Version Description
Download this release
Release Info
| Developer | gutenbergplugin |
| Plugin | |
| Version | 11.9.0 |
| Comparing to | |
| See all releases | |
Code changes from version 11.8.3 to 11.9.0
- README.md +3 -1
- build/api-fetch/index.js +17 -28
- build/api-fetch/index.min.asset.php +1 -1
- build/api-fetch/index.min.js +1 -1
- build/block-editor/index.js +2583 -1712
- build/block-editor/index.min.asset.php +1 -1
- build/block-editor/index.min.js +58 -55
README.md
CHANGED
|
@@ -19,6 +19,8 @@ The block editor introduces a modular approach to pages and posts: each piece of
|
|
| 19 |
|
| 20 |
The block editor first became available in December 2018, and we're still hard at work refining the experience, creating more and better blocks, and laying the groundwork for the next three phases of work. The Gutenberg plugin gives you the latest version of the block editor so you can join us in testing bleeding-edge features, start playing with blocks, and maybe get inspired to build your own.
|
| 21 |
|
|
|
|
|
|
|
| 22 |
## Getting Started
|
| 23 |
|
| 24 |
Get hands on: check out the [block editor live demo](https://wordpress.org/gutenberg/) to play with a test instance of the editor.
|
|
@@ -35,7 +37,7 @@ Get hands on: check out the [block editor live demo](https://wordpress.org/guten
|
|
| 35 |
|
| 36 |
Extending and customizing is at the heart of the WordPress platform, this is no different for the Gutenberg project. The editor and future products can be extended by third-party developers using plugins.
|
| 37 |
|
| 38 |
-
Review the [Create a Block tutorial](/docs/getting-started/
|
| 39 |
|
| 40 |
### Contribute to Gutenberg
|
| 41 |
|
| 19 |
|
| 20 |
The block editor first became available in December 2018, and we're still hard at work refining the experience, creating more and better blocks, and laying the groundwork for the next three phases of work. The Gutenberg plugin gives you the latest version of the block editor so you can join us in testing bleeding-edge features, start playing with blocks, and maybe get inspired to build your own.
|
| 21 |
|
| 22 |
+
Check out the [Ways to keep up with Gutenberg & Full Site Editing (FSE)](https://make.wordpress.org/core/2020/05/20/ways-to-keep-up-with-full-site-editing-fse/)
|
| 23 |
+
|
| 24 |
## Getting Started
|
| 25 |
|
| 26 |
Get hands on: check out the [block editor live demo](https://wordpress.org/gutenberg/) to play with a test instance of the editor.
|
| 37 |
|
| 38 |
Extending and customizing is at the heart of the WordPress platform, this is no different for the Gutenberg project. The editor and future products can be extended by third-party developers using plugins.
|
| 39 |
|
| 40 |
+
Review the [Create a Block tutorial](/docs/getting-started/create-block/README.md) for the fastest way to get started extending the block editor. See the [Developer Documentation](https://developer.wordpress.org/block-editor/#develop-for-the-block-editor) for extensive tutorials, documentation, and API references.
|
| 41 |
|
| 42 |
### Contribute to Gutenberg
|
| 43 |
|
build/api-fetch/index.js
CHANGED
|
@@ -134,33 +134,13 @@ const createRootURLMiddleware = rootURL => (options, next) => {
|
|
| 134 |
|
| 135 |
/* harmony default export */ var root_url = (createRootURLMiddleware);
|
| 136 |
//# sourceMappingURL=root-url.js.map
|
|
|
|
|
|
|
| 137 |
;// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/preloading.js
|
| 138 |
/**
|
| 139 |
-
*
|
| 140 |
-
* will be treated as identical, regardless of order they appear in the original
|
| 141 |
-
* text.
|
| 142 |
-
*
|
| 143 |
-
* @param {string} path Original path.
|
| 144 |
-
*
|
| 145 |
-
* @return {string} Normalized path.
|
| 146 |
*/
|
| 147 |
-
function getStablePath(path) {
|
| 148 |
-
const splitted = path.split('?');
|
| 149 |
-
const query = splitted[1];
|
| 150 |
-
const base = splitted[0];
|
| 151 |
-
|
| 152 |
-
if (!query) {
|
| 153 |
-
return base;
|
| 154 |
-
} // 'b=1&c=2&a=5'
|
| 155 |
|
| 156 |
-
|
| 157 |
-
return base + '?' + query // [ 'b=1', 'c=2', 'a=5' ]
|
| 158 |
-
.split('&') // [ [ 'b, '1' ], [ 'c', '2' ], [ 'a', '5' ] ]
|
| 159 |
-
.map(entry => entry.split('=')) // [ [ 'a', '5' ], [ 'b, '1' ], [ 'c', '2' ] ]
|
| 160 |
-
.sort((a, b) => a[0].localeCompare(b[0])) // [ 'a=5', 'b=1', 'c=2' ]
|
| 161 |
-
.map(pair => pair.join('=')) // 'a=5&b=1&c=2'
|
| 162 |
-
.join('&');
|
| 163 |
-
}
|
| 164 |
/**
|
| 165 |
* @param {Record<string, any>} preloadedData
|
| 166 |
* @return {import('../types').APIFetchMiddleware} Preloading middleware.
|
|
@@ -168,7 +148,7 @@ function getStablePath(path) {
|
|
| 168 |
|
| 169 |
function createPreloadingMiddleware(preloadedData) {
|
| 170 |
const cache = Object.keys(preloadedData).reduce((result, path) => {
|
| 171 |
-
result[
|
| 172 |
return result;
|
| 173 |
},
|
| 174 |
/** @type {Record<string, any>} */
|
|
@@ -177,10 +157,21 @@ function createPreloadingMiddleware(preloadedData) {
|
|
| 177 |
const {
|
| 178 |
parse = true
|
| 179 |
} = options;
|
|
|
|
| 180 |
|
| 181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
const method = options.method || 'GET';
|
| 183 |
-
const path =
|
| 184 |
|
| 185 |
if ('GET' === method && cache[path]) {
|
| 186 |
const cacheData = cache[path]; // Unsetting the cache key ensures that the data is only used a single time
|
|
@@ -205,8 +196,6 @@ function createPreloadingMiddleware(preloadedData) {
|
|
| 205 |
|
| 206 |
/* harmony default export */ var preloading = (createPreloadingMiddleware);
|
| 207 |
//# sourceMappingURL=preloading.js.map
|
| 208 |
-
;// CONCATENATED MODULE: external ["wp","url"]
|
| 209 |
-
var external_wp_url_namespaceObject = window["wp"]["url"];
|
| 210 |
;// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/fetch-all-middleware.js
|
| 211 |
/**
|
| 212 |
* WordPress dependencies
|
| 134 |
|
| 135 |
/* harmony default export */ var root_url = (createRootURLMiddleware);
|
| 136 |
//# sourceMappingURL=root-url.js.map
|
| 137 |
+
;// CONCATENATED MODULE: external ["wp","url"]
|
| 138 |
+
var external_wp_url_namespaceObject = window["wp"]["url"];
|
| 139 |
;// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/preloading.js
|
| 140 |
/**
|
| 141 |
+
* WordPress dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
/**
|
| 145 |
* @param {Record<string, any>} preloadedData
|
| 146 |
* @return {import('../types').APIFetchMiddleware} Preloading middleware.
|
| 148 |
|
| 149 |
function createPreloadingMiddleware(preloadedData) {
|
| 150 |
const cache = Object.keys(preloadedData).reduce((result, path) => {
|
| 151 |
+
result[(0,external_wp_url_namespaceObject.normalizePath)(path)] = preloadedData[path];
|
| 152 |
return result;
|
| 153 |
},
|
| 154 |
/** @type {Record<string, any>} */
|
| 157 |
const {
|
| 158 |
parse = true
|
| 159 |
} = options;
|
| 160 |
+
/** @type {string | void} */
|
| 161 |
|
| 162 |
+
let rawPath = options.path;
|
| 163 |
+
|
| 164 |
+
if (!rawPath && options.url) {
|
| 165 |
+
const pathFromQuery = (0,external_wp_url_namespaceObject.getQueryArg)(options.url, 'rest_route');
|
| 166 |
+
|
| 167 |
+
if (typeof pathFromQuery === 'string') {
|
| 168 |
+
rawPath = pathFromQuery;
|
| 169 |
+
}
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
if (typeof rawPath === 'string') {
|
| 173 |
const method = options.method || 'GET';
|
| 174 |
+
const path = (0,external_wp_url_namespaceObject.normalizePath)(rawPath);
|
| 175 |
|
| 176 |
if ('GET' === method && cache[path]) {
|
| 177 |
const cacheData = cache[path]; // Unsetting the cache key ensures that the data is only used a single time
|
| 196 |
|
| 197 |
/* harmony default export */ var preloading = (createPreloadingMiddleware);
|
| 198 |
//# sourceMappingURL=preloading.js.map
|
|
|
|
|
|
|
| 199 |
;// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/fetch-all-middleware.js
|
| 200 |
/**
|
| 201 |
* WordPress dependencies
|
build/api-fetch/index.min.asset.php
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
<?php return array('dependencies' => array('wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => '
|
| 1 |
+
<?php return array('dependencies' => array('wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => '09e0de7a122c812b31afac4712ad77c9');
|
build/api-fetch/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
!function(){"use strict";var e={d:function(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:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{default:function(){return
|
| 1 |
+
!function(){"use strict";var e={d:function(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:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{default:function(){return P}});var r=window.wp.i18n,n=(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})},o=window.wp.url;const a=({path:e,url:t,...r},n)=>({...r,url:t&&(0,o.addQueryArgs)(t,n),path:e&&(0,o.addQueryArgs)(e,n)}),s=e=>e.json?e.json():Promise.reject(e),i=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};var c=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 P({...a(e,{per_page:100}),parse:!1}),n=await s(r);if(!Array.isArray(n))return n;let o=i(r);if(!o)return n;let c=[].concat(n);for(;o;){const t=await P({...e,path:void 0,url:o,parse:!1}),r=await s(t);c=c.concat(r),o=i(t)}return c};const d=new Set(["PATCH","PUT","DELETE"]),p="GET",u=(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=>l(e,t)));function l(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 h={Accept:"application/json, */*;q=0.1"},f={credentials:"include"},w=[(e,t)=>("string"!=typeof e.url||(0,o.hasQueryArg)(e.url,"_locale")||(e.url=(0,o.addQueryArgs)(e.url,{_locale:"user"})),"string"!=typeof e.path||(0,o.hasQueryArg)(e.path,"_locale")||(e.path=(0,o.addQueryArgs)(e.path,{_locale:"user"})),t(e)),n,(e,t)=>{const{method:r=p}=e;return d.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},c],m=e=>{if(e.status>=200&&e.status<300)return e;throw e};let g=e=>{const{url:t,path:n,data:o,parse:a=!0,...s}=e;let{body:i,headers:c}=e;return c={...h,...c},o&&(i=JSON.stringify(o),c["Content-Type"]="application/json"),window.fetch(t||n||window.location.href,{...f,...s,body:i,headers:c}).then((e=>Promise.resolve(e).then(m).catch((e=>l(e,a))).then((e=>u(e,a)))),(e=>{if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:(0,r.__)("You are probably offline.")}}))};function y(e){return w.reduceRight(((e,t)=>r=>t(r,e)),g)(e).catch((t=>"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(y.nonceEndpoint).then(m).then((e=>e.text())).then((t=>(y.nonceMiddleware.nonce=t,y(e))))))}y.use=function(e){w.unshift(e)},y.setFetchHandler=function(e){g=e},y.createNonceMiddleware=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},y.createPreloadingMiddleware=function(e){const t=Object.keys(e).reduce(((t,r)=>(t[(0,o.normalizePath)(r)]=e[r],t)),{});return(e,r)=>{const{parse:n=!0}=e;let a=e.path;if(!a&&e.url){const t=(0,o.getQueryArg)(e.url,"rest_route");"string"==typeof t&&(a=t)}if("string"==typeof a){const r=e.method||"GET",s=(0,o.normalizePath)(a);if("GET"===r&&t[s]){const e=t[s];return delete t[s],Promise.resolve(n?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}if("OPTIONS"===r&&t[r]&&t[r][s]){const e=t[r][s];return delete t[r][s],Promise.resolve(n?e.body:e)}}return r(e)}},y.createRootURLMiddleware=e=>(t,r)=>n(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})})),y.fetchAllMiddleware=c,y.mediaUploadMiddleware=(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))):l(t,e.parse)})).then((t=>u(t,e.parse)))};var P=y;(window.wp=window.wp||{}).apiFetch=t.default}();
|
build/block-editor/index.js
CHANGED
|
@@ -2154,7 +2154,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
| 2154 |
"BlockEditorKeyboardShortcuts": function() { return /* reexport */ keyboard_shortcuts; },
|
| 2155 |
"BlockEditorProvider": function() { return /* reexport */ provider; },
|
| 2156 |
"BlockFormatControls": function() { return /* reexport */ BlockFormatControls; },
|
| 2157 |
-
"BlockIcon": function() { return /* reexport */
|
| 2158 |
"BlockInspector": function() { return /* reexport */ block_inspector; },
|
| 2159 |
"BlockList": function() { return /* reexport */ BlockList; },
|
| 2160 |
"BlockMover": function() { return /* reexport */ block_mover; },
|
|
@@ -2238,12 +2238,13 @@ __webpack_require__.d(__webpack_exports__, {
|
|
| 2238 |
"__experimentalPanelColorGradientSettings": function() { return /* reexport */ panel_color_gradient_settings; },
|
| 2239 |
"__experimentalPreviewOptions": function() { return /* reexport */ PreviewOptions; },
|
| 2240 |
"__experimentalResponsiveBlockControl": function() { return /* reexport */ responsive_block_control; },
|
|
|
|
|
|
|
| 2241 |
"__experimentalUnitControl": function() { return /* reexport */ UnitControl; },
|
| 2242 |
"__experimentalUseBorderProps": function() { return /* reexport */ useBorderProps; },
|
| 2243 |
"__experimentalUseColorProps": function() { return /* reexport */ useColorProps; },
|
| 2244 |
"__experimentalUseCustomSides": function() { return /* reexport */ useCustomSides; },
|
| 2245 |
"__experimentalUseGradient": function() { return /* reexport */ __experimentalUseGradient; },
|
| 2246 |
-
"__experimentalUseInnerBlocksProps": function() { return /* reexport */ useInnerBlocksProps; },
|
| 2247 |
"__experimentalUseNoRecursiveRenders": function() { return /* reexport */ useNoRecursiveRenders; },
|
| 2248 |
"__experimentalUseResizeCanvas": function() { return /* reexport */ useResizeCanvas; },
|
| 2249 |
"__unstableBlockSettingsMenuFirstItem": function() { return /* reexport */ block_settings_menu_first_item; },
|
|
@@ -2274,6 +2275,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
| 2274 |
"useBlockEditContext": function() { return /* reexport */ useBlockEditContext; },
|
| 2275 |
"useBlockProps": function() { return /* reexport */ useBlockProps; },
|
| 2276 |
"useCachedTruthy": function() { return /* reexport */ useCachedTruthy; },
|
|
|
|
| 2277 |
"useSetting": function() { return /* reexport */ useSetting; },
|
| 2278 |
"validateThemeColors": function() { return /* reexport */ validateThemeColors; },
|
| 2279 |
"validateThemeGradients": function() { return /* reexport */ validateThemeGradients; },
|
|
@@ -2293,7 +2295,6 @@ __webpack_require__.d(selectors_namespaceObject, {
|
|
| 2293 |
"__experimentalGetDirectInsertBlock": function() { return __experimentalGetDirectInsertBlock; },
|
| 2294 |
"__experimentalGetLastBlockAttributeChanges": function() { return __experimentalGetLastBlockAttributeChanges; },
|
| 2295 |
"__experimentalGetParsedPattern": function() { return __experimentalGetParsedPattern; },
|
| 2296 |
-
"__experimentalGetParsedReusableBlock": function() { return __experimentalGetParsedReusableBlock; },
|
| 2297 |
"__experimentalGetPatternTransformItems": function() { return __experimentalGetPatternTransformItems; },
|
| 2298 |
"__experimentalGetPatternsByBlockTypes": function() { return __experimentalGetPatternsByBlockTypes; },
|
| 2299 |
"__experimentalGetReusableBlockTitle": function() { return __experimentalGetReusableBlockTitle; },
|
|
@@ -2383,7 +2384,6 @@ var actions_namespaceObject = {};
|
|
| 2383 |
__webpack_require__.r(actions_namespaceObject);
|
| 2384 |
__webpack_require__.d(actions_namespaceObject, {
|
| 2385 |
"__unstableMarkAutomaticChange": function() { return __unstableMarkAutomaticChange; },
|
| 2386 |
-
"__unstableMarkAutomaticChangeFinal": function() { return __unstableMarkAutomaticChangeFinal; },
|
| 2387 |
"__unstableMarkLastChangeAsPersistent": function() { return __unstableMarkLastChangeAsPersistent; },
|
| 2388 |
"__unstableMarkNextChangeAsNotPersistent": function() { return __unstableMarkNextChangeAsNotPersistent; },
|
| 2389 |
"__unstableSaveReusableBlock": function() { return __unstableSaveReusableBlock; },
|
|
@@ -2964,35 +2964,35 @@ function buildBlockTree(state, blocks) {
|
|
| 2964 |
return result;
|
| 2965 |
}
|
| 2966 |
|
| 2967 |
-
function updateParentInnerBlocksInTree(state, tree, updatedClientIds) {
|
| 2968 |
-
const
|
| 2969 |
const controlledParents = new Set();
|
| 2970 |
|
| 2971 |
for (const clientId of updatedClientIds) {
|
| 2972 |
-
let current = clientId;
|
| 2973 |
|
| 2974 |
do {
|
| 2975 |
if (state.controlledInnerBlocks[current]) {
|
| 2976 |
-
|
| 2977 |
-
|
|
|
|
| 2978 |
break;
|
| 2979 |
} else {
|
| 2980 |
-
|
| 2981 |
-
|
| 2982 |
-
|
| 2983 |
-
|
| 2984 |
-
current = state.parents[current];
|
| 2985 |
} while (current !== undefined);
|
| 2986 |
} // To make sure the order of assignments doesn't matter,
|
| 2987 |
// we first create empty objects and mutates the inner blocks later.
|
| 2988 |
|
| 2989 |
|
| 2990 |
-
for (const clientId of
|
| 2991 |
tree[clientId] = { ...tree[clientId]
|
| 2992 |
};
|
| 2993 |
}
|
| 2994 |
|
| 2995 |
-
for (const clientId of
|
| 2996 |
tree[clientId].innerBlocks = (state.order[clientId] || []).map(subClientId => tree[subClientId]);
|
| 2997 |
} // Controlled parent blocks, need a dedicated key for their inner blocks
|
| 2998 |
// to be used when doing getBlocks( controlledBlockClientId ).
|
|
@@ -3033,16 +3033,17 @@ const withBlockTree = reducer => (state = {}, action) => {
|
|
| 3033 |
const subTree = buildBlockTree(newState, action.blocks);
|
| 3034 |
newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
|
| 3035 |
...subTree
|
| 3036 |
-
}, action.rootClientId ? [action.rootClientId] : ['']);
|
| 3037 |
break;
|
| 3038 |
}
|
| 3039 |
|
| 3040 |
case 'UPDATE_BLOCK':
|
| 3041 |
newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
|
| 3042 |
-
[action.clientId]: { ...newState.
|
|
|
|
| 3043 |
attributes: newState.attributes[action.clientId]
|
| 3044 |
}
|
| 3045 |
-
}, [action.clientId]);
|
| 3046 |
break;
|
| 3047 |
|
| 3048 |
case 'UPDATE_BLOCK_ATTRIBUTES':
|
|
@@ -3055,7 +3056,7 @@ const withBlockTree = reducer => (state = {}, action) => {
|
|
| 3055 |
}, {});
|
| 3056 |
newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
|
| 3057 |
...newSubTree
|
| 3058 |
-
}, action.clientIds);
|
| 3059 |
break;
|
| 3060 |
}
|
| 3061 |
|
|
@@ -3064,7 +3065,7 @@ const withBlockTree = reducer => (state = {}, action) => {
|
|
| 3064 |
const subTree = buildBlockTree(newState, action.blocks);
|
| 3065 |
newState.tree = updateParentInnerBlocksInTree(newState, { ...(0,external_lodash_namespaceObject.omit)(newState.tree, action.replacedClientIds.concat(action.replacedClientIds.map(clientId => 'controlled||' + clientId))),
|
| 3066 |
...subTree
|
| 3067 |
-
}, action.blocks.map(b => b.clientId)); // If there are no replaced blocks, it means we're removing blocks so we need to update their parent.
|
| 3068 |
|
| 3069 |
const parentsOfRemovedBlocks = [];
|
| 3070 |
|
|
@@ -3074,7 +3075,7 @@ const withBlockTree = reducer => (state = {}, action) => {
|
|
| 3074 |
}
|
| 3075 |
}
|
| 3076 |
|
| 3077 |
-
newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, parentsOfRemovedBlocks);
|
| 3078 |
break;
|
| 3079 |
}
|
| 3080 |
|
|
@@ -3087,7 +3088,7 @@ const withBlockTree = reducer => (state = {}, action) => {
|
|
| 3087 |
}
|
| 3088 |
}
|
| 3089 |
|
| 3090 |
-
newState.tree = updateParentInnerBlocksInTree(newState, (0,external_lodash_namespaceObject.omit)(newState.tree, action.removedClientIds.concat(action.removedClientIds.map(clientId => 'controlled||' + clientId))), parentsOfRemovedBlocks);
|
| 3091 |
break;
|
| 3092 |
|
| 3093 |
case 'MOVE_BLOCKS_TO_POSITION':
|
|
@@ -3106,7 +3107,7 @@ const withBlockTree = reducer => (state = {}, action) => {
|
|
| 3106 |
updatedBlockUids.push('');
|
| 3107 |
}
|
| 3108 |
|
| 3109 |
-
newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, updatedBlockUids);
|
| 3110 |
break;
|
| 3111 |
}
|
| 3112 |
|
|
@@ -3114,7 +3115,7 @@ const withBlockTree = reducer => (state = {}, action) => {
|
|
| 3114 |
case 'MOVE_BLOCKS_DOWN':
|
| 3115 |
{
|
| 3116 |
const updatedBlockUids = [action.rootClientId ? action.rootClientId : ''];
|
| 3117 |
-
newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, updatedBlockUids);
|
| 3118 |
break;
|
| 3119 |
}
|
| 3120 |
|
|
@@ -3131,7 +3132,7 @@ const withBlockTree = reducer => (state = {}, action) => {
|
|
| 3131 |
};
|
| 3132 |
return result;
|
| 3133 |
}, {})
|
| 3134 |
-
}, updatedBlockUids);
|
| 3135 |
}
|
| 3136 |
}
|
| 3137 |
|
|
@@ -6183,18 +6184,48 @@ const getInserterItems = rememo((state, rootClientId = null) => {
|
|
| 6183 |
const buildBlockTypeInserterItem = buildBlockTypeItem(state, {
|
| 6184 |
buildScope: 'inserter'
|
| 6185 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6186 |
|
| 6187 |
const buildReusableBlockInserterItem = reusableBlock => {
|
| 6188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6189 |
|
| 6190 |
-
|
|
|
|
|
|
|
| 6191 |
|
| 6192 |
-
|
|
|
|
|
|
|
| 6193 |
|
| 6194 |
-
|
| 6195 |
-
|
|
|
|
|
|
|
| 6196 |
}
|
| 6197 |
|
|
|
|
| 6198 |
const {
|
| 6199 |
time,
|
| 6200 |
count = 0
|
|
@@ -6207,7 +6238,7 @@ const getInserterItems = rememo((state, rootClientId = null) => {
|
|
| 6207 |
ref: reusableBlock.id
|
| 6208 |
},
|
| 6209 |
title: reusableBlock.title.raw,
|
| 6210 |
-
icon
|
| 6211 |
category: 'reusable',
|
| 6212 |
keywords: [],
|
| 6213 |
isDisabled: false,
|
|
@@ -6418,7 +6449,9 @@ const getAllAllowedPatterns = rememo(state => {
|
|
| 6418 |
const {
|
| 6419 |
allowedBlockTypes
|
| 6420 |
} = getSettings(state);
|
| 6421 |
-
const parsedPatterns = patterns.
|
|
|
|
|
|
|
| 6422 |
name
|
| 6423 |
}) => __experimentalGetParsedPattern(state, name));
|
| 6424 |
const allowedPatterns = parsedPatterns.filter(({
|
|
@@ -6575,26 +6608,6 @@ const __experimentalGetBlockListSettingsForBlocks = rememo((state, clientIds = [
|
|
| 6575 |
};
|
| 6576 |
}, {});
|
| 6577 |
}, state => [state.blockListSettings]);
|
| 6578 |
-
/**
|
| 6579 |
-
* Returns the parsed block saved as shared block with the given ID.
|
| 6580 |
-
*
|
| 6581 |
-
* @param {Object} state Global application state.
|
| 6582 |
-
* @param {number|string} ref The shared block's ID.
|
| 6583 |
-
*
|
| 6584 |
-
* @return {Object} The parsed block.
|
| 6585 |
-
*/
|
| 6586 |
-
|
| 6587 |
-
const __experimentalGetParsedReusableBlock = rememo((state, ref) => {
|
| 6588 |
-
const reusableBlock = (0,external_lodash_namespaceObject.find)(getReusableBlocks(state), block => block.id === ref);
|
| 6589 |
-
|
| 6590 |
-
if (!reusableBlock) {
|
| 6591 |
-
return null;
|
| 6592 |
-
} // Only reusableBlock.content.raw should be used here, `reusableBlock.content` is a
|
| 6593 |
-
// workaround until #22127 is fixed.
|
| 6594 |
-
|
| 6595 |
-
|
| 6596 |
-
return (0,external_wp_blocks_namespaceObject.parse)(typeof reusableBlock.content.raw === 'string' ? reusableBlock.content.raw : reusableBlock.content);
|
| 6597 |
-
}, state => [getReusableBlocks(state)]);
|
| 6598 |
/**
|
| 6599 |
* Returns the title of a given reusable block
|
| 6600 |
*
|
|
@@ -6774,42 +6787,6 @@ var external_wp_richText_namespaceObject = window["wp"]["richText"];
|
|
| 6774 |
;// CONCATENATED MODULE: external ["wp","deprecated"]
|
| 6775 |
var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
|
| 6776 |
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
|
| 6777 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/store/controls.js
|
| 6778 |
-
/**
|
| 6779 |
-
* WordPress dependencies
|
| 6780 |
-
*/
|
| 6781 |
-
|
| 6782 |
-
/**
|
| 6783 |
-
* Internal dependencies
|
| 6784 |
-
*/
|
| 6785 |
-
|
| 6786 |
-
|
| 6787 |
-
const __unstableMarkAutomaticChangeFinalControl = function () {
|
| 6788 |
-
return {
|
| 6789 |
-
type: 'MARK_AUTOMATIC_CHANGE_FINAL_CONTROL'
|
| 6790 |
-
};
|
| 6791 |
-
};
|
| 6792 |
-
const controls = {
|
| 6793 |
-
SLEEP({
|
| 6794 |
-
duration
|
| 6795 |
-
}) {
|
| 6796 |
-
return new Promise(resolve => {
|
| 6797 |
-
setTimeout(resolve, duration);
|
| 6798 |
-
});
|
| 6799 |
-
},
|
| 6800 |
-
|
| 6801 |
-
MARK_AUTOMATIC_CHANGE_FINAL_CONTROL: (0,external_wp_data_namespaceObject.createRegistryControl)(registry => () => {
|
| 6802 |
-
const {
|
| 6803 |
-
requestIdleCallback = callback => setTimeout(callback, 100)
|
| 6804 |
-
} = window;
|
| 6805 |
-
requestIdleCallback(() => registry.dispatch(store).__unstableMarkAutomaticChangeFinal());
|
| 6806 |
-
})
|
| 6807 |
-
};
|
| 6808 |
-
/* harmony default export */ var store_controls = (controls);
|
| 6809 |
-
//# sourceMappingURL=controls.js.map
|
| 6810 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/store/constants.js
|
| 6811 |
-
const STORE_NAME = 'core/block-editor';
|
| 6812 |
-
//# sourceMappingURL=constants.js.map
|
| 6813 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/store/actions.js
|
| 6814 |
/**
|
| 6815 |
* External dependencies
|
|
@@ -6824,54 +6801,55 @@ const STORE_NAME = 'core/block-editor';
|
|
| 6824 |
|
| 6825 |
|
| 6826 |
|
| 6827 |
-
|
| 6828 |
-
/**
|
| 6829 |
-
* Internal dependencies
|
| 6830 |
-
*/
|
| 6831 |
-
|
| 6832 |
-
|
| 6833 |
-
|
| 6834 |
/**
|
| 6835 |
-
*
|
| 6836 |
-
* are no other blocks at the root of the editor. This
|
| 6837 |
* in actions which may result in no blocks remaining in the editor (removal,
|
| 6838 |
* replacement, etc).
|
| 6839 |
*/
|
| 6840 |
|
| 6841 |
-
|
| 6842 |
-
|
|
|
|
|
|
|
|
|
|
| 6843 |
// always a default block if the last of the blocks have been removed.
|
|
|
|
| 6844 |
|
| 6845 |
-
if (count
|
| 6846 |
-
|
| 6847 |
-
|
| 6848 |
-
|
| 6849 |
-
|
| 6850 |
-
// prevent it from being lost though.
|
| 6851 |
|
| 6852 |
-
if (__unstableHasCustomAppender) {
|
| 6853 |
-
return;
|
| 6854 |
-
}
|
| 6855 |
|
| 6856 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6857 |
}
|
| 6858 |
-
|
|
|
|
|
|
|
| 6859 |
/**
|
| 6860 |
-
*
|
| 6861 |
-
*
|
| 6862 |
-
* content reflected as an edit in state.
|
| 6863 |
*
|
| 6864 |
* @param {Array} blocks Array of blocks.
|
| 6865 |
*/
|
| 6866 |
|
| 6867 |
|
| 6868 |
-
|
| 6869 |
-
|
|
|
|
|
|
|
| 6870 |
type: 'RESET_BLOCKS',
|
| 6871 |
blocks
|
| 6872 |
-
};
|
| 6873 |
-
|
| 6874 |
-
}
|
| 6875 |
/**
|
| 6876 |
* Block validity is a function of blocks state (at the point of a
|
| 6877 |
* reset) and the template setting. As a compromise to its placement
|
|
@@ -6881,20 +6859,23 @@ function* resetBlocks(blocks) {
|
|
| 6881 |
* @param {Array} blocks Array of blocks.
|
| 6882 |
*/
|
| 6883 |
|
| 6884 |
-
|
| 6885 |
-
|
| 6886 |
-
|
|
|
|
|
|
|
|
|
|
| 6887 |
// as default values only.
|
| 6888 |
|
| 6889 |
const isBlocksValidToTemplate = !template || templateLock !== 'all' || (0,external_wp_blocks_namespaceObject.doBlocksMatchTemplate)(blocks, template); // Update if validity has changed.
|
| 6890 |
|
| 6891 |
-
const isValidTemplate =
|
| 6892 |
|
| 6893 |
if (isBlocksValidToTemplate !== isValidTemplate) {
|
| 6894 |
-
|
| 6895 |
return isBlocksValidToTemplate;
|
| 6896 |
}
|
| 6897 |
-
}
|
| 6898 |
/**
|
| 6899 |
* A block selection object.
|
| 6900 |
*
|
|
@@ -6951,8 +6932,7 @@ function receiveBlocks(blocks) {
|
|
| 6951 |
};
|
| 6952 |
}
|
| 6953 |
/**
|
| 6954 |
-
*
|
| 6955 |
-
* attributes with the specified client IDs have been updated.
|
| 6956 |
*
|
| 6957 |
* @param {string|string[]} clientIds Block client IDs.
|
| 6958 |
* @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if
|
|
@@ -6970,8 +6950,7 @@ function updateBlockAttributes(clientIds, attributes, uniqueByBlock = false) {
|
|
| 6970 |
};
|
| 6971 |
}
|
| 6972 |
/**
|
| 6973 |
-
*
|
| 6974 |
-
* specified client ID has been updated.
|
| 6975 |
*
|
| 6976 |
* @param {string} clientId Block client ID.
|
| 6977 |
* @param {Object} updates Block attributes to be merged.
|
|
@@ -7016,14 +6995,16 @@ function selectBlock(clientId, initialPosition = 0) {
|
|
| 7016 |
* @param {string} clientId Block client ID.
|
| 7017 |
*/
|
| 7018 |
|
| 7019 |
-
|
| 7020 |
-
|
|
|
|
|
|
|
|
|
|
| 7021 |
|
| 7022 |
if (previousBlockClientId) {
|
| 7023 |
-
|
| 7024 |
-
return [previousBlockClientId];
|
| 7025 |
}
|
| 7026 |
-
}
|
| 7027 |
/**
|
| 7028 |
* Yields action objects used in signalling that the block following the given
|
| 7029 |
* clientId should be selected.
|
|
@@ -7031,16 +7012,18 @@ function* selectPreviousBlock(clientId) {
|
|
| 7031 |
* @param {string} clientId Block client ID.
|
| 7032 |
*/
|
| 7033 |
|
| 7034 |
-
|
| 7035 |
-
|
|
|
|
|
|
|
|
|
|
| 7036 |
|
| 7037 |
if (nextBlockClientId) {
|
| 7038 |
-
|
| 7039 |
-
return [nextBlockClientId];
|
| 7040 |
}
|
| 7041 |
-
}
|
| 7042 |
/**
|
| 7043 |
-
*
|
| 7044 |
*
|
| 7045 |
* @return {Object} Action object.
|
| 7046 |
*/
|
|
@@ -7051,7 +7034,7 @@ function startMultiSelect() {
|
|
| 7051 |
};
|
| 7052 |
}
|
| 7053 |
/**
|
| 7054 |
-
*
|
| 7055 |
*
|
| 7056 |
* @return {Object} Action object.
|
| 7057 |
*/
|
|
@@ -7062,32 +7045,35 @@ function stopMultiSelect() {
|
|
| 7062 |
};
|
| 7063 |
}
|
| 7064 |
/**
|
| 7065 |
-
*
|
| 7066 |
*
|
| 7067 |
* @param {string} start First block of the multi selection.
|
| 7068 |
* @param {string} end Last block of the multiselection.
|
| 7069 |
*/
|
| 7070 |
|
| 7071 |
-
|
| 7072 |
-
|
| 7073 |
-
|
|
|
|
|
|
|
|
|
|
| 7074 |
|
| 7075 |
if (startBlockRootClientId !== endBlockRootClientId) {
|
| 7076 |
return;
|
| 7077 |
}
|
| 7078 |
|
| 7079 |
-
|
| 7080 |
type: 'MULTI_SELECT',
|
| 7081 |
start,
|
| 7082 |
end
|
| 7083 |
-
};
|
| 7084 |
-
const blockCount =
|
| 7085 |
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)(
|
| 7086 |
/* translators: %s: number of selected blocks */
|
| 7087 |
(0,external_wp_i18n_namespaceObject._n)('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive');
|
| 7088 |
-
}
|
| 7089 |
/**
|
| 7090 |
-
*
|
| 7091 |
*
|
| 7092 |
* @return {Object} Action object.
|
| 7093 |
*/
|
|
@@ -7098,7 +7084,7 @@ function clearSelectedBlock() {
|
|
| 7098 |
};
|
| 7099 |
}
|
| 7100 |
/**
|
| 7101 |
-
*
|
| 7102 |
*
|
| 7103 |
* @param {boolean} [isSelectionEnabled=true] Whether block selection should
|
| 7104 |
* be enabled.
|
|
@@ -7150,8 +7136,7 @@ function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
|
|
| 7150 |
/* eslint-disable jsdoc/valid-types */
|
| 7151 |
|
| 7152 |
/**
|
| 7153 |
-
*
|
| 7154 |
-
* one or more replacement blocks.
|
| 7155 |
*
|
| 7156 |
* @param {(string|string[])} clientIds Block client ID(s) to replace.
|
| 7157 |
* @param {(Object|Object[])} blocks Replacement block(s).
|
|
@@ -7159,26 +7144,29 @@ function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
|
|
| 7159 |
* @param {0|-1|null} initialPosition Index of caret after in the selected block after the operation.
|
| 7160 |
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
| 7161 |
*
|
| 7162 |
-
* @
|
| 7163 |
*/
|
| 7164 |
|
| 7165 |
|
| 7166 |
-
|
|
|
|
|
|
|
|
|
|
| 7167 |
/* eslint-enable jsdoc/valid-types */
|
| 7168 |
clientIds = (0,external_lodash_namespaceObject.castArray)(clientIds);
|
| 7169 |
-
blocks = getBlocksWithDefaultStylesApplied((0,external_lodash_namespaceObject.castArray)(blocks),
|
| 7170 |
-
const rootClientId =
|
| 7171 |
|
| 7172 |
for (let index = 0; index < blocks.length; index++) {
|
| 7173 |
const block = blocks[index];
|
| 7174 |
-
const canInsertBlock =
|
| 7175 |
|
| 7176 |
if (!canInsertBlock) {
|
| 7177 |
return;
|
| 7178 |
}
|
| 7179 |
}
|
| 7180 |
|
| 7181 |
-
|
| 7182 |
type: 'REPLACE_BLOCKS',
|
| 7183 |
clientIds,
|
| 7184 |
blocks,
|
|
@@ -7186,12 +7174,11 @@ function* replaceBlocks(clientIds, blocks, indexToSelect, initialPosition = 0, m
|
|
| 7186 |
indexToSelect,
|
| 7187 |
initialPosition,
|
| 7188 |
meta
|
| 7189 |
-
};
|
| 7190 |
-
|
| 7191 |
-
}
|
| 7192 |
/**
|
| 7193 |
-
*
|
| 7194 |
-
* with one or more replacement blocks.
|
| 7195 |
*
|
| 7196 |
* @param {(string|string[])} clientId Block client ID to replace.
|
| 7197 |
* @param {(Object|Object[])} block Replacement block(s).
|
|
@@ -7211,87 +7198,83 @@ function replaceBlock(clientId, block) {
|
|
| 7211 |
* @return {Function} Action creator.
|
| 7212 |
*/
|
| 7213 |
|
| 7214 |
-
|
| 7215 |
-
|
| 7216 |
-
|
|
|
|
|
|
|
|
|
|
| 7217 |
|
| 7218 |
-
|
| 7219 |
-
|
| 7220 |
-
|
| 7221 |
|
| 7222 |
-
|
| 7223 |
-
|
| 7224 |
-
|
| 7225 |
-
|
| 7226 |
-
|
| 7227 |
-
|
| 7228 |
-
}
|
| 7229 |
|
| 7230 |
const moveBlocksDown = createOnMove('MOVE_BLOCKS_DOWN');
|
| 7231 |
const moveBlocksUp = createOnMove('MOVE_BLOCKS_UP');
|
| 7232 |
/**
|
| 7233 |
-
*
|
| 7234 |
-
* a new position.
|
| 7235 |
*
|
| 7236 |
* @param {?string} clientIds The client IDs of the blocks.
|
| 7237 |
* @param {?string} fromRootClientId Root client ID source.
|
| 7238 |
* @param {?string} toRootClientId Root client ID destination.
|
| 7239 |
* @param {number} index The index to move the blocks to.
|
| 7240 |
-
*
|
| 7241 |
-
* @yield {Object} Action object.
|
| 7242 |
*/
|
| 7243 |
|
| 7244 |
-
|
| 7245 |
-
|
| 7246 |
-
|
|
|
|
|
|
|
| 7247 |
|
| 7248 |
if (!canMoveBlocks) {
|
| 7249 |
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7250 |
}
|
| 7251 |
|
| 7252 |
-
|
| 7253 |
type: 'MOVE_BLOCKS_TO_POSITION',
|
| 7254 |
fromRootClientId,
|
| 7255 |
toRootClientId,
|
| 7256 |
clientIds,
|
| 7257 |
index
|
| 7258 |
-
};
|
| 7259 |
-
|
| 7260 |
-
if (fromRootClientId === toRootClientId) {
|
| 7261 |
-
yield action;
|
| 7262 |
-
return;
|
| 7263 |
-
} // If we're moving to another block, it means we're deleting blocks from
|
| 7264 |
-
// the original block, so we need to check if removing is possible.
|
| 7265 |
-
|
| 7266 |
-
|
| 7267 |
-
if (!canRemoveBlocks) {
|
| 7268 |
-
return;
|
| 7269 |
-
}
|
| 7270 |
-
|
| 7271 |
-
const canInsertBlocks = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'canInsertBlocks', clientIds, toRootClientId); // If moving to other parent block, the move is possible if we can insert a block of the same type inside the new parent block.
|
| 7272 |
-
|
| 7273 |
-
if (canInsertBlocks) {
|
| 7274 |
-
yield action;
|
| 7275 |
-
}
|
| 7276 |
-
}
|
| 7277 |
/**
|
| 7278 |
-
*
|
| 7279 |
-
* new position.
|
| 7280 |
*
|
| 7281 |
* @param {?string} clientId The client ID of the block.
|
| 7282 |
* @param {?string} fromRootClientId Root client ID source.
|
| 7283 |
* @param {?string} toRootClientId Root client ID destination.
|
| 7284 |
* @param {number} index The index to move the block to.
|
| 7285 |
-
*
|
| 7286 |
-
* @yield {Object} Action object.
|
| 7287 |
*/
|
| 7288 |
|
| 7289 |
-
function
|
| 7290 |
-
|
| 7291 |
}
|
| 7292 |
/**
|
| 7293 |
-
*
|
| 7294 |
-
* inserted, optionally at a specific index respective a root block list.
|
| 7295 |
*
|
| 7296 |
* @param {Object} block Block object to insert.
|
| 7297 |
* @param {?number} index Index at which block should be inserted.
|
|
@@ -7302,14 +7285,13 @@ function* moveBlockToPosition(clientId, fromRootClientId = '', toRootClientId =
|
|
| 7302 |
* @return {Object} Action object.
|
| 7303 |
*/
|
| 7304 |
|
| 7305 |
-
function insertBlock(block, index, rootClientId, updateSelection
|
| 7306 |
return insertBlocks([block], index, rootClientId, updateSelection, 0, meta);
|
| 7307 |
}
|
| 7308 |
/* eslint-disable jsdoc/valid-types */
|
| 7309 |
|
| 7310 |
/**
|
| 7311 |
-
*
|
| 7312 |
-
* be inserted, optionally at a specific index respective a root block list.
|
| 7313 |
*
|
| 7314 |
* @param {Object[]} blocks Block objects to insert.
|
| 7315 |
* @param {?number} index Index at which block should be inserted.
|
|
@@ -7320,7 +7302,10 @@ function insertBlock(block, index, rootClientId, updateSelection = true, meta) {
|
|
| 7320 |
* @return {Object} Action object.
|
| 7321 |
*/
|
| 7322 |
|
| 7323 |
-
|
|
|
|
|
|
|
|
|
|
| 7324 |
/* eslint-enable jsdoc/valid-types */
|
| 7325 |
if ((0,external_lodash_namespaceObject.isObject)(initialPosition)) {
|
| 7326 |
meta = initialPosition;
|
|
@@ -7332,11 +7317,11 @@ function* insertBlocks(blocks, index, rootClientId, updateSelection = true, init
|
|
| 7332 |
});
|
| 7333 |
}
|
| 7334 |
|
| 7335 |
-
blocks = getBlocksWithDefaultStylesApplied((0,external_lodash_namespaceObject.castArray)(blocks),
|
| 7336 |
const allowedBlocks = [];
|
| 7337 |
|
| 7338 |
for (const block of blocks) {
|
| 7339 |
-
const isValid =
|
| 7340 |
|
| 7341 |
if (isValid) {
|
| 7342 |
allowedBlocks.push(block);
|
|
@@ -7344,7 +7329,7 @@ function* insertBlocks(blocks, index, rootClientId, updateSelection = true, init
|
|
| 7344 |
}
|
| 7345 |
|
| 7346 |
if (allowedBlocks.length) {
|
| 7347 |
-
|
| 7348 |
type: 'INSERT_BLOCKS',
|
| 7349 |
blocks: allowedBlocks,
|
| 7350 |
index,
|
|
@@ -7353,12 +7338,11 @@ function* insertBlocks(blocks, index, rootClientId, updateSelection = true, init
|
|
| 7353 |
updateSelection,
|
| 7354 |
initialPosition: updateSelection ? initialPosition : null,
|
| 7355 |
meta
|
| 7356 |
-
};
|
| 7357 |
}
|
| 7358 |
-
}
|
| 7359 |
/**
|
| 7360 |
-
*
|
| 7361 |
-
* be shown.
|
| 7362 |
*
|
| 7363 |
* @param {?string} rootClientId Optional root client ID of block list on
|
| 7364 |
* which to insert.
|
|
@@ -7380,7 +7364,7 @@ function showInsertionPoint(rootClientId, index, __unstableOptions = {}) {
|
|
| 7380 |
};
|
| 7381 |
}
|
| 7382 |
/**
|
| 7383 |
-
*
|
| 7384 |
*
|
| 7385 |
* @return {Object} Action object.
|
| 7386 |
*/
|
|
@@ -7391,7 +7375,7 @@ function hideInsertionPoint() {
|
|
| 7391 |
};
|
| 7392 |
}
|
| 7393 |
/**
|
| 7394 |
-
*
|
| 7395 |
*
|
| 7396 |
* @param {boolean} isValid template validity flag.
|
| 7397 |
*
|
|
@@ -7405,49 +7389,55 @@ function setTemplateValidity(isValid) {
|
|
| 7405 |
};
|
| 7406 |
}
|
| 7407 |
/**
|
| 7408 |
-
*
|
| 7409 |
*
|
| 7410 |
* @return {Object} Action object.
|
| 7411 |
*/
|
| 7412 |
|
| 7413 |
-
|
| 7414 |
-
|
|
|
|
|
|
|
|
|
|
| 7415 |
type: 'SYNCHRONIZE_TEMPLATE'
|
| 7416 |
-
};
|
| 7417 |
-
const blocks =
|
| 7418 |
-
const template =
|
| 7419 |
const updatedBlockList = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template);
|
| 7420 |
-
|
| 7421 |
-
}
|
| 7422 |
/**
|
| 7423 |
-
*
|
| 7424 |
*
|
| 7425 |
* @param {string} firstBlockClientId Client ID of the first block to merge.
|
| 7426 |
* @param {string} secondBlockClientId Client ID of the second block to merge.
|
| 7427 |
*/
|
| 7428 |
|
| 7429 |
-
|
|
|
|
|
|
|
|
|
|
| 7430 |
const blocks = [firstBlockClientId, secondBlockClientId];
|
| 7431 |
-
|
| 7432 |
type: 'MERGE_BLOCKS',
|
| 7433 |
blocks
|
| 7434 |
-
};
|
| 7435 |
const [clientIdA, clientIdB] = blocks;
|
| 7436 |
-
const blockA =
|
| 7437 |
const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); // Only focus the previous block if it's not mergeable
|
| 7438 |
|
| 7439 |
if (blockAType && !blockAType.merge) {
|
| 7440 |
-
|
| 7441 |
return;
|
| 7442 |
}
|
| 7443 |
|
| 7444 |
-
const blockB =
|
| 7445 |
const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name);
|
| 7446 |
const {
|
| 7447 |
clientId,
|
| 7448 |
attributeKey,
|
| 7449 |
offset
|
| 7450 |
-
} =
|
| 7451 |
const selectedBlockType = clientId === clientIdA ? blockAType : blockBType;
|
| 7452 |
const attributeDefinition = selectedBlockType.attributes[attributeKey];
|
| 7453 |
const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== undefined && offset !== undefined && // We cannot restore text selection if the RichText identifier
|
|
@@ -7525,16 +7515,16 @@ function* mergeBlocks(firstBlockClientId, secondBlockClientId) {
|
|
| 7525 |
preserveWhiteSpace
|
| 7526 |
});
|
| 7527 |
updatedAttributes[newAttributeKey] = newHtml;
|
| 7528 |
-
|
| 7529 |
}
|
| 7530 |
|
| 7531 |
-
|
| 7532 |
attributes: { ...blockA.attributes,
|
| 7533 |
...updatedAttributes
|
| 7534 |
}
|
| 7535 |
}, ...blocksWithTheSameType.slice(1)], 0 // If we don't pass the `indexToSelect` it will default to the last block.
|
| 7536 |
);
|
| 7537 |
-
}
|
| 7538 |
/**
|
| 7539 |
* Yields action objects used in signalling that the blocks corresponding to
|
| 7540 |
* the set of specified client IDs are to be removed.
|
|
@@ -7544,36 +7534,34 @@ function* mergeBlocks(firstBlockClientId, secondBlockClientId) {
|
|
| 7544 |
* selected when a block is removed.
|
| 7545 |
*/
|
| 7546 |
|
| 7547 |
-
|
|
|
|
|
|
|
|
|
|
| 7548 |
if (!clientIds || !clientIds.length) {
|
| 7549 |
return;
|
| 7550 |
}
|
| 7551 |
|
| 7552 |
clientIds = (0,external_lodash_namespaceObject.castArray)(clientIds);
|
| 7553 |
-
const rootClientId =
|
| 7554 |
-
const canRemoveBlocks =
|
| 7555 |
|
| 7556 |
if (!canRemoveBlocks) {
|
| 7557 |
return;
|
| 7558 |
}
|
| 7559 |
|
| 7560 |
-
let previousBlockId;
|
| 7561 |
-
|
| 7562 |
if (selectPrevious) {
|
| 7563 |
-
|
| 7564 |
-
} else {
|
| 7565 |
-
previousBlockId = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getPreviousBlockClientId', clientIds[0]);
|
| 7566 |
}
|
| 7567 |
|
| 7568 |
-
|
| 7569 |
type: 'REMOVE_BLOCKS',
|
| 7570 |
clientIds
|
| 7571 |
-
}; // To avoid a focus loss when removing the last block, assure there is
|
| 7572 |
// always a default block if the last of the blocks have been removed.
|
| 7573 |
|
| 7574 |
-
|
| 7575 |
-
|
| 7576 |
-
}
|
| 7577 |
/**
|
| 7578 |
* Returns an action object used in signalling that the block with the
|
| 7579 |
* specified client ID is to be removed.
|
|
@@ -7697,8 +7685,7 @@ function exitFormattedText() {
|
|
| 7697 |
};
|
| 7698 |
}
|
| 7699 |
/**
|
| 7700 |
-
*
|
| 7701 |
-
* position.
|
| 7702 |
*
|
| 7703 |
* @param {string} clientId The selected block client ID.
|
| 7704 |
* @param {string} attributeKey The selected block attribute key.
|
|
@@ -7718,8 +7705,7 @@ function selectionChange(clientId, attributeKey, startOffset, endOffset) {
|
|
| 7718 |
};
|
| 7719 |
}
|
| 7720 |
/**
|
| 7721 |
-
*
|
| 7722 |
-
* type should be added to the block list.
|
| 7723 |
*
|
| 7724 |
* @param {?Object} attributes Optional attributes of the block to assign.
|
| 7725 |
* @param {?string} rootClientId Optional root client ID of block list on which
|
|
@@ -7741,7 +7727,7 @@ function insertDefaultBlock(attributes, rootClientId, index) {
|
|
| 7741 |
return insertBlock(block, index, rootClientId);
|
| 7742 |
}
|
| 7743 |
/**
|
| 7744 |
-
*
|
| 7745 |
*
|
| 7746 |
* @param {string} clientId Client ID of the block whose nested setting are
|
| 7747 |
* being received.
|
|
@@ -7758,7 +7744,7 @@ function updateBlockListSettings(clientId, settings) {
|
|
| 7758 |
};
|
| 7759 |
}
|
| 7760 |
/**
|
| 7761 |
-
*
|
| 7762 |
*
|
| 7763 |
* @param {Object} settings Updated settings
|
| 7764 |
*
|
|
@@ -7772,7 +7758,7 @@ function updateSettings(settings) {
|
|
| 7772 |
};
|
| 7773 |
}
|
| 7774 |
/**
|
| 7775 |
-
*
|
| 7776 |
* in order to switch its temporary id with the real id.
|
| 7777 |
*
|
| 7778 |
* @param {string} id Reusable block's id.
|
|
@@ -7789,7 +7775,7 @@ function __unstableSaveReusableBlock(id, updatedId) {
|
|
| 7789 |
};
|
| 7790 |
}
|
| 7791 |
/**
|
| 7792 |
-
*
|
| 7793 |
*
|
| 7794 |
* @return {Object} Action object.
|
| 7795 |
*/
|
|
@@ -7800,7 +7786,7 @@ function __unstableMarkLastChangeAsPersistent() {
|
|
| 7800 |
};
|
| 7801 |
}
|
| 7802 |
/**
|
| 7803 |
-
*
|
| 7804 |
*
|
| 7805 |
* @return {Object} Action object.
|
| 7806 |
*/
|
|
@@ -7811,138 +7797,156 @@ function __unstableMarkNextChangeAsNotPersistent() {
|
|
| 7811 |
};
|
| 7812 |
}
|
| 7813 |
/**
|
| 7814 |
-
*
|
| 7815 |
-
*
|
| 7816 |
-
*
|
| 7817 |
-
*
|
| 7818 |
-
* it is recommended to be called at the next idle period to ensure all
|
| 7819 |
* selection changes have been recorded.
|
| 7820 |
*/
|
| 7821 |
|
| 7822 |
-
|
| 7823 |
-
|
|
|
|
|
|
|
| 7824 |
type: 'MARK_AUTOMATIC_CHANGE'
|
| 7825 |
-
};
|
| 7826 |
-
|
| 7827 |
-
|
| 7828 |
-
|
| 7829 |
-
|
| 7830 |
-
|
| 7831 |
-
|
| 7832 |
-
}
|
|
|
|
|
|
|
| 7833 |
/**
|
| 7834 |
-
*
|
| 7835 |
*
|
| 7836 |
* @param {string} isNavigationMode Enable/Disable navigation mode.
|
| 7837 |
*/
|
| 7838 |
|
| 7839 |
-
|
| 7840 |
-
|
|
|
|
|
|
|
| 7841 |
type: 'SET_NAVIGATION_MODE',
|
| 7842 |
isNavigationMode
|
| 7843 |
-
};
|
| 7844 |
|
| 7845 |
if (isNavigationMode) {
|
| 7846 |
(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.'));
|
| 7847 |
} else {
|
| 7848 |
(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.'));
|
| 7849 |
}
|
| 7850 |
-
}
|
| 7851 |
/**
|
| 7852 |
-
*
|
| 7853 |
*
|
| 7854 |
* @param {string|null} hasBlockMovingClientId Enable/Disable block moving mode.
|
| 7855 |
*/
|
| 7856 |
|
| 7857 |
-
|
| 7858 |
-
|
|
|
|
|
|
|
| 7859 |
type: 'SET_BLOCK_MOVING_MODE',
|
| 7860 |
hasBlockMovingClientId
|
| 7861 |
-
};
|
| 7862 |
|
| 7863 |
if (hasBlockMovingClientId) {
|
| 7864 |
(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.'));
|
| 7865 |
}
|
| 7866 |
-
}
|
| 7867 |
/**
|
| 7868 |
-
*
|
| 7869 |
*
|
| 7870 |
* @param {string[]} clientIds
|
| 7871 |
* @param {boolean} updateSelection
|
| 7872 |
*/
|
| 7873 |
|
| 7874 |
-
|
| 7875 |
-
|
|
|
|
|
|
|
|
|
|
| 7876 |
return;
|
| 7877 |
-
}
|
|
|
|
| 7878 |
|
| 7879 |
-
const blocks =
|
| 7880 |
-
const rootClientId = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getBlockRootClientId', clientIds[0]); // Return early if blocks don't exist.
|
| 7881 |
|
| 7882 |
if ((0,external_lodash_namespaceObject.some)(blocks, block => !block)) {
|
| 7883 |
return;
|
| 7884 |
-
}
|
| 7885 |
|
| 7886 |
-
const blockNames = blocks.map(block => block.name); // Return early if blocks don't support multiple usage.
|
| 7887 |
|
| 7888 |
-
|
|
|
|
|
|
|
| 7889 |
return;
|
| 7890 |
}
|
| 7891 |
|
| 7892 |
-
const
|
|
|
|
| 7893 |
const clonedBlocks = blocks.map(block => (0,external_wp_blocks_namespaceObject.__experimentalCloneSanitizedBlock)(block));
|
| 7894 |
-
|
| 7895 |
|
| 7896 |
if (clonedBlocks.length > 1 && updateSelection) {
|
| 7897 |
-
|
| 7898 |
}
|
| 7899 |
|
| 7900 |
return clonedBlocks.map(block => block.clientId);
|
| 7901 |
-
}
|
| 7902 |
/**
|
| 7903 |
-
*
|
| 7904 |
*
|
| 7905 |
* @param {string} clientId
|
| 7906 |
*/
|
| 7907 |
|
| 7908 |
-
|
|
|
|
|
|
|
|
|
|
| 7909 |
if (!clientId) {
|
| 7910 |
return;
|
| 7911 |
}
|
| 7912 |
|
| 7913 |
-
const rootClientId =
|
| 7914 |
-
const isLocked =
|
| 7915 |
|
| 7916 |
if (isLocked) {
|
| 7917 |
return;
|
| 7918 |
}
|
| 7919 |
|
| 7920 |
-
const firstSelectedIndex =
|
| 7921 |
-
return
|
| 7922 |
-
}
|
| 7923 |
/**
|
| 7924 |
-
*
|
| 7925 |
*
|
| 7926 |
* @param {string} clientId
|
| 7927 |
*/
|
| 7928 |
|
| 7929 |
-
|
|
|
|
|
|
|
|
|
|
| 7930 |
if (!clientId) {
|
| 7931 |
return;
|
| 7932 |
}
|
| 7933 |
|
| 7934 |
-
const rootClientId =
|
| 7935 |
-
const isLocked =
|
| 7936 |
|
| 7937 |
if (isLocked) {
|
| 7938 |
return;
|
| 7939 |
}
|
| 7940 |
|
| 7941 |
-
const firstSelectedIndex =
|
| 7942 |
-
return
|
| 7943 |
-
}
|
| 7944 |
/**
|
| 7945 |
-
*
|
| 7946 |
*
|
| 7947 |
* @param {string} clientId The block's clientId.
|
| 7948 |
* @param {boolean} isHighlighted The highlight state.
|
|
@@ -7956,22 +7960,20 @@ function toggleBlockHighlight(clientId, isHighlighted) {
|
|
| 7956 |
};
|
| 7957 |
}
|
| 7958 |
/**
|
| 7959 |
-
*
|
| 7960 |
-
* given clientId should appear to "flash" by rhythmically highlighting it.
|
| 7961 |
*
|
| 7962 |
* @param {string} clientId Target block client ID.
|
| 7963 |
*/
|
| 7964 |
|
| 7965 |
-
|
| 7966 |
-
|
| 7967 |
-
|
| 7968 |
-
|
| 7969 |
-
|
| 7970 |
-
|
| 7971 |
-
|
| 7972 |
-
}
|
| 7973 |
/**
|
| 7974 |
-
*
|
| 7975 |
*
|
| 7976 |
* @param {string} clientId The block's clientId.
|
| 7977 |
* @param {boolean} hasControlledInnerBlocks True if the block's inner blocks are controlled.
|
|
@@ -7985,6 +7987,9 @@ function setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) {
|
|
| 7985 |
};
|
| 7986 |
}
|
| 7987 |
//# sourceMappingURL=actions.js.map
|
|
|
|
|
|
|
|
|
|
| 7988 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/store/index.js
|
| 7989 |
/**
|
| 7990 |
* WordPress dependencies
|
|
@@ -7998,7 +8003,6 @@ function setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) {
|
|
| 7998 |
|
| 7999 |
|
| 8000 |
|
| 8001 |
-
|
| 8002 |
/**
|
| 8003 |
* Block editor data store configuration.
|
| 8004 |
*
|
|
@@ -8011,7 +8015,7 @@ const storeConfig = {
|
|
| 8011 |
reducer: reducer,
|
| 8012 |
selectors: selectors_namespaceObject,
|
| 8013 |
actions: actions_namespaceObject,
|
| 8014 |
-
|
| 8015 |
};
|
| 8016 |
/**
|
| 8017 |
* Store definition for the block editor namespace.
|
|
@@ -8392,6 +8396,36 @@ const justifySpaceBetween = (0,external_wp_element_namespaceObject.createElement
|
|
| 8392 |
}));
|
| 8393 |
/* harmony default export */ var justify_space_between = (justifySpaceBetween);
|
| 8394 |
//# sourceMappingURL=justify-space-between.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8395 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/layouts/utils.js
|
| 8396 |
/**
|
| 8397 |
* Utility to generate the proper CSS selector for layout styles.
|
|
@@ -8434,7 +8468,7 @@ const deprecatedFlags = {
|
|
| 8434 |
'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients,
|
| 8435 |
'typography.fontSizes': settings => settings.fontSizes === undefined ? undefined : settings.fontSizes,
|
| 8436 |
'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes,
|
| 8437 |
-
'typography.
|
| 8438 |
'spacing.units': settings => {
|
| 8439 |
if (settings.enableCustomUnits === undefined) {
|
| 8440 |
return;
|
|
@@ -8446,22 +8480,60 @@ const deprecatedFlags = {
|
|
| 8446 |
|
| 8447 |
return settings.enableCustomUnits;
|
| 8448 |
},
|
| 8449 |
-
'spacing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8450 |
};
|
| 8451 |
/**
|
| 8452 |
* Hook that retrieves the editor setting.
|
| 8453 |
* It works with nested objects using by finding the value at path.
|
| 8454 |
*
|
| 8455 |
* @param {string} path The path to the setting.
|
| 8456 |
-
*
|
| 8457 |
* @return {any} Returns the value defined for the setting.
|
| 8458 |
-
*
|
| 8459 |
* @example
|
| 8460 |
* ```js
|
| 8461 |
* const isEnabled = useSetting( 'typography.dropCap' );
|
| 8462 |
* ```
|
| 8463 |
*/
|
| 8464 |
|
|
|
|
| 8465 |
function useSetting(path) {
|
| 8466 |
const {
|
| 8467 |
name: blockName
|
|
@@ -8472,12 +8544,13 @@ function useSetting(path) {
|
|
| 8472 |
const settings = select(store).getSettings(); // 1 - Use __experimental features, if available.
|
| 8473 |
// We cascade to the all value if the block one is not available.
|
| 8474 |
|
| 8475 |
-
const
|
| 8476 |
-
const
|
|
|
|
| 8477 |
const experimentalFeaturesResult = (_get = (0,external_lodash_namespaceObject.get)(settings, blockPath)) !== null && _get !== void 0 ? _get : (0,external_lodash_namespaceObject.get)(settings, defaultsPath);
|
| 8478 |
|
| 8479 |
if (experimentalFeaturesResult !== undefined) {
|
| 8480 |
-
if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[
|
| 8481 |
var _ref, _experimentalFeatures;
|
| 8482 |
|
| 8483 |
return (_ref = (_experimentalFeatures = experimentalFeaturesResult.user) !== null && _experimentalFeatures !== void 0 ? _experimentalFeatures : experimentalFeaturesResult.theme) !== null && _ref !== void 0 ? _ref : experimentalFeaturesResult.core;
|
|
@@ -8487,7 +8560,7 @@ function useSetting(path) {
|
|
| 8487 |
} // 2 - Use deprecated settings, otherwise.
|
| 8488 |
|
| 8489 |
|
| 8490 |
-
const deprecatedSettingsValue = deprecatedFlags[
|
| 8491 |
|
| 8492 |
if (deprecatedSettingsValue !== undefined) {
|
| 8493 |
return deprecatedSettingsValue;
|
|
@@ -8497,7 +8570,7 @@ function useSetting(path) {
|
|
| 8497 |
// To remove when __experimentalFeatures are ported to core.
|
| 8498 |
|
| 8499 |
|
| 8500 |
-
return
|
| 8501 |
}, [blockName, path]);
|
| 8502 |
return setting;
|
| 8503 |
}
|
|
@@ -8612,13 +8685,21 @@ function JustifyToolbar(props) {
|
|
| 8612 |
|
| 8613 |
|
| 8614 |
|
|
|
|
| 8615 |
|
| 8616 |
const justifyContentMap = {
|
| 8617 |
left: 'flex-start',
|
| 8618 |
right: 'flex-end',
|
| 8619 |
center: 'center',
|
| 8620 |
'space-between': 'space-between'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8621 |
};
|
|
|
|
| 8622 |
/* harmony default export */ var flex = ({
|
| 8623 |
name: 'flex',
|
| 8624 |
label: (0,external_wp_i18n_namespaceObject.__)('Flex'),
|
|
@@ -8626,10 +8707,19 @@ const justifyContentMap = {
|
|
| 8626 |
layout = {},
|
| 8627 |
onChange
|
| 8628 |
}) {
|
| 8629 |
-
|
|
|
|
|
|
|
|
|
|
| 8630 |
layout: layout,
|
| 8631 |
onChange: onChange
|
| 8632 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8633 |
},
|
| 8634 |
toolBarControls: function FlexLayoutToolbarControls({
|
| 8635 |
layout = {},
|
|
@@ -8653,17 +8743,53 @@ const justifyContentMap = {
|
|
| 8653 |
selector,
|
| 8654 |
layout
|
| 8655 |
}) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8656 |
const blockGapSupport = useSetting('spacing.blockGap');
|
| 8657 |
const hasBlockGapStylesSupport = blockGapSupport !== null;
|
| 8658 |
-
const justifyContent = justifyContentMap[layout.justifyContent] ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8659 |
return (0,external_wp_element_namespaceObject.createElement)("style", null, `
|
| 8660 |
${appendSelectors(selector)} {
|
| 8661 |
display: flex;
|
| 8662 |
gap: ${hasBlockGapStylesSupport ? 'var( --wp--style--block-gap, 0.5em )' : '0.5em'};
|
| 8663 |
-
flex-wrap:
|
| 8664 |
-
|
| 8665 |
-
flex-direction: row;
|
| 8666 |
-
justify-content: ${justifyContent};
|
| 8667 |
}
|
| 8668 |
|
| 8669 |
${appendSelectors(selector, '> *')} {
|
|
@@ -8672,8 +8798,11 @@ const justifyContentMap = {
|
|
| 8672 |
`);
|
| 8673 |
},
|
| 8674 |
|
| 8675 |
-
getOrientation() {
|
| 8676 |
-
|
|
|
|
|
|
|
|
|
|
| 8677 |
},
|
| 8678 |
|
| 8679 |
getAlignments() {
|
|
@@ -8681,23 +8810,6 @@ const justifyContentMap = {
|
|
| 8681 |
}
|
| 8682 |
|
| 8683 |
});
|
| 8684 |
-
const justificationOptions = [{
|
| 8685 |
-
value: 'left',
|
| 8686 |
-
icon: justify_left,
|
| 8687 |
-
label: (0,external_wp_i18n_namespaceObject.__)('Justify items left')
|
| 8688 |
-
}, {
|
| 8689 |
-
value: 'center',
|
| 8690 |
-
icon: justify_center,
|
| 8691 |
-
label: (0,external_wp_i18n_namespaceObject.__)('Justify items center')
|
| 8692 |
-
}, {
|
| 8693 |
-
value: 'right',
|
| 8694 |
-
icon: justify_right,
|
| 8695 |
-
label: (0,external_wp_i18n_namespaceObject.__)('Justify items right')
|
| 8696 |
-
}, {
|
| 8697 |
-
value: 'space-between',
|
| 8698 |
-
icon: justify_space_between,
|
| 8699 |
-
label: (0,external_wp_i18n_namespaceObject.__)('Space between items')
|
| 8700 |
-
}];
|
| 8701 |
|
| 8702 |
function FlexLayoutJustifyContentControl({
|
| 8703 |
layout,
|
|
@@ -8705,7 +8817,8 @@ function FlexLayoutJustifyContentControl({
|
|
| 8705 |
isToolbar = false
|
| 8706 |
}) {
|
| 8707 |
const {
|
| 8708 |
-
justifyContent = 'left'
|
|
|
|
| 8709 |
} = layout;
|
| 8710 |
|
| 8711 |
const onJustificationChange = value => {
|
|
@@ -8714,9 +8827,15 @@ function FlexLayoutJustifyContentControl({
|
|
| 8714 |
});
|
| 8715 |
};
|
| 8716 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8717 |
if (isToolbar) {
|
| 8718 |
return (0,external_wp_element_namespaceObject.createElement)(JustifyContentControl, {
|
| 8719 |
-
allowedControls:
|
| 8720 |
value: justifyContent,
|
| 8721 |
onChange: onJustificationChange,
|
| 8722 |
popoverProps: {
|
|
@@ -8726,6 +8845,28 @@ function FlexLayoutJustifyContentControl({
|
|
| 8726 |
});
|
| 8727 |
}
|
| 8728 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8729 |
return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
|
| 8730 |
className: "block-editor-hooks__flex-layout-justification-controls"
|
| 8731 |
}, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Justification')), (0,external_wp_element_namespaceObject.createElement)("div", null, justificationOptions.map(({
|
|
@@ -8742,6 +8883,50 @@ function FlexLayoutJustifyContentControl({
|
|
| 8742 |
});
|
| 8743 |
})));
|
| 8744 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8745 |
//# sourceMappingURL=flex.js.map
|
| 8746 |
;// CONCATENATED MODULE: ./packages/icons/build-module/icon/index.js
|
| 8747 |
/**
|
|
@@ -9548,10 +9733,12 @@ var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp
|
|
| 9548 |
const InspectorControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControls');
|
| 9549 |
const InspectorControlsAdvanced = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorAdvancedControls');
|
| 9550 |
const InspectorControlsDimensions = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsDimensions');
|
|
|
|
| 9551 |
const groups_groups = {
|
| 9552 |
default: InspectorControlsDefault,
|
| 9553 |
advanced: InspectorControlsAdvanced,
|
| 9554 |
-
dimensions: InspectorControlsDimensions
|
|
|
|
| 9555 |
};
|
| 9556 |
/* harmony default export */ var inspector_controls_groups = (groups_groups);
|
| 9557 |
//# sourceMappingURL=groups.js.map
|
|
@@ -15747,12 +15934,18 @@ function useMultiSelection(clientId) {
|
|
| 15747 |
const startParents = getBlockParents(blockSelectionStart);
|
| 15748 |
|
| 15749 |
if (blockSelectionStart && blockSelectionStart !== clientId && !(startParents !== null && startParents !== void 0 && startParents.includes(clientId))) {
|
| 15750 |
-
toggleRichText(node, false);
|
| 15751 |
const startPath = [...startParents, blockSelectionStart];
|
| 15752 |
const endPath = [...getBlockParents(clientId), clientId];
|
| 15753 |
const depth = Math.min(startPath.length, endPath.length) - 1;
|
| 15754 |
-
|
| 15755 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15756 |
}
|
| 15757 |
} else if (hasMultiSelection()) {
|
| 15758 |
// Allow user to escape out of a multi-selection to a
|
|
@@ -16323,6 +16516,8 @@ const blockDefault = (0,external_wp_element_namespaceObject.createElement)(exter
|
|
| 16323 |
|
| 16324 |
|
| 16325 |
|
|
|
|
|
|
|
| 16326 |
function BlockIcon({
|
| 16327 |
icon,
|
| 16328 |
showColors = false,
|
|
@@ -16350,6 +16545,8 @@ function BlockIcon({
|
|
| 16350 |
})
|
| 16351 |
}, renderedIcon);
|
| 16352 |
}
|
|
|
|
|
|
|
| 16353 |
//# sourceMappingURL=index.js.map
|
| 16354 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-card/index.js
|
| 16355 |
|
|
@@ -16384,7 +16581,7 @@ function BlockCard({
|
|
| 16384 |
|
| 16385 |
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 16386 |
className: "block-editor-block-card"
|
| 16387 |
-
}, (0,external_wp_element_namespaceObject.createElement)(
|
| 16388 |
icon: icon,
|
| 16389 |
showColors: true
|
| 16390 |
}), (0,external_wp_element_namespaceObject.createElement)("div", {
|
|
@@ -19595,11 +19792,11 @@ function BlockDraggableChip({
|
|
| 19595 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
|
| 19596 |
justify: "center",
|
| 19597 |
className: "block-editor-block-draggable-chip__content"
|
| 19598 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, icon ? (0,external_wp_element_namespaceObject.createElement)(
|
| 19599 |
icon: icon
|
| 19600 |
}) : (0,external_wp_i18n_namespaceObject.sprintf)(
|
| 19601 |
/* translators: %d: Number of blocks. */
|
| 19602 |
-
(0,external_wp_i18n_namespaceObject._n)('%d block', '%d blocks', count), count)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(
|
| 19603 |
icon: drag_handle
|
| 19604 |
})))));
|
| 19605 |
}
|
|
@@ -19767,7 +19964,7 @@ function InserterListItem({
|
|
| 19767 |
}, props), (0,external_wp_element_namespaceObject.createElement)("span", {
|
| 19768 |
className: "block-editor-block-types-list__item-icon",
|
| 19769 |
style: itemIconStyle
|
| 19770 |
-
}, (0,external_wp_element_namespaceObject.createElement)(
|
| 19771 |
icon: item.icon,
|
| 19772 |
showColors: true
|
| 19773 |
})), (0,external_wp_element_namespaceObject.createElement)("span", {
|
|
@@ -20144,12 +20341,15 @@ function BlockTypesTab({
|
|
| 20144 |
|
| 20145 |
|
| 20146 |
|
|
|
|
| 20147 |
function PatternInserterPanel({
|
| 20148 |
selectedCategory,
|
| 20149 |
patternCategories,
|
| 20150 |
onClickCategory,
|
| 20151 |
-
|
| 20152 |
}) {
|
|
|
|
|
|
|
| 20153 |
const categoryOptions = () => {
|
| 20154 |
const options = [];
|
| 20155 |
patternCategories.map(patternCategory => {
|
|
@@ -20165,22 +20365,24 @@ function PatternInserterPanel({
|
|
| 20165 |
onClickCategory(patternCategories.find(patternCategory => selected === patternCategory.name));
|
| 20166 |
};
|
| 20167 |
|
| 20168 |
-
const
|
| 20169 |
-
return classnames_default()('block-editor-inserter__panel-header', 'block-editor-inserter__panel-header-patterns');
|
| 20170 |
-
}; // In iOS-based mobile devices, the onBlur will fire when selecting an option
|
| 20171 |
// from a Select element. To prevent closing the useDialog on iOS devices, we
|
| 20172 |
// stop propagating the onBlur event if there is no relatedTarget, which means
|
| 20173 |
// that the user most likely did not click on an element within the editor canvas.
|
| 20174 |
|
| 20175 |
-
|
| 20176 |
const onBlur = event => {
|
| 20177 |
if (!(event !== null && event !== void 0 && event.relatedTarget)) {
|
| 20178 |
event.stopPropagation();
|
| 20179 |
}
|
| 20180 |
};
|
| 20181 |
|
| 20182 |
-
return (0,external_wp_element_namespaceObject.createElement)(
|
| 20183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20184 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
|
| 20185 |
className: "block-editor-inserter__panel-dropdown",
|
| 20186 |
label: (0,external_wp_i18n_namespaceObject.__)('Filter patterns'),
|
|
@@ -20189,9 +20391,12 @@ function PatternInserterPanel({
|
|
| 20189 |
onChange: onChangeSelect,
|
| 20190 |
onBlur: onBlur,
|
| 20191 |
options: categoryOptions()
|
| 20192 |
-
})), (0,external_wp_element_namespaceObject.createElement)(
|
| 20193 |
-
|
| 20194 |
-
|
|
|
|
|
|
|
|
|
|
| 20195 |
}
|
| 20196 |
|
| 20197 |
/* harmony default export */ var pattern_panel = (PatternInserterPanel);
|
|
@@ -20266,7 +20471,6 @@ const usePatternsState = (onInsert, rootClientId) => {
|
|
| 20266 |
|
| 20267 |
|
| 20268 |
|
| 20269 |
-
|
| 20270 |
/**
|
| 20271 |
* Internal dependencies
|
| 20272 |
*/
|
|
@@ -20274,7 +20478,6 @@ const usePatternsState = (onInsert, rootClientId) => {
|
|
| 20274 |
|
| 20275 |
|
| 20276 |
|
| 20277 |
-
|
| 20278 |
function BlockPattern({
|
| 20279 |
isDraggable,
|
| 20280 |
pattern,
|
|
@@ -20282,12 +20485,9 @@ function BlockPattern({
|
|
| 20282 |
composite
|
| 20283 |
}) {
|
| 20284 |
const {
|
| 20285 |
-
|
| 20286 |
viewportWidth
|
| 20287 |
} = pattern;
|
| 20288 |
-
const {
|
| 20289 |
-
blocks
|
| 20290 |
-
} = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).__experimentalGetParsedPattern(name), [name]);
|
| 20291 |
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPattern);
|
| 20292 |
const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`;
|
| 20293 |
return (0,external_wp_element_namespaceObject.createElement)(inserter_draggable_blocks, {
|
|
@@ -20357,110 +20557,76 @@ function BlockPatternList({
|
|
| 20357 |
|
| 20358 |
/* harmony default export */ var block_patterns_list = (BlockPatternList);
|
| 20359 |
//# sourceMappingURL=index.js.map
|
| 20360 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/block-patterns-
|
| 20361 |
|
| 20362 |
|
| 20363 |
-
/**
|
| 20364 |
-
* External dependencies
|
| 20365 |
-
*/
|
| 20366 |
-
|
| 20367 |
/**
|
| 20368 |
* WordPress dependencies
|
| 20369 |
*/
|
| 20370 |
|
| 20371 |
|
| 20372 |
|
| 20373 |
-
|
| 20374 |
-
/**
|
| 20375 |
-
* Internal dependencies
|
| 20376 |
-
*/
|
| 20377 |
-
|
| 20378 |
-
|
| 20379 |
-
|
| 20380 |
-
|
| 20381 |
-
|
| 20382 |
-
function BlockPatternsCategory({
|
| 20383 |
-
rootClientId,
|
| 20384 |
-
onInsert,
|
| 20385 |
selectedCategory,
|
|
|
|
| 20386 |
onClickCategory
|
| 20387 |
}) {
|
| 20388 |
-
const
|
| 20389 |
-
|
| 20390 |
-
|
| 20391 |
-
|
| 20392 |
-
|
| 20393 |
-
|
| 20394 |
-
})).sort(({
|
| 20395 |
-
name: currentName
|
| 20396 |
-
}, {
|
| 20397 |
-
name: nextName
|
| 20398 |
}) => {
|
| 20399 |
-
|
| 20400 |
-
|
| 20401 |
-
|
| 20402 |
-
|
| 20403 |
-
|
| 20404 |
-
|
| 20405 |
-
|
| 20406 |
-
|
| 20407 |
-
|
| 20408 |
-
|
| 20409 |
-
|
| 20410 |
-
label: (0,external_wp_i18n_namespaceObject._x)('Uncategorized')
|
| 20411 |
-
});
|
| 20412 |
-
}
|
| 20413 |
-
}, [populatedCategories, allPatterns]);
|
| 20414 |
-
const getPatternIndex = (0,external_wp_element_namespaceObject.useCallback)(pattern => {
|
| 20415 |
-
if (!pattern.categories || !pattern.categories.length) {
|
| 20416 |
-
return Infinity;
|
| 20417 |
-
}
|
| 20418 |
-
|
| 20419 |
-
const indexedCategories = (0,external_lodash_namespaceObject.fromPairs)(populatedCategories.map(({
|
| 20420 |
-
name
|
| 20421 |
-
}, index) => [name, index]));
|
| 20422 |
-
return Math.min(...pattern.categories.map(cat => indexedCategories[cat] !== undefined ? indexedCategories[cat] : Infinity));
|
| 20423 |
-
}, [populatedCategories]);
|
| 20424 |
-
const currentCategoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => allPatterns.filter(pattern => patternCategory.name === 'uncategorized' ? getPatternIndex(pattern) === Infinity : pattern.categories && pattern.categories.includes(patternCategory.name)), [allPatterns, patternCategory]); // Ordering the patterns is important for the async rendering.
|
| 20425 |
|
| 20426 |
-
|
| 20427 |
-
|
| 20428 |
-
|
| 20429 |
-
|
| 20430 |
-
|
| 20431 |
-
|
| 20432 |
-
|
| 20433 |
-
|
| 20434 |
-
|
| 20435 |
-
|
| 20436 |
-
|
| 20437 |
-
|
| 20438 |
-
|
| 20439 |
-
onClickPattern: onClick,
|
| 20440 |
-
label: patternCategory.label,
|
| 20441 |
-
orientation: "vertical",
|
| 20442 |
-
isDraggable: true
|
| 20443 |
-
})));
|
| 20444 |
}
|
| 20445 |
|
| 20446 |
-
function
|
| 20447 |
-
|
| 20448 |
-
|
| 20449 |
onClickCategory,
|
| 20450 |
-
|
|
|
|
| 20451 |
}) {
|
| 20452 |
-
|
| 20453 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20454 |
selectedCategory: selectedCategory,
|
| 20455 |
-
|
| 20456 |
onClickCategory: onClickCategory
|
| 20457 |
-
});
|
| 20458 |
}
|
| 20459 |
|
| 20460 |
-
/* harmony default export */ var
|
| 20461 |
-
//# sourceMappingURL=
|
| 20462 |
-
;// CONCATENATED MODULE: external ["wp","url"]
|
| 20463 |
-
var external_wp_url_namespaceObject = window["wp"]["url"];
|
| 20464 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/no-results.js
|
| 20465 |
|
| 20466 |
|
|
@@ -20481,94 +20647,6 @@ function InserterNoResults() {
|
|
| 20481 |
|
| 20482 |
/* harmony default export */ var no_results = (InserterNoResults);
|
| 20483 |
//# sourceMappingURL=no-results.js.map
|
| 20484 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/reusable-blocks-tab.js
|
| 20485 |
-
|
| 20486 |
-
|
| 20487 |
-
/**
|
| 20488 |
-
* WordPress dependencies
|
| 20489 |
-
*/
|
| 20490 |
-
|
| 20491 |
-
|
| 20492 |
-
|
| 20493 |
-
/**
|
| 20494 |
-
* Internal dependencies
|
| 20495 |
-
*/
|
| 20496 |
-
|
| 20497 |
-
|
| 20498 |
-
|
| 20499 |
-
|
| 20500 |
-
|
| 20501 |
-
|
| 20502 |
-
function ReusableBlocksList({
|
| 20503 |
-
onHover,
|
| 20504 |
-
onInsert,
|
| 20505 |
-
rootClientId
|
| 20506 |
-
}) {
|
| 20507 |
-
const [items,,, onSelectItem] = use_block_types_state(rootClientId, onInsert);
|
| 20508 |
-
const filteredItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
| 20509 |
-
return items.filter(({
|
| 20510 |
-
category
|
| 20511 |
-
}) => category === 'reusable');
|
| 20512 |
-
}, [items]);
|
| 20513 |
-
|
| 20514 |
-
if (filteredItems.length === 0) {
|
| 20515 |
-
return (0,external_wp_element_namespaceObject.createElement)(no_results, null);
|
| 20516 |
-
}
|
| 20517 |
-
|
| 20518 |
-
return (0,external_wp_element_namespaceObject.createElement)(panel, {
|
| 20519 |
-
title: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks')
|
| 20520 |
-
}, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
|
| 20521 |
-
items: filteredItems,
|
| 20522 |
-
onSelect: onSelectItem,
|
| 20523 |
-
onHover: onHover,
|
| 20524 |
-
label: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks')
|
| 20525 |
-
}));
|
| 20526 |
-
} // The unwrapped component is only exported for use by unit tests.
|
| 20527 |
-
|
| 20528 |
-
/**
|
| 20529 |
-
* List of reusable blocks shown in the "Reusable" tab of the inserter.
|
| 20530 |
-
*
|
| 20531 |
-
* @param {Object} props Component props.
|
| 20532 |
-
* @param {?string} props.rootClientId Client id of block to insert into.
|
| 20533 |
-
* @param {Function} props.onInsert Callback to run when item is inserted.
|
| 20534 |
-
* @param {Function} props.onHover Callback to run when item is hovered.
|
| 20535 |
-
*
|
| 20536 |
-
* @return {WPComponent} The component.
|
| 20537 |
-
*/
|
| 20538 |
-
|
| 20539 |
-
|
| 20540 |
-
function ReusableBlocksTab({
|
| 20541 |
-
rootClientId,
|
| 20542 |
-
onInsert,
|
| 20543 |
-
onHover
|
| 20544 |
-
}) {
|
| 20545 |
-
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(ReusableBlocksList, {
|
| 20546 |
-
onHover: onHover,
|
| 20547 |
-
onInsert: onInsert,
|
| 20548 |
-
rootClientId: rootClientId
|
| 20549 |
-
}), (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 20550 |
-
className: "block-editor-inserter__manage-reusable-blocks-container"
|
| 20551 |
-
}, (0,external_wp_element_namespaceObject.createElement)("a", {
|
| 20552 |
-
className: "block-editor-inserter__manage-reusable-blocks",
|
| 20553 |
-
href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
|
| 20554 |
-
post_type: 'wp_block'
|
| 20555 |
-
})
|
| 20556 |
-
}, (0,external_wp_i18n_namespaceObject.__)('Manage Reusable blocks'))));
|
| 20557 |
-
}
|
| 20558 |
-
/* harmony default export */ var reusable_blocks_tab = (ReusableBlocksTab);
|
| 20559 |
-
//# sourceMappingURL=reusable-blocks-tab.js.map
|
| 20560 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-menu-extension/index.js
|
| 20561 |
-
/**
|
| 20562 |
-
* WordPress dependencies
|
| 20563 |
-
*/
|
| 20564 |
-
|
| 20565 |
-
const {
|
| 20566 |
-
Fill: __unstableInserterMenuExtension,
|
| 20567 |
-
Slot
|
| 20568 |
-
} = (0,external_wp_components_namespaceObject.createSlotFill)('__unstableInserterMenuExtension');
|
| 20569 |
-
__unstableInserterMenuExtension.Slot = Slot;
|
| 20570 |
-
/* harmony default export */ var inserter_menu_extension = (__unstableInserterMenuExtension);
|
| 20571 |
-
//# sourceMappingURL=index.js.map
|
| 20572 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/hooks/use-insertion-point.js
|
| 20573 |
/**
|
| 20574 |
* External dependencies
|
|
@@ -20846,6 +20924,371 @@ function getItemSearchRank(item, searchTerm, config = {}) {
|
|
| 20846 |
return rank;
|
| 20847 |
}
|
| 20848 |
//# sourceMappingURL=search-items.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20849 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/search-results.js
|
| 20850 |
|
| 20851 |
|
|
@@ -20876,7 +21319,7 @@ function getItemSearchRank(item, searchTerm, config = {}) {
|
|
| 20876 |
|
| 20877 |
|
| 20878 |
|
| 20879 |
-
const
|
| 20880 |
/**
|
| 20881 |
* Shared reference to an empty array for cases where it is important to avoid
|
| 20882 |
* returning a new array reference on every invocation and rerendering the component.
|
|
@@ -20932,7 +21375,7 @@ function InserterSearchResults({
|
|
| 20932 |
debouncedSpeak(resultsFoundMessage);
|
| 20933 |
}, [filterValue, debouncedSpeak]);
|
| 20934 |
const currentShownBlockTypes = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockTypes, {
|
| 20935 |
-
step:
|
| 20936 |
});
|
| 20937 |
const currentShownPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(currentShownBlockTypes.length === filteredBlockTypes.length ? filteredBlockPatterns : search_results_EMPTY_ARRAY);
|
| 20938 |
const hasItems = !(0,external_lodash_namespaceObject.isEmpty)(filteredBlockTypes) || !(0,external_lodash_namespaceObject.isEmpty)(filteredBlockPatterns);
|
|
@@ -23016,7 +23459,7 @@ function BlockSelectionButton({
|
|
| 23016 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
|
| 23017 |
justify: "center",
|
| 23018 |
className: "block-editor-block-list__block-selection-button__content"
|
| 23019 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(
|
| 23020 |
icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon,
|
| 23021 |
showColors: true
|
| 23022 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(block_draggable, {
|
|
@@ -23949,7 +24392,7 @@ function BlockParentSelector() {
|
|
| 23949 |
/* translators: %s: Name of the block's parent. */
|
| 23950 |
(0,external_wp_i18n_namespaceObject.__)('Select %s'), blockInformation.title),
|
| 23951 |
showTooltip: true,
|
| 23952 |
-
icon: (0,external_wp_element_namespaceObject.createElement)(
|
| 23953 |
icon: blockInformation.icon
|
| 23954 |
})
|
| 23955 |
}));
|
|
@@ -24050,7 +24493,7 @@ const BlockTransformationsMenu = ({
|
|
| 24050 |
disabled: isDisabled,
|
| 24051 |
onMouseLeave: () => setHoveredTransformItemName(null),
|
| 24052 |
onMouseEnter: () => setHoveredTransformItemName(name)
|
| 24053 |
-
}, (0,external_wp_element_namespaceObject.createElement)(
|
| 24054 |
icon: icon,
|
| 24055 |
showColors: true
|
| 24056 |
}), title);
|
|
@@ -24708,7 +25151,7 @@ const BlockSwitcherDropdownMenu = ({
|
|
| 24708 |
disabled: true,
|
| 24709 |
className: "block-editor-block-switcher__no-switcher-icon",
|
| 24710 |
title: blockTitle,
|
| 24711 |
-
icon: (0,external_wp_element_namespaceObject.createElement)(
|
| 24712 |
icon: icon,
|
| 24713 |
showColors: true
|
| 24714 |
})
|
|
@@ -24730,7 +25173,7 @@ const BlockSwitcherDropdownMenu = ({
|
|
| 24730 |
isAlternate: true,
|
| 24731 |
className: 'block-editor-block-switcher__popover'
|
| 24732 |
},
|
| 24733 |
-
icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(
|
| 24734 |
icon: icon,
|
| 24735 |
className: "block-editor-block-switcher__toggle",
|
| 24736 |
showColors: true
|
|
@@ -25548,7 +25991,24 @@ function BlockSettingsDropdown({
|
|
| 25548 |
const blockClientIds = (0,external_lodash_namespaceObject.castArray)(clientIds);
|
| 25549 |
const count = blockClientIds.length;
|
| 25550 |
const firstBlockClientId = blockClientIds[0];
|
| 25551 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25552 |
const shortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
| 25553 |
const {
|
| 25554 |
getShortcutRepresentation
|
|
@@ -25567,7 +26027,10 @@ function BlockSettingsDropdown({
|
|
| 25567 |
__experimentalSelectBlock(ids[0]);
|
| 25568 |
}
|
| 25569 |
} : external_lodash_namespaceObject.noop, [__experimentalSelectBlock]);
|
| 25570 |
-
const
|
|
|
|
|
|
|
|
|
|
| 25571 |
return (0,external_wp_element_namespaceObject.createElement)(BlockActions, {
|
| 25572 |
clientIds: clientIds,
|
| 25573 |
__experimentalUpdateSelection: !__experimentalSelectBlock
|
|
@@ -27069,17 +27532,18 @@ function useInnerBlocksProps(props = {}, options = {}) {
|
|
| 27069 |
clientId: clientId
|
| 27070 |
})) : (0,external_wp_element_namespaceObject.createElement)(BlockListItems, options)
|
| 27071 |
};
|
| 27072 |
-
}
|
|
|
|
| 27073 |
|
| 27074 |
ForwardedInnerBlocks.DefaultBlockAppender = inner_blocks_default_block_appender;
|
| 27075 |
ForwardedInnerBlocks.ButtonBlockAppender = inner_blocks_button_block_appender;
|
| 27076 |
-
|
| 27077 |
-
|
| 27078 |
-
}) => (0,external_wp_element_namespaceObject.createElement)(BlockContent, null));
|
| 27079 |
/**
|
| 27080 |
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md
|
| 27081 |
*/
|
| 27082 |
|
|
|
|
| 27083 |
/* harmony default export */ var inner_blocks = (ForwardedInnerBlocks);
|
| 27084 |
//# sourceMappingURL=index.js.map
|
| 27085 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/index.js
|
|
@@ -27230,205 +27694,6 @@ function BlockListItems(props) {
|
|
| 27230 |
}, (0,external_wp_element_namespaceObject.createElement)(Items, props));
|
| 27231 |
}
|
| 27232 |
//# sourceMappingURL=index.js.map
|
| 27233 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors/utils.js
|
| 27234 |
-
/**
|
| 27235 |
-
* External dependencies
|
| 27236 |
-
*/
|
| 27237 |
-
|
| 27238 |
-
|
| 27239 |
-
|
| 27240 |
-
|
| 27241 |
-
k([names, a11y]);
|
| 27242 |
-
/**
|
| 27243 |
-
* Provided an array of color objects as set by the theme or by the editor defaults,
|
| 27244 |
-
* and the values of the defined color or custom color returns a color object describing the color.
|
| 27245 |
-
*
|
| 27246 |
-
* @param {Array} colors Array of color objects as set by the theme or by the editor defaults.
|
| 27247 |
-
* @param {?string} definedColor A string containing the color slug.
|
| 27248 |
-
* @param {?string} customColor A string containing the customColor value.
|
| 27249 |
-
*
|
| 27250 |
-
* @return {?Object} If definedColor is passed and the name is found in colors,
|
| 27251 |
-
* the color object exactly as set by the theme or editor defaults is returned.
|
| 27252 |
-
* Otherwise, an object that just sets the color is defined.
|
| 27253 |
-
*/
|
| 27254 |
-
|
| 27255 |
-
const getColorObjectByAttributeValues = (colors, definedColor, customColor) => {
|
| 27256 |
-
if (definedColor) {
|
| 27257 |
-
const colorObj = (0,external_lodash_namespaceObject.find)(colors, {
|
| 27258 |
-
slug: definedColor
|
| 27259 |
-
});
|
| 27260 |
-
|
| 27261 |
-
if (colorObj) {
|
| 27262 |
-
return colorObj;
|
| 27263 |
-
}
|
| 27264 |
-
}
|
| 27265 |
-
|
| 27266 |
-
return {
|
| 27267 |
-
color: customColor
|
| 27268 |
-
};
|
| 27269 |
-
};
|
| 27270 |
-
/**
|
| 27271 |
-
* 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.
|
| 27272 |
-
*
|
| 27273 |
-
* @param {Array} colors Array of color objects as set by the theme or by the editor defaults.
|
| 27274 |
-
* @param {?string} colorValue A string containing the color value.
|
| 27275 |
-
*
|
| 27276 |
-
* @return {?Object} Color object included in the colors array whose color property equals colorValue.
|
| 27277 |
-
* Returns undefined if no color object matches this requirement.
|
| 27278 |
-
*/
|
| 27279 |
-
|
| 27280 |
-
const getColorObjectByColorValue = (colors, colorValue) => {
|
| 27281 |
-
return (0,external_lodash_namespaceObject.find)(colors, {
|
| 27282 |
-
color: colorValue
|
| 27283 |
-
});
|
| 27284 |
-
};
|
| 27285 |
-
/**
|
| 27286 |
-
* Returns a class based on the context a color is being used and its slug.
|
| 27287 |
-
*
|
| 27288 |
-
* @param {string} colorContextName Context/place where color is being used e.g: background, text etc...
|
| 27289 |
-
* @param {string} colorSlug Slug of the color.
|
| 27290 |
-
*
|
| 27291 |
-
* @return {?string} String with the class corresponding to the color in the provided context.
|
| 27292 |
-
* Returns undefined if either colorContextName or colorSlug are not provided.
|
| 27293 |
-
*/
|
| 27294 |
-
|
| 27295 |
-
function getColorClassName(colorContextName, colorSlug) {
|
| 27296 |
-
if (!colorContextName || !colorSlug) {
|
| 27297 |
-
return undefined;
|
| 27298 |
-
}
|
| 27299 |
-
|
| 27300 |
-
return `has-${(0,external_lodash_namespaceObject.kebabCase)(colorSlug)}-${colorContextName}`;
|
| 27301 |
-
}
|
| 27302 |
-
/**
|
| 27303 |
-
* Given an array of color objects and a color value returns the color value of the most readable color in the array.
|
| 27304 |
-
*
|
| 27305 |
-
* @param {Array} colors Array of color objects as set by the theme or by the editor defaults.
|
| 27306 |
-
* @param {?string} colorValue A string containing the color value.
|
| 27307 |
-
*
|
| 27308 |
-
* @return {string} String with the color value of the most readable color.
|
| 27309 |
-
*/
|
| 27310 |
-
|
| 27311 |
-
function getMostReadableColor(colors, colorValue) {
|
| 27312 |
-
const colordColor = w(colorValue);
|
| 27313 |
-
return (0,external_lodash_namespaceObject.maxBy)(colors, ({
|
| 27314 |
-
color
|
| 27315 |
-
}) => colordColor.contrast(color)).color;
|
| 27316 |
-
}
|
| 27317 |
-
//# sourceMappingURL=utils.js.map
|
| 27318 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/gradients/use-gradient.js
|
| 27319 |
-
/**
|
| 27320 |
-
* External dependencies
|
| 27321 |
-
*/
|
| 27322 |
-
|
| 27323 |
-
/**
|
| 27324 |
-
* WordPress dependencies
|
| 27325 |
-
*/
|
| 27326 |
-
|
| 27327 |
-
|
| 27328 |
-
|
| 27329 |
-
/**
|
| 27330 |
-
* Internal dependencies
|
| 27331 |
-
*/
|
| 27332 |
-
|
| 27333 |
-
|
| 27334 |
-
|
| 27335 |
-
|
| 27336 |
-
const use_gradient_EMPTY_ARRAY = [];
|
| 27337 |
-
function __experimentalGetGradientClass(gradientSlug) {
|
| 27338 |
-
if (!gradientSlug) {
|
| 27339 |
-
return undefined;
|
| 27340 |
-
}
|
| 27341 |
-
|
| 27342 |
-
return `has-${gradientSlug}-gradient-background`;
|
| 27343 |
-
}
|
| 27344 |
-
/**
|
| 27345 |
-
* Retrieves the gradient value per slug.
|
| 27346 |
-
*
|
| 27347 |
-
* @param {Array} gradients Gradient Palette
|
| 27348 |
-
* @param {string} slug Gradient slug
|
| 27349 |
-
*
|
| 27350 |
-
* @return {string} Gradient value.
|
| 27351 |
-
*/
|
| 27352 |
-
|
| 27353 |
-
function getGradientValueBySlug(gradients, slug) {
|
| 27354 |
-
const gradient = (0,external_lodash_namespaceObject.find)(gradients, ['slug', slug]);
|
| 27355 |
-
return gradient && gradient.gradient;
|
| 27356 |
-
}
|
| 27357 |
-
function __experimentalGetGradientObjectByGradientValue(gradients, value) {
|
| 27358 |
-
const gradient = (0,external_lodash_namespaceObject.find)(gradients, ['gradient', value]);
|
| 27359 |
-
return gradient;
|
| 27360 |
-
}
|
| 27361 |
-
/**
|
| 27362 |
-
* Retrieves the gradient slug per slug.
|
| 27363 |
-
*
|
| 27364 |
-
* @param {Array} gradients Gradient Palette
|
| 27365 |
-
* @param {string} value Gradient value
|
| 27366 |
-
* @return {string} Gradient slug.
|
| 27367 |
-
*/
|
| 27368 |
-
|
| 27369 |
-
function getGradientSlugByValue(gradients, value) {
|
| 27370 |
-
const gradient = __experimentalGetGradientObjectByGradientValue(gradients, value);
|
| 27371 |
-
|
| 27372 |
-
return gradient && gradient.slug;
|
| 27373 |
-
}
|
| 27374 |
-
function __experimentalUseGradient({
|
| 27375 |
-
gradientAttribute = 'gradient',
|
| 27376 |
-
customGradientAttribute = 'customGradient'
|
| 27377 |
-
} = {}) {
|
| 27378 |
-
const {
|
| 27379 |
-
clientId
|
| 27380 |
-
} = useBlockEditContext();
|
| 27381 |
-
const gradients = useSetting('color.gradients') || use_gradient_EMPTY_ARRAY;
|
| 27382 |
-
const {
|
| 27383 |
-
gradient,
|
| 27384 |
-
customGradient
|
| 27385 |
-
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
| 27386 |
-
const {
|
| 27387 |
-
getBlockAttributes
|
| 27388 |
-
} = select(store);
|
| 27389 |
-
const attributes = getBlockAttributes(clientId) || {};
|
| 27390 |
-
return {
|
| 27391 |
-
customGradient: attributes[customGradientAttribute],
|
| 27392 |
-
gradient: attributes[gradientAttribute]
|
| 27393 |
-
};
|
| 27394 |
-
}, [clientId, gradientAttribute, customGradientAttribute]);
|
| 27395 |
-
const {
|
| 27396 |
-
updateBlockAttributes
|
| 27397 |
-
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
| 27398 |
-
const setGradient = (0,external_wp_element_namespaceObject.useCallback)(newGradientValue => {
|
| 27399 |
-
const slug = getGradientSlugByValue(gradients, newGradientValue);
|
| 27400 |
-
|
| 27401 |
-
if (slug) {
|
| 27402 |
-
updateBlockAttributes(clientId, {
|
| 27403 |
-
[gradientAttribute]: slug,
|
| 27404 |
-
[customGradientAttribute]: undefined
|
| 27405 |
-
});
|
| 27406 |
-
return;
|
| 27407 |
-
}
|
| 27408 |
-
|
| 27409 |
-
updateBlockAttributes(clientId, {
|
| 27410 |
-
[gradientAttribute]: undefined,
|
| 27411 |
-
[customGradientAttribute]: newGradientValue
|
| 27412 |
-
});
|
| 27413 |
-
}, [gradients, clientId, updateBlockAttributes]);
|
| 27414 |
-
|
| 27415 |
-
const gradientClass = __experimentalGetGradientClass(gradient);
|
| 27416 |
-
|
| 27417 |
-
let gradientValue;
|
| 27418 |
-
|
| 27419 |
-
if (gradient) {
|
| 27420 |
-
gradientValue = getGradientValueBySlug(gradients, gradient);
|
| 27421 |
-
} else {
|
| 27422 |
-
gradientValue = customGradient;
|
| 27423 |
-
}
|
| 27424 |
-
|
| 27425 |
-
return {
|
| 27426 |
-
gradientClass,
|
| 27427 |
-
gradientValue,
|
| 27428 |
-
setGradient
|
| 27429 |
-
};
|
| 27430 |
-
}
|
| 27431 |
-
//# sourceMappingURL=use-gradient.js.map
|
| 27432 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors-gradients/control.js
|
| 27433 |
|
| 27434 |
|
|
@@ -27450,60 +27715,22 @@ function __experimentalUseGradient({
|
|
| 27450 |
*/
|
| 27451 |
|
| 27452 |
|
| 27453 |
-
|
| 27454 |
-
// translators: first %s: the color name or value (e.g. red or #ff0000)
|
| 27455 |
-
|
| 27456 |
-
const colorIndicatorAriaLabel = (0,external_wp_i18n_namespaceObject.__)('(Color: %s)'); // translators: first %s: the gradient name or value (e.g. red to green or linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)
|
| 27457 |
-
|
| 27458 |
-
|
| 27459 |
-
const gradientIndicatorAriaLabel = (0,external_wp_i18n_namespaceObject.__)('(Gradient: %s)');
|
| 27460 |
-
|
| 27461 |
const colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients'];
|
| 27462 |
|
| 27463 |
-
function VisualLabel({
|
| 27464 |
-
colors,
|
| 27465 |
-
gradients,
|
| 27466 |
-
label,
|
| 27467 |
-
currentTab,
|
| 27468 |
-
colorValue,
|
| 27469 |
-
gradientValue
|
| 27470 |
-
}) {
|
| 27471 |
-
let value, ariaLabel;
|
| 27472 |
-
|
| 27473 |
-
if (currentTab === 'color') {
|
| 27474 |
-
if (colorValue) {
|
| 27475 |
-
value = colorValue;
|
| 27476 |
-
const colorObject = getColorObjectByColorValue(colors, value);
|
| 27477 |
-
const colorName = colorObject && colorObject.name;
|
| 27478 |
-
ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(colorIndicatorAriaLabel, colorName || value);
|
| 27479 |
-
}
|
| 27480 |
-
} else if (currentTab === 'gradient' && gradientValue) {
|
| 27481 |
-
value = gradientValue;
|
| 27482 |
-
|
| 27483 |
-
const gradientObject = __experimentalGetGradientObjectByGradientValue(gradients, value);
|
| 27484 |
-
|
| 27485 |
-
const gradientName = gradientObject && gradientObject.name;
|
| 27486 |
-
ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(gradientIndicatorAriaLabel, gradientName || value);
|
| 27487 |
-
}
|
| 27488 |
-
|
| 27489 |
-
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, label, !!value && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
|
| 27490 |
-
colorValue: value,
|
| 27491 |
-
"aria-label": ariaLabel
|
| 27492 |
-
}));
|
| 27493 |
-
}
|
| 27494 |
-
|
| 27495 |
function ColorGradientControlInner({
|
| 27496 |
colors,
|
| 27497 |
gradients,
|
| 27498 |
disableCustomColors,
|
| 27499 |
disableCustomGradients,
|
|
|
|
| 27500 |
className,
|
| 27501 |
label,
|
| 27502 |
onColorChange,
|
| 27503 |
onGradientChange,
|
| 27504 |
colorValue,
|
| 27505 |
gradientValue,
|
| 27506 |
-
clearable
|
|
|
|
| 27507 |
}) {
|
| 27508 |
const canChooseAColor = onColorChange && (!(0,external_lodash_namespaceObject.isEmpty)(colors) || !disableCustomColors);
|
| 27509 |
const canChooseAGradient = onGradientChange && (!(0,external_lodash_namespaceObject.isEmpty)(gradients) || !disableCustomGradients);
|
|
@@ -27516,15 +27743,10 @@ function ColorGradientControlInner({
|
|
| 27516 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, {
|
| 27517 |
className: classnames_default()('block-editor-color-gradient-control', className)
|
| 27518 |
}, (0,external_wp_element_namespaceObject.createElement)("fieldset", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
|
| 27519 |
-
|
| 27520 |
-
}, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 27521 |
className: "block-editor-color-gradient-control__color-indicator"
|
| 27522 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, null, (0,external_wp_element_namespaceObject.createElement)(
|
| 27523 |
-
currentTab: currentTab,
|
| 27524 |
-
label: label,
|
| 27525 |
-
colorValue: colorValue,
|
| 27526 |
-
gradientValue: gradientValue
|
| 27527 |
-
})))), canChooseAColor && canChooseAGradient && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
|
| 27528 |
value: currentTab,
|
| 27529 |
onChange: setCurrentTab,
|
| 27530 |
label: (0,external_wp_i18n_namespaceObject.__)('Select color type'),
|
|
@@ -27544,6 +27766,7 @@ function ColorGradientControlInner({
|
|
| 27544 |
} : onColorChange,
|
| 27545 |
colors,
|
| 27546 |
disableCustomColors,
|
|
|
|
| 27547 |
clearable: clearable
|
| 27548 |
}), (currentTab === 'gradient' || !canChooseAColor) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.GradientPicker, {
|
| 27549 |
value: gradientValue,
|
|
@@ -27553,6 +27776,7 @@ function ColorGradientControlInner({
|
|
| 27553 |
} : onGradientChange,
|
| 27554 |
gradients,
|
| 27555 |
disableCustomGradients,
|
|
|
|
| 27556 |
clearable: clearable
|
| 27557 |
}))));
|
| 27558 |
}
|
|
@@ -27576,6 +27800,91 @@ function ColorGradientControl(props) {
|
|
| 27576 |
|
| 27577 |
/* harmony default export */ var control = (ColorGradientControl);
|
| 27578 |
//# sourceMappingURL=control.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27579 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/border-color.js
|
| 27580 |
|
| 27581 |
|
|
@@ -28458,10 +28767,10 @@ const BORDER_SUPPORT_KEY = '__experimentalBorder';
|
|
| 28458 |
function BorderPanel(props) {
|
| 28459 |
const isDisabled = useIsBorderDisabled(props);
|
| 28460 |
const isSupported = hasBorderSupport(props.name);
|
| 28461 |
-
const isColorSupported = useSetting('border.
|
| 28462 |
-
const isRadiusSupported = useSetting('border.
|
| 28463 |
-
const isStyleSupported = useSetting('border.
|
| 28464 |
-
const isWidthSupported = useSetting('border.
|
| 28465 |
|
| 28466 |
if (isDisabled || !isSupported) {
|
| 28467 |
return null;
|
|
@@ -28520,10 +28829,124 @@ function shouldSkipSerialization(blockType) {
|
|
| 28520 |
*/
|
| 28521 |
|
| 28522 |
const useIsBorderDisabled = () => {
|
| 28523 |
-
const configs = [!useSetting('border.
|
| 28524 |
return configs.every(Boolean);
|
| 28525 |
};
|
| 28526 |
//# sourceMappingURL=border.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28527 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js
|
| 28528 |
|
| 28529 |
|
|
@@ -28539,6 +28962,7 @@ const useIsBorderDisabled = () => {
|
|
| 28539 |
|
| 28540 |
|
| 28541 |
|
|
|
|
| 28542 |
/**
|
| 28543 |
* Internal dependencies
|
| 28544 |
*/
|
|
@@ -28548,10 +28972,10 @@ const useIsBorderDisabled = () => {
|
|
| 28548 |
|
| 28549 |
// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)
|
| 28550 |
|
| 28551 |
-
const
|
| 28552 |
|
| 28553 |
|
| 28554 |
-
const
|
| 28555 |
|
| 28556 |
const panel_color_gradient_settings_colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients'];
|
| 28557 |
|
|
@@ -28575,11 +28999,11 @@ const Indicators = ({
|
|
| 28575 |
|
| 28576 |
if (colorValue) {
|
| 28577 |
const colorObject = getColorObjectByColorValue(availableColors || colors, colorValue);
|
| 28578 |
-
ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
|
| 28579 |
} else {
|
| 28580 |
const gradientObject = __experimentalGetGradientObjectByGradientValue(availableGradients || gradients, colorValue);
|
| 28581 |
|
| 28582 |
-
ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
|
| 28583 |
}
|
| 28584 |
|
| 28585 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
|
|
@@ -28600,6 +29024,7 @@ const PanelColorGradientSettingsInner = ({
|
|
| 28600 |
settings,
|
| 28601 |
title,
|
| 28602 |
showTitle = true,
|
|
|
|
| 28603 |
...props
|
| 28604 |
}) => {
|
| 28605 |
if ((0,external_lodash_namespaceObject.isEmpty)(colors) && (0,external_lodash_namespaceObject.isEmpty)(gradients) && disableCustomColors && disableCustomGradients && (0,external_lodash_namespaceObject.every)(settings, setting => (0,external_lodash_namespaceObject.isEmpty)(setting.colors) && (0,external_lodash_namespaceObject.isEmpty)(setting.gradients) && (setting.disableCustomColors === undefined || setting.disableCustomColors) && (setting.disableCustomGradients === undefined || setting.disableCustomGradients))) {
|
|
@@ -28617,20 +29042,90 @@ const PanelColorGradientSettingsInner = ({
|
|
| 28617 |
className: classnames_default()('block-editor-panel-color-gradient-settings', className),
|
| 28618 |
title: showTitle ? titleElement : undefined
|
| 28619 |
}, props), settings.map((setting, index) => (0,external_wp_element_namespaceObject.createElement)(control, _extends({
|
|
|
|
| 28620 |
key: index,
|
| 28621 |
colors,
|
| 28622 |
gradients,
|
| 28623 |
disableCustomColors,
|
| 28624 |
-
disableCustomGradients
|
|
|
|
| 28625 |
}, setting))), children);
|
| 28626 |
};
|
| 28627 |
|
| 28628 |
-
|
| 28629 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28630 |
colorGradientSettings.colors = useSetting('color.palette');
|
| 28631 |
colorGradientSettings.gradients = useSetting('color.gradients');
|
| 28632 |
-
|
| 28633 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28634 |
return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsInner, _extends({}, colorGradientSettings, props));
|
| 28635 |
};
|
| 28636 |
|
|
@@ -28639,7 +29134,11 @@ const PanelColorGradientSettings = props => {
|
|
| 28639 |
return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsInner, props);
|
| 28640 |
}
|
| 28641 |
|
| 28642 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28643 |
};
|
| 28644 |
|
| 28645 |
/* harmony default export */ var panel_color_gradient_settings = (PanelColorGradientSettings);
|
|
@@ -28774,7 +29273,8 @@ function ColorPanel({
|
|
| 28774 |
title: (0,external_wp_i18n_namespaceObject.__)('Color'),
|
| 28775 |
initialOpen: false,
|
| 28776 |
settings: settings,
|
| 28777 |
-
showTitle: showTitle
|
|
|
|
| 28778 |
}, enableContrastChecking && (0,external_wp_element_namespaceObject.createElement)(contrast_checker, {
|
| 28779 |
backgroundColor: detectedBackgroundColor,
|
| 28780 |
textColor: detectedColor
|
|
@@ -29163,37 +29663,7 @@ const withColorPaletteStyles = (0,external_wp_compose_namespaceObject.createHigh
|
|
| 29163 |
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/color/addEditProps', color_addEditProps);
|
| 29164 |
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/color/with-color-palette-styles', withColorPaletteStyles);
|
| 29165 |
//# sourceMappingURL=color.js.map
|
| 29166 |
-
;// CONCATENATED MODULE: ./packages/
|
| 29167 |
-
|
| 29168 |
-
|
| 29169 |
-
/**
|
| 29170 |
-
* WordPress dependencies
|
| 29171 |
-
*/
|
| 29172 |
-
|
| 29173 |
-
const formatUnderline = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 29174 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 29175 |
-
viewBox: "0 0 24 24"
|
| 29176 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 29177 |
-
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"
|
| 29178 |
-
}));
|
| 29179 |
-
/* harmony default export */ var format_underline = (formatUnderline);
|
| 29180 |
-
//# sourceMappingURL=format-underline.js.map
|
| 29181 |
-
;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-strikethrough.js
|
| 29182 |
-
|
| 29183 |
-
|
| 29184 |
-
/**
|
| 29185 |
-
* WordPress dependencies
|
| 29186 |
-
*/
|
| 29187 |
-
|
| 29188 |
-
const formatStrikethrough = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 29189 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 29190 |
-
viewBox: "0 0 24 24"
|
| 29191 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 29192 |
-
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"
|
| 29193 |
-
}));
|
| 29194 |
-
/* harmony default export */ var format_strikethrough = (formatStrikethrough);
|
| 29195 |
-
//# sourceMappingURL=format-strikethrough.js.map
|
| 29196 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/text-decoration-control/index.js
|
| 29197 |
|
| 29198 |
|
| 29199 |
/**
|
|
@@ -29202,319 +29672,195 @@ const formatStrikethrough = (0,external_wp_element_namespaceObject.createElement
|
|
| 29202 |
|
| 29203 |
|
| 29204 |
|
| 29205 |
-
const
|
| 29206 |
-
name: (0,external_wp_i18n_namespaceObject.__)('
|
| 29207 |
-
value: '
|
| 29208 |
-
icon: format_underline
|
| 29209 |
}, {
|
| 29210 |
-
name: (0,external_wp_i18n_namespaceObject.__)('
|
| 29211 |
-
value: '
|
| 29212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29213 |
}];
|
| 29214 |
/**
|
| 29215 |
-
*
|
| 29216 |
-
*
|
| 29217 |
-
* @param {Object} props Component props.
|
| 29218 |
-
* @param {string} props.value Currently selected text decoration.
|
| 29219 |
-
* @param {Function} props.onChange Handles change in text decoration selection.
|
| 29220 |
*
|
| 29221 |
-
* @
|
|
|
|
|
|
|
| 29222 |
*/
|
| 29223 |
|
| 29224 |
-
|
| 29225 |
-
|
| 29226 |
-
|
| 29227 |
-
}
|
| 29228 |
-
return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
|
| 29229 |
-
className: "block-editor-text-decoration-control"
|
| 29230 |
-
}, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Decoration')), (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 29231 |
-
className: "block-editor-text-decoration-control__buttons"
|
| 29232 |
-
}, TEXT_DECORATIONS.map(textDecoration => {
|
| 29233 |
-
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
| 29234 |
-
key: textDecoration.value,
|
| 29235 |
-
icon: textDecoration.icon,
|
| 29236 |
-
isSmall: true,
|
| 29237 |
-
isPressed: textDecoration.value === value,
|
| 29238 |
-
onClick: () => onChange(textDecoration.value === value ? undefined : textDecoration.value),
|
| 29239 |
-
"aria-label": textDecoration.name
|
| 29240 |
-
});
|
| 29241 |
-
})));
|
| 29242 |
-
}
|
| 29243 |
-
//# sourceMappingURL=index.js.map
|
| 29244 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/text-decoration.js
|
| 29245 |
-
|
| 29246 |
-
|
| 29247 |
-
/**
|
| 29248 |
-
* WordPress dependencies
|
| 29249 |
-
*/
|
| 29250 |
-
|
| 29251 |
-
/**
|
| 29252 |
-
* Internal dependencies
|
| 29253 |
-
*/
|
| 29254 |
-
|
| 29255 |
-
|
| 29256 |
-
|
| 29257 |
|
| 29258 |
-
|
| 29259 |
-
|
| 29260 |
-
|
| 29261 |
-
*/
|
| 29262 |
|
| 29263 |
-
|
|
|
|
| 29264 |
/**
|
| 29265 |
-
*
|
| 29266 |
*
|
| 29267 |
-
* @param {Object} props
|
| 29268 |
*
|
| 29269 |
-
* @return {WPElement}
|
| 29270 |
*/
|
| 29271 |
|
| 29272 |
-
function
|
| 29273 |
-
var _style$typography;
|
| 29274 |
-
|
| 29275 |
const {
|
| 29276 |
-
|
| 29277 |
-
|
| 29278 |
-
|
| 29279 |
-
|
|
|
|
|
|
|
|
|
|
| 29280 |
} = props;
|
| 29281 |
-
const
|
| 29282 |
-
|
| 29283 |
-
|
| 29284 |
-
|
| 29285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29286 |
|
| 29287 |
-
|
| 29288 |
-
|
| 29289 |
-
|
| 29290 |
-
|
| 29291 |
-
|
| 29292 |
-
|
| 29293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29294 |
});
|
| 29295 |
-
|
| 29296 |
-
|
| 29297 |
-
return (0,external_wp_element_namespaceObject.createElement)(TextDecorationControl, {
|
| 29298 |
-
value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textDecoration,
|
| 29299 |
-
onChange: onChange
|
| 29300 |
-
});
|
| 29301 |
-
}
|
| 29302 |
-
/**
|
| 29303 |
-
* Checks if text-decoration settings have been disabled.
|
| 29304 |
-
*
|
| 29305 |
-
* @param {string} name Name of the block.
|
| 29306 |
-
*
|
| 29307 |
-
* @return {boolean} Whether or not the setting is disabled.
|
| 29308 |
-
*/
|
| 29309 |
-
|
| 29310 |
-
function useIsTextDecorationDisabled({
|
| 29311 |
-
name: blockName
|
| 29312 |
-
} = {}) {
|
| 29313 |
-
const notSupported = !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, TEXT_DECORATION_SUPPORT_KEY);
|
| 29314 |
-
const hasTextDecoration = useSetting('typography.customTextDecorations');
|
| 29315 |
-
return notSupported || !hasTextDecoration;
|
| 29316 |
-
}
|
| 29317 |
-
//# sourceMappingURL=text-decoration.js.map
|
| 29318 |
-
;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-uppercase.js
|
| 29319 |
-
|
| 29320 |
-
|
| 29321 |
-
/**
|
| 29322 |
-
* WordPress dependencies
|
| 29323 |
-
*/
|
| 29324 |
-
|
| 29325 |
-
const formatUppercase = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 29326 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 29327 |
-
viewBox: "0 0 24 24"
|
| 29328 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 29329 |
-
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"
|
| 29330 |
-
}));
|
| 29331 |
-
/* harmony default export */ var format_uppercase = (formatUppercase);
|
| 29332 |
-
//# sourceMappingURL=format-uppercase.js.map
|
| 29333 |
-
;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-lowercase.js
|
| 29334 |
-
|
| 29335 |
-
|
| 29336 |
-
/**
|
| 29337 |
-
* WordPress dependencies
|
| 29338 |
-
*/
|
| 29339 |
-
|
| 29340 |
-
const formatLowercase = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 29341 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 29342 |
-
viewBox: "0 0 24 24"
|
| 29343 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 29344 |
-
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"
|
| 29345 |
-
}));
|
| 29346 |
-
/* harmony default export */ var format_lowercase = (formatLowercase);
|
| 29347 |
-
//# sourceMappingURL=format-lowercase.js.map
|
| 29348 |
-
;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-capitalize.js
|
| 29349 |
-
|
| 29350 |
-
|
| 29351 |
-
/**
|
| 29352 |
-
* WordPress dependencies
|
| 29353 |
-
*/
|
| 29354 |
-
|
| 29355 |
-
const formatCapitalize = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 29356 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 29357 |
-
viewBox: "0 0 24 24"
|
| 29358 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 29359 |
-
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"
|
| 29360 |
-
}));
|
| 29361 |
-
/* harmony default export */ var format_capitalize = (formatCapitalize);
|
| 29362 |
-
//# sourceMappingURL=format-capitalize.js.map
|
| 29363 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/text-transform-control/index.js
|
| 29364 |
-
|
| 29365 |
-
|
| 29366 |
-
/**
|
| 29367 |
-
* WordPress dependencies
|
| 29368 |
-
*/
|
| 29369 |
-
|
| 29370 |
-
|
| 29371 |
|
| 29372 |
-
const TEXT_TRANSFORMS = [{
|
| 29373 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Uppercase'),
|
| 29374 |
-
value: 'uppercase',
|
| 29375 |
-
icon: format_uppercase
|
| 29376 |
-
}, {
|
| 29377 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Lowercase'),
|
| 29378 |
-
value: 'lowercase',
|
| 29379 |
-
icon: format_lowercase
|
| 29380 |
-
}, {
|
| 29381 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Capitalize'),
|
| 29382 |
-
value: 'capitalize',
|
| 29383 |
-
icon: format_capitalize
|
| 29384 |
-
}];
|
| 29385 |
-
/**
|
| 29386 |
-
* Control to facilitate text transform selections.
|
| 29387 |
-
*
|
| 29388 |
-
* @param {Object} props Component props.
|
| 29389 |
-
* @param {string} props.value Currently selected text transform.
|
| 29390 |
-
* @param {Function} props.onChange Handles change in text transform selection.
|
| 29391 |
-
*
|
| 29392 |
-
* @return {WPElement} Text transform control.
|
| 29393 |
-
*/
|
| 29394 |
|
| 29395 |
-
|
| 29396 |
-
|
| 29397 |
-
|
| 29398 |
-
|
| 29399 |
-
|
| 29400 |
-
|
| 29401 |
-
|
| 29402 |
-
|
| 29403 |
-
|
| 29404 |
-
|
| 29405 |
-
|
| 29406 |
-
|
| 29407 |
-
|
| 29408 |
-
|
| 29409 |
-
"aria-label": textTransform.name,
|
| 29410 |
-
onClick: () => onChange(value === textTransform.value ? undefined : textTransform.value)
|
| 29411 |
});
|
| 29412 |
-
|
| 29413 |
-
}
|
| 29414 |
-
//# sourceMappingURL=index.js.map
|
| 29415 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/text-transform.js
|
| 29416 |
-
|
| 29417 |
-
|
| 29418 |
-
/**
|
| 29419 |
-
* WordPress dependencies
|
| 29420 |
-
*/
|
| 29421 |
-
|
| 29422 |
-
/**
|
| 29423 |
-
* Internal dependencies
|
| 29424 |
-
*/
|
| 29425 |
-
|
| 29426 |
-
|
| 29427 |
-
|
| 29428 |
-
|
| 29429 |
-
/**
|
| 29430 |
-
* Key within block settings' supports array indicating support for text
|
| 29431 |
-
* transforms e.g. settings found in `block.json`.
|
| 29432 |
-
*/
|
| 29433 |
-
|
| 29434 |
-
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
|
| 29435 |
-
/**
|
| 29436 |
-
* Inspector control panel containing the text transform options.
|
| 29437 |
-
*
|
| 29438 |
-
* @param {Object} props Block properties.
|
| 29439 |
-
*
|
| 29440 |
-
* @return {WPElement} Text transform edit element.
|
| 29441 |
-
*/
|
| 29442 |
-
|
| 29443 |
-
function TextTransformEdit(props) {
|
| 29444 |
-
var _style$typography;
|
| 29445 |
|
| 29446 |
-
const {
|
| 29447 |
-
attributes: {
|
| 29448 |
-
style
|
| 29449 |
-
},
|
| 29450 |
-
setAttributes
|
| 29451 |
-
} = props;
|
| 29452 |
-
const isDisabled = useIsTextTransformDisabled(props);
|
| 29453 |
|
| 29454 |
-
|
| 29455 |
-
|
| 29456 |
-
|
| 29457 |
-
|
| 29458 |
-
|
| 29459 |
-
|
| 29460 |
-
|
| 29461 |
-
|
| 29462 |
-
|
|
|
|
|
|
|
|
|
|
| 29463 |
}
|
| 29464 |
-
})
|
| 29465 |
});
|
| 29466 |
-
|
|
|
|
| 29467 |
|
| 29468 |
-
return (0,external_wp_element_namespaceObject.createElement)(TextTransformControl, {
|
| 29469 |
-
value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textTransform,
|
| 29470 |
-
onChange: onChange
|
| 29471 |
-
});
|
| 29472 |
-
}
|
| 29473 |
-
/**
|
| 29474 |
-
* Checks if text-transform settings have been disabled.
|
| 29475 |
-
*
|
| 29476 |
-
* @param {string} name Name of the block.
|
| 29477 |
-
*
|
| 29478 |
-
* @return {boolean} Whether or not the setting is disabled.
|
| 29479 |
-
*/
|
| 29480 |
|
| 29481 |
-
|
| 29482 |
-
|
| 29483 |
-
|
| 29484 |
-
|
| 29485 |
-
const hasTextTransforms = useSetting('typography.customTextTransforms');
|
| 29486 |
-
return notSupported || !hasTextTransforms;
|
| 29487 |
-
}
|
| 29488 |
-
//# sourceMappingURL=text-transform.js.map
|
| 29489 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/text-decoration-and-transform/index.js
|
| 29490 |
|
|
|
|
|
|
|
|
|
|
| 29491 |
|
| 29492 |
-
|
| 29493 |
-
* Internal dependencies
|
| 29494 |
-
*/
|
| 29495 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29496 |
|
| 29497 |
-
|
| 29498 |
-
|
| 29499 |
-
|
| 29500 |
-
|
| 29501 |
-
*
|
| 29502 |
-
* @param {Object} props Block props to be passed on to individual controls.
|
| 29503 |
-
*
|
| 29504 |
-
* @return {WPElement} Component containing text decoration or transform controls.
|
| 29505 |
-
*/
|
| 29506 |
|
| 29507 |
-
|
| 29508 |
-
|
| 29509 |
-
|
|
|
|
| 29510 |
|
| 29511 |
-
|
| 29512 |
-
|
| 29513 |
-
}
|
| 29514 |
|
| 29515 |
-
return (0,external_wp_element_namespaceObject.createElement)(
|
| 29516 |
-
className: "
|
| 29517 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29518 |
}
|
| 29519 |
//# sourceMappingURL=index.js.map
|
| 29520 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/line-height-control/utils.js
|
|
@@ -29656,13 +30002,9 @@ function LineHeightEdit(props) {
|
|
| 29656 |
const {
|
| 29657 |
attributes: {
|
| 29658 |
style
|
| 29659 |
-
}
|
|
|
|
| 29660 |
} = props;
|
| 29661 |
-
const isDisabled = useIsLineHeightDisabled(props);
|
| 29662 |
-
|
| 29663 |
-
if (isDisabled) {
|
| 29664 |
-
return null;
|
| 29665 |
-
}
|
| 29666 |
|
| 29667 |
const onChange = newLineHeightValue => {
|
| 29668 |
const newStyle = { ...style,
|
|
@@ -29670,7 +30012,7 @@ function LineHeightEdit(props) {
|
|
| 29670 |
lineHeight: newLineHeightValue
|
| 29671 |
}
|
| 29672 |
};
|
| 29673 |
-
|
| 29674 |
style: cleanEmptyObject(newStyle)
|
| 29675 |
});
|
| 29676 |
};
|
|
@@ -29690,202 +30032,47 @@ function LineHeightEdit(props) {
|
|
| 29690 |
function useIsLineHeightDisabled({
|
| 29691 |
name: blockName
|
| 29692 |
} = {}) {
|
| 29693 |
-
const isDisabled = !useSetting('typography.
|
| 29694 |
return !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, LINE_HEIGHT_SUPPORT_KEY) || isDisabled;
|
| 29695 |
}
|
| 29696 |
-
//# sourceMappingURL=line-height.js.map
|
| 29697 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/font-appearance-control/index.js
|
| 29698 |
-
|
| 29699 |
-
|
| 29700 |
/**
|
| 29701 |
-
*
|
|
|
|
|
|
|
|
|
|
| 29702 |
*/
|
| 29703 |
|
|
|
|
|
|
|
| 29704 |
|
| 29705 |
-
|
| 29706 |
-
|
| 29707 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Regular'),
|
| 29708 |
-
value: 'normal'
|
| 29709 |
-
}, {
|
| 29710 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Italic'),
|
| 29711 |
-
value: 'italic'
|
| 29712 |
-
}];
|
| 29713 |
-
const FONT_WEIGHTS = [{
|
| 29714 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Thin'),
|
| 29715 |
-
value: '100'
|
| 29716 |
-
}, {
|
| 29717 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Extra Light'),
|
| 29718 |
-
value: '200'
|
| 29719 |
-
}, {
|
| 29720 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Light'),
|
| 29721 |
-
value: '300'
|
| 29722 |
-
}, {
|
| 29723 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Regular'),
|
| 29724 |
-
value: '400'
|
| 29725 |
-
}, {
|
| 29726 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Medium'),
|
| 29727 |
-
value: '500'
|
| 29728 |
-
}, {
|
| 29729 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Semi Bold'),
|
| 29730 |
-
value: '600'
|
| 29731 |
-
}, {
|
| 29732 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Bold'),
|
| 29733 |
-
value: '700'
|
| 29734 |
-
}, {
|
| 29735 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Extra Bold'),
|
| 29736 |
-
value: '800'
|
| 29737 |
-
}, {
|
| 29738 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Black'),
|
| 29739 |
-
value: '900'
|
| 29740 |
-
}];
|
| 29741 |
/**
|
| 29742 |
-
*
|
| 29743 |
-
*
|
| 29744 |
-
*
|
| 29745 |
*
|
| 29746 |
-
* @
|
|
|
|
|
|
|
| 29747 |
*/
|
| 29748 |
|
| 29749 |
-
function
|
|
|
|
|
|
|
|
|
|
| 29750 |
const {
|
| 29751 |
-
|
| 29752 |
-
|
| 29753 |
-
|
| 29754 |
-
|
| 29755 |
-
|
| 29756 |
-
|
| 29757 |
-
|
| 29758 |
-
|
| 29759 |
-
const hasStylesOrWeights = hasFontStyles || hasFontWeights;
|
| 29760 |
-
const defaultOption = {
|
| 29761 |
-
key: 'default',
|
| 29762 |
-
name: (0,external_wp_i18n_namespaceObject.__)('Default'),
|
| 29763 |
-
style: {
|
| 29764 |
-
fontStyle: undefined,
|
| 29765 |
-
fontWeight: undefined
|
| 29766 |
-
}
|
| 29767 |
-
}; // Combines both font style and weight options into a single dropdown.
|
| 29768 |
-
|
| 29769 |
-
const combineOptions = () => {
|
| 29770 |
-
const combinedOptions = [defaultOption];
|
| 29771 |
-
FONT_STYLES.forEach(({
|
| 29772 |
-
name: styleName,
|
| 29773 |
-
value: styleValue
|
| 29774 |
-
}) => {
|
| 29775 |
-
FONT_WEIGHTS.forEach(({
|
| 29776 |
-
name: weightName,
|
| 29777 |
-
value: weightValue
|
| 29778 |
-
}) => {
|
| 29779 |
-
const optionName = styleValue === 'normal' ? weightName : (0,external_wp_i18n_namespaceObject.sprintf)(
|
| 29780 |
-
/* translators: 1: Font weight name. 2: Font style name. */
|
| 29781 |
-
(0,external_wp_i18n_namespaceObject.__)('%1$s %2$s'), weightName, styleName);
|
| 29782 |
-
combinedOptions.push({
|
| 29783 |
-
key: `${styleValue}-${weightValue}`,
|
| 29784 |
-
name: optionName,
|
| 29785 |
-
style: {
|
| 29786 |
-
fontStyle: styleValue,
|
| 29787 |
-
fontWeight: weightValue
|
| 29788 |
-
}
|
| 29789 |
-
});
|
| 29790 |
-
});
|
| 29791 |
-
});
|
| 29792 |
-
return combinedOptions;
|
| 29793 |
-
}; // Generates select options for font styles only.
|
| 29794 |
-
|
| 29795 |
-
|
| 29796 |
-
const styleOptions = () => {
|
| 29797 |
-
const combinedOptions = [defaultOption];
|
| 29798 |
-
FONT_STYLES.forEach(({
|
| 29799 |
-
name,
|
| 29800 |
-
value
|
| 29801 |
-
}) => {
|
| 29802 |
-
combinedOptions.push({
|
| 29803 |
-
key: value,
|
| 29804 |
-
name,
|
| 29805 |
-
style: {
|
| 29806 |
-
fontStyle: value,
|
| 29807 |
-
fontWeight: undefined
|
| 29808 |
-
}
|
| 29809 |
-
});
|
| 29810 |
-
});
|
| 29811 |
-
return combinedOptions;
|
| 29812 |
-
}; // Generates select options for font weights only.
|
| 29813 |
-
|
| 29814 |
-
|
| 29815 |
-
const weightOptions = () => {
|
| 29816 |
-
const combinedOptions = [defaultOption];
|
| 29817 |
-
FONT_WEIGHTS.forEach(({
|
| 29818 |
-
name,
|
| 29819 |
-
value
|
| 29820 |
-
}) => {
|
| 29821 |
-
combinedOptions.push({
|
| 29822 |
-
key: value,
|
| 29823 |
-
name,
|
| 29824 |
-
style: {
|
| 29825 |
-
fontStyle: undefined,
|
| 29826 |
-
fontWeight: value
|
| 29827 |
-
}
|
| 29828 |
-
});
|
| 29829 |
-
});
|
| 29830 |
-
return combinedOptions;
|
| 29831 |
-
}; // Map font styles and weights to select options.
|
| 29832 |
-
|
| 29833 |
-
|
| 29834 |
-
const selectOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
| 29835 |
-
if (hasFontStyles && hasFontWeights) {
|
| 29836 |
-
return combineOptions();
|
| 29837 |
-
}
|
| 29838 |
-
|
| 29839 |
-
return hasFontStyles ? styleOptions() : weightOptions();
|
| 29840 |
-
}, [props.options]); // Find current selection by comparing font style & weight against options,
|
| 29841 |
-
// and fall back to the Default option if there is no matching option.
|
| 29842 |
-
|
| 29843 |
-
const currentSelection = selectOptions.find(option => option.style.fontStyle === fontStyle && option.style.fontWeight === fontWeight) || selectOptions[0]; // Adjusts field label in case either styles or weights are disabled.
|
| 29844 |
-
|
| 29845 |
-
const getLabel = () => {
|
| 29846 |
-
if (!hasFontStyles) {
|
| 29847 |
-
return (0,external_wp_i18n_namespaceObject.__)('Font weight');
|
| 29848 |
-
}
|
| 29849 |
-
|
| 29850 |
-
if (!hasFontWeights) {
|
| 29851 |
-
return (0,external_wp_i18n_namespaceObject.__)('Font style');
|
| 29852 |
-
}
|
| 29853 |
-
|
| 29854 |
-
return (0,external_wp_i18n_namespaceObject.__)('Appearance');
|
| 29855 |
-
}; // Adjusts screen reader description based on styles or weights.
|
| 29856 |
-
|
| 29857 |
-
|
| 29858 |
-
const getDescribedBy = () => {
|
| 29859 |
-
if (!currentSelection) {
|
| 29860 |
-
return (0,external_wp_i18n_namespaceObject.__)('No selected font appearance');
|
| 29861 |
-
}
|
| 29862 |
-
|
| 29863 |
-
if (!hasFontStyles) {
|
| 29864 |
-
return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font weight.
|
| 29865 |
-
(0,external_wp_i18n_namespaceObject.__)('Currently selected font weight: %s'), currentSelection.name);
|
| 29866 |
-
}
|
| 29867 |
-
|
| 29868 |
-
if (!hasFontWeights) {
|
| 29869 |
-
return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font style.
|
| 29870 |
-
(0,external_wp_i18n_namespaceObject.__)('Currently selected font style: %s'), currentSelection.name);
|
| 29871 |
-
}
|
| 29872 |
-
|
| 29873 |
-
return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font appearance.
|
| 29874 |
-
(0,external_wp_i18n_namespaceObject.__)('Currently selected font appearance: %s'), currentSelection.name);
|
| 29875 |
-
};
|
| 29876 |
-
|
| 29877 |
-
return hasStylesOrWeights && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CustomSelectControl, {
|
| 29878 |
-
className: "components-font-appearance-control",
|
| 29879 |
-
label: getLabel(),
|
| 29880 |
-
describedBy: getDescribedBy(),
|
| 29881 |
-
options: selectOptions,
|
| 29882 |
-
value: currentSelection,
|
| 29883 |
-
onChange: ({
|
| 29884 |
-
selectedItem
|
| 29885 |
-
}) => onChange(selectedItem.style)
|
| 29886 |
});
|
| 29887 |
}
|
| 29888 |
-
//# sourceMappingURL=
|
| 29889 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/font-appearance.js
|
| 29890 |
|
| 29891 |
|
|
@@ -29930,10 +30117,6 @@ function FontAppearanceEdit(props) {
|
|
| 29930 |
const hasFontStyles = !useIsFontStyleDisabled(props);
|
| 29931 |
const hasFontWeights = !useIsFontWeightDisabled(props);
|
| 29932 |
|
| 29933 |
-
if (!hasFontStyles && !hasFontWeights) {
|
| 29934 |
-
return null;
|
| 29935 |
-
}
|
| 29936 |
-
|
| 29937 |
const onChange = newStyles => {
|
| 29938 |
setAttributes({
|
| 29939 |
style: cleanEmptyObject({ ...style,
|
|
@@ -29971,7 +30154,7 @@ function useIsFontStyleDisabled({
|
|
| 29971 |
name: blockName
|
| 29972 |
} = {}) {
|
| 29973 |
const styleSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_STYLE_SUPPORT_KEY);
|
| 29974 |
-
const hasFontStyles = useSetting('typography.
|
| 29975 |
return !styleSupport || !hasFontStyles;
|
| 29976 |
}
|
| 29977 |
/**
|
|
@@ -29988,7 +30171,7 @@ function useIsFontWeightDisabled({
|
|
| 29988 |
name: blockName
|
| 29989 |
} = {}) {
|
| 29990 |
const weightSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_WEIGHT_SUPPORT_KEY);
|
| 29991 |
-
const hasFontWeights = useSetting('typography.
|
| 29992 |
return !weightSupport || !hasFontWeights;
|
| 29993 |
}
|
| 29994 |
/**
|
|
@@ -30004,6 +30187,49 @@ function useIsFontAppearanceDisabled(props) {
|
|
| 30004 |
const weightsDisabled = useIsFontWeightDisabled(props);
|
| 30005 |
return stylesDisabled && weightsDisabled;
|
| 30006 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30007 |
//# sourceMappingURL=font-appearance.js.map
|
| 30008 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/font-family/index.js
|
| 30009 |
|
|
@@ -30086,8 +30312,8 @@ const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
|
|
| 30086 |
* Filters registered block settings, extending attributes to include
|
| 30087 |
* the `fontFamily` attribute.
|
| 30088 |
*
|
| 30089 |
-
* @param
|
| 30090 |
-
* @return {Object}
|
| 30091 |
*/
|
| 30092 |
|
| 30093 |
function font_family_addAttributes(settings) {
|
|
@@ -30109,10 +30335,10 @@ function font_family_addAttributes(settings) {
|
|
| 30109 |
/**
|
| 30110 |
* Override props assigned to save component to inject font family.
|
| 30111 |
*
|
| 30112 |
-
* @param
|
| 30113 |
-
* @param
|
| 30114 |
-
* @param
|
| 30115 |
-
* @return {Object}
|
| 30116 |
*/
|
| 30117 |
|
| 30118 |
|
|
@@ -30121,7 +30347,7 @@ function font_family_addSaveProps(props, blockType, attributes) {
|
|
| 30121 |
return props;
|
| 30122 |
}
|
| 30123 |
|
| 30124 |
-
if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, '
|
| 30125 |
return props;
|
| 30126 |
}
|
| 30127 |
|
|
@@ -30167,7 +30393,6 @@ function font_family_addEditProps(settings) {
|
|
| 30167 |
}
|
| 30168 |
|
| 30169 |
function FontFamilyEdit({
|
| 30170 |
-
name,
|
| 30171 |
setAttributes,
|
| 30172 |
attributes: {
|
| 30173 |
fontFamily
|
|
@@ -30176,14 +30401,6 @@ function FontFamilyEdit({
|
|
| 30176 |
var _find;
|
| 30177 |
|
| 30178 |
const fontFamilies = useSetting('typography.fontFamilies');
|
| 30179 |
-
const isDisable = useIsFontFamilyDisabled({
|
| 30180 |
-
name
|
| 30181 |
-
});
|
| 30182 |
-
|
| 30183 |
-
if (isDisable) {
|
| 30184 |
-
return null;
|
| 30185 |
-
}
|
| 30186 |
-
|
| 30187 |
const value = (_find = (0,external_lodash_namespaceObject.find)(fontFamilies, ({
|
| 30188 |
slug
|
| 30189 |
}) => fontFamily === slug)) === null || _find === void 0 ? void 0 : _find.fontFamily;
|
|
@@ -30217,6 +30434,32 @@ function useIsFontFamilyDisabled({
|
|
| 30217 |
const fontFamilies = useSetting('typography.fontFamilies');
|
| 30218 |
return !fontFamilies || fontFamilies.length === 0 || !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_FAMILY_SUPPORT_KEY);
|
| 30219 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30220 |
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/fontFamily/addAttribute', font_family_addAttributes);
|
| 30221 |
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/fontFamily/addSaveProps', font_family_addSaveProps);
|
| 30222 |
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/fontFamily/addEditProps', font_family_addEditProps);
|
|
@@ -30435,7 +30678,6 @@ function FontSizeEdit(props) {
|
|
| 30435 |
},
|
| 30436 |
setAttributes
|
| 30437 |
} = props;
|
| 30438 |
-
const isDisabled = useIsFontSizeDisabled(props);
|
| 30439 |
const fontSizes = useSetting('typography.fontSizes');
|
| 30440 |
|
| 30441 |
const onChange = value => {
|
|
@@ -30450,15 +30692,54 @@ function FontSizeEdit(props) {
|
|
| 30450 |
});
|
| 30451 |
};
|
| 30452 |
|
| 30453 |
-
if (isDisabled) {
|
| 30454 |
-
return null;
|
| 30455 |
-
}
|
| 30456 |
-
|
| 30457 |
const fontSizeObject = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontSize);
|
| 30458 |
const fontSizeValue = (fontSizeObject === null || fontSizeObject === void 0 ? void 0 : fontSizeObject.size) || (style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontSize) || fontSize;
|
| 30459 |
return (0,external_wp_element_namespaceObject.createElement)(font_size_picker, {
|
| 30460 |
onChange: onChange,
|
| 30461 |
-
value: fontSizeValue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30462 |
});
|
| 30463 |
}
|
| 30464 |
/**
|
|
@@ -30486,7 +30767,7 @@ function useIsFontSizeDisabled({
|
|
| 30486 |
*/
|
| 30487 |
|
| 30488 |
const withFontSizeInlineStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => {
|
| 30489 |
-
var _style$
|
| 30490 |
|
| 30491 |
const fontSizes = useSetting('typography.fontSizes');
|
| 30492 |
const {
|
|
@@ -30501,11 +30782,11 @@ const withFontSizeInlineStyles = (0,external_wp_compose_namespaceObject.createHi
|
|
| 30501 |
// doesn't already have an inline font size,
|
| 30502 |
// and does have a class to extract the font size from.
|
| 30503 |
|
| 30504 |
-
if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_SIZE_SUPPORT_KEY) || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'typography.__experimentalSkipSerialization') || !fontSize || style !== null && style !== void 0 && (_style$
|
| 30505 |
return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, props);
|
| 30506 |
}
|
| 30507 |
|
| 30508 |
-
const fontSizeValue = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$
|
| 30509 |
const newProps = { ...props,
|
| 30510 |
wrapperProps: { ...wrapperProps,
|
| 30511 |
style: {
|
|
@@ -30521,6 +30802,393 @@ const withFontSizeInlineStyles = (0,external_wp_compose_namespaceObject.createHi
|
|
| 30521 |
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/font/addEditProps', font_size_addEditProps);
|
| 30522 |
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/font-size/with-font-size-inline-styles', withFontSizeInlineStyles);
|
| 30523 |
//# sourceMappingURL=font-size.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30524 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/letter-spacing-control/index.js
|
| 30525 |
|
| 30526 |
|
|
@@ -30537,15 +31205,18 @@ const withFontSizeInlineStyles = (0,external_wp_compose_namespaceObject.createHi
|
|
| 30537 |
/**
|
| 30538 |
* Control for letter-spacing.
|
| 30539 |
*
|
| 30540 |
-
* @param {Object} props
|
| 30541 |
-
* @param {string} props.value
|
| 30542 |
-
* @param {Function} props.onChange
|
| 30543 |
-
* @
|
|
|
|
|
|
|
| 30544 |
*/
|
| 30545 |
|
| 30546 |
function LetterSpacingControl({
|
| 30547 |
value,
|
| 30548 |
-
onChange
|
|
|
|
| 30549 |
}) {
|
| 30550 |
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
|
| 30551 |
availableUnits: useSetting('spacing.units') || ['px', 'em', 'rem'],
|
|
@@ -30558,7 +31229,7 @@ function LetterSpacingControl({
|
|
| 30558 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
|
| 30559 |
label: (0,external_wp_i18n_namespaceObject.__)('Letter-spacing'),
|
| 30560 |
value: value,
|
| 30561 |
-
__unstableInputWidth:
|
| 30562 |
units: units,
|
| 30563 |
onChange: onChange
|
| 30564 |
});
|
|
@@ -30600,11 +31271,6 @@ function LetterSpacingEdit(props) {
|
|
| 30600 |
},
|
| 30601 |
setAttributes
|
| 30602 |
} = props;
|
| 30603 |
-
const isDisabled = useIsLetterSpacingDisabled(props);
|
| 30604 |
-
|
| 30605 |
-
if (isDisabled) {
|
| 30606 |
-
return null;
|
| 30607 |
-
}
|
| 30608 |
|
| 30609 |
function onChange(newSpacing) {
|
| 30610 |
setAttributes({
|
|
@@ -30618,7 +31284,8 @@ function LetterSpacingEdit(props) {
|
|
| 30618 |
|
| 30619 |
return (0,external_wp_element_namespaceObject.createElement)(LetterSpacingControl, {
|
| 30620 |
value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.letterSpacing,
|
| 30621 |
-
onChange: onChange
|
|
|
|
| 30622 |
});
|
| 30623 |
}
|
| 30624 |
/**
|
|
@@ -30632,19 +31299,52 @@ function useIsLetterSpacingDisabled({
|
|
| 30632 |
name: blockName
|
| 30633 |
} = {}) {
|
| 30634 |
const notSupported = !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, LETTER_SPACING_SUPPORT_KEY);
|
| 30635 |
-
const hasLetterSpacing = useSetting('typography.
|
| 30636 |
return notSupported || !hasLetterSpacing;
|
| 30637 |
}
|
| 30638 |
-
|
| 30639 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30640 |
|
|
|
|
|
|
|
| 30641 |
|
|
|
|
|
|
|
| 30642 |
/**
|
| 30643 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30644 |
*/
|
| 30645 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30646 |
/**
|
| 30647 |
-
*
|
| 30648 |
*/
|
| 30649 |
|
| 30650 |
|
|
@@ -30665,12 +31365,116 @@ function useIsLetterSpacingDisabled({
|
|
| 30665 |
const TYPOGRAPHY_SUPPORT_KEY = 'typography';
|
| 30666 |
const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
|
| 30667 |
function TypographyPanel(props) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30668 |
const isDisabled = useIsTypographyDisabled(props);
|
| 30669 |
const isSupported = hasTypographySupport(props.name);
|
| 30670 |
if (isDisabled || !isSupported) return null;
|
| 30671 |
-
|
| 30672 |
-
|
| 30673 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30674 |
}
|
| 30675 |
|
| 30676 |
const hasTypographySupport = blockName => {
|
|
@@ -30899,7 +31703,7 @@ function resetMargin({
|
|
| 30899 |
function useIsMarginDisabled({
|
| 30900 |
name: blockName
|
| 30901 |
} = {}) {
|
| 30902 |
-
const isDisabled = !useSetting('spacing.
|
| 30903 |
const isInvalid = !useIsDimensionsSupportValid(blockName, 'margin');
|
| 30904 |
return !hasMarginSupport(blockName) || isDisabled || isInvalid;
|
| 30905 |
}
|
|
@@ -31044,7 +31848,7 @@ function resetPadding({
|
|
| 31044 |
function useIsPaddingDisabled({
|
| 31045 |
name: blockName
|
| 31046 |
} = {}) {
|
| 31047 |
-
const isDisabled = !useSetting('spacing.
|
| 31048 |
const isInvalid = !useIsDimensionsSupportValid(blockName, 'padding');
|
| 31049 |
return !hasPaddingSupport(blockName) || isDisabled || isInvalid;
|
| 31050 |
}
|
|
@@ -31533,7 +32337,8 @@ function DuotoneControl({
|
|
| 31533 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
|
| 31534 |
popoverProps: {
|
| 31535 |
className: 'block-editor-duotone-control__popover',
|
| 31536 |
-
headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone')
|
|
|
|
| 31537 |
},
|
| 31538 |
renderToggle: ({
|
| 31539 |
isOpen,
|
|
@@ -31560,7 +32365,9 @@ function DuotoneControl({
|
|
| 31560 |
},
|
| 31561 |
renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
|
| 31562 |
label: (0,external_wp_i18n_namespaceObject.__)('Duotone')
|
| 31563 |
-
}, (0,external_wp_element_namespaceObject.createElement)(
|
|
|
|
|
|
|
| 31564 |
colorPalette: colorPalette,
|
| 31565 |
duotonePalette: duotonePalette,
|
| 31566 |
disableCustomColors: disableCustomColors,
|
|
@@ -31612,13 +32419,15 @@ function getValuesFromColors(colors = []) {
|
|
| 31612 |
const values = {
|
| 31613 |
r: [],
|
| 31614 |
g: [],
|
| 31615 |
-
b: []
|
|
|
|
| 31616 |
};
|
| 31617 |
colors.forEach(color => {
|
| 31618 |
const rgbColor = w(color).toRgb();
|
| 31619 |
values.r.push(rgbColor.r / 255);
|
| 31620 |
values.g.push(rgbColor.g / 255);
|
| 31621 |
values.b.push(rgbColor.b / 255);
|
|
|
|
| 31622 |
});
|
| 31623 |
return values;
|
| 31624 |
}
|
|
@@ -31629,6 +32438,7 @@ function getValuesFromColors(colors = []) {
|
|
| 31629 |
* @property {number[]} r Red values.
|
| 31630 |
* @property {number[]} g Green values.
|
| 31631 |
* @property {number[]} b Blue values.
|
|
|
|
| 31632 |
*/
|
| 31633 |
|
| 31634 |
/**
|
|
@@ -31637,7 +32447,7 @@ function getValuesFromColors(colors = []) {
|
|
| 31637 |
* @param {Object} props Duotone props.
|
| 31638 |
* @param {string} props.selector Selector to apply the filter to.
|
| 31639 |
* @param {string} props.id Unique id for this duotone filter.
|
| 31640 |
-
* @param {Values} props.values R, G, and
|
| 31641 |
*
|
| 31642 |
* @return {WPElement} Duotone element.
|
| 31643 |
*/
|
|
@@ -31668,10 +32478,11 @@ ${selector} {
|
|
| 31668 |
}, (0,external_wp_element_namespaceObject.createElement)("defs", null, (0,external_wp_element_namespaceObject.createElement)("filter", {
|
| 31669 |
id: id
|
| 31670 |
}, (0,external_wp_element_namespaceObject.createElement)("feColorMatrix", {
|
|
|
|
|
|
|
| 31671 |
type: "matrix" // Use perceptual brightness to convert to grayscale.
|
| 31672 |
-
// prettier-ignore
|
| 31673 |
,
|
| 31674 |
-
values: ".299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0
|
| 31675 |
}), (0,external_wp_element_namespaceObject.createElement)("feComponentTransfer", {
|
| 31676 |
// Use sRGB instead of linearRGB to be consistent with how CSS gradients work.
|
| 31677 |
colorInterpolationFilters: "sRGB"
|
|
@@ -31684,7 +32495,14 @@ ${selector} {
|
|
| 31684 |
}), (0,external_wp_element_namespaceObject.createElement)("feFuncB", {
|
| 31685 |
type: "table",
|
| 31686 |
tableValues: values.b.join(' ')
|
| 31687 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31688 |
dangerouslySetInnerHTML: {
|
| 31689 |
__html: stylesheet
|
| 31690 |
}
|
|
@@ -32731,8 +33549,7 @@ function AlignmentUI({
|
|
| 32731 |
icon: setIcon(),
|
| 32732 |
label: label,
|
| 32733 |
toggleProps: {
|
| 32734 |
-
describedBy
|
| 32735 |
-
className: activeAlignment ? 'is-pressed' : undefined
|
| 32736 |
},
|
| 32737 |
popoverProps: ui_POPOVER_PROPS,
|
| 32738 |
controls: alignmentControls.map(control => {
|
|
@@ -32837,7 +33654,7 @@ function createBlockCompleter() {
|
|
| 32837 |
return {
|
| 32838 |
key: `block-${blockItem.id}`,
|
| 32839 |
value: blockItem,
|
| 32840 |
-
label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(
|
| 32841 |
key: "icon",
|
| 32842 |
icon: icon,
|
| 32843 |
showColors: true
|
|
@@ -33395,7 +34212,7 @@ function ListViewLeaf({
|
|
| 33395 |
isSelected,
|
| 33396 |
adjustScrolling: false,
|
| 33397 |
enableAnimation: true,
|
| 33398 |
-
triggerAnimationOnChange: path
|
| 33399 |
});
|
| 33400 |
return (0,external_wp_element_namespaceObject.createElement)(AnimatedTreeGridRow, _extends({
|
| 33401 |
ref: ref,
|
|
@@ -33520,7 +34337,7 @@ function ListViewBlockSelectButton({
|
|
| 33520 |
draggable: draggable
|
| 33521 |
}, (0,external_wp_element_namespaceObject.createElement)(ListViewExpander, {
|
| 33522 |
onClick: onToggleExpanded
|
| 33523 |
-
}), (0,external_wp_element_namespaceObject.createElement)(
|
| 33524 |
icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon,
|
| 33525 |
showColors: true
|
| 33526 |
}), (0,external_wp_element_namespaceObject.createElement)(BlockTitle, {
|
|
@@ -33647,14 +34464,13 @@ const useListViewContext = () => (0,external_wp_element_namespaceObject.useConte
|
|
| 33647 |
|
| 33648 |
|
| 33649 |
|
|
|
|
| 33650 |
function ListViewBlock({
|
| 33651 |
block,
|
| 33652 |
-
isSelected,
|
| 33653 |
isDragged,
|
|
|
|
| 33654 |
isBranchSelected,
|
| 33655 |
-
|
| 33656 |
-
onClick,
|
| 33657 |
-
onToggleExpanded,
|
| 33658 |
position,
|
| 33659 |
level,
|
| 33660 |
rowCount,
|
|
@@ -33671,16 +34487,19 @@ function ListViewBlock({
|
|
| 33671 |
const {
|
| 33672 |
toggleBlockHighlight
|
| 33673 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33674 |
const hasSiblings = siblingBlockCount > 0;
|
| 33675 |
const hasRenderedMovers = showBlockMovers && hasSiblings;
|
| 33676 |
const moverCellClassName = classnames_default()('block-editor-list-view-block__mover-cell', {
|
| 33677 |
'is-visible': isHovered || isSelected
|
| 33678 |
});
|
| 33679 |
-
const {
|
| 33680 |
-
__experimentalFeatures: withExperimentalFeatures,
|
| 33681 |
-
__experimentalPersistentListViewFeatures: withExperimentalPersistentListViewFeatures,
|
| 33682 |
-
isTreeGridMounted
|
| 33683 |
-
} = useListViewContext();
|
| 33684 |
const listViewBlockSettingsClassName = classnames_default()('block-editor-list-view-block__menu-cell', {
|
| 33685 |
'is-visible': isHovered || isSelected
|
| 33686 |
}); // If ListView has experimental features related to the Persistent List View,
|
|
@@ -33693,22 +34512,43 @@ function ListViewBlock({
|
|
| 33693 |
}
|
| 33694 |
}, []);
|
| 33695 |
const highlightBlock = withExperimentalPersistentListViewFeatures ? toggleBlockHighlight : () => {};
|
| 33696 |
-
|
| 33697 |
-
const onMouseEnter = () => {
|
| 33698 |
setIsHovered(true);
|
| 33699 |
highlightBlock(clientId, true);
|
| 33700 |
-
};
|
| 33701 |
-
|
| 33702 |
-
const onMouseLeave = () => {
|
| 33703 |
setIsHovered(false);
|
| 33704 |
highlightBlock(clientId, false);
|
| 33705 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33706 |
|
| 33707 |
const classes = classnames_default()({
|
| 33708 |
'is-selected': isSelected,
|
| 33709 |
'is-branch-selected': withExperimentalPersistentListViewFeatures && isBranchSelected,
|
| 33710 |
-
'is-
|
| 33711 |
-
'
|
| 33712 |
});
|
| 33713 |
return (0,external_wp_element_namespaceObject.createElement)(ListViewLeaf, {
|
| 33714 |
className: classes,
|
|
@@ -33725,7 +34565,7 @@ function ListViewBlock({
|
|
| 33725 |
isExpanded: isExpanded
|
| 33726 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, {
|
| 33727 |
className: "block-editor-list-view-block__contents-cell",
|
| 33728 |
-
colSpan:
|
| 33729 |
ref: cellRef
|
| 33730 |
}, ({
|
| 33731 |
ref,
|
|
@@ -33735,8 +34575,8 @@ function ListViewBlock({
|
|
| 33735 |
className: "block-editor-list-view-block__contents-container"
|
| 33736 |
}, (0,external_wp_element_namespaceObject.createElement)(block_contents, {
|
| 33737 |
block: block,
|
| 33738 |
-
onClick:
|
| 33739 |
-
onToggleExpanded:
|
| 33740 |
isSelected: isSelected,
|
| 33741 |
position: position,
|
| 33742 |
siblingBlockCount: siblingBlockCount,
|
|
@@ -33767,7 +34607,7 @@ function ListViewBlock({
|
|
| 33767 |
ref: ref,
|
| 33768 |
tabIndex: tabIndex,
|
| 33769 |
onFocus: onFocus
|
| 33770 |
-
})))),
|
| 33771 |
className: listViewBlockSettingsClassName
|
| 33772 |
}, ({
|
| 33773 |
ref,
|
|
@@ -33783,11 +34623,13 @@ function ListViewBlock({
|
|
| 33783 |
onFocus
|
| 33784 |
},
|
| 33785 |
disableOpenOnArrowDown: true,
|
| 33786 |
-
__experimentalSelectBlock:
|
| 33787 |
})));
|
| 33788 |
}
|
|
|
|
|
|
|
| 33789 |
//# sourceMappingURL=block.js.map
|
| 33790 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/list-view/
|
| 33791 |
|
| 33792 |
|
| 33793 |
/**
|
|
@@ -33800,8 +34642,6 @@ function ListViewBlock({
|
|
| 33800 |
|
| 33801 |
|
| 33802 |
|
| 33803 |
-
|
| 33804 |
-
|
| 33805 |
/**
|
| 33806 |
* Internal dependencies
|
| 33807 |
*/
|
|
@@ -33809,193 +34649,141 @@ function ListViewBlock({
|
|
| 33809 |
|
| 33810 |
|
| 33811 |
|
| 33812 |
-
function ListViewAppender({
|
| 33813 |
-
parentBlockClientId,
|
| 33814 |
-
position,
|
| 33815 |
-
level,
|
| 33816 |
-
rowCount,
|
| 33817 |
-
path
|
| 33818 |
-
}) {
|
| 33819 |
-
const isDragging = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
| 33820 |
-
const {
|
| 33821 |
-
isBlockBeingDragged,
|
| 33822 |
-
isAncestorBeingDragged
|
| 33823 |
-
} = select(store);
|
| 33824 |
-
return isBlockBeingDragged(parentBlockClientId) || isAncestorBeingDragged(parentBlockClientId);
|
| 33825 |
-
}, [parentBlockClientId]);
|
| 33826 |
-
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewAppender);
|
| 33827 |
-
const descriptionId = `list-view-appender-row__description_${instanceId}`;
|
| 33828 |
-
const appenderPositionDescription = (0,external_wp_i18n_namespaceObject.sprintf)(
|
| 33829 |
-
/* translators: 1: The numerical position of the block that will be inserted. 2: The level of nesting for the block that will be inserted. */
|
| 33830 |
-
(0,external_wp_i18n_namespaceObject.__)('Add block at position %1$d, Level %2$d'), position, level);
|
| 33831 |
-
return (0,external_wp_element_namespaceObject.createElement)(ListViewLeaf, {
|
| 33832 |
-
className: classnames_default()({
|
| 33833 |
-
'is-dragging': isDragging
|
| 33834 |
-
}),
|
| 33835 |
-
level: level,
|
| 33836 |
-
position: position,
|
| 33837 |
-
rowCount: rowCount,
|
| 33838 |
-
path: path
|
| 33839 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, {
|
| 33840 |
-
className: "block-editor-list-view-appender__cell",
|
| 33841 |
-
colSpan: "3"
|
| 33842 |
-
}, ({
|
| 33843 |
-
ref,
|
| 33844 |
-
tabIndex,
|
| 33845 |
-
onFocus
|
| 33846 |
-
}) => (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 33847 |
-
className: "block-editor-list-view-appender__container"
|
| 33848 |
-
}, (0,external_wp_element_namespaceObject.createElement)(inserter, {
|
| 33849 |
-
rootClientId: parentBlockClientId,
|
| 33850 |
-
__experimentalIsQuick: true,
|
| 33851 |
-
"aria-describedby": descriptionId,
|
| 33852 |
-
toggleProps: {
|
| 33853 |
-
ref,
|
| 33854 |
-
tabIndex,
|
| 33855 |
-
onFocus
|
| 33856 |
-
}
|
| 33857 |
-
}), (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 33858 |
-
className: "block-editor-list-view-appender__description",
|
| 33859 |
-
id: descriptionId
|
| 33860 |
-
}, appenderPositionDescription))));
|
| 33861 |
-
}
|
| 33862 |
-
//# sourceMappingURL=appender.js.map
|
| 33863 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/list-view/branch.js
|
| 33864 |
-
|
| 33865 |
-
|
| 33866 |
/**
|
| 33867 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33868 |
*/
|
| 33869 |
|
| 33870 |
-
|
| 33871 |
-
|
| 33872 |
-
*/
|
| 33873 |
|
|
|
|
| 33874 |
|
| 33875 |
-
|
| 33876 |
-
|
| 33877 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33878 |
|
|
|
|
|
|
|
| 33879 |
|
|
|
|
| 33880 |
|
|
|
|
|
|
|
|
|
|
| 33881 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33882 |
|
| 33883 |
function ListViewBranch(props) {
|
| 33884 |
const {
|
| 33885 |
blocks,
|
| 33886 |
selectBlock,
|
| 33887 |
-
showAppender,
|
| 33888 |
showBlockMovers,
|
| 33889 |
showNestedBlocks,
|
| 33890 |
-
|
| 33891 |
level = 1,
|
| 33892 |
-
|
| 33893 |
-
path = [],
|
| 33894 |
isBranchSelected = false,
|
| 33895 |
-
|
|
|
|
| 33896 |
} = props;
|
| 33897 |
const {
|
| 33898 |
expandedState,
|
| 33899 |
-
expand,
|
| 33900 |
-
collapse,
|
| 33901 |
draggedClientIds,
|
| 33902 |
-
|
| 33903 |
} = useListViewContext();
|
| 33904 |
-
const isTreeRoot = !parentBlockClientId;
|
| 33905 |
const filteredBlocks = (0,external_lodash_namespaceObject.compact)(blocks);
|
| 33906 |
-
|
| 33907 |
-
const itemHasAppender = parentClientId => showAppender && !isTreeRoot && isClientIdSelected(parentClientId, selectedClientIds);
|
| 33908 |
-
|
| 33909 |
-
const hasAppender = itemHasAppender(parentBlockClientId); // Add +1 to the rowCount to take the block appender into account.
|
| 33910 |
-
|
| 33911 |
const blockCount = filteredBlocks.length;
|
| 33912 |
-
|
| 33913 |
-
|
| 33914 |
-
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_lodash_namespaceObject.map)(filteredBlocks, (block, index) => {
|
| 33915 |
var _expandedState$client;
|
| 33916 |
|
| 33917 |
const {
|
| 33918 |
clientId,
|
| 33919 |
innerBlocks
|
| 33920 |
} = block;
|
| 33921 |
-
const position = index + 1;
|
| 33922 |
-
const isLastRowAtLevel = rowCount === position;
|
| 33923 |
-
const updatedTerminatedLevels = isLastRowAtLevel ? [...terminatedLevels, level] : terminatedLevels;
|
| 33924 |
-
const updatedPath = [...path, position];
|
| 33925 |
-
const hasNestedBlocks = showNestedBlocks && !!innerBlocks && !!innerBlocks.length;
|
| 33926 |
-
const hasNestedAppender = itemHasAppender(clientId);
|
| 33927 |
-
const hasNestedBranch = hasNestedBlocks || hasNestedAppender;
|
| 33928 |
-
const isSelected = isClientIdSelected(clientId, selectedClientIds);
|
| 33929 |
-
const isSelectedBranch = isBranchSelected || isSelected && hasNestedBranch; // Logic needed to target the last item of a selected branch which might be deeply nested.
|
| 33930 |
-
// This is currently only needed for styling purposes. See: `.is-last-of-selected-branch`.
|
| 33931 |
-
|
| 33932 |
-
const isLastBlock = index === blockCount - 1;
|
| 33933 |
-
const isLast = isSelected || isLastOfBranch && isLastBlock;
|
| 33934 |
-
const isLastOfSelectedBranch = isLastOfBranch && !hasNestedBranch && isLastBlock;
|
| 33935 |
-
const isExpanded = hasNestedBranch ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : true : undefined;
|
| 33936 |
|
| 33937 |
-
|
| 33938 |
-
|
| 33939 |
-
|
| 33940 |
-
};
|
| 33941 |
-
|
| 33942 |
-
const toggleExpanded = event => {
|
| 33943 |
-
event.stopPropagation();
|
| 33944 |
|
| 33945 |
-
|
| 33946 |
-
|
| 33947 |
-
|
| 33948 |
-
|
| 33949 |
-
|
| 33950 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33951 |
// but asynchronous for any other block.
|
| 33952 |
|
| 33953 |
-
|
| 33954 |
-
const
|
| 33955 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, {
|
| 33956 |
key: clientId,
|
| 33957 |
value: !isSelected
|
| 33958 |
-
}, (0,external_wp_element_namespaceObject.createElement)(
|
| 33959 |
block: block,
|
| 33960 |
-
|
| 33961 |
-
onToggleExpanded: toggleExpanded,
|
| 33962 |
-
isDragged: isDragged,
|
| 33963 |
isSelected: isSelected,
|
| 33964 |
isBranchSelected: isSelectedBranch,
|
| 33965 |
-
|
| 33966 |
level: level,
|
| 33967 |
position: position,
|
| 33968 |
-
rowCount:
|
| 33969 |
siblingBlockCount: blockCount,
|
| 33970 |
showBlockMovers: showBlockMovers,
|
| 33971 |
-
terminatedLevels: terminatedLevels,
|
| 33972 |
path: updatedPath,
|
| 33973 |
-
isExpanded: isExpanded
|
| 33974 |
-
|
|
|
|
|
|
|
|
|
|
| 33975 |
blocks: innerBlocks,
|
| 33976 |
selectBlock: selectBlock,
|
| 33977 |
-
isBranchSelected: isSelectedBranch,
|
| 33978 |
-
isLastOfBranch: isLast,
|
| 33979 |
-
showAppender: showAppender,
|
| 33980 |
showBlockMovers: showBlockMovers,
|
| 33981 |
showNestedBlocks: showNestedBlocks,
|
| 33982 |
-
parentBlockClientId: clientId,
|
| 33983 |
level: level + 1,
|
| 33984 |
-
|
| 33985 |
-
|
|
|
|
|
|
|
|
|
|
| 33986 |
}));
|
| 33987 |
-
}), hasAppender && (0,external_wp_element_namespaceObject.createElement)(ListViewAppender, {
|
| 33988 |
-
parentBlockClientId: parentBlockClientId,
|
| 33989 |
-
position: rowCount,
|
| 33990 |
-
rowCount: appenderPosition,
|
| 33991 |
-
level: level,
|
| 33992 |
-
terminatedLevels: terminatedLevels,
|
| 33993 |
-
path: [...path, appenderPosition]
|
| 33994 |
}));
|
| 33995 |
}
|
|
|
|
| 33996 |
ListViewBranch.defaultProps = {
|
| 33997 |
selectBlock: () => {}
|
| 33998 |
};
|
|
|
|
| 33999 |
//# sourceMappingURL=branch.js.map
|
| 34000 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/list-view/drop-indicator.js
|
| 34001 |
|
|
@@ -34116,69 +34904,19 @@ function ListViewDropIndicator({
|
|
| 34116 |
*/
|
| 34117 |
|
| 34118 |
|
| 34119 |
-
|
| 34120 |
-
|
| 34121 |
-
const useListViewClientIdsTree = (blocks, selectedClientIds, showOnlyCurrentHierarchy) => (0,external_wp_data_namespaceObject.useSelect)(select => {
|
| 34122 |
-
const {
|
| 34123 |
-
getBlockHierarchyRootClientId,
|
| 34124 |
-
__unstableGetClientIdsTree,
|
| 34125 |
-
__unstableGetClientIdWithClientIdsTree
|
| 34126 |
-
} = select(store);
|
| 34127 |
-
|
| 34128 |
-
if (blocks) {
|
| 34129 |
-
return blocks;
|
| 34130 |
-
}
|
| 34131 |
-
|
| 34132 |
-
const isSingleBlockSelected = selectedClientIds && !Array.isArray(selectedClientIds);
|
| 34133 |
-
|
| 34134 |
-
if (!showOnlyCurrentHierarchy || !isSingleBlockSelected) {
|
| 34135 |
-
return __unstableGetClientIdsTree();
|
| 34136 |
-
}
|
| 34137 |
-
|
| 34138 |
-
const rootBlock = __unstableGetClientIdWithClientIdsTree(getBlockHierarchyRootClientId(selectedClientIds));
|
| 34139 |
-
|
| 34140 |
-
if (!rootBlock) {
|
| 34141 |
-
return __unstableGetClientIdsTree();
|
| 34142 |
-
}
|
| 34143 |
-
|
| 34144 |
-
const hasHierarchy = !isClientIdSelected(rootBlock.clientId, selectedClientIds) || rootBlock.innerBlocks && rootBlock.innerBlocks.length !== 0;
|
| 34145 |
-
|
| 34146 |
-
if (hasHierarchy) {
|
| 34147 |
-
return [rootBlock];
|
| 34148 |
-
}
|
| 34149 |
-
|
| 34150 |
-
return __unstableGetClientIdsTree();
|
| 34151 |
-
}, [blocks, selectedClientIds, showOnlyCurrentHierarchy]);
|
| 34152 |
-
|
| 34153 |
-
function useListViewClientIds(blocks, showOnlyCurrentHierarchy, __experimentalPersistentListViewFeatures) {
|
| 34154 |
-
const {
|
| 34155 |
-
selectedClientIds,
|
| 34156 |
-
draggedClientIds
|
| 34157 |
-
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
| 34158 |
const {
|
| 34159 |
-
|
| 34160 |
getSelectedBlockClientIds,
|
| 34161 |
-
|
| 34162 |
} = select(store);
|
| 34163 |
-
|
| 34164 |
-
if (__experimentalPersistentListViewFeatures) {
|
| 34165 |
-
return {
|
| 34166 |
-
selectedClientIds: getSelectedBlockClientIds(),
|
| 34167 |
-
draggedClientIds: getDraggedBlockClientIds()
|
| 34168 |
-
};
|
| 34169 |
-
}
|
| 34170 |
-
|
| 34171 |
return {
|
| 34172 |
-
selectedClientIds:
|
| 34173 |
-
draggedClientIds: getDraggedBlockClientIds()
|
|
|
|
| 34174 |
};
|
| 34175 |
-
}, [
|
| 34176 |
-
const clientIdsTree = useListViewClientIdsTree(blocks, selectedClientIds, showOnlyCurrentHierarchy);
|
| 34177 |
-
return {
|
| 34178 |
-
clientIdsTree,
|
| 34179 |
-
selectedClientIds,
|
| 34180 |
-
draggedClientIds
|
| 34181 |
-
};
|
| 34182 |
}
|
| 34183 |
//# sourceMappingURL=use-list-view-client-ids.js.map
|
| 34184 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/list-view/use-list-view-drop-zone.js
|
|
@@ -34469,29 +35207,44 @@ const expanded = (state, action) => {
|
|
| 34469 |
* @param {Array} props.blocks Custom subset of block client IDs to be used instead of the default hierarchy.
|
| 34470 |
* @param {Function} props.onSelect Block selection callback.
|
| 34471 |
* @param {boolean} props.showNestedBlocks Flag to enable displaying nested blocks.
|
| 34472 |
-
* @param {boolean} props.
|
| 34473 |
* @param {boolean} props.__experimentalFeatures Flag to enable experimental features.
|
| 34474 |
* @param {boolean} props.__experimentalPersistentListViewFeatures Flag to enable features for the Persistent List View experiment.
|
|
|
|
| 34475 |
* @param {Object} ref Forwarded ref
|
| 34476 |
*/
|
| 34477 |
|
| 34478 |
|
| 34479 |
function ListView({
|
| 34480 |
blocks,
|
| 34481 |
-
showOnlyCurrentHierarchy,
|
| 34482 |
onSelect = list_view_noop,
|
| 34483 |
__experimentalFeatures,
|
| 34484 |
__experimentalPersistentListViewFeatures,
|
|
|
|
|
|
|
|
|
|
| 34485 |
...props
|
| 34486 |
}, ref) {
|
| 34487 |
const {
|
| 34488 |
clientIdsTree,
|
| 34489 |
-
|
| 34490 |
-
|
| 34491 |
-
} = useListViewClientIds(blocks
|
| 34492 |
const {
|
| 34493 |
selectBlock
|
| 34494 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34495 |
const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)(clientId => {
|
| 34496 |
selectBlock(clientId);
|
| 34497 |
onSelect(clientId);
|
|
@@ -34506,7 +35259,14 @@ function ListView({
|
|
| 34506 |
const isMounted = (0,external_wp_element_namespaceObject.useRef)(false);
|
| 34507 |
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
| 34508 |
isMounted.current = true;
|
| 34509 |
-
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34510 |
const expand = (0,external_wp_element_namespaceObject.useCallback)(clientId => {
|
| 34511 |
if (!clientId) {
|
| 34512 |
return;
|
|
@@ -34527,29 +35287,26 @@ function ListView({
|
|
| 34527 |
clientId
|
| 34528 |
});
|
| 34529 |
}, [setExpandedState]);
|
| 34530 |
-
|
| 34531 |
-
const expandRow = row => {
|
| 34532 |
var _row$dataset;
|
| 34533 |
|
| 34534 |
expand(row === null || row === void 0 ? void 0 : (_row$dataset = row.dataset) === null || _row$dataset === void 0 ? void 0 : _row$dataset.block);
|
| 34535 |
-
};
|
| 34536 |
-
|
| 34537 |
-
const collapseRow = row => {
|
| 34538 |
var _row$dataset2;
|
| 34539 |
|
| 34540 |
collapse(row === null || row === void 0 ? void 0 : (_row$dataset2 = row.dataset) === null || _row$dataset2 === void 0 ? void 0 : _row$dataset2.block);
|
| 34541 |
-
};
|
| 34542 |
-
|
| 34543 |
const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
|
| 34544 |
__experimentalFeatures,
|
| 34545 |
__experimentalPersistentListViewFeatures,
|
|
|
|
| 34546 |
isTreeGridMounted: isMounted.current,
|
| 34547 |
draggedClientIds,
|
| 34548 |
-
selectedClientIds,
|
| 34549 |
expandedState,
|
| 34550 |
expand,
|
| 34551 |
collapse
|
| 34552 |
-
}), [__experimentalFeatures, __experimentalPersistentListViewFeatures, isMounted.current, draggedClientIds,
|
| 34553 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, {
|
| 34554 |
value: true
|
| 34555 |
}, (0,external_wp_element_namespaceObject.createElement)(ListViewDropIndicator, {
|
|
@@ -34563,9 +35320,13 @@ function ListView({
|
|
| 34563 |
onExpandRow: expandRow
|
| 34564 |
}, (0,external_wp_element_namespaceObject.createElement)(ListViewContext.Provider, {
|
| 34565 |
value: contextValue
|
| 34566 |
-
}, (0,external_wp_element_namespaceObject.createElement)(
|
| 34567 |
blocks: clientIdsTree,
|
| 34568 |
-
selectBlock: selectEditorBlock
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34569 |
}, props)))));
|
| 34570 |
}
|
| 34571 |
|
|
@@ -34636,7 +35397,6 @@ function BlockNavigationDropdown({
|
|
| 34636 |
className: "block-editor-block-navigation__label"
|
| 34637 |
}, (0,external_wp_i18n_namespaceObject.__)('List view')), (0,external_wp_element_namespaceObject.createElement)(components_list_view, {
|
| 34638 |
showNestedBlocks: true,
|
| 34639 |
-
showOnlyCurrentHierarchy: true,
|
| 34640 |
__experimentalFeatures: __experimentalFeatures
|
| 34641 |
}))
|
| 34642 |
});
|
|
@@ -37179,7 +37939,8 @@ class URLInput extends external_wp_element_namespaceObject.Component {
|
|
| 37179 |
selectedSuggestion
|
| 37180 |
} = this.state;
|
| 37181 |
const {
|
| 37182 |
-
value
|
|
|
|
| 37183 |
} = this.props; // only have to worry about scrolling selected suggestion into view
|
| 37184 |
// when already expanded
|
| 37185 |
|
|
@@ -37191,11 +37952,17 @@ class URLInput extends external_wp_element_namespaceObject.Component {
|
|
| 37191 |
this.props.setTimeout(() => {
|
| 37192 |
this.scrollingIntoView = false;
|
| 37193 |
}, 100);
|
| 37194 |
-
} //
|
| 37195 |
|
| 37196 |
|
| 37197 |
-
if (prevProps.value !== value && this.
|
| 37198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37199 |
}
|
| 37200 |
}
|
| 37201 |
|
|
@@ -37995,6 +38762,7 @@ function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggesti
|
|
| 37995 |
* External dependencies
|
| 37996 |
*/
|
| 37997 |
|
|
|
|
| 37998 |
/**
|
| 37999 |
* WordPress dependencies
|
| 38000 |
*/
|
|
@@ -38032,7 +38800,8 @@ const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef
|
|
| 38032 |
showInitialSuggestions = false,
|
| 38033 |
suggestionsQuery = {},
|
| 38034 |
withURLSuggestion = true,
|
| 38035 |
-
createSuggestionButtonText
|
|
|
|
| 38036 |
}, ref) => {
|
| 38037 |
const genericSearchHandler = useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion, withURLSuggestion);
|
| 38038 |
const searchHandler = showSuggestions ? fetchSuggestions || genericSearchHandler : noopSearchHandler;
|
|
@@ -38092,8 +38861,14 @@ const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef
|
|
| 38092 |
}
|
| 38093 |
};
|
| 38094 |
|
| 38095 |
-
|
| 38096 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38097 |
value: value,
|
| 38098 |
onChange: onInputChange,
|
| 38099 |
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : (0,external_wp_i18n_namespaceObject.__)('Search or type url'),
|
|
@@ -38135,6 +38910,28 @@ const info = (0,external_wp_element_namespaceObject.createElement)(external_wp_p
|
|
| 38135 |
}));
|
| 38136 |
/* harmony default export */ var library_info = (info);
|
| 38137 |
//# sourceMappingURL=info.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38138 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/link-control/viewer-slot.js
|
| 38139 |
/**
|
| 38140 |
* WordPress dependencies
|
|
@@ -38249,6 +39046,7 @@ function useRemoteUrlData(url) {
|
|
| 38249 |
|
| 38250 |
|
| 38251 |
|
|
|
|
| 38252 |
/**
|
| 38253 |
* Internal dependencies
|
| 38254 |
*/
|
|
@@ -38258,7 +39056,9 @@ function useRemoteUrlData(url) {
|
|
| 38258 |
function LinkPreview({
|
| 38259 |
value,
|
| 38260 |
onEditClick,
|
| 38261 |
-
hasRichPreviews = false
|
|
|
|
|
|
|
| 38262 |
}) {
|
| 38263 |
// Avoid fetching if rich previews are not desired.
|
| 38264 |
const showRichPreviews = hasRichPreviews ? value === null || value === void 0 ? void 0 : value.url : null;
|
|
@@ -38269,6 +39069,7 @@ function LinkPreview({
|
|
| 38269 |
|
| 38270 |
const hasRichData = richData && Object.keys(richData).length;
|
| 38271 |
const displayURL = value && (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(value.url), 16) || '';
|
|
|
|
| 38272 |
const isEmptyURL = !value.url.length;
|
| 38273 |
let icon;
|
| 38274 |
|
|
@@ -38311,15 +39112,23 @@ function LinkPreview({
|
|
| 38311 |
}, !isEmptyURL ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
|
| 38312 |
className: "block-editor-link-control__search-item-title",
|
| 38313 |
href: value.url
|
| 38314 |
-
}, (
|
| 38315 |
className: "block-editor-link-control__search-item-info"
|
| 38316 |
}, displayURL)) : (0,external_wp_element_namespaceObject.createElement)("span", {
|
| 38317 |
className: "block-editor-link-control__search-item-error-notice"
|
| 38318 |
}, "Link is empty"))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
| 38319 |
-
|
| 38320 |
-
|
| 38321 |
-
className: "block-editor-link-control__search-item-action"
|
| 38322 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38323 |
fillProps: value
|
| 38324 |
})), (hasRichData && ((richData === null || richData === void 0 ? void 0 : richData.image) || (richData === null || richData === void 0 ? void 0 : richData.description)) || isFetching) && (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 38325 |
className: "block-editor-link-control__search-item-bottom"
|
|
@@ -38428,6 +39237,7 @@ const makeCancelable = promise => {
|
|
| 38428 |
* External dependencies
|
| 38429 |
*/
|
| 38430 |
|
|
|
|
| 38431 |
/**
|
| 38432 |
* WordPress dependencies
|
| 38433 |
*/
|
|
@@ -38520,6 +39330,7 @@ const makeCancelable = promise => {
|
|
| 38520 |
* @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.
|
| 38521 |
* @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.
|
| 38522 |
* @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.
|
|
|
|
| 38523 |
*/
|
| 38524 |
|
| 38525 |
/**
|
|
@@ -38546,9 +39357,11 @@ function LinkControl({
|
|
| 38546 |
suggestionsQuery = {},
|
| 38547 |
noURLSuggestion = false,
|
| 38548 |
createSuggestionButtonText,
|
| 38549 |
-
hasRichPreviews = false
|
|
|
|
|
|
|
| 38550 |
}) {
|
| 38551 |
-
var _currentInputValue$tr;
|
| 38552 |
|
| 38553 |
if (withCreateSuggestion === undefined && createSuggestion) {
|
| 38554 |
withCreateSuggestion = true;
|
|
@@ -38556,7 +39369,9 @@ function LinkControl({
|
|
| 38556 |
|
| 38557 |
const isMounting = (0,external_wp_element_namespaceObject.useRef)(true);
|
| 38558 |
const wrapperNode = (0,external_wp_element_namespaceObject.useRef)();
|
| 38559 |
-
const
|
|
|
|
|
|
|
| 38560 |
const currentInputValue = propInputValue || internalInputValue;
|
| 38561 |
const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(forceIsEditingLink !== undefined ? forceIsEditingLink : !value || !value.url);
|
| 38562 |
const isEndingEditWithFocus = (0,external_wp_element_namespaceObject.useRef)(false);
|
|
@@ -38567,17 +39382,47 @@ function LinkControl({
|
|
| 38567 |
}
|
| 38568 |
}, [forceIsEditingLink]);
|
| 38569 |
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
|
|
|
|
|
|
|
|
|
| 38570 |
if (isMounting.current) {
|
| 38571 |
isMounting.current = false;
|
| 38572 |
return;
|
| 38573 |
-
} //
|
| 38574 |
-
//
|
|
|
|
|
|
|
|
|
|
| 38575 |
|
| 38576 |
|
| 38577 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38578 |
nextFocusTarget.focus();
|
| 38579 |
isEndingEditWithFocus.current = false;
|
| 38580 |
}, [isEditingLink]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38581 |
/**
|
| 38582 |
* Cancels editing state and marks that focus may need to be restored after
|
| 38583 |
* the next render, if focus was within the wrapper when editing finished.
|
|
@@ -38597,22 +39442,41 @@ function LinkControl({
|
|
| 38597 |
} = useCreatePage(createSuggestion);
|
| 38598 |
|
| 38599 |
const handleSelectSuggestion = updatedValue => {
|
| 38600 |
-
onChange(updatedValue
|
|
|
|
|
|
|
| 38601 |
stopEditing();
|
| 38602 |
};
|
| 38603 |
|
| 38604 |
-
const
|
| 38605 |
-
if (currentInputValue !== (value === null || value === void 0 ? void 0 : value.url)) {
|
| 38606 |
onChange({
|
| 38607 |
-
url: currentInputValue
|
|
|
|
| 38608 |
});
|
| 38609 |
}
|
| 38610 |
|
| 38611 |
stopEditing();
|
| 38612 |
};
|
| 38613 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38614 |
const shownUnlinkControl = onRemove && value && !isEditingLink && !isCreatingPage;
|
| 38615 |
-
const showSettingsDrawer = !!(settings !== null && settings !== void 0 && settings.length);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38616 |
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 38617 |
tabIndex: -1,
|
| 38618 |
ref: wrapperNode,
|
|
@@ -38620,10 +39484,20 @@ function LinkControl({
|
|
| 38620 |
}, isCreatingPage && (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 38621 |
className: "block-editor-link-control__loading"
|
| 38622 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), " ", (0,external_wp_i18n_namespaceObject.__)('Creating'), "\u2026"), (isEditingLink || !value) && !isCreatingPage && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 38623 |
-
className:
|
| 38624 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38625 |
currentLink: value,
|
| 38626 |
-
className: "block-editor-link-control__search-input",
|
| 38627 |
placeholder: searchInputPlaceholder,
|
| 38628 |
value: currentInputValue,
|
| 38629 |
withCreateSuggestion: withCreateSuggestion,
|
|
@@ -38635,22 +39509,12 @@ function LinkControl({
|
|
| 38635 |
showSuggestions: showSuggestions,
|
| 38636 |
suggestionsQuery: suggestionsQuery,
|
| 38637 |
withURLSuggestion: !noURLSuggestion,
|
| 38638 |
-
createSuggestionButtonText: createSuggestionButtonText
|
|
|
|
| 38639 |
}, (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 38640 |
className: "block-editor-link-control__search-actions"
|
| 38641 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
| 38642 |
-
onClick:
|
| 38643 |
-
onKeyDown: event => {
|
| 38644 |
-
const {
|
| 38645 |
-
keyCode
|
| 38646 |
-
} = event;
|
| 38647 |
-
|
| 38648 |
-
if (keyCode === external_wp_keycodes_namespaceObject.ENTER && !currentInputIsEmpty // disallow submitting empty values.
|
| 38649 |
-
) {
|
| 38650 |
-
event.preventDefault();
|
| 38651 |
-
handleSubmitButton();
|
| 38652 |
-
}
|
| 38653 |
-
},
|
| 38654 |
label: (0,external_wp_i18n_namespaceObject.__)('Submit'),
|
| 38655 |
icon: keyboard_return,
|
| 38656 |
className: "block-editor-link-control__search-submit",
|
|
@@ -38665,19 +39529,16 @@ function LinkControl({
|
|
| 38665 |
,
|
| 38666 |
value: value,
|
| 38667 |
onEditClick: () => setIsEditingLink(true),
|
| 38668 |
-
hasRichPreviews: hasRichPreviews
|
| 38669 |
-
|
|
|
|
|
|
|
| 38670 |
className: "block-editor-link-control__tools"
|
| 38671 |
}, (0,external_wp_element_namespaceObject.createElement)(settings_drawer, {
|
| 38672 |
value: value,
|
| 38673 |
settings: settings,
|
| 38674 |
onChange: onChange
|
| 38675 |
-
}),
|
| 38676 |
-
className: "block-editor-link-control__unlink",
|
| 38677 |
-
isDestructive: true,
|
| 38678 |
-
variant: "link",
|
| 38679 |
-
onClick: onRemove
|
| 38680 |
-
}, (0,external_wp_i18n_namespaceObject.__)('Unlink'))));
|
| 38681 |
}
|
| 38682 |
|
| 38683 |
LinkControl.ViewerFill = ViewerFill;
|
|
@@ -38947,28 +39808,6 @@ const MediaReplaceFlow = ({
|
|
| 38947 |
};
|
| 38948 |
}), (0,external_wp_components_namespaceObject.withFilters)('editor.MediaReplaceFlow')])(MediaReplaceFlow));
|
| 38949 |
//# sourceMappingURL=index.js.map
|
| 38950 |
-
;// CONCATENATED MODULE: ./packages/icons/build-module/library/pencil.js
|
| 38951 |
-
|
| 38952 |
-
|
| 38953 |
-
/**
|
| 38954 |
-
* WordPress dependencies
|
| 38955 |
-
*/
|
| 38956 |
-
|
| 38957 |
-
const pencil = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 38958 |
-
xmlns: "http://www.w3.org/2000/svg",
|
| 38959 |
-
viewBox: "0 0 24 24"
|
| 38960 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 38961 |
-
d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"
|
| 38962 |
-
}));
|
| 38963 |
-
/* harmony default export */ var library_pencil = (pencil);
|
| 38964 |
-
//# sourceMappingURL=pencil.js.map
|
| 38965 |
-
;// CONCATENATED MODULE: ./packages/icons/build-module/library/edit.js
|
| 38966 |
-
/**
|
| 38967 |
-
* Internal dependencies
|
| 38968 |
-
*/
|
| 38969 |
-
|
| 38970 |
-
/* harmony default export */ var library_edit = (library_pencil);
|
| 38971 |
-
//# sourceMappingURL=edit.js.map
|
| 38972 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/url-popover/link-viewer-url.js
|
| 38973 |
|
| 38974 |
|
|
@@ -39582,7 +40421,8 @@ const FormatToolbar = () => {
|
|
| 39582 |
toggleProps: { ...toggleProps,
|
| 39583 |
className: classnames_default()(toggleProps.className, {
|
| 39584 |
'is-pressed': hasActive
|
| 39585 |
-
})
|
|
|
|
| 39586 |
},
|
| 39587 |
controls: (0,external_lodash_namespaceObject.orderBy)(fills.map(([{
|
| 39588 |
props
|
|
@@ -40582,6 +41422,11 @@ function useInputEvents(inputEvents) {
|
|
| 40582 |
* WordPress dependencies
|
| 40583 |
*/
|
| 40584 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40585 |
function FormatEdit({
|
| 40586 |
formatTypes,
|
| 40587 |
onChange,
|
|
@@ -40600,9 +41445,29 @@ function FormatEdit({
|
|
| 40600 |
}
|
| 40601 |
|
| 40602 |
const activeFormat = (0,external_wp_richText_namespaceObject.getActiveFormat)(value, name);
|
| 40603 |
-
|
| 40604 |
const activeObject = (0,external_wp_richText_namespaceObject.getActiveObject)(value);
|
| 40605 |
-
const isObjectActive = activeObject !== undefined && activeObject.type === name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40606 |
return (0,external_wp_element_namespaceObject.createElement)(Edit, {
|
| 40607 |
key: name,
|
| 40608 |
isActive: isActive,
|
|
@@ -41985,7 +42850,7 @@ function MultiSelectionInspector({
|
|
| 41985 |
const words = (0,external_wp_wordcount_namespaceObject.count)((0,external_wp_blocks_namespaceObject.serialize)(blocks), 'words');
|
| 41986 |
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 41987 |
className: "block-editor-multi-selection-inspector__card"
|
| 41988 |
-
}, (0,external_wp_element_namespaceObject.createElement)(
|
| 41989 |
icon: library_stack,
|
| 41990 |
showColors: true
|
| 41991 |
}), (0,external_wp_element_namespaceObject.createElement)("div", {
|
|
@@ -42177,6 +43042,10 @@ const BlockInspectorSingleBlock = ({
|
|
| 42177 |
blockName: blockName
|
| 42178 |
}))), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, {
|
| 42179 |
bubblesVirtually: bubblesVirtually
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42180 |
}), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, {
|
| 42181 |
__experimentalGroup: "dimensions",
|
| 42182 |
bubblesVirtually: bubblesVirtually,
|
|
@@ -43175,6 +44044,8 @@ function useNoRecursiveRenders(uniqueId, blockName = '') {
|
|
| 43175 |
|
| 43176 |
|
| 43177 |
|
|
|
|
|
|
|
| 43178 |
|
| 43179 |
|
| 43180 |
|
| 2154 |
"BlockEditorKeyboardShortcuts": function() { return /* reexport */ keyboard_shortcuts; },
|
| 2155 |
"BlockEditorProvider": function() { return /* reexport */ provider; },
|
| 2156 |
"BlockFormatControls": function() { return /* reexport */ BlockFormatControls; },
|
| 2157 |
+
"BlockIcon": function() { return /* reexport */ block_icon; },
|
| 2158 |
"BlockInspector": function() { return /* reexport */ block_inspector; },
|
| 2159 |
"BlockList": function() { return /* reexport */ BlockList; },
|
| 2160 |
"BlockMover": function() { return /* reexport */ block_mover; },
|
| 2238 |
"__experimentalPanelColorGradientSettings": function() { return /* reexport */ panel_color_gradient_settings; },
|
| 2239 |
"__experimentalPreviewOptions": function() { return /* reexport */ PreviewOptions; },
|
| 2240 |
"__experimentalResponsiveBlockControl": function() { return /* reexport */ responsive_block_control; },
|
| 2241 |
+
"__experimentalTextDecorationControl": function() { return /* reexport */ TextDecorationControl; },
|
| 2242 |
+
"__experimentalTextTransformControl": function() { return /* reexport */ TextTransformControl; },
|
| 2243 |
"__experimentalUnitControl": function() { return /* reexport */ UnitControl; },
|
| 2244 |
"__experimentalUseBorderProps": function() { return /* reexport */ useBorderProps; },
|
| 2245 |
"__experimentalUseColorProps": function() { return /* reexport */ useColorProps; },
|
| 2246 |
"__experimentalUseCustomSides": function() { return /* reexport */ useCustomSides; },
|
| 2247 |
"__experimentalUseGradient": function() { return /* reexport */ __experimentalUseGradient; },
|
|
|
|
| 2248 |
"__experimentalUseNoRecursiveRenders": function() { return /* reexport */ useNoRecursiveRenders; },
|
| 2249 |
"__experimentalUseResizeCanvas": function() { return /* reexport */ useResizeCanvas; },
|
| 2250 |
"__unstableBlockSettingsMenuFirstItem": function() { return /* reexport */ block_settings_menu_first_item; },
|
| 2275 |
"useBlockEditContext": function() { return /* reexport */ useBlockEditContext; },
|
| 2276 |
"useBlockProps": function() { return /* reexport */ useBlockProps; },
|
| 2277 |
"useCachedTruthy": function() { return /* reexport */ useCachedTruthy; },
|
| 2278 |
+
"useInnerBlocksProps": function() { return /* reexport */ useInnerBlocksProps; },
|
| 2279 |
"useSetting": function() { return /* reexport */ useSetting; },
|
| 2280 |
"validateThemeColors": function() { return /* reexport */ validateThemeColors; },
|
| 2281 |
"validateThemeGradients": function() { return /* reexport */ validateThemeGradients; },
|
| 2295 |
"__experimentalGetDirectInsertBlock": function() { return __experimentalGetDirectInsertBlock; },
|
| 2296 |
"__experimentalGetLastBlockAttributeChanges": function() { return __experimentalGetLastBlockAttributeChanges; },
|
| 2297 |
"__experimentalGetParsedPattern": function() { return __experimentalGetParsedPattern; },
|
|
|
|
| 2298 |
"__experimentalGetPatternTransformItems": function() { return __experimentalGetPatternTransformItems; },
|
| 2299 |
"__experimentalGetPatternsByBlockTypes": function() { return __experimentalGetPatternsByBlockTypes; },
|
| 2300 |
"__experimentalGetReusableBlockTitle": function() { return __experimentalGetReusableBlockTitle; },
|
| 2384 |
__webpack_require__.r(actions_namespaceObject);
|
| 2385 |
__webpack_require__.d(actions_namespaceObject, {
|
| 2386 |
"__unstableMarkAutomaticChange": function() { return __unstableMarkAutomaticChange; },
|
|
|
|
| 2387 |
"__unstableMarkLastChangeAsPersistent": function() { return __unstableMarkLastChangeAsPersistent; },
|
| 2388 |
"__unstableMarkNextChangeAsNotPersistent": function() { return __unstableMarkNextChangeAsNotPersistent; },
|
| 2389 |
"__unstableSaveReusableBlock": function() { return __unstableSaveReusableBlock; },
|
| 2964 |
return result;
|
| 2965 |
}
|
| 2966 |
|
| 2967 |
+
function updateParentInnerBlocksInTree(state, tree, updatedClientIds, updateChildrenOfUpdatedClientIds = false) {
|
| 2968 |
+
const uncontrolledParents = new Set([]);
|
| 2969 |
const controlledParents = new Set();
|
| 2970 |
|
| 2971 |
for (const clientId of updatedClientIds) {
|
| 2972 |
+
let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents[clientId];
|
| 2973 |
|
| 2974 |
do {
|
| 2975 |
if (state.controlledInnerBlocks[current]) {
|
| 2976 |
+
// Should stop on controlled blocks.
|
| 2977 |
+
// If we reach a controlled parent, break out of the loop.
|
| 2978 |
+
controlledParents.add(current);
|
| 2979 |
break;
|
| 2980 |
} else {
|
| 2981 |
+
// else continue traversing up through parents.
|
| 2982 |
+
uncontrolledParents.add(current);
|
| 2983 |
+
current = state.parents[current];
|
| 2984 |
+
}
|
|
|
|
| 2985 |
} while (current !== undefined);
|
| 2986 |
} // To make sure the order of assignments doesn't matter,
|
| 2987 |
// we first create empty objects and mutates the inner blocks later.
|
| 2988 |
|
| 2989 |
|
| 2990 |
+
for (const clientId of uncontrolledParents) {
|
| 2991 |
tree[clientId] = { ...tree[clientId]
|
| 2992 |
};
|
| 2993 |
}
|
| 2994 |
|
| 2995 |
+
for (const clientId of uncontrolledParents) {
|
| 2996 |
tree[clientId].innerBlocks = (state.order[clientId] || []).map(subClientId => tree[subClientId]);
|
| 2997 |
} // Controlled parent blocks, need a dedicated key for their inner blocks
|
| 2998 |
// to be used when doing getBlocks( controlledBlockClientId ).
|
| 3033 |
const subTree = buildBlockTree(newState, action.blocks);
|
| 3034 |
newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
|
| 3035 |
...subTree
|
| 3036 |
+
}, action.rootClientId ? [action.rootClientId] : [''], true);
|
| 3037 |
break;
|
| 3038 |
}
|
| 3039 |
|
| 3040 |
case 'UPDATE_BLOCK':
|
| 3041 |
newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
|
| 3042 |
+
[action.clientId]: { ...newState.tree[action.clientId],
|
| 3043 |
+
...newState.byClientId[action.clientId],
|
| 3044 |
attributes: newState.attributes[action.clientId]
|
| 3045 |
}
|
| 3046 |
+
}, [action.clientId], false);
|
| 3047 |
break;
|
| 3048 |
|
| 3049 |
case 'UPDATE_BLOCK_ATTRIBUTES':
|
| 3056 |
}, {});
|
| 3057 |
newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
|
| 3058 |
...newSubTree
|
| 3059 |
+
}, action.clientIds, false);
|
| 3060 |
break;
|
| 3061 |
}
|
| 3062 |
|
| 3065 |
const subTree = buildBlockTree(newState, action.blocks);
|
| 3066 |
newState.tree = updateParentInnerBlocksInTree(newState, { ...(0,external_lodash_namespaceObject.omit)(newState.tree, action.replacedClientIds.concat(action.replacedClientIds.map(clientId => 'controlled||' + clientId))),
|
| 3067 |
...subTree
|
| 3068 |
+
}, 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.
|
| 3069 |
|
| 3070 |
const parentsOfRemovedBlocks = [];
|
| 3071 |
|
| 3075 |
}
|
| 3076 |
}
|
| 3077 |
|
| 3078 |
+
newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, parentsOfRemovedBlocks, true);
|
| 3079 |
break;
|
| 3080 |
}
|
| 3081 |
|
| 3088 |
}
|
| 3089 |
}
|
| 3090 |
|
| 3091 |
+
newState.tree = updateParentInnerBlocksInTree(newState, (0,external_lodash_namespaceObject.omit)(newState.tree, action.removedClientIds.concat(action.removedClientIds.map(clientId => 'controlled||' + clientId))), parentsOfRemovedBlocks, true);
|
| 3092 |
break;
|
| 3093 |
|
| 3094 |
case 'MOVE_BLOCKS_TO_POSITION':
|
| 3107 |
updatedBlockUids.push('');
|
| 3108 |
}
|
| 3109 |
|
| 3110 |
+
newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, updatedBlockUids, true);
|
| 3111 |
break;
|
| 3112 |
}
|
| 3113 |
|
| 3115 |
case 'MOVE_BLOCKS_DOWN':
|
| 3116 |
{
|
| 3117 |
const updatedBlockUids = [action.rootClientId ? action.rootClientId : ''];
|
| 3118 |
+
newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, updatedBlockUids, true);
|
| 3119 |
break;
|
| 3120 |
}
|
| 3121 |
|
| 3132 |
};
|
| 3133 |
return result;
|
| 3134 |
}, {})
|
| 3135 |
+
}, updatedBlockUids, false);
|
| 3136 |
}
|
| 3137 |
}
|
| 3138 |
|
| 6184 |
const buildBlockTypeInserterItem = buildBlockTypeItem(state, {
|
| 6185 |
buildScope: 'inserter'
|
| 6186 |
});
|
| 6187 |
+
/*
|
| 6188 |
+
* Matches block comment delimiters amid serialized content.
|
| 6189 |
+
*
|
| 6190 |
+
* @see `tokenizer` in `@wordpress/block-serialization-default-parser`
|
| 6191 |
+
* package
|
| 6192 |
+
*
|
| 6193 |
+
* blockParserTokenizer differs from the original tokenizer in the
|
| 6194 |
+
* following ways:
|
| 6195 |
+
*
|
| 6196 |
+
* - removed global flag (/g)
|
| 6197 |
+
* - prepended ^\s*
|
| 6198 |
+
*
|
| 6199 |
+
*/
|
| 6200 |
+
|
| 6201 |
+
const blockParserTokenizer = /^\s*<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/;
|
| 6202 |
|
| 6203 |
const buildReusableBlockInserterItem = reusableBlock => {
|
| 6204 |
+
let icon = library_symbol;
|
| 6205 |
+
/*
|
| 6206 |
+
* Instead of always displaying a generic "symbol" icon for every
|
| 6207 |
+
* reusable block, try to use an icon that represents the first
|
| 6208 |
+
* outermost block contained in the reusable block. This requires
|
| 6209 |
+
* scanning the serialized form of the reusable block to find its
|
| 6210 |
+
* first block delimiter, then looking up the corresponding block
|
| 6211 |
+
* type, if available.
|
| 6212 |
+
*/
|
| 6213 |
|
| 6214 |
+
if (external_wp_element_namespaceObject.Platform.OS === 'web') {
|
| 6215 |
+
const content = typeof reusableBlock.content.raw === 'string' ? reusableBlock.content.raw : reusableBlock.content;
|
| 6216 |
+
const rawBlockMatch = content.match(blockParserTokenizer);
|
| 6217 |
|
| 6218 |
+
if (rawBlockMatch) {
|
| 6219 |
+
const [,, namespace = 'core/', blockName] = rawBlockMatch;
|
| 6220 |
+
const referencedBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(namespace + blockName);
|
| 6221 |
|
| 6222 |
+
if (referencedBlockType) {
|
| 6223 |
+
icon = referencedBlockType.icon;
|
| 6224 |
+
}
|
| 6225 |
+
}
|
| 6226 |
}
|
| 6227 |
|
| 6228 |
+
const id = `core/block/${reusableBlock.id}`;
|
| 6229 |
const {
|
| 6230 |
time,
|
| 6231 |
count = 0
|
| 6238 |
ref: reusableBlock.id
|
| 6239 |
},
|
| 6240 |
title: reusableBlock.title.raw,
|
| 6241 |
+
icon,
|
| 6242 |
category: 'reusable',
|
| 6243 |
keywords: [],
|
| 6244 |
isDisabled: false,
|
| 6449 |
const {
|
| 6450 |
allowedBlockTypes
|
| 6451 |
} = getSettings(state);
|
| 6452 |
+
const parsedPatterns = patterns.filter(({
|
| 6453 |
+
inserter = true
|
| 6454 |
+
}) => !!inserter).map(({
|
| 6455 |
name
|
| 6456 |
}) => __experimentalGetParsedPattern(state, name));
|
| 6457 |
const allowedPatterns = parsedPatterns.filter(({
|
| 6608 |
};
|
| 6609 |
}, {});
|
| 6610 |
}, state => [state.blockListSettings]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6611 |
/**
|
| 6612 |
* Returns the title of a given reusable block
|
| 6613 |
*
|
| 6787 |
;// CONCATENATED MODULE: external ["wp","deprecated"]
|
| 6788 |
var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
|
| 6789 |
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6790 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/store/actions.js
|
| 6791 |
/**
|
| 6792 |
* External dependencies
|
| 6801 |
|
| 6802 |
|
| 6803 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6804 |
/**
|
| 6805 |
+
* Action which will insert a default block insert action if there
|
| 6806 |
+
* are no other blocks at the root of the editor. This action should be used
|
| 6807 |
* in actions which may result in no blocks remaining in the editor (removal,
|
| 6808 |
* replacement, etc).
|
| 6809 |
*/
|
| 6810 |
|
| 6811 |
+
const ensureDefaultBlock = () => ({
|
| 6812 |
+
select,
|
| 6813 |
+
dispatch
|
| 6814 |
+
}) => {
|
| 6815 |
+
// To avoid a focus loss when removing the last block, assure there is
|
| 6816 |
// always a default block if the last of the blocks have been removed.
|
| 6817 |
+
const count = select.getBlockCount();
|
| 6818 |
|
| 6819 |
+
if (count > 0) {
|
| 6820 |
+
return;
|
| 6821 |
+
} // If there's an custom appender, don't insert default block.
|
| 6822 |
+
// We have to remember to manually move the focus elsewhere to
|
| 6823 |
+
// prevent it from being lost though.
|
|
|
|
| 6824 |
|
|
|
|
|
|
|
|
|
|
| 6825 |
|
| 6826 |
+
const {
|
| 6827 |
+
__unstableHasCustomAppender
|
| 6828 |
+
} = select.getSettings();
|
| 6829 |
+
|
| 6830 |
+
if (__unstableHasCustomAppender) {
|
| 6831 |
+
return;
|
| 6832 |
}
|
| 6833 |
+
|
| 6834 |
+
dispatch.insertDefaultBlock();
|
| 6835 |
+
};
|
| 6836 |
/**
|
| 6837 |
+
* Action that resets blocks state to the specified array of blocks, taking precedence
|
| 6838 |
+
* over any other content reflected as an edit in state.
|
|
|
|
| 6839 |
*
|
| 6840 |
* @param {Array} blocks Array of blocks.
|
| 6841 |
*/
|
| 6842 |
|
| 6843 |
|
| 6844 |
+
const resetBlocks = blocks => ({
|
| 6845 |
+
dispatch
|
| 6846 |
+
}) => {
|
| 6847 |
+
dispatch({
|
| 6848 |
type: 'RESET_BLOCKS',
|
| 6849 |
blocks
|
| 6850 |
+
});
|
| 6851 |
+
dispatch(validateBlocksToTemplate(blocks));
|
| 6852 |
+
};
|
| 6853 |
/**
|
| 6854 |
* Block validity is a function of blocks state (at the point of a
|
| 6855 |
* reset) and the template setting. As a compromise to its placement
|
| 6859 |
* @param {Array} blocks Array of blocks.
|
| 6860 |
*/
|
| 6861 |
|
| 6862 |
+
const validateBlocksToTemplate = blocks => ({
|
| 6863 |
+
select,
|
| 6864 |
+
dispatch
|
| 6865 |
+
}) => {
|
| 6866 |
+
const template = select.getTemplate();
|
| 6867 |
+
const templateLock = select.getTemplateLock(); // Unlocked templates are considered always valid because they act
|
| 6868 |
// as default values only.
|
| 6869 |
|
| 6870 |
const isBlocksValidToTemplate = !template || templateLock !== 'all' || (0,external_wp_blocks_namespaceObject.doBlocksMatchTemplate)(blocks, template); // Update if validity has changed.
|
| 6871 |
|
| 6872 |
+
const isValidTemplate = select.isValidTemplate();
|
| 6873 |
|
| 6874 |
if (isBlocksValidToTemplate !== isValidTemplate) {
|
| 6875 |
+
dispatch.setTemplateValidity(isBlocksValidToTemplate);
|
| 6876 |
return isBlocksValidToTemplate;
|
| 6877 |
}
|
| 6878 |
+
};
|
| 6879 |
/**
|
| 6880 |
* A block selection object.
|
| 6881 |
*
|
| 6932 |
};
|
| 6933 |
}
|
| 6934 |
/**
|
| 6935 |
+
* Action that updates attributes of multiple blocks with the specified client IDs.
|
|
|
|
| 6936 |
*
|
| 6937 |
* @param {string|string[]} clientIds Block client IDs.
|
| 6938 |
* @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if
|
| 6950 |
};
|
| 6951 |
}
|
| 6952 |
/**
|
| 6953 |
+
* Action that updates the block with the specified client ID.
|
|
|
|
| 6954 |
*
|
| 6955 |
* @param {string} clientId Block client ID.
|
| 6956 |
* @param {Object} updates Block attributes to be merged.
|
| 6995 |
* @param {string} clientId Block client ID.
|
| 6996 |
*/
|
| 6997 |
|
| 6998 |
+
const selectPreviousBlock = clientId => ({
|
| 6999 |
+
select,
|
| 7000 |
+
dispatch
|
| 7001 |
+
}) => {
|
| 7002 |
+
const previousBlockClientId = select.getPreviousBlockClientId(clientId);
|
| 7003 |
|
| 7004 |
if (previousBlockClientId) {
|
| 7005 |
+
dispatch.selectBlock(previousBlockClientId, -1);
|
|
|
|
| 7006 |
}
|
| 7007 |
+
};
|
| 7008 |
/**
|
| 7009 |
* Yields action objects used in signalling that the block following the given
|
| 7010 |
* clientId should be selected.
|
| 7012 |
* @param {string} clientId Block client ID.
|
| 7013 |
*/
|
| 7014 |
|
| 7015 |
+
const selectNextBlock = clientId => ({
|
| 7016 |
+
select,
|
| 7017 |
+
dispatch
|
| 7018 |
+
}) => {
|
| 7019 |
+
const nextBlockClientId = select.getNextBlockClientId(clientId);
|
| 7020 |
|
| 7021 |
if (nextBlockClientId) {
|
| 7022 |
+
dispatch.selectBlock(nextBlockClientId);
|
|
|
|
| 7023 |
}
|
| 7024 |
+
};
|
| 7025 |
/**
|
| 7026 |
+
* Action that starts block multi-selection.
|
| 7027 |
*
|
| 7028 |
* @return {Object} Action object.
|
| 7029 |
*/
|
| 7034 |
};
|
| 7035 |
}
|
| 7036 |
/**
|
| 7037 |
+
* Action that stops block multi-selection.
|
| 7038 |
*
|
| 7039 |
* @return {Object} Action object.
|
| 7040 |
*/
|
| 7045 |
};
|
| 7046 |
}
|
| 7047 |
/**
|
| 7048 |
+
* Action that changes block multi-selection.
|
| 7049 |
*
|
| 7050 |
* @param {string} start First block of the multi selection.
|
| 7051 |
* @param {string} end Last block of the multiselection.
|
| 7052 |
*/
|
| 7053 |
|
| 7054 |
+
const multiSelect = (start, end) => ({
|
| 7055 |
+
select,
|
| 7056 |
+
dispatch
|
| 7057 |
+
}) => {
|
| 7058 |
+
const startBlockRootClientId = select.getBlockRootClientId(start);
|
| 7059 |
+
const endBlockRootClientId = select.getBlockRootClientId(end); // Only allow block multi-selections at the same level.
|
| 7060 |
|
| 7061 |
if (startBlockRootClientId !== endBlockRootClientId) {
|
| 7062 |
return;
|
| 7063 |
}
|
| 7064 |
|
| 7065 |
+
dispatch({
|
| 7066 |
type: 'MULTI_SELECT',
|
| 7067 |
start,
|
| 7068 |
end
|
| 7069 |
+
});
|
| 7070 |
+
const blockCount = select.getSelectedBlockCount();
|
| 7071 |
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)(
|
| 7072 |
/* translators: %s: number of selected blocks */
|
| 7073 |
(0,external_wp_i18n_namespaceObject._n)('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive');
|
| 7074 |
+
};
|
| 7075 |
/**
|
| 7076 |
+
* Action that clears the block selection.
|
| 7077 |
*
|
| 7078 |
* @return {Object} Action object.
|
| 7079 |
*/
|
| 7084 |
};
|
| 7085 |
}
|
| 7086 |
/**
|
| 7087 |
+
* Action that enables or disables block selection.
|
| 7088 |
*
|
| 7089 |
* @param {boolean} [isSelectionEnabled=true] Whether block selection should
|
| 7090 |
* be enabled.
|
| 7136 |
/* eslint-disable jsdoc/valid-types */
|
| 7137 |
|
| 7138 |
/**
|
| 7139 |
+
* Action that replaces given blocks with one or more replacement blocks.
|
|
|
|
| 7140 |
*
|
| 7141 |
* @param {(string|string[])} clientIds Block client ID(s) to replace.
|
| 7142 |
* @param {(Object|Object[])} blocks Replacement block(s).
|
| 7144 |
* @param {0|-1|null} initialPosition Index of caret after in the selected block after the operation.
|
| 7145 |
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
| 7146 |
*
|
| 7147 |
+
* @return {Object} Action object.
|
| 7148 |
*/
|
| 7149 |
|
| 7150 |
|
| 7151 |
+
const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition = 0, meta) => ({
|
| 7152 |
+
select,
|
| 7153 |
+
dispatch
|
| 7154 |
+
}) => {
|
| 7155 |
/* eslint-enable jsdoc/valid-types */
|
| 7156 |
clientIds = (0,external_lodash_namespaceObject.castArray)(clientIds);
|
| 7157 |
+
blocks = getBlocksWithDefaultStylesApplied((0,external_lodash_namespaceObject.castArray)(blocks), select.getSettings());
|
| 7158 |
+
const rootClientId = select.getBlockRootClientId((0,external_lodash_namespaceObject.first)(clientIds)); // Replace is valid if the new blocks can be inserted in the root block.
|
| 7159 |
|
| 7160 |
for (let index = 0; index < blocks.length; index++) {
|
| 7161 |
const block = blocks[index];
|
| 7162 |
+
const canInsertBlock = select.canInsertBlockType(block.name, rootClientId);
|
| 7163 |
|
| 7164 |
if (!canInsertBlock) {
|
| 7165 |
return;
|
| 7166 |
}
|
| 7167 |
}
|
| 7168 |
|
| 7169 |
+
dispatch({
|
| 7170 |
type: 'REPLACE_BLOCKS',
|
| 7171 |
clientIds,
|
| 7172 |
blocks,
|
| 7174 |
indexToSelect,
|
| 7175 |
initialPosition,
|
| 7176 |
meta
|
| 7177 |
+
});
|
| 7178 |
+
dispatch(ensureDefaultBlock());
|
| 7179 |
+
};
|
| 7180 |
/**
|
| 7181 |
+
* Action that replaces a single block with one or more replacement blocks.
|
|
|
|
| 7182 |
*
|
| 7183 |
* @param {(string|string[])} clientId Block client ID to replace.
|
| 7184 |
* @param {(Object|Object[])} block Replacement block(s).
|
| 7198 |
* @return {Function} Action creator.
|
| 7199 |
*/
|
| 7200 |
|
| 7201 |
+
const createOnMove = type => (clientIds, rootClientId) => ({
|
| 7202 |
+
select,
|
| 7203 |
+
dispatch
|
| 7204 |
+
}) => {
|
| 7205 |
+
// If one of the blocks is locked or the parent is locked, we cannot move any block.
|
| 7206 |
+
const canMoveBlocks = select.canMoveBlocks(clientIds, rootClientId);
|
| 7207 |
|
| 7208 |
+
if (!canMoveBlocks) {
|
| 7209 |
+
return;
|
| 7210 |
+
}
|
| 7211 |
|
| 7212 |
+
dispatch({
|
| 7213 |
+
type,
|
| 7214 |
+
clientIds: (0,external_lodash_namespaceObject.castArray)(clientIds),
|
| 7215 |
+
rootClientId
|
| 7216 |
+
});
|
| 7217 |
+
};
|
|
|
|
| 7218 |
|
| 7219 |
const moveBlocksDown = createOnMove('MOVE_BLOCKS_DOWN');
|
| 7220 |
const moveBlocksUp = createOnMove('MOVE_BLOCKS_UP');
|
| 7221 |
/**
|
| 7222 |
+
* Action that moves given blocks to a new position.
|
|
|
|
| 7223 |
*
|
| 7224 |
* @param {?string} clientIds The client IDs of the blocks.
|
| 7225 |
* @param {?string} fromRootClientId Root client ID source.
|
| 7226 |
* @param {?string} toRootClientId Root client ID destination.
|
| 7227 |
* @param {number} index The index to move the blocks to.
|
|
|
|
|
|
|
| 7228 |
*/
|
| 7229 |
|
| 7230 |
+
const moveBlocksToPosition = (clientIds, fromRootClientId = '', toRootClientId = '', index) => ({
|
| 7231 |
+
select,
|
| 7232 |
+
dispatch
|
| 7233 |
+
}) => {
|
| 7234 |
+
const canMoveBlocks = select.canMoveBlocks(clientIds, fromRootClientId); // If one of the blocks is locked or the parent is locked, we cannot move any block.
|
| 7235 |
|
| 7236 |
if (!canMoveBlocks) {
|
| 7237 |
return;
|
| 7238 |
+
} // If moving inside the same root block the move is always possible.
|
| 7239 |
+
|
| 7240 |
+
|
| 7241 |
+
if (fromRootClientId !== toRootClientId) {
|
| 7242 |
+
const canRemoveBlocks = select.canRemoveBlocks(clientIds, fromRootClientId); // If we're moving to another block, it means we're deleting blocks from
|
| 7243 |
+
// the original block, so we need to check if removing is possible.
|
| 7244 |
+
|
| 7245 |
+
if (!canRemoveBlocks) {
|
| 7246 |
+
return;
|
| 7247 |
+
}
|
| 7248 |
+
|
| 7249 |
+
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.
|
| 7250 |
+
|
| 7251 |
+
if (!canInsertBlocks) {
|
| 7252 |
+
return;
|
| 7253 |
+
}
|
| 7254 |
}
|
| 7255 |
|
| 7256 |
+
dispatch({
|
| 7257 |
type: 'MOVE_BLOCKS_TO_POSITION',
|
| 7258 |
fromRootClientId,
|
| 7259 |
toRootClientId,
|
| 7260 |
clientIds,
|
| 7261 |
index
|
| 7262 |
+
});
|
| 7263 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7264 |
/**
|
| 7265 |
+
* Action that moves given block to a new position.
|
|
|
|
| 7266 |
*
|
| 7267 |
* @param {?string} clientId The client ID of the block.
|
| 7268 |
* @param {?string} fromRootClientId Root client ID source.
|
| 7269 |
* @param {?string} toRootClientId Root client ID destination.
|
| 7270 |
* @param {number} index The index to move the block to.
|
|
|
|
|
|
|
| 7271 |
*/
|
| 7272 |
|
| 7273 |
+
function moveBlockToPosition(clientId, fromRootClientId = '', toRootClientId = '', index) {
|
| 7274 |
+
return moveBlocksToPosition([clientId], fromRootClientId, toRootClientId, index);
|
| 7275 |
}
|
| 7276 |
/**
|
| 7277 |
+
* Action that inserts a single block, optionally at a specific index respective a root block list.
|
|
|
|
| 7278 |
*
|
| 7279 |
* @param {Object} block Block object to insert.
|
| 7280 |
* @param {?number} index Index at which block should be inserted.
|
| 7285 |
* @return {Object} Action object.
|
| 7286 |
*/
|
| 7287 |
|
| 7288 |
+
function insertBlock(block, index, rootClientId, updateSelection, meta) {
|
| 7289 |
return insertBlocks([block], index, rootClientId, updateSelection, 0, meta);
|
| 7290 |
}
|
| 7291 |
/* eslint-disable jsdoc/valid-types */
|
| 7292 |
|
| 7293 |
/**
|
| 7294 |
+
* Action that inserts an array of blocks, optionally at a specific index respective a root block list.
|
|
|
|
| 7295 |
*
|
| 7296 |
* @param {Object[]} blocks Block objects to insert.
|
| 7297 |
* @param {?number} index Index at which block should be inserted.
|
| 7302 |
* @return {Object} Action object.
|
| 7303 |
*/
|
| 7304 |
|
| 7305 |
+
const insertBlocks = (blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) => ({
|
| 7306 |
+
select,
|
| 7307 |
+
dispatch
|
| 7308 |
+
}) => {
|
| 7309 |
/* eslint-enable jsdoc/valid-types */
|
| 7310 |
if ((0,external_lodash_namespaceObject.isObject)(initialPosition)) {
|
| 7311 |
meta = initialPosition;
|
| 7317 |
});
|
| 7318 |
}
|
| 7319 |
|
| 7320 |
+
blocks = getBlocksWithDefaultStylesApplied((0,external_lodash_namespaceObject.castArray)(blocks), select.getSettings());
|
| 7321 |
const allowedBlocks = [];
|
| 7322 |
|
| 7323 |
for (const block of blocks) {
|
| 7324 |
+
const isValid = select.canInsertBlockType(block.name, rootClientId);
|
| 7325 |
|
| 7326 |
if (isValid) {
|
| 7327 |
allowedBlocks.push(block);
|
| 7329 |
}
|
| 7330 |
|
| 7331 |
if (allowedBlocks.length) {
|
| 7332 |
+
dispatch({
|
| 7333 |
type: 'INSERT_BLOCKS',
|
| 7334 |
blocks: allowedBlocks,
|
| 7335 |
index,
|
| 7338 |
updateSelection,
|
| 7339 |
initialPosition: updateSelection ? initialPosition : null,
|
| 7340 |
meta
|
| 7341 |
+
});
|
| 7342 |
}
|
| 7343 |
+
};
|
| 7344 |
/**
|
| 7345 |
+
* Action that shows the insertion point.
|
|
|
|
| 7346 |
*
|
| 7347 |
* @param {?string} rootClientId Optional root client ID of block list on
|
| 7348 |
* which to insert.
|
| 7364 |
};
|
| 7365 |
}
|
| 7366 |
/**
|
| 7367 |
+
* Action that hides the insertion point.
|
| 7368 |
*
|
| 7369 |
* @return {Object} Action object.
|
| 7370 |
*/
|
| 7375 |
};
|
| 7376 |
}
|
| 7377 |
/**
|
| 7378 |
+
* Action that resets the template validity.
|
| 7379 |
*
|
| 7380 |
* @param {boolean} isValid template validity flag.
|
| 7381 |
*
|
| 7389 |
};
|
| 7390 |
}
|
| 7391 |
/**
|
| 7392 |
+
* Action that synchronizes the template with the list of blocks.
|
| 7393 |
*
|
| 7394 |
* @return {Object} Action object.
|
| 7395 |
*/
|
| 7396 |
|
| 7397 |
+
const synchronizeTemplate = () => ({
|
| 7398 |
+
select,
|
| 7399 |
+
dispatch
|
| 7400 |
+
}) => {
|
| 7401 |
+
dispatch({
|
| 7402 |
type: 'SYNCHRONIZE_TEMPLATE'
|
| 7403 |
+
});
|
| 7404 |
+
const blocks = select.getBlocks();
|
| 7405 |
+
const template = select.getTemplate();
|
| 7406 |
const updatedBlockList = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template);
|
| 7407 |
+
dispatch.resetBlocks(updatedBlockList);
|
| 7408 |
+
};
|
| 7409 |
/**
|
| 7410 |
+
* Action that merges two blocks.
|
| 7411 |
*
|
| 7412 |
* @param {string} firstBlockClientId Client ID of the first block to merge.
|
| 7413 |
* @param {string} secondBlockClientId Client ID of the second block to merge.
|
| 7414 |
*/
|
| 7415 |
|
| 7416 |
+
const mergeBlocks = (firstBlockClientId, secondBlockClientId) => ({
|
| 7417 |
+
select,
|
| 7418 |
+
dispatch
|
| 7419 |
+
}) => {
|
| 7420 |
const blocks = [firstBlockClientId, secondBlockClientId];
|
| 7421 |
+
dispatch({
|
| 7422 |
type: 'MERGE_BLOCKS',
|
| 7423 |
blocks
|
| 7424 |
+
});
|
| 7425 |
const [clientIdA, clientIdB] = blocks;
|
| 7426 |
+
const blockA = select.getBlock(clientIdA);
|
| 7427 |
const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); // Only focus the previous block if it's not mergeable
|
| 7428 |
|
| 7429 |
if (blockAType && !blockAType.merge) {
|
| 7430 |
+
dispatch.selectBlock(blockA.clientId);
|
| 7431 |
return;
|
| 7432 |
}
|
| 7433 |
|
| 7434 |
+
const blockB = select.getBlock(clientIdB);
|
| 7435 |
const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name);
|
| 7436 |
const {
|
| 7437 |
clientId,
|
| 7438 |
attributeKey,
|
| 7439 |
offset
|
| 7440 |
+
} = select.getSelectionStart();
|
| 7441 |
const selectedBlockType = clientId === clientIdA ? blockAType : blockBType;
|
| 7442 |
const attributeDefinition = selectedBlockType.attributes[attributeKey];
|
| 7443 |
const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== undefined && offset !== undefined && // We cannot restore text selection if the RichText identifier
|
| 7515 |
preserveWhiteSpace
|
| 7516 |
});
|
| 7517 |
updatedAttributes[newAttributeKey] = newHtml;
|
| 7518 |
+
dispatch.selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset);
|
| 7519 |
}
|
| 7520 |
|
| 7521 |
+
dispatch.replaceBlocks([blockA.clientId, blockB.clientId], [{ ...blockA,
|
| 7522 |
attributes: { ...blockA.attributes,
|
| 7523 |
...updatedAttributes
|
| 7524 |
}
|
| 7525 |
}, ...blocksWithTheSameType.slice(1)], 0 // If we don't pass the `indexToSelect` it will default to the last block.
|
| 7526 |
);
|
| 7527 |
+
};
|
| 7528 |
/**
|
| 7529 |
* Yields action objects used in signalling that the blocks corresponding to
|
| 7530 |
* the set of specified client IDs are to be removed.
|
| 7534 |
* selected when a block is removed.
|
| 7535 |
*/
|
| 7536 |
|
| 7537 |
+
const removeBlocks = (clientIds, selectPrevious = true) => ({
|
| 7538 |
+
select,
|
| 7539 |
+
dispatch
|
| 7540 |
+
}) => {
|
| 7541 |
if (!clientIds || !clientIds.length) {
|
| 7542 |
return;
|
| 7543 |
}
|
| 7544 |
|
| 7545 |
clientIds = (0,external_lodash_namespaceObject.castArray)(clientIds);
|
| 7546 |
+
const rootClientId = select.getBlockRootClientId(clientIds[0]);
|
| 7547 |
+
const canRemoveBlocks = select.canRemoveBlocks(clientIds, rootClientId);
|
| 7548 |
|
| 7549 |
if (!canRemoveBlocks) {
|
| 7550 |
return;
|
| 7551 |
}
|
| 7552 |
|
|
|
|
|
|
|
| 7553 |
if (selectPrevious) {
|
| 7554 |
+
dispatch.selectPreviousBlock(clientIds[0]);
|
|
|
|
|
|
|
| 7555 |
}
|
| 7556 |
|
| 7557 |
+
dispatch({
|
| 7558 |
type: 'REMOVE_BLOCKS',
|
| 7559 |
clientIds
|
| 7560 |
+
}); // To avoid a focus loss when removing the last block, assure there is
|
| 7561 |
// always a default block if the last of the blocks have been removed.
|
| 7562 |
|
| 7563 |
+
dispatch(ensureDefaultBlock());
|
| 7564 |
+
};
|
|
|
|
| 7565 |
/**
|
| 7566 |
* Returns an action object used in signalling that the block with the
|
| 7567 |
* specified client ID is to be removed.
|
| 7685 |
};
|
| 7686 |
}
|
| 7687 |
/**
|
| 7688 |
+
* Action that changes the position of the user caret.
|
|
|
|
| 7689 |
*
|
| 7690 |
* @param {string} clientId The selected block client ID.
|
| 7691 |
* @param {string} attributeKey The selected block attribute key.
|
| 7705 |
};
|
| 7706 |
}
|
| 7707 |
/**
|
| 7708 |
+
* Action that adds a new block of the default type to the block list.
|
|
|
|
| 7709 |
*
|
| 7710 |
* @param {?Object} attributes Optional attributes of the block to assign.
|
| 7711 |
* @param {?string} rootClientId Optional root client ID of block list on which
|
| 7727 |
return insertBlock(block, index, rootClientId);
|
| 7728 |
}
|
| 7729 |
/**
|
| 7730 |
+
* Action that changes the nested settings of a given block.
|
| 7731 |
*
|
| 7732 |
* @param {string} clientId Client ID of the block whose nested setting are
|
| 7733 |
* being received.
|
| 7744 |
};
|
| 7745 |
}
|
| 7746 |
/**
|
| 7747 |
+
* Action that updates the block editor settings.
|
| 7748 |
*
|
| 7749 |
* @param {Object} settings Updated settings
|
| 7750 |
*
|
| 7758 |
};
|
| 7759 |
}
|
| 7760 |
/**
|
| 7761 |
+
* Action that signals that a temporary reusable block has been saved
|
| 7762 |
* in order to switch its temporary id with the real id.
|
| 7763 |
*
|
| 7764 |
* @param {string} id Reusable block's id.
|
| 7775 |
};
|
| 7776 |
}
|
| 7777 |
/**
|
| 7778 |
+
* Action that marks the last block change explicitly as persistent.
|
| 7779 |
*
|
| 7780 |
* @return {Object} Action object.
|
| 7781 |
*/
|
| 7786 |
};
|
| 7787 |
}
|
| 7788 |
/**
|
| 7789 |
+
* Action that signals that the next block change should be marked explicitly as not persistent.
|
| 7790 |
*
|
| 7791 |
* @return {Object} Action object.
|
| 7792 |
*/
|
| 7797 |
};
|
| 7798 |
}
|
| 7799 |
/**
|
| 7800 |
+
* Action that marks the last block change as an automatic change, meaning it was not
|
| 7801 |
+
* performed by the user, and can be undone using the `Escape` and `Backspace` keys.
|
| 7802 |
+
* This action must be called after the change was made, and any actions that are a
|
| 7803 |
+
* consequence of it, so it is recommended to be called at the next idle period to ensure all
|
|
|
|
| 7804 |
* selection changes have been recorded.
|
| 7805 |
*/
|
| 7806 |
|
| 7807 |
+
const __unstableMarkAutomaticChange = () => ({
|
| 7808 |
+
dispatch
|
| 7809 |
+
}) => {
|
| 7810 |
+
dispatch({
|
| 7811 |
type: 'MARK_AUTOMATIC_CHANGE'
|
| 7812 |
+
});
|
| 7813 |
+
const {
|
| 7814 |
+
requestIdleCallback = cb => setTimeout(cb, 100)
|
| 7815 |
+
} = window;
|
| 7816 |
+
requestIdleCallback(() => {
|
| 7817 |
+
dispatch({
|
| 7818 |
+
type: 'MARK_AUTOMATIC_CHANGE_FINAL'
|
| 7819 |
+
});
|
| 7820 |
+
});
|
| 7821 |
+
};
|
| 7822 |
/**
|
| 7823 |
+
* Action that enables or disables the navigation mode.
|
| 7824 |
*
|
| 7825 |
* @param {string} isNavigationMode Enable/Disable navigation mode.
|
| 7826 |
*/
|
| 7827 |
|
| 7828 |
+
const setNavigationMode = (isNavigationMode = true) => ({
|
| 7829 |
+
dispatch
|
| 7830 |
+
}) => {
|
| 7831 |
+
dispatch({
|
| 7832 |
type: 'SET_NAVIGATION_MODE',
|
| 7833 |
isNavigationMode
|
| 7834 |
+
});
|
| 7835 |
|
| 7836 |
if (isNavigationMode) {
|
| 7837 |
(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.'));
|
| 7838 |
} else {
|
| 7839 |
(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.'));
|
| 7840 |
}
|
| 7841 |
+
};
|
| 7842 |
/**
|
| 7843 |
+
* Action that enables or disables the block moving mode.
|
| 7844 |
*
|
| 7845 |
* @param {string|null} hasBlockMovingClientId Enable/Disable block moving mode.
|
| 7846 |
*/
|
| 7847 |
|
| 7848 |
+
const setBlockMovingClientId = (hasBlockMovingClientId = null) => ({
|
| 7849 |
+
dispatch
|
| 7850 |
+
}) => {
|
| 7851 |
+
dispatch({
|
| 7852 |
type: 'SET_BLOCK_MOVING_MODE',
|
| 7853 |
hasBlockMovingClientId
|
| 7854 |
+
});
|
| 7855 |
|
| 7856 |
if (hasBlockMovingClientId) {
|
| 7857 |
(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.'));
|
| 7858 |
}
|
| 7859 |
+
};
|
| 7860 |
/**
|
| 7861 |
+
* Action that duplicates a list of blocks.
|
| 7862 |
*
|
| 7863 |
* @param {string[]} clientIds
|
| 7864 |
* @param {boolean} updateSelection
|
| 7865 |
*/
|
| 7866 |
|
| 7867 |
+
const duplicateBlocks = (clientIds, updateSelection = true) => ({
|
| 7868 |
+
select,
|
| 7869 |
+
dispatch
|
| 7870 |
+
}) => {
|
| 7871 |
+
if (!clientIds || !clientIds.length) {
|
| 7872 |
return;
|
| 7873 |
+
} // Return early if blocks don't exist.
|
| 7874 |
+
|
| 7875 |
|
| 7876 |
+
const blocks = select.getBlocksByClientId(clientIds);
|
|
|
|
| 7877 |
|
| 7878 |
if ((0,external_lodash_namespaceObject.some)(blocks, block => !block)) {
|
| 7879 |
return;
|
| 7880 |
+
} // Return early if blocks don't support multiple usage.
|
| 7881 |
|
|
|
|
| 7882 |
|
| 7883 |
+
const blockNames = blocks.map(block => block.name);
|
| 7884 |
+
|
| 7885 |
+
if (blockNames.some(blockName => !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'multiple', true))) {
|
| 7886 |
return;
|
| 7887 |
}
|
| 7888 |
|
| 7889 |
+
const rootClientId = select.getBlockRootClientId(clientIds[0]);
|
| 7890 |
+
const lastSelectedIndex = select.getBlockIndex((0,external_lodash_namespaceObject.last)((0,external_lodash_namespaceObject.castArray)(clientIds)), rootClientId);
|
| 7891 |
const clonedBlocks = blocks.map(block => (0,external_wp_blocks_namespaceObject.__experimentalCloneSanitizedBlock)(block));
|
| 7892 |
+
dispatch.insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection);
|
| 7893 |
|
| 7894 |
if (clonedBlocks.length > 1 && updateSelection) {
|
| 7895 |
+
dispatch.multiSelect((0,external_lodash_namespaceObject.first)(clonedBlocks).clientId, (0,external_lodash_namespaceObject.last)(clonedBlocks).clientId);
|
| 7896 |
}
|
| 7897 |
|
| 7898 |
return clonedBlocks.map(block => block.clientId);
|
| 7899 |
+
};
|
| 7900 |
/**
|
| 7901 |
+
* Action that inserts an empty block before a given block.
|
| 7902 |
*
|
| 7903 |
* @param {string} clientId
|
| 7904 |
*/
|
| 7905 |
|
| 7906 |
+
const insertBeforeBlock = clientId => ({
|
| 7907 |
+
select,
|
| 7908 |
+
dispatch
|
| 7909 |
+
}) => {
|
| 7910 |
if (!clientId) {
|
| 7911 |
return;
|
| 7912 |
}
|
| 7913 |
|
| 7914 |
+
const rootClientId = select.getBlockRootClientId(clientId);
|
| 7915 |
+
const isLocked = select.getTemplateLock(rootClientId);
|
| 7916 |
|
| 7917 |
if (isLocked) {
|
| 7918 |
return;
|
| 7919 |
}
|
| 7920 |
|
| 7921 |
+
const firstSelectedIndex = select.getBlockIndex(clientId, rootClientId);
|
| 7922 |
+
return dispatch.insertDefaultBlock({}, rootClientId, firstSelectedIndex);
|
| 7923 |
+
};
|
| 7924 |
/**
|
| 7925 |
+
* Action that inserts an empty block after a given block.
|
| 7926 |
*
|
| 7927 |
* @param {string} clientId
|
| 7928 |
*/
|
| 7929 |
|
| 7930 |
+
const insertAfterBlock = clientId => ({
|
| 7931 |
+
select,
|
| 7932 |
+
dispatch
|
| 7933 |
+
}) => {
|
| 7934 |
if (!clientId) {
|
| 7935 |
return;
|
| 7936 |
}
|
| 7937 |
|
| 7938 |
+
const rootClientId = select.getBlockRootClientId(clientId);
|
| 7939 |
+
const isLocked = select.getTemplateLock(rootClientId);
|
| 7940 |
|
| 7941 |
if (isLocked) {
|
| 7942 |
return;
|
| 7943 |
}
|
| 7944 |
|
| 7945 |
+
const firstSelectedIndex = select.getBlockIndex(clientId, rootClientId);
|
| 7946 |
+
return dispatch.insertDefaultBlock({}, rootClientId, firstSelectedIndex + 1);
|
| 7947 |
+
};
|
| 7948 |
/**
|
| 7949 |
+
* Action that toggles the highlighted block state.
|
| 7950 |
*
|
| 7951 |
* @param {string} clientId The block's clientId.
|
| 7952 |
* @param {boolean} isHighlighted The highlight state.
|
| 7960 |
};
|
| 7961 |
}
|
| 7962 |
/**
|
| 7963 |
+
* Action that "flashes" the block with a given `clientId` by rhythmically highlighting it.
|
|
|
|
| 7964 |
*
|
| 7965 |
* @param {string} clientId Target block client ID.
|
| 7966 |
*/
|
| 7967 |
|
| 7968 |
+
const flashBlock = clientId => async ({
|
| 7969 |
+
dispatch
|
| 7970 |
+
}) => {
|
| 7971 |
+
dispatch(toggleBlockHighlight(clientId, true));
|
| 7972 |
+
await new Promise(resolve => setTimeout(resolve, 150));
|
| 7973 |
+
dispatch(toggleBlockHighlight(clientId, false));
|
| 7974 |
+
};
|
|
|
|
| 7975 |
/**
|
| 7976 |
+
* Action that sets whether a block has controlled inner blocks.
|
| 7977 |
*
|
| 7978 |
* @param {string} clientId The block's clientId.
|
| 7979 |
* @param {boolean} hasControlledInnerBlocks True if the block's inner blocks are controlled.
|
| 7987 |
};
|
| 7988 |
}
|
| 7989 |
//# sourceMappingURL=actions.js.map
|
| 7990 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/store/constants.js
|
| 7991 |
+
const STORE_NAME = 'core/block-editor';
|
| 7992 |
+
//# sourceMappingURL=constants.js.map
|
| 7993 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/store/index.js
|
| 7994 |
/**
|
| 7995 |
* WordPress dependencies
|
| 8003 |
|
| 8004 |
|
| 8005 |
|
|
|
|
| 8006 |
/**
|
| 8007 |
* Block editor data store configuration.
|
| 8008 |
*
|
| 8015 |
reducer: reducer,
|
| 8016 |
selectors: selectors_namespaceObject,
|
| 8017 |
actions: actions_namespaceObject,
|
| 8018 |
+
__experimentalUseThunks: true
|
| 8019 |
};
|
| 8020 |
/**
|
| 8021 |
* Store definition for the block editor namespace.
|
| 8396 |
}));
|
| 8397 |
/* harmony default export */ var justify_space_between = (justifySpaceBetween);
|
| 8398 |
//# sourceMappingURL=justify-space-between.js.map
|
| 8399 |
+
;// CONCATENATED MODULE: ./packages/icons/build-module/library/arrow-right.js
|
| 8400 |
+
|
| 8401 |
+
|
| 8402 |
+
/**
|
| 8403 |
+
* WordPress dependencies
|
| 8404 |
+
*/
|
| 8405 |
+
|
| 8406 |
+
const arrowRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 8407 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 8408 |
+
viewBox: "0 0 24 24"
|
| 8409 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 8410 |
+
d: "M14.3 6.7l-1.1 1.1 4 4H4v1.5h13.3l-4.1 4.4 1.1 1.1 5.8-6.3z"
|
| 8411 |
+
}));
|
| 8412 |
+
/* harmony default export */ var arrow_right = (arrowRight);
|
| 8413 |
+
//# sourceMappingURL=arrow-right.js.map
|
| 8414 |
+
;// CONCATENATED MODULE: ./packages/icons/build-module/library/arrow-down.js
|
| 8415 |
+
|
| 8416 |
+
|
| 8417 |
+
/**
|
| 8418 |
+
* WordPress dependencies
|
| 8419 |
+
*/
|
| 8420 |
+
|
| 8421 |
+
const arrowDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 8422 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 8423 |
+
viewBox: "0 0 24 24"
|
| 8424 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 8425 |
+
d: "M16.2 13.2l-4 4V4h-1.5v13.3l-4.5-4.1-1 1.1 6.2 5.8 5.8-5.8-1-1.1z"
|
| 8426 |
+
}));
|
| 8427 |
+
/* harmony default export */ var arrow_down = (arrowDown);
|
| 8428 |
+
//# sourceMappingURL=arrow-down.js.map
|
| 8429 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/layouts/utils.js
|
| 8430 |
/**
|
| 8431 |
* Utility to generate the proper CSS selector for layout styles.
|
| 8468 |
'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients,
|
| 8469 |
'typography.fontSizes': settings => settings.fontSizes === undefined ? undefined : settings.fontSizes,
|
| 8470 |
'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes,
|
| 8471 |
+
'typography.lineHeight': settings => settings.enableCustomLineHeight,
|
| 8472 |
'spacing.units': settings => {
|
| 8473 |
if (settings.enableCustomUnits === undefined) {
|
| 8474 |
return;
|
| 8480 |
|
| 8481 |
return settings.enableCustomUnits;
|
| 8482 |
},
|
| 8483 |
+
'spacing.padding': settings => settings.enableCustomSpacing
|
| 8484 |
+
};
|
| 8485 |
+
const prefixedFlags = {
|
| 8486 |
+
/*
|
| 8487 |
+
* These were only available in the plugin
|
| 8488 |
+
* and can be removed when the minimum WordPress version
|
| 8489 |
+
* for the plugin is 5.9.
|
| 8490 |
+
*/
|
| 8491 |
+
'border.customColor': 'border.color',
|
| 8492 |
+
'border.customStyle': 'border.style',
|
| 8493 |
+
'border.customWidth': 'border.width',
|
| 8494 |
+
'typography.customFontStyle': 'typography.fontStyle',
|
| 8495 |
+
'typography.customFontWeight': 'typography.fontWeight',
|
| 8496 |
+
'typography.customLetterSpacing': 'typography.letterSpacing',
|
| 8497 |
+
'typography.customTextDecorations': 'typography.textDecoration',
|
| 8498 |
+
'typography.customTextTransforms': 'typography.textTransform',
|
| 8499 |
+
|
| 8500 |
+
/*
|
| 8501 |
+
* These were part of WordPress 5.8 and we need to keep them.
|
| 8502 |
+
*/
|
| 8503 |
+
'border.customRadius': 'border.radius',
|
| 8504 |
+
'spacing.customMargin': 'spacing.margin',
|
| 8505 |
+
'spacing.customPadding': 'spacing.padding',
|
| 8506 |
+
'typography.customLineHeight': 'typography.lineHeight'
|
| 8507 |
+
};
|
| 8508 |
+
/**
|
| 8509 |
+
* Remove `custom` prefixes for flags that did not land in 5.8.
|
| 8510 |
+
*
|
| 8511 |
+
* This provides continued support for `custom` prefixed properties. It will
|
| 8512 |
+
* be removed once third party devs have had sufficient time to update themes,
|
| 8513 |
+
* plugins, etc.
|
| 8514 |
+
*
|
| 8515 |
+
* @see https://github.com/WordPress/gutenberg/pull/34485
|
| 8516 |
+
*
|
| 8517 |
+
* @param {string} path Path to desired value in settings.
|
| 8518 |
+
* @return {string} The value for defined setting.
|
| 8519 |
+
*/
|
| 8520 |
+
|
| 8521 |
+
const removeCustomPrefixes = path => {
|
| 8522 |
+
return prefixedFlags[path] || path;
|
| 8523 |
};
|
| 8524 |
/**
|
| 8525 |
* Hook that retrieves the editor setting.
|
| 8526 |
* It works with nested objects using by finding the value at path.
|
| 8527 |
*
|
| 8528 |
* @param {string} path The path to the setting.
|
|
|
|
| 8529 |
* @return {any} Returns the value defined for the setting.
|
|
|
|
| 8530 |
* @example
|
| 8531 |
* ```js
|
| 8532 |
* const isEnabled = useSetting( 'typography.dropCap' );
|
| 8533 |
* ```
|
| 8534 |
*/
|
| 8535 |
|
| 8536 |
+
|
| 8537 |
function useSetting(path) {
|
| 8538 |
const {
|
| 8539 |
name: blockName
|
| 8544 |
const settings = select(store).getSettings(); // 1 - Use __experimental features, if available.
|
| 8545 |
// We cascade to the all value if the block one is not available.
|
| 8546 |
|
| 8547 |
+
const normalizedPath = removeCustomPrefixes(path);
|
| 8548 |
+
const defaultsPath = `__experimentalFeatures.${normalizedPath}`;
|
| 8549 |
+
const blockPath = `__experimentalFeatures.blocks.${blockName}.${normalizedPath}`;
|
| 8550 |
const experimentalFeaturesResult = (_get = (0,external_lodash_namespaceObject.get)(settings, blockPath)) !== null && _get !== void 0 ? _get : (0,external_lodash_namespaceObject.get)(settings, defaultsPath);
|
| 8551 |
|
| 8552 |
if (experimentalFeaturesResult !== undefined) {
|
| 8553 |
+
if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[normalizedPath]) {
|
| 8554 |
var _ref, _experimentalFeatures;
|
| 8555 |
|
| 8556 |
return (_ref = (_experimentalFeatures = experimentalFeaturesResult.user) !== null && _experimentalFeatures !== void 0 ? _experimentalFeatures : experimentalFeaturesResult.theme) !== null && _ref !== void 0 ? _ref : experimentalFeaturesResult.core;
|
| 8560 |
} // 2 - Use deprecated settings, otherwise.
|
| 8561 |
|
| 8562 |
|
| 8563 |
+
const deprecatedSettingsValue = deprecatedFlags[normalizedPath] ? deprecatedFlags[normalizedPath](settings) : undefined;
|
| 8564 |
|
| 8565 |
if (deprecatedSettingsValue !== undefined) {
|
| 8566 |
return deprecatedSettingsValue;
|
| 8570 |
// To remove when __experimentalFeatures are ported to core.
|
| 8571 |
|
| 8572 |
|
| 8573 |
+
return normalizedPath === 'typography.dropCap' ? true : undefined;
|
| 8574 |
}, [blockName, path]);
|
| 8575 |
return setting;
|
| 8576 |
}
|
| 8685 |
|
| 8686 |
|
| 8687 |
|
| 8688 |
+
// Used with the default, horizontal flex orientation.
|
| 8689 |
|
| 8690 |
const justifyContentMap = {
|
| 8691 |
left: 'flex-start',
|
| 8692 |
right: 'flex-end',
|
| 8693 |
center: 'center',
|
| 8694 |
'space-between': 'space-between'
|
| 8695 |
+
}; // Used with the vertical (column) flex orientation.
|
| 8696 |
+
|
| 8697 |
+
const alignItemsMap = {
|
| 8698 |
+
left: 'flex-start',
|
| 8699 |
+
right: 'flex-end',
|
| 8700 |
+
center: 'center'
|
| 8701 |
};
|
| 8702 |
+
const flexWrapOptions = ['wrap', 'nowrap'];
|
| 8703 |
/* harmony default export */ var flex = ({
|
| 8704 |
name: 'flex',
|
| 8705 |
label: (0,external_wp_i18n_namespaceObject.__)('Flex'),
|
| 8707 |
layout = {},
|
| 8708 |
onChange
|
| 8709 |
}) {
|
| 8710 |
+
const {
|
| 8711 |
+
allowOrientation = true
|
| 8712 |
+
} = layout;
|
| 8713 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(FlexLayoutJustifyContentControl, {
|
| 8714 |
layout: layout,
|
| 8715 |
onChange: onChange
|
| 8716 |
+
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, allowOrientation && (0,external_wp_element_namespaceObject.createElement)(OrientationControl, {
|
| 8717 |
+
layout: layout,
|
| 8718 |
+
onChange: onChange
|
| 8719 |
+
}))), (0,external_wp_element_namespaceObject.createElement)(FlexWrapControl, {
|
| 8720 |
+
layout: layout,
|
| 8721 |
+
onChange: onChange
|
| 8722 |
+
}));
|
| 8723 |
},
|
| 8724 |
toolBarControls: function FlexLayoutToolbarControls({
|
| 8725 |
layout = {},
|
| 8743 |
selector,
|
| 8744 |
layout
|
| 8745 |
}) {
|
| 8746 |
+
const {
|
| 8747 |
+
orientation = 'horizontal',
|
| 8748 |
+
setCascadingProperties = false
|
| 8749 |
+
} = layout;
|
| 8750 |
const blockGapSupport = useSetting('spacing.blockGap');
|
| 8751 |
const hasBlockGapStylesSupport = blockGapSupport !== null;
|
| 8752 |
+
const justifyContent = justifyContentMap[layout.justifyContent] || justifyContentMap.left;
|
| 8753 |
+
const flexWrap = flexWrapOptions.includes(layout.flexWrap) ? layout.flexWrap : 'wrap';
|
| 8754 |
+
let rowOrientation = `
|
| 8755 |
+
flex-direction: row;
|
| 8756 |
+
align-items: center;
|
| 8757 |
+
justify-content: ${justifyContent};
|
| 8758 |
+
`;
|
| 8759 |
+
|
| 8760 |
+
if (setCascadingProperties) {
|
| 8761 |
+
// --layout-justification-setting allows children to inherit the value
|
| 8762 |
+
// regardless or row or column direction.
|
| 8763 |
+
rowOrientation += `
|
| 8764 |
+
--layout-justification-setting: ${justifyContent};
|
| 8765 |
+
--layout-direction: row;
|
| 8766 |
+
--layout-wrap: ${flexWrap};
|
| 8767 |
+
--layout-justify: ${justifyContent};
|
| 8768 |
+
--layout-align: center;
|
| 8769 |
+
`;
|
| 8770 |
+
}
|
| 8771 |
+
|
| 8772 |
+
const alignItems = alignItemsMap[layout.justifyContent] || alignItemsMap.left;
|
| 8773 |
+
let columnOrientation = `
|
| 8774 |
+
flex-direction: column;
|
| 8775 |
+
align-items: ${alignItems};
|
| 8776 |
+
`;
|
| 8777 |
+
|
| 8778 |
+
if (setCascadingProperties) {
|
| 8779 |
+
columnOrientation += `
|
| 8780 |
+
--layout-justification-setting: ${alignItems};
|
| 8781 |
+
--layout-direction: column;
|
| 8782 |
+
--layout-justify: initial;
|
| 8783 |
+
--layout-align: ${alignItems};
|
| 8784 |
+
`;
|
| 8785 |
+
}
|
| 8786 |
+
|
| 8787 |
return (0,external_wp_element_namespaceObject.createElement)("style", null, `
|
| 8788 |
${appendSelectors(selector)} {
|
| 8789 |
display: flex;
|
| 8790 |
gap: ${hasBlockGapStylesSupport ? 'var( --wp--style--block-gap, 0.5em )' : '0.5em'};
|
| 8791 |
+
flex-wrap: ${flexWrap};
|
| 8792 |
+
${orientation === 'horizontal' ? rowOrientation : columnOrientation}
|
|
|
|
|
|
|
| 8793 |
}
|
| 8794 |
|
| 8795 |
${appendSelectors(selector, '> *')} {
|
| 8798 |
`);
|
| 8799 |
},
|
| 8800 |
|
| 8801 |
+
getOrientation(layout) {
|
| 8802 |
+
const {
|
| 8803 |
+
orientation = 'horizontal'
|
| 8804 |
+
} = layout;
|
| 8805 |
+
return orientation;
|
| 8806 |
},
|
| 8807 |
|
| 8808 |
getAlignments() {
|
| 8810 |
}
|
| 8811 |
|
| 8812 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8813 |
|
| 8814 |
function FlexLayoutJustifyContentControl({
|
| 8815 |
layout,
|
| 8817 |
isToolbar = false
|
| 8818 |
}) {
|
| 8819 |
const {
|
| 8820 |
+
justifyContent = 'left',
|
| 8821 |
+
orientation = 'horizontal'
|
| 8822 |
} = layout;
|
| 8823 |
|
| 8824 |
const onJustificationChange = value => {
|
| 8827 |
});
|
| 8828 |
};
|
| 8829 |
|
| 8830 |
+
const allowedControls = ['left', 'center', 'right'];
|
| 8831 |
+
|
| 8832 |
+
if (orientation === 'horizontal') {
|
| 8833 |
+
allowedControls.push('space-between');
|
| 8834 |
+
}
|
| 8835 |
+
|
| 8836 |
if (isToolbar) {
|
| 8837 |
return (0,external_wp_element_namespaceObject.createElement)(JustifyContentControl, {
|
| 8838 |
+
allowedControls: allowedControls,
|
| 8839 |
value: justifyContent,
|
| 8840 |
onChange: onJustificationChange,
|
| 8841 |
popoverProps: {
|
| 8845 |
});
|
| 8846 |
}
|
| 8847 |
|
| 8848 |
+
const justificationOptions = [{
|
| 8849 |
+
value: 'left',
|
| 8850 |
+
icon: justify_left,
|
| 8851 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Justify items left')
|
| 8852 |
+
}, {
|
| 8853 |
+
value: 'center',
|
| 8854 |
+
icon: justify_center,
|
| 8855 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Justify items center')
|
| 8856 |
+
}, {
|
| 8857 |
+
value: 'right',
|
| 8858 |
+
icon: justify_right,
|
| 8859 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Justify items right')
|
| 8860 |
+
}];
|
| 8861 |
+
|
| 8862 |
+
if (orientation === 'horizontal') {
|
| 8863 |
+
justificationOptions.push({
|
| 8864 |
+
value: 'space-between',
|
| 8865 |
+
icon: justify_space_between,
|
| 8866 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Space between items')
|
| 8867 |
+
});
|
| 8868 |
+
}
|
| 8869 |
+
|
| 8870 |
return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
|
| 8871 |
className: "block-editor-hooks__flex-layout-justification-controls"
|
| 8872 |
}, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Justification')), (0,external_wp_element_namespaceObject.createElement)("div", null, justificationOptions.map(({
|
| 8883 |
});
|
| 8884 |
})));
|
| 8885 |
}
|
| 8886 |
+
|
| 8887 |
+
function FlexWrapControl({
|
| 8888 |
+
layout,
|
| 8889 |
+
onChange
|
| 8890 |
+
}) {
|
| 8891 |
+
const {
|
| 8892 |
+
flexWrap = 'wrap'
|
| 8893 |
+
} = layout;
|
| 8894 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
|
| 8895 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Allow to wrap to multiple lines'),
|
| 8896 |
+
onChange: value => {
|
| 8897 |
+
onChange({ ...layout,
|
| 8898 |
+
flexWrap: value ? 'wrap' : 'nowrap'
|
| 8899 |
+
});
|
| 8900 |
+
},
|
| 8901 |
+
checked: flexWrap === 'wrap'
|
| 8902 |
+
});
|
| 8903 |
+
}
|
| 8904 |
+
|
| 8905 |
+
function OrientationControl({
|
| 8906 |
+
layout,
|
| 8907 |
+
onChange
|
| 8908 |
+
}) {
|
| 8909 |
+
const {
|
| 8910 |
+
orientation = 'horizontal'
|
| 8911 |
+
} = layout;
|
| 8912 |
+
return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
|
| 8913 |
+
className: "block-editor-hooks__flex-layout-orientation-controls"
|
| 8914 |
+
}, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Orientation')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
| 8915 |
+
label: 'horizontal',
|
| 8916 |
+
icon: arrow_right,
|
| 8917 |
+
isPressed: orientation === 'horizontal',
|
| 8918 |
+
onClick: () => onChange({ ...layout,
|
| 8919 |
+
orientation: 'horizontal'
|
| 8920 |
+
})
|
| 8921 |
+
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
| 8922 |
+
label: 'vertical',
|
| 8923 |
+
icon: arrow_down,
|
| 8924 |
+
isPressed: orientation === 'vertical',
|
| 8925 |
+
onClick: () => onChange({ ...layout,
|
| 8926 |
+
orientation: 'vertical'
|
| 8927 |
+
})
|
| 8928 |
+
}));
|
| 8929 |
+
}
|
| 8930 |
//# sourceMappingURL=flex.js.map
|
| 8931 |
;// CONCATENATED MODULE: ./packages/icons/build-module/icon/index.js
|
| 8932 |
/**
|
| 9733 |
const InspectorControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControls');
|
| 9734 |
const InspectorControlsAdvanced = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorAdvancedControls');
|
| 9735 |
const InspectorControlsDimensions = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsDimensions');
|
| 9736 |
+
const InspectorControlsTypography = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsTypography');
|
| 9737 |
const groups_groups = {
|
| 9738 |
default: InspectorControlsDefault,
|
| 9739 |
advanced: InspectorControlsAdvanced,
|
| 9740 |
+
dimensions: InspectorControlsDimensions,
|
| 9741 |
+
typography: InspectorControlsTypography
|
| 9742 |
};
|
| 9743 |
/* harmony default export */ var inspector_controls_groups = (groups_groups);
|
| 9744 |
//# sourceMappingURL=groups.js.map
|
| 15934 |
const startParents = getBlockParents(blockSelectionStart);
|
| 15935 |
|
| 15936 |
if (blockSelectionStart && blockSelectionStart !== clientId && !(startParents !== null && startParents !== void 0 && startParents.includes(clientId))) {
|
|
|
|
| 15937 |
const startPath = [...startParents, blockSelectionStart];
|
| 15938 |
const endPath = [...getBlockParents(clientId), clientId];
|
| 15939 |
const depth = Math.min(startPath.length, endPath.length) - 1;
|
| 15940 |
+
const start = startPath[depth];
|
| 15941 |
+
const end = endPath[depth]; // Handle the case of having selected a parent block and
|
| 15942 |
+
// then sfift+click on a child.
|
| 15943 |
+
|
| 15944 |
+
if (start !== end) {
|
| 15945 |
+
toggleRichText(node, false);
|
| 15946 |
+
multiSelect(start, end);
|
| 15947 |
+
event.preventDefault();
|
| 15948 |
+
}
|
| 15949 |
}
|
| 15950 |
} else if (hasMultiSelection()) {
|
| 15951 |
// Allow user to escape out of a multi-selection to a
|
| 16516 |
|
| 16517 |
|
| 16518 |
|
| 16519 |
+
|
| 16520 |
+
|
| 16521 |
function BlockIcon({
|
| 16522 |
icon,
|
| 16523 |
showColors = false,
|
| 16545 |
})
|
| 16546 |
}, renderedIcon);
|
| 16547 |
}
|
| 16548 |
+
|
| 16549 |
+
/* harmony default export */ var block_icon = ((0,external_wp_element_namespaceObject.memo)(BlockIcon));
|
| 16550 |
//# sourceMappingURL=index.js.map
|
| 16551 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-card/index.js
|
| 16552 |
|
| 16581 |
|
| 16582 |
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 16583 |
className: "block-editor-block-card"
|
| 16584 |
+
}, (0,external_wp_element_namespaceObject.createElement)(block_icon, {
|
| 16585 |
icon: icon,
|
| 16586 |
showColors: true
|
| 16587 |
}), (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 19792 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
|
| 19793 |
justify: "center",
|
| 19794 |
className: "block-editor-block-draggable-chip__content"
|
| 19795 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, icon ? (0,external_wp_element_namespaceObject.createElement)(block_icon, {
|
| 19796 |
icon: icon
|
| 19797 |
}) : (0,external_wp_i18n_namespaceObject.sprintf)(
|
| 19798 |
/* translators: %d: Number of blocks. */
|
| 19799 |
+
(0,external_wp_i18n_namespaceObject._n)('%d block', '%d blocks', count), count)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(block_icon, {
|
| 19800 |
icon: drag_handle
|
| 19801 |
})))));
|
| 19802 |
}
|
| 19964 |
}, props), (0,external_wp_element_namespaceObject.createElement)("span", {
|
| 19965 |
className: "block-editor-block-types-list__item-icon",
|
| 19966 |
style: itemIconStyle
|
| 19967 |
+
}, (0,external_wp_element_namespaceObject.createElement)(block_icon, {
|
| 19968 |
icon: item.icon,
|
| 19969 |
showColors: true
|
| 19970 |
})), (0,external_wp_element_namespaceObject.createElement)("span", {
|
| 20341 |
|
| 20342 |
|
| 20343 |
|
| 20344 |
+
|
| 20345 |
function PatternInserterPanel({
|
| 20346 |
selectedCategory,
|
| 20347 |
patternCategories,
|
| 20348 |
onClickCategory,
|
| 20349 |
+
openPatternExplorer
|
| 20350 |
}) {
|
| 20351 |
+
const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
|
| 20352 |
+
|
| 20353 |
const categoryOptions = () => {
|
| 20354 |
const options = [];
|
| 20355 |
patternCategories.map(patternCategory => {
|
| 20365 |
onClickCategory(patternCategories.find(patternCategory => selected === patternCategory.name));
|
| 20366 |
};
|
| 20367 |
|
| 20368 |
+
const className = classnames_default()('block-editor-inserter__panel-header', 'block-editor-inserter__panel-header-patterns'); // In iOS-based mobile devices, the onBlur will fire when selecting an option
|
|
|
|
|
|
|
| 20369 |
// from a Select element. To prevent closing the useDialog on iOS devices, we
|
| 20370 |
// stop propagating the onBlur event if there is no relatedTarget, which means
|
| 20371 |
// that the user most likely did not click on an element within the editor canvas.
|
| 20372 |
|
|
|
|
| 20373 |
const onBlur = event => {
|
| 20374 |
if (!(event !== null && event !== void 0 && event.relatedTarget)) {
|
| 20375 |
event.stopPropagation();
|
| 20376 |
}
|
| 20377 |
};
|
| 20378 |
|
| 20379 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
|
| 20380 |
+
justify: "space-between",
|
| 20381 |
+
align: "start",
|
| 20382 |
+
gap: "4",
|
| 20383 |
+
className: className
|
| 20384 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
|
| 20385 |
+
isBlock: true
|
| 20386 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
|
| 20387 |
className: "block-editor-inserter__panel-dropdown",
|
| 20388 |
label: (0,external_wp_i18n_namespaceObject.__)('Filter patterns'),
|
| 20391 |
onChange: onChangeSelect,
|
| 20392 |
onBlur: onBlur,
|
| 20393 |
options: categoryOptions()
|
| 20394 |
+
})), !isMobile && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
| 20395 |
+
variant: "secondary",
|
| 20396 |
+
className: "block-editor-inserter__patterns-explorer-expand",
|
| 20397 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Explore all patterns'),
|
| 20398 |
+
onClick: () => openPatternExplorer()
|
| 20399 |
+
}, (0,external_wp_i18n_namespaceObject._x)('Explore', 'Label for showing all block patterns'))));
|
| 20400 |
}
|
| 20401 |
|
| 20402 |
/* harmony default export */ var pattern_panel = (PatternInserterPanel);
|
| 20471 |
|
| 20472 |
|
| 20473 |
|
|
|
|
| 20474 |
/**
|
| 20475 |
* Internal dependencies
|
| 20476 |
*/
|
| 20478 |
|
| 20479 |
|
| 20480 |
|
|
|
|
| 20481 |
function BlockPattern({
|
| 20482 |
isDraggable,
|
| 20483 |
pattern,
|
| 20485 |
composite
|
| 20486 |
}) {
|
| 20487 |
const {
|
| 20488 |
+
blocks,
|
| 20489 |
viewportWidth
|
| 20490 |
} = pattern;
|
|
|
|
|
|
|
|
|
|
| 20491 |
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPattern);
|
| 20492 |
const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`;
|
| 20493 |
return (0,external_wp_element_namespaceObject.createElement)(inserter_draggable_blocks, {
|
| 20557 |
|
| 20558 |
/* harmony default export */ var block_patterns_list = (BlockPatternList);
|
| 20559 |
//# sourceMappingURL=index.js.map
|
| 20560 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/block-patterns-explorer/sidebar.js
|
| 20561 |
|
| 20562 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20563 |
/**
|
| 20564 |
* WordPress dependencies
|
| 20565 |
*/
|
| 20566 |
|
| 20567 |
|
| 20568 |
|
| 20569 |
+
function PatternCategoriesList({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20570 |
selectedCategory,
|
| 20571 |
+
patternCategories,
|
| 20572 |
onClickCategory
|
| 20573 |
}) {
|
| 20574 |
+
const baseClassName = 'block-editor-block-patterns-explorer__sidebar';
|
| 20575 |
+
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 20576 |
+
className: `${baseClassName}__categories-list`
|
| 20577 |
+
}, patternCategories.map(({
|
| 20578 |
+
name,
|
| 20579 |
+
label
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20580 |
}) => {
|
| 20581 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
| 20582 |
+
key: name,
|
| 20583 |
+
label: label,
|
| 20584 |
+
className: `${baseClassName}__categories-list__item`,
|
| 20585 |
+
isPressed: selectedCategory === name,
|
| 20586 |
+
onClick: () => {
|
| 20587 |
+
onClickCategory(name);
|
| 20588 |
+
}
|
| 20589 |
+
}, label);
|
| 20590 |
+
}));
|
| 20591 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20592 |
|
| 20593 |
+
function PatternsExplorerSearch({
|
| 20594 |
+
filterValue,
|
| 20595 |
+
setFilterValue
|
| 20596 |
+
}) {
|
| 20597 |
+
const baseClassName = 'block-editor-block-patterns-explorer__search';
|
| 20598 |
+
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 20599 |
+
className: baseClassName
|
| 20600 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
|
| 20601 |
+
onChange: setFilterValue,
|
| 20602 |
+
value: filterValue,
|
| 20603 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Search for patterns'),
|
| 20604 |
+
placeholder: (0,external_wp_i18n_namespaceObject.__)('Search')
|
| 20605 |
+
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20606 |
}
|
| 20607 |
|
| 20608 |
+
function PatternExplorerSidebar({
|
| 20609 |
+
selectedCategory,
|
| 20610 |
+
patternCategories,
|
| 20611 |
onClickCategory,
|
| 20612 |
+
filterValue,
|
| 20613 |
+
setFilterValue
|
| 20614 |
}) {
|
| 20615 |
+
const baseClassName = 'block-editor-block-patterns-explorer__sidebar';
|
| 20616 |
+
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 20617 |
+
className: baseClassName
|
| 20618 |
+
}, (0,external_wp_element_namespaceObject.createElement)(PatternsExplorerSearch, {
|
| 20619 |
+
filterValue: filterValue,
|
| 20620 |
+
setFilterValue: setFilterValue
|
| 20621 |
+
}), !filterValue && (0,external_wp_element_namespaceObject.createElement)(PatternCategoriesList, {
|
| 20622 |
selectedCategory: selectedCategory,
|
| 20623 |
+
patternCategories: patternCategories,
|
| 20624 |
onClickCategory: onClickCategory
|
| 20625 |
+
}));
|
| 20626 |
}
|
| 20627 |
|
| 20628 |
+
/* harmony default export */ var sidebar = (PatternExplorerSidebar);
|
| 20629 |
+
//# sourceMappingURL=sidebar.js.map
|
|
|
|
|
|
|
| 20630 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/no-results.js
|
| 20631 |
|
| 20632 |
|
| 20647 |
|
| 20648 |
/* harmony default export */ var no_results = (InserterNoResults);
|
| 20649 |
//# sourceMappingURL=no-results.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20650 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/hooks/use-insertion-point.js
|
| 20651 |
/**
|
| 20652 |
* External dependencies
|
| 20924 |
return rank;
|
| 20925 |
}
|
| 20926 |
//# sourceMappingURL=search-items.js.map
|
| 20927 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/block-patterns-explorer/patterns-list.js
|
| 20928 |
+
|
| 20929 |
+
|
| 20930 |
+
/**
|
| 20931 |
+
* WordPress dependencies
|
| 20932 |
+
*/
|
| 20933 |
+
|
| 20934 |
+
|
| 20935 |
+
|
| 20936 |
+
|
| 20937 |
+
|
| 20938 |
+
/**
|
| 20939 |
+
* Internal dependencies
|
| 20940 |
+
*/
|
| 20941 |
+
|
| 20942 |
+
|
| 20943 |
+
|
| 20944 |
+
|
| 20945 |
+
|
| 20946 |
+
|
| 20947 |
+
|
| 20948 |
+
const INITIAL_INSERTER_RESULTS = 2;
|
| 20949 |
+
|
| 20950 |
+
function PatternsListHeader({
|
| 20951 |
+
filterValue,
|
| 20952 |
+
filteredBlockPatternsLength
|
| 20953 |
+
}) {
|
| 20954 |
+
if (!filterValue) {
|
| 20955 |
+
return null;
|
| 20956 |
+
}
|
| 20957 |
+
|
| 20958 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
|
| 20959 |
+
level: 2,
|
| 20960 |
+
lineHeight: '48px',
|
| 20961 |
+
className: "block-editor-block-patterns-explorer__search-results-count"
|
| 20962 |
+
}, (0,external_wp_i18n_namespaceObject.sprintf)(
|
| 20963 |
+
/* translators: %d: number of patterns. %s: block pattern search query */
|
| 20964 |
+
(0,external_wp_i18n_namespaceObject._n)('%1$d pattern found for "%2$s"', '%1$d patterns found for "%2$s"', filteredBlockPatternsLength), filteredBlockPatternsLength, filterValue));
|
| 20965 |
+
}
|
| 20966 |
+
|
| 20967 |
+
function PatternList({
|
| 20968 |
+
filterValue,
|
| 20969 |
+
selectedCategory,
|
| 20970 |
+
patternCategories
|
| 20971 |
+
}) {
|
| 20972 |
+
const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
|
| 20973 |
+
const [destinationRootClientId, onInsertBlocks] = use_insertion_point({
|
| 20974 |
+
shouldFocusBlock: true
|
| 20975 |
+
});
|
| 20976 |
+
const [allPatterns,, onSelectBlockPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId);
|
| 20977 |
+
const registeredPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => patternCategories.map(patternCategory => patternCategory.name), [patternCategories]);
|
| 20978 |
+
const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
| 20979 |
+
if (!filterValue) {
|
| 20980 |
+
return allPatterns.filter(pattern => {
|
| 20981 |
+
var _pattern$categories, _pattern$categories2;
|
| 20982 |
+
|
| 20983 |
+
return selectedCategory === 'uncategorized' ? !((_pattern$categories = pattern.categories) !== null && _pattern$categories !== void 0 && _pattern$categories.length) || pattern.categories.every(category => !registeredPatternCategories.includes(category)) : (_pattern$categories2 = pattern.categories) === null || _pattern$categories2 === void 0 ? void 0 : _pattern$categories2.includes(selectedCategory);
|
| 20984 |
+
});
|
| 20985 |
+
}
|
| 20986 |
+
|
| 20987 |
+
return searchItems(allPatterns, filterValue);
|
| 20988 |
+
}, [filterValue, selectedCategory, allPatterns]); // Announce search results on change.
|
| 20989 |
+
|
| 20990 |
+
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
| 20991 |
+
if (!filterValue) {
|
| 20992 |
+
return;
|
| 20993 |
+
}
|
| 20994 |
+
|
| 20995 |
+
const count = filteredBlockPatterns.length;
|
| 20996 |
+
const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
|
| 20997 |
+
/* translators: %d: number of results. */
|
| 20998 |
+
(0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count);
|
| 20999 |
+
debouncedSpeak(resultsFoundMessage);
|
| 21000 |
+
}, [filterValue, debouncedSpeak]);
|
| 21001 |
+
const currentShownPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockPatterns, {
|
| 21002 |
+
step: INITIAL_INSERTER_RESULTS
|
| 21003 |
+
});
|
| 21004 |
+
const hasItems = !!(filteredBlockPatterns !== null && filteredBlockPatterns !== void 0 && filteredBlockPatterns.length);
|
| 21005 |
+
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 21006 |
+
className: "block-editor-block-patterns-explorer__list"
|
| 21007 |
+
}, hasItems && (0,external_wp_element_namespaceObject.createElement)(PatternsListHeader, {
|
| 21008 |
+
filterValue: filterValue,
|
| 21009 |
+
filteredBlockPatternsLength: filteredBlockPatterns.length
|
| 21010 |
+
}), (0,external_wp_element_namespaceObject.createElement)(inserter_listbox, null, !hasItems && (0,external_wp_element_namespaceObject.createElement)(no_results, null), hasItems && (0,external_wp_element_namespaceObject.createElement)(block_patterns_list, {
|
| 21011 |
+
shownPatterns: currentShownPatterns,
|
| 21012 |
+
blockPatterns: filteredBlockPatterns,
|
| 21013 |
+
onClickPattern: onSelectBlockPattern,
|
| 21014 |
+
isDraggable: false
|
| 21015 |
+
})));
|
| 21016 |
+
}
|
| 21017 |
+
|
| 21018 |
+
/* harmony default export */ var patterns_list = (PatternList);
|
| 21019 |
+
//# sourceMappingURL=patterns-list.js.map
|
| 21020 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/block-patterns-explorer/explorer.js
|
| 21021 |
+
|
| 21022 |
+
|
| 21023 |
+
/**
|
| 21024 |
+
* WordPress dependencies
|
| 21025 |
+
*/
|
| 21026 |
+
|
| 21027 |
+
|
| 21028 |
+
|
| 21029 |
+
/**
|
| 21030 |
+
* Internal dependencies
|
| 21031 |
+
*/
|
| 21032 |
+
|
| 21033 |
+
|
| 21034 |
+
|
| 21035 |
+
|
| 21036 |
+
function PatternsExplorer({
|
| 21037 |
+
initialCategory,
|
| 21038 |
+
patternCategories
|
| 21039 |
+
}) {
|
| 21040 |
+
const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
|
| 21041 |
+
const [selectedCategory, setSelectedCategory] = (0,external_wp_element_namespaceObject.useState)(initialCategory === null || initialCategory === void 0 ? void 0 : initialCategory.name);
|
| 21042 |
+
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 21043 |
+
className: "block-editor-block-patterns-explorer"
|
| 21044 |
+
}, (0,external_wp_element_namespaceObject.createElement)(sidebar, {
|
| 21045 |
+
selectedCategory: selectedCategory,
|
| 21046 |
+
patternCategories: patternCategories,
|
| 21047 |
+
onClickCategory: setSelectedCategory,
|
| 21048 |
+
filterValue: filterValue,
|
| 21049 |
+
setFilterValue: setFilterValue
|
| 21050 |
+
}), (0,external_wp_element_namespaceObject.createElement)(patterns_list, {
|
| 21051 |
+
filterValue: filterValue,
|
| 21052 |
+
selectedCategory: selectedCategory,
|
| 21053 |
+
patternCategories: patternCategories
|
| 21054 |
+
}));
|
| 21055 |
+
}
|
| 21056 |
+
|
| 21057 |
+
function PatternsExplorerModal({
|
| 21058 |
+
onModalClose,
|
| 21059 |
+
...restProps
|
| 21060 |
+
}) {
|
| 21061 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
|
| 21062 |
+
title: (0,external_wp_i18n_namespaceObject.__)('Patterns'),
|
| 21063 |
+
closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
|
| 21064 |
+
onRequestClose: onModalClose,
|
| 21065 |
+
isFullScreen: true
|
| 21066 |
+
}, (0,external_wp_element_namespaceObject.createElement)(PatternsExplorer, restProps));
|
| 21067 |
+
}
|
| 21068 |
+
|
| 21069 |
+
/* harmony default export */ var explorer = (PatternsExplorerModal);
|
| 21070 |
+
//# sourceMappingURL=explorer.js.map
|
| 21071 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/block-patterns-tab.js
|
| 21072 |
+
|
| 21073 |
+
|
| 21074 |
+
/**
|
| 21075 |
+
* WordPress dependencies
|
| 21076 |
+
*/
|
| 21077 |
+
|
| 21078 |
+
|
| 21079 |
+
|
| 21080 |
+
/**
|
| 21081 |
+
* Internal dependencies
|
| 21082 |
+
*/
|
| 21083 |
+
|
| 21084 |
+
|
| 21085 |
+
|
| 21086 |
+
|
| 21087 |
+
|
| 21088 |
+
|
| 21089 |
+
function BlockPatternsCategory({
|
| 21090 |
+
rootClientId,
|
| 21091 |
+
onInsert,
|
| 21092 |
+
selectedCategory,
|
| 21093 |
+
populatedCategories
|
| 21094 |
+
}) {
|
| 21095 |
+
const [allPatterns,, onClick] = use_patterns_state(onInsert, rootClientId);
|
| 21096 |
+
const getPatternIndex = (0,external_wp_element_namespaceObject.useCallback)(pattern => {
|
| 21097 |
+
var _pattern$categories;
|
| 21098 |
+
|
| 21099 |
+
if (!((_pattern$categories = pattern.categories) !== null && _pattern$categories !== void 0 && _pattern$categories.length)) {
|
| 21100 |
+
return Infinity;
|
| 21101 |
+
}
|
| 21102 |
+
|
| 21103 |
+
const indexedCategories = populatedCategories.reduce((accumulator, {
|
| 21104 |
+
name
|
| 21105 |
+
}, index) => {
|
| 21106 |
+
accumulator[name] = index;
|
| 21107 |
+
return accumulator;
|
| 21108 |
+
}, {});
|
| 21109 |
+
return Math.min(...pattern.categories.map(cat => indexedCategories[cat] !== undefined ? indexedCategories[cat] : Infinity));
|
| 21110 |
+
}, [populatedCategories]);
|
| 21111 |
+
const currentCategoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => allPatterns.filter(pattern => {
|
| 21112 |
+
var _pattern$categories2;
|
| 21113 |
+
|
| 21114 |
+
return selectedCategory.name === 'uncategorized' ? getPatternIndex(pattern) === Infinity : (_pattern$categories2 = pattern.categories) === null || _pattern$categories2 === void 0 ? void 0 : _pattern$categories2.includes(selectedCategory.name);
|
| 21115 |
+
}), [allPatterns, selectedCategory]); // Ordering the patterns is important for the async rendering.
|
| 21116 |
+
|
| 21117 |
+
const orderedPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
| 21118 |
+
return currentCategoryPatterns.sort((a, b) => {
|
| 21119 |
+
return getPatternIndex(a) - getPatternIndex(b);
|
| 21120 |
+
});
|
| 21121 |
+
}, [currentCategoryPatterns, getPatternIndex]);
|
| 21122 |
+
const currentShownPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(orderedPatterns);
|
| 21123 |
+
|
| 21124 |
+
if (!currentCategoryPatterns.length) {
|
| 21125 |
+
return null;
|
| 21126 |
+
}
|
| 21127 |
+
|
| 21128 |
+
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 21129 |
+
className: "block-editor-inserter__panel-content"
|
| 21130 |
+
}, (0,external_wp_element_namespaceObject.createElement)(block_patterns_list, {
|
| 21131 |
+
shownPatterns: currentShownPatterns,
|
| 21132 |
+
blockPatterns: currentCategoryPatterns,
|
| 21133 |
+
onClickPattern: onClick,
|
| 21134 |
+
label: selectedCategory.label,
|
| 21135 |
+
orientation: "vertical",
|
| 21136 |
+
isDraggable: true
|
| 21137 |
+
}));
|
| 21138 |
+
}
|
| 21139 |
+
|
| 21140 |
+
function BlockPatternsTabs({
|
| 21141 |
+
rootClientId,
|
| 21142 |
+
onInsert,
|
| 21143 |
+
onClickCategory,
|
| 21144 |
+
selectedCategory
|
| 21145 |
+
}) {
|
| 21146 |
+
const [showPatternsExplorer, setShowPatternsExplorer] = (0,external_wp_element_namespaceObject.useState)(false);
|
| 21147 |
+
const [allPatterns, allCategories] = use_patterns_state();
|
| 21148 |
+
const hasRegisteredCategory = (0,external_wp_element_namespaceObject.useCallback)(pattern => {
|
| 21149 |
+
if (!pattern.categories || !pattern.categories.length) {
|
| 21150 |
+
return false;
|
| 21151 |
+
}
|
| 21152 |
+
|
| 21153 |
+
return pattern.categories.some(cat => allCategories.some(category => category.name === cat));
|
| 21154 |
+
}, [allCategories]); // Remove any empty categories
|
| 21155 |
+
|
| 21156 |
+
const populatedCategories = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
| 21157 |
+
const categories = allCategories.filter(category => allPatterns.some(pattern => {
|
| 21158 |
+
var _pattern$categories3;
|
| 21159 |
+
|
| 21160 |
+
return (_pattern$categories3 = pattern.categories) === null || _pattern$categories3 === void 0 ? void 0 : _pattern$categories3.includes(category.name);
|
| 21161 |
+
})).sort(({
|
| 21162 |
+
name: currentName
|
| 21163 |
+
}, {
|
| 21164 |
+
name: nextName
|
| 21165 |
+
}) => {
|
| 21166 |
+
if (![currentName, nextName].includes('featured')) {
|
| 21167 |
+
return 0;
|
| 21168 |
+
}
|
| 21169 |
+
|
| 21170 |
+
return currentName === 'featured' ? -1 : 1;
|
| 21171 |
+
});
|
| 21172 |
+
|
| 21173 |
+
if (allPatterns.some(pattern => !hasRegisteredCategory(pattern)) && !categories.find(category => category.name === 'uncategorized')) {
|
| 21174 |
+
categories.push({
|
| 21175 |
+
name: 'uncategorized',
|
| 21176 |
+
label: (0,external_wp_i18n_namespaceObject._x)('Uncategorized')
|
| 21177 |
+
});
|
| 21178 |
+
}
|
| 21179 |
+
|
| 21180 |
+
return categories;
|
| 21181 |
+
}, [allPatterns, allCategories]);
|
| 21182 |
+
const patternCategory = selectedCategory ? selectedCategory : populatedCategories[0];
|
| 21183 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !showPatternsExplorer && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(pattern_panel, {
|
| 21184 |
+
selectedCategory: patternCategory,
|
| 21185 |
+
patternCategories: populatedCategories,
|
| 21186 |
+
onClickCategory: onClickCategory,
|
| 21187 |
+
openPatternExplorer: () => setShowPatternsExplorer(true)
|
| 21188 |
+
}), (0,external_wp_element_namespaceObject.createElement)(BlockPatternsCategory, {
|
| 21189 |
+
rootClientId: rootClientId,
|
| 21190 |
+
onInsert: onInsert,
|
| 21191 |
+
selectedCategory: patternCategory,
|
| 21192 |
+
populatedCategories: populatedCategories
|
| 21193 |
+
})), showPatternsExplorer && (0,external_wp_element_namespaceObject.createElement)(explorer, {
|
| 21194 |
+
initialCategory: patternCategory,
|
| 21195 |
+
patternCategories: populatedCategories,
|
| 21196 |
+
onModalClose: () => setShowPatternsExplorer(false)
|
| 21197 |
+
}));
|
| 21198 |
+
}
|
| 21199 |
+
|
| 21200 |
+
/* harmony default export */ var block_patterns_tab = (BlockPatternsTabs);
|
| 21201 |
+
//# sourceMappingURL=block-patterns-tab.js.map
|
| 21202 |
+
;// CONCATENATED MODULE: external ["wp","url"]
|
| 21203 |
+
var external_wp_url_namespaceObject = window["wp"]["url"];
|
| 21204 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/reusable-blocks-tab.js
|
| 21205 |
+
|
| 21206 |
+
|
| 21207 |
+
/**
|
| 21208 |
+
* WordPress dependencies
|
| 21209 |
+
*/
|
| 21210 |
+
|
| 21211 |
+
|
| 21212 |
+
|
| 21213 |
+
/**
|
| 21214 |
+
* Internal dependencies
|
| 21215 |
+
*/
|
| 21216 |
+
|
| 21217 |
+
|
| 21218 |
+
|
| 21219 |
+
|
| 21220 |
+
|
| 21221 |
+
|
| 21222 |
+
function ReusableBlocksList({
|
| 21223 |
+
onHover,
|
| 21224 |
+
onInsert,
|
| 21225 |
+
rootClientId
|
| 21226 |
+
}) {
|
| 21227 |
+
const [items,,, onSelectItem] = use_block_types_state(rootClientId, onInsert);
|
| 21228 |
+
const filteredItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
| 21229 |
+
return items.filter(({
|
| 21230 |
+
category
|
| 21231 |
+
}) => category === 'reusable');
|
| 21232 |
+
}, [items]);
|
| 21233 |
+
|
| 21234 |
+
if (filteredItems.length === 0) {
|
| 21235 |
+
return (0,external_wp_element_namespaceObject.createElement)(no_results, null);
|
| 21236 |
+
}
|
| 21237 |
+
|
| 21238 |
+
return (0,external_wp_element_namespaceObject.createElement)(panel, {
|
| 21239 |
+
title: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks')
|
| 21240 |
+
}, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
|
| 21241 |
+
items: filteredItems,
|
| 21242 |
+
onSelect: onSelectItem,
|
| 21243 |
+
onHover: onHover,
|
| 21244 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks')
|
| 21245 |
+
}));
|
| 21246 |
+
} // The unwrapped component is only exported for use by unit tests.
|
| 21247 |
+
|
| 21248 |
+
/**
|
| 21249 |
+
* List of reusable blocks shown in the "Reusable" tab of the inserter.
|
| 21250 |
+
*
|
| 21251 |
+
* @param {Object} props Component props.
|
| 21252 |
+
* @param {?string} props.rootClientId Client id of block to insert into.
|
| 21253 |
+
* @param {Function} props.onInsert Callback to run when item is inserted.
|
| 21254 |
+
* @param {Function} props.onHover Callback to run when item is hovered.
|
| 21255 |
+
*
|
| 21256 |
+
* @return {WPComponent} The component.
|
| 21257 |
+
*/
|
| 21258 |
+
|
| 21259 |
+
|
| 21260 |
+
function ReusableBlocksTab({
|
| 21261 |
+
rootClientId,
|
| 21262 |
+
onInsert,
|
| 21263 |
+
onHover
|
| 21264 |
+
}) {
|
| 21265 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(ReusableBlocksList, {
|
| 21266 |
+
onHover: onHover,
|
| 21267 |
+
onInsert: onInsert,
|
| 21268 |
+
rootClientId: rootClientId
|
| 21269 |
+
}), (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 21270 |
+
className: "block-editor-inserter__manage-reusable-blocks-container"
|
| 21271 |
+
}, (0,external_wp_element_namespaceObject.createElement)("a", {
|
| 21272 |
+
className: "block-editor-inserter__manage-reusable-blocks",
|
| 21273 |
+
href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
|
| 21274 |
+
post_type: 'wp_block'
|
| 21275 |
+
})
|
| 21276 |
+
}, (0,external_wp_i18n_namespaceObject.__)('Manage Reusable blocks'))));
|
| 21277 |
+
}
|
| 21278 |
+
/* harmony default export */ var reusable_blocks_tab = (ReusableBlocksTab);
|
| 21279 |
+
//# sourceMappingURL=reusable-blocks-tab.js.map
|
| 21280 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-menu-extension/index.js
|
| 21281 |
+
/**
|
| 21282 |
+
* WordPress dependencies
|
| 21283 |
+
*/
|
| 21284 |
+
|
| 21285 |
+
const {
|
| 21286 |
+
Fill: __unstableInserterMenuExtension,
|
| 21287 |
+
Slot
|
| 21288 |
+
} = (0,external_wp_components_namespaceObject.createSlotFill)('__unstableInserterMenuExtension');
|
| 21289 |
+
__unstableInserterMenuExtension.Slot = Slot;
|
| 21290 |
+
/* harmony default export */ var inserter_menu_extension = (__unstableInserterMenuExtension);
|
| 21291 |
+
//# sourceMappingURL=index.js.map
|
| 21292 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/search-results.js
|
| 21293 |
|
| 21294 |
|
| 21319 |
|
| 21320 |
|
| 21321 |
|
| 21322 |
+
const search_results_INITIAL_INSERTER_RESULTS = 9;
|
| 21323 |
/**
|
| 21324 |
* Shared reference to an empty array for cases where it is important to avoid
|
| 21325 |
* returning a new array reference on every invocation and rerendering the component.
|
| 21375 |
debouncedSpeak(resultsFoundMessage);
|
| 21376 |
}, [filterValue, debouncedSpeak]);
|
| 21377 |
const currentShownBlockTypes = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockTypes, {
|
| 21378 |
+
step: search_results_INITIAL_INSERTER_RESULTS
|
| 21379 |
});
|
| 21380 |
const currentShownPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(currentShownBlockTypes.length === filteredBlockTypes.length ? filteredBlockPatterns : search_results_EMPTY_ARRAY);
|
| 21381 |
const hasItems = !(0,external_lodash_namespaceObject.isEmpty)(filteredBlockTypes) || !(0,external_lodash_namespaceObject.isEmpty)(filteredBlockPatterns);
|
| 23459 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
|
| 23460 |
justify: "center",
|
| 23461 |
className: "block-editor-block-list__block-selection-button__content"
|
| 23462 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(block_icon, {
|
| 23463 |
icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon,
|
| 23464 |
showColors: true
|
| 23465 |
})), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(block_draggable, {
|
| 24392 |
/* translators: %s: Name of the block's parent. */
|
| 24393 |
(0,external_wp_i18n_namespaceObject.__)('Select %s'), blockInformation.title),
|
| 24394 |
showTooltip: true,
|
| 24395 |
+
icon: (0,external_wp_element_namespaceObject.createElement)(block_icon, {
|
| 24396 |
icon: blockInformation.icon
|
| 24397 |
})
|
| 24398 |
}));
|
| 24493 |
disabled: isDisabled,
|
| 24494 |
onMouseLeave: () => setHoveredTransformItemName(null),
|
| 24495 |
onMouseEnter: () => setHoveredTransformItemName(name)
|
| 24496 |
+
}, (0,external_wp_element_namespaceObject.createElement)(block_icon, {
|
| 24497 |
icon: icon,
|
| 24498 |
showColors: true
|
| 24499 |
}), title);
|
| 25151 |
disabled: true,
|
| 25152 |
className: "block-editor-block-switcher__no-switcher-icon",
|
| 25153 |
title: blockTitle,
|
| 25154 |
+
icon: (0,external_wp_element_namespaceObject.createElement)(block_icon, {
|
| 25155 |
icon: icon,
|
| 25156 |
showColors: true
|
| 25157 |
})
|
| 25173 |
isAlternate: true,
|
| 25174 |
className: 'block-editor-block-switcher__popover'
|
| 25175 |
},
|
| 25176 |
+
icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(block_icon, {
|
| 25177 |
icon: icon,
|
| 25178 |
className: "block-editor-block-switcher__toggle",
|
| 25179 |
showColors: true
|
| 25991 |
const blockClientIds = (0,external_lodash_namespaceObject.castArray)(clientIds);
|
| 25992 |
const count = blockClientIds.length;
|
| 25993 |
const firstBlockClientId = blockClientIds[0];
|
| 25994 |
+
const {
|
| 25995 |
+
onlyBlock,
|
| 25996 |
+
title
|
| 25997 |
+
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
| 25998 |
+
var _getBlockType;
|
| 25999 |
+
|
| 26000 |
+
const {
|
| 26001 |
+
getBlockCount,
|
| 26002 |
+
getBlockName
|
| 26003 |
+
} = select(store);
|
| 26004 |
+
const {
|
| 26005 |
+
getBlockType
|
| 26006 |
+
} = select(external_wp_blocks_namespaceObject.store);
|
| 26007 |
+
return {
|
| 26008 |
+
onlyBlock: 1 === getBlockCount(),
|
| 26009 |
+
title: (_getBlockType = getBlockType(getBlockName(firstBlockClientId))) === null || _getBlockType === void 0 ? void 0 : _getBlockType.title
|
| 26010 |
+
};
|
| 26011 |
+
}, [firstBlockClientId]);
|
| 26012 |
const shortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
| 26013 |
const {
|
| 26014 |
getShortcutRepresentation
|
| 26027 |
__experimentalSelectBlock(ids[0]);
|
| 26028 |
}
|
| 26029 |
} : external_lodash_namespaceObject.noop, [__experimentalSelectBlock]);
|
| 26030 |
+
const label = (0,external_wp_i18n_namespaceObject.sprintf)(
|
| 26031 |
+
/* translators: %s: block name */
|
| 26032 |
+
(0,external_wp_i18n_namespaceObject.__)('Remove %s'), title);
|
| 26033 |
+
const removeBlockLabel = count === 1 ? label : (0,external_wp_i18n_namespaceObject.__)('Remove blocks');
|
| 26034 |
return (0,external_wp_element_namespaceObject.createElement)(BlockActions, {
|
| 26035 |
clientIds: clientIds,
|
| 26036 |
__experimentalUpdateSelection: !__experimentalSelectBlock
|
| 27532 |
clientId: clientId
|
| 27533 |
})) : (0,external_wp_element_namespaceObject.createElement)(BlockListItems, options)
|
| 27534 |
};
|
| 27535 |
+
}
|
| 27536 |
+
useInnerBlocksProps.save = external_wp_blocks_namespaceObject.__unstableGetInnerBlocksProps; // Expose default appender placeholders as components.
|
| 27537 |
|
| 27538 |
ForwardedInnerBlocks.DefaultBlockAppender = inner_blocks_default_block_appender;
|
| 27539 |
ForwardedInnerBlocks.ButtonBlockAppender = inner_blocks_button_block_appender;
|
| 27540 |
+
|
| 27541 |
+
ForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;
|
|
|
|
| 27542 |
/**
|
| 27543 |
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md
|
| 27544 |
*/
|
| 27545 |
|
| 27546 |
+
|
| 27547 |
/* harmony default export */ var inner_blocks = (ForwardedInnerBlocks);
|
| 27548 |
//# sourceMappingURL=index.js.map
|
| 27549 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/index.js
|
| 27694 |
}, (0,external_wp_element_namespaceObject.createElement)(Items, props));
|
| 27695 |
}
|
| 27696 |
//# sourceMappingURL=index.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27697 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors-gradients/control.js
|
| 27698 |
|
| 27699 |
|
| 27715 |
*/
|
| 27716 |
|
| 27717 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27718 |
const colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients'];
|
| 27719 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27720 |
function ColorGradientControlInner({
|
| 27721 |
colors,
|
| 27722 |
gradients,
|
| 27723 |
disableCustomColors,
|
| 27724 |
disableCustomGradients,
|
| 27725 |
+
__experimentalHasMultipleOrigins,
|
| 27726 |
className,
|
| 27727 |
label,
|
| 27728 |
onColorChange,
|
| 27729 |
onGradientChange,
|
| 27730 |
colorValue,
|
| 27731 |
gradientValue,
|
| 27732 |
+
clearable,
|
| 27733 |
+
showTitle = true
|
| 27734 |
}) {
|
| 27735 |
const canChooseAColor = onColorChange && (!(0,external_lodash_namespaceObject.isEmpty)(colors) || !disableCustomColors);
|
| 27736 |
const canChooseAGradient = onGradientChange && (!(0,external_lodash_namespaceObject.isEmpty)(gradients) || !disableCustomGradients);
|
| 27743 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, {
|
| 27744 |
className: classnames_default()('block-editor-color-gradient-control', className)
|
| 27745 |
}, (0,external_wp_element_namespaceObject.createElement)("fieldset", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
|
| 27746 |
+
spacing: 1
|
| 27747 |
+
}, showTitle && (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 27748 |
className: "block-editor-color-gradient-control__color-indicator"
|
| 27749 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, null, label))), canChooseAColor && canChooseAGradient && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27750 |
value: currentTab,
|
| 27751 |
onChange: setCurrentTab,
|
| 27752 |
label: (0,external_wp_i18n_namespaceObject.__)('Select color type'),
|
| 27766 |
} : onColorChange,
|
| 27767 |
colors,
|
| 27768 |
disableCustomColors,
|
| 27769 |
+
__experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
|
| 27770 |
clearable: clearable
|
| 27771 |
}), (currentTab === 'gradient' || !canChooseAColor) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.GradientPicker, {
|
| 27772 |
value: gradientValue,
|
| 27776 |
} : onGradientChange,
|
| 27777 |
gradients,
|
| 27778 |
disableCustomGradients,
|
| 27779 |
+
__experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
|
| 27780 |
clearable: clearable
|
| 27781 |
}))));
|
| 27782 |
}
|
| 27800 |
|
| 27801 |
/* harmony default export */ var control = (ColorGradientControl);
|
| 27802 |
//# sourceMappingURL=control.js.map
|
| 27803 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors/utils.js
|
| 27804 |
+
/**
|
| 27805 |
+
* External dependencies
|
| 27806 |
+
*/
|
| 27807 |
+
|
| 27808 |
+
|
| 27809 |
+
|
| 27810 |
+
|
| 27811 |
+
k([names, a11y]);
|
| 27812 |
+
/**
|
| 27813 |
+
* Provided an array of color objects as set by the theme or by the editor defaults,
|
| 27814 |
+
* and the values of the defined color or custom color returns a color object describing the color.
|
| 27815 |
+
*
|
| 27816 |
+
* @param {Array} colors Array of color objects as set by the theme or by the editor defaults.
|
| 27817 |
+
* @param {?string} definedColor A string containing the color slug.
|
| 27818 |
+
* @param {?string} customColor A string containing the customColor value.
|
| 27819 |
+
*
|
| 27820 |
+
* @return {?Object} If definedColor is passed and the name is found in colors,
|
| 27821 |
+
* the color object exactly as set by the theme or editor defaults is returned.
|
| 27822 |
+
* Otherwise, an object that just sets the color is defined.
|
| 27823 |
+
*/
|
| 27824 |
+
|
| 27825 |
+
const getColorObjectByAttributeValues = (colors, definedColor, customColor) => {
|
| 27826 |
+
if (definedColor) {
|
| 27827 |
+
const colorObj = (0,external_lodash_namespaceObject.find)(colors, {
|
| 27828 |
+
slug: definedColor
|
| 27829 |
+
});
|
| 27830 |
+
|
| 27831 |
+
if (colorObj) {
|
| 27832 |
+
return colorObj;
|
| 27833 |
+
}
|
| 27834 |
+
}
|
| 27835 |
+
|
| 27836 |
+
return {
|
| 27837 |
+
color: customColor
|
| 27838 |
+
};
|
| 27839 |
+
};
|
| 27840 |
+
/**
|
| 27841 |
+
* 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.
|
| 27842 |
+
*
|
| 27843 |
+
* @param {Array} colors Array of color objects as set by the theme or by the editor defaults.
|
| 27844 |
+
* @param {?string} colorValue A string containing the color value.
|
| 27845 |
+
*
|
| 27846 |
+
* @return {?Object} Color object included in the colors array whose color property equals colorValue.
|
| 27847 |
+
* Returns undefined if no color object matches this requirement.
|
| 27848 |
+
*/
|
| 27849 |
+
|
| 27850 |
+
const getColorObjectByColorValue = (colors, colorValue) => {
|
| 27851 |
+
return (0,external_lodash_namespaceObject.find)(colors, {
|
| 27852 |
+
color: colorValue
|
| 27853 |
+
});
|
| 27854 |
+
};
|
| 27855 |
+
/**
|
| 27856 |
+
* Returns a class based on the context a color is being used and its slug.
|
| 27857 |
+
*
|
| 27858 |
+
* @param {string} colorContextName Context/place where color is being used e.g: background, text etc...
|
| 27859 |
+
* @param {string} colorSlug Slug of the color.
|
| 27860 |
+
*
|
| 27861 |
+
* @return {?string} String with the class corresponding to the color in the provided context.
|
| 27862 |
+
* Returns undefined if either colorContextName or colorSlug are not provided.
|
| 27863 |
+
*/
|
| 27864 |
+
|
| 27865 |
+
function getColorClassName(colorContextName, colorSlug) {
|
| 27866 |
+
if (!colorContextName || !colorSlug) {
|
| 27867 |
+
return undefined;
|
| 27868 |
+
}
|
| 27869 |
+
|
| 27870 |
+
return `has-${(0,external_lodash_namespaceObject.kebabCase)(colorSlug)}-${colorContextName}`;
|
| 27871 |
+
}
|
| 27872 |
+
/**
|
| 27873 |
+
* Given an array of color objects and a color value returns the color value of the most readable color in the array.
|
| 27874 |
+
*
|
| 27875 |
+
* @param {Array} colors Array of color objects as set by the theme or by the editor defaults.
|
| 27876 |
+
* @param {?string} colorValue A string containing the color value.
|
| 27877 |
+
*
|
| 27878 |
+
* @return {string} String with the color value of the most readable color.
|
| 27879 |
+
*/
|
| 27880 |
+
|
| 27881 |
+
function getMostReadableColor(colors, colorValue) {
|
| 27882 |
+
const colordColor = w(colorValue);
|
| 27883 |
+
return (0,external_lodash_namespaceObject.maxBy)(colors, ({
|
| 27884 |
+
color
|
| 27885 |
+
}) => colordColor.contrast(color)).color;
|
| 27886 |
+
}
|
| 27887 |
+
//# sourceMappingURL=utils.js.map
|
| 27888 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/border-color.js
|
| 27889 |
|
| 27890 |
|
| 28767 |
function BorderPanel(props) {
|
| 28768 |
const isDisabled = useIsBorderDisabled(props);
|
| 28769 |
const isSupported = hasBorderSupport(props.name);
|
| 28770 |
+
const isColorSupported = useSetting('border.color') && hasBorderSupport(props.name, 'color');
|
| 28771 |
+
const isRadiusSupported = useSetting('border.radius') && hasBorderSupport(props.name, 'radius');
|
| 28772 |
+
const isStyleSupported = useSetting('border.style') && hasBorderSupport(props.name, 'style');
|
| 28773 |
+
const isWidthSupported = useSetting('border.width') && hasBorderSupport(props.name, 'width');
|
| 28774 |
|
| 28775 |
if (isDisabled || !isSupported) {
|
| 28776 |
return null;
|
| 28829 |
*/
|
| 28830 |
|
| 28831 |
const useIsBorderDisabled = () => {
|
| 28832 |
+
const configs = [!useSetting('border.color'), !useSetting('border.radius'), !useSetting('border.style'), !useSetting('border.width')];
|
| 28833 |
return configs.every(Boolean);
|
| 28834 |
};
|
| 28835 |
//# sourceMappingURL=border.js.map
|
| 28836 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/gradients/use-gradient.js
|
| 28837 |
+
/**
|
| 28838 |
+
* External dependencies
|
| 28839 |
+
*/
|
| 28840 |
+
|
| 28841 |
+
/**
|
| 28842 |
+
* WordPress dependencies
|
| 28843 |
+
*/
|
| 28844 |
+
|
| 28845 |
+
|
| 28846 |
+
|
| 28847 |
+
/**
|
| 28848 |
+
* Internal dependencies
|
| 28849 |
+
*/
|
| 28850 |
+
|
| 28851 |
+
|
| 28852 |
+
|
| 28853 |
+
|
| 28854 |
+
const use_gradient_EMPTY_ARRAY = [];
|
| 28855 |
+
function __experimentalGetGradientClass(gradientSlug) {
|
| 28856 |
+
if (!gradientSlug) {
|
| 28857 |
+
return undefined;
|
| 28858 |
+
}
|
| 28859 |
+
|
| 28860 |
+
return `has-${gradientSlug}-gradient-background`;
|
| 28861 |
+
}
|
| 28862 |
+
/**
|
| 28863 |
+
* Retrieves the gradient value per slug.
|
| 28864 |
+
*
|
| 28865 |
+
* @param {Array} gradients Gradient Palette
|
| 28866 |
+
* @param {string} slug Gradient slug
|
| 28867 |
+
*
|
| 28868 |
+
* @return {string} Gradient value.
|
| 28869 |
+
*/
|
| 28870 |
+
|
| 28871 |
+
function getGradientValueBySlug(gradients, slug) {
|
| 28872 |
+
const gradient = (0,external_lodash_namespaceObject.find)(gradients, ['slug', slug]);
|
| 28873 |
+
return gradient && gradient.gradient;
|
| 28874 |
+
}
|
| 28875 |
+
function __experimentalGetGradientObjectByGradientValue(gradients, value) {
|
| 28876 |
+
const gradient = (0,external_lodash_namespaceObject.find)(gradients, ['gradient', value]);
|
| 28877 |
+
return gradient;
|
| 28878 |
+
}
|
| 28879 |
+
/**
|
| 28880 |
+
* Retrieves the gradient slug per slug.
|
| 28881 |
+
*
|
| 28882 |
+
* @param {Array} gradients Gradient Palette
|
| 28883 |
+
* @param {string} value Gradient value
|
| 28884 |
+
* @return {string} Gradient slug.
|
| 28885 |
+
*/
|
| 28886 |
+
|
| 28887 |
+
function getGradientSlugByValue(gradients, value) {
|
| 28888 |
+
const gradient = __experimentalGetGradientObjectByGradientValue(gradients, value);
|
| 28889 |
+
|
| 28890 |
+
return gradient && gradient.slug;
|
| 28891 |
+
}
|
| 28892 |
+
function __experimentalUseGradient({
|
| 28893 |
+
gradientAttribute = 'gradient',
|
| 28894 |
+
customGradientAttribute = 'customGradient'
|
| 28895 |
+
} = {}) {
|
| 28896 |
+
const {
|
| 28897 |
+
clientId
|
| 28898 |
+
} = useBlockEditContext();
|
| 28899 |
+
const gradients = useSetting('color.gradients') || use_gradient_EMPTY_ARRAY;
|
| 28900 |
+
const {
|
| 28901 |
+
gradient,
|
| 28902 |
+
customGradient
|
| 28903 |
+
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
| 28904 |
+
const {
|
| 28905 |
+
getBlockAttributes
|
| 28906 |
+
} = select(store);
|
| 28907 |
+
const attributes = getBlockAttributes(clientId) || {};
|
| 28908 |
+
return {
|
| 28909 |
+
customGradient: attributes[customGradientAttribute],
|
| 28910 |
+
gradient: attributes[gradientAttribute]
|
| 28911 |
+
};
|
| 28912 |
+
}, [clientId, gradientAttribute, customGradientAttribute]);
|
| 28913 |
+
const {
|
| 28914 |
+
updateBlockAttributes
|
| 28915 |
+
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
| 28916 |
+
const setGradient = (0,external_wp_element_namespaceObject.useCallback)(newGradientValue => {
|
| 28917 |
+
const slug = getGradientSlugByValue(gradients, newGradientValue);
|
| 28918 |
+
|
| 28919 |
+
if (slug) {
|
| 28920 |
+
updateBlockAttributes(clientId, {
|
| 28921 |
+
[gradientAttribute]: slug,
|
| 28922 |
+
[customGradientAttribute]: undefined
|
| 28923 |
+
});
|
| 28924 |
+
return;
|
| 28925 |
+
}
|
| 28926 |
+
|
| 28927 |
+
updateBlockAttributes(clientId, {
|
| 28928 |
+
[gradientAttribute]: undefined,
|
| 28929 |
+
[customGradientAttribute]: newGradientValue
|
| 28930 |
+
});
|
| 28931 |
+
}, [gradients, clientId, updateBlockAttributes]);
|
| 28932 |
+
|
| 28933 |
+
const gradientClass = __experimentalGetGradientClass(gradient);
|
| 28934 |
+
|
| 28935 |
+
let gradientValue;
|
| 28936 |
+
|
| 28937 |
+
if (gradient) {
|
| 28938 |
+
gradientValue = getGradientValueBySlug(gradients, gradient);
|
| 28939 |
+
} else {
|
| 28940 |
+
gradientValue = customGradient;
|
| 28941 |
+
}
|
| 28942 |
+
|
| 28943 |
+
return {
|
| 28944 |
+
gradientClass,
|
| 28945 |
+
gradientValue,
|
| 28946 |
+
setGradient
|
| 28947 |
+
};
|
| 28948 |
+
}
|
| 28949 |
+
//# sourceMappingURL=use-gradient.js.map
|
| 28950 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js
|
| 28951 |
|
| 28952 |
|
| 28962 |
|
| 28963 |
|
| 28964 |
|
| 28965 |
+
|
| 28966 |
/**
|
| 28967 |
* Internal dependencies
|
| 28968 |
*/
|
| 28972 |
|
| 28973 |
// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)
|
| 28974 |
|
| 28975 |
+
const colorIndicatorAriaLabel = (0,external_wp_i18n_namespaceObject.__)('(%s: color %s)'); // translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)
|
| 28976 |
|
| 28977 |
|
| 28978 |
+
const gradientIndicatorAriaLabel = (0,external_wp_i18n_namespaceObject.__)('(%s: gradient %s)');
|
| 28979 |
|
| 28980 |
const panel_color_gradient_settings_colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients'];
|
| 28981 |
|
| 28999 |
|
| 29000 |
if (colorValue) {
|
| 29001 |
const colorObject = getColorObjectByColorValue(availableColors || colors, colorValue);
|
| 29002 |
+
ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(colorIndicatorAriaLabel, label.toLowerCase(), colorObject && colorObject.name || colorValue);
|
| 29003 |
} else {
|
| 29004 |
const gradientObject = __experimentalGetGradientObjectByGradientValue(availableGradients || gradients, colorValue);
|
| 29005 |
|
| 29006 |
+
ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(gradientIndicatorAriaLabel, label.toLowerCase(), gradientObject && gradientObject.name || gradientValue);
|
| 29007 |
}
|
| 29008 |
|
| 29009 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
|
| 29024 |
settings,
|
| 29025 |
title,
|
| 29026 |
showTitle = true,
|
| 29027 |
+
__experimentalHasMultipleOrigins,
|
| 29028 |
...props
|
| 29029 |
}) => {
|
| 29030 |
if ((0,external_lodash_namespaceObject.isEmpty)(colors) && (0,external_lodash_namespaceObject.isEmpty)(gradients) && disableCustomColors && disableCustomGradients && (0,external_lodash_namespaceObject.every)(settings, setting => (0,external_lodash_namespaceObject.isEmpty)(setting.colors) && (0,external_lodash_namespaceObject.isEmpty)(setting.gradients) && (setting.disableCustomColors === undefined || setting.disableCustomColors) && (setting.disableCustomGradients === undefined || setting.disableCustomGradients))) {
|
| 29042 |
className: classnames_default()('block-editor-panel-color-gradient-settings', className),
|
| 29043 |
title: showTitle ? titleElement : undefined
|
| 29044 |
}, props), settings.map((setting, index) => (0,external_wp_element_namespaceObject.createElement)(control, _extends({
|
| 29045 |
+
showTitle: showTitle,
|
| 29046 |
key: index,
|
| 29047 |
colors,
|
| 29048 |
gradients,
|
| 29049 |
disableCustomColors,
|
| 29050 |
+
disableCustomGradients,
|
| 29051 |
+
__experimentalHasMultipleOrigins
|
| 29052 |
}, setting))), children);
|
| 29053 |
};
|
| 29054 |
|
| 29055 |
+
function useCommonSingleMultipleSelects() {
|
| 29056 |
+
return {
|
| 29057 |
+
disableCustomColors: !useSetting('color.custom'),
|
| 29058 |
+
disableCustomGradients: !useSetting('color.customGradient')
|
| 29059 |
+
};
|
| 29060 |
+
}
|
| 29061 |
+
|
| 29062 |
+
const PanelColorGradientSettingsSingleSelect = props => {
|
| 29063 |
+
const colorGradientSettings = useCommonSingleMultipleSelects();
|
| 29064 |
colorGradientSettings.colors = useSetting('color.palette');
|
| 29065 |
colorGradientSettings.gradients = useSetting('color.gradients');
|
| 29066 |
+
return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsInner, _extends({}, colorGradientSettings, props));
|
| 29067 |
+
};
|
| 29068 |
+
|
| 29069 |
+
const PanelColorGradientSettingsMultipleSelect = props => {
|
| 29070 |
+
const colorGradientSettings = useCommonSingleMultipleSelects();
|
| 29071 |
+
const userColors = useSetting('color.palette.user');
|
| 29072 |
+
const themeColors = useSetting('color.palette.theme');
|
| 29073 |
+
const coreColors = useSetting('color.palette.core');
|
| 29074 |
+
colorGradientSettings.colors = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
| 29075 |
+
const result = [];
|
| 29076 |
+
|
| 29077 |
+
if (coreColors && coreColors.length) {
|
| 29078 |
+
result.push({
|
| 29079 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Core'),
|
| 29080 |
+
colors: coreColors
|
| 29081 |
+
});
|
| 29082 |
+
}
|
| 29083 |
+
|
| 29084 |
+
if (themeColors && themeColors.length) {
|
| 29085 |
+
result.push({
|
| 29086 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Theme'),
|
| 29087 |
+
colors: themeColors
|
| 29088 |
+
});
|
| 29089 |
+
}
|
| 29090 |
+
|
| 29091 |
+
if (userColors && userColors.length) {
|
| 29092 |
+
result.push({
|
| 29093 |
+
name: (0,external_wp_i18n_namespaceObject.__)('User'),
|
| 29094 |
+
colors: userColors
|
| 29095 |
+
});
|
| 29096 |
+
}
|
| 29097 |
+
|
| 29098 |
+
return result;
|
| 29099 |
+
}, [coreColors, themeColors, userColors]);
|
| 29100 |
+
const userGradients = useSetting('color.gradients.user');
|
| 29101 |
+
const themeGradients = useSetting('color.gradients.theme');
|
| 29102 |
+
const coreGradients = useSetting('color.gradients.core');
|
| 29103 |
+
colorGradientSettings.gradients = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
| 29104 |
+
const result = [];
|
| 29105 |
+
|
| 29106 |
+
if (coreGradients && coreGradients.length) {
|
| 29107 |
+
result.push({
|
| 29108 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Core'),
|
| 29109 |
+
gradients: coreGradients
|
| 29110 |
+
});
|
| 29111 |
+
}
|
| 29112 |
+
|
| 29113 |
+
if (themeGradients && themeGradients.length) {
|
| 29114 |
+
result.push({
|
| 29115 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Theme'),
|
| 29116 |
+
gradients: themeGradients
|
| 29117 |
+
});
|
| 29118 |
+
}
|
| 29119 |
+
|
| 29120 |
+
if (userGradients && userGradients.length) {
|
| 29121 |
+
result.push({
|
| 29122 |
+
name: (0,external_wp_i18n_namespaceObject.__)('User'),
|
| 29123 |
+
gradients: userGradients
|
| 29124 |
+
});
|
| 29125 |
+
}
|
| 29126 |
+
|
| 29127 |
+
return result;
|
| 29128 |
+
}, [userGradients, themeGradients, coreGradients]);
|
| 29129 |
return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsInner, _extends({}, colorGradientSettings, props));
|
| 29130 |
};
|
| 29131 |
|
| 29134 |
return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsInner, props);
|
| 29135 |
}
|
| 29136 |
|
| 29137 |
+
if (props.__experimentalHasMultipleOrigins) {
|
| 29138 |
+
return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsMultipleSelect, props);
|
| 29139 |
+
}
|
| 29140 |
+
|
| 29141 |
+
return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsSingleSelect, props);
|
| 29142 |
};
|
| 29143 |
|
| 29144 |
/* harmony default export */ var panel_color_gradient_settings = (PanelColorGradientSettings);
|
| 29273 |
title: (0,external_wp_i18n_namespaceObject.__)('Color'),
|
| 29274 |
initialOpen: false,
|
| 29275 |
settings: settings,
|
| 29276 |
+
showTitle: showTitle,
|
| 29277 |
+
__experimentalHasMultipleOrigins: true
|
| 29278 |
}, enableContrastChecking && (0,external_wp_element_namespaceObject.createElement)(contrast_checker, {
|
| 29279 |
backgroundColor: detectedBackgroundColor,
|
| 29280 |
textColor: detectedColor
|
| 29663 |
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/color/addEditProps', color_addEditProps);
|
| 29664 |
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/color/with-color-palette-styles', withColorPaletteStyles);
|
| 29665 |
//# sourceMappingURL=color.js.map
|
| 29666 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/font-appearance-control/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29667 |
|
| 29668 |
|
| 29669 |
/**
|
| 29672 |
|
| 29673 |
|
| 29674 |
|
| 29675 |
+
const FONT_STYLES = [{
|
| 29676 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Regular'),
|
| 29677 |
+
value: 'normal'
|
|
|
|
| 29678 |
}, {
|
| 29679 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Italic'),
|
| 29680 |
+
value: 'italic'
|
| 29681 |
+
}];
|
| 29682 |
+
const FONT_WEIGHTS = [{
|
| 29683 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Thin'),
|
| 29684 |
+
value: '100'
|
| 29685 |
+
}, {
|
| 29686 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Extra Light'),
|
| 29687 |
+
value: '200'
|
| 29688 |
+
}, {
|
| 29689 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Light'),
|
| 29690 |
+
value: '300'
|
| 29691 |
+
}, {
|
| 29692 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Regular'),
|
| 29693 |
+
value: '400'
|
| 29694 |
+
}, {
|
| 29695 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Medium'),
|
| 29696 |
+
value: '500'
|
| 29697 |
+
}, {
|
| 29698 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Semi Bold'),
|
| 29699 |
+
value: '600'
|
| 29700 |
+
}, {
|
| 29701 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Bold'),
|
| 29702 |
+
value: '700'
|
| 29703 |
+
}, {
|
| 29704 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Extra Bold'),
|
| 29705 |
+
value: '800'
|
| 29706 |
+
}, {
|
| 29707 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Black'),
|
| 29708 |
+
value: '900'
|
| 29709 |
}];
|
| 29710 |
/**
|
| 29711 |
+
* Adjusts font appearance field label in case either font styles or weights
|
| 29712 |
+
* are disabled.
|
|
|
|
|
|
|
|
|
|
| 29713 |
*
|
| 29714 |
+
* @param {boolean} hasFontStyles Whether font styles are enabled and present.
|
| 29715 |
+
* @param {boolean} hasFontWeights Whether font weights are enabled and present.
|
| 29716 |
+
* @return {string} A label representing what font appearance is being edited.
|
| 29717 |
*/
|
| 29718 |
|
| 29719 |
+
const getFontAppearanceLabel = (hasFontStyles, hasFontWeights) => {
|
| 29720 |
+
if (!hasFontStyles) {
|
| 29721 |
+
return (0,external_wp_i18n_namespaceObject.__)('Font weight');
|
| 29722 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29723 |
|
| 29724 |
+
if (!hasFontWeights) {
|
| 29725 |
+
return (0,external_wp_i18n_namespaceObject.__)('Font style');
|
| 29726 |
+
}
|
|
|
|
| 29727 |
|
| 29728 |
+
return (0,external_wp_i18n_namespaceObject.__)('Appearance');
|
| 29729 |
+
};
|
| 29730 |
/**
|
| 29731 |
+
* Control to display unified font style and weight options.
|
| 29732 |
*
|
| 29733 |
+
* @param {Object} props Component props.
|
| 29734 |
*
|
| 29735 |
+
* @return {WPElement} Font appearance control.
|
| 29736 |
*/
|
| 29737 |
|
| 29738 |
+
function FontAppearanceControl(props) {
|
|
|
|
|
|
|
| 29739 |
const {
|
| 29740 |
+
onChange,
|
| 29741 |
+
hasFontStyles = true,
|
| 29742 |
+
hasFontWeights = true,
|
| 29743 |
+
value: {
|
| 29744 |
+
fontStyle,
|
| 29745 |
+
fontWeight
|
| 29746 |
+
}
|
| 29747 |
} = props;
|
| 29748 |
+
const hasStylesOrWeights = hasFontStyles || hasFontWeights;
|
| 29749 |
+
const label = getFontAppearanceLabel(hasFontStyles, hasFontWeights);
|
| 29750 |
+
const defaultOption = {
|
| 29751 |
+
key: 'default',
|
| 29752 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Default'),
|
| 29753 |
+
style: {
|
| 29754 |
+
fontStyle: undefined,
|
| 29755 |
+
fontWeight: undefined
|
| 29756 |
+
}
|
| 29757 |
+
}; // Combines both font style and weight options into a single dropdown.
|
| 29758 |
|
| 29759 |
+
const combineOptions = () => {
|
| 29760 |
+
const combinedOptions = [defaultOption];
|
| 29761 |
+
FONT_STYLES.forEach(({
|
| 29762 |
+
name: styleName,
|
| 29763 |
+
value: styleValue
|
| 29764 |
+
}) => {
|
| 29765 |
+
FONT_WEIGHTS.forEach(({
|
| 29766 |
+
name: weightName,
|
| 29767 |
+
value: weightValue
|
| 29768 |
+
}) => {
|
| 29769 |
+
const optionName = styleValue === 'normal' ? weightName : (0,external_wp_i18n_namespaceObject.sprintf)(
|
| 29770 |
+
/* translators: 1: Font weight name. 2: Font style name. */
|
| 29771 |
+
(0,external_wp_i18n_namespaceObject.__)('%1$s %2$s'), weightName, styleName);
|
| 29772 |
+
combinedOptions.push({
|
| 29773 |
+
key: `${styleValue}-${weightValue}`,
|
| 29774 |
+
name: optionName,
|
| 29775 |
+
style: {
|
| 29776 |
+
fontStyle: styleValue,
|
| 29777 |
+
fontWeight: weightValue
|
| 29778 |
+
}
|
| 29779 |
+
});
|
| 29780 |
+
});
|
| 29781 |
});
|
| 29782 |
+
return combinedOptions;
|
| 29783 |
+
}; // Generates select options for font styles only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29784 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29785 |
|
| 29786 |
+
const styleOptions = () => {
|
| 29787 |
+
const combinedOptions = [defaultOption];
|
| 29788 |
+
FONT_STYLES.forEach(({
|
| 29789 |
+
name,
|
| 29790 |
+
value
|
| 29791 |
+
}) => {
|
| 29792 |
+
combinedOptions.push({
|
| 29793 |
+
key: value,
|
| 29794 |
+
name,
|
| 29795 |
+
style: {
|
| 29796 |
+
fontStyle: value,
|
| 29797 |
+
fontWeight: undefined
|
| 29798 |
+
}
|
| 29799 |
+
});
|
|
|
|
|
|
|
| 29800 |
});
|
| 29801 |
+
return combinedOptions;
|
| 29802 |
+
}; // Generates select options for font weights only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29803 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29804 |
|
| 29805 |
+
const weightOptions = () => {
|
| 29806 |
+
const combinedOptions = [defaultOption];
|
| 29807 |
+
FONT_WEIGHTS.forEach(({
|
| 29808 |
+
name,
|
| 29809 |
+
value
|
| 29810 |
+
}) => {
|
| 29811 |
+
combinedOptions.push({
|
| 29812 |
+
key: value,
|
| 29813 |
+
name,
|
| 29814 |
+
style: {
|
| 29815 |
+
fontStyle: undefined,
|
| 29816 |
+
fontWeight: value
|
| 29817 |
}
|
| 29818 |
+
});
|
| 29819 |
});
|
| 29820 |
+
return combinedOptions;
|
| 29821 |
+
}; // Map font styles and weights to select options.
|
| 29822 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29823 |
|
| 29824 |
+
const selectOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
| 29825 |
+
if (hasFontStyles && hasFontWeights) {
|
| 29826 |
+
return combineOptions();
|
| 29827 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29828 |
|
| 29829 |
+
return hasFontStyles ? styleOptions() : weightOptions();
|
| 29830 |
+
}, [props.options]); // Find current selection by comparing font style & weight against options,
|
| 29831 |
+
// and fall back to the Default option if there is no matching option.
|
| 29832 |
|
| 29833 |
+
const currentSelection = selectOptions.find(option => option.style.fontStyle === fontStyle && option.style.fontWeight === fontWeight) || selectOptions[0]; // Adjusts screen reader description based on styles or weights.
|
|
|
|
|
|
|
| 29834 |
|
| 29835 |
+
const getDescribedBy = () => {
|
| 29836 |
+
if (!currentSelection) {
|
| 29837 |
+
return (0,external_wp_i18n_namespaceObject.__)('No selected font appearance');
|
| 29838 |
+
}
|
| 29839 |
|
| 29840 |
+
if (!hasFontStyles) {
|
| 29841 |
+
return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font weight.
|
| 29842 |
+
(0,external_wp_i18n_namespaceObject.__)('Currently selected font weight: %s'), currentSelection.name);
|
| 29843 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29844 |
|
| 29845 |
+
if (!hasFontWeights) {
|
| 29846 |
+
return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font style.
|
| 29847 |
+
(0,external_wp_i18n_namespaceObject.__)('Currently selected font style: %s'), currentSelection.name);
|
| 29848 |
+
}
|
| 29849 |
|
| 29850 |
+
return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font appearance.
|
| 29851 |
+
(0,external_wp_i18n_namespaceObject.__)('Currently selected font appearance: %s'), currentSelection.name);
|
| 29852 |
+
};
|
| 29853 |
|
| 29854 |
+
return hasStylesOrWeights && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CustomSelectControl, {
|
| 29855 |
+
className: "components-font-appearance-control",
|
| 29856 |
+
label: label,
|
| 29857 |
+
describedBy: getDescribedBy(),
|
| 29858 |
+
options: selectOptions,
|
| 29859 |
+
value: currentSelection,
|
| 29860 |
+
onChange: ({
|
| 29861 |
+
selectedItem
|
| 29862 |
+
}) => onChange(selectedItem.style)
|
| 29863 |
+
});
|
| 29864 |
}
|
| 29865 |
//# sourceMappingURL=index.js.map
|
| 29866 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/line-height-control/utils.js
|
| 30002 |
const {
|
| 30003 |
attributes: {
|
| 30004 |
style
|
| 30005 |
+
},
|
| 30006 |
+
setAttributes
|
| 30007 |
} = props;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30008 |
|
| 30009 |
const onChange = newLineHeightValue => {
|
| 30010 |
const newStyle = { ...style,
|
| 30012 |
lineHeight: newLineHeightValue
|
| 30013 |
}
|
| 30014 |
};
|
| 30015 |
+
setAttributes({
|
| 30016 |
style: cleanEmptyObject(newStyle)
|
| 30017 |
});
|
| 30018 |
};
|
| 30032 |
function useIsLineHeightDisabled({
|
| 30033 |
name: blockName
|
| 30034 |
} = {}) {
|
| 30035 |
+
const isDisabled = !useSetting('typography.lineHeight');
|
| 30036 |
return !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, LINE_HEIGHT_SUPPORT_KEY) || isDisabled;
|
| 30037 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30038 |
/**
|
| 30039 |
+
* Checks if there is a current value set for the line height block support.
|
| 30040 |
+
*
|
| 30041 |
+
* @param {Object} props Block props.
|
| 30042 |
+
* @return {boolean} Whether or not the block has a line height value set.
|
| 30043 |
*/
|
| 30044 |
|
| 30045 |
+
function hasLineHeightValue(props) {
|
| 30046 |
+
var _props$attributes$sty, _props$attributes$sty2;
|
| 30047 |
|
| 30048 |
+
return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.typography) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.lineHeight);
|
| 30049 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30050 |
/**
|
| 30051 |
+
* Resets the line height block support attribute. This can be used when
|
| 30052 |
+
* disabling the line height support controls for a block via a progressive
|
| 30053 |
+
* discovery panel.
|
| 30054 |
*
|
| 30055 |
+
* @param {Object} props Block props.
|
| 30056 |
+
* @param {Object} props.attributes Block's attributes.
|
| 30057 |
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
| 30058 |
*/
|
| 30059 |
|
| 30060 |
+
function resetLineHeight({
|
| 30061 |
+
attributes = {},
|
| 30062 |
+
setAttributes
|
| 30063 |
+
}) {
|
| 30064 |
const {
|
| 30065 |
+
style
|
| 30066 |
+
} = attributes;
|
| 30067 |
+
setAttributes({
|
| 30068 |
+
style: cleanEmptyObject({ ...style,
|
| 30069 |
+
typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
|
| 30070 |
+
lineHeight: undefined
|
| 30071 |
+
}
|
| 30072 |
+
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30073 |
});
|
| 30074 |
}
|
| 30075 |
+
//# sourceMappingURL=line-height.js.map
|
| 30076 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/font-appearance.js
|
| 30077 |
|
| 30078 |
|
| 30117 |
const hasFontStyles = !useIsFontStyleDisabled(props);
|
| 30118 |
const hasFontWeights = !useIsFontWeightDisabled(props);
|
| 30119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30120 |
const onChange = newStyles => {
|
| 30121 |
setAttributes({
|
| 30122 |
style: cleanEmptyObject({ ...style,
|
| 30154 |
name: blockName
|
| 30155 |
} = {}) {
|
| 30156 |
const styleSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_STYLE_SUPPORT_KEY);
|
| 30157 |
+
const hasFontStyles = useSetting('typography.fontStyle');
|
| 30158 |
return !styleSupport || !hasFontStyles;
|
| 30159 |
}
|
| 30160 |
/**
|
| 30171 |
name: blockName
|
| 30172 |
} = {}) {
|
| 30173 |
const weightSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_WEIGHT_SUPPORT_KEY);
|
| 30174 |
+
const hasFontWeights = useSetting('typography.fontWeight');
|
| 30175 |
return !weightSupport || !hasFontWeights;
|
| 30176 |
}
|
| 30177 |
/**
|
| 30187 |
const weightsDisabled = useIsFontWeightDisabled(props);
|
| 30188 |
return stylesDisabled && weightsDisabled;
|
| 30189 |
}
|
| 30190 |
+
/**
|
| 30191 |
+
* Checks if there is either a font style or weight value set within the
|
| 30192 |
+
* typography styles.
|
| 30193 |
+
*
|
| 30194 |
+
* @param {Object} props Block props.
|
| 30195 |
+
* @return {boolean} Whether or not the block has a font style or weight.
|
| 30196 |
+
*/
|
| 30197 |
+
|
| 30198 |
+
function hasFontAppearanceValue(props) {
|
| 30199 |
+
var _props$attributes$sty;
|
| 30200 |
+
|
| 30201 |
+
const {
|
| 30202 |
+
fontStyle,
|
| 30203 |
+
fontWeight
|
| 30204 |
+
} = ((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : _props$attributes$sty.typography) || {};
|
| 30205 |
+
return !!fontStyle || !!fontWeight;
|
| 30206 |
+
}
|
| 30207 |
+
/**
|
| 30208 |
+
* Resets the font style and weight block support attributes. This can be used
|
| 30209 |
+
* when disabling the font appearance support controls for a block via a
|
| 30210 |
+
* progressive discovery panel.
|
| 30211 |
+
*
|
| 30212 |
+
* @param {Object} props Block props.
|
| 30213 |
+
* @param {Object} props.attributes Block's attributes.
|
| 30214 |
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
| 30215 |
+
*/
|
| 30216 |
+
|
| 30217 |
+
function resetFontAppearance({
|
| 30218 |
+
attributes = {},
|
| 30219 |
+
setAttributes
|
| 30220 |
+
}) {
|
| 30221 |
+
const {
|
| 30222 |
+
style
|
| 30223 |
+
} = attributes;
|
| 30224 |
+
setAttributes({
|
| 30225 |
+
style: cleanEmptyObject({ ...style,
|
| 30226 |
+
typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
|
| 30227 |
+
fontStyle: undefined,
|
| 30228 |
+
fontWeight: undefined
|
| 30229 |
+
}
|
| 30230 |
+
})
|
| 30231 |
+
});
|
| 30232 |
+
}
|
| 30233 |
//# sourceMappingURL=font-appearance.js.map
|
| 30234 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/font-family/index.js
|
| 30235 |
|
| 30312 |
* Filters registered block settings, extending attributes to include
|
| 30313 |
* the `fontFamily` attribute.
|
| 30314 |
*
|
| 30315 |
+
* @param {Object} settings Original block settings
|
| 30316 |
+
* @return {Object} Filtered block settings
|
| 30317 |
*/
|
| 30318 |
|
| 30319 |
function font_family_addAttributes(settings) {
|
| 30335 |
/**
|
| 30336 |
* Override props assigned to save component to inject font family.
|
| 30337 |
*
|
| 30338 |
+
* @param {Object} props Additional props applied to save element
|
| 30339 |
+
* @param {Object} blockType Block type
|
| 30340 |
+
* @param {Object} attributes Block attributes
|
| 30341 |
+
* @return {Object} Filtered props applied to save element
|
| 30342 |
*/
|
| 30343 |
|
| 30344 |
|
| 30347 |
return props;
|
| 30348 |
}
|
| 30349 |
|
| 30350 |
+
if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'typography.__experimentalSkipSerialization')) {
|
| 30351 |
return props;
|
| 30352 |
}
|
| 30353 |
|
| 30393 |
}
|
| 30394 |
|
| 30395 |
function FontFamilyEdit({
|
|
|
|
| 30396 |
setAttributes,
|
| 30397 |
attributes: {
|
| 30398 |
fontFamily
|
| 30401 |
var _find;
|
| 30402 |
|
| 30403 |
const fontFamilies = useSetting('typography.fontFamilies');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30404 |
const value = (_find = (0,external_lodash_namespaceObject.find)(fontFamilies, ({
|
| 30405 |
slug
|
| 30406 |
}) => fontFamily === slug)) === null || _find === void 0 ? void 0 : _find.fontFamily;
|
| 30434 |
const fontFamilies = useSetting('typography.fontFamilies');
|
| 30435 |
return !fontFamilies || fontFamilies.length === 0 || !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_FAMILY_SUPPORT_KEY);
|
| 30436 |
}
|
| 30437 |
+
/**
|
| 30438 |
+
* Checks if there is a current value set for the font family block support.
|
| 30439 |
+
*
|
| 30440 |
+
* @param {Object} props Block props.
|
| 30441 |
+
* @return {boolean} Whether or not the block has a font family value set.
|
| 30442 |
+
*/
|
| 30443 |
+
|
| 30444 |
+
function hasFontFamilyValue(props) {
|
| 30445 |
+
return !!props.attributes.fontFamily;
|
| 30446 |
+
}
|
| 30447 |
+
/**
|
| 30448 |
+
* Resets the font family block support attribute. This can be used when
|
| 30449 |
+
* disabling the font family support controls for a block via a progressive
|
| 30450 |
+
* discovery panel.
|
| 30451 |
+
*
|
| 30452 |
+
* @param {Object} props Block props.
|
| 30453 |
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
| 30454 |
+
*/
|
| 30455 |
+
|
| 30456 |
+
function resetFontFamily({
|
| 30457 |
+
setAttributes
|
| 30458 |
+
}) {
|
| 30459 |
+
setAttributes({
|
| 30460 |
+
fontFamily: undefined
|
| 30461 |
+
});
|
| 30462 |
+
}
|
| 30463 |
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/fontFamily/addAttribute', font_family_addAttributes);
|
| 30464 |
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/fontFamily/addSaveProps', font_family_addSaveProps);
|
| 30465 |
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/fontFamily/addEditProps', font_family_addEditProps);
|
| 30678 |
},
|
| 30679 |
setAttributes
|
| 30680 |
} = props;
|
|
|
|
| 30681 |
const fontSizes = useSetting('typography.fontSizes');
|
| 30682 |
|
| 30683 |
const onChange = value => {
|
| 30692 |
});
|
| 30693 |
};
|
| 30694 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30695 |
const fontSizeObject = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontSize);
|
| 30696 |
const fontSizeValue = (fontSizeObject === null || fontSizeObject === void 0 ? void 0 : fontSizeObject.size) || (style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontSize) || fontSize;
|
| 30697 |
return (0,external_wp_element_namespaceObject.createElement)(font_size_picker, {
|
| 30698 |
onChange: onChange,
|
| 30699 |
+
value: fontSizeValue,
|
| 30700 |
+
withReset: false
|
| 30701 |
+
});
|
| 30702 |
+
}
|
| 30703 |
+
/**
|
| 30704 |
+
* Checks if there is a current value set for the font size block support.
|
| 30705 |
+
*
|
| 30706 |
+
* @param {Object} props Block props.
|
| 30707 |
+
* @return {boolean} Whether or not the block has a font size value set.
|
| 30708 |
+
*/
|
| 30709 |
+
|
| 30710 |
+
function hasFontSizeValue(props) {
|
| 30711 |
+
var _style$typography3;
|
| 30712 |
+
|
| 30713 |
+
const {
|
| 30714 |
+
fontSize,
|
| 30715 |
+
style
|
| 30716 |
+
} = props.attributes;
|
| 30717 |
+
return !!fontSize || !!(style !== null && style !== void 0 && (_style$typography3 = style.typography) !== null && _style$typography3 !== void 0 && _style$typography3.fontSize);
|
| 30718 |
+
}
|
| 30719 |
+
/**
|
| 30720 |
+
* Resets the font size block support attribute. This can be used when
|
| 30721 |
+
* disabling the font size support controls for a block via a progressive
|
| 30722 |
+
* discovery panel.
|
| 30723 |
+
*
|
| 30724 |
+
* @param {Object} props Block props.
|
| 30725 |
+
* @param {Object} props.attributes Block's attributes.
|
| 30726 |
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
| 30727 |
+
*/
|
| 30728 |
+
|
| 30729 |
+
function resetFontSize({
|
| 30730 |
+
attributes = {},
|
| 30731 |
+
setAttributes
|
| 30732 |
+
}) {
|
| 30733 |
+
const {
|
| 30734 |
+
style
|
| 30735 |
+
} = attributes;
|
| 30736 |
+
setAttributes({
|
| 30737 |
+
fontSize: undefined,
|
| 30738 |
+
style: cleanEmptyObject({ ...style,
|
| 30739 |
+
typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
|
| 30740 |
+
fontSize: undefined
|
| 30741 |
+
}
|
| 30742 |
+
})
|
| 30743 |
});
|
| 30744 |
}
|
| 30745 |
/**
|
| 30767 |
*/
|
| 30768 |
|
| 30769 |
const withFontSizeInlineStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => {
|
| 30770 |
+
var _style$typography4, _style$typography5;
|
| 30771 |
|
| 30772 |
const fontSizes = useSetting('typography.fontSizes');
|
| 30773 |
const {
|
| 30782 |
// doesn't already have an inline font size,
|
| 30783 |
// and does have a class to extract the font size from.
|
| 30784 |
|
| 30785 |
+
if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_SIZE_SUPPORT_KEY) || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'typography.__experimentalSkipSerialization') || !fontSize || style !== null && style !== void 0 && (_style$typography4 = style.typography) !== null && _style$typography4 !== void 0 && _style$typography4.fontSize) {
|
| 30786 |
return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, props);
|
| 30787 |
}
|
| 30788 |
|
| 30789 |
+
const fontSizeValue = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography5 = style.typography) === null || _style$typography5 === void 0 ? void 0 : _style$typography5.fontSize).size;
|
| 30790 |
const newProps = { ...props,
|
| 30791 |
wrapperProps: { ...wrapperProps,
|
| 30792 |
style: {
|
| 30802 |
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/font/addEditProps', font_size_addEditProps);
|
| 30803 |
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/font-size/with-font-size-inline-styles', withFontSizeInlineStyles);
|
| 30804 |
//# sourceMappingURL=font-size.js.map
|
| 30805 |
+
;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-underline.js
|
| 30806 |
+
|
| 30807 |
+
|
| 30808 |
+
/**
|
| 30809 |
+
* WordPress dependencies
|
| 30810 |
+
*/
|
| 30811 |
+
|
| 30812 |
+
const formatUnderline = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 30813 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 30814 |
+
viewBox: "0 0 24 24"
|
| 30815 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 30816 |
+
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"
|
| 30817 |
+
}));
|
| 30818 |
+
/* harmony default export */ var format_underline = (formatUnderline);
|
| 30819 |
+
//# sourceMappingURL=format-underline.js.map
|
| 30820 |
+
;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-strikethrough.js
|
| 30821 |
+
|
| 30822 |
+
|
| 30823 |
+
/**
|
| 30824 |
+
* WordPress dependencies
|
| 30825 |
+
*/
|
| 30826 |
+
|
| 30827 |
+
const formatStrikethrough = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 30828 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 30829 |
+
viewBox: "0 0 24 24"
|
| 30830 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 30831 |
+
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"
|
| 30832 |
+
}));
|
| 30833 |
+
/* harmony default export */ var format_strikethrough = (formatStrikethrough);
|
| 30834 |
+
//# sourceMappingURL=format-strikethrough.js.map
|
| 30835 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/text-decoration-control/index.js
|
| 30836 |
+
|
| 30837 |
+
|
| 30838 |
+
/**
|
| 30839 |
+
* WordPress dependencies
|
| 30840 |
+
*/
|
| 30841 |
+
|
| 30842 |
+
|
| 30843 |
+
|
| 30844 |
+
const TEXT_DECORATIONS = [{
|
| 30845 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Underline'),
|
| 30846 |
+
value: 'underline',
|
| 30847 |
+
icon: format_underline
|
| 30848 |
+
}, {
|
| 30849 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Strikethrough'),
|
| 30850 |
+
value: 'line-through',
|
| 30851 |
+
icon: format_strikethrough
|
| 30852 |
+
}];
|
| 30853 |
+
/**
|
| 30854 |
+
* Control to facilitate text decoration selections.
|
| 30855 |
+
*
|
| 30856 |
+
* @param {Object} props Component props.
|
| 30857 |
+
* @param {string} props.value Currently selected text decoration.
|
| 30858 |
+
* @param {Function} props.onChange Handles change in text decoration selection.
|
| 30859 |
+
*
|
| 30860 |
+
* @return {WPElement} Text decoration control.
|
| 30861 |
+
*/
|
| 30862 |
+
|
| 30863 |
+
function TextDecorationControl({
|
| 30864 |
+
value,
|
| 30865 |
+
onChange
|
| 30866 |
+
}) {
|
| 30867 |
+
return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
|
| 30868 |
+
className: "block-editor-text-decoration-control"
|
| 30869 |
+
}, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Decoration')), (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 30870 |
+
className: "block-editor-text-decoration-control__buttons"
|
| 30871 |
+
}, TEXT_DECORATIONS.map(textDecoration => {
|
| 30872 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
| 30873 |
+
key: textDecoration.value,
|
| 30874 |
+
icon: textDecoration.icon,
|
| 30875 |
+
isSmall: true,
|
| 30876 |
+
isPressed: textDecoration.value === value,
|
| 30877 |
+
onClick: () => onChange(textDecoration.value === value ? undefined : textDecoration.value),
|
| 30878 |
+
"aria-label": textDecoration.name
|
| 30879 |
+
});
|
| 30880 |
+
})));
|
| 30881 |
+
}
|
| 30882 |
+
//# sourceMappingURL=index.js.map
|
| 30883 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/text-decoration.js
|
| 30884 |
+
|
| 30885 |
+
|
| 30886 |
+
/**
|
| 30887 |
+
* WordPress dependencies
|
| 30888 |
+
*/
|
| 30889 |
+
|
| 30890 |
+
/**
|
| 30891 |
+
* Internal dependencies
|
| 30892 |
+
*/
|
| 30893 |
+
|
| 30894 |
+
|
| 30895 |
+
|
| 30896 |
+
|
| 30897 |
+
/**
|
| 30898 |
+
* Key within block settings' supports array indicating support for text
|
| 30899 |
+
* decorations e.g. settings found in `block.json`.
|
| 30900 |
+
*/
|
| 30901 |
+
|
| 30902 |
+
const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
|
| 30903 |
+
/**
|
| 30904 |
+
* Inspector control panel containing the text decoration options.
|
| 30905 |
+
*
|
| 30906 |
+
* @param {Object} props Block properties.
|
| 30907 |
+
*
|
| 30908 |
+
* @return {WPElement} Text decoration edit element.
|
| 30909 |
+
*/
|
| 30910 |
+
|
| 30911 |
+
function TextDecorationEdit(props) {
|
| 30912 |
+
var _style$typography;
|
| 30913 |
+
|
| 30914 |
+
const {
|
| 30915 |
+
attributes: {
|
| 30916 |
+
style
|
| 30917 |
+
},
|
| 30918 |
+
setAttributes
|
| 30919 |
+
} = props;
|
| 30920 |
+
|
| 30921 |
+
function onChange(newDecoration) {
|
| 30922 |
+
setAttributes({
|
| 30923 |
+
style: cleanEmptyObject({ ...style,
|
| 30924 |
+
typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
|
| 30925 |
+
textDecoration: newDecoration
|
| 30926 |
+
}
|
| 30927 |
+
})
|
| 30928 |
+
});
|
| 30929 |
+
}
|
| 30930 |
+
|
| 30931 |
+
return (0,external_wp_element_namespaceObject.createElement)(TextDecorationControl, {
|
| 30932 |
+
value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textDecoration,
|
| 30933 |
+
onChange: onChange
|
| 30934 |
+
});
|
| 30935 |
+
}
|
| 30936 |
+
/**
|
| 30937 |
+
* Checks if text-decoration settings have been disabled.
|
| 30938 |
+
*
|
| 30939 |
+
* @param {string} name Name of the block.
|
| 30940 |
+
*
|
| 30941 |
+
* @return {boolean} Whether or not the setting is disabled.
|
| 30942 |
+
*/
|
| 30943 |
+
|
| 30944 |
+
function useIsTextDecorationDisabled({
|
| 30945 |
+
name: blockName
|
| 30946 |
+
} = {}) {
|
| 30947 |
+
const notSupported = !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, TEXT_DECORATION_SUPPORT_KEY);
|
| 30948 |
+
const hasTextDecoration = useSetting('typography.textDecoration');
|
| 30949 |
+
return notSupported || !hasTextDecoration;
|
| 30950 |
+
}
|
| 30951 |
+
/**
|
| 30952 |
+
* Checks if there is a current value set for the text decoration block support.
|
| 30953 |
+
*
|
| 30954 |
+
* @param {Object} props Block props.
|
| 30955 |
+
* @return {boolean} Whether or not the block has a text decoration set.
|
| 30956 |
+
*/
|
| 30957 |
+
|
| 30958 |
+
function hasTextDecorationValue(props) {
|
| 30959 |
+
var _props$attributes$sty, _props$attributes$sty2;
|
| 30960 |
+
|
| 30961 |
+
return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.typography) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.textDecoration);
|
| 30962 |
+
}
|
| 30963 |
+
/**
|
| 30964 |
+
* Resets the text decoration block support attribute. This can be used when
|
| 30965 |
+
* disabling the text decoration support controls for a block via a progressive
|
| 30966 |
+
* discovery panel.
|
| 30967 |
+
*
|
| 30968 |
+
* @param {Object} props Block props.
|
| 30969 |
+
* @param {Object} props.attributes Block's attributes.
|
| 30970 |
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
| 30971 |
+
*/
|
| 30972 |
+
|
| 30973 |
+
function resetTextDecoration({
|
| 30974 |
+
attributes = {},
|
| 30975 |
+
setAttributes
|
| 30976 |
+
}) {
|
| 30977 |
+
const {
|
| 30978 |
+
style
|
| 30979 |
+
} = attributes;
|
| 30980 |
+
setAttributes({
|
| 30981 |
+
style: cleanEmptyObject({ ...style,
|
| 30982 |
+
typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
|
| 30983 |
+
textDecoration: undefined
|
| 30984 |
+
}
|
| 30985 |
+
})
|
| 30986 |
+
});
|
| 30987 |
+
}
|
| 30988 |
+
//# sourceMappingURL=text-decoration.js.map
|
| 30989 |
+
;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-uppercase.js
|
| 30990 |
+
|
| 30991 |
+
|
| 30992 |
+
/**
|
| 30993 |
+
* WordPress dependencies
|
| 30994 |
+
*/
|
| 30995 |
+
|
| 30996 |
+
const formatUppercase = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 30997 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 30998 |
+
viewBox: "0 0 24 24"
|
| 30999 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 31000 |
+
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"
|
| 31001 |
+
}));
|
| 31002 |
+
/* harmony default export */ var format_uppercase = (formatUppercase);
|
| 31003 |
+
//# sourceMappingURL=format-uppercase.js.map
|
| 31004 |
+
;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-lowercase.js
|
| 31005 |
+
|
| 31006 |
+
|
| 31007 |
+
/**
|
| 31008 |
+
* WordPress dependencies
|
| 31009 |
+
*/
|
| 31010 |
+
|
| 31011 |
+
const formatLowercase = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 31012 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 31013 |
+
viewBox: "0 0 24 24"
|
| 31014 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 31015 |
+
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"
|
| 31016 |
+
}));
|
| 31017 |
+
/* harmony default export */ var format_lowercase = (formatLowercase);
|
| 31018 |
+
//# sourceMappingURL=format-lowercase.js.map
|
| 31019 |
+
;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-capitalize.js
|
| 31020 |
+
|
| 31021 |
+
|
| 31022 |
+
/**
|
| 31023 |
+
* WordPress dependencies
|
| 31024 |
+
*/
|
| 31025 |
+
|
| 31026 |
+
const formatCapitalize = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 31027 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 31028 |
+
viewBox: "0 0 24 24"
|
| 31029 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 31030 |
+
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"
|
| 31031 |
+
}));
|
| 31032 |
+
/* harmony default export */ var format_capitalize = (formatCapitalize);
|
| 31033 |
+
//# sourceMappingURL=format-capitalize.js.map
|
| 31034 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/text-transform-control/index.js
|
| 31035 |
+
|
| 31036 |
+
|
| 31037 |
+
/**
|
| 31038 |
+
* WordPress dependencies
|
| 31039 |
+
*/
|
| 31040 |
+
|
| 31041 |
+
|
| 31042 |
+
|
| 31043 |
+
const TEXT_TRANSFORMS = [{
|
| 31044 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Uppercase'),
|
| 31045 |
+
value: 'uppercase',
|
| 31046 |
+
icon: format_uppercase
|
| 31047 |
+
}, {
|
| 31048 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Lowercase'),
|
| 31049 |
+
value: 'lowercase',
|
| 31050 |
+
icon: format_lowercase
|
| 31051 |
+
}, {
|
| 31052 |
+
name: (0,external_wp_i18n_namespaceObject.__)('Capitalize'),
|
| 31053 |
+
value: 'capitalize',
|
| 31054 |
+
icon: format_capitalize
|
| 31055 |
+
}];
|
| 31056 |
+
/**
|
| 31057 |
+
* Control to facilitate text transform selections.
|
| 31058 |
+
*
|
| 31059 |
+
* @param {Object} props Component props.
|
| 31060 |
+
* @param {string} props.value Currently selected text transform.
|
| 31061 |
+
* @param {Function} props.onChange Handles change in text transform selection.
|
| 31062 |
+
*
|
| 31063 |
+
* @return {WPElement} Text transform control.
|
| 31064 |
+
*/
|
| 31065 |
+
|
| 31066 |
+
function TextTransformControl({
|
| 31067 |
+
value,
|
| 31068 |
+
onChange
|
| 31069 |
+
}) {
|
| 31070 |
+
return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
|
| 31071 |
+
className: "block-editor-text-transform-control"
|
| 31072 |
+
}, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Letter case')), (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 31073 |
+
className: "block-editor-text-transform-control__buttons"
|
| 31074 |
+
}, TEXT_TRANSFORMS.map(textTransform => {
|
| 31075 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
| 31076 |
+
key: textTransform.value,
|
| 31077 |
+
icon: textTransform.icon,
|
| 31078 |
+
isSmall: true,
|
| 31079 |
+
isPressed: value === textTransform.value,
|
| 31080 |
+
"aria-label": textTransform.name,
|
| 31081 |
+
onClick: () => onChange(value === textTransform.value ? undefined : textTransform.value)
|
| 31082 |
+
});
|
| 31083 |
+
})));
|
| 31084 |
+
}
|
| 31085 |
+
//# sourceMappingURL=index.js.map
|
| 31086 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/text-transform.js
|
| 31087 |
+
|
| 31088 |
+
|
| 31089 |
+
/**
|
| 31090 |
+
* WordPress dependencies
|
| 31091 |
+
*/
|
| 31092 |
+
|
| 31093 |
+
/**
|
| 31094 |
+
* Internal dependencies
|
| 31095 |
+
*/
|
| 31096 |
+
|
| 31097 |
+
|
| 31098 |
+
|
| 31099 |
+
|
| 31100 |
+
/**
|
| 31101 |
+
* Key within block settings' supports array indicating support for text
|
| 31102 |
+
* transforms e.g. settings found in `block.json`.
|
| 31103 |
+
*/
|
| 31104 |
+
|
| 31105 |
+
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
|
| 31106 |
+
/**
|
| 31107 |
+
* Inspector control panel containing the text transform options.
|
| 31108 |
+
*
|
| 31109 |
+
* @param {Object} props Block properties.
|
| 31110 |
+
*
|
| 31111 |
+
* @return {WPElement} Text transform edit element.
|
| 31112 |
+
*/
|
| 31113 |
+
|
| 31114 |
+
function TextTransformEdit(props) {
|
| 31115 |
+
var _style$typography;
|
| 31116 |
+
|
| 31117 |
+
const {
|
| 31118 |
+
attributes: {
|
| 31119 |
+
style
|
| 31120 |
+
},
|
| 31121 |
+
setAttributes
|
| 31122 |
+
} = props;
|
| 31123 |
+
|
| 31124 |
+
function onChange(newTransform) {
|
| 31125 |
+
setAttributes({
|
| 31126 |
+
style: cleanEmptyObject({ ...style,
|
| 31127 |
+
typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
|
| 31128 |
+
textTransform: newTransform
|
| 31129 |
+
}
|
| 31130 |
+
})
|
| 31131 |
+
});
|
| 31132 |
+
}
|
| 31133 |
+
|
| 31134 |
+
return (0,external_wp_element_namespaceObject.createElement)(TextTransformControl, {
|
| 31135 |
+
value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textTransform,
|
| 31136 |
+
onChange: onChange
|
| 31137 |
+
});
|
| 31138 |
+
}
|
| 31139 |
+
/**
|
| 31140 |
+
* Checks if text-transform settings have been disabled.
|
| 31141 |
+
*
|
| 31142 |
+
* @param {string} name Name of the block.
|
| 31143 |
+
*
|
| 31144 |
+
* @return {boolean} Whether or not the setting is disabled.
|
| 31145 |
+
*/
|
| 31146 |
+
|
| 31147 |
+
function useIsTextTransformDisabled({
|
| 31148 |
+
name: blockName
|
| 31149 |
+
} = {}) {
|
| 31150 |
+
const notSupported = !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, TEXT_TRANSFORM_SUPPORT_KEY);
|
| 31151 |
+
const hasTextTransforms = useSetting('typography.textTransform');
|
| 31152 |
+
return notSupported || !hasTextTransforms;
|
| 31153 |
+
}
|
| 31154 |
+
/**
|
| 31155 |
+
* Checks if there is a current value set for the text transform block support.
|
| 31156 |
+
*
|
| 31157 |
+
* @param {Object} props Block props.
|
| 31158 |
+
* @return {boolean} Whether or not the block has a text transform set.
|
| 31159 |
+
*/
|
| 31160 |
+
|
| 31161 |
+
function hasTextTransformValue(props) {
|
| 31162 |
+
var _props$attributes$sty, _props$attributes$sty2;
|
| 31163 |
+
|
| 31164 |
+
return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.typography) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.textTransform);
|
| 31165 |
+
}
|
| 31166 |
+
/**
|
| 31167 |
+
* Resets the text transform block support attribute. This can be used when
|
| 31168 |
+
* disabling the text transform support controls for a block via a progressive
|
| 31169 |
+
* discovery panel.
|
| 31170 |
+
*
|
| 31171 |
+
* @param {Object} props Block props.
|
| 31172 |
+
* @param {Object} props.attributes Block's attributes.
|
| 31173 |
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
| 31174 |
+
*/
|
| 31175 |
+
|
| 31176 |
+
function resetTextTransform({
|
| 31177 |
+
attributes = {},
|
| 31178 |
+
setAttributes
|
| 31179 |
+
}) {
|
| 31180 |
+
const {
|
| 31181 |
+
style
|
| 31182 |
+
} = attributes;
|
| 31183 |
+
setAttributes({
|
| 31184 |
+
style: cleanEmptyObject({ ...style,
|
| 31185 |
+
typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
|
| 31186 |
+
textTransform: undefined
|
| 31187 |
+
}
|
| 31188 |
+
})
|
| 31189 |
+
});
|
| 31190 |
+
}
|
| 31191 |
+
//# sourceMappingURL=text-transform.js.map
|
| 31192 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/letter-spacing-control/index.js
|
| 31193 |
|
| 31194 |
|
| 31205 |
/**
|
| 31206 |
* Control for letter-spacing.
|
| 31207 |
*
|
| 31208 |
+
* @param {Object} props Component props.
|
| 31209 |
+
* @param {string} props.value Currently selected letter-spacing.
|
| 31210 |
+
* @param {Function} props.onChange Handles change in letter-spacing selection.
|
| 31211 |
+
* @param {boolean} props.__unstableInputWidth Input width to pass through to inner UnitControl.
|
| 31212 |
+
*
|
| 31213 |
+
* @return {WPElement} Letter-spacing control.
|
| 31214 |
*/
|
| 31215 |
|
| 31216 |
function LetterSpacingControl({
|
| 31217 |
value,
|
| 31218 |
+
onChange,
|
| 31219 |
+
__unstableInputWidth = '60px'
|
| 31220 |
}) {
|
| 31221 |
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
|
| 31222 |
availableUnits: useSetting('spacing.units') || ['px', 'em', 'rem'],
|
| 31229 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
|
| 31230 |
label: (0,external_wp_i18n_namespaceObject.__)('Letter-spacing'),
|
| 31231 |
value: value,
|
| 31232 |
+
__unstableInputWidth: __unstableInputWidth,
|
| 31233 |
units: units,
|
| 31234 |
onChange: onChange
|
| 31235 |
});
|
| 31271 |
},
|
| 31272 |
setAttributes
|
| 31273 |
} = props;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31274 |
|
| 31275 |
function onChange(newSpacing) {
|
| 31276 |
setAttributes({
|
| 31284 |
|
| 31285 |
return (0,external_wp_element_namespaceObject.createElement)(LetterSpacingControl, {
|
| 31286 |
value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.letterSpacing,
|
| 31287 |
+
onChange: onChange,
|
| 31288 |
+
__unstableInputWidth: false
|
| 31289 |
});
|
| 31290 |
}
|
| 31291 |
/**
|
| 31299 |
name: blockName
|
| 31300 |
} = {}) {
|
| 31301 |
const notSupported = !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, LETTER_SPACING_SUPPORT_KEY);
|
| 31302 |
+
const hasLetterSpacing = useSetting('typography.letterSpacing');
|
| 31303 |
return notSupported || !hasLetterSpacing;
|
| 31304 |
}
|
| 31305 |
+
/**
|
| 31306 |
+
* Checks if there is a current value set for the letter spacing block support.
|
| 31307 |
+
*
|
| 31308 |
+
* @param {Object} props Block props.
|
| 31309 |
+
* @return {boolean} Whether or not the block has a letter spacing set.
|
| 31310 |
+
*/
|
| 31311 |
|
| 31312 |
+
function hasLetterSpacingValue(props) {
|
| 31313 |
+
var _props$attributes$sty, _props$attributes$sty2;
|
| 31314 |
|
| 31315 |
+
return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.typography) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.letterSpacing);
|
| 31316 |
+
}
|
| 31317 |
/**
|
| 31318 |
+
* Resets the letter spacing block support attribute. This can be used when
|
| 31319 |
+
* disabling the letter spacing support controls for a block via a progressive
|
| 31320 |
+
* discovery panel.
|
| 31321 |
+
*
|
| 31322 |
+
* @param {Object} props Block props.
|
| 31323 |
+
* @param {Object} props.attributes Block's attributes.
|
| 31324 |
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
| 31325 |
*/
|
| 31326 |
|
| 31327 |
+
function resetLetterSpacing({
|
| 31328 |
+
attributes = {},
|
| 31329 |
+
setAttributes
|
| 31330 |
+
}) {
|
| 31331 |
+
const {
|
| 31332 |
+
style
|
| 31333 |
+
} = attributes;
|
| 31334 |
+
setAttributes({
|
| 31335 |
+
style: cleanEmptyObject({ ...style,
|
| 31336 |
+
typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
|
| 31337 |
+
letterSpacing: undefined
|
| 31338 |
+
}
|
| 31339 |
+
})
|
| 31340 |
+
});
|
| 31341 |
+
}
|
| 31342 |
+
//# sourceMappingURL=letter-spacing.js.map
|
| 31343 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/typography.js
|
| 31344 |
+
|
| 31345 |
+
|
| 31346 |
/**
|
| 31347 |
+
* WordPress dependencies
|
| 31348 |
*/
|
| 31349 |
|
| 31350 |
|
| 31365 |
const TYPOGRAPHY_SUPPORT_KEY = 'typography';
|
| 31366 |
const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
|
| 31367 |
function TypographyPanel(props) {
|
| 31368 |
+
const {
|
| 31369 |
+
clientId
|
| 31370 |
+
} = props;
|
| 31371 |
+
const isFontFamilyDisabled = useIsFontFamilyDisabled(props);
|
| 31372 |
+
const isFontSizeDisabled = useIsFontSizeDisabled(props);
|
| 31373 |
+
const isFontAppearanceDisabled = useIsFontAppearanceDisabled(props);
|
| 31374 |
+
const isLineHeightDisabled = useIsLineHeightDisabled(props);
|
| 31375 |
+
const isTextDecorationDisabled = useIsTextDecorationDisabled(props);
|
| 31376 |
+
const isTextTransformDisabled = useIsTextTransformDisabled(props);
|
| 31377 |
+
const isLetterSpacingDisabled = useIsLetterSpacingDisabled(props);
|
| 31378 |
+
const hasFontStyles = !useIsFontStyleDisabled(props);
|
| 31379 |
+
const hasFontWeights = !useIsFontWeightDisabled(props);
|
| 31380 |
const isDisabled = useIsTypographyDisabled(props);
|
| 31381 |
const isSupported = hasTypographySupport(props.name);
|
| 31382 |
if (isDisabled || !isSupported) return null;
|
| 31383 |
+
const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(props.name, [TYPOGRAPHY_SUPPORT_KEY, '__experimentalDefaultControls']);
|
| 31384 |
+
|
| 31385 |
+
const createResetAllFilter = attribute => newAttributes => {
|
| 31386 |
+
var _newAttributes$style;
|
| 31387 |
+
|
| 31388 |
+
return { ...newAttributes,
|
| 31389 |
+
style: { ...newAttributes.style,
|
| 31390 |
+
typography: { ...((_newAttributes$style = newAttributes.style) === null || _newAttributes$style === void 0 ? void 0 : _newAttributes$style.typography),
|
| 31391 |
+
[attribute]: undefined
|
| 31392 |
+
}
|
| 31393 |
+
}
|
| 31394 |
+
};
|
| 31395 |
+
};
|
| 31396 |
+
|
| 31397 |
+
return (0,external_wp_element_namespaceObject.createElement)(inspector_controls, {
|
| 31398 |
+
__experimentalGroup: "typography"
|
| 31399 |
+
}, !isFontFamilyDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
|
| 31400 |
+
hasValue: () => hasFontFamilyValue(props),
|
| 31401 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Font family'),
|
| 31402 |
+
onDeselect: () => resetFontFamily(props),
|
| 31403 |
+
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.fontFamily,
|
| 31404 |
+
resetAllFilter: newAttributes => ({ ...newAttributes,
|
| 31405 |
+
fontFamily: undefined
|
| 31406 |
+
}),
|
| 31407 |
+
panelId: clientId
|
| 31408 |
+
}, (0,external_wp_element_namespaceObject.createElement)(FontFamilyEdit, props)), !isFontSizeDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
|
| 31409 |
+
hasValue: () => hasFontSizeValue(props),
|
| 31410 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Font size'),
|
| 31411 |
+
onDeselect: () => resetFontSize(props),
|
| 31412 |
+
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.fontSize,
|
| 31413 |
+
resetAllFilter: newAttributes => {
|
| 31414 |
+
var _newAttributes$style2;
|
| 31415 |
+
|
| 31416 |
+
return { ...newAttributes,
|
| 31417 |
+
fontSize: undefined,
|
| 31418 |
+
style: { ...newAttributes.style,
|
| 31419 |
+
typography: { ...((_newAttributes$style2 = newAttributes.style) === null || _newAttributes$style2 === void 0 ? void 0 : _newAttributes$style2.typography),
|
| 31420 |
+
fontSize: undefined
|
| 31421 |
+
}
|
| 31422 |
+
}
|
| 31423 |
+
};
|
| 31424 |
+
},
|
| 31425 |
+
panelId: clientId
|
| 31426 |
+
}, (0,external_wp_element_namespaceObject.createElement)(FontSizeEdit, props)), !isFontAppearanceDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
|
| 31427 |
+
className: "single-column",
|
| 31428 |
+
hasValue: () => hasFontAppearanceValue(props),
|
| 31429 |
+
label: getFontAppearanceLabel(hasFontStyles, hasFontWeights),
|
| 31430 |
+
onDeselect: () => resetFontAppearance(props),
|
| 31431 |
+
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.fontAppearance,
|
| 31432 |
+
resetAllFilter: newAttributes => {
|
| 31433 |
+
var _newAttributes$style3;
|
| 31434 |
+
|
| 31435 |
+
return { ...newAttributes,
|
| 31436 |
+
style: { ...newAttributes.style,
|
| 31437 |
+
typography: { ...((_newAttributes$style3 = newAttributes.style) === null || _newAttributes$style3 === void 0 ? void 0 : _newAttributes$style3.typography),
|
| 31438 |
+
fontStyle: undefined,
|
| 31439 |
+
fontWeight: undefined
|
| 31440 |
+
}
|
| 31441 |
+
}
|
| 31442 |
+
};
|
| 31443 |
+
},
|
| 31444 |
+
panelId: clientId
|
| 31445 |
+
}, (0,external_wp_element_namespaceObject.createElement)(FontAppearanceEdit, props)), !isLineHeightDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
|
| 31446 |
+
className: "single-column",
|
| 31447 |
+
hasValue: () => hasLineHeightValue(props),
|
| 31448 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Line height'),
|
| 31449 |
+
onDeselect: () => resetLineHeight(props),
|
| 31450 |
+
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.lineHeight,
|
| 31451 |
+
resetAllFilter: createResetAllFilter('lineHeight'),
|
| 31452 |
+
panelId: clientId
|
| 31453 |
+
}, (0,external_wp_element_namespaceObject.createElement)(LineHeightEdit, props)), !isTextDecorationDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
|
| 31454 |
+
className: "single-column",
|
| 31455 |
+
hasValue: () => hasTextDecorationValue(props),
|
| 31456 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Decoration'),
|
| 31457 |
+
onDeselect: () => resetTextDecoration(props),
|
| 31458 |
+
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.textDecoration,
|
| 31459 |
+
resetAllFilter: createResetAllFilter('textDecoration'),
|
| 31460 |
+
panelId: clientId
|
| 31461 |
+
}, (0,external_wp_element_namespaceObject.createElement)(TextDecorationEdit, props)), !isTextTransformDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
|
| 31462 |
+
className: "single-column",
|
| 31463 |
+
hasValue: () => hasTextTransformValue(props),
|
| 31464 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Letter case'),
|
| 31465 |
+
onDeselect: () => resetTextTransform(props),
|
| 31466 |
+
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.textTransform,
|
| 31467 |
+
resetAllFilter: createResetAllFilter('textTransform'),
|
| 31468 |
+
panelId: clientId
|
| 31469 |
+
}, (0,external_wp_element_namespaceObject.createElement)(TextTransformEdit, props)), !isLetterSpacingDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
|
| 31470 |
+
className: "single-column",
|
| 31471 |
+
hasValue: () => hasLetterSpacingValue(props),
|
| 31472 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Letter-spacing'),
|
| 31473 |
+
onDeselect: () => resetLetterSpacing(props),
|
| 31474 |
+
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.letterSpacing,
|
| 31475 |
+
resetAllFilter: createResetAllFilter('letterSpacing'),
|
| 31476 |
+
panelId: clientId
|
| 31477 |
+
}, (0,external_wp_element_namespaceObject.createElement)(LetterSpacingEdit, props)));
|
| 31478 |
}
|
| 31479 |
|
| 31480 |
const hasTypographySupport = blockName => {
|
| 31703 |
function useIsMarginDisabled({
|
| 31704 |
name: blockName
|
| 31705 |
} = {}) {
|
| 31706 |
+
const isDisabled = !useSetting('spacing.margin');
|
| 31707 |
const isInvalid = !useIsDimensionsSupportValid(blockName, 'margin');
|
| 31708 |
return !hasMarginSupport(blockName) || isDisabled || isInvalid;
|
| 31709 |
}
|
| 31848 |
function useIsPaddingDisabled({
|
| 31849 |
name: blockName
|
| 31850 |
} = {}) {
|
| 31851 |
+
const isDisabled = !useSetting('spacing.padding');
|
| 31852 |
const isInvalid = !useIsDimensionsSupportValid(blockName, 'padding');
|
| 31853 |
return !hasPaddingSupport(blockName) || isDisabled || isInvalid;
|
| 31854 |
}
|
| 32337 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
|
| 32338 |
popoverProps: {
|
| 32339 |
className: 'block-editor-duotone-control__popover',
|
| 32340 |
+
headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone'),
|
| 32341 |
+
isAlternate: true
|
| 32342 |
},
|
| 32343 |
renderToggle: ({
|
| 32344 |
isOpen,
|
| 32365 |
},
|
| 32366 |
renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
|
| 32367 |
label: (0,external_wp_i18n_namespaceObject.__)('Duotone')
|
| 32368 |
+
}, (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 32369 |
+
className: "block-editor-duotone-control__description"
|
| 32370 |
+
}, (0,external_wp_i18n_namespaceObject.__)('Create a two-tone color effect without losing your original image.')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotonePicker, {
|
| 32371 |
colorPalette: colorPalette,
|
| 32372 |
duotonePalette: duotonePalette,
|
| 32373 |
disableCustomColors: disableCustomColors,
|
| 32419 |
const values = {
|
| 32420 |
r: [],
|
| 32421 |
g: [],
|
| 32422 |
+
b: [],
|
| 32423 |
+
a: []
|
| 32424 |
};
|
| 32425 |
colors.forEach(color => {
|
| 32426 |
const rgbColor = w(color).toRgb();
|
| 32427 |
values.r.push(rgbColor.r / 255);
|
| 32428 |
values.g.push(rgbColor.g / 255);
|
| 32429 |
values.b.push(rgbColor.b / 255);
|
| 32430 |
+
values.a.push(rgbColor.a);
|
| 32431 |
});
|
| 32432 |
return values;
|
| 32433 |
}
|
| 32438 |
* @property {number[]} r Red values.
|
| 32439 |
* @property {number[]} g Green values.
|
| 32440 |
* @property {number[]} b Blue values.
|
| 32441 |
+
* @property {number[]} a Alpha values.
|
| 32442 |
*/
|
| 32443 |
|
| 32444 |
/**
|
| 32447 |
* @param {Object} props Duotone props.
|
| 32448 |
* @param {string} props.selector Selector to apply the filter to.
|
| 32449 |
* @param {string} props.id Unique id for this duotone filter.
|
| 32450 |
+
* @param {Values} props.values R, G, B, and A values to filter with.
|
| 32451 |
*
|
| 32452 |
* @return {WPElement} Duotone element.
|
| 32453 |
*/
|
| 32478 |
}, (0,external_wp_element_namespaceObject.createElement)("defs", null, (0,external_wp_element_namespaceObject.createElement)("filter", {
|
| 32479 |
id: id
|
| 32480 |
}, (0,external_wp_element_namespaceObject.createElement)("feColorMatrix", {
|
| 32481 |
+
// Use sRGB instead of linearRGB so transparency looks correct.
|
| 32482 |
+
colorInterpolationFilters: "sRGB",
|
| 32483 |
type: "matrix" // Use perceptual brightness to convert to grayscale.
|
|
|
|
| 32484 |
,
|
| 32485 |
+
values: " .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "
|
| 32486 |
}), (0,external_wp_element_namespaceObject.createElement)("feComponentTransfer", {
|
| 32487 |
// Use sRGB instead of linearRGB to be consistent with how CSS gradients work.
|
| 32488 |
colorInterpolationFilters: "sRGB"
|
| 32495 |
}), (0,external_wp_element_namespaceObject.createElement)("feFuncB", {
|
| 32496 |
type: "table",
|
| 32497 |
tableValues: values.b.join(' ')
|
| 32498 |
+
}), (0,external_wp_element_namespaceObject.createElement)("feFuncA", {
|
| 32499 |
+
type: "table",
|
| 32500 |
+
tableValues: values.a.join(' ')
|
| 32501 |
+
})), (0,external_wp_element_namespaceObject.createElement)("feComposite", {
|
| 32502 |
+
// Re-mask the image with the original transparency since the feColorMatrix above loses that information.
|
| 32503 |
+
in2: "SourceGraphic",
|
| 32504 |
+
operator: "in"
|
| 32505 |
+
})))), (0,external_wp_element_namespaceObject.createElement)("style", {
|
| 32506 |
dangerouslySetInnerHTML: {
|
| 32507 |
__html: stylesheet
|
| 32508 |
}
|
| 33549 |
icon: setIcon(),
|
| 33550 |
label: label,
|
| 33551 |
toggleProps: {
|
| 33552 |
+
describedBy
|
|
|
|
| 33553 |
},
|
| 33554 |
popoverProps: ui_POPOVER_PROPS,
|
| 33555 |
controls: alignmentControls.map(control => {
|
| 33654 |
return {
|
| 33655 |
key: `block-${blockItem.id}`,
|
| 33656 |
value: blockItem,
|
| 33657 |
+
label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(block_icon, {
|
| 33658 |
key: "icon",
|
| 33659 |
icon: icon,
|
| 33660 |
showColors: true
|
| 34212 |
isSelected,
|
| 34213 |
adjustScrolling: false,
|
| 34214 |
enableAnimation: true,
|
| 34215 |
+
triggerAnimationOnChange: path
|
| 34216 |
});
|
| 34217 |
return (0,external_wp_element_namespaceObject.createElement)(AnimatedTreeGridRow, _extends({
|
| 34218 |
ref: ref,
|
| 34337 |
draggable: draggable
|
| 34338 |
}, (0,external_wp_element_namespaceObject.createElement)(ListViewExpander, {
|
| 34339 |
onClick: onToggleExpanded
|
| 34340 |
+
}), (0,external_wp_element_namespaceObject.createElement)(block_icon, {
|
| 34341 |
icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon,
|
| 34342 |
showColors: true
|
| 34343 |
}), (0,external_wp_element_namespaceObject.createElement)(BlockTitle, {
|
| 34464 |
|
| 34465 |
|
| 34466 |
|
| 34467 |
+
|
| 34468 |
function ListViewBlock({
|
| 34469 |
block,
|
|
|
|
| 34470 |
isDragged,
|
| 34471 |
+
isSelected,
|
| 34472 |
isBranchSelected,
|
| 34473 |
+
selectBlock,
|
|
|
|
|
|
|
| 34474 |
position,
|
| 34475 |
level,
|
| 34476 |
rowCount,
|
| 34487 |
const {
|
| 34488 |
toggleBlockHighlight
|
| 34489 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
| 34490 |
+
const {
|
| 34491 |
+
__experimentalFeatures: withExperimentalFeatures,
|
| 34492 |
+
__experimentalPersistentListViewFeatures: withExperimentalPersistentListViewFeatures,
|
| 34493 |
+
__experimentalHideContainerBlockActions: hideContainerBlockActions,
|
| 34494 |
+
isTreeGridMounted,
|
| 34495 |
+
expand,
|
| 34496 |
+
collapse
|
| 34497 |
+
} = useListViewContext();
|
| 34498 |
const hasSiblings = siblingBlockCount > 0;
|
| 34499 |
const hasRenderedMovers = showBlockMovers && hasSiblings;
|
| 34500 |
const moverCellClassName = classnames_default()('block-editor-list-view-block__mover-cell', {
|
| 34501 |
'is-visible': isHovered || isSelected
|
| 34502 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34503 |
const listViewBlockSettingsClassName = classnames_default()('block-editor-list-view-block__menu-cell', {
|
| 34504 |
'is-visible': isHovered || isSelected
|
| 34505 |
}); // If ListView has experimental features related to the Persistent List View,
|
| 34512 |
}
|
| 34513 |
}, []);
|
| 34514 |
const highlightBlock = withExperimentalPersistentListViewFeatures ? toggleBlockHighlight : () => {};
|
| 34515 |
+
const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => {
|
|
|
|
| 34516 |
setIsHovered(true);
|
| 34517 |
highlightBlock(clientId, true);
|
| 34518 |
+
}, [clientId, setIsHovered, highlightBlock]);
|
| 34519 |
+
const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => {
|
|
|
|
| 34520 |
setIsHovered(false);
|
| 34521 |
highlightBlock(clientId, false);
|
| 34522 |
+
}, [clientId, setIsHovered, highlightBlock]);
|
| 34523 |
+
const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)(event => {
|
| 34524 |
+
event.stopPropagation();
|
| 34525 |
+
selectBlock(clientId);
|
| 34526 |
+
}, [clientId, selectBlock]);
|
| 34527 |
+
const toggleExpanded = (0,external_wp_element_namespaceObject.useCallback)(event => {
|
| 34528 |
+
event.stopPropagation();
|
| 34529 |
+
|
| 34530 |
+
if (isExpanded === true) {
|
| 34531 |
+
collapse(clientId);
|
| 34532 |
+
} else if (isExpanded === false) {
|
| 34533 |
+
expand(clientId);
|
| 34534 |
+
}
|
| 34535 |
+
}, [clientId, expand, collapse, isExpanded]);
|
| 34536 |
+
const showBlockActions = withExperimentalFeatures && ( //hide actions for blocks like core/widget-areas
|
| 34537 |
+
!hideContainerBlockActions || hideContainerBlockActions && level > 1);
|
| 34538 |
+
const hideBlockActions = withExperimentalFeatures && !showBlockActions;
|
| 34539 |
+
let colSpan;
|
| 34540 |
+
|
| 34541 |
+
if (hasRenderedMovers) {
|
| 34542 |
+
colSpan = 2;
|
| 34543 |
+
} else if (hideBlockActions) {
|
| 34544 |
+
colSpan = 3;
|
| 34545 |
+
}
|
| 34546 |
|
| 34547 |
const classes = classnames_default()({
|
| 34548 |
'is-selected': isSelected,
|
| 34549 |
'is-branch-selected': withExperimentalPersistentListViewFeatures && isBranchSelected,
|
| 34550 |
+
'is-dragging': isDragged,
|
| 34551 |
+
'has-single-cell': hideBlockActions
|
| 34552 |
});
|
| 34553 |
return (0,external_wp_element_namespaceObject.createElement)(ListViewLeaf, {
|
| 34554 |
className: classes,
|
| 34565 |
isExpanded: isExpanded
|
| 34566 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, {
|
| 34567 |
className: "block-editor-list-view-block__contents-cell",
|
| 34568 |
+
colSpan: colSpan,
|
| 34569 |
ref: cellRef
|
| 34570 |
}, ({
|
| 34571 |
ref,
|
| 34575 |
className: "block-editor-list-view-block__contents-container"
|
| 34576 |
}, (0,external_wp_element_namespaceObject.createElement)(block_contents, {
|
| 34577 |
block: block,
|
| 34578 |
+
onClick: selectEditorBlock,
|
| 34579 |
+
onToggleExpanded: toggleExpanded,
|
| 34580 |
isSelected: isSelected,
|
| 34581 |
position: position,
|
| 34582 |
siblingBlockCount: siblingBlockCount,
|
| 34607 |
ref: ref,
|
| 34608 |
tabIndex: tabIndex,
|
| 34609 |
onFocus: onFocus
|
| 34610 |
+
})))), showBlockActions && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, {
|
| 34611 |
className: listViewBlockSettingsClassName
|
| 34612 |
}, ({
|
| 34613 |
ref,
|
| 34623 |
onFocus
|
| 34624 |
},
|
| 34625 |
disableOpenOnArrowDown: true,
|
| 34626 |
+
__experimentalSelectBlock: selectEditorBlock
|
| 34627 |
})));
|
| 34628 |
}
|
| 34629 |
+
|
| 34630 |
+
/* harmony default export */ var list_view_block = ((0,external_wp_element_namespaceObject.memo)(ListViewBlock));
|
| 34631 |
//# sourceMappingURL=block.js.map
|
| 34632 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/list-view/branch.js
|
| 34633 |
|
| 34634 |
|
| 34635 |
/**
|
| 34642 |
|
| 34643 |
|
| 34644 |
|
|
|
|
|
|
|
| 34645 |
/**
|
| 34646 |
* Internal dependencies
|
| 34647 |
*/
|
| 34649 |
|
| 34650 |
|
| 34651 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34652 |
/**
|
| 34653 |
+
* Given a block, returns the total number of blocks in that subtree. This is used to help determine
|
| 34654 |
+
* the list position of a block.
|
| 34655 |
+
*
|
| 34656 |
+
* When a block is collapsed, we do not count their children as part of that total. In the current drag
|
| 34657 |
+
* implementation dragged blocks and their children are not counted.
|
| 34658 |
+
*
|
| 34659 |
+
* @param {Object} block block tree
|
| 34660 |
+
* @param {Object} expandedState state that notes which branches are collapsed
|
| 34661 |
+
* @param {Array} draggedClientIds a list of dragged client ids
|
| 34662 |
+
* @return {number} block count
|
| 34663 |
*/
|
| 34664 |
|
| 34665 |
+
function countBlocks(block, expandedState, draggedClientIds) {
|
| 34666 |
+
var _expandedState$block$;
|
|
|
|
| 34667 |
|
| 34668 |
+
const isDragged = draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.includes(block.clientId);
|
| 34669 |
|
| 34670 |
+
if (isDragged) {
|
| 34671 |
+
return 0;
|
| 34672 |
+
}
|
| 34673 |
+
|
| 34674 |
+
const isExpanded = (_expandedState$block$ = expandedState[block.clientId]) !== null && _expandedState$block$ !== void 0 ? _expandedState$block$ : true;
|
| 34675 |
+
|
| 34676 |
+
if (isExpanded) {
|
| 34677 |
+
return 1 + block.innerBlocks.reduce(countReducer(expandedState, draggedClientIds), 0);
|
| 34678 |
+
}
|
| 34679 |
+
|
| 34680 |
+
return 1;
|
| 34681 |
+
}
|
| 34682 |
|
| 34683 |
+
const countReducer = (expandedState, draggedClientIds) => (count, block) => {
|
| 34684 |
+
var _expandedState$block$2;
|
| 34685 |
|
| 34686 |
+
const isDragged = draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.includes(block.clientId);
|
| 34687 |
|
| 34688 |
+
if (isDragged) {
|
| 34689 |
+
return count;
|
| 34690 |
+
}
|
| 34691 |
|
| 34692 |
+
const isExpanded = (_expandedState$block$2 = expandedState[block.clientId]) !== null && _expandedState$block$2 !== void 0 ? _expandedState$block$2 : true;
|
| 34693 |
+
|
| 34694 |
+
if (isExpanded && block.innerBlocks.length > 0) {
|
| 34695 |
+
return count + countBlocks(block, expandedState, draggedClientIds);
|
| 34696 |
+
}
|
| 34697 |
+
|
| 34698 |
+
return count + 1;
|
| 34699 |
+
};
|
| 34700 |
|
| 34701 |
function ListViewBranch(props) {
|
| 34702 |
const {
|
| 34703 |
blocks,
|
| 34704 |
selectBlock,
|
|
|
|
| 34705 |
showBlockMovers,
|
| 34706 |
showNestedBlocks,
|
| 34707 |
+
selectedClientIds,
|
| 34708 |
level = 1,
|
| 34709 |
+
path = '',
|
|
|
|
| 34710 |
isBranchSelected = false,
|
| 34711 |
+
listPosition = 0,
|
| 34712 |
+
fixedListWindow
|
| 34713 |
} = props;
|
| 34714 |
const {
|
| 34715 |
expandedState,
|
|
|
|
|
|
|
| 34716 |
draggedClientIds,
|
| 34717 |
+
__experimentalPersistentListViewFeatures
|
| 34718 |
} = useListViewContext();
|
|
|
|
| 34719 |
const filteredBlocks = (0,external_lodash_namespaceObject.compact)(blocks);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34720 |
const blockCount = filteredBlocks.length;
|
| 34721 |
+
let nextPosition = listPosition;
|
| 34722 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, filteredBlocks.map((block, index) => {
|
|
|
|
| 34723 |
var _expandedState$client;
|
| 34724 |
|
| 34725 |
const {
|
| 34726 |
clientId,
|
| 34727 |
innerBlocks
|
| 34728 |
} = block;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34729 |
|
| 34730 |
+
if (index > 0) {
|
| 34731 |
+
nextPosition += countBlocks(filteredBlocks[index - 1], expandedState, draggedClientIds);
|
| 34732 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34733 |
|
| 34734 |
+
const usesWindowing = __experimentalPersistentListViewFeatures;
|
| 34735 |
+
const {
|
| 34736 |
+
itemInView
|
| 34737 |
+
} = fixedListWindow;
|
| 34738 |
+
const blockInView = !usesWindowing || itemInView(nextPosition);
|
| 34739 |
+
const position = index + 1;
|
| 34740 |
+
const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`;
|
| 34741 |
+
const hasNestedBlocks = showNestedBlocks && !!innerBlocks && !!innerBlocks.length;
|
| 34742 |
+
const isExpanded = hasNestedBlocks ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : true : undefined;
|
| 34743 |
+
const isDragged = !!(draggedClientIds !== null && draggedClientIds !== void 0 && draggedClientIds.includes(clientId));
|
| 34744 |
+
const showBlock = isDragged || blockInView; // Make updates to the selected or dragged blocks synchronous,
|
| 34745 |
// but asynchronous for any other block.
|
| 34746 |
|
| 34747 |
+
const isSelected = isClientIdSelected(clientId, selectedClientIds);
|
| 34748 |
+
const isSelectedBranch = isBranchSelected || isSelected && hasNestedBlocks;
|
| 34749 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, {
|
| 34750 |
key: clientId,
|
| 34751 |
value: !isSelected
|
| 34752 |
+
}, showBlock && (0,external_wp_element_namespaceObject.createElement)(list_view_block, {
|
| 34753 |
block: block,
|
| 34754 |
+
selectBlock: selectBlock,
|
|
|
|
|
|
|
| 34755 |
isSelected: isSelected,
|
| 34756 |
isBranchSelected: isSelectedBranch,
|
| 34757 |
+
isDragged: isDragged,
|
| 34758 |
level: level,
|
| 34759 |
position: position,
|
| 34760 |
+
rowCount: blockCount,
|
| 34761 |
siblingBlockCount: blockCount,
|
| 34762 |
showBlockMovers: showBlockMovers,
|
|
|
|
| 34763 |
path: updatedPath,
|
| 34764 |
+
isExpanded: isExpanded,
|
| 34765 |
+
listPosition: nextPosition
|
| 34766 |
+
}), !showBlock && (0,external_wp_element_namespaceObject.createElement)("tr", null, (0,external_wp_element_namespaceObject.createElement)("td", {
|
| 34767 |
+
className: "block-editor-list-view-placeholder"
|
| 34768 |
+
})), hasNestedBlocks && isExpanded && !isDragged && (0,external_wp_element_namespaceObject.createElement)(ListViewBranch, {
|
| 34769 |
blocks: innerBlocks,
|
| 34770 |
selectBlock: selectBlock,
|
|
|
|
|
|
|
|
|
|
| 34771 |
showBlockMovers: showBlockMovers,
|
| 34772 |
showNestedBlocks: showNestedBlocks,
|
|
|
|
| 34773 |
level: level + 1,
|
| 34774 |
+
path: updatedPath,
|
| 34775 |
+
listPosition: nextPosition + 1,
|
| 34776 |
+
fixedListWindow: fixedListWindow,
|
| 34777 |
+
isBranchSelected: isSelectedBranch,
|
| 34778 |
+
selectedClientIds: selectedClientIds
|
| 34779 |
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34780 |
}));
|
| 34781 |
}
|
| 34782 |
+
|
| 34783 |
ListViewBranch.defaultProps = {
|
| 34784 |
selectBlock: () => {}
|
| 34785 |
};
|
| 34786 |
+
/* harmony default export */ var branch = ((0,external_wp_element_namespaceObject.memo)(ListViewBranch));
|
| 34787 |
//# sourceMappingURL=branch.js.map
|
| 34788 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/list-view/drop-indicator.js
|
| 34789 |
|
| 34904 |
*/
|
| 34905 |
|
| 34906 |
|
| 34907 |
+
function useListViewClientIds(blocks) {
|
| 34908 |
+
return (0,external_wp_data_namespaceObject.useSelect)(select => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34909 |
const {
|
| 34910 |
+
getDraggedBlockClientIds,
|
| 34911 |
getSelectedBlockClientIds,
|
| 34912 |
+
__unstableGetClientIdsTree
|
| 34913 |
} = select(store);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34914 |
return {
|
| 34915 |
+
selectedClientIds: getSelectedBlockClientIds(),
|
| 34916 |
+
draggedClientIds: getDraggedBlockClientIds(),
|
| 34917 |
+
clientIdsTree: blocks ? blocks : __unstableGetClientIdsTree()
|
| 34918 |
};
|
| 34919 |
+
}, [blocks]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34920 |
}
|
| 34921 |
//# sourceMappingURL=use-list-view-client-ids.js.map
|
| 34922 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/list-view/use-list-view-drop-zone.js
|
| 35207 |
* @param {Array} props.blocks Custom subset of block client IDs to be used instead of the default hierarchy.
|
| 35208 |
* @param {Function} props.onSelect Block selection callback.
|
| 35209 |
* @param {boolean} props.showNestedBlocks Flag to enable displaying nested blocks.
|
| 35210 |
+
* @param {boolean} props.showBlockMovers Flag to enable block movers
|
| 35211 |
* @param {boolean} props.__experimentalFeatures Flag to enable experimental features.
|
| 35212 |
* @param {boolean} props.__experimentalPersistentListViewFeatures Flag to enable features for the Persistent List View experiment.
|
| 35213 |
+
* @param {boolean} props.__experimentalHideContainerBlockActions Flag to hide actions of top level blocks (like core/widget-area)
|
| 35214 |
* @param {Object} ref Forwarded ref
|
| 35215 |
*/
|
| 35216 |
|
| 35217 |
|
| 35218 |
function ListView({
|
| 35219 |
blocks,
|
|
|
|
| 35220 |
onSelect = list_view_noop,
|
| 35221 |
__experimentalFeatures,
|
| 35222 |
__experimentalPersistentListViewFeatures,
|
| 35223 |
+
__experimentalHideContainerBlockActions,
|
| 35224 |
+
showNestedBlocks,
|
| 35225 |
+
showBlockMovers,
|
| 35226 |
...props
|
| 35227 |
}, ref) {
|
| 35228 |
const {
|
| 35229 |
clientIdsTree,
|
| 35230 |
+
draggedClientIds,
|
| 35231 |
+
selectedClientIds
|
| 35232 |
+
} = useListViewClientIds(blocks);
|
| 35233 |
const {
|
| 35234 |
selectBlock
|
| 35235 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
| 35236 |
+
const {
|
| 35237 |
+
visibleBlockCount
|
| 35238 |
+
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
| 35239 |
+
const {
|
| 35240 |
+
getGlobalBlockCount,
|
| 35241 |
+
getClientIdsOfDescendants
|
| 35242 |
+
} = select(store);
|
| 35243 |
+
const draggedBlockCount = (draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.length) > 0 ? getClientIdsOfDescendants(draggedClientIds).length + 1 : 0;
|
| 35244 |
+
return {
|
| 35245 |
+
visibleBlockCount: getGlobalBlockCount() - draggedBlockCount
|
| 35246 |
+
};
|
| 35247 |
+
}, [draggedClientIds]);
|
| 35248 |
const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)(clientId => {
|
| 35249 |
selectBlock(clientId);
|
| 35250 |
onSelect(clientId);
|
| 35259 |
const isMounted = (0,external_wp_element_namespaceObject.useRef)(false);
|
| 35260 |
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
| 35261 |
isMounted.current = true;
|
| 35262 |
+
}, []); // List View renders a fixed number of items and relies on each having a fixed item height of 36px.
|
| 35263 |
+
// If this value changes, we should also change the itemHeight value set in useFixedWindowList.
|
| 35264 |
+
// See: https://github.com/WordPress/gutenberg/pull/35230 for additional context.
|
| 35265 |
+
|
| 35266 |
+
const [fixedListWindow] = (0,external_wp_compose_namespaceObject.__experimentalUseFixedWindowList)(elementRef, 36, visibleBlockCount, {
|
| 35267 |
+
useWindowing: __experimentalPersistentListViewFeatures,
|
| 35268 |
+
windowOverscan: 40
|
| 35269 |
+
});
|
| 35270 |
const expand = (0,external_wp_element_namespaceObject.useCallback)(clientId => {
|
| 35271 |
if (!clientId) {
|
| 35272 |
return;
|
| 35287 |
clientId
|
| 35288 |
});
|
| 35289 |
}, [setExpandedState]);
|
| 35290 |
+
const expandRow = (0,external_wp_element_namespaceObject.useCallback)(row => {
|
|
|
|
| 35291 |
var _row$dataset;
|
| 35292 |
|
| 35293 |
expand(row === null || row === void 0 ? void 0 : (_row$dataset = row.dataset) === null || _row$dataset === void 0 ? void 0 : _row$dataset.block);
|
| 35294 |
+
}, [expand]);
|
| 35295 |
+
const collapseRow = (0,external_wp_element_namespaceObject.useCallback)(row => {
|
|
|
|
| 35296 |
var _row$dataset2;
|
| 35297 |
|
| 35298 |
collapse(row === null || row === void 0 ? void 0 : (_row$dataset2 = row.dataset) === null || _row$dataset2 === void 0 ? void 0 : _row$dataset2.block);
|
| 35299 |
+
}, [collapse]);
|
|
|
|
| 35300 |
const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
|
| 35301 |
__experimentalFeatures,
|
| 35302 |
__experimentalPersistentListViewFeatures,
|
| 35303 |
+
__experimentalHideContainerBlockActions,
|
| 35304 |
isTreeGridMounted: isMounted.current,
|
| 35305 |
draggedClientIds,
|
|
|
|
| 35306 |
expandedState,
|
| 35307 |
expand,
|
| 35308 |
collapse
|
| 35309 |
+
}), [__experimentalFeatures, __experimentalPersistentListViewFeatures, __experimentalHideContainerBlockActions, isMounted.current, draggedClientIds, expandedState, expand, collapse]);
|
| 35310 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, {
|
| 35311 |
value: true
|
| 35312 |
}, (0,external_wp_element_namespaceObject.createElement)(ListViewDropIndicator, {
|
| 35320 |
onExpandRow: expandRow
|
| 35321 |
}, (0,external_wp_element_namespaceObject.createElement)(ListViewContext.Provider, {
|
| 35322 |
value: contextValue
|
| 35323 |
+
}, (0,external_wp_element_namespaceObject.createElement)(branch, _extends({
|
| 35324 |
blocks: clientIdsTree,
|
| 35325 |
+
selectBlock: selectEditorBlock,
|
| 35326 |
+
showNestedBlocks: showNestedBlocks,
|
| 35327 |
+
showBlockMovers: showBlockMovers,
|
| 35328 |
+
fixedListWindow: fixedListWindow,
|
| 35329 |
+
selectedClientIds: selectedClientIds
|
| 35330 |
}, props)))));
|
| 35331 |
}
|
| 35332 |
|
| 35397 |
className: "block-editor-block-navigation__label"
|
| 35398 |
}, (0,external_wp_i18n_namespaceObject.__)('List view')), (0,external_wp_element_namespaceObject.createElement)(components_list_view, {
|
| 35399 |
showNestedBlocks: true,
|
|
|
|
| 35400 |
__experimentalFeatures: __experimentalFeatures
|
| 35401 |
}))
|
| 35402 |
});
|
| 37939 |
selectedSuggestion
|
| 37940 |
} = this.state;
|
| 37941 |
const {
|
| 37942 |
+
value,
|
| 37943 |
+
__experimentalShowInitialSuggestions = false
|
| 37944 |
} = this.props; // only have to worry about scrolling selected suggestion into view
|
| 37945 |
// when already expanded
|
| 37946 |
|
| 37952 |
this.props.setTimeout(() => {
|
| 37953 |
this.scrollingIntoView = false;
|
| 37954 |
}, 100);
|
| 37955 |
+
} // Update suggestions when the value changes
|
| 37956 |
|
| 37957 |
|
| 37958 |
+
if (prevProps.value !== value && !this.props.disableSuggestions && !this.isUpdatingSuggestions) {
|
| 37959 |
+
if (value !== null && value !== void 0 && value.length) {
|
| 37960 |
+
// If the new value is not empty we need to update with suggestions for it
|
| 37961 |
+
this.updateSuggestions(value);
|
| 37962 |
+
} else if (__experimentalShowInitialSuggestions) {
|
| 37963 |
+
// If the new value is empty and we can show initial suggestions, then show initial suggestions
|
| 37964 |
+
this.updateSuggestions();
|
| 37965 |
+
}
|
| 37966 |
}
|
| 37967 |
}
|
| 37968 |
|
| 38762 |
* External dependencies
|
| 38763 |
*/
|
| 38764 |
|
| 38765 |
+
|
| 38766 |
/**
|
| 38767 |
* WordPress dependencies
|
| 38768 |
*/
|
| 38800 |
showInitialSuggestions = false,
|
| 38801 |
suggestionsQuery = {},
|
| 38802 |
withURLSuggestion = true,
|
| 38803 |
+
createSuggestionButtonText,
|
| 38804 |
+
useLabel = false
|
| 38805 |
}, ref) => {
|
| 38806 |
const genericSearchHandler = useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion, withURLSuggestion);
|
| 38807 |
const searchHandler = showSuggestions ? fetchSuggestions || genericSearchHandler : noopSearchHandler;
|
| 38861 |
}
|
| 38862 |
};
|
| 38863 |
|
| 38864 |
+
const inputClasses = classnames_default()(className, {
|
| 38865 |
+
'has-no-label': !useLabel
|
| 38866 |
+
});
|
| 38867 |
+
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 38868 |
+
className: "block-editor-link-control__search-input-container"
|
| 38869 |
+
}, (0,external_wp_element_namespaceObject.createElement)(url_input, {
|
| 38870 |
+
label: useLabel ? 'URL' : undefined,
|
| 38871 |
+
className: inputClasses,
|
| 38872 |
value: value,
|
| 38873 |
onChange: onInputChange,
|
| 38874 |
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : (0,external_wp_i18n_namespaceObject.__)('Search or type url'),
|
| 38910 |
}));
|
| 38911 |
/* harmony default export */ var library_info = (info);
|
| 38912 |
//# sourceMappingURL=info.js.map
|
| 38913 |
+
;// CONCATENATED MODULE: ./packages/icons/build-module/library/pencil.js
|
| 38914 |
+
|
| 38915 |
+
|
| 38916 |
+
/**
|
| 38917 |
+
* WordPress dependencies
|
| 38918 |
+
*/
|
| 38919 |
+
|
| 38920 |
+
const pencil = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
| 38921 |
+
xmlns: "http://www.w3.org/2000/svg",
|
| 38922 |
+
viewBox: "0 0 24 24"
|
| 38923 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
| 38924 |
+
d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"
|
| 38925 |
+
}));
|
| 38926 |
+
/* harmony default export */ var library_pencil = (pencil);
|
| 38927 |
+
//# sourceMappingURL=pencil.js.map
|
| 38928 |
+
;// CONCATENATED MODULE: ./packages/icons/build-module/library/edit.js
|
| 38929 |
+
/**
|
| 38930 |
+
* Internal dependencies
|
| 38931 |
+
*/
|
| 38932 |
+
|
| 38933 |
+
/* harmony default export */ var library_edit = (library_pencil);
|
| 38934 |
+
//# sourceMappingURL=edit.js.map
|
| 38935 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/link-control/viewer-slot.js
|
| 38936 |
/**
|
| 38937 |
* WordPress dependencies
|
| 39046 |
|
| 39047 |
|
| 39048 |
|
| 39049 |
+
|
| 39050 |
/**
|
| 39051 |
* Internal dependencies
|
| 39052 |
*/
|
| 39056 |
function LinkPreview({
|
| 39057 |
value,
|
| 39058 |
onEditClick,
|
| 39059 |
+
hasRichPreviews = false,
|
| 39060 |
+
hasUnlinkControl = false,
|
| 39061 |
+
onRemove
|
| 39062 |
}) {
|
| 39063 |
// Avoid fetching if rich previews are not desired.
|
| 39064 |
const showRichPreviews = hasRichPreviews ? value === null || value === void 0 ? void 0 : value.url : null;
|
| 39069 |
|
| 39070 |
const hasRichData = richData && Object.keys(richData).length;
|
| 39071 |
const displayURL = value && (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(value.url), 16) || '';
|
| 39072 |
+
const displayTitle = (richData === null || richData === void 0 ? void 0 : richData.title) || (value === null || value === void 0 ? void 0 : value.title) || displayURL;
|
| 39073 |
const isEmptyURL = !value.url.length;
|
| 39074 |
let icon;
|
| 39075 |
|
| 39112 |
}, !isEmptyURL ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
|
| 39113 |
className: "block-editor-link-control__search-item-title",
|
| 39114 |
href: value.url
|
| 39115 |
+
}, (0,external_wp_dom_namespaceObject.__unstableStripHTML)(displayTitle)), (value === null || value === void 0 ? void 0 : value.url) && (0,external_wp_element_namespaceObject.createElement)("span", {
|
| 39116 |
className: "block-editor-link-control__search-item-info"
|
| 39117 |
}, displayURL)) : (0,external_wp_element_namespaceObject.createElement)("span", {
|
| 39118 |
className: "block-editor-link-control__search-item-error-notice"
|
| 39119 |
}, "Link is empty"))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
| 39120 |
+
icon: library_edit,
|
| 39121 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Edit'),
|
| 39122 |
+
className: "block-editor-link-control__search-item-action",
|
| 39123 |
+
onClick: onEditClick,
|
| 39124 |
+
iconSize: 24
|
| 39125 |
+
}), hasUnlinkControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
| 39126 |
+
icon: link_off,
|
| 39127 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Unlink'),
|
| 39128 |
+
className: "block-editor-link-control__search-item-action block-editor-link-control__unlink",
|
| 39129 |
+
onClick: onRemove,
|
| 39130 |
+
iconSize: 24
|
| 39131 |
+
}), (0,external_wp_element_namespaceObject.createElement)(ViewerSlot, {
|
| 39132 |
fillProps: value
|
| 39133 |
})), (hasRichData && ((richData === null || richData === void 0 ? void 0 : richData.image) || (richData === null || richData === void 0 ? void 0 : richData.description)) || isFetching) && (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 39134 |
className: "block-editor-link-control__search-item-bottom"
|
| 39237 |
* External dependencies
|
| 39238 |
*/
|
| 39239 |
|
| 39240 |
+
|
| 39241 |
/**
|
| 39242 |
* WordPress dependencies
|
| 39243 |
*/
|
| 39330 |
* @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.
|
| 39331 |
* @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.
|
| 39332 |
* @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.
|
| 39333 |
+
* @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.
|
| 39334 |
*/
|
| 39335 |
|
| 39336 |
/**
|
| 39357 |
suggestionsQuery = {},
|
| 39358 |
noURLSuggestion = false,
|
| 39359 |
createSuggestionButtonText,
|
| 39360 |
+
hasRichPreviews = false,
|
| 39361 |
+
hasTextControl = false,
|
| 39362 |
+
renderControlBottom = null
|
| 39363 |
}) {
|
| 39364 |
+
var _currentInputValue$tr, _value$url, _value$url$trim;
|
| 39365 |
|
| 39366 |
if (withCreateSuggestion === undefined && createSuggestion) {
|
| 39367 |
withCreateSuggestion = true;
|
| 39369 |
|
| 39370 |
const isMounting = (0,external_wp_element_namespaceObject.useRef)(true);
|
| 39371 |
const wrapperNode = (0,external_wp_element_namespaceObject.useRef)();
|
| 39372 |
+
const textInputRef = (0,external_wp_element_namespaceObject.useRef)();
|
| 39373 |
+
const [internalInputValue, setInternalInputValue] = (0,external_wp_element_namespaceObject.useState)((value === null || value === void 0 ? void 0 : value.url) || '');
|
| 39374 |
+
const [internalTextValue, setInternalTextValue] = (0,external_wp_element_namespaceObject.useState)((value === null || value === void 0 ? void 0 : value.title) || '');
|
| 39375 |
const currentInputValue = propInputValue || internalInputValue;
|
| 39376 |
const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(forceIsEditingLink !== undefined ? forceIsEditingLink : !value || !value.url);
|
| 39377 |
const isEndingEditWithFocus = (0,external_wp_element_namespaceObject.useRef)(false);
|
| 39382 |
}
|
| 39383 |
}, [forceIsEditingLink]);
|
| 39384 |
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
| 39385 |
+
// We don't auto focus into the Link UI on mount
|
| 39386 |
+
// because otherwise using the keyboard to select text
|
| 39387 |
+
// *within* the link format is not possible.
|
| 39388 |
if (isMounting.current) {
|
| 39389 |
isMounting.current = false;
|
| 39390 |
return;
|
| 39391 |
+
} // Unless we are mounting, we always want to focus either:
|
| 39392 |
+
// - the URL input
|
| 39393 |
+
// - the first focusable element in the Link UI.
|
| 39394 |
+
// But in editing mode if there is a text input present then
|
| 39395 |
+
// the URL input is at index 1. If not then it is at index 0.
|
| 39396 |
|
| 39397 |
|
| 39398 |
+
const whichFocusTargetIndex = textInputRef !== null && textInputRef !== void 0 && textInputRef.current ? 1 : 0; // Scenario - when:
|
| 39399 |
+
// - switching between editable and non editable LinkControl
|
| 39400 |
+
// - clicking on a link
|
| 39401 |
+
// ...then move focus to the *first* element to avoid focus loss
|
| 39402 |
+
// and to ensure focus is *within* the Link UI.
|
| 39403 |
+
|
| 39404 |
+
const nextFocusTarget = external_wp_dom_namespaceObject.focus.focusable.find(wrapperNode.current)[whichFocusTargetIndex] || wrapperNode.current;
|
| 39405 |
nextFocusTarget.focus();
|
| 39406 |
isEndingEditWithFocus.current = false;
|
| 39407 |
}, [isEditingLink]);
|
| 39408 |
+
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
| 39409 |
+
/**
|
| 39410 |
+
* If the value's `text` property changes then sync this
|
| 39411 |
+
* back up with state.
|
| 39412 |
+
*/
|
| 39413 |
+
if (value !== null && value !== void 0 && value.title && value.title !== internalTextValue) {
|
| 39414 |
+
setInternalTextValue(value.title);
|
| 39415 |
+
}
|
| 39416 |
+
/**
|
| 39417 |
+
* Update the state value internalInputValue if the url value changes
|
| 39418 |
+
* for example when clicking on another anchor
|
| 39419 |
+
*/
|
| 39420 |
+
|
| 39421 |
+
|
| 39422 |
+
if (value !== null && value !== void 0 && value.url) {
|
| 39423 |
+
setInternalInputValue(value.url);
|
| 39424 |
+
}
|
| 39425 |
+
}, [value]);
|
| 39426 |
/**
|
| 39427 |
* Cancels editing state and marks that focus may need to be restored after
|
| 39428 |
* the next render, if focus was within the wrapper when editing finished.
|
| 39442 |
} = useCreatePage(createSuggestion);
|
| 39443 |
|
| 39444 |
const handleSelectSuggestion = updatedValue => {
|
| 39445 |
+
onChange({ ...updatedValue,
|
| 39446 |
+
title: internalTextValue || (updatedValue === null || updatedValue === void 0 ? void 0 : updatedValue.title)
|
| 39447 |
+
});
|
| 39448 |
stopEditing();
|
| 39449 |
};
|
| 39450 |
|
| 39451 |
+
const handleSubmit = () => {
|
| 39452 |
+
if (currentInputValue !== (value === null || value === void 0 ? void 0 : value.url) || internalTextValue !== (value === null || value === void 0 ? void 0 : value.title)) {
|
| 39453 |
onChange({
|
| 39454 |
+
url: currentInputValue,
|
| 39455 |
+
title: internalTextValue
|
| 39456 |
});
|
| 39457 |
}
|
| 39458 |
|
| 39459 |
stopEditing();
|
| 39460 |
};
|
| 39461 |
|
| 39462 |
+
const handleSubmitWithEnter = event => {
|
| 39463 |
+
const {
|
| 39464 |
+
keyCode
|
| 39465 |
+
} = event;
|
| 39466 |
+
|
| 39467 |
+
if (keyCode === external_wp_keycodes_namespaceObject.ENTER && !currentInputIsEmpty // disallow submitting empty values.
|
| 39468 |
+
) {
|
| 39469 |
+
event.preventDefault();
|
| 39470 |
+
handleSubmit();
|
| 39471 |
+
}
|
| 39472 |
+
};
|
| 39473 |
+
|
| 39474 |
const shownUnlinkControl = onRemove && value && !isEditingLink && !isCreatingPage;
|
| 39475 |
+
const showSettingsDrawer = !!(settings !== null && settings !== void 0 && settings.length); // Only show text control once a URL value has been committed
|
| 39476 |
+
// and it isn't just empty whitespace.
|
| 39477 |
+
// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.
|
| 39478 |
+
|
| 39479 |
+
const showTextControl = (value === null || value === void 0 ? void 0 : (_value$url = value.url) === null || _value$url === void 0 ? void 0 : (_value$url$trim = _value$url.trim()) === null || _value$url$trim === void 0 ? void 0 : _value$url$trim.length) > 0 && hasTextControl;
|
| 39480 |
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 39481 |
tabIndex: -1,
|
| 39482 |
ref: wrapperNode,
|
| 39484 |
}, isCreatingPage && (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 39485 |
className: "block-editor-link-control__loading"
|
| 39486 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), " ", (0,external_wp_i18n_namespaceObject.__)('Creating'), "\u2026"), (isEditingLink || !value) && !isCreatingPage && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 39487 |
+
className: classnames_default()({
|
| 39488 |
+
'block-editor-link-control__search-input-wrapper': true,
|
| 39489 |
+
'has-text-control': showTextControl
|
| 39490 |
+
})
|
| 39491 |
+
}, showTextControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
|
| 39492 |
+
ref: textInputRef,
|
| 39493 |
+
className: "block-editor-link-control__field block-editor-link-control__text-content",
|
| 39494 |
+
label: "Text",
|
| 39495 |
+
value: internalTextValue,
|
| 39496 |
+
onChange: setInternalTextValue,
|
| 39497 |
+
onKeyDown: handleSubmitWithEnter
|
| 39498 |
+
}), (0,external_wp_element_namespaceObject.createElement)(search_input, {
|
| 39499 |
currentLink: value,
|
| 39500 |
+
className: "block-editor-link-control__field block-editor-link-control__search-input",
|
| 39501 |
placeholder: searchInputPlaceholder,
|
| 39502 |
value: currentInputValue,
|
| 39503 |
withCreateSuggestion: withCreateSuggestion,
|
| 39509 |
showSuggestions: showSuggestions,
|
| 39510 |
suggestionsQuery: suggestionsQuery,
|
| 39511 |
withURLSuggestion: !noURLSuggestion,
|
| 39512 |
+
createSuggestionButtonText: createSuggestionButtonText,
|
| 39513 |
+
useLabel: showTextControl
|
| 39514 |
}, (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 39515 |
className: "block-editor-link-control__search-actions"
|
| 39516 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
| 39517 |
+
onClick: handleSubmit,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39518 |
label: (0,external_wp_i18n_namespaceObject.__)('Submit'),
|
| 39519 |
icon: keyboard_return,
|
| 39520 |
className: "block-editor-link-control__search-submit",
|
| 39529 |
,
|
| 39530 |
value: value,
|
| 39531 |
onEditClick: () => setIsEditingLink(true),
|
| 39532 |
+
hasRichPreviews: hasRichPreviews,
|
| 39533 |
+
hasUnlinkControl: shownUnlinkControl,
|
| 39534 |
+
onRemove: onRemove
|
| 39535 |
+
}), showSettingsDrawer && (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 39536 |
className: "block-editor-link-control__tools"
|
| 39537 |
}, (0,external_wp_element_namespaceObject.createElement)(settings_drawer, {
|
| 39538 |
value: value,
|
| 39539 |
settings: settings,
|
| 39540 |
onChange: onChange
|
| 39541 |
+
})), renderControlBottom && renderControlBottom());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39542 |
}
|
| 39543 |
|
| 39544 |
LinkControl.ViewerFill = ViewerFill;
|
| 39808 |
};
|
| 39809 |
}), (0,external_wp_components_namespaceObject.withFilters)('editor.MediaReplaceFlow')])(MediaReplaceFlow));
|
| 39810 |
//# sourceMappingURL=index.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39811 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/url-popover/link-viewer-url.js
|
| 39812 |
|
| 39813 |
|
| 40421 |
toggleProps: { ...toggleProps,
|
| 40422 |
className: classnames_default()(toggleProps.className, {
|
| 40423 |
'is-pressed': hasActive
|
| 40424 |
+
}),
|
| 40425 |
+
describedBy: (0,external_wp_i18n_namespaceObject.__)('Displays more block tools')
|
| 40426 |
},
|
| 40427 |
controls: (0,external_lodash_namespaceObject.orderBy)(fills.map(([{
|
| 40428 |
props
|
| 41422 |
* WordPress dependencies
|
| 41423 |
*/
|
| 41424 |
|
| 41425 |
+
/**
|
| 41426 |
+
* External dependencies
|
| 41427 |
+
*/
|
| 41428 |
+
|
| 41429 |
+
|
| 41430 |
function FormatEdit({
|
| 41431 |
formatTypes,
|
| 41432 |
onChange,
|
| 41445 |
}
|
| 41446 |
|
| 41447 |
const activeFormat = (0,external_wp_richText_namespaceObject.getActiveFormat)(value, name);
|
| 41448 |
+
let isActive = activeFormat !== undefined;
|
| 41449 |
const activeObject = (0,external_wp_richText_namespaceObject.getActiveObject)(value);
|
| 41450 |
+
const isObjectActive = activeObject !== undefined && activeObject.type === name; // Edge case: un-collapsed link formats.
|
| 41451 |
+
// If there is a missing link format at either end of the selection
|
| 41452 |
+
// then we shouldn't show the Edit UI because the selection has exceeded
|
| 41453 |
+
// the bounds of the link format.
|
| 41454 |
+
// Also if the format objects don't match then we're dealing with two separate
|
| 41455 |
+
// links so we should not allow the link to be modified over the top.
|
| 41456 |
+
|
| 41457 |
+
if (name === 'core/link' && !(0,external_wp_richText_namespaceObject.isCollapsed)(value)) {
|
| 41458 |
+
const formats = value.formats;
|
| 41459 |
+
const linkFormatAtStart = (0,external_lodash_namespaceObject.find)(formats[value.start], {
|
| 41460 |
+
type: 'core/link'
|
| 41461 |
+
});
|
| 41462 |
+
const linkFormatAtEnd = (0,external_lodash_namespaceObject.find)(formats[value.end - 1], {
|
| 41463 |
+
type: 'core/link'
|
| 41464 |
+
});
|
| 41465 |
+
|
| 41466 |
+
if (!linkFormatAtStart || !linkFormatAtEnd || linkFormatAtStart !== linkFormatAtEnd) {
|
| 41467 |
+
isActive = false;
|
| 41468 |
+
}
|
| 41469 |
+
}
|
| 41470 |
+
|
| 41471 |
return (0,external_wp_element_namespaceObject.createElement)(Edit, {
|
| 41472 |
key: name,
|
| 41473 |
isActive: isActive,
|
| 42850 |
const words = (0,external_wp_wordcount_namespaceObject.count)((0,external_wp_blocks_namespaceObject.serialize)(blocks), 'words');
|
| 42851 |
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 42852 |
className: "block-editor-multi-selection-inspector__card"
|
| 42853 |
+
}, (0,external_wp_element_namespaceObject.createElement)(block_icon, {
|
| 42854 |
icon: library_stack,
|
| 42855 |
showColors: true
|
| 42856 |
}), (0,external_wp_element_namespaceObject.createElement)("div", {
|
| 43042 |
blockName: blockName
|
| 43043 |
}))), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, {
|
| 43044 |
bubblesVirtually: bubblesVirtually
|
| 43045 |
+
}), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, {
|
| 43046 |
+
__experimentalGroup: "typography",
|
| 43047 |
+
bubblesVirtually: bubblesVirtually,
|
| 43048 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Typography')
|
| 43049 |
}), (0,external_wp_element_namespaceObject.createElement)(inspector_controls.Slot, {
|
| 43050 |
__experimentalGroup: "dimensions",
|
| 43051 |
bubblesVirtually: bubblesVirtually,
|
| 44044 |
|
| 44045 |
|
| 44046 |
|
| 44047 |
+
|
| 44048 |
+
|
| 44049 |
|
| 44050 |
|
| 44051 |
|
build/block-editor/index.min.asset.php
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-shortcode', 'wp-token-list', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '
|
| 1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-shortcode', 'wp-token-list', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => 'cf3c0f2b1f8399684eb71d30af7906fd');
|
build/block-editor/index.min.js
CHANGED
|
@@ -1,88 +1,92 @@
|
|
| 1 |
-
!function(){var e={9367:function(e,t){var n,o;void 0===(o="function"==typeof(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&&d()},s=function(t){window.removeEventListener("resize",i,!1),e.removeEventListener("input",d,!1),e.removeEventListener("keyup",d,!1),e.removeEventListener("autosize:destroy",s,!1),e.removeEventListener("autosize:update",d,!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",d,!1),window.addEventListener("resize",i,!1),e.addEventListener("input",d,!1),e.addEventListener("autosize:update",d,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",r.set(e,{destroy:s,update:d}),"vertical"===(a=window.getComputedStyle(e,null)).resize?e.style.resize="none":"both"===a.resize&&(e.style.resize="horizontal"),t="content-box"===a.boxSizing?-(parseFloat(a.paddingTop)+parseFloat(a.paddingBottom)):parseFloat(a.borderTopWidth)+parseFloat(a.borderBottomWidth),isNaN(t)&&(t=0),d()}var a;function c(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function u(){if(0!==e.scrollHeight){var o=function(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}(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 d(){u();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"),u(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==n.overflowY&&(c("hidden"),u(),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)})),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})?n.apply(t,[e,t]):n)||(e.exports=o)},4184:function(e,t){var n;!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)for(var s in n)o.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},1934:function(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()}))]}},5913:function(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}function r(e){return{newPos:e.newPos,components:e.components.slice(0)}}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]:{},l=n.callback;"function"==typeof n&&(l=n,n={}),this.options=n;var i=this;function s(e){return l?(setTimeout((function(){l(void 0,e)}),0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e));var a=(t=this.removeEmpty(this.tokenize(t))).length,c=e.length,u=1,d=a+c,p=[{newPos:-1,components:[]}],m=this.extractCommon(p[0],t,e,0);if(p[0].newPos+1>=a&&m+1>=c)return s([{value:this.join(t),count:t.length}]);function f(){for(var n=-1*u;n<=u;n+=2){var l=void 0,d=p[n-1],m=p[n+1],f=(m?m.newPos:0)-n;d&&(p[n-1]=void 0);var g=d&&d.newPos+1<a,h=m&&0<=f&&f<c;if(g||h){if(!g||h&&d.newPos<m.newPos?(l=r(m),i.pushComponent(l.components,void 0,!0)):((l=d).newPos++,i.pushComponent(l.components,!0,void 0)),f=i.extractCommon(l,t,e,n),l.newPos+1>=a&&f+1>=c)return s(o(i,l.components,t,e,i.useLongestToken));p[n]=l}else p[n]=void 0}u++}if(l)!function e(){setTimeout((function(){if(u>d)return l();f()||e()}),0)}();else for(;u<=d;){var g=f();if(g)return g}},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("")}}},7630:function(e,t,n){"use strict";var o;t.Kx=function(e,t,n){return r.diff(e,t,n)};var r=new(((o=n(5913))&&o.__esModule?o:{default:o}).default)},9010:function(e,t,n){"use strict";var o=n(4657);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=!(!p||!t.frameElement),f=o.offset(e),g=o.outerHeight(e),h=o.outerWidth(e),b=void 0,v=void 0,k=void 0,_=void 0,y=void 0,E=void 0,C=void 0,S=void 0,w=void 0,B=void 0;m&&(t=t.document.scrollingElement||t.document.body),p||m?(C=t,B=o.height(C),w=o.width(C),S={left:o.scrollLeft(C),top:o.scrollTop(C)},y={left:f.left-S.left-c,top:f.top-S.top-a},E={left:f.left+h-(S.left+w)+d,top:f.top+g-(S.top+B)+u},_=S):(b=o.offset(t),v=t.clientHeight,k=t.clientWidth,_={left:t.scrollLeft,top:t.scrollTop},y={left:f.left-(b.left+(parseFloat(o.css(t,"borderLeftWidth"))||0))-c,top:f.top-(b.top+(parseFloat(o.css(t,"borderTopWidth"))||0))-a},E={left:f.left+h-(b.left+k+(parseFloat(o.css(t,"borderRightWidth"))||0))+d,top:f.top+g-(b.top+v+(parseFloat(o.css(t,"borderBottomWidth"))||0))+u}),y.top<0||E.top>0?!0===i?o.scrollTop(t,_.top+y.top):!1===i?o.scrollTop(t,_.top+E.top):y.top<0?o.scrollTop(t,_.top+y.top):o.scrollTop(t,_.top+E.top):l||((i=void 0===i||!!i)?o.scrollTop(t,_.top+y.top):o.scrollTop(t,_.top+E.top)),r&&(y.left<0||E.left>0?!0===s?o.scrollLeft(t,_.left+y.left):!1===s?o.scrollLeft(t,_.left+E.left):y.left<0?o.scrollLeft(t,_.left+y.left):o.scrollLeft(t,_.left+E.left):l||((s=void 0===s||!!s)?o.scrollLeft(t,_.left+y.left):o.scrollLeft(t,_.left+E.left)))}},4979:function(e,t,n){"use strict";e.exports=n(9010)},4657:function(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=void 0;function u(e,t){for(var n=0;n<e.length;n++)t(e[n])}function d(e){return"border-box"===c(e,"boxSizing")}"undefined"!=typeof window&&(c=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.currentStyle&&e.currentStyle[t];if(s.test(n)&&!a.test(t)){var o=e.style,r=o.left,l=e.runtimeStyle.left;e.runtimeStyle.left=e.currentStyle.left,o.left="fontSize"===t?"1em":n||0,n=o.pixelLeft+"px",o.left=r,e.runtimeStyle.left=l}return""===n?"auto":n});var p=["margin","border","padding"];function m(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])}function f(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;s="border"===r?r+n[i]+"Width":r+n[i],o+=parseFloat(c(e,s))||0}return o}function g(e){return null!=e&&e==e.window}var h={};function b(e,t,n){if(g(e))return"width"===t?h.viewportWidth(e):h.viewportHeight(e);if(9===e.nodeType)return"width"===t?h.docWidth(e):h.docHeight(e);var o="width"===t?["Left","Right"]:["Top","Bottom"],r="width"===t?e.offsetWidth:e.offsetHeight,l=(c(e),d(e)),i=0;(null==r||r<=0)&&(r=void 0,(null==(i=c(e,t))||Number(i)<0)&&(i=e.style[t]||0),i=parseFloat(i)||0),void 0===n&&(n=l?1:-1);var s=void 0!==r||l,a=r||i;if(-1===n)return s?a-f(e,["border","padding"],o):i;if(s){var u=2===n?-f(e,["border"],o):f(e,["margin"],o);return a+(1===n?0:u)}return i+f(e,p.slice(n),o)}u(["Width","Height"],(function(e){h["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],h["viewport"+e](n))},h["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 v={position:"absolute",visibility:"hidden",display:"block"};function k(e){var t=void 0,n=arguments;return 0!==e.offsetWidth?t=b.apply(void 0,n):m(e,v,(function(){t=b.apply(void 0,n)})),t}function _(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)):c(e,t);for(var l in t)t.hasOwnProperty(l)&&_(e,l,t[l])}u(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);h["outer"+t]=function(t,n){return t&&k(t,e,n?0:1)};var n="width"===e?["Left","Right"]:["Top","Bottom"];h[e]=function(t,o){return void 0===o?t&&k(t,e,-1):t?(c(t),d(t)&&(o+=f(t,["padding","border"],n)),_(t,e,o)):void 0}})),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"===_(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(_(e,l))||0,o[l]=r+t[l]-n[l]);_(e,o)}(e,t)},isWindow:g,each:u,css:_,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(g(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(g(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},h)},5717:function(e){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},8303:function(e,t,n){var o=n(1934);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}},2703:function(e,t,n){"use strict";var o=n(414);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,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}},5697:function(e,t,n){e.exports=n(2703)()},414:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4857: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 __(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),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(3804),a=n(5697),c=n(9367),u=n(8303),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}))}))},4042:function(e,t,n){"use strict";var o=n(4857);t.Z=o.TextareaAutosize},3692:function(e){var t=e.exports=function(e){return new n(e)};function n(e){this.value=e}function o(e,t,n){var o=[],i=[],u=!0;return function e(d){var p=n?r(d):d,m={},f=!0,g={node:p,node_:d,path:[].concat(o),parent:i[i.length-1],parents:i,key:o.slice(-1)[0],isRoot:0===o.length,level:o.length,circular:null,update:function(e,t){g.isRoot||(g.parent.node[g.key]=e),g.node=e,t&&(f=!1)},delete:function(e){delete g.parent.node[g.key],e&&(f=!1)},remove:function(e){s(g.parent.node)?g.parent.node.splice(g.key,1):delete g.parent.node[g.key],e&&(f=!1)},keys:null,before:function(e){m.before=e},after:function(e){m.after=e},pre:function(e){m.pre=e},post:function(e){m.post=e},stop:function(){u=!1},block:function(){f=!1}};if(!u)return g;function h(){if("object"==typeof g.node&&null!==g.node){g.keys&&g.node_===g.node||(g.keys=l(g.node)),g.isLeaf=0==g.keys.length;for(var e=0;e<i.length;e++)if(i[e].node_===d){g.circular=i[e];break}}else g.isLeaf=!0,g.keys=null;g.notLeaf=!g.isLeaf,g.notRoot=!g.isRoot}h();var b=t.call(g,g.node);return void 0!==b&&g.update&&g.update(b),m.before&&m.before.call(g,g.node),f?("object"!=typeof g.node||null===g.node||g.circular||(i.push(g),h(),a(g.keys,(function(t,r){o.push(t),m.pre&&m.pre.call(g,g.node[t],t);var l=e(g.node[t]);n&&c.call(g.node,t)&&(g.node[t]=l.node),l.isLast=r==g.keys.length-1,l.isFirst=0==r,m.post&&m.post.call(g,l),o.pop()})),i.pop()),m.after&&m.after.call(g,g.node),g):g}(e).node}function r(e){if("object"==typeof e&&null!==e){var t;if(s(e))t=[];else if("[object Date]"===i(e))t=new Date(e.getTime?e.getTime():e);else if("[object RegExp]"===i(e))t=new RegExp(e);else if(function(e){return"[object Error]"===i(e)}(e))t={message:e.message};else if(function(e){return"[object Boolean]"===i(e)}(e))t=new Boolean(e);else if(function(e){return"[object Number]"===i(e)}(e))t=new Number(e);else if(function(e){return"[object String]"===i(e)}(e))t=new String(e);else if(Object.create&&Object.getPrototypeOf)t=Object.create(Object.getPrototypeOf(e));else if(e.constructor===Object)t={};else{var n=e.constructor&&e.constructor.prototype||e.__proto__||{},o=function(){};o.prototype=n,t=new o}return a(l(e),(function(n){t[n]=e[n]})),t}return e}n.prototype.get=function(e){for(var t=this.value,n=0;n<e.length;n++){var o=e[n];if(!t||!c.call(t,o)){t=void 0;break}t=t[o]}return t},n.prototype.has=function(e){for(var t=this.value,n=0;n<e.length;n++){var o=e[n];if(!t||!c.call(t,o))return!1;t=t[o]}return!0},n.prototype.set=function(e,t){for(var n=this.value,o=0;o<e.length-1;o++){var r=e[o];c.call(n,r)||(n[r]={}),n=n[r]}return n[e[o]]=t,t},n.prototype.map=function(e){return o(this.value,e,!0)},n.prototype.forEach=function(e){return this.value=o(this.value,e,!1),this.value},n.prototype.reduce=function(e,t){var n=1===arguments.length,o=n?this.value:t;return this.forEach((function(t){this.isRoot&&n||(o=e.call(this,o,t))})),o},n.prototype.paths=function(){var e=[];return this.forEach((function(t){e.push(this.path)})),e},n.prototype.nodes=function(){var e=[];return this.forEach((function(t){e.push(this.node)})),e},n.prototype.clone=function(){var e=[],t=[];return function n(o){for(var i=0;i<e.length;i++)if(e[i]===o)return t[i];if("object"==typeof o&&null!==o){var s=r(o);return e.push(o),t.push(s),a(l(o),(function(e){s[e]=n(o[e])})),e.pop(),t.pop(),s}return o}(this.value)};var l=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function i(e){return Object.prototype.toString.call(e)}var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n,e)};a(l(n.prototype),(function(e){t[e]=function(t){var o=[].slice.call(arguments,1),r=new n(t);return r[e].apply(r,o)}}));var c=Object.hasOwnProperty||function(e,t){return t in e}},3804:function(e){"use strict";e.exports=window.React}},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=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(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=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};!function(){"use strict";n.r(o),n.d(o,{AlignmentControl:function(){return ch},AlignmentToolbar:function(){return uh},Autocomplete:function(){return fh},BlockAlignmentControl:function(){return Do},BlockAlignmentToolbar:function(){return Oo},BlockBreadcrumb:function(){return kh},BlockColorsStyleSelector:function(){return Sh},BlockContextProvider:function(){return or},BlockControls:function(){return eo},BlockEdit:function(){return sr},BlockEditorKeyboardShortcuts:function(){return Ak},BlockEditorProvider:function(){return Ua},BlockFormatControls:function(){return Jn},BlockIcon:function(){return za},BlockInspector:function(){return Pk},BlockList:function(){return Kp},BlockMover:function(){return Ld},BlockNavigationDropdown:function(){return Wh},BlockPreview:function(){return iu},BlockSelectionClearer:function(){return $a},BlockSettingsMenu:function(){return Ep},BlockSettingsMenuControls:function(){return vp},BlockTitle:function(){return _d},BlockToolbar:function(){return Cp},BlockTools:function(){return Rk},BlockVerticalAlignmentControl:function(){return db},BlockVerticalAlignmentToolbar:function(){return pb},ButtonBlockAppender:function(){return ud},ButtonBlockerAppender:function(){return cd},ColorPalette:function(){return fb},ColorPaletteControl:function(){return gb},ContrastChecker:function(){return Zm},CopyHandler:function(){return sp},DefaultBlockAppender:function(){return sd},FontSizePicker:function(){return jf},InnerBlocks:function(){return Gp},Inserter:function(){return id},InspectorAdvancedControls:function(){return Zo},InspectorControls:function(){return Xo},JustifyContentControl:function(){return bo},JustifyToolbar:function(){return vo},LineHeightControl:function(){return wf},MediaPlaceholder:function(){return Nv},MediaReplaceFlow:function(){return Sv},MediaUpload:function(){return Ev},MediaUploadCheck:function(){return Cv},MultiSelectScrollIntoView:function(){return Dk},NavigableToolbar:function(){return Sd},ObserveTyping:function(){return Vk},PanelColorSettings:function(){return Pv},PlainText:function(){return ok},PreserveScrollInReorder:function(){return Hk},RichText:function(){return ek},RichTextShortcut:function(){return ik},RichTextToolbarButton:function(){return sk},SETTINGS_DEFAULTS:function(){return b},SkipToSelectedBlock:function(){return wk},ToolSelector:function(){return uk},Typewriter:function(){return $k},URLInput:function(){return ev},URLInputButton:function(){return fk},URLPopover:function(){return xv},Warning:function(){return cr},WritingFlow:function(){return tc},__experimentalBlockAlignmentMatrixControl:function(){return bh},__experimentalBlockContentOverlay:function(){return _h},__experimentalBlockFullHeightAligmentControl:function(){return hh},__experimentalBlockPatternSetup:function(){return nb},__experimentalBlockVariationPicker:function(){return jh},__experimentalBlockVariationTransforms:function(){return rb},__experimentalBorderRadiusControl:function(){return xm},__experimentalBorderStyleControl:function(){return Lm},__experimentalColorGradientControl:function(){return dm},__experimentalDuotoneControl:function(){return Pg},__experimentalFontAppearanceControl:function(){return Pf},__experimentalFontFamilyControl:function(){return Ff},__experimentalGetBorderClassesAndStyles:function(){return Wg},__experimentalGetColorClassesAndStyles:function(){return Kg},__experimentalGetGradientClass:function(){return em},__experimentalGetGradientObjectByGradientValue:function(){return nm},__experimentalGetMatchingVariation:function(){return ob},__experimentalGetSpacingClassesAndStyles:function(){return Yg},__experimentalImageEditingProvider:function(){return Ob},__experimentalImageEditor:function(){return qb},__experimentalImageSizeControl:function(){return Zb},__experimentalImageURLInputUI:function(){return Ek},__experimentalLayoutStyle:function(){return To},__experimentalLetterSpacingControl:function(){return Qf},__experimentalLibrary:function(){return Mk},__experimentalLinkControl:function(){return kv},__experimentalLinkControlSearchInput:function(){return pv},__experimentalLinkControlSearchItem:function(){return ov},__experimentalLinkControlSearchResults:function(){return iv},__experimentalListView:function(){return Uh},__experimentalPanelColorGradientSettings:function(){return qm},__experimentalPreviewOptions:function(){return Ck},__experimentalResponsiveBlockControl:function(){return lk},__experimentalUnitControl:function(){return dk},__experimentalUseBorderProps:function(){return $g},__experimentalUseColorProps:function(){return qg},__experimentalUseCustomSides:function(){return kg},__experimentalUseGradient:function(){return rm},__experimentalUseInnerBlocksProps:function(){return Up},__experimentalUseNoRecursiveRenders:function(){return Yk},__experimentalUseResizeCanvas:function(){return Sk},__unstableBlockSettingsMenuFirstItem:function(){return mp},__unstableEditorStyles:function(){return ou},__unstableIframe:function(){return rc},__unstableInserterMenuExtension:function(){return Ou},__unstableRichTextInputEvent:function(){return ak},__unstableUseBlockSelectionClearer:function(){return Wa},__unstableUseCanvasClickRedirect:function(){return Kk},__unstableUseClipboardHandler:function(){return ip},__unstableUseMouseMoveTypingReset:function(){return Fk},__unstableUseTypewriter:function(){return Wk},__unstableUseTypingObserver:function(){return zk},createCustomColorsHOC:function(){return Jg},getColorClassName:function(){return Qp},getColorObjectByAttributeValues:function(){return Zp},getColorObjectByColorValue:function(){return Xp},getFontSize:function(){return Gf},getFontSizeClass:function(){return $f},getFontSizeObjectByValue:function(){return Wf},getGradientSlugByValue:function(){return om},getGradientValueBySlug:function(){return tm},getPxFromCssUnit:function(){return n_},store:function(){return Wn},storeConfig:function(){return Gn},transformStyles:function(){return eu},useBlockDisplayInformation:function(){return kd},useBlockEditContext:function(){return qn},useBlockProps:function(){return xa},useCachedTruthy:function(){return Zg},useSetting:function(){return fo},validateThemeColors:function(){return Zk},validateThemeGradients:function(){return Xk},withColorContext:function(){return mb},withColors:function(){return eh},withFontSizes:function(){return nh}});var e={};n.r(e),n.d(e,{__experimentalGetActiveBlockIdByBlockNames:function(){return Nt},__experimentalGetAllowedBlocks:function(){return ct},__experimentalGetAllowedPatterns:function(){return mt},__experimentalGetBlockListSettingsForBlocks:function(){return kt},__experimentalGetDirectInsertBlock:function(){return ut},__experimentalGetLastBlockAttributeChanges:function(){return Ct},__experimentalGetParsedPattern:function(){return dt},__experimentalGetParsedReusableBlock:function(){return _t},__experimentalGetPatternTransformItems:function(){return gt},__experimentalGetPatternsByBlockTypes:function(){return ft},__experimentalGetReusableBlockTitle:function(){return yt},__unstableGetBlockWithoutInnerBlocks:function(){return $},__unstableGetClientIdWithClientIdsTree:function(){return K},__unstableGetClientIdsTree:function(){return q},__unstableIsLastBlockChangeIgnored:function(){return Et},areInnerBlocksControlled:function(){return Tt},canInsertBlockType:function(){return Ye},canInsertBlocks:function(){return Ze},canMoveBlock:function(){return Je},canMoveBlocks:function(){return et},canRemoveBlock:function(){return Xe},canRemoveBlocks:function(){return Qe},didAutomaticChange:function(){return It},getAdjacentBlockClientId:function(){return me},getBlock:function(){return W},getBlockAttributes:function(){return G},getBlockCount:function(){return J},getBlockHierarchyRootClientId:function(){return de},getBlockIndex:function(){return xe},getBlockInsertionPoint:function(){return Ue},getBlockListSettings:function(){return ht},getBlockMode:function(){return Ae},getBlockName:function(){return H},getBlockOrder:function(){return Ie},getBlockParents:function(){return ce},getBlockParentsByBlockName:function(){return ue},getBlockRootClientId:function(){return ae},getBlockSelectionEnd:function(){return oe},getBlockSelectionStart:function(){return ne},getBlockTransformItems:function(){return st},getBlocks:function(){return j},getBlocksByClientId:function(){return Q},getClientIdsOfDescendants:function(){return Y},getClientIdsWithDescendants:function(){return Z},getDraggedBlockClientIds:function(){return Fe},getFirstMultiSelectedBlockClientId:function(){return _e},getGlobalBlockCount:function(){return X},getInserterItems:function(){return it},getLastMultiSelectedBlockClientId:function(){return ye},getLowestCommonAncestorWithSelectedBlock:function(){return pe},getMultiSelectedBlockClientIds:function(){return ve},getMultiSelectedBlocks:function(){return ke},getMultiSelectedBlocksEndClientId:function(){return Be},getMultiSelectedBlocksStartClientId:function(){return we},getNextBlockClientId:function(){return ge},getPreviousBlockClientId:function(){return fe},getSelectedBlock:function(){return se},getSelectedBlockClientId:function(){return ie},getSelectedBlockClientIds:function(){return be},getSelectedBlockCount:function(){return re},getSelectedBlocksInitialCaretPosition:function(){return he},getSelectionEnd:function(){return te},getSelectionStart:function(){return ee},getSettings:function(){return bt},getTemplate:function(){return $e},getTemplateLock:function(){return je},hasBlockMovingClientId:function(){return Bt},hasInserterItems:function(){return at},hasMultiSelection:function(){return Re},hasSelectedBlock:function(){return le},hasSelectedInnerBlock:function(){return Ne},isAncestorBeingDragged:function(){return Ve},isAncestorMultiSelected:function(){return Se},isBlockBeingDragged:function(){return ze},isBlockHighlighted:function(){return xt},isBlockInsertionPointVisible:function(){return Ge},isBlockMultiSelected:function(){return Ce},isBlockSelected:function(){return Te},isBlockValid:function(){return U},isBlockWithinSelection:function(){return Pe},isCaretWithinFormattedText:function(){return He},isDraggingBlocks:function(){return Oe},isFirstMultiSelectedBlock:function(){return Ee},isLastBlockChangePersistent:function(){return vt},isMultiSelecting:function(){return Me},isNavigationMode:function(){return wt},isSelectionEnabled:function(){return Le},isTyping:function(){return De},isValidTemplate:function(){return We},wasBlockJustInserted:function(){return Pt}});var t={};n.r(t),n.d(t,{__unstableMarkAutomaticChange:function(){return Mn},__unstableMarkAutomaticChangeFinal:function(){return Ln},__unstableMarkLastChangeAsPersistent:function(){return Pn},__unstableMarkNextChangeAsNotPersistent:function(){return Rn},__unstableSaveReusableBlock:function(){return Nn},clearSelectedBlock:function(){return Xt},duplicateBlocks:function(){return On},enterFormattedText:function(){return Sn},exitFormattedText:function(){return wn},flashBlock:function(){return Hn},hideInsertionPoint:function(){return dn},insertAfterBlock:function(){return zn},insertBeforeBlock:function(){return Fn},insertBlock:function(){return an},insertBlocks:function(){return cn},insertDefaultBlock:function(){return In},mergeBlocks:function(){return fn},moveBlockToPosition:function(){return sn},moveBlocksDown:function(){return on},moveBlocksToPosition:function(){return ln},moveBlocksUp:function(){return rn},multiSelect:function(){return Zt},receiveBlocks:function(){return Ut},removeBlock:function(){return hn},removeBlocks:function(){return gn},replaceBlock:function(){return tn},replaceBlocks:function(){return en},replaceInnerBlocks:function(){return bn},resetBlocks:function(){return zt},resetSelection:function(){return Ht},selectBlock:function(){return $t},selectNextBlock:function(){return Kt},selectPreviousBlock:function(){return jt},selectionChange:function(){return Bn},setBlockMovingClientId:function(){return Dn},setHasControlledInnerBlocks:function(){return Un},setNavigationMode:function(){return An},setTemplateValidity:function(){return pn},showInsertionPoint:function(){return un},startDraggingBlocks:function(){return En},startMultiSelect:function(){return qt},startTyping:function(){return kn},stopDraggingBlocks:function(){return Cn},stopMultiSelect:function(){return Yt},stopTyping:function(){return yn},synchronizeTemplate:function(){return mn},toggleBlockHighlight:function(){return Vn},toggleBlockMode:function(){return vn},toggleSelection:function(){return Qt},updateBlock:function(){return Wt},updateBlockAttributes:function(){return Gt},updateBlockListSettings:function(){return xn},updateSettings:function(){return Tn},validateBlocksToTemplate:function(){return Vt}});var r=window.wp.blocks,l=window.wp.hooks;function i(){return(i=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}).apply(this,arguments)}(0,l.addFilter)("blocks.registerBlockType","core/compat/migrateLightBlockWrapper",(function(e){const{apiVersion:t=1}=e;return t<2&&(0,r.hasBlockSupport)(e,"lightBlockWrapper",!1)&&(e.apiVersion=2),e}));var s=window.wp.element,a=n(4184),c=n.n(a),u=window.lodash,d=window.wp.compose,p=window.wp.components,m=window.wp.data,f={default:(0,p.createSlotFill)("BlockControls"),block:(0,p.createSlotFill)("BlockControlsBlock"),inline:(0,p.createSlotFill)("BlockFormatControls"),other:(0,p.createSlotFill)("BlockControlsOther"),parent:(0,p.createSlotFill)("BlockControlsParent")},g=window.wp.i18n;const h={insertUsage:{}},b={alignWide:!1,supportsLayout:!0,colors:[{name:(0,g.__)("Black"),slug:"black",color:"#000000"},{name:(0,g.__)("Cyan bluish gray"),slug:"cyan-bluish-gray",color:"#abb8c3"},{name:(0,g.__)("White"),slug:"white",color:"#ffffff"},{name:(0,g.__)("Pale pink"),slug:"pale-pink",color:"#f78da7"},{name:(0,g.__)("Vivid red"),slug:"vivid-red",color:"#cf2e2e"},{name:(0,g.__)("Luminous vivid orange"),slug:"luminous-vivid-orange",color:"#ff6900"},{name:(0,g.__)("Luminous vivid amber"),slug:"luminous-vivid-amber",color:"#fcb900"},{name:(0,g.__)("Light green cyan"),slug:"light-green-cyan",color:"#7bdcb5"},{name:(0,g.__)("Vivid green cyan"),slug:"vivid-green-cyan",color:"#00d084"},{name:(0,g.__)("Pale cyan blue"),slug:"pale-cyan-blue",color:"#8ed1fc"},{name:(0,g.__)("Vivid cyan blue"),slug:"vivid-cyan-blue",color:"#0693e3"},{name:(0,g.__)("Vivid purple"),slug:"vivid-purple",color:"#9b51e0"}],fontSizes:[{name:(0,g._x)("Small","font size name"),size:13,slug:"small"},{name:(0,g._x)("Normal","font size name"),size:16,slug:"normal"},{name:(0,g._x)("Medium","font size name"),size:20,slug:"medium"},{name:(0,g._x)("Large","font size name"),size:36,slug:"large"},{name:(0,g._x)("Huge","font size name"),size:42,slug:"huge"}],imageDefaultSize:"large",imageSizes:[{slug:"thumbnail",name:(0,g.__)("Thumbnail")},{slug:"medium",name:(0,g.__)("Medium")},{slug:"large",name:(0,g.__)("Large")},{slug:"full",name:(0,g.__)("Full Size")}],imageEditing:!0,maxWidth:580,allowedBlockTypes:!0,maxUploadFileSize:0,allowedMimeTypes:null,__experimentalCanUserUseUnfilteredHTML:!1,__experimentalBlockDirectory:!1,__mobileEnablePageTemplates:!1,__experimentalBlockPatterns:[],__experimentalBlockPatternCategories:[],__experimentalSpotlightEntityBlocks:[],__unstableGalleryWithImageBlocks:!1,gradients:[{name:(0,g.__)("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,g.__)("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,g.__)("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,g.__)("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,g.__)("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,g.__)("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,g.__)("Blush light purple"),gradient:"linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)",slug:"blush-light-purple"},{name:(0,g.__)("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,g.__)("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,g.__)("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,g.__)("Electric grass"),gradient:"linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)",slug:"electric-grass"},{name:(0,g.__)("Midnight"),gradient:"linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)",slug:"midnight"}]};function v(e,t,n){return[...e.slice(0,n),...(0,u.castArray)(t),...e.slice(n)]}function k(e,t,n,o=1){const r=[...e];return r.splice(t,o),v(r,e.slice(t,t+o),n)}function _(e,t=""){const n={[t]:[]};return e.forEach((e=>{const{clientId:o,innerBlocks:r}=e;n[t].push(o),Object.assign(n,_(r,o))})),n}function y(e,t=""){return e.reduce(((e,n)=>Object.assign(e,{[n.clientId]:t},y(n.innerBlocks,n.clientId))),{})}function E(e,t=u.identity){const n={},o=[...e];for(;o.length;){const{innerBlocks:e,...r}=o.shift();o.push(...e),n[r.clientId]=t(r)}return n}function C(e){return E(e,(e=>(0,u.omit)(e,"attributes")))}function S(e){return E(e,(e=>e.attributes))}function w(e,t="",n={}){return(0,u.reduce)(e[t],((t,o)=>n[o]?t:[...t,o,...w(e,o)]),[])}function B(e,t){return"UPDATE_BLOCK_ATTRIBUTES"===e.type&&void 0!==t&&"UPDATE_BLOCK_ATTRIBUTES"===t.type&&(0,u.isEqual)(e.clientIds,t.clientIds)&&function(e,t){return(0,u.isEqual)((0,u.keys)(e),(0,u.keys)(t))}(e.attributes,t.attributes)}function I(e,t){const n={},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[e.clientId]={};for(const t of r)n[t.clientId]=Object.assign(n[t.clientId],{...e.byClientId[t.clientId],attributes:e.attributes[t.clientId],innerBlocks:t.innerBlocks.map((e=>n[e.clientId]))});return n}function x(e,t,n){const o=new Set([]),r=new Set;for(const t of n){let n=t;do{if(e.controlledInnerBlocks[n]){r.add(n);break}o.add(n),n=e.parents[n]}while(void 0!==n)}for(const e of o)t[e]={...t[e]};for(const n of o)t[n].innerBlocks=(e.order[n]||[]).map((e=>t[e]));for(const n of r)t["controlled||"+n]={innerBlocks:(e.order[n]||[]).map((e=>t[e]))};return t}const T=(0,u.flow)(m.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=(0,u.mapValues)(t.attributes,((n,r)=>{const{name:l}=t.byClientId[r];return"core/block"===l&&n.ref===e?{...n,ref:o}:n}))}return e(t,n)}),(e=>(t={},n)=>{const o=e(t,n);if(o===t)return t;switch(o.tree=t.tree?t.tree:{},n.type){case"RECEIVE_BLOCKS":case"INSERT_BLOCKS":{const e=I(o,n.blocks);o.tree=x(o,{...o.tree,...e},n.rootClientId?[n.rootClientId]:[""]);break}case"UPDATE_BLOCK":o.tree=x(o,{...o.tree,[n.clientId]:{...o.byClientId[n.clientId],attributes:o.attributes[n.clientId]}},[n.clientId]);break;case"UPDATE_BLOCK_ATTRIBUTES":{const e=n.clientIds.reduce(((e,t)=>(e[t]={...o.tree[t],attributes:o.attributes[t]},e)),{});o.tree=x(o,{...o.tree,...e},n.clientIds);break}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const e=I(o,n.blocks);o.tree=x(o,{...(0,u.omit)(o.tree,n.replacedClientIds.concat(n.replacedClientIds.map((e=>"controlled||"+e)))),...e},n.blocks.map((e=>e.clientId)));const r=[];for(const e of n.clientIds)void 0===t.parents[e]||""!==t.parents[e]&&!o.byClientId[t.parents[e]]||r.push(t.parents[e]);o.tree=x(o,o.tree,r);break}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":const e=[];for(const r of n.clientIds)void 0===t.parents[r]||""!==t.parents[r]&&!o.byClientId[t.parents[r]]||e.push(t.parents[r]);o.tree=x(o,(0,u.omit)(o.tree,n.removedClientIds.concat(n.removedClientIds.map((e=>"controlled||"+e)))),e);break;case"MOVE_BLOCKS_TO_POSITION":{const e=[];n.fromRootClientId&&e.push(n.fromRootClientId),n.toRootClientId&&e.push(n.toRootClientId),n.fromRootClientId&&n.fromRootClientId||e.push(""),o.tree=x(o,o.tree,e);break}case"MOVE_BLOCKS_UP":case"MOVE_BLOCKS_DOWN":{const e=[n.rootClientId?n.rootClientId:""];o.tree=x(o,o.tree,e);break}case"SAVE_REUSABLE_BLOCK_SUCCESS":{const e=(0,u.keys)((0,u.omitBy)(o.attributes,((e,t)=>"core/block"!==o.byClientId[t].name||e.ref!==n.updatedId)));o.tree=x(o,{...o.tree,...e.reduce(((e,t)=>(e[t]={...o.byClientId[t],attributes:o.attributes[t],innerBlocks:o.tree[t].innerBlocks},e)),{})},e)}}return o}),(e=>(t,n)=>{const o=e=>{let o=e;for(let r=0;r<o.length;r++)!t.order[o[r]]||n.keepControlledInnerBlocks&&n.keepControlledInnerBlocks[o[r]]||(o===e&&(o=[...o]),o.push(...t.order[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[n.rootClientId]&&(r=e(r,{type:"REMOVE_BLOCKS",keepControlledInnerBlocks:o,clientIds:t.order[n.rootClientId]}));let l=r;return n.blocks.length&&(l=e(l,{...n,type:"INSERT_BLOCKS",index:0}),l.order={...l.order,...(0,u.reduce)(o,((e,n,o)=>(t.order[o]&&(e[o]=t.order[o]),e)),{})}),l}),(e=>(t,n)=>{if("RESET_BLOCKS"===n.type){var o,r,l;const e=w(null!==(o=null==t?void 0:t.order)&&void 0!==o?o:{},"",null!==(r=null==t?void 0:t.controlledInnerBlocks)&&void 0!==r?r:{}),i=Object.keys((0,u.pickBy)(null!==(l=null==t?void 0:t.controlledInnerBlocks)&&void 0!==l?l:{})),s={...t,byClientId:{...(0,u.omit)(null==t?void 0:t.byClientId,e),...C(n.blocks)},attributes:{...(0,u.omit)(null==t?void 0:t.attributes,e),...S(n.blocks)},order:{...(0,u.omit)(null==t?void 0:t.order,e),...(0,u.omit)(_(n.blocks),i)},parents:{...(0,u.omit)(null==t?void 0:t.parents,e),...y(n.blocks)},controlledInnerBlocks:(null==t?void 0:t.controlledInnerBlocks)||{}},a=I(s,n.blocks);return s.tree={...(0,u.omit)(null==t?void 0:t.tree,e),...a,"":{innerBlocks:n.blocks.map((e=>a[e.clientId]))}},s}return e(t,n)}),(function(e){let t,n=!1;return(o,r)=>{let l=e(o,r);const i="MARK_LAST_CHANGE_AS_PERSISTENT"===r.type||n;if(o===l&&!i){var s;n="MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"===r.type;const e=null===(s=null==o?void 0:o.isPersistentChange)||void 0===s||s;return o.isPersistentChange===e?o:{...l,isPersistentChange:e}}return l={...l,isPersistentChange:i?!n:!B(r,t)},t=r,n="MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"===r.type,l}}),(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}}))({byClientId(e={},t){switch(t.type){case"RECEIVE_BLOCKS":case"INSERT_BLOCKS":return{...e,...C(t.blocks)};case"UPDATE_BLOCK":if(!e[t.clientId])return e;const n=(0,u.omit)(t.updates,"attributes");return(0,u.isEmpty)(n)?e:{...e,[t.clientId]:{...e[t.clientId],...n}};case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":return t.blocks?{...(0,u.omit)(e,t.replacedClientIds),...C(t.blocks)}:e;case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":return(0,u.omit)(e,t.removedClientIds)}return e},attributes(e={},t){switch(t.type){case"RECEIVE_BLOCKS":case"INSERT_BLOCKS":return{...e,...S(t.blocks)};case"UPDATE_BLOCK":return e[t.clientId]&&t.updates.attributes?{...e,[t.clientId]:{...e[t.clientId],...t.updates.attributes}}:e;case"UPDATE_BLOCK_ATTRIBUTES":{if(t.clientIds.every((t=>!e[t])))return e;const n=t.clientIds.reduce(((n,o)=>({...n,[o]:(0,u.reduce)(t.uniqueByBlock?t.attributes[o]:t.attributes,((t,n,r)=>{var l,i;return n!==t[r]&&((t=(l=e[o])===(i=t)?{...l}:i)[r]=n),t}),e[o])})),{});return t.clientIds.every((t=>n[t]===e[t]))?e:{...e,...n}}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":return t.blocks?{...(0,u.omit)(e,t.replacedClientIds),...S(t.blocks)}:e;case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":return(0,u.omit)(e,t.removedClientIds)}return e},order(e={},t){switch(t.type){case"RECEIVE_BLOCKS":{const n=_(t.blocks);return{...e,...(0,u.omit)(n,""),"":((null==e?void 0:e[""])||[]).concat(n[""])}}case"INSERT_BLOCKS":{const{rootClientId:n=""}=t,o=e[n]||[],r=_(t.blocks,n),{index:l=o.length}=t;return{...e,...r,[n]:v(o,r[n],l)}}case"MOVE_BLOCKS_TO_POSITION":{const{fromRootClientId:n="",toRootClientId:o="",clientIds:r}=t,{index:l=e[o].length}=t;if(n===o){const t=e[o].indexOf(r[0]);return{...e,[o]:k(e[o],t,l,r.length)}}return{...e,[n]:(0,u.without)(e[n],...r),[o]:v(e[o],r,l)}}case"MOVE_BLOCKS_UP":{const{clientIds:n,rootClientId:o=""}=t,r=(0,u.first)(n),l=e[o];if(!l.length||r===(0,u.first)(l))return e;const i=l.indexOf(r);return{...e,[o]:k(l,i,i-1,n.length)}}case"MOVE_BLOCKS_DOWN":{const{clientIds:n,rootClientId:o=""}=t,r=(0,u.first)(n),l=(0,u.last)(n),i=e[o];if(!i.length||l===(0,u.last)(i))return e;const s=i.indexOf(r);return{...e,[o]:k(i,s,s+1,n.length)}}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const{clientIds:n}=t;if(!t.blocks)return e;const o=_(t.blocks);return(0,u.flow)([e=>(0,u.omit)(e,t.replacedClientIds),e=>({...e,...(0,u.omit)(o,"")}),e=>(0,u.mapValues)(e,(e=>(0,u.reduce)(e,((e,t)=>t===n[0]?[...e,...o[""]]:(-1===n.indexOf(t)&&e.push(t),e)),[])))])(e)}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":return(0,u.flow)([e=>(0,u.omit)(e,t.removedClientIds),e=>(0,u.mapValues)(e,(e=>(0,u.without)(e,...t.removedClientIds)))])(e)}return e},parents(e={},t){switch(t.type){case"RECEIVE_BLOCKS":return{...e,...y(t.blocks)};case"INSERT_BLOCKS":return{...e,...y(t.blocks,t.rootClientId||"")};case"MOVE_BLOCKS_TO_POSITION":return{...e,...t.clientIds.reduce(((e,n)=>(e[n]=t.toRootClientId||"",e)),{})};case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":return{...(0,u.omit)(e,t.replacedClientIds),...y(t.blocks,e[t.clientIds[0]])};case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":return(0,u.omit)(e,t.removedClientIds)}return e},controlledInnerBlocks:(e={},{type:t,clientId:n,hasControlledInnerBlocks:o})=>"SET_HAS_CONTROLLED_INNER_BLOCKS"===t?{...e,[n]:o}:e});function N(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}var P,R,M=(0,m.combineReducers)({blocks:T,isTyping:function(e=!1,t){switch(t.type){case"START_TYPING":return!0;case"STOP_TYPING":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},isCaretWithinFormattedText:function(e=!1,t){switch(t.type){case"ENTER_FORMATTED_TEXT":return!0;case"EXIT_FORMATTED_TEXT":return!1}return e},selection:function(e={},t){var n,o;switch(t.type){case"SELECTION_CHANGE":return{selectionStart:{clientId:t.clientId,attributeKey:t.attributeKey,offset:t.startOffset},selectionEnd:{clientId:t.clientId,attributeKey:t.attributeKey,offset:t.endOffset}};case"RESET_SELECTION":const{selectionStart:r,selectionEnd:l}=t;return{selectionStart:r,selectionEnd:l};case"MULTI_SELECT":const{start:i,end:s}=t;return{selectionStart:{clientId:i},selectionEnd:{clientId:s}};case"RESET_BLOCKS":const a=null==e||null===(n=e.selectionStart)||void 0===n?void 0:n.clientId,c=null==e||null===(o=e.selectionEnd)||void 0===o?void 0:o.clientId;if(!a&&!c)return e;if(!t.blocks.some((e=>e.clientId===a)))return{selectionStart:{},selectionEnd:{}};if(!t.blocks.some((e=>e.clientId===c)))return{...e,selectionEnd:e.selectionStart}}return{selectionStart:N(e.selectionStart,t),selectionEnd:N(e.selectionEnd,t)}},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){switch(t.type){case"TOGGLE_SELECTION":return t.isSelectionEnabled}return e},initialPosition:function(e=null,t){return"REPLACE_BLOCKS"===t.type&&void 0!==t.initialPosition||["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(0,u.omit)(e,t.clientIds);case"UPDATE_BLOCK_LIST_SETTINGS":{const{clientId:n}=t;return t.settings?(0,u.isEqual)(e[n],t.settings)?e:{...e,[n]:t.settings}:e.hasOwnProperty(n)?(0,u.omit)(e,n):e}}return e},insertionPoint:function(e=null,t){switch(t.type){case"SHOW_INSERTION_POINT":const{rootClientId:e,index:n,__unstableWithInserter:o}=t;return{rootClientId:e,index:n,__unstableWithInserter:o};case"HIDE_INSERTION_POINT":return null}return e},template:function(e={isValid:!0},t){switch(t.type){case"SET_TEMPLATE_VALIDITY":return{...e,isValid:t.isValid}}return e},settings:function(e=b,t){switch(t.type){case"UPDATE_SETTINGS":return{...e,...t.settings}}return e},preferences:function(e=h,t){switch(t.type){case"INSERT_BLOCKS":case"REPLACE_BLOCKS":return t.blocks.reduce(((e,n)=>{const{attributes:o,name:l}=n,i=(0,m.select)(r.store).getActiveBlockVariation(l,o);let s=null!=i&&i.name?`${l}/${i.name}`:l;const a={name:s};return"core/block"===l&&(a.ref=o.ref,s+="/"+o.ref),{...e,insertUsage:{...e.insertUsage,[s]:{time:t.time,count:e.insertUsage[s]?e.insertUsage[s].count+1:1,insert:a}}}}),e)}return e},lastBlockAttributesChange:function(e,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 null},isNavigationMode:function(e=!1,t){return"INSERT_BLOCKS"!==t.type&&("SET_NAVIGATION_MODE"===t.type?t.isNavigationMode:e)},hasBlockMovingClientId:function(e=null,t){return"SET_BLOCK_MOVING_MODE"===t.type?t.hasBlockMovingClientId:"SET_NAVIGATION_MODE"===t.type?null:e},automaticChangeStatus:function(e,t){switch(t.type){case"MARK_AUTOMATIC_CHANGE":return"pending";case"MARK_AUTOMATIC_CHANGE_FINAL":return"pending"===e?"final":void 0;case"SELECTION_CHANGE":return"final"!==e?e:void 0;case"START_TYPING":case"STOP_TYPING":return 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){var n;switch(t.type){case"INSERT_BLOCKS":return t.blocks.length?{clientId:t.blocks[0].clientId,source:null===(n=t.meta)||void 0===n?void 0:n.source}:e;case"RESET_BLOCKS":return{}}return e}});function L(e){return[e]}function A(){var e={clear:function(){e.head=null}};return e}function D(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 O(e,t){var n,o;function r(){n=R?new WeakMap:A()}function l(){var n,r,l,i,s,a=arguments.length;for(i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];for(s=t.apply(null,i),(n=o(s)).isUniqueByDependants||(n.lastDependants&&!D(s,n.lastDependants,0)&&n.clear(),n.lastDependants=s),r=n.head;r;){if(D(r.args,i,1))return r!==n.head&&(r.prev.next=r.next,r.next&&(r.next.prev=r.prev),r.next=n.head,r.prev=null,n.head.prev=r,n.head=r),r.val;r=r.next}return r={val:e.apply(null,i)},i[0]=null,r.args=i,n.head&&(n.head.prev=r,r.next=n.head),n.head=r,r.val}return t||(t=L),o=R?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(P)||((l=A()).isUniqueByDependants=a,s.set(P,l)),s.get(P)}:function(){return n},l.getDependants=t,l.clear=r,r(),l}P={},R="undefined"!=typeof WeakMap;var F=window.wp.primitives,z=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"}));const V=[];function H(e,t){const n=e.blocks.byClientId[t],o="core/social-link";if("web"!==s.Platform.OS&&(null==n?void 0:n.name)===o){const n=e.blocks.attributes[t],{service:r}=n;return r?`core/social-link-${r}`:o}return n?n.name:null}function U(e,t){const n=e.blocks.byClientId[t];return!!n&&n.isValid}function G(e,t){return e.blocks.byClientId[t]?e.blocks.attributes[t]:null}function W(e,t){return e.blocks.byClientId[t]?e.blocks.tree[t]:null}const $=O(((e,t)=>{const n=e.blocks.byClientId[t];return n?{...n,attributes:G(e,t)}:null}),((e,t)=>[e.blocks.byClientId[t],e.blocks.attributes[t]]));function j(e,t){var n;const o=t&&Tt(e,t)?"controlled||"+t:t||"";return(null===(n=e.blocks.tree[o])||void 0===n?void 0:n.innerBlocks)||V}const K=O(((e,t)=>({clientId:t,innerBlocks:q(e,t)})),(e=>[e.blocks.order])),q=O(((e,t="")=>(0,u.map)(Ie(e,t),(t=>K(e,t)))),(e=>[e.blocks.order])),Y=(e,t)=>(0,u.flatMap)(t,(t=>{const n=Ie(e,t);return[...n,...Y(e,n)]})),Z=O((e=>{const t=Ie(e);return[...t,...Y(e,t)]}),(e=>[e.blocks.order])),X=O(((e,t)=>{const n=Z(e);return t?(0,u.reduce)(n,((n,o)=>e.blocks.byClientId[o].name===t?n+1:n),0):n.length}),(e=>[e.blocks.order,e.blocks.byClientId])),Q=O(((e,t)=>(0,u.map)((0,u.castArray)(t),(t=>W(e,t)))),((e,t)=>(0,u.map)((0,u.castArray)(t),(t=>e.blocks.tree[t]))));function J(e,t){return Ie(e,t).length}function ee(e){return e.selection.selectionStart}function te(e){return e.selection.selectionEnd}function ne(e){return e.selection.selectionStart.clientId}function oe(e){return e.selection.selectionEnd.clientId}function re(e){return ve(e).length||(e.selection.selectionStart.clientId?1:0)}function le(e){const{selectionStart:t,selectionEnd:n}=e.selection;return!!t.clientId&&t.clientId===n.clientId}function ie(e){const{selectionStart:t,selectionEnd:n}=e.selection,{clientId:o}=t;return o&&o===n.clientId?o:null}function se(e){const t=ie(e);return t?W(e,t):null}function ae(e,t){return void 0!==e.blocks.parents[t]?e.blocks.parents[t]:null}const ce=O(((e,t,n=!1)=>{const o=[];let r=t;for(;e.blocks.parents[r];)r=e.blocks.parents[r],o.push(r);return n?o:o.reverse()}),(e=>[e.blocks.parents])),ue=O(((e,t,n,o=!1)=>{const r=ce(e,t,o);return(0,u.map)((0,u.filter)((0,u.map)(r,(t=>({id:t,name:H(e,t)}))),(({name:e})=>Array.isArray(n)?n.includes(e):e===n)),(({id:e})=>e))}),(e=>[e.blocks.parents]));function de(e,t){let n,o=t;do{n=o,o=e.blocks.parents[o]}while(o);return n}function pe(e,t){const n=ie(e),o=[...ce(e,t),t],r=[...ce(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 me(e,t,n=1){if(void 0===t&&(t=ie(e)),void 0===t&&(t=n<0?_e(e):ye(e)),!t)return null;const o=ae(e,t);if(null===o)return null;const{order:r}=e.blocks,l=r[o],i=l.indexOf(t)+1*n;return i<0||i===l.length?null:l[i]}function fe(e,t){return me(e,t,-1)}function ge(e,t){return me(e,t,1)}function he(e){return e.initialPosition}const be=O((e=>{const{selectionStart:t,selectionEnd:n}=e.selection;if(void 0===t.clientId||void 0===n.clientId)return V;if(t.clientId===n.clientId)return[t.clientId];const o=ae(e,t.clientId);if(null===o)return V;const r=Ie(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 ve(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId===n.clientId?V:be(e)}const ke=O((e=>{const t=ve(e);return t.length?t.map((t=>W(e,t))):V}),(e=>[...be.getDependants(e),e.blocks.byClientId,e.blocks.order,e.blocks.attributes]));function _e(e){return(0,u.first)(ve(e))||null}function ye(e){return(0,u.last)(ve(e))||null}function Ee(e,t){return _e(e)===t}function Ce(e,t){return-1!==ve(e).indexOf(t)}const Se=O(((e,t)=>{let n=t,o=!1;for(;n&&!o;)n=ae(e,n),o=Ce(e,n);return o}),(e=>[e.blocks.order,e.selection.selectionStart.clientId,e.selection.selectionEnd.clientId]));function we(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId===n.clientId?null:t.clientId||null}function Be(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId===n.clientId?null:n.clientId||null}function Ie(e,t){return e.blocks.order[t||""]||V}function xe(e,t,n){return Ie(e,n).indexOf(t)}function Te(e,t){const{selectionStart:n,selectionEnd:o}=e.selection;return n.clientId===o.clientId&&n.clientId===t}function Ne(e,t,n=!1){return(0,u.some)(Ie(e,t),(t=>Te(e,t)||Ce(e,t)||n&&Ne(e,t,n)))}function Pe(e,t){if(!t)return!1;const n=ve(e),o=n.indexOf(t);return o>-1&&o<n.length-1}function Re(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId!==n.clientId}function Me(e){return e.isMultiSelecting}function Le(e){return e.isSelectionEnabled}function Ae(e,t){return e.blocksMode[t]||"visual"}function De(e){return e.isTyping}function Oe(e){return!!e.draggedBlocks.length}function Fe(e){return e.draggedBlocks}function ze(e,t){return e.draggedBlocks.includes(t)}function Ve(e,t){if(!Oe(e))return!1;const n=ce(e,t);return(0,u.some)(n,(t=>ze(e,t)))}function He(e){return e.isCaretWithinFormattedText}function Ue(e){let t,n;const{insertionPoint:o,selection:{selectionEnd:r}}=e;if(null!==o)return o;const{clientId:l}=r;return l?(t=ae(e,l)||void 0,n=xe(e,r.clientId,t)+1):n=Ie(e).length,{rootClientId:t,index:n}}function Ge(e){return null!==e.insertionPoint}function We(e){return e.template.isValid}function $e(e){return e.settings.template}function je(e,t){if(!t)return e.settings.templateLock;const n=ht(e,t);return n?n.templateLock:null}const Ke=(e,t,n=null)=>(0,u.isBoolean)(e)?e:(0,u.isArray)(e)?!(!e.includes("core/post-content")||null!==t)||e.includes(t):n,qe=(e,t,n=null)=>{let o;if(t&&"object"==typeof t?(o=t,t=o.name):o=(0,r.getBlockType)(t),!o)return!1;const{allowedBlockTypes:l}=bt(e);if(!Ke(l,t,!0))return!1;if(je(e,n))return!1;const i=ht(e,n);if(n&&void 0===i)return!1;const s=null==i?void 0:i.allowedBlocks,a=Ke(s,t),c=o.parent,u=H(e,n),d=Ke(c,u);return null!==a&&null!==d?a||d:null!==a?a:null===d||d},Ye=O(qe,((e,t,n)=>[e.blockListSettings[n],e.blocks.byClientId[n],e.settings.allowedBlockTypes,e.settings.templateLock]));function Ze(e,t,n=null){return t.every((t=>Ye(e,H(e,t),n)))}function Xe(e,t,n=null){const o=G(e,t);if(null===o)return!0;const{lock:r}=o,l=!!je(e,n);return void 0===r||void 0===(null==r?void 0:r.remove)?!l:!(null!=r&&r.remove)}function Qe(e,t,n=null){return t.every((t=>Xe(e,t,n)))}function Je(e,t,n=null){const o=G(e,t);if(null===o)return;const{lock:r}=o,l="all"===je(e,n);return void 0===r||void 0===(null==r?void 0:r.move)?!l:!(null!=r&&r.move)}function et(e,t,n=null){return t.every((t=>Je(e,t,n)))}function tt(e,t){var n,o;return null!==(n=null===(o=e.preferences.insertUsage)||void 0===o?void 0:o[t])&&void 0!==n?n:null}const nt=(e,t,n)=>!!(0,r.hasBlockSupport)(t,"inserter",!0)&&qe(e,t.name,n),ot=(e,t)=>n=>{const o=`${t.id}/${n.name}`,{time:r,count:l=0}=tt(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:rt(r,l)}},rt=(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}},lt=(e,{buildScope:t="inserter"})=>n=>{const o=n.name;let l=!1;(0,r.hasBlockSupport)(n.name,"multiple",!0)||(l=(0,u.some)(Q(e,Z(e)),{name:n.name}));const{time:i,count:s=0}=tt(e,o)||{},a={id:o,name:n.name,title:n.title,icon:n.icon,isDisabled:l,frecency:rt(i,s)};if("transform"===t)return a;const c=(0,r.getBlockVariations)(n.name,"inserter");return{...a,initialAttributes:{},description:n.description,category:n.category,keywords:n.keywords,variations:c,example:n.example,utility:1}},it=O(((e,t=null)=>{const n=lt(e,{buildScope:"inserter"}),o=(0,r.getBlockTypes)().filter((n=>nt(e,n,t))).map(n),l=qe(e,"core/block",t)?St(e).map((t=>{const n=`core/block/${t.id}`,o=_t(e,t.id);let l;1===o.length&&(l=(0,r.getBlockType)(o[0].name));const{time:i,count:a=0}=tt(e,n)||{},c=rt(i,a);return{id:n,name:"core/block",initialAttributes:{ref:t.id},title:t.title.raw,icon:l&&"web"===s.Platform.OS?l.icon:z,category:"reusable",keywords:[],isDisabled:!1,utility:1,frecency:c}})):[],i=o.filter((({variations:e=[]})=>!e.some((({isDefault:e})=>e)))),a=[];for(const t of o){const{variations:n=[]}=t;if(n.length){const o=ot(e,t);a.push(...n.map(o))}}const c=(e,t)=>{const{core:n,noncore:o}=e;return(t.name.startsWith("core/")?n:o).push(t),e},u=i.reduce(c,{core:[],noncore:[]}),d=a.reduce(c,{core:[],noncore:[]});return[...u.core,...d.core,...u.noncore,...d.noncore,...l]}),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId,e.blocks.order,e.preferences.insertUsage,e.settings.allowedBlockTypes,e.settings.templateLock,St(e),(0,r.getBlockTypes)()])),st=O(((e,t,n=null)=>{const o=lt(e,{buildScope:"transform"}),l=(0,r.getBlockTypes)().filter((t=>nt(e,t,n))).map(o),i=(0,u.mapKeys)(l,(({name:e})=>e)),s=(0,r.getPossibleBlockTransformations)(t).reduce(((e,t)=>(i[null==t?void 0:t.name]&&e.push(i[t.name]),e)),[]);return(0,u.orderBy)(s,(e=>i[e.name].frecency),"desc")}),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId,e.preferences.insertUsage,e.settings.allowedBlockTypes,e.settings.templateLock,(0,r.getBlockTypes)()])),at=O(((e,t=null)=>!!(0,u.some)((0,r.getBlockTypes)(),(n=>nt(e,n,t)))||qe(e,"core/block",t)&&St(e).length>0),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId,e.settings.allowedBlockTypes,e.settings.templateLock,St(e),(0,r.getBlockTypes)()])),ct=O(((e,t=null)=>{if(t)return(0,u.filter)((0,r.getBlockTypes)(),(n=>nt(e,n,t)))}),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId,e.settings.allowedBlockTypes,e.settings.templateLock,(0,r.getBlockTypes)()])),ut=O(((e,t=null)=>{var n,o;if(!t)return;const r=null===(n=e.blockListSettings[t])||void 0===n?void 0:n.__experimentalDefaultBlock,l=null===(o=e.blockListSettings[t])||void 0===o?void 0:o.__experimentalDirectInsert;return r&&l?"function"==typeof l?l(W(e,t))?r:null:r:void 0}),((e,t)=>[e.blockListSettings[t],e.blocks.tree[t]])),dt=O(((e,t)=>{const n=e.settings.__experimentalBlockPatterns.find((({name:e})=>e===t));return n?{...n,blocks:(0,r.parse)(n.content)}:null}),(e=>[e.settings.__experimentalBlockPatterns])),pt=O((e=>{const t=e.settings.__experimentalBlockPatterns,{allowedBlockTypes:n}=bt(e);return t.map((({name:t})=>dt(e,t))).filter((({blocks:e})=>((e,t)=>{if((0,u.isBoolean)(t))return t;const n=[...e];for(;n.length>0;){var o;const e=n.shift();if(!Ke(t,e.name||e.blockName,!0))return!1;null===(o=e.innerBlocks)||void 0===o||o.forEach((e=>{n.push(e)}))}return!0})(e,n)))}),(e=>[e.settings.__experimentalBlockPatterns,e.settings.allowedBlockTypes])),mt=O(((e,t=null)=>{const n=pt(e);return(0,u.filter)(n,(({blocks:n})=>n.every((({name:n})=>Ye(e,n,t)))))}),((e,t)=>[e.settings.__experimentalBlockPatterns,e.settings.allowedBlockTypes,e.settings.templateLock,e.blockListSettings[t],e.blocks.byClientId[t]])),ft=O(((e,t,n=null)=>{if(!t)return V;const o=mt(e,n),r=Array.isArray(t)?t:[t];return o.filter((e=>{var t,n;return null==e||null===(t=e.blockTypes)||void 0===t||null===(n=t.some)||void 0===n?void 0:n.call(t,(e=>r.includes(e)))}))}),((e,t)=>[...mt.getDependants(e,t)])),gt=O(((e,t,n=null)=>{if(!t)return V;if(t.some((({clientId:t,innerBlocks:n})=>n.length||Tt(e,t))))return V;const o=Array.from(new Set(t.map((({name:e})=>e))));return ft(e,o,n)}),((e,t)=>[...ft.getDependants(e,t)]));function ht(e,t){return e.blockListSettings[t]}function bt(e){return e.settings}function vt(e){return e.blocks.isPersistentChange}const kt=O(((e,t=[])=>t.reduce(((t,n)=>e.blockListSettings[n]?{...t,[n]:e.blockListSettings[n]}:t),{})),(e=>[e.blockListSettings])),_t=O(((e,t)=>{const n=(0,u.find)(St(e),(e=>e.id===t));return n?(0,r.parse)("string"==typeof n.content.raw?n.content.raw:n.content):null}),(e=>[St(e)])),yt=O(((e,t)=>{var n;const o=(0,u.find)(St(e),(e=>e.id===t));return o?null===(n=o.title)||void 0===n?void 0:n.raw:null}),(e=>[St(e)]));function Et(e){return e.blocks.isIgnoredChange}function Ct(e){return e.lastBlockAttributesChange}function St(e){var t,n;return null!==(t=null==e||null===(n=e.settings)||void 0===n?void 0:n.__experimentalReusableBlocks)&&void 0!==t?t:V}function wt(e){return e.isNavigationMode}function Bt(e){return e.hasBlockMovingClientId}function It(e){return!!e.automaticChangeStatus}function xt(e,t){return e.highlightedBlock===t}function Tt(e,t){return!!e.blocks.controlledInnerBlocks[t]}const Nt=O(((e,t)=>{if(!t.length)return null;const n=ie(e);if(t.includes(H(e,n)))return n;const o=ve(e),r=ue(e,n||o[0],t);return r?(0,u.last)(r):null}),((e,t)=>[e.selection.selectionStart.clientId,e.selection.selectionEnd.clientId,t]));function Pt(e,t,n){const{lastBlockInserted:o}=e;return o.clientId===t&&o.source===n}var Rt=window.wp.a11y,Mt=window.wp.richText,Lt=window.wp.deprecated,At=n.n(Lt),Dt={SLEEP:({duration:e})=>new Promise((t=>{setTimeout(t,e)})),MARK_AUTOMATIC_CHANGE_FINAL_CONTROL:(0,m.createRegistryControl)((e=>()=>{const{requestIdleCallback:t=(e=>setTimeout(e,100))}=window;t((()=>e.dispatch(Wn).__unstableMarkAutomaticChangeFinal()))}))};const Ot="core/block-editor";function*Ft(){if(0===(yield m.controls.select(Ot,"getBlockCount"))){const{__unstableHasCustomAppender:e}=yield m.controls.select(Ot,"getSettings");if(e)return;return yield In()}}function*zt(e){return yield{type:"RESET_BLOCKS",blocks:e},yield*Vt(e)}function*Vt(e){const t=yield m.controls.select(Ot,"getTemplate"),n=yield m.controls.select(Ot,"getTemplateLock"),o=!t||"all"!==n||(0,r.doBlocksMatchTemplate)(e,t);if(o!==(yield m.controls.select(Ot,"isValidTemplate")))return yield pn(o),o}function Ht(e,t,n){return{type:"RESET_SELECTION",selectionStart:e,selectionEnd:t,initialPosition:n}}function Ut(e){return At()('wp.data.dispatch( "core/block-editor" ).receiveBlocks',{since:"5.9",alternative:"resetBlocks or insertBlocks"}),{type:"RECEIVE_BLOCKS",blocks:e}}function Gt(e,t,n=!1){return{type:"UPDATE_BLOCK_ATTRIBUTES",clientIds:(0,u.castArray)(e),attributes:t,uniqueByBlock:n}}function Wt(e,t){return{type:"UPDATE_BLOCK",clientId:e,updates:t}}function $t(e,t=0){return{type:"SELECT_BLOCK",initialPosition:t,clientId:e}}function*jt(e){const t=yield m.controls.select(Ot,"getPreviousBlockClientId",e);if(t)return yield $t(t,-1),[t]}function*Kt(e){const t=yield m.controls.select(Ot,"getNextBlockClientId",e);if(t)return yield $t(t),[t]}function qt(){return{type:"START_MULTI_SELECT"}}function Yt(){return{type:"STOP_MULTI_SELECT"}}function*Zt(e,t){if((yield m.controls.select(Ot,"getBlockRootClientId",e))!==(yield m.controls.select(Ot,"getBlockRootClientId",t)))return;yield{type:"MULTI_SELECT",start:e,end:t};const n=yield m.controls.select(Ot,"getSelectedBlockCount");(0,Rt.speak)((0,g.sprintf)(
|
| 2 |
/* translators: %s: number of selected blocks */
|
| 3 |
-
(0,g._n)("%s block selected.","%s blocks selected.",n),n),"assertive")}function Xt(){return{type:"CLEAR_SELECTED_BLOCK"}}function Qt(e=!0){return{type:"TOGGLE_SELECTION",isSelectionEnabled:e}}function Jt(e,t){var n,o;const l=null!==(n=null==t||null===(o=t.__experimentalPreferredStyleVariations)||void 0===o?void 0:o.value)&&void 0!==n?n:{};return e.map((e=>{var t;const n=e.name;if(!(0,r.hasBlockSupport)(n,"defaultStylePicker",!0))return e;if(!l[n])return e;const o=null===(t=e.attributes)||void 0===t?void 0:t.className;if(null!=o&&o.includes("is-style-"))return e;const{attributes:i={}}=e,s=l[n];return{...e,attributes:{...i,className:`${o||""} is-style-${s}`.trim()}}}))}function*en(e,t,n,o=0,r){e=(0,u.castArray)(e),t=Jt((0,u.castArray)(t),yield m.controls.select(Ot,"getSettings"));const l=yield m.controls.select(Ot,"getBlockRootClientId",(0,u.first)(e));for(let e=0;e<t.length;e++){const n=t[e];if(!(yield m.controls.select(Ot,"canInsertBlockType",n.name,l)))return}yield{type:"REPLACE_BLOCKS",clientIds:e,blocks:t,time:Date.now(),indexToSelect:n,initialPosition:o,meta:r},yield*Ft()}function tn(e,t){return en(e,t)}function nn(e){return function*(t,n){(yield m.controls.select(Ot,"canMoveBlocks",t,n))&&(yield{clientIds:(0,u.castArray)(t),type:e,rootClientId:n})}}const on=nn("MOVE_BLOCKS_DOWN"),rn=nn("MOVE_BLOCKS_UP");function*ln(e,t="",n="",o){const r=yield m.controls.select(Ot,"canMoveBlocks",e,t),l=yield m.controls.select(Ot,"canRemoveBlocks",e,t);if(!r)return;const i={type:"MOVE_BLOCKS_TO_POSITION",fromRootClientId:t,toRootClientId:n,clientIds:e,index:o};t!==n?l&&(yield m.controls.select(Ot,"canInsertBlocks",e,n))&&(yield i):yield i}function*sn(e,t="",n="",o){yield ln([e],t,n,o)}function an(e,t,n,o=!0,r){return cn([e],t,n,o,0,r)}function*cn(e,t,n,o=!0,r=0,l){(0,u.isObject)(r)&&(l=r,r=0,At()("meta argument in wp.data.dispatch('core/block-editor')",{since:"10.1",plugin:"Gutenberg",hint:"The meta argument is now the 6th argument of the function"})),e=Jt((0,u.castArray)(e),yield m.controls.select(Ot,"getSettings"));const i=[];for(const t of e)(yield m.controls.select(Ot,"canInsertBlockType",t.name,n))&&i.push(t);if(i.length)return{type:"INSERT_BLOCKS",blocks:i,index:t,rootClientId:n,time:Date.now(),updateSelection:o,initialPosition:o?r:null,meta:l}}function un(e,t,n={}){const{__unstableWithInserter:o}=n;return{type:"SHOW_INSERTION_POINT",rootClientId:e,index:t,__unstableWithInserter:o}}function dn(){return{type:"HIDE_INSERTION_POINT"}}function pn(e){return{type:"SET_TEMPLATE_VALIDITY",isValid:e}}function*mn(){yield{type:"SYNCHRONIZE_TEMPLATE"};const e=yield m.controls.select(Ot,"getBlocks"),t=yield m.controls.select(Ot,"getTemplate"),n=(0,r.synchronizeBlocksWithTemplate)(e,t);return yield zt(n)}function*fn(e,t){const n=[e,t];yield{type:"MERGE_BLOCKS",blocks:n};const[o,l]=n,i=yield m.controls.select(Ot,"getBlock",o),s=(0,r.getBlockType)(i.name);if(s&&!s.merge)return void(yield $t(i.clientId));const a=yield m.controls.select(Ot,"getBlock",l),c=(0,r.getBlockType)(a.name),{clientId:d,attributeKey:p,offset:f}=yield m.controls.select(Ot,"getSelectionStart"),g=(d===o?s:c).attributes[p],h=(d===o||d===l)&&void 0!==p&&void 0!==f&&!!g;g||("number"==typeof p?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 p):window.console.error("The RichText identifier prop does not match any attributes defined by the block."));const b=(0,r.cloneBlock)(i),v=(0,r.cloneBlock)(a);if(h){const e=d===o?b:v,t=e.attributes[p],{multiline:n,__unstableMultilineWrapperTags:r,__unstablePreserveWhiteSpace:l}=g,i=(0,Mt.insert)((0,Mt.create)({html:t,multilineTag:n,multilineWrapperTags:r,preserveWhiteSpace:l}),"",f,f);e.attributes[p]=(0,Mt.toHTMLString)({value:i,multilineTag:n,preserveWhiteSpace:l})}const k=i.name===a.name?[v]:(0,r.switchToBlockType)(v,i.name);if(!k||!k.length)return;const _=s.merge(b.attributes,k[0].attributes);if(h){const e=(0,u.findKey)(_,(e=>"string"==typeof e&&-1!==e.indexOf(""))),t=_[e],{multiline:n,__unstableMultilineWrapperTags:o,__unstablePreserveWhiteSpace:r}=s.attributes[e],l=(0,Mt.create)({html:t,multilineTag:n,multilineWrapperTags:o,preserveWhiteSpace:r}),a=l.text.indexOf(""),c=(0,Mt.remove)(l,a,a+1),d=(0,Mt.toHTMLString)({value:c,multilineTag:n,preserveWhiteSpace:r});_[e]=d,yield Bn(i.clientId,e,a,a)}yield*en([i.clientId,a.clientId],[{...i,attributes:{...i.attributes,..._}},...k.slice(1)],0)}function*gn(e,t=!0){if(!e||!e.length)return;e=(0,u.castArray)(e);const n=yield m.controls.select(Ot,"getBlockRootClientId",e[0]);if(!(yield m.controls.select(Ot,"canRemoveBlocks",e,n)))return;let o;o=t?yield jt(e[0]):yield m.controls.select(Ot,"getPreviousBlockClientId",e[0]),yield{type:"REMOVE_BLOCKS",clientIds:e};const r=yield*Ft();return[o||r]}function hn(e,t){return gn([e],t)}function bn(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 vn(e){return{type:"TOGGLE_BLOCK_MODE",clientId:e}}function kn(){return{type:"START_TYPING"}}function yn(){return{type:"STOP_TYPING"}}function En(e=[]){return{type:"START_DRAGGING_BLOCKS",clientIds:e}}function Cn(){return{type:"STOP_DRAGGING_BLOCKS"}}function Sn(){return{type:"ENTER_FORMATTED_TEXT"}}function wn(){return{type:"EXIT_FORMATTED_TEXT"}}function Bn(e,t,n,o){return{type:"SELECTION_CHANGE",clientId:e,attributeKey:t,startOffset:n,endOffset:o}}function In(e,t,n){const o=(0,r.getDefaultBlockName)();if(o)return an((0,r.createBlock)(o,e),n,t)}function xn(e,t){return{type:"UPDATE_BLOCK_LIST_SETTINGS",clientId:e,settings:t}}function Tn(e){return{type:"UPDATE_SETTINGS",settings:e}}function Nn(e,t){return{type:"SAVE_REUSABLE_BLOCK_SUCCESS",id:e,updatedId:t}}function Pn(){return{type:"MARK_LAST_CHANGE_AS_PERSISTENT"}}function Rn(){return{type:"MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"}}function*Mn(){yield{type:"MARK_AUTOMATIC_CHANGE"},yield{type:"MARK_AUTOMATIC_CHANGE_FINAL_CONTROL"}}function Ln(){return{type:"MARK_AUTOMATIC_CHANGE_FINAL"}}function*An(e=!0){yield{type:"SET_NAVIGATION_MODE",isNavigationMode:e},e?(0,Rt.speak)((0,g.__)("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.")):(0,Rt.speak)((0,g.__)("You are currently in edit mode. To return to the navigation mode, press Escape."))}function*Dn(e=null){yield{type:"SET_BLOCK_MOVING_MODE",hasBlockMovingClientId:e},e&&(0,Rt.speak)((0,g.__)("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."))}function*On(e,t=!0){if(!e&&!e.length)return;const n=yield m.controls.select(Ot,"getBlocksByClientId",e),o=yield m.controls.select(Ot,"getBlockRootClientId",e[0]);if((0,u.some)(n,(e=>!e)))return;const l=n.map((e=>e.name));if((0,u.some)(l,(e=>!(0,r.hasBlockSupport)(e,"multiple",!0))))return;const i=yield m.controls.select(Ot,"getBlockIndex",(0,u.last)((0,u.castArray)(e)),o),s=n.map((e=>(0,r.__experimentalCloneSanitizedBlock)(e)));return yield cn(s,i+1,o,t),s.length>1&&t&&(yield Zt((0,u.first)(s).clientId,(0,u.last)(s).clientId)),s.map((e=>e.clientId))}function*Fn(e){if(!e)return;const t=yield m.controls.select(Ot,"getBlockRootClientId",e);if(yield m.controls.select(Ot,"getTemplateLock",t))return;const n=yield m.controls.select(Ot,"getBlockIndex",e,t);return yield In({},t,n)}function*zn(e){if(!e)return;const t=yield m.controls.select(Ot,"getBlockRootClientId",e);if(yield m.controls.select(Ot,"getTemplateLock",t))return;const n=yield m.controls.select(Ot,"getBlockIndex",e,t);return yield In({},t,n+1)}function Vn(e,t){return{type:"TOGGLE_BLOCK_HIGHLIGHT",clientId:e,isHighlighted:t}}function*Hn(e){yield Vn(e,!0),yield{type:"SLEEP",duration:150},yield Vn(e,!1)}function Un(e,t){return{type:"SET_HAS_CONTROLLED_INNER_BLOCKS",hasControlledInnerBlocks:t,clientId:e}}const Gn={reducer:M,selectors:e,actions:t,controls:Dt},Wn=(0,m.createReduxStore)(Ot,{...Gn,persist:["preferences"]});(0,m.registerStore)(Ot,{...Gn,persist:["preferences"]});const $n={name:"",isSelected:!1},jn=(0,s.createContext)($n),{Provider:Kn}=jn;function qn(){return(0,s.useContext)(jn)}function Yn(){const{isSelected:e,clientId:t,name:n}=qn();return(0,m.useSelect)((o=>{if(e)return!0;const{getBlockName:r,isFirstMultiSelectedBlock:l,getMultiSelectedBlockClientIds:i}=o(Wn);return!!l(t)&&i().every((e=>r(e)===n))}),[t,e,n])}function Zn({group:e="default",controls:t,children:n,__experimentalShareWithChildBlocks:o=!1}){const l=function(e,t){const n=Yn(),{clientId:o}=qn(),l=(0,m.useSelect)((e=>{const{getBlockName:n,hasSelectedInnerBlock:l}=e(Wn),{hasBlockSupport:i}=e(r.store);return t&&i(n(o),"__experimentalExposeControlsToChildren",!1)&&l(o)}),[t,o]);var i;return n?null===(i=f[e])||void 0===i?void 0:i.Fill:l?f.parent.Fill:null}(e,o);return l?(0,s.createElement)(p.__experimentalStyleProvider,{document:document},(0,s.createElement)(l,null,(o=>{const r=(0,u.isEmpty)(o)?null:o;return(0,s.createElement)(p.__experimentalToolbarContext.Provider,{value:r},"default"===e&&(0,s.createElement)(p.ToolbarGroup,{controls:t}),n)}))):null}function Xn({group:e="default",...t}){const n=(0,s.useContext)(p.__experimentalToolbarContext),o=f[e].Slot,r=(0,p.__experimentalUseSlot)(o.__unstableName);return Boolean(r.fills&&r.fills.length)?"default"===e?(0,s.createElement)(o,i({},t,{bubblesVirtually:!0,fillProps:n})):(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(o,i({},t,{bubblesVirtually:!0,fillProps:n}))):null}const Qn=Zn;Qn.Slot=Xn;const Jn=e=>(0,s.createElement)(Zn,i({group:"inline"},e));Jn.Slot=e=>(0,s.createElement)(Xn,i({group:"inline"},e));var eo=Qn,to=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M5 15h14V9H5v6zm0 4.8h14v-1.5H5v1.5zM5 4.2v1.5h14V4.2H5z"})),no=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M4 9v6h14V9H4zm8-4.8H4v1.5h8V4.2zM4 19.8h8v-1.5H4v1.5z"})),oo=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M7 9v6h10V9H7zM5 19.8h14v-1.5H5v1.5zM5 4.3v1.5h14V4.3H5z"})),ro=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M6 15h14V9H6v6zm6-10.8v1.5h8V4.2h-8zm0 15.6h8v-1.5h-8v1.5z"})),lo=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M5 9v6h14V9H5zm11-4.8H8v1.5h8V4.2zM8 19.8h8v-1.5H8v1.5z"})),io=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M5 4v11h14V4H5zm3 15.8h8v-1.5H8v1.5z"})),so=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M9 9v6h11V9H9zM4 20h1.5V4H4v16z"})),ao=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M20 9h-7.2V4h-1.6v5H4v6h7.2v5h1.6v-5H20z"})),co=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z"})),uo=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z"}));function po(e,t=""){return e.split(",").map((e=>`.editor-styles-wrapper ${e} ${t}`)).join(",")}const mo={"color.palette":e=>void 0===e.colors?void 0:e.colors,"color.gradients":e=>void 0===e.gradients?void 0: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=>void 0===e.fontSizes?void 0:e.fontSizes,"typography.customFontSize":e=>void 0===e.disableCustomFontSizes?void 0:!e.disableCustomFontSizes,"typography.customLineHeight":e=>e.enableCustomLineHeight,"spacing.units":e=>{if(void 0!==e.enableCustomUnits)return!0===e.enableCustomUnits?["px","em","rem","vh","vw","%"]:e.enableCustomUnits},"spacing.customPadding":e=>e.enableCustomSpacing};function fo(e){const{name:t}=qn();return(0,m.useSelect)((n=>{var o;const l=n(Wn).getSettings(),i=`__experimentalFeatures.${e}`,s=`__experimentalFeatures.blocks.${t}.${e}`,a=null!==(o=(0,u.get)(l,s))&&void 0!==o?o:(0,u.get)(l,i);var c,d;if(void 0!==a)return r.__EXPERIMENTAL_PATHS_WITH_MERGE[e]?null!==(c=null!==(d=a.user)&&void 0!==d?d:a.theme)&&void 0!==c?c:a.core:a;const p=mo[e]?mo[e](l):void 0;return void 0!==p?p:"typography.dropCap"===e||void 0}),[t,e])}const go={left:so,center:ao,right:co,"space-between":uo};var ho=function({allowedControls:e=["left","center","right","space-between"],isCollapsed:t=!0,onChange:n,value:o,popoverProps:r,isToolbar:l}){const a=e=>{n(e===o?void 0:e)},c=o?go[o]:go.left,u=[{name:"left",icon:so,title:(0,g.__)("Justify items left"),isActive:"left"===o,onClick:()=>a("left")},{name:"center",icon:ao,title:(0,g.__)("Justify items center"),isActive:"center"===o,onClick:()=>a("center")},{name:"right",icon:co,title:(0,g.__)("Justify items right"),isActive:"right"===o,onClick:()=>a("right")},{name:"space-between",icon:uo,title:(0,g.__)("Space between items"),isActive:"space-between"===o,onClick:()=>a("space-between")}],d=l?p.ToolbarGroup:p.ToolbarDropdownMenu,m=l?{isCollapsed:t}:{};return(0,s.createElement)(d,i({icon:c,popoverProps:r,label:(0,g.__)("Change items justification"),controls:u.filter((t=>e.includes(t.name)))},m))};function bo(e){return(0,s.createElement)(ho,i({},e,{isToolbar:!1}))}function vo(e){return(0,s.createElement)(ho,i({},e,{isToolbar:!0}))}const ko={left:"flex-start",right:"flex-end",center:"center","space-between":"space-between"};var _o={name:"flex",label:(0,g.__)("Flex"),inspectorControls:function({layout:e={},onChange:t}){return(0,s.createElement)(Eo,{layout:e,onChange:t})},toolBarControls:function({layout:e={},onChange:t,layoutBlockSupport:n}){return null!=n&&n.allowSwitching?null:(0,s.createElement)(eo,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(Eo,{layout:e,onChange:t,isToolbar:!0}))},save:function({selector:e,layout:t}){const n=null!==fo("spacing.blockGap"),o=ko[t.justifyContent]||"flex-start";return(0,s.createElement)("style",null,`\n\t\t\t\t${po(e)} {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tgap: ${n?"var( --wp--style--block-gap, 0.5em )":"0.5em"};\n\t\t\t\t\tflex-wrap: wrap;\n\t\t\t\t\talign-items: center;\n\t\t\t\t\tflex-direction: row;\n\t\t\t\t\tjustify-content: ${o};\n\t\t\t\t}\n\n\t\t\t\t${po(e,"> *")} {\n\t\t\t\t\tmargin: 0;\n\t\t\t\t}\n\t\t\t`)},getOrientation:()=>"horizontal",getAlignments:()=>[]};const yo=[{value:"left",icon:so,label:(0,g.__)("Justify items left")},{value:"center",icon:ao,label:(0,g.__)("Justify items center")},{value:"right",icon:co,label:(0,g.__)("Justify items right")},{value:"space-between",icon:uo,label:(0,g.__)("Space between items")}];function Eo({layout:e,onChange:t,isToolbar:n=!1}){const{justifyContent:o="left"}=e,r=n=>{t({...e,justifyContent:n})};return n?(0,s.createElement)(bo,{allowedControls:["left","center","right","space-between"],value:o,onChange:r,popoverProps:{position:"bottom right",isAlternate:!0}}):(0,s.createElement)("fieldset",{className:"block-editor-hooks__flex-layout-justification-controls"},(0,s.createElement)("legend",null,(0,g.__)("Justification")),(0,s.createElement)("div",null,yo.map((({value:e,icon:t,label:n})=>(0,s.createElement)(p.Button,{key:e,label:n,icon:t,isPressed:o===e,onClick:()=>r(e)})))))}var Co=function({icon:e,size:t=24,...n}){return(0,s.cloneElement)(e,{width:t,height:t,...n})};const So=[{name:"default",label:(0,g.__)("Flow"),inspectorControls:function({layout:e,onChange:t}){const{wideSize:n,contentSize:o}=e,r=(0,p.__experimentalUseCustomUnits)({availableUnits:fo("spacing.units")||["%","px","em","rem","vw"]});return(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)(p.__experimentalUnitControl,{label:(0,g.__)("Content"),labelPosition:"top",__unstableInputWidth:"80px",value:o||n||"",onChange:n=>{n=0>parseFloat(n)?"0":n,t({...e,contentSize:n})},units:r}),(0,s.createElement)(Co,{icon:oo})),(0,s.createElement)("div",{className:"block-editor-hooks__layout-controls-unit"},(0,s.createElement)(p.__experimentalUnitControl,{label:(0,g.__)("Wide"),labelPosition:"top",__unstableInputWidth:"80px",value:n||o||"",onChange:n=>{n=0>parseFloat(n)?"0":n,t({...e,wideSize:n})},units:r}),(0,s.createElement)(Co,{icon:lo}))),(0,s.createElement)("div",{className:"block-editor-hooks__layout-controls-reset"},(0,s.createElement)(p.Button,{variant:"secondary",isSmall:!0,disabled:!o&&!n,onClick:()=>t({contentSize:void 0,wideSize:void 0,inherit:!1})},(0,g.__)("Reset"))),(0,s.createElement)("p",{className:"block-editor-hooks__layout-controls-helptext"},(0,g.__)("Customize the width for all elements that are assigned to the center or wide columns.")))},toolBarControls:function(){return null},save:function({selector:e,layout:t={}}){const{contentSize:n,wideSize:o}=t,r=null!==fo("spacing.blockGap");let l=n||o?`\n\t\t\t\t\t${po(e,"> *")} {\n\t\t\t\t\t\tmax-width: ${null!=n?n:o};\n\t\t\t\t\t\tmargin-left: auto !important;\n\t\t\t\t\t\tmargin-right: auto !important;\n\t\t\t\t\t}\n\n\t\t\t\t\t${po(e,'> [data-align="wide"]')} {\n\t\t\t\t\t\tmax-width: ${null!=o?o:n};\n\t\t\t\t\t}\n\n\t\t\t\t\t${po(e,'> [data-align="full"]')} {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`:"";return l+=`\n\t\t\t${po(e,'> [data-align="left"]')} {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-right: 2em;\n\t\t\t}\n\n\t\t\t${po(e,'> [data-align="right"]')} {\n\t\t\t\tfloat: right;\n\t\t\t\tmargin-left: 2em;\n\t\t\t}\n\n\t\t`,r&&(l+=`\n\t\t\t\t${po(e,"> *")} {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\tmargin-bottom: 0;\n\t\t\t\t}\n\t\t\t\t${po(e,"> * + *")} {\n\t\t\t\t\tmargin-top: var( --wp--style--block-gap );\n\t\t\t\t}\n\t\t\t`),(0,s.createElement)("style",null,l)},getOrientation:()=>"vertical",getAlignments(e){const t=function(e){const{contentSize:t,wideSize:n}=e,o={},r=/^(?!0)\d+(px|em|rem|vw|vh|%)?$/i;return r.test(t)&&(
|
| 4 |
// translators: %s: container size (i.e. 600px etc)
|
| 5 |
-
o.none=(0,
|
| 6 |
// translators: %s: container size (i.e. 600px etc)
|
| 7 |
-
o.wide=(0,g.sprintf)((0,g.__)("Max %s wide"),n)),o}(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}},_o];function wo(e="default"){return So.find((t=>t.name===e))}const Bo={type:"default"},Io=(0,s.createContext)(Bo),xo=Io.Provider;function To({layout:e={},...t}){const n=wo(e.type);return n?(0,s.createElement)(n.save,i({layout:e},t)):null}const No=["none","left","center","right","wide","full"],Po=["wide","full"];function Ro(e=No){e.includes("none")||(e=["none",...e]);const{wideControlsEnabled:t=!1,themeSupportsLayout:n}=(0,m.useSelect)((e=>{const{getSettings:t}=e(Wn),n=t();return{wideControlsEnabled:n.alignWide,themeSupportsLayout:n.supportsLayout}}),[]),o=(0,s.useContext)(Io),r=wo(null==o?void 0:o.type),l=r.getAlignments(o);if(n){const t=l.filter((({name:t})=>e.includes(t)));return 1===t.length&&"none"===t[0].name?[]:t}if("default"!==r.name)return[];const{alignments:i=No}=o,a=e.filter((e=>(o.alignments||t||!Po.includes(e))&&i.includes(e))).map((e=>({name:e})));return 1===a.length&&"none"===a[0].name?[]:a}const Mo={none:{icon:to,title:(0,g.__)("None")},left:{icon:no,title:(0,g.__)("Align left")},center:{icon:oo,title:(0,g.__)("Align center")},right:{icon:ro,title:(0,g.__)("Align right")},wide:{icon:lo,title:(0,g.__)("Wide width")},full:{icon:io,title:(0,g.__)("Full width")}},Lo={isAlternate:!0};var Ao=function({value:e,onChange:t,controls:n,isToolbar:o,isCollapsed:r=!0}){const l=Ro(n);if(!l.length)return null;function a(n){t([e,"none"].includes(n)?void 0:n)}const u=Mo[e],d=Mo.none,m=o?p.ToolbarGroup:p.ToolbarDropdownMenu,f={popoverProps:Lo,icon:u?u.icon:d.icon,label:(0,g.__)("Align"),toggleProps:{describedBy:(0,g.__)("Change alignment")}},h=o||s.Platform.isNative?{isCollapsed:o?r:void 0,controls:l.map((({name:t})=>({...Mo[t],isActive:e===t||!e&&"none"===t,role:r?"menuitemradio":void 0,onClick:()=>a(t)})))}:{children:({onClose:t})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.MenuGroup,{className:"block-editor-block-alignment-control__menu-group"},l.map((({name:n,info:o})=>{const{icon:r,title:l}=Mo[n],i=n===e||!e&&"none"===n;return(0,s.createElement)(p.MenuItem,{key:n,icon:r,iconPosition:"left",className:c()("components-dropdown-menu__menu-item",{"is-active":i}),isSelected:i,onClick:()=>{a(n),t()},role:"menuitemradio",info:o},l)}))))};return(0,s.createElement)(m,i({},f,h))};function Do(e){return(0,s.createElement)(Ao,i({},e,{isToolbar:!1}))}function Oo(e){return(0,s.createElement)(Ao,i({},e,{isToolbar:!0}))}const Fo=["left","center","right","wide","full"],zo=["wide","full"];function Vo(e,t=!0,n=!0){let o;return o=Array.isArray(e)?Fo.filter((t=>e.includes(t))):!0===e?[...Fo]:[],!n||!0===e&&!t?(0,u.without)(o,...zo):o}const Ho=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n}=t,o=Ro(Vo((0,r.getBlockSupport)(n,"align"),(0,r.hasBlockSupport)(n,"alignWide",!0))).map((({name:e})=>e));return(0,s.createElement)(s.Fragment,null,!!o.length&&(0,s.createElement)(eo,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(Do,{value:t.attributes.align,onChange:e=>{if(!e){var n,o;const l=(0,r.getBlockType)(t.name);(null==l||null===(n=l.attributes)||void 0===n||null===(o=n.align)||void 0===o?void 0:o.default)&&(e="")}t.setAttributes({align:e})},controls:o})),(0,s.createElement)(e,t))}),"withToolbarControls"),Uo=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n,attributes:o}=t,{align:l}=o,a=Ro(Vo((0,r.getBlockSupport)(n,"align"),(0,r.hasBlockSupport)(n,"alignWide",!0)));if(void 0===l)return(0,s.createElement)(e,t);let c=t.wrapperProps;return a.some((e=>e.name===l))&&(c={...c,"data-align":l}),(0,s.createElement)(e,i({},t,{wrapperProps:c}))}));(0,l.addFilter)("blocks.registerBlockType","core/align/addAttribute",(function(e){return(0,u.has)(e.attributes,["align","type"])||(0,r.hasBlockSupport)(e,"align")&&(e.attributes={...e.attributes,align:{type:"string",enum:[...Fo,""]}}),e})),(0,l.addFilter)("editor.BlockListBlock","core/editor/align/with-data-align",Uo),(0,l.addFilter)("editor.BlockEdit","core/editor/align/with-toolbar-controls",Ho),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/align/addAssignedAlign",(function(e,t,n){const{align:o}=n;return Vo((0,r.getBlockSupport)(t,"align"),(0,r.hasBlockSupport)(t,"alignWide",!0)).includes(o)&&(e.className=c()(`align${o}`,e.className)),e})),(0,l.addFilter)("blocks.registerBlockType","core/lock/addAttribute",(function(e){return(0,u.has)(e.attributes,["lock","type"])||(e.attributes={...e.attributes,lock:{type:"object"}}),e})),window.wp.warning;var Go={default:(0,p.createSlotFill)("InspectorControls"),advanced:(0,p.createSlotFill)("InspectorAdvancedControls"),dimensions:(0,p.createSlotFill)("InspectorControlsDimensions")};function Wo({__experimentalGroup:e="default",children:t}){var n;const o=Yn(),r=null===(n=Go[e])||void 0===n?void 0:n.Fill;return r?o?(0,s.createElement)(p.__experimentalStyleProvider,{document:document},(0,s.createElement)(r,null,(e=>{const n=(0,u.isEmpty)(e)?null:e;return(0,s.createElement)(p.__experimentalToolsPanelContext.Provider,{value:n},t)}))):null:("undefined"!=typeof process&&process.env,null)}const $o=e=>{if(!(0,u.isObject)(e)||Array.isArray(e))return e;const t=(0,u.pickBy)((0,u.mapValues)(e,$o),u.identity);return(0,u.isEmpty)(t)?void 0:t};function jo({children:e,group:t,label:n}){const{clientId:o,attributes:r}=(0,m.useSelect)((e=>{const{getBlockAttributes:t,getSelectedBlockClientId:n}=e(Wn),o=n();return{clientId:o,attributes:t(o)}}),[]),{updateBlockAttributes:l}=(0,m.useDispatch)(Wn);return(0,s.createElement)(p.__experimentalToolsPanel,{className:`${t}-block-support-panel`,label:n,resetAll:(e=[])=>{const{style:t}=r;let n={style:t};e.forEach((e=>{n={...n,...e(n)}})),n={...n,style:$o(n.style)},l(o,n)},key:o,panelId:o,hasInnerWrapper:!0,shouldRenderPlaceholderItems:!0},e)}function Ko({Slot:e,...t}){const n=(0,s.useContext)(p.__experimentalToolsPanelContext);return(0,s.createElement)(e,i({},t,{fillProps:n}))}function qo({__experimentalGroup:e="default",bubblesVirtually:t=!0,label:n,...o}){var r;const l=null===(r=Go[e])||void 0===r?void 0:r.Slot,a=(0,p.__experimentalUseSlot)(null==l?void 0:l.__unstableName);return l&&a?Boolean(a.fills&&a.fills.length)?n?(0,s.createElement)(jo,{group:e,label:n},(0,s.createElement)(Ko,i({},o,{bubblesVirtually:t,Slot:l}))):(0,s.createElement)(l,i({},o,{bubblesVirtually:t})):null:("undefined"!=typeof process&&process.env,null)}const Yo=Wo;Yo.Slot=qo;const Zo=e=>(0,s.createElement)(Wo,i({},e,{__experimentalGroup:"advanced"}));Zo.Slot=e=>(0,s.createElement)(qo,i({},e,{__experimentalGroup:"advanced"})),Zo.slotName="InspectorAdvancedControls";var Xo=Yo;const Qo=/[\s#]/g,Jo=(0,d.createHigherOrderComponent)((e=>t=>{if((0,r.hasBlockSupport)(t.name,"anchor")&&t.isSelected){const n="web"===s.Platform.OS,o=(0,s.createElement)(p.TextControl,{className:"html-anchor-control",label:(0,g.__)("HTML anchor"),help:(0,s.createElement)(s.Fragment,null,(0,g.__)("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."),n&&(0,s.createElement)(p.ExternalLink,{href:(0,g.__)("https://wordpress.org/support/article/page-jumps/")},(0,g.__)("Learn more about anchors"))),value:t.attributes.anchor||"",placeholder:n?null:(0,g.__)("Add an anchor"),onChange:e=>{e=e.replace(Qo,"-"),t.setAttributes({anchor:e})},autoCapitalize:"none",autoComplete:"off"});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(e,t),n&&(0,s.createElement)(Xo,{__experimentalGroup:"advanced"},o),!n&&"core/heading"===t.name&&(0,s.createElement)(Xo,null,(0,s.createElement)(p.PanelBody,{title:(0,g.__)("Heading settings")},o)))}return(0,s.createElement)(e,t)}),"withInspectorControl");(0,l.addFilter)("blocks.registerBlockType","core/anchor/attribute",(function(e){return(0,u.has)(e.attributes,["anchor","type"])||(0,r.hasBlockSupport)(e,"anchor")&&(e.attributes={...e.attributes,anchor:{type:"string",source:"attribute",attribute:"id",selector:"*"}}),e})),(0,l.addFilter)("editor.BlockEdit","core/editor/anchor/with-inspector-control",Jo),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/anchor/save-props",(function(e,t,n){return(0,r.hasBlockSupport)(t,"anchor")&&(e.id=""===n.anchor?null:n.anchor),e}));const er=(0,d.createHigherOrderComponent)((e=>t=>(0,r.hasBlockSupport)(t.name,"customClassName",!0)&&t.isSelected?(0,s.createElement)(s.Fragment,null,(0,s.createElement)(e,t),(0,s.createElement)(Xo,{__experimentalGroup:"advanced"},(0,s.createElement)(p.TextControl,{autoComplete:"off",label:(0,g.__)("Additional CSS class(es)"),value:t.attributes.className||"",onChange:e=>{t.setAttributes({className:""!==e?e:void 0})},help:(0,g.__)("Separate multiple classes with spaces.")}))):(0,s.createElement)(e,t)),"withInspectorControl");(0,l.addFilter)("blocks.registerBlockType","core/custom-class-name/attribute",(function(e){return(0,r.hasBlockSupport)(e,"customClassName",!0)&&(e.attributes={...e.attributes,className:{type:"string"}}),e})),(0,l.addFilter)("editor.BlockEdit","core/editor/custom-class-name/with-inspector-control",er),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/custom-class-name/save-props",(function(e,t,n){return(0,r.hasBlockSupport)(t,"customClassName",!0)&&n.className&&(e.className=c()(e.className,n.className)),e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/generated-class-name/save-props",(function(e,t){return(0,r.hasBlockSupport)(t,"className",!0)&&("string"==typeof e.className?e.className=(0,u.uniq)([(0,r.getBlockDefaultClassName)(t.name),...e.className.split(" ")]).join(" ").trim():e.className=(0,r.getBlockDefaultClassName)(t.name)),e}));var tr=window.wp.dom;const nr=(0,s.createContext)({});function or({value:e,children:t}){const n=(0,s.useContext)(nr),o=(0,s.useMemo)((()=>({...n,...e})),[n,e]);return(0,s.createElement)(nr.Provider,{value:o,children:t})}var rr=nr;const lr={};var ir=(0,p.withFilters)("editor.BlockEdit")((e=>{const{attributes:t={},name:n}=e,o=(0,r.getBlockType)(n),l=(0,s.useContext)(rr),a=(0,s.useMemo)((()=>o&&o.usesContext?(0,u.pick)(l,o.usesContext):lr),[o,l]);if(!o)return null;const d=o.edit||o.save;if(o.apiVersion>1)return(0,s.createElement)(d,i({},e,{context:a}));const p=(0,r.hasBlockSupport)(o,"className",!0)?(0,r.getBlockDefaultClassName)(n):null,m=c()(p,t.className);return(0,s.createElement)(d,i({},e,{context:a,className:m}))}));function sr(e){const{name:t,isSelected:n,clientId:o}=e,r={name:t,isSelected:n,clientId:o};return(0,s.createElement)(Kn,{value:(0,s.useMemo)((()=>r),Object.values(r))},(0,s.createElement)(ir,e))}var ar=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z"})),cr=function({className:e,actions:t,children:n,secondaryActions:o}){return(0,s.createElement)("div",{className:c()(e,"block-editor-warning")},(0,s.createElement)("div",{className:"block-editor-warning__contents"},(0,s.createElement)("p",{className:"block-editor-warning__message"},n),(s.Children.count(t)>0||o)&&(0,s.createElement)("div",{className:"block-editor-warning__actions"},s.Children.count(t)>0&&s.Children.map(t,((e,t)=>(0,s.createElement)("span",{key:t,className:"block-editor-warning__action"},e))),o&&(0,s.createElement)(p.DropdownMenu,{className:"block-editor-warning__secondary",icon:ar,label:(0,g.__)("More options"),popoverProps:{position:"bottom left",className:"block-editor-warning__dropdown"},noIcons:!0},(()=>(0,s.createElement)(p.MenuGroup,null,o.map(((e,t)=>(0,s.createElement)(p.MenuItem,{onClick:e.onClick,key:t},e.title)))))))))},ur=n(7630);function dr({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)(s.RawHTML,null,(0,tr.safeHTML)(n)))),(0,s.createElement)("div",{className:"block-editor-block-compare__action"},(0,s.createElement)(p.Button,{variant:"secondary",tabIndex:"0",onClick:o},r)))}var pr=function({block:e,onKeep:t,onConvert:n,convertor:o,convertButtonText:l}){const i=(a=o(e),(0,u.castArray)(a).map((e=>(0,r.getSaveContent)(e.name,e.attributes,e.innerBlocks))).join(""));var a;const d=(p=e.originalContent,m=i,(0,ur.Kx)(p,m).map(((e,t)=>{const n=c()({"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 p,m;return(0,s.createElement)("div",{className:"block-editor-block-compare__wrapper"},(0,s.createElement)(dr,{title:(0,g.__)("Current"),className:"block-editor-block-compare__current",action:t,actionText:(0,g.__)("Convert to HTML"),rawContent:e.originalContent,renderedContent:e.originalContent}),(0,s.createElement)(dr,{title:(0,g.__)("After Conversion"),className:"block-editor-block-compare__converted",action:n,actionText:l,rawContent:d,renderedContent:i}))};const mr=e=>(0,r.rawHandler)({HTML:e.originalContent});var fr=(0,d.compose)([(0,m.withSelect)(((e,{clientId:t})=>({block:e(Wn).getBlock(t)}))),(0,m.withDispatch)(((e,{block:t})=>{const{replaceBlock:n}=e(Wn);return{convertToClassic(){n(t.clientId,(e=>(0,r.createBlock)("core/freeform",{content:e.originalContent}))(t))},convertToHTML(){n(t.clientId,(e=>(0,r.createBlock)("core/html",{content:e.originalContent}))(t))},convertToBlocks(){n(t.clientId,mr(t))},attemptBlockRecovery(){n(t.clientId,(({name:e,attributes:t,innerBlocks:n})=>(0,r.createBlock)(e,t,n))(t))}}}))])((function({convertToHTML:e,convertToBlocks:t,convertToClassic:n,attemptBlockRecovery:o,block:l}){const i=!!(0,r.getBlockType)("core/html"),[a,c]=(0,s.useState)(!1),u=(0,s.useCallback)((()=>c(!0)),[]),d=(0,s.useCallback)((()=>c(!1)),[]),m=(0,s.useMemo)((()=>[{
|
| 8 |
// translators: Button to fix block content
|
| 9 |
-
title:(0,
|
| 10 |
-
(0,g.__)("Resolve Block"),onRequestClose:d,className:"block-editor-block-compare"},(0,s.createElement)(pr,{block:l,onKeep:e,onConvert:t,convertor:mr,convertButtonText:(0,g.__)("Convert to Blocks")})))}));const gr=(0,s.createElement)(cr,{className:"block-editor-block-list__block-crash-warning"},(0,g.__)("This block has encountered an error and cannot be previewed."));var hr=()=>gr;class br extends s.Component{constructor(){super(...arguments),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?this.props.fallback:this.props.children}}var vr=br,kr=n(4042),_r=function({clientId:e}){const[t,n]=(0,s.useState)(""),o=(0,m.useSelect)((t=>t(Wn).getBlock(e)),[e]),{updateBlock:l}=(0,m.useDispatch)(Wn);return(0,s.useEffect)((()=>{n((0,r.getBlockContent)(o))}),[o]),(0,s.createElement)(kr.Z,{className:"block-editor-block-list__block-html-textarea",value:t,onBlur:()=>{const i=(0,r.getBlockType)(o.name);if(!i)return;const s=(0,r.getBlockAttributes)(i,t,o.attributes),a=t||(0,r.getSaveContent)(i,s),c=!t||(0,r.isValidBlockContent)(i,s,a);l(e,{attributes:s,originalContent:a,isValid:c}),t||n({content:a})},onChange:e=>n(e.target.value)})};let yr=Dr();const Er=e=>Rr(e,yr);let Cr=Dr();Er.write=e=>Rr(e,Cr);let Sr=Dr();Er.onStart=e=>Rr(e,Sr);let wr=Dr();Er.onFrame=e=>Rr(e,wr);let Br=Dr();Er.onFinish=e=>Rr(e,Br);let Ir=[];Er.setTimeout=(e,t)=>{let n=Er.now()+t,o=()=>{let e=Ir.findIndex((e=>e.cancel==o));~e&&Ir.splice(e,1),Fr.count-=~e?1:0},r={time:n,handler:e,cancel:o};return Ir.splice(xr(n),0,r),Fr.count+=1,Mr(),r};let xr=e=>~(~Ir.findIndex((t=>t.time>e))||~Ir.length);Er.cancel=e=>{yr.delete(e),Cr.delete(e)},Er.sync=e=>{Pr=!0,Er.batchedUpdates(e),Pr=!1},Er.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function o(...e){t=e,Er.onStart(n)}return o.handler=e,o.cancel=()=>{Sr.delete(n),t=null},o};let Tr="undefined"!=typeof window?window.requestAnimationFrame:()=>{};Er.use=e=>Tr=e,Er.now="undefined"!=typeof performance?()=>performance.now():Date.now,Er.batchedUpdates=e=>e(),Er.catch=console.error,Er.frameLoop="always",Er.advance=()=>{"demand"!==Er.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):Ar()};let Nr=-1,Pr=!1;function Rr(e,t){Pr?(t.delete(e),e(0)):(t.add(e),Mr())}function Mr(){Nr<0&&(Nr=0,"demand"!==Er.frameLoop&&Tr(Lr))}function Lr(){~Nr&&(Tr(Lr),Er.batchedUpdates(Ar))}function Ar(){let e=Nr;Nr=Er.now();let t=xr(Nr);t&&(Or(Ir.splice(0,t),(e=>e.handler())),Fr.count-=t),Sr.flush(),yr.flush(e?Math.min(64,Nr-e):16.667),wr.flush(),Cr.flush(),Br.flush()}function Dr(){let e=new Set,t=e;return{add(n){Fr.count+=t!=e||e.has(n)?0:1,e.add(n)},delete:n=>(Fr.count-=t==e&&e.has(n)?1:0,e.delete(n)),flush(n){t.size&&(e=new Set,Fr.count-=t.size,Or(t,(t=>t(n)&&e.add(t))),Fr.count+=e.size,t=e)}}}function Or(e,t){e.forEach((e=>{try{t(e)}catch(e){Er.catch(e)}}))}const Fr={count:0,clear(){Nr=-1,Ir=[],Sr=Dr(),yr=Dr(),wr=Dr(),Cr=Dr(),Br=Dr(),Fr.count=0}};var zr=n(3804),Vr=n.n(zr);function Hr(){}const Ur={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 Gr(e,t){if(Ur.arr(e)){if(!Ur.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}const Wr=(e,t)=>e.forEach(t);function $r(e,t,n){for(const o in e)e.hasOwnProperty(o)&&t.call(n,e[o],o)}const jr=e=>Ur.und(e)?[]:Ur.arr(e)?e:[e];function Kr(e,t){if(e.size){const n=Array.from(e);e.clear(),Wr(n,t)}}const qr=(e,...t)=>Kr(e,(e=>e(...t)));let Yr,Zr,Xr=null,Qr=!1,Jr=Hr;var el=Object.freeze({__proto__:null,get createStringInterpolator(){return Yr},get to(){return Zr},get colors(){return Xr},get skipAnimation(){return Qr},get willAdvance(){return Jr},assign:e=>{e.to&&(Zr=e.to),e.now&&(Er.now=e.now),void 0!==e.colors&&(Xr=e.colors),null!=e.skipAnimation&&(Qr=e.skipAnimation),e.createStringInterpolator&&(Yr=e.createStringInterpolator),e.requestAnimationFrame&&Er.use(e.requestAnimationFrame),e.batchedUpdates&&(Er.batchedUpdates=e.batchedUpdates),e.willAdvance&&(Jr=e.willAdvance),e.frameLoop&&(Er.frameLoop=e.frameLoop)}});const tl=new Set;let nl=[],ol=[],rl=0;const ll={get idle(){return!tl.size&&!nl.length},start(e){rl>e.priority?(tl.add(e),Er.onStart(il)):(sl(e),Er(cl))},advance:cl,sort(e){if(rl)Er.onFrame((()=>ll.sort(e)));else{const t=nl.indexOf(e);~t&&(nl.splice(t,1),al(e))}},clear(){nl=[],tl.clear()}};function il(){tl.forEach(sl),tl.clear(),Er(cl)}function sl(e){nl.includes(e)||al(e)}function al(e){nl.splice(function(t,n){const o=t.findIndex((t=>t.priority>e.priority));return o<0?t.length:o}(nl),0,e)}function cl(e){const t=ol;for(let n=0;n<nl.length;n++){const o=nl[n];rl=o.priority,o.idle||(Jr(o),o.advance(e),o.idle||t.push(o))}return rl=0,ol=nl,ol.length=0,nl=t,nl.length>0}const ul="[-+]?\\d*\\.?\\d+",dl=ul+"%";function pl(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}const ml=new RegExp("rgb"+pl(ul,ul,ul)),fl=new RegExp("rgba"+pl(ul,ul,ul,ul)),gl=new RegExp("hsl"+pl(ul,dl,dl)),hl=new RegExp("hsla"+pl(ul,dl,dl,ul)),bl=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,vl=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,kl=/^#([0-9a-fA-F]{6})$/,_l=/^#([0-9a-fA-F]{8})$/;function yl(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 El(e,t,n){const o=n<.5?n*(1+t):n+t-n*t,r=2*n-o,l=yl(r,o,e+1/3),i=yl(r,o,e),s=yl(r,o,e-1/3);return Math.round(255*l)<<24|Math.round(255*i)<<16|Math.round(255*s)<<8}function Cl(e){const t=parseInt(e,10);return t<0?0:t>255?255:t}function Sl(e){return(parseFloat(e)%360+360)%360/360}function wl(e){const t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function Bl(e){const t=parseFloat(e);return t<0?0:t>100?1:t/100}function Il(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=kl.exec(e))?parseInt(t[1]+"ff",16)>>>0:Xr&&void 0!==Xr[e]?Xr[e]:(t=ml.exec(e))?(Cl(t[1])<<24|Cl(t[2])<<16|Cl(t[3])<<8|255)>>>0:(t=fl.exec(e))?(Cl(t[1])<<24|Cl(t[2])<<16|Cl(t[3])<<8|wl(t[4]))>>>0:(t=bl.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=_l.exec(e))?parseInt(t[1],16)>>>0:(t=vl.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=gl.exec(e))?(255|El(Sl(t[1]),Bl(t[2]),Bl(t[3])))>>>0:(t=hl.exec(e))?(El(Sl(t[1]),Bl(t[2]),Bl(t[3]))|wl(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})`)}const xl=(e,t,n)=>{if(Ur.fun(e))return e;if(Ur.arr(e))return xl({range:e,output:t,extrapolate:n});if(Ur.str(e.output[0]))return Yr(e);const 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=>{const 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)}};function Tl(){return(Tl=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}).apply(this,arguments)}const Nl=Symbol.for("FluidValue.get"),Pl=Symbol.for("FluidValue.observers"),Rl=e=>Boolean(e&&e[Nl]),Ml=e=>e&&e[Nl]?e[Nl]():e,Ll=e=>e[Pl]||null;function Al(e,t){let n=e[Pl];n&&n.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}class Dl{constructor(e){if(this[Nl]=void 0,this[Pl]=void 0,!e&&!(e=this.get))throw Error("Unknown getter");Ol(this,e)}}const Ol=(e,t)=>Vl(e,Nl,t);function Fl(e,t){if(e[Nl]){let n=e[Pl];n||Vl(e,Pl,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function zl(e,t){let n=e[Pl];if(n&&n.has(t)){const o=n.size-1;o?n.delete(t):e[Pl]=null,e.observerRemoved&&e.observerRemoved(o,t)}}const Vl=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),Hl=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,Ul=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi;let Gl;const Wl=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,$l=(e,t,n,o,r)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(o)}, ${r})`,jl=e=>{Gl||(Gl=Xr?new RegExp(`(${Object.keys(Xr).join("|")})(?!\\w)`,"g"):/^\b$/);const t=e.output.map((e=>Ml(e).replace(Ul,Il).replace(Gl,Il))),n=t.map((e=>e.match(Hl).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=>xl(Tl({},e,{output:t}))));return e=>{let n=0;return t[0].replace(Hl,(()=>String(o[n++](e)))).replace(Wl,$l)}},Kl="react-spring: ",ql=e=>{const t=e;let n=!1;if("function"!=typeof t)throw new TypeError(`${Kl}once requires a function parameter`);return(...e)=>{n||(t(...e),n=!0)}},Yl=ql(console.warn),Zl=ql(console.warn);function Xl(e){return Ur.str(e)&&("#"==e[0]||/\d/.test(e)||e in(Xr||{}))}const Ql=e=>(0,zr.useEffect)(e,Jl),Jl=[];function ei(){const e=(0,zr.useState)()[1],t=(0,zr.useState)(ti)[0];return Ql(t.unmount),()=>{t.current&&e({})}}function ti(){const e={current:!0,unmount:()=>()=>{e.current=!1}};return e}function ni(e){const t=(0,zr.useRef)();return(0,zr.useEffect)((()=>{t.current=e})),t.current}const oi="undefined"!=typeof window&&window.document&&window.document.createElement?zr.useLayoutEffect:zr.useEffect,ri=Symbol.for("Animated:node"),li=e=>e&&e[ri],ii=(e,t)=>{return n=e,o=ri,r=t,Object.defineProperty(n,o,{value:r,writable:!0,configurable:!0});var n,o,r},si=e=>e&&e[ri]&&e[ri].getPayload();class ai{constructor(){this.payload=void 0,ii(this,this)}getPayload(){return this.payload||[]}}class ci extends ai{constructor(e){super(),this.done=!0,this.elapsedTime=void 0,this.lastPosition=void 0,this.lastVelocity=void 0,this.v0=void 0,this.durationProgress=0,this._value=e,Ur.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new ci(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Ur.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(){const{done:e}=this;this.done=!1,Ur.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}}class ui extends ci{constructor(e){super(0),this._string=null,this._toString=void 0,this._toString=xl({output:[e,e]})}static create(e){return new ui(e)}getValue(){let e=this._string;return null==e?this._string=this._toString(this._value):e}setValue(e){if(Ur.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=xl({output:[this.getValue(),e]})),this._value=0,super.reset()}}const di={dependencies:null};class pi extends ai{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return $r(this.source,((n,o)=>{var r;(r=n)&&r[ri]===r?t[o]=n.getValue(e):Rl(n)?t[o]=Ml(n):e||(t[o]=n)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&Wr(this.payload,(e=>e.reset()))}_makePayload(e){if(e){const t=new Set;return $r(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){di.dependencies&&Rl(e)&&di.dependencies.add(e);const t=si(e);t&&Wr(t,(e=>this.add(e)))}}class mi extends pi{constructor(e){super(e)}static create(e){return new mi(e)}getValue(){return this.source.map((e=>e.getValue()))}setValue(e){const t=this.getPayload();return e.length==t.length?t.map(((t,n)=>t.setValue(e[n]))).some(Boolean):(super.setValue(e.map(fi)),!0)}}function fi(e){return(Xl(e)?ui:ci).create(e)}function gi(e){const t=li(e);return t?t.constructor:Ur.arr(e)?mi:Xl(e)?ui:ci}function hi(){return(hi=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}).apply(this,arguments)}const bi=(e,t)=>{const n=!Ur.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,zr.forwardRef)(((o,r)=>{const l=(0,zr.useRef)(null),i=n&&(0,zr.useCallback)((e=>{l.current=function(e,t){return e&&(Ur.fun(e)?e(t):e.current=t),t}(r,e)}),[r]),[s,a]=function(e,t){const n=new Set;return di.dependencies=n,e.style&&(e=hi({},e,{style:t.createAnimatedStyle(e.style)})),e=new pi(e),di.dependencies=null,[e,n]}(o,t),c=ei(),u=()=>{const e=l.current;n&&!e||!1===(!!e&&t.applyAnimatedValues(e,s.getValue(!0)))&&c()},d=new vi(u,a),p=(0,zr.useRef)();oi((()=>{const e=p.current;p.current=d,Wr(a,(e=>Fl(e,d))),e&&(Wr(e.deps,(t=>zl(t,e))),Er.cancel(e.update))})),(0,zr.useEffect)(u,[]),Ql((()=>()=>{const e=p.current;Wr(e.deps,(t=>zl(t,e)))}));const m=t.getComponentProps(s.getValue());return zr.createElement(e,hi({},m,{ref:i}))}))};class vi{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&Er.write(this.update)}}const ki=Symbol.for("AnimatedComponent"),_i=e=>Ur.str(e)?e:e&&Ur.str(e.displayName)?e.displayName:Ur.fun(e)&&e.name||null;function yi(){return(yi=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}).apply(this,arguments)}function Ei(e,...t){return Ur.fun(e)?e(...t):e}const Ci=(e,t)=>!0===e||!!(t&&e&&(Ur.fun(e)?e(t):jr(e).includes(t))),Si=(e,t)=>Ur.obj(e)?t&&e[t]:e,wi=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,Bi=e=>e,Ii=(e,t=Bi)=>{let n=xi;e.default&&!0!==e.default&&(e=e.default,n=Object.keys(e));const o={};for(const r of n){const n=t(e[r],r);Ur.und(n)||(o[r]=n)}return o},xi=["config","onProps","onStart","onChange","onPause","onResume","onRest"],Ti={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 Ni(e){const t=function(e){const t={};let n=0;if($r(e,((e,o)=>{Ti[o]||(t[o]=e,n++)})),n)return t}(e);if(t){const n={to:t};return $r(e,((e,o)=>o in t||(n[o]=e))),n}return yi({},e)}function Pi(e){return e=Ml(e),Ur.arr(e)?e.map(Pi):Xl(e)?el.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function Ri(e){for(const t in e)return!0;return!1}function Mi(e){return Ur.fun(e)||Ur.arr(e)&&Ur.obj(e[0])}function Li(e,t){var n;null==(n=e.ref)||n.delete(e),null==t||t.delete(e)}function Ai(e,t){var n;t&&e.ref!==t&&(null==(n=e.ref)||n.delete(e),t.add(e),e.ref=t)}const Di=yi({},{tension:170,friction:26},{mass:1,damping:1,easing:e=>e,clamp:!1});class Oi{constructor(){this.tension=void 0,this.friction=void 0,this.frequency=void 0,this.damping=void 0,this.mass=void 0,this.velocity=0,this.restVelocity=void 0,this.precision=void 0,this.progress=void 0,this.duration=void 0,this.easing=void 0,this.clamp=void 0,this.bounce=void 0,this.decay=void 0,this.round=void 0,Object.assign(this,Di)}}function Fi(e,t){if(Ur.und(t.decay)){const n=!Ur.und(t.tension)||!Ur.und(t.friction);!n&&Ur.und(t.frequency)&&Ur.und(t.damping)&&Ur.und(t.mass)||(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}else e.duration=void 0}const zi=[];class Vi{constructor(){this.changed=!1,this.values=zi,this.toValues=null,this.fromValues=zi,this.to=void 0,this.from=void 0,this.config=new Oi,this.immediate=!1}}function Hi(e,{key:t,props:n,defaultProps:o,state:r,actions:l}){return new Promise(((i,s)=>{var a;let c,u,d=Ci(null!=(a=n.cancel)?a:null==o?void 0:o.cancel,t);if(d)f();else{Ur.und(n.pause)||(r.paused=Ci(n.pause,t));let e=null==o?void 0:o.pause;!0!==e&&(e=r.paused||Ci(e,t)),c=Ei(n.delay||0,t),e?(r.resumeQueue.add(m),l.pause()):(l.resume(),m())}function p(){r.resumeQueue.add(m),r.timeouts.delete(u),u.cancel(),c=u.time-Er.now()}function m(){c>0?(u=Er.setTimeout(f,c),r.pauseQueue.add(p),r.timeouts.add(u)):f()}function f(){r.pauseQueue.delete(p),r.timeouts.delete(u),e<=(r.cancelId||0)&&(d=!0);try{l.start(yi({},n,{callId:e,cancel:d}),i)}catch(e){s(e)}}}))}const Ui=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?$i(e.get()):t.every((e=>e.noop))?Gi(e.get()):Wi(e.get(),t.every((e=>e.finished))),Gi=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),Wi=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),$i=e=>({value:e,cancelled:!0,finished:!1});function ji(e,t,n,o){const{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;const c=Ii(t,((e,t)=>"onRest"===t?void 0:e));let u,d;const p=new Promise(((e,t)=>(u=e,d=t))),m=e=>{const t=r<=(n.cancelId||0)&&$i(o)||r!==n.asyncId&&Wi(o,!1);if(t)throw e.result=t,d(e),e},f=(e,t)=>{const l=new qi,i=new Yi;return(async()=>{if(el.skipAnimation)throw Ki(n),i.result=Wi(o,!1),d(i),i;m(l);const s=Ur.obj(e)?yi({},e):yi({},t,{to:e});s.parentId=r,$r(c,((e,t)=>{Ur.und(s[t])&&(s[t]=e)}));const a=await o.start(s);return m(l),n.paused&&await new Promise((e=>{n.resumeQueue.add(e)})),a})()};let g;if(el.skipAnimation)return Ki(n),Wi(o,!1);try{let t;t=Ur.arr(e)?(async e=>{for(const t of e)await f(t)})(e):Promise.resolve(e(f,o.stop.bind(o))),await Promise.all([t.then(u),p]),g=Wi(o.get(),!0,!1)}catch(e){if(e instanceof qi)g=e.result;else{if(!(e instanceof Yi))throw e;g=e.result}}finally{r==n.asyncId&&(n.asyncId=l,n.asyncTo=l?s:void 0,n.promise=l?a:void 0)}return Ur.fun(i)&&Er.batchedUpdates((()=>{i(g,o,o.item)})),g})():a}function Ki(e,t){Kr(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}class qi extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."),this.result=void 0}}class Yi extends Error{constructor(){super("SkipAnimationSignal"),this.result=void 0}}const Zi=e=>e instanceof Qi;let Xi=1;class Qi extends Dl{constructor(...e){super(...e),this.id=Xi++,this.key=void 0,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){const e=li(this);return e&&e.getValue()}to(...e){return el.to(this,e)}interpolate(...e){return Yl(`${Kl}The "interpolate" function is deprecated in v9 (use "to" instead)`),el.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){Al(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||ll.sort(this),Al(this,{type:"priority",parent:this,priority:e})}}const Ji=Symbol.for("SpringPhase"),es=e=>(1&e[Ji])>0,ts=e=>(2&e[Ji])>0,ns=e=>(4&e[Ji])>0,os=(e,t)=>t?e[Ji]|=3:e[Ji]&=-3,rs=(e,t)=>t?e[Ji]|=4:e[Ji]&=-5;class ls extends Qi{constructor(e,t){if(super(),this.key=void 0,this.animation=new Vi,this.queue=void 0,this.defaultProps={},this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!Ur.und(e)||!Ur.und(t)){const n=Ur.obj(e)?yi({},e):yi({},t,{from:e});Ur.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(ts(this)||this._state.asyncTo)||ns(this)}get goal(){return Ml(this.animation.to)}get velocity(){const e=li(this);return e instanceof ci?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return es(this)}get isAnimating(){return ts(this)}get isPaused(){return ns(this)}advance(e){let t=!0,n=!1;const o=this.animation;let{config:r,toValues:l}=o;const i=si(o.to);!i&&Rl(o.to)&&(l=jr(Ml(o.to))),o.values.forEach(((s,a)=>{if(s.done)return;const c=s.constructor==ui?1:i?i[a].lastPosition:l[a];let u=o.immediate,d=c;if(!u){if(d=s.lastPosition,r.tension<=0)return void(s.done=!0);let t=s.elapsedTime+=e;const n=o.fromValues[a],l=null!=s.v0?s.v0:s.v0=Ur.arr(r.velocity)?r.velocity[a]:r.velocity;let i;if(Ur.und(r.duration))if(r.decay){const e=!0===r.decay?.998:r.decay,o=Math.exp(-(1-e)*t);d=n+l/(1-e)*(1-o),u=Math.abs(s.lastPosition-d)<.1,i=l*o}else{i=null==s.lastVelocity?l:s.lastVelocity;const t=r.precision||(n==c?.005:Math.min(1,.001*Math.abs(c-n))),o=r.restVelocity||t/10,a=r.clamp?0:r.bounce,p=!Ur.und(a),m=n==c?s.v0>0:n<c;let f,g=!1;const h=1,b=Math.ceil(e/h);for(let e=0;e<b&&(f=Math.abs(i)>o,f||(u=Math.abs(c-d)<=t,!u));++e)p&&(g=d==c||d>c==m,g&&(i=-i*a,d=c)),i+=(1e-6*-r.tension*(d-c)+.001*-r.friction*i)/r.mass*h,d+=i*h}else{let o=1;r.duration>0&&(this._memoizedDuration!==r.duration&&(this._memoizedDuration=r.duration,s.durationProgress>0&&(s.elapsedTime=r.duration*s.durationProgress,t=s.elapsedTime+=e)),o=(r.progress||0)+t/this._memoizedDuration,o=o>1?1:o<0?0:o,s.durationProgress=o),d=n+r.easing(o)*(c-n),i=(d-s.lastPosition)/e,u=1==o}s.lastVelocity=i,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)}));const s=li(this),a=s.getValue();if(t){const e=Ml(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 Er.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(ts(this)){const{to:e,config:t}=this.animation;Er.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 Ur.und(e)?(n=this.queue||[],this.queue=[]):n=[Ur.obj(e)?e:yi({},t,{to:e})],Promise.all(n.map((e=>this._update(e)))).then((e=>Ui(this,e)))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),Ki(this._state,e&&this._lastCallId),Er.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){const t=this.key||"";let{to:n,from:o}=e;n=Ur.obj(n)?n[t]:n,(null==n||Mi(n))&&(n=void 0),o=Ur.obj(o)?o[t]:o,null==o&&(o=void 0);const r={to:n,from:o};return es(this)||(e.reverse&&([n,o]=[o,n]),o=Ml(o),Ur.und(o)?li(this)||this._set(n):this._set(o)),r}_update(e,t){let n=yi({},e);const{key:o,defaultProps:r}=this;n.default&&Object.assign(r,Ii(n,((e,t)=>/^on/.test(t)?Si(e,o):e))),ps(this,n,"onProps"),ms(this,"onProps",n,this);const l=this._prepareNode(n);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const i=this._state;return Hi(++this._lastCallId,{key:o,props:n,defaultProps:r,state:i,actions:{pause:()=>{ns(this)||(rs(this,!0),qr(i.pauseQueue),ms(this,"onPause",Wi(this,is(this,this.animation.to)),this))},resume:()=>{ns(this)&&(rs(this,!1),ts(this)&&this._resume(),qr(i.resumeQueue),ms(this,"onResume",Wi(this,is(this,this.animation.to)),this))},start:this._merge.bind(this,l)}}).then((e=>{if(n.loop&&e.finished&&(!t||!e.noop)){const e=ss(n);if(e)return this._update(e,!0)}return e}))}_merge(e,t,n){if(t.cancel)return this.stop(!0),n($i(this));const o=!Ur.und(e.to),r=!Ur.und(e.from);if(o||r){if(!(t.callId>this._lastToId))return n($i(this));this._lastToId=t.callId}const{key:l,defaultProps:i,animation:s}=this,{to:a,from:c}=s;let{to:u=a,from:d=c}=e;!r||o||t.default&&!Ur.und(u)||(u=d),t.reverse&&([u,d]=[d,u]);const p=!Gr(d,c);p&&(s.from=d),d=Ml(d);const m=!Gr(u,a);m&&this._focus(u);const f=Mi(t.to),{config:g}=s,{decay:h,velocity:b}=g;(o||r)&&(g.velocity=0),t.config&&!f&&function(e,t,n){n&&(Fi(n=yi({},n),t),t=yi({},n,t)),Fi(e,t),Object.assign(e,t);for(const t in Di)null==e[t]&&(e[t]=Di[t]);let{mass:o,frequency:r,damping:l}=e;Ur.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,Ei(t.config,l),t.config!==i.config?Ei(i.config,l):void 0);let v=li(this);if(!v||Ur.und(u))return n(Wi(this,!0));const k=Ur.und(t.reset)?r&&!t.default:!Ur.und(d)&&Ci(t.reset,l),_=k?d:this.get(),y=Pi(u),E=Ur.num(y)||Ur.arr(y)||Xl(y),C=!f&&(!E||Ci(i.immediate||t.immediate,l));if(m){const e=gi(u);if(e!==v.constructor){if(!C)throw Error(`Cannot animate between ${v.constructor.name} and ${e.name}, as the "to" prop suggests`);v=this._set(y)}}const S=v.constructor;let w=Rl(u),B=!1;if(!w){const e=k||!es(this)&&p;(m||e)&&(B=Gr(Pi(_),y),w=!B),(Gr(s.immediate,C)||C)&&Gr(g.decay,h)&&Gr(g.velocity,b)||(w=!0)}if(B&&ts(this)&&(s.changed&&!k?w=!0:w||this._stop(a)),!f&&((w||Rl(a))&&(s.values=v.getPayload(),s.toValues=Rl(u)?null:S==ui?[1]:jr(y)),s.immediate!=C&&(s.immediate=C,C||k||this._set(a)),w)){const{onRest:e}=s;Wr(ds,(e=>ps(this,t,e)));const o=Wi(this,is(this,a));qr(this._pendingCalls,o),this._pendingCalls.add(n),s.changed&&Er.batchedUpdates((()=>{s.changed=!k,null==e||e(o,this),k?Ei(i.onRest,o):null==s.onStart||s.onStart(o,this)}))}k&&this._set(_),f?n(ji(t.to,t,this._state,this)):w?this._start():ts(this)&&!m?this._pendingCalls.add(n):n(Gi(_))}_focus(e){const t=this.animation;e!==t.to&&(Ll(this)&&this._detach(),t.to=e,Ll(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;Rl(t)&&(Fl(t,this),Zi(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;Rl(e)&&zl(e,this)}_set(e,t=!0){const n=Ml(e);if(!Ur.und(n)){const e=li(this);if(!e||!Gr(n,e.getValue())){const o=gi(n);e&&e.constructor==o?e.setValue(n):ii(this,o.create(n)),e&&Er.batchedUpdates((()=>{this._onChange(n,t)}))}}return li(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,ms(this,"onStart",Wi(this,is(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Ei(this.animation.onChange,e,this)),Ei(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;li(this).reset(Ml(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),ts(this)||(os(this,!0),ns(this)||this._resume())}_resume(){el.skipAnimation?this.finish():ll.start(this)}_stop(e,t){if(ts(this)){os(this,!1);const n=this.animation;Wr(n.values,(e=>{e.done=!0})),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Al(this,{type:"idle",parent:this});const o=t?$i(this.get()):Wi(this.get(),is(this,null!=e?e:n.to));qr(this._pendingCalls,o),n.changed&&(n.changed=!1,ms(this,"onRest",o,this))}}}function is(e,t){const n=Pi(t);return Gr(Pi(e.get()),n)}function ss(e,t=e.loop,n=e.to){let o=Ei(t);if(o){const r=!0!==o&&Ni(o),l=(r||e).reverse,i=!r||r.reset;return as(yi({},e,{loop:t,default:!1,pause:void 0,to:!l||Mi(n)?n:void 0,from:i?e.from:void 0,reset:i},r))}}function as(e){const{to:t,from:n}=e=Ni(e),o=new Set;return Ur.obj(t)&&us(t,o),Ur.obj(n)&&us(n,o),e.keys=o.size?Array.from(o):null,e}function cs(e){const t=as(e);return Ur.und(t.default)&&(t.default=Ii(t)),t}function us(e,t){$r(e,((e,n)=>null!=e&&t.add(n)))}const ds=["onStart","onRest","onChange","onPause","onResume"];function ps(e,t,n){e.animation[n]=t[n]!==wi(t,n)?Si(t[n],e.key):void 0}function ms(e,t,...n){var o,r,l,i;null==(o=(r=e.animation)[t])||o.call(r,...n),null==(l=(i=e.defaultProps)[t])||l.call(i,...n)}const fs=["onStart","onChange","onRest"];let gs=1;class hs{constructor(e,t){this.id=gs++,this.springs={},this.queue=[],this.ref=void 0,this._flush=void 0,this._initialProps=void 0,this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._item=void 0,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start(yi({default:!0},e))}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every((e=>e.idle))}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each(((t,n)=>e[n]=t.get())),e}set(e){for(const t in e){const n=e[t];Ur.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(as(e)),this}start(e){let{queue:t}=this;return e?t=jr(e).map(as):this.queue=[],this._flush?this._flush(this,t):(Cs(this,t),bs(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;Wr(jr(t),(t=>n[t].stop(!!e)))}else Ki(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(Ur.und(e))this.start({pause:!0});else{const t=this.springs;Wr(jr(e),(e=>t[e].pause()))}return this}resume(e){if(Ur.und(e))this.start({pause:!1});else{const t=this.springs;Wr(jr(e),(e=>t[e].resume()))}return this}each(e){$r(this.springs,e)}_onFrame(){const{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,Kr(e,(([e,t])=>{t.value=this.get(),e(t,this,this._item)})));const l=!o&&this._started,i=r||l&&n.size?this.get():null;r&&t.size&&Kr(t,(([e,t])=>{t.value=i,e(t,this,this._item)})),l&&(this._started=!1,Kr(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)}Er.onFrame(this._onFrame)}}function bs(e,t){return Promise.all(t.map((t=>vs(e,t)))).then((t=>Ui(e,t)))}async function vs(e,t,n){const{keys:o,to:r,from:l,loop:i,onRest:s,onResolve:a}=t,c=Ur.obj(t.default)&&t.default;i&&(t.loop=!1),!1===r&&(t.to=null),!1===l&&(t.from=null);const u=Ur.arr(r)||Ur.fun(r)?r:void 0;u?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):Wr(fs,(n=>{const o=t[n];if(Ur.fun(o)){const r=e._events[n];t[n]=({finished:e,cancelled:t})=>{const 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])}}));const d=e._state;t.pause===!d.paused?(d.paused=t.pause,qr(t.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(t.pause=!0);const p=(o||Object.keys(e.springs)).map((n=>e.springs[n].start(t))),m=!0===t.cancel||!0===wi(t,"cancel");(u||m&&d.asyncId)&&p.push(Hi(++e._lastAsyncId,{props:t,state:d,actions:{pause:Hr,resume:Hr,start(t,n){m?(Ki(d,e._lastAsyncId),n($i(e))):(t.onRest=s,n(ji(u,t,d,e)))}}})),d.paused&&await new Promise((e=>{d.resumeQueue.add(e)}));const f=Ui(e,await Promise.all(p));if(i&&f.finished&&(!n||!f.noop)){const n=ss(t,i,r);if(n)return Cs(e,[n]),vs(e,n,!0)}return a&&Er.batchedUpdates((()=>a(f,e,e.item))),f}function ks(e,t){const n=yi({},e.springs);return t&&Wr(jr(t),(e=>{Ur.und(e.keys)&&(e=as(e)),Ur.obj(e.to)||(e=yi({},e,{to:void 0})),Es(n,e,(e=>ys(e)))})),_s(e,n),n}function _s(e,t){$r(t,((t,n)=>{e.springs[n]||(e.springs[n]=t,Fl(t,e))}))}function ys(e,t){const n=new ls;return n.key=e,t&&Fl(n,t),n}function Es(e,t,n){t.keys&&Wr(t.keys,(o=>{(e[o]||(e[o]=n(o)))._prepareNode(t)}))}function Cs(e,t){Wr(t,(t=>{Es(e.springs,t,(t=>ys(t,e)))}))}const Ss=["children"],ws=e=>{let{children:t}=e,n=function(e,t){if(null==e)return{};var n,o,r={},l=Object.keys(e);for(o=0;o<l.length;o++)n=l[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,Ss);const o=(0,zr.useContext)(Bs),r=n.pause||!!o.pause,l=n.immediate||!!o.immediate;n=function(e,t){const[n]=(0,zr.useState)((()=>({inputs:t,result:e()}))),o=(0,zr.useRef)(),r=o.current;let 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,zr.useEffect)((()=>{o.current=l,r==n&&(n.inputs=n.result=void 0)}),[l]),l.result}((()=>({pause:r,immediate:l})),[r,l]);const{Provider:i}=Bs;return zr.createElement(i,{value:n},t)},Bs=(Is=ws,xs={},Object.assign(Is,zr.createContext(xs)),Is.Provider._context=Is,Is.Consumer._context=Is,Is);var Is,xs;ws.Provider=Bs.Provider,ws.Consumer=Bs.Consumer;const Ts=()=>{const e=[],t=function(t){Zl(`${Kl}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`);const o=[];return Wr(e,((e,r)=>{if(Ur.und(t))o.push(e.start());else{const l=n(t,e,r);l&&o.push(e.start(l))}})),o};t.current=e,t.add=function(t){e.includes(t)||e.push(t)},t.delete=function(t){const n=e.indexOf(t);~n&&e.splice(n,1)},t.pause=function(){return Wr(e,(e=>e.pause(...arguments))),this},t.resume=function(){return Wr(e,(e=>e.resume(...arguments))),this},t.set=function(t){Wr(e,(e=>e.set(t)))},t.start=function(t){const n=[];return Wr(e,((e,o)=>{if(Ur.und(t))n.push(e.start());else{const r=this._getProps(t,e,o);r&&n.push(e.start(r))}})),n},t.stop=function(){return Wr(e,(e=>e.stop(...arguments))),this},t.update=function(t){return Wr(e,((e,n)=>e.update(this._getProps(t,e,n)))),this};const n=function(e,t,n){return Ur.fun(e)?e(n,t):e};return t._getProps=n,t};function Ns(e,t,n){const o=Ur.fun(t)&&t;o&&!n&&(n=[]);const r=(0,zr.useMemo)((()=>o||3==arguments.length?Ts():void 0),[]),l=(0,zr.useRef)(0),i=ei(),s=(0,zr.useMemo)((()=>({ctrls:[],queue:[],flush(e,t){const n=ks(e,t);return l.current>0&&!s.queue.length&&!Object.keys(n).some((t=>!e.springs[t]))?bs(e,t):new Promise((o=>{_s(e,n),s.queue.push((()=>{o(bs(e,t))})),i()}))}})),[]),a=(0,zr.useRef)([...s.ctrls]),c=[],u=ni(e)||0;function d(e,n){for(let r=e;r<n;r++){const e=a.current[r]||(a.current[r]=new hs(null,s.flush)),n=o?o(r,e):t[r];n&&(c[r]=cs(n))}}(0,zr.useMemo)((()=>{Wr(a.current.slice(e,u),(e=>{Li(e,r),e.stop(!0)})),a.current.length=e,d(u,e)}),[e]),(0,zr.useMemo)((()=>{d(0,Math.min(u,e))}),n);const p=a.current.map(((e,t)=>ks(e,c[t]))),m=(0,zr.useContext)(ws),f=ni(m),g=m!==f&&Ri(m);oi((()=>{l.current++,s.ctrls=a.current;const{queue:e}=s;e.length&&(s.queue=[],Wr(e,(e=>e()))),Wr(a.current,((e,t)=>{null==r||r.add(e),g&&e.start({default:m});const n=c[t];n&&(Ai(e,n.ref),e.ref?e.queue.push(n):e.start(n))}))})),Ql((()=>()=>{Wr(s.ctrls,(e=>e.stop(!0)))}));const h=p.map((e=>yi({},e)));return r?[h,r]:h}let Ps;!function(e){e.MOUNT="mount",e.ENTER="enter",e.UPDATE="update",e.LEAVE="leave"}(Ps||(Ps={}));class Rs extends Qi{constructor(e,t){super(),this.key=void 0,this.idle=!0,this.calc=void 0,this._active=new Set,this.source=e,this.calc=xl(...t);const n=this._get(),o=gi(n);ii(this,o.create(n))}advance(e){const t=this._get();Gr(t,this.get())||(li(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&Ls(this._active)&&As(this)}_get(){const e=Ur.arr(this.source)?this.source.map(Ml):jr(Ml(this.source));return this.calc(...e)}_start(){this.idle&&!Ls(this._active)&&(this.idle=!1,Wr(si(this),(e=>{e.done=!1})),el.skipAnimation?(Er.batchedUpdates((()=>this.advance())),As(this)):ll.start(this))}_attach(){let e=1;Wr(jr(this.source),(t=>{Rl(t)&&Fl(t,this),Zi(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){Wr(jr(this.source),(e=>{Rl(e)&&zl(e,this)})),this._active.clear(),As(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=jr(this.source).reduce(((e,t)=>Math.max(e,(Zi(t)?t.priority:0)+1)),0))}}function Ms(e){return!1!==e.idle}function Ls(e){return!e.size||Array.from(e).every(Ms)}function As(e){e.idle||(e.idle=!0,Wr(si(e),(e=>{e.done=!0})),Al(e,{type:"idle",parent:e}))}el.assign({createStringInterpolator:jl,to:(e,t)=>new Rs(e,t)}),ll.advance;var Ds=window.ReactDOM;function Os(e,t){if(null==e)return{};var n,o,r={},l=Object.keys(e);for(o=0;o<l.length;o++)n=l[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}const Fs=["style","children","scrollTop","scrollLeft"],zs=/^--/;function Vs(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||zs.test(e)||Us.hasOwnProperty(e)&&Us[e]?(""+t).trim():t+"px"}const Hs={};let Us={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};const Gs=["Webkit","Ms","Moz","O"];Us=Object.keys(Us).reduce(((e,t)=>(Gs.forEach((n=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(n,t)]=e[t])),e)),Us);const Ws=["x","y","z"],$s=/^(matrix|translate|scale|rotate|skew)/,js=/^(translate)/,Ks=/^(rotate|skew)/,qs=(e,t)=>Ur.num(e)&&0!==e?e+t:e,Ys=(e,t)=>Ur.arr(e)?e.every((e=>Ys(e,t))):Ur.num(e)?e===t:parseFloat(e)===t;class Zs extends pi{constructor(e){let{x:t,y:n,z:o}=e,r=Os(e,Ws);const l=[],i=[];(t||n||o)&&(l.push([t||0,n||0,o||0]),i.push((e=>[`translate3d(${e.map((e=>qs(e,"px"))).join(",")})`,Ys(e,0)]))),$r(r,((e,t)=>{if("transform"===t)l.push([e||""]),i.push((e=>[e,""===e]));else if($s.test(t)){if(delete r[t],Ur.und(e))return;const n=js.test(t)?"px":Ks.test(t)?"deg":"";l.push(jr(e)),i.push("rotate3d"===t?([e,t,o,r])=>[`rotate3d(${e},${t},${o},${qs(r,n)})`,Ys(r,0)]:e=>[`${t}(${e.map((e=>qs(e,n))).join(",")})`,Ys(e,t.startsWith("scale")?1:0)])}})),l.length&&(r.transform=new Xs(l,i)),super(r)}}class Xs extends Dl{constructor(e,t){super(),this._value=null,this.inputs=e,this.transforms=t}get(){return this._value||(this._value=this._get())}_get(){let e="",t=!0;return Wr(this.inputs,((n,o)=>{const r=Ml(n[0]),[l,i]=this.transforms[o](Ur.arr(r)?r:n.map(Ml));e+=" "+l,t=t&&i})),t?"none":e}observerAdded(e){1==e&&Wr(this.inputs,(e=>Wr(e,(e=>Rl(e)&&Fl(e,this)))))}observerRemoved(e){0==e&&Wr(this.inputs,(e=>Wr(e,(e=>Rl(e)&&zl(e,this)))))}eventObserved(e){"change"==e.type&&(this._value=null),Al(this,e)}}const Qs=["scrollTop","scrollLeft"];el.assign({batchedUpdates:Ds.unstable_batchedUpdates,createStringInterpolator:jl,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}});const Js=((e,{applyAnimatedValues:t=(()=>!1),createAnimatedStyle:n=(e=>new pi(e)),getComponentProps:o=(e=>e)}={})=>{const r={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:o},l=e=>{const t=_i(e)||"Anonymous";return(e=Ur.str(e)?l[e]||(l[e]=bi(e,r)):e[ki]||(e[ki]=bi(e,r))).displayName=`Animated(${t})`,e};return $r(e,((t,n)=>{Ur.arr(e)&&(n=_i(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;const n="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName,o=t,{style:r,children:l,scrollTop:i,scrollLeft:s}=o,a=Os(o,Fs),c=Object.values(a),u=Object.keys(a).map((t=>n||e.hasAttribute(t)?t:Hs[t]||(Hs[t]=t.replace(/([A-Z])/g,(e=>"-"+e.toLowerCase())))));void 0!==l&&(e.textContent=l);for(let t in r)if(r.hasOwnProperty(t)){const n=Vs(t,r[t]);zs.test(t)?e.style.setProperty(t,n):e.style[t]=n}u.forEach(((t,n)=>{e.setAttribute(t,c[n])})),void 0!==i&&(e.scrollTop=i),void 0!==s&&(e.scrollLeft=s)},createAnimatedStyle:e=>new Zs(e),getComponentProps:e=>Os(e,Qs)}).animated,ea=e=>e+1,ta=e=>({top:e.offsetTop,left:e.offsetLeft});var na=function({isSelected:e,adjustScrolling:t,enableAnimation:n,triggerAnimationOnChange:o}){const r=(0,s.useRef)(),l=(0,d.useReducedMotion)()||!n,[i,a]=(0,s.useReducer)(ea,0),[c,u]=(0,s.useReducer)(ea,0),[p,m]=(0,s.useState)({x:0,y:0}),f=(0,s.useMemo)((()=>r.current?ta(r.current):null),[o]),g=(0,s.useMemo)((()=>{if(!t||!r.current)return()=>{};const e=(0,tr.getScrollContainer)(r.current);if(!e)return()=>{};const n=r.current.getBoundingClientRect();return()=>{const t=r.current.getBoundingClientRect().top-n.top;t&&(e.scrollTop+=t)}}),[o,t]);function h({value:t}){let{x:n,y:o}=t;n=Math.round(n),o=Math.round(o),n===h.x&&o===h.y||(function({x:t,y:n}){if(!r.current)return;const o=0===t&&0===n;r.current.style.transformOrigin=o?"":"center",r.current.style.transform=o?"":`translate3d(${t}px,${n}px,0)`,r.current.style.zIndex=!e||o?"":"1",g()}({x:n,y:o}),h.x=n,h.y=o)}return(0,s.useLayoutEffect)((()=>{i&&u()}),[i]),(0,s.useLayoutEffect)((()=>{if(!f)return;if(l)return void g();r.current.style.transform="";const e=ta(r.current);a(),m({x:Math.round(f.left-e.left),y:Math.round(f.top-e.top)})}),[o]),h.x=0,h.y=0,function(e,t){const n=Ur.fun(e),[[o],r]=Ns(1,n?e:[e],n?t||[]:t)}({from:{x:p.x,y:p.y},to:{x:0,y:0},reset:i!==c,config:{mass:5,tension:2e3,friction:200},immediate:l,onChange:h}),r};const oa=".block-editor-block-list__block",ra=".block-list-appender";function la(e,t){return t.closest([oa,ra].join(","))===e}function ia(e){const t=(0,s.useRef)(),n=function(e){return(0,m.useSelect)((t=>{const{getSelectedBlocksInitialCaretPosition:n,isMultiSelecting:o,isNavigationMode:r,isBlockSelected:l}=t(Wn);if(l(e)&&!o()&&!r())return n()}),[e])}(e);return(0,s.useEffect)((()=>{if(null==n)return;if(!t.current)return;const{ownerDocument:e}=t.current;if(t.current.contains(e.activeElement))return;const o=tr.focus.tabbable.find(t.current).filter((e=>(0,tr.isTextField)(e))),r=-1===n,l=(r?u.last:u.first)(o)||t.current;la(t.current,l)?(0,tr.placeCaretAtHorizontalEdge)(l,r):t.current.focus()}),[n]),t}function sa(e){if(e.defaultPrevented)return;const t="mouseover"===e.type?"add":"remove";e.preventDefault(),e.currentTarget.classList[t]("is-hovered")}function aa(){const e=(0,m.useSelect)((e=>{const{isNavigationMode:t,getSettings:n}=e(Wn);return t()||n().outlineMode}),[]);return(0,d.useRefEffect)((t=>{if(e)return t.addEventListener("mouseout",sa),t.addEventListener("mouseover",sa),()=>{t.removeEventListener("mouseout",sa),t.removeEventListener("mouseover",sa),t.classList.remove("is-hovered")}}),[e])}function ca(e){return(0,m.useSelect)((t=>{const{isBlockBeingDragged:n,isBlockHighlighted:o,isBlockSelected:l,isBlockMultiSelected:i,getBlockName:s,getSettings:a,hasSelectedInnerBlock:u,isTyping:d,__experimentalGetActiveBlockIdByBlockNames:p}=t(Wn),{__experimentalSpotlightEntityBlocks:m,outlineMode:f}=a(),g=n(e),h=l(e),b=s(e),v=u(e,!0),k=p(m);return c()({"is-selected":h,"is-highlighted":o(e),"is-multi-selected":i(e),"is-reusable":(0,r.isReusableBlock)((0,r.getBlockType)(b)),"is-dragging":g,"has-child-selected":v,"has-active-entity":k,"is-active-entity":k===e,"remove-outline":h&&f&&d()})}),[e])}function ua(e){return(0,m.useSelect)((t=>{const n=t(Wn).getBlockName(e),o=(0,r.getBlockType)(n);if((null==o?void 0:o.apiVersion)>1)return(0,r.getBlockDefaultClassName)(n)}),[e])}function da(e){return(0,m.useSelect)((t=>{const{getBlockName:n,getBlockAttributes:o}=t(Wn),l=o(e);if(null==l||!l.className)return;const i=(0,r.getBlockType)(n(e));return(null==i?void 0:i.apiVersion)>1?l.className:void 0}),[e])}function pa(e){return(0,m.useSelect)((t=>{const{hasBlockMovingClientId:n,canInsertBlockType:o,getBlockName:r,getBlockRootClientId:l,isBlockSelected:i}=t(Wn);if(!i(e))return;const s=n();return s?c()("is-block-moving-mode",{"can-insert-moving-block":o(r(s),l(e))}):void 0}),[e])}function ma(e){const{isBlockSelected:t}=(0,m.useSelect)(Wn),{selectBlock:n,selectionChange:o}=(0,m.useDispatch)(Wn);return(0,d.useRefEffect)((r=>{function l(l){t(e)?l.target.isContentEditable||o(e):la(r,l.target)&&n(e)}return r.addEventListener("focusin",l),()=>{r.removeEventListener("focusin",l)}}),[t,n])}var fa=window.wp.keycodes;function ga(e){const t=(0,m.useSelect)((t=>t(Wn).isBlockSelected(e)),[e]),{getBlockRootClientId:n,getBlockIndex:o}=(0,m.useSelect)(Wn),{insertDefaultBlock:r,removeBlock:l}=(0,m.useDispatch)(Wn);return(0,d.useRefEffect)((i=>{if(t)return i.addEventListener("keydown",s),i.addEventListener("dragstart",a),()=>{i.removeEventListener("keydown",s),i.removeEventListener("dragstart",a)};function s(t){const{keyCode:s,target:a}=t;s!==fa.ENTER&&s!==fa.BACKSPACE&&s!==fa.DELETE||a!==i||(0,tr.isTextField)(a)||(t.preventDefault(),s===fa.ENTER?r({},n(e),o(e)+1):l(e))}function a(e){e.preventDefault()}}),[e,t,n,o,r,l])}function ha(e){const{isNavigationMode:t,isBlockSelected:n}=(0,m.useSelect)(Wn),{setNavigationMode:o,selectBlock:r}=(0,m.useDispatch)(Wn);return(0,d.useRefEffect)((l=>{function i(l){t()&&!l.defaultPrevented&&(l.preventDefault(),n(e)?o(!1):r(e))}return l.addEventListener("mousedown",i),()=>{l.addEventListener("mousedown",i)}}),[e,t,n,o])}var ba=n(4979),va=n.n(ba);function ka(e){const t=(0,s.useRef)(),n=(0,m.useSelect)((t=>{const{isBlockSelected:n,getBlockSelectionEnd:o}=t(Wn);return n(e)||o()===e}),[e]);return(0,s.useEffect)((()=>{if(!n)return;const e=t.current;if(!e)return;if(e.contains(e.ownerDocument.activeElement))return;const o=(0,tr.getScrollContainer)(e)||e.ownerDocument.defaultView;o&&va()(e,o,{onlyScrollIfNeeded:!0})}),[n]),t}const _a=(0,s.createContext)();function ya({children:e}){const t=(0,s.useMemo)((()=>({refs:new Map,callbacks:new Map})),[]);return(0,s.createElement)(_a.Provider,{value:t},e)}function Ea(e){const{refs:t,callbacks:n}=(0,s.useContext)(_a),o=(0,s.useRef)();return(0,s.useLayoutEffect)((()=>(t.set(o,e),()=>{t.delete(o)})),[e]),(0,d.useRefEffect)((t=>{o.current=t,n.forEach(((n,o)=>{e===n&&o(t)}))}),[e])}function Ca(e){const{refs:t}=(0,s.useContext)(_a),n=(0,s.useRef)();return n.current=e,(0,s.useMemo)((()=>({get current(){let e=null;for(const[o,r]of t.entries())r===n.current&&o.current&&(e=o.current);return e}})),[])}function Sa(e){const{callbacks:t}=(0,s.useContext)(_a),n=Ca(e),[o,r]=(0,s.useState)(null);return(0,s.useLayoutEffect)((()=>{if(e)return t.set(r,e),()=>{t.delete(r)}}),[e]),n.current||o}function wa(e,t){Array.from(e.closest(".is-root-container").querySelectorAll(".rich-text")).forEach((e=>{t?e.setAttribute("contenteditable",!0):e.removeAttribute("contenteditable")}))}function Ba(e){const{startMultiSelect:t,stopMultiSelect:n,multiSelect:o,selectBlock:r}=(0,m.useDispatch)(Wn),{isSelectionEnabled:l,isBlockSelected:i,getBlockParents:s,getBlockSelectionStart:a,hasMultiSelection:c}=(0,m.useSelect)(Wn);return(0,d.useRefEffect)((u=>{const{ownerDocument:d}=u,{defaultView:p}=d;let m,f;function g({isSelectionEnd:t}){const n=p.getSelection();if(!n.rangeCount||n.isCollapsed)return void wa(u,!0);const l=function(e){for(;e&&e.nodeType!==e.ELEMENT_NODE;)e=e.parentNode;if(!e)return;const t=e.closest(oa);return t?t.id.slice("block-".length):void 0}(n.focusNode);if(e===l){if(r(e),t&&(wa(u,!0),n.rangeCount)){const{commonAncestorContainer:e}=n.getRangeAt(0);m.contains(e)&&m.focus()}}else{const t=[...s(e),e],n=[...s(l),l],r=Math.min(t.length,n.length)-1;o(t[r],n[r])}}function h(){d.removeEventListener("selectionchange",g),p.removeEventListener("mouseup",h),f=p.requestAnimationFrame((()=>{g({isSelectionEnd:!0}),n()}))}function b({buttons:n}){1===n&&l()&&i(e)&&(m=d.activeElement,t(),d.addEventListener("selectionchange",g),p.addEventListener("mouseup",h),wa(u,!1))}function v(t){if(l()&&0===t.button)if(t.shiftKey){const n=a(),r=s(n);if(n&&n!==e&&(null==r||!r.includes(e))){wa(u,!1);const l=[...r,n],i=[...s(e),e],a=Math.min(l.length,i.length)-1;o(l[a],i[a]),t.preventDefault()}}else c()&&r(e)}return u.addEventListener("mousedown",v),u.addEventListener("mouseleave",b),()=>{u.removeEventListener("mousedown",v),u.removeEventListener("mouseleave",b),d.removeEventListener("selectionchange",g),p.removeEventListener("mouseup",h),p.cancelAnimationFrame(f)}}),[e,t,n,o,r,l,i,s])}function Ia(){const e=(0,s.useContext)($p);return(0,d.useRefEffect)((t=>{if(e)return e.observe(t),()=>{e.unobserve(t)}}),[e])}function xa(e={},{__unstableIsHtml:t}={}){const{clientId:n,className:o,wrapperProps:l={},isAligned:i}=(0,s.useContext)(Ta),{index:a,mode:u,name:p,blockApiVersion:f,blockTitle:h,isPartOfSelection:b,adjustScrolling:v,enableAnimation:k}=(0,m.useSelect)((e=>{const{getBlockRootClientId:t,getBlockIndex:o,getBlockMode:l,getBlockName:i,isTyping:s,getGlobalBlockCount:a,isBlockSelected:c,isBlockMultiSelected:u,isAncestorMultiSelected:d,isFirstMultiSelectedBlock:p}=e(Wn),m=c(n),f=u(n)||d(n),g=i(n),h=t(n),b=(0,r.getBlockType)(g);return{index:o(n,h),mode:l(n),name:g,blockApiVersion:(null==b?void 0:b.apiVersion)||1,blockTitle:null==b?void 0:b.title,isPartOfSelection:m||f,adjustScrolling:m||p(n),enableAnimation:!s()&&a()<=200}}),[n]),_=(0,g.sprintf)((0,g.__)("Block: %s"),h),y="html"!==u||t?"":"-visual",E=(0,d.useMergeRefs)([e.ref,ia(n),ka(n),Ea(n),ma(n),Ba(n),ga(n),ha(n),aa(),Ia(),na({isSelected:b,adjustScrolling:v,enableAnimation:k,triggerAnimationOnChange:a})]),C=qn();return f<2&&n===C.clientId&&"undefined"!=typeof process&&process.env,{...l,...e,ref:E,id:`block-${n}${y}`,tabIndex:0,role:"document","aria-label":_,"data-block":n,"data-type":p,"data-title":h,className:c()(c()("block-editor-block-list__block",{"wp-block":!i}),o,e.className,l.className,ca(n),ua(n),da(n),pa(n)),style:{...l.style,...e.style}}}xa.save=r.__unstableGetBlockProps;const Ta=(0,s.createContext)();function Na({children:e,isHtml:t,...n}){return(0,s.createElement)("div",xa(n,{__unstableIsHtml:t}),e)}const Pa=(0,m.withSelect)(((e,{clientId:t,rootClientId:n})=>{const{isBlockSelected:o,getBlockMode:r,isSelectionEnabled:l,getTemplateLock:i,__unstableGetBlockWithoutInnerBlocks:s,canRemoveBlock:a,canMoveBlock:c}=e(Wn),u=s(t),d=o(t),p=i(n),m=a(t,n),f=c(t,n),{name:g,attributes:h,isValid:b}=u||{};return{mode:r(t),isSelectionEnabled:l(),isLocked:!!p,canRemove:m,canMove:f,block:u,name:g,attributes:h,isValid:b,isSelected:d}})),Ra=(0,m.withDispatch)(((e,t,{select:n})=>{const{updateBlockAttributes:o,insertBlocks:l,mergeBlocks:i,replaceBlocks:s,toggleSelection:a,__unstableMarkLastChangeAsPersistent:c}=e(Wn);return{setAttributes(e){const{getMultiSelectedBlockClientIds:r}=n(Wn),l=r(),{clientId:i}=t,s=l.length?l:[i];o(s,e)},onInsertBlocks(e,n){const{rootClientId:o}=t;l(e,n,o)},onInsertBlocksAfter(e){const{clientId:o,rootClientId:r}=t,{getBlockIndex:i}=n(Wn),s=i(o,r);l(e,s+1,r)},onMerge(e){const{clientId:o}=t,{getPreviousBlockClientId:r,getNextBlockClientId:l}=n(Wn);if(e){const e=l(o);e&&i(o,e)}else{const e=r(o);e&&i(e,o)}},onReplace(e,n,o){e.length&&!(0,r.isUnmodifiedDefaultBlock)(e[e.length-1])&&c(),s([t.clientId],e,n,o)},toggleSelection(e){a(e)}}}));var Ma=(0,d.compose)(d.pure,Pa,Ra,(0,d.ifCondition)((({block:e})=>!!e)),(0,p.withFilters)("editor.BlockListBlock"))((function({mode:e,isLocked:t,canRemove:n,clientId:o,isSelected:l,isSelectionEnabled:i,className:a,name:d,isValid:p,attributes:f,wrapperProps:g,setAttributes:h,onReplace:b,onInsertBlocksAfter:v,onMerge:k,toggleSelection:_}){const{removeBlock:y}=(0,m.useDispatch)(Wn),E=(0,s.useCallback)((()=>y(o)),[o]);let C=(0,s.createElement)(sr,{name:d,isSelected:l,attributes:f,setAttributes:h,insertBlocksAfter:t?void 0:v,onReplace:n?b:void 0,onRemove:n?E:void 0,mergeBlocks:n?k:void 0,clientId:o,isSelectionEnabled:i,toggleSelection:_});const S=(0,r.getBlockType)(d);null!=S&&S.getEditWrapperProps&&(g=function(e,t){const n={...e,...t};return e&&t&&e.className&&t.className&&(n.className=c()(e.className,t.className)),e&&t&&e.style&&t.style&&(n.style={...e.style,...t.style}),n}(g,S.getEditWrapperProps(f)));const w=g&&!!g["data-align"];let B;if(w&&(C=(0,s.createElement)("div",{className:"wp-block","data-align":g["data-align"]},C)),p)B="html"===e?(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{style:{display:"none"}},C),(0,s.createElement)(Na,{isHtml:!0},(0,s.createElement)(_r,{clientId:o}))):(null==S?void 0:S.apiVersion)>1?C:(0,s.createElement)(Na,g,C);else{const e=(0,r.getSaveContent)(S,f);B=(0,s.createElement)(Na,{className:"has-warning"},(0,s.createElement)(fr,{clientId:o}),(0,s.createElement)(s.RawHTML,null,(0,tr.safeHTML)(e)))}const I={clientId:o,className:a,wrapperProps:(0,u.omit)(g,["data-align"]),isAligned:w},x=(0,s.useMemo)((()=>I),Object.values(I));return(0,s.createElement)(Ta.Provider,{value:x},(0,s.createElement)(vr,{fallback:(0,s.createElement)(Na,{className:"has-warning"},(0,s.createElement)(hr,null))},B))})),La=window.wp.htmlEntities,Aa=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));const Da=[(0,s.createInterpolateElement)((0,g.__)("While writing, you can press <kbd>/</kbd> to quickly insert new blocks."),{kbd:(0,s.createElement)("kbd",null)}),(0,s.createInterpolateElement)((0,g.__)("Indent a list by pressing <kbd>space</kbd> at the beginning of a line."),{kbd:(0,s.createElement)("kbd",null)}),(0,s.createInterpolateElement)((0,g.__)("Outdent a list by pressing <kbd>backspace</kbd> at the beginning of a line."),{kbd:(0,s.createElement)("kbd",null)}),(0,g.__)("Drag files into the editor to automatically insert media blocks."),(0,g.__)("Change a block's type by pressing the block icon on the toolbar.")];var Oa=function(){const[e]=(0,s.useState)(Math.floor(Math.random()*Da.length));return(0,s.createElement)(p.Tip,null,Da[e])},Fa=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"}));function za({icon:e,showColors:t=!1,className:n}){var o;"block-default"===(null===(o=e)||void 0===o?void 0:o.src)&&(e={src:Fa});const r=(0,s.createElement)(p.Icon,{icon:e&&e.src?e.src:e}),l=t?{backgroundColor:e&&e.background,color:e&&e.foreground}:{};return(0,s.createElement)("span",{style:l,className:c()("block-editor-block-icon",n,{"has-colors":t})},r)}var Va=function({title:e,icon:t,description:n,blockType:o}){return o&&(At()("`blockType` property in `BlockCard component`",{since:"5.7",alternative:"`title, icon and description` properties"}),({title:e,icon:t,description:n}=o)),(0,s.createElement)("div",{className:"block-editor-block-card"},(0,s.createElement)(za,{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),(0,s.createElement)("span",{className:"block-editor-block-card__description"},n)))};function Ha({clientId:e=null,value:t,selection:n,onChange:o=u.noop,onInput:l=u.noop}){const i=(0,m.useRegistry)(),{resetBlocks:a,resetSelection:c,replaceInnerBlocks:d,setHasControlledInnerBlocks:p,__unstableMarkNextChangeAsNotPersistent:f}=i.dispatch(Wn),{getBlockName:g,getBlocks:h}=i.select(Wn),b=(0,s.useRef)({incoming:null,outgoing:[]}),v=(0,s.useRef)(!1),k=(0,s.useRef)(l),_=(0,s.useRef)(o);(0,s.useEffect)((()=>{k.current=l,_.current=o}),[l,o]),(0,s.useEffect)((()=>{b.current.outgoing.includes(t)?(0,u.last)(b.current.outgoing)===t&&(b.current.outgoing=[]):h(e)!==t&&(b.current.outgoing=[],(()=>{if(t)if(f(),e){p(e,!0),f();const n=t.map((e=>(0,r.cloneBlock)(e)));v.current&&(b.current.incoming=n),d(e,n)}else v.current&&(b.current.incoming=t),a(t)})(),n&&c(n.selectionStart,n.selectionEnd,n.initialPosition))}),[t,e]),(0,s.useEffect)((()=>{const{getSelectionStart:t,getSelectionEnd:n,getSelectedBlocksInitialCaretPosition:o,isLastBlockChangePersistent:r,__unstableIsLastBlockChangeIgnored:l}=i.select(Wn);let s=h(e),a=r(),c=!1;v.current=!0;const u=i.subscribe((()=>{if(null!==e&&null===g(e))return;const i=r(),u=h(e),d=u!==s;if(s=u,d&&(b.current.incoming||l()))return b.current.incoming=null,void(a=i);(d||c&&!d&&i&&!a)&&(a=i,b.current.outgoing.push(s),(a?_.current:k.current)(s,{selection:{selectionStart:t(),selectionEnd:n(),initialPosition:o()}})),c=d}));return()=>u()}),[i,e])}var Ua=(0,d.createHigherOrderComponent)((e=>(0,m.withRegistry)((({useSubRegistry:t=!0,registry:n,...o})=>{if(!t)return(0,s.createElement)(e,i({registry:n},o));const[r,l]=(0,s.useState)(null);return(0,s.useEffect)((()=>{const e=(0,m.createRegistry)({},n);e.registerStore(Ot,Gn),l(e)}),[n]),r?(0,s.createElement)(m.RegistryProvider,{value:r},(0,s.createElement)(e,i({registry:r},o))):null}))),"withRegistryProvider")((function(e){const{children:t,settings:n}=e,{updateSettings:o}=(0,m.useDispatch)(Wn);return(0,s.useEffect)((()=>{o(n)}),[n]),Ha(e),(0,s.createElement)(ya,null,t)}));function Ga({onClick:e}){return(0,s.createElement)("div",{tabIndex:0,role:"button",onClick:e,onKeyPress:e},(0,s.createElement)(p.Disabled,null,(0,s.createElement)(Kp,null)))}function Wa(){const{hasSelectedBlock:e,hasMultiSelection:t}=(0,m.useSelect)(Wn),{clearSelectedBlock:n}=(0,m.useDispatch)(Wn);return(0,d.useRefEffect)((o=>{function r(r){(e()||t())&&r.target===o&&n()}return o.addEventListener("mousedown",r),()=>{o.removeEventListener("mousedown",r)}}),[e,t,n])}function $a(e){return(0,s.createElement)("div",i({ref:Wa()},e))}function ja(e,t){const n="start"===t?"firstChild":"lastChild",o="start"===t?"nextSibling":"previousSibling";for(;e[n];)for(e=e[n];e.nodeType===e.TEXT_NODE&&/^[ \t\n]*$/.test(e.data)&&e[o];)e=e[o];return e}function Ka(e){const{isMultiSelecting:t,getMultiSelectedBlockClientIds:n,hasMultiSelection:o,getSelectedBlockClientId:r}=e(Wn);return{isMultiSelecting:t(),multiSelectedBlockClientIds:n(),hasMultiSelection:o(),selectedBlockClientId:r()}}function qa(){const{isMultiSelecting:e,multiSelectedBlockClientIds:t,hasMultiSelection:n,selectedBlockClientId:o}=(0,m.useSelect)(Ka,[]),r=Ca(o),l=Ca((0,u.first)(t)),i=Ca((0,u.last)(t));return(0,d.useRefEffect)((s=>{const{ownerDocument:a}=s,{defaultView:c}=a;if(!n||e){if(!o||e)return;const t=c.getSelection();if(t.rangeCount&&!t.isCollapsed){const e=r.current,{startContainer:n,endContainer:o}=t.getRangeAt(0);!e||e.contains(n)&&e.contains(o)||t.removeAllRanges()}return}const{length:u}=t;if(u<2)return;if(!l.current||!i.current)return;s.focus();const d=c.getSelection(),p=a.createRange(),m=ja(l.current,"start"),f=ja(i.current,"end");var g;g=s,Array.from(g.querySelectorAll(".rich-text")).forEach((e=>{e.removeAttribute("contenteditable")})),p.setStartBefore(m),p.setEndAfter(f),d.removeAllRanges(),d.addRange(p)}),[n,e,t,o])}function Ya(e){const{tagName:t}=e;return"INPUT"===t||"BUTTON"===t||"SELECT"===t||"TEXTAREA"===t}function Za(e,t,n,o){let r,l=tr.focus.focusable.find(n);return t&&(l=(0,u.reverse)(l)),l=l.slice(l.indexOf(e)+1),o&&(r=e.getBoundingClientRect()),(0,u.find)(l,(function(e){if(!tr.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 Xa(){const{getSelectedBlockClientId:e,getMultiSelectedBlocksStartClientId:t,getMultiSelectedBlocksEndClientId:n,getPreviousBlockClientId:o,getNextBlockClientId:r,getFirstMultiSelectedBlockClientId:l,getLastMultiSelectedBlockClientId:i,getSettings:s,hasMultiSelection:a}=(0,m.useSelect)(Wn),{multiSelect:c,selectBlock:u}=(0,m.useDispatch)(Wn);return(0,d.useRefEffect)((d=>{let p;function m(){p=null}function f(l){const i=e(),s=t(),a=n(),d=o(a||i),p=r(a||i),m=l?d:p;m&&(s===m?u(m):c(s||i,m))}function g(e){const t=l(),n=i(),o=e?t:n;o&&u(o)}function h(t){const{keyCode:l,target:i}=t,c=l===fa.UP,u=l===fa.DOWN,m=l===fa.LEFT,h=l===fa.RIGHT,b=c||m,v=m||h,k=c||u,_=v||k,y=t.shiftKey,E=y||t.ctrlKey||t.altKey||t.metaKey,C=k?tr.isVerticalEdge:tr.isHorizontalEdge,{ownerDocument:S}=d,{defaultView:w}=S;if(a())return void(_&&((y?f:g)(b),t.preventDefault()));if(k?p||(p=(0,tr.computeCaretRect)(w)):p=null,t.defaultPrevented)return;if(!_)return;if(!function(e,t,n){if((t===fa.UP||t===fa.DOWN)&&!n)return!0;const{tagName:o}=e;return"INPUT"!==o&&"TEXTAREA"!==o}(i,l,E))return;const B=(0,tr.isRTL)(i)?!b:b,{keepCaretInsideBlock:I}=s(),x=e();if(y){const e=n(),l=o(e||x),s=r(e||x);(b&&l||!b&&s)&&function(e,t){const n=Za(e,t,d);return!n||!function(e,t){return e.closest(oa)===t.closest(oa)}(e,n)}(i,b)&&C(i,b)&&(f(b),t.preventDefault())}else if(k&&(0,tr.isVerticalEdge)(i,b)&&!I){const e=Za(i,b,d,!0);e&&((0,tr.placeCaretAtVerticalEdge)(e,b,p),t.preventDefault())}else if(v&&w.getSelection().isCollapsed&&(0,tr.isHorizontalEdge)(i,B)&&!I){const e=Za(i,B,d);(0,tr.placeCaretAtHorizontalEdge)(e,b),t.preventDefault()}}return d.addEventListener("mousedown",m),d.addEventListener("keydown",h),()=>{d.removeEventListener("mousedown",m),d.removeEventListener("keydown",h)}}),[])}var Qa=window.wp.keyboardShortcuts;function Ja(){const{getBlockOrder:e,getSelectedBlockClientIds:t,getBlockRootClientId:n}=(0,m.useSelect)(Wn),{multiSelect:o}=(0,m.useDispatch)(Wn),r=(0,Qa.__unstableUseShortcutEventMatch)();return(0,d.useRefEffect)((l=>{function i(l){if(!r("core/block-editor/select-all",l))return;if(!(0,tr.isEntirelySelected)(l.target))return;const i=t(),[s]=i,a=n(s);let c=e(a);i.length===c.length&&(c=e(n(a)));const d=(0,u.first)(c),p=(0,u.last)(c);d!==p&&(o(d,p),l.preventDefault())}return l.addEventListener("keydown",i),()=>{l.removeEventListener("keydown",i)}}),[])}function ec(){const[e,t,n]=function(){const e=(0,s.useRef)(),t=(0,s.useRef)(),n=(0,s.useRef)(),o=(0,s.useRef)(),{hasMultiSelection:r,getSelectedBlockClientId:l,getBlockCount:i}=(0,m.useSelect)(Wn),{setNavigationMode:a}=(0,m.useDispatch)(Wn),c=(0,m.useSelect)((e=>e(Wn).isNavigationMode()),[])?void 0:"0",u=(0,s.useRef)();function p(t){if(u.current)u.current=null;else if(r())e.current.focus();else if(l())o.current.focus();else{a(!0);const n=t.target.compareDocumentPosition(e.current)&t.target.DOCUMENT_POSITION_FOLLOWING?"findNext":"findPrevious";tr.focus.tabbable[n](t.target).focus()}}const f=(0,s.createElement)("div",{ref:t,tabIndex:c,onFocus:p}),g=(0,s.createElement)("div",{ref:n,tabIndex:c,onFocus:p}),h=(0,d.useRefEffect)((s=>{function c(e){if(e.defaultPrevented)return;if(e.keyCode===fa.ESCAPE&&!r())return e.preventDefault(),void a(!0);if(e.keyCode!==fa.TAB)return;const o=e.shiftKey,i=o?"findPrevious":"findNext";if(!r()&&!l())return void(e.target===s&&a(!0));if(Ya(e.target)&&Ya(tr.focus.tabbable[i](e.target)))return;const c=o?t:n;u.current=!0,c.current.focus({preventScroll:!0})}function d(e){o.current=e.target;const{ownerDocument:t}=s;e.relatedTarget||t.activeElement!==t.body||0!==i()||s.focus()}function p(o){var r;if(o.keyCode!==fa.TAB)return;if("region"===(null===(r=o.target)||void 0===r?void 0:r.getAttribute("role")))return;if(e.current===o.target)return;const l=o.shiftKey?"findPrevious":"findNext",i=tr.focus.tabbable[l](o.target);i!==t.current&&i!==n.current||(o.preventDefault(),i.focus({preventScroll:!0}))}const{ownerDocument:m}=s,{defaultView:f}=m;return f.addEventListener("keydown",p),s.addEventListener("keydown",c),s.addEventListener("focusout",d),()=>{f.removeEventListener("keydown",p),s.removeEventListener("keydown",c),s.removeEventListener("focusout",d)}}),[]);return[f,(0,d.useMergeRefs)([e,h]),g]}(),o=(0,m.useSelect)((e=>e(Wn).hasMultiSelection()),[]);return[e,(0,d.useMergeRefs)([t,qa(),Ja(),Xa(),(0,d.useRefEffect)((e=>{if(e.tabIndex=-1,o)return e.setAttribute("aria-label",(0,g.__)("Multiple selected blocks")),()=>{e.removeAttribute("aria-label")}}),[o])]),n]}var tc=(0,s.forwardRef)((function({children:e,...t},n){const[o,r,l]=ec();return(0,s.createElement)(s.Fragment,null,o,(0,s.createElement)("div",i({},t,{ref:(0,d.useMergeRefs)([r,n]),className:c()(t.className,"block-editor-writing-flow")}),e),l)}));const nc="editor-styles-wrapper";function oc(e){return(0,s.useMemo)((()=>{const t=document.implementation.createHTMLDocument("");return t.body.innerHTML=e,Array.from(t.body.children)}),[e])}var rc=(0,s.forwardRef)((function({contentRef:e,children:t,head:n,tabIndex:o=0,...r},l){var a,u;const[,m]=(0,s.useReducer)((()=>({}))),[f,h]=(0,s.useState)(),[b,v]=(0,s.useState)([]),k=oc(null===(a=window.__editorAssets)||void 0===a?void 0:a.styles),_=oc(null===(u=window.__editorAssets)||void 0===u?void 0:u.scripts),y=Wa(),[E,C,S]=ec(),w=(0,d.useRefEffect)((e=>{function t(){const{contentDocument:t,ownerDocument:n}=e,{readyState:o,documentElement:r}=t;return("interactive"===o||"complete"===o)&&(function(e){const{defaultView:t}=e,{frameElement:n}=t;function o(e){const o=Object.getPrototypeOf(e).constructor.name,r=window[o],l={};for(const t in e)l[t]=e[t];if(e instanceof t.MouseEvent){const e=n.getBoundingClientRect();l.clientX+=e.left,l.clientY+=e.top}const i=new r(e.type,l);!n.dispatchEvent(i)&&e.preventDefault()}const r=["dragover"];for(const t of r)e.addEventListener(t,o)}(t),h(t),y(r),v(Array.from(n.body.classList).filter((e=>e.startsWith("admin-color-")||"wp-embed-responsive"===e))),t.dir=n.dir,r.removeChild(t.head),r.removeChild(t.body),!0)}t()||e.addEventListener("load",(()=>{t()}))}),[]),B=(0,d.useRefEffect)((e=>{_.reduce(((t,n)=>t.then((()=>async function(e,{id:t,src:n}){return new Promise(((o,r)=>{const l=e.ownerDocument.createElement("script");l.id=t,n?(l.src=n,l.onload=()=>o(),l.onerror=()=>r()):o(),e.appendChild(l)}))}(e,n)))),Promise.resolve()).finally((()=>{m()}))}),[]),I=(0,d.useMergeRefs)([e,y,C]);return(0,s.useEffect)((()=>{var e;f&&(e=f,Array.from(document.styleSheets).forEach((t=>{try{t.cssRules}catch(e){return}const{ownerNode:n,cssRules:o}=t;if(o&&"LINK"===n.tagName&&"wp-reset-editor-styles-css"!==n.id&&Array.from(o).find((({selectorText:e})=>e&&(e.includes(`.${nc}`)||e.includes(".wp-block"))))&&!e.getElementById(n.id)){console.warn(`Stylesheet ${n.id} was not properly added.\nFor blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).\nFor themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`,n.outerHTML),e.head.appendChild(n.cloneNode(!0));const t=n.id.replace("-css","-inline-css"),o=document.getElementById(t);o&&e.head.appendChild(o.cloneNode(!0))}})))}),[f]),n=(0,s.createElement)(s.Fragment,null,(0,s.createElement)("style",null,"body{margin:0}"),k.map((({tagName:e,href:t,id:n,rel:o,media:r,textContent:l})=>{const i=e.toLowerCase();return"style"===i?(0,s.createElement)(i,{id:n,key:n},l):(0,s.createElement)(i,{href:t,id:n,rel:o,media:r,key:n})})),n),(0,s.createElement)(s.Fragment,null,o>=0&&E,(0,s.createElement)("iframe",i({},r,{ref:(0,d.useMergeRefs)([l,w]),tabIndex:o,title:(0,g.__)("Editor canvas")}),f&&(0,s.createPortal)((0,s.createElement)(s.Fragment,null,(0,s.createElement)("head",{ref:B},n),(0,s.createElement)("body",{ref:I,className:c()(nc,...b)},(0,s.createElement)(p.__experimentalStyleProvider,{document:f},t))),f.documentElement)),o>=0&&S)})),lc={grad:.9,turn:360,rad:360/(2*Math.PI)},ic=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},sc=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},ac=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},cc=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},uc=function(e){return{r:ac(e.r,0,255),g:ac(e.g,0,255),b:ac(e.b,0,255),a:ac(e.a)}},dc=function(e){return{r:sc(e.r),g:sc(e.g),b:sc(e.b),a:sc(e.a,3)}},pc=/^#([0-9a-f]{3,8})$/i,mc=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},fc=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}},gc=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}},hc=function(e){return{h:cc(e.h),s:ac(e.s,0,100),l:ac(e.l,0,100),a:ac(e.a)}},bc=function(e){return{h:sc(e.h),s:sc(e.s),l:sc(e.l),a:sc(e.a,3)}},vc=function(e){return gc((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},kc=function(e){return{h:(t=fc(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},_c=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yc=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ec=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Cc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Sc={string:[[function(e){var t=pc.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?sc(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?sc(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Ec.exec(e)||Cc.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:uc({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=_c.exec(e)||yc.exec(e);if(!t)return null;var n,o,r=hc({h:(n=t[1],o=t[2],void 0===o&&(o="deg"),Number(n)*(lc[o]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return vc(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 ic(t)&&ic(n)&&ic(o)?uc({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(!ic(t)||!ic(n)||!ic(o))return null;var i=hc({h:Number(t),s:Number(n),l:Number(o),a:Number(l)});return vc(i)},"hsl"],[function(e){var t=e.h,n=e.s,o=e.v,r=e.a,l=void 0===r?1:r;if(!ic(t)||!ic(n)||!ic(o))return null;var i=function(e){return{h:cc(e.h),s:ac(e.s,0,100),v:ac(e.v,0,100),a:ac(e.a)}}({h:Number(t),s:Number(n),v:Number(o),a:Number(l)});return gc(i)},"hsv"]]},wc=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]},Bc=function(e,t){var n=kc(e);return{h:n.h,s:ac(n.s+100*t,0,100),l:n.l,a:n.a}},Ic=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},xc=function(e,t){var n=kc(e);return{h:n.h,s:n.s,l:ac(n.l+100*t,0,100),a:n.a}},Tc=function(){function e(e){this.parsed=function(e){return"string"==typeof e?wc(e.trim(),Sc.string):"object"==typeof e&&null!==e?wc(e,Sc.object):[null,void 0]}(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 sc(Ic(this.rgba),2)},e.prototype.isDark=function(){return Ic(this.rgba)<.5},e.prototype.isLight=function(){return Ic(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=dc(this.rgba)).r,n=e.g,o=e.b,l=(r=e.a)<1?mc(sc(255*r)):"","#"+mc(t)+mc(n)+mc(o)+l;var e,t,n,o,r,l},e.prototype.toRgb=function(){return dc(this.rgba)},e.prototype.toRgbString=function(){return t=(e=dc(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 bc(kc(this.rgba))},e.prototype.toHslString=function(){return t=(e=bc(kc(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=fc(this.rgba),{h:sc(e.h),s:sc(e.s),v:sc(e.v),a:sc(e.a,3)};var e},e.prototype.invert=function(){return Nc({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),Nc(Bc(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Nc(Bc(this.rgba,-e))},e.prototype.grayscale=function(){return Nc(Bc(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Nc(xc(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Nc(xc(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?Nc({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):sc(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=kc(this.rgba);return"number"==typeof e?Nc({h:e,s:t.s,l:t.l,a:t.a}):sc(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Nc(e).toHex()},e}(),Nc=function(e){return e instanceof Tc?e:new Tc(e)},Pc=[],Rc=function(e){e.forEach((function(e){Pc.indexOf(e)<0&&(e(Tc,Sc),Pc.push(e))}))};function Mc(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 Lc=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},Ac=function(e){return.2126*Lc(e.r)+.7152*Lc(e.g)+.0722*Lc(e.b)};function Dc(e){e.prototype.luminance=function(){return e=Ac(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=Ac(l))>(a=Ac(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}}var Oc=n(3692),Fc=n.n(Oc);const zc=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function Vc(e,t){t=t||{};let n=1,o=1;function r(e){const t=e.match(/\n/g);t&&(n+=t.length);const r=e.lastIndexOf("\n");o=~r?e.length-r:o+e.length}function l(){const e={line:n,column:o};return function(t){return t.position=new i(e),m(),t}}function i(e){this.start=e,this.end={line:n,column:o},this.source=t.source}i.prototype.content=e;const s=[];function a(r){const l=new Error(t.source+":"+n+":"+o+": "+r);if(l.reason=r,l.filename=t.source,l.line=n,l.column=o,l.source=e,!t.silent)throw l;s.push(l)}function c(){return p(/^{\s*/)}function u(){return p(/^}/)}function d(){let t;const n=[];for(m(),f(n);e.length&&"}"!==e.charAt(0)&&(t=S()||w());)!1!==t&&(n.push(t),f(n));return n}function p(t){const n=t.exec(e);if(!n)return;const o=n[0];return r(o),e=e.slice(o.length),n}function m(){p(/^\s*/)}function f(e){let t;for(e=e||[];t=g();)!1!==t&&e.push(t);return e}function g(){const t=l();if("/"!==e.charAt(0)||"*"!==e.charAt(1))return;let n=2;for(;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return a("End of comment missing");const i=e.slice(2,n-2);return o+=2,r(i),e=e.slice(n),o+=2,t({type:"comment",comment:i})}function h(){const e=p(/^([^{]+)/);if(e)return Hc(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(function(e){return e.replace(/,/g,"")})).split(/\s*(?![^(]*\)),\s*/).map((function(e){return e.replace(/\u200C/g,",")}))}function b(){const e=l();let t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!t)return;if(t=Hc(t[0]),!p(/^:\s*/))return a("property missing ':'");const n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),o=e({type:"declaration",property:t.replace(zc,""),value:n?Hc(n[0]).replace(zc,""):""});return p(/^[;\s]*/),o}function v(){const e=[];if(!c())return a("missing '{'");let t;for(f(e);t=b();)!1!==t&&(e.push(t),f(e));return u()?e:a("missing '}'")}function k(){let e;const t=[],n=l();for(;e=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),p(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:v()})}const _=C("import"),y=C("charset"),E=C("namespace");function C(e){const t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){const n=l(),o=p(t);if(!o)return;const r={type:e};return r[e]=o[1].trim(),n(r)}}function S(){if("@"===e[0])return function(){const e=l();let t=p(/^@([-\w]+)?keyframes\s*/);if(!t)return;const n=t[1];if(t=p(/^([-\w]+)\s*/),!t)return a("@keyframes missing name");const o=t[1];if(!c())return a("@keyframes missing '{'");let r,i=f();for(;r=k();)i.push(r),i=i.concat(f());return u()?e({type:"keyframes",name:o,vendor:n,keyframes:i}):a("@keyframes missing '}'")}()||function(){const e=l(),t=p(/^@media *([^{]+)/);if(!t)return;const n=Hc(t[1]);if(!c())return a("@media missing '{'");const o=f().concat(d());return u()?e({type:"media",media:n,rules:o}):a("@media missing '}'")}()||function(){const e=l(),t=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:Hc(t[1]),media:Hc(t[2])})}()||function(){const e=l(),t=p(/^@supports *([^{]+)/);if(!t)return;const n=Hc(t[1]);if(!c())return a("@supports missing '{'");const o=f().concat(d());return u()?e({type:"supports",supports:n,rules:o}):a("@supports missing '}'")}()||_()||y()||E()||function(){const e=l(),t=p(/^@([-\w]+)?document *([^{]+)/);if(!t)return;const n=Hc(t[1]),o=Hc(t[2]);if(!c())return a("@document missing '{'");const r=f().concat(d());return u()?e({type:"document",document:o,vendor:n,rules:r}):a("@document missing '}'")}()||function(){const e=l();if(!p(/^@page */))return;const t=h()||[];if(!c())return a("@page missing '{'");let n,o=f();for(;n=b();)o.push(n),o=o.concat(f());return u()?e({type:"page",selectors:t,declarations:o}):a("@page missing '}'")}()||function(){const e=l();if(!p(/^@host\s*/))return;if(!c())return a("@host missing '{'");const t=f().concat(d());return u()?e({type:"host",rules:t}):a("@host missing '}'")}()||function(){const e=l();if(!p(/^@font-face\s*/))return;if(!c())return a("@font-face missing '{'");let t,n=f();for(;t=b();)n.push(t),n=n.concat(f());return u()?e({type:"font-face",declarations:n}):a("@font-face missing '}'")}()}function w(){const e=l(),t=h();return t?(f(),e({type:"rule",selectors:t,declarations:v()})):a("selector missing")}return Uc(function(){const e=d();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:s}}}())}function Hc(e){return e?e.replace(/^\s+|\s+$/g,""):""}function Uc(e,t){const n=e&&"string"==typeof e.type,o=n?e:t;for(const t in e){const n=e[t];Array.isArray(n)?n.forEach((function(e){Uc(e,o)})):n&&"object"==typeof n&&Uc(n,o)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var Gc=n(5717),Wc=n.n(Gc),$c=jc;function jc(e){this.options=e||{}}jc.prototype.emit=function(e){return e},jc.prototype.visit=function(e){return this[e.type](e)},jc.prototype.mapVisit=function(e,t){let n="";t=t||"";for(let o=0,r=e.length;o<r;o++)n+=this.visit(e[o]),t&&o<r-1&&(n+=this.emit(t));return n};var Kc=qc;function qc(e){$c.call(this,e)}Wc()(qc,$c),qc.prototype.compile=function(e){return e.stylesheet.rules.map(this.visit,this).join("")},qc.prototype.comment=function(e){return this.emit("",e.position)},qc.prototype.import=function(e){return this.emit("@import "+e.import+";",e.position)},qc.prototype.media=function(e){return this.emit("@media "+e.media,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},qc.prototype.document=function(e){const t="@"+(e.vendor||"")+"document "+e.document;return this.emit(t,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},qc.prototype.charset=function(e){return this.emit("@charset "+e.charset+";",e.position)},qc.prototype.namespace=function(e){return this.emit("@namespace "+e.namespace+";",e.position)},qc.prototype.supports=function(e){return this.emit("@supports "+e.supports,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},qc.prototype.keyframes=function(e){return this.emit("@"+(e.vendor||"")+"keyframes "+e.name,e.position)+this.emit("{")+this.mapVisit(e.keyframes)+this.emit("}")},qc.prototype.keyframe=function(e){const t=e.declarations;return this.emit(e.values.join(","),e.position)+this.emit("{")+this.mapVisit(t)+this.emit("}")},qc.prototype.page=function(e){const t=e.selectors.length?e.selectors.join(", "):"";return this.emit("@page "+t,e.position)+this.emit("{")+this.mapVisit(e.declarations)+this.emit("}")},qc.prototype["font-face"]=function(e){return this.emit("@font-face",e.position)+this.emit("{")+this.mapVisit(e.declarations)+this.emit("}")},qc.prototype.host=function(e){return this.emit("@host",e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},qc.prototype["custom-media"]=function(e){return this.emit("@custom-media "+e.name+" "+e.media+";",e.position)},qc.prototype.rule=function(e){const t=e.declarations;return t.length?this.emit(e.selectors.join(","),e.position)+this.emit("{")+this.mapVisit(t)+this.emit("}"):""},qc.prototype.declaration=function(e){return this.emit(e.property+":"+e.value,e.position)+this.emit(";")};var Yc=Zc;function Zc(e){e=e||{},$c.call(this,e),this.indentation=e.indent}Wc()(Zc,$c),Zc.prototype.compile=function(e){return this.stylesheet(e)},Zc.prototype.stylesheet=function(e){return this.mapVisit(e.stylesheet.rules,"\n\n")},Zc.prototype.comment=function(e){return this.emit(this.indent()+"/*"+e.comment+"*/",e.position)},Zc.prototype.import=function(e){return this.emit("@import "+e.import+";",e.position)},Zc.prototype.media=function(e){return this.emit("@media "+e.media,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")},Zc.prototype.document=function(e){const t="@"+(e.vendor||"")+"document "+e.document;return this.emit(t,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")},Zc.prototype.charset=function(e){return this.emit("@charset "+e.charset+";",e.position)},Zc.prototype.namespace=function(e){return this.emit("@namespace "+e.namespace+";",e.position)},Zc.prototype.supports=function(e){return this.emit("@supports "+e.supports,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")},Zc.prototype.keyframes=function(e){return this.emit("@"+(e.vendor||"")+"keyframes "+e.name,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.keyframes,"\n")+this.emit(this.indent(-1)+"}")},Zc.prototype.keyframe=function(e){const t=e.declarations;return this.emit(this.indent())+this.emit(e.values.join(", "),e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(t,"\n")+this.emit(this.indent(-1)+"\n"+this.indent()+"}\n")},Zc.prototype.page=function(e){const t=e.selectors.length?e.selectors.join(", ")+" ":"";return this.emit("@page "+t,e.position)+this.emit("{\n")+this.emit(this.indent(1))+this.mapVisit(e.declarations,"\n")+this.emit(this.indent(-1))+this.emit("\n}")},Zc.prototype["font-face"]=function(e){return this.emit("@font-face ",e.position)+this.emit("{\n")+this.emit(this.indent(1))+this.mapVisit(e.declarations,"\n")+this.emit(this.indent(-1))+this.emit("\n}")},Zc.prototype.host=function(e){return this.emit("@host",e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")},Zc.prototype["custom-media"]=function(e){return this.emit("@custom-media "+e.name+" "+e.media+";",e.position)},Zc.prototype.rule=function(e){const t=this.indent(),n=e.declarations;return n.length?this.emit(e.selectors.map((function(e){return t+e})).join(",\n"),e.position)+this.emit(" {\n")+this.emit(this.indent(1))+this.mapVisit(n,"\n")+this.emit(this.indent(-1))+this.emit("\n"+this.indent()+"}"):""},Zc.prototype.declaration=function(e){return this.emit(this.indent())+this.emit(e.property+": "+e.value,e.position)+this.emit(";")},Zc.prototype.indent=function(e){return this.level=this.level||1,null!==e?(this.level+=e,""):Array(this.level).join(this.indentation||" ")};function Xc(e){return 0!==e.value.indexOf("data:")&&0!==e.value.indexOf("#")&&(t=e.value,!/^\/(?!\/)/.test(t)&&!function(e){return/^(?:https?:)?\/\//.test(e)}(e.value));var t}function Qc(e,t){return new URL(e,t).toString()}const Jc=/^(body|html|:root).*$/;var eu=(e,t="")=>(0,u.map)(e,(({css:e,baseURL:n,__experimentalNoWrapper:o=!1})=>{const r=[];return t&&!o&&r.push(((e,t=[])=>n=>"rule"===n.type?{...n,selectors:n.selectors.map((n=>t.includes(n.trim())?n:n.match(Jc)?n.replace(/^(body|html|:root)/,e):e+" "+n))}:n)(t)),n&&r.push((l=n,e=>{if("declaration"===e.type){const r=function(e){const t=/url\((\s*)(['"]?)(.+?)\2(\s*)\)/g;let n;const o=[];for(;null!==(n=t.exec(e));){const e={source:n[0],before:n[1],quote:n[2],value:n[3],after:n[4]};Xc(e)&&o.push(e)}return o}(e.value).map((o=l,e=>({...e,newUrl:"url("+e.before+e.quote+Qc(e.value,o)+e.quote+e.after+")"})));return{...e,value:(t=e.value,n=r,n.forEach((e=>{t=t.replace(e.source,e.newUrl)})),t)}}var t,n,o;return e})),r.length?function(e,t){try{const r=Vc(e);return n=Fc().map(r,(function(e){if(!e)return e;const n=t(e);return this.update(n)})),((o=o||{}).compress?new Kc(o):new Yc(o)).compile(n)}catch(e){return console.warn("Error while traversing the CSS: "+e),null}var n,o}(e,(0,d.compose)(r)):e;var l}));const tu=".editor-styles-wrapper";function nu(e){return(0,s.useCallback)((e=>{if(!e)return;const{ownerDocument:t}=e,{defaultView:n,body:o}=t,r=t.querySelector(tu);let l;if(r)l=n.getComputedStyle(r,null).getPropertyValue("background-color");else{const e=t.createElement("div");e.classList.add("editor-styles-wrapper"),o.appendChild(e),l=n.getComputedStyle(e,null).getPropertyValue("background-color"),o.removeChild(e)}const i=Nc(l);i.luminance()>.5||0===i.alpha()?o.classList.remove("is-dark-theme"):o.classList.add("is-dark-theme")}),[e])}function ou({styles:e}){const t=(0,s.useMemo)((()=>eu(e,tu)),[e]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("style",{ref:nu(e)}),t.map(((e,t)=>(0,s.createElement)("style",{key:t},e))))}let ru;Rc([Mc,Dc]);var lu=function({viewportWidth:e,__experimentalPadding:t}){const[n,{width:o}]=(0,d.useResizeObserver)(),[r,{height:l}]=(0,d.useResizeObserver)(),i=(0,m.useSelect)((e=>e(Wn).getSettings().styles),[]);ru=ru||(0,d.pure)(Kp);const a=o/e;return(0,s.createElement)("div",{className:"block-editor-block-preview__container"},n,(0,s.createElement)(p.Disabled,{className:"block-editor-block-preview__content",style:{transform:`scale(${a})`,height:l*a}},(0,s.createElement)(rc,{head:(0,s.createElement)(ou,{styles:i}),contentRef:(0,d.useRefEffect)((e=>{const{ownerDocument:{documentElement:n}}=e;n.style.position="absolute",n.style.width="100%",e.style.padding=t+"px"}),[]),"aria-hidden":!0,tabIndex:-1,style:{position:"absolute",width:e,height:l,pointerEvents:"none"}},r,(0,s.createElement)(ru,{renderAppender:!1}))))},iu=(0,s.memo)((function({blocks:e,__experimentalPadding:t=0,viewportWidth:n=1200,__experimentalLive:o=!1,__experimentalOnClick:r}){const l=(0,m.useSelect)((e=>e(Wn).getSettings()),[]),i=(0,s.useMemo)((()=>{const e={...l};return e.__experimentalBlockPatterns=[],e}),[l]),a=(0,s.useMemo)((()=>(0,u.castArray)(e)),[e]);return e&&0!==e.length?(0,s.createElement)(Ua,{value:a,settings:i},o?(0,s.createElement)(Ga,{onClick:r}):(0,s.createElement)(lu,{viewportWidth:n,__experimentalPadding:t})):null})),su=function({item:e}){var t,n;const{name:o,title:l,icon:i,description:a,initialAttributes:c}=e,u=(0,r.getBlockType)(o),d=(0,r.isReusableBlock)(e);return(0,s.createElement)("div",{className:"block-editor-inserter__preview-container"},(0,s.createElement)("div",{className:"block-editor-inserter__preview"},d||null!=u&&u.example?(0,s.createElement)("div",{className:"block-editor-inserter__preview-content"},(0,s.createElement)(iu,{__experimentalPadding:16,viewportWidth:null!==(t=null===(n=u.example)||void 0===n?void 0:n.viewportWidth)&&void 0!==t?t:500,blocks:u.example?(0,r.getBlockFromExample)(e.name,{attributes:{...u.example.attributes,...c},innerBlocks:u.example.innerBlocks}):(0,r.createBlock)(o,c)})):(0,s.createElement)("div",{className:"block-editor-inserter__preview-content-missing"},(0,g.__)("No Preview Available."))),!d&&(0,s.createElement)(Va,{title:l,icon:i,description:a}))},au=(0,s.createContext)(),cu=(0,s.forwardRef)((function({isFirst:e,as:t,children:n,...o},r){const l=(0,s.useContext)(au);return(0,s.createElement)(p.__unstableCompositeItem,i({ref:r,state:l,role:"option",focusable:!0},o),(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)(p.Button,r,n)}))})),uu=(0,s.createElement)(F.SVG,{width:"18",height:"18",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18"},(0,s.createElement)(F.Path,{d:"M5 4h2V2H5v2zm6-2v2h2V2h-2zm-6 8h2V8H5v2zm6 0h2V8h-2v2zm-6 6h2v-2H5v2zm6 0h2v-2h-2v2z"}));function du({count:e,icon:t}){return(0,s.createElement)("div",{className:"block-editor-block-draggable-chip-wrapper"},(0,s.createElement)("div",{className:"block-editor-block-draggable-chip"},(0,s.createElement)(p.Flex,{justify:"center",className:"block-editor-block-draggable-chip__content"},(0,s.createElement)(p.FlexItem,null,t?(0,s.createElement)(za,{icon:t}):(0,g.sprintf)(
|
| 11 |
/* translators: %d: Number of blocks. */
|
| 12 |
-
(0,
|
| 13 |
/* translators: %s: block pattern title. */
|
| 14 |
-
(0,
|
| 15 |
-
(0,
|
|
|
|
|
|
|
| 16 |
/* translators: %d: number of results. */
|
| 17 |
-
(0,
|
|
|
|
|
|
|
| 18 |
/* translators: Blocks tab title in the block inserter. */
|
| 19 |
-
title:(0,
|
| 20 |
/* translators: Patterns tab title in the block inserter. */
|
| 21 |
-
title:(0,
|
| 22 |
/* translators: Reusable blocks tab title in the block inserter. */
|
| 23 |
-
title:(0,
|
| 24 |
-
(0,
|
| 25 |
-
(0,
|
| 26 |
-
(0,g._x)("Add %s","directly add the only allowed block"),a):(0,g._x)("Add block","Generic label for block inserter button");const m=!u;let f=(0,s.createElement)(p.Button,{ref:r,onFocus:n,tabIndex:o,className:c()(t,"block-editor-button-block-appender"),onClick:e,"aria-haspopup":m?"true":void 0,"aria-expanded":m?i:void 0,disabled:l,label:d},!u&&(0,s.createElement)(p.VisuallyHidden,{as:"span"},d),(0,s.createElement)(Co,{icon:Aa}));return(m||u)&&(f=(0,s.createElement)(p.Tooltip,{text:d},f)),f},isAppender:!0})}const cd=(0,s.forwardRef)(((e,t)=>(At()("wp.blockEditor.ButtonBlockerAppender",{alternative:"wp.blockEditor.ButtonBlockAppender"}),ad(e,t))));var ud=(0,s.forwardRef)(ad),dd=(0,m.withSelect)(((e,{rootClientId:t})=>{const{getBlockOrder:n,canInsertBlockType:o,getTemplateLock:l,getSelectedBlockClientId:i}=e(Wn);return{isLocked:!!l(t),blockClientIds:n(t),canInsertDefaultBlock:o((0,r.getDefaultBlockName)(),t),selectedBlockClientId:i()}}))((function({blockClientIds:e,rootClientId:t,canInsertDefaultBlock:n,isLocked:o,renderAppender:r,className:l,selectedBlockClientId:i,tagName:a="div"}){if(o||!1===r)return null;let d;if(r)d=(0,s.createElement)(r,null);else{const o=!t,r=i===t,l=i&&!e.includes(i);if(!o&&!r&&(!i||l))return null;d=n?(0,s.createElement)(sd,{rootClientId:t,lastBlockClientId:(0,u.last)(e)}):(0,s.createElement)(ud,{rootClientId:t,className:"block-list-appender__toggle"})}return(0,s.createElement)(a,{tabIndex:-1,className:c()("block-list-appender wp-block",l),"data-block":!0},d)}));function pd(e){return(0,d.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])}const md=(0,s.createContext)();function fd({__unstablePopoverSlot:e,__unstableContentRef:t}){const{selectBlock:n}=(0,m.useDispatch)(Wn),o=(0,s.useContext)(md),r=(0,s.useRef)(),{orientation:l,previousClientId:i,nextClientId:a,rootClientId:u,isInserterShown:f}=(0,m.useSelect)((e=>{var t;const{getBlockOrder:n,getBlockListSettings:o,getBlockInsertionPoint:r,isBlockBeingDragged:l,getPreviousBlockClientId:i,getNextBlockClientId:s}=e(Wn),a=r(),c=n(a.rootClientId);if(!c.length)return{};let u=c[a.index-1],d=c[a.index];for(;l(u);)u=i(u);for(;l(d);)d=s(d);return{previousClientId:u,nextClientId:d,orientation:(null===(t=o(a.rootClientId))||void 0===t?void 0:t.orientation)||"vertical",rootClientId:a.rootClientId,isInserterShown:null==a?void 0:a.__unstableWithInserter}}),[]),h=Sa(i),b=Sa(a),v="vertical"===l,k=(0,s.useMemo)((()=>{if(!h&&!b)return{};const e=h?h.getBoundingClientRect():null,t=b?b.getBoundingClientRect():null;if(v)return{width:h?h.offsetWidth:b.offsetWidth,height:t&&e?t.top-e.bottom:0};let n=0;return e&&t&&(n=(0,g.isRTL)()?e.left-t.right:t.left-e.right),{width:n,height:h?h.offsetHeight:b.offsetHeight}}),[h,b]),_=(0,s.useCallback)((()=>{if(!h&&!b)return{};const{ownerDocument:e}=h||b,t=h?h.getBoundingClientRect():null,n=b?b.getBoundingClientRect():null;return v?(0,g.isRTL)()?{top:t?t.bottom:n.top,left:t?t.right:n.right,right:t?t.left:n.left,bottom:n?n.top:t.bottom,ownerDocument:e}:{top:t?t.bottom:n.top,left:t?t.left:n.left,right:t?t.right:n.right,bottom:n?n.top:t.bottom,ownerDocument:e}:(0,g.isRTL)()?{top:t?t.top:n.top,left:t?t.left:n.right,right:n?n.right:t.left,bottom:t?t.bottom:n.bottom,ownerDocument:e}:{top:t?t.top:n.top,left:t?t.right:n.left,right:n?n.left:t.right,bottom:t?t.bottom:n.bottom,ownerDocument:e}}),[h,b]),y=pd(t),E=(0,d.useReducedMotion)(),C=c()("block-editor-block-list__insertion-point","is-"+l),S=h&&b&&f,w={start:{...v?{height:0,left:"50%",right:"50%",y:0}:{width:0,top:"50%",bottom:"50%",x:0},opacity:0},rest:{...v?{height:4,left:0,right:0,y:-2}:{width:4,top:0,bottom:0,x:-2},opacity:1,borderRadius:"2px",transition:{delay:S?.4:0}},hover:{...v?{height:4,left:0,right:0,y:-2}:{width:4,top:0,bottom:0,x:-2},opacity:1,borderRadius:"2px",transition:{delay:.4}}},B={start:{scale:E?1:0},rest:{scale:1,transition:{delay:.2}}};return(0,s.createElement)(p.Popover,{ref:y,noArrow:!0,animate:!1,getAnchorRect:_,focusOnMount:!1,className:"block-editor-block-list__insertion-point-popover",__unstableSlotName:e||null,key:a+"--"+u},(0,s.createElement)(p.__unstableMotion.div,{layout:!E,initial:E?"rest":"start",animate:"rest",whileHover:"hover",whileTap:"pressed",exit:"start",ref:r,tabIndex:-1,onClick:function(e){e.target===r.current&&a&&n(a,-1)},onFocus:function(e){e.target!==r.current&&(o.current=!0)},className:c()(C,{"is-with-inserter":S}),style:k},(0,s.createElement)(p.__unstableMotion.div,{variants:w,className:"block-editor-block-list__insertion-point-indicator"}),S&&(0,s.createElement)(p.__unstableMotion.div,{variants:B,className:c()("block-editor-block-list__insertion-point-inserter")},(0,s.createElement)(id,{position:"bottom center",clientId:a,rootClientId:u,__experimentalIsQuick:!0,onToggle:e=>{o.current=e},onSelectOrClose:()=>{o.current=!1}}))))}function gd({children:e,__unstablePopoverSlot:t,__unstableContentRef:n}){const o=(0,m.useSelect)((e=>e(Wn).isBlockInsertionPointVisible()),[]);return(0,s.createElement)(md.Provider,{value:(0,s.useRef)(!1)},o&&(0,s.createElement)(fd,{__unstablePopoverSlot:t,__unstableContentRef:n}),e)}function hd(){const e=(0,s.useContext)(md),t=(0,m.useSelect)((e=>e(Wn).getSettings().hasReducedUI),[]),{getBlockListSettings:n,getBlockRootClientId:o,getBlockIndex:r,isBlockInsertionPointVisible:l,isMultiSelecting:i,getSelectedBlockClientIds:a,getTemplateLock:c}=(0,m.useSelect)(Wn),{showInsertionPoint:u,hideInsertionPoint:p}=(0,m.useDispatch)(Wn);return(0,d.useRefEffect)((o=>{if(!t)return o.addEventListener("mousemove",s),()=>{o.removeEventListener("mousemove",s)};function s(t){var o,s;if(e.current)return;if(i())return;if(!t.target.classList.contains("block-editor-block-list__layout"))return void(l()&&p());let d;if(t.target.classList.contains("is-root-container")||(d=(t.target.getAttribute("data-block")?t.target:t.target.closest("[data-block]")).getAttribute("data-block")),c(d))return;const m=(null===(o=n(d))||void 0===o?void 0:o.orientation)||"vertical",f=t.target.getBoundingClientRect(),g=t.clientY-f.top,h=t.clientX-f.left;let b=Array.from(t.target.children).find((e=>e.classList.contains("wp-block")&&"vertical"===m&&e.offsetTop>g||e.classList.contains("wp-block")&&"horizontal"===m&&e.offsetLeft>h));if(!b)return;if(!b.id&&(b=b.firstElementChild,!b))return;if(null===(s=b.parentElement)||void 0===s?void 0:s.closest(".block-editor-block-content-overlay.overlay-active"))return;const v=b.id.slice("block-".length);if(!v)return;if(a().includes(v))return;const k=b.getBoundingClientRect();if("horizontal"===m&&(t.clientY>k.bottom||t.clientY<k.top)||"vertical"===m&&(t.clientX>k.right||t.clientX<k.left))return void(l()&&p());const _=r(v,d);0!==_?u(d,_,{__unstableWithInserter:!0}):l()&&p()}}),[e,n,o,r,l,i,u,p,a])}const bd="undefined"==typeof window?e=>{setTimeout((()=>e(Date.now())),0)}:window.requestIdleCallback||window.requestAnimationFrame,vd="undefined"==typeof window?clearTimeout:window.cancelIdleCallback||window.cancelAnimationFrame;function kd(e){return(0,m.useSelect)((t=>{if(!e)return null;const{getBlockName:n,getBlockAttributes:o}=t(Wn),{getBlockType:l,getActiveBlockVariation:i}=t(r.store),s=n(e),a=l(s);if(!a)return null;const c=o(e),u=i(s,c),d={title:a.title,icon:a.icon,description:a.description,anchor:null==c?void 0:c.anchor};return u?{title:u.title||a.title,icon:u.icon||a.icon,description:u.description||a.description}:d}),[e])}function _d({clientId:e}){const{attributes:t,name:n,reusableBlockTitle:o}=(0,m.useSelect)((t=>{if(!e)return{};const{getBlockName:n,getBlockAttributes:o,__experimentalGetReusableBlockTitle:l}=t(Wn),i=n(e);if(!i)return{};const s=(0,r.isReusableBlock)((0,r.getBlockType)(i));return{attributes:o(e),name:i,reusableBlockTitle:s&&l(o(e).ref)}}),[e]),l=kd(e);if(!n||!l)return null;const i=(0,r.getBlockType)(n),s=i?(0,r.__experimentalGetBlockLabel)(i,t):null,a=o||s;return a&&a!==i.title?(0,u.truncate)(a,{length:35}):l.title}var yd=({children:e,clientIds:t,cloneClassname:n,onDragStart:o,onDragEnd:l})=>{const{srcRootClientId:i,isDraggable:a,icon:c}=(0,m.useSelect)((e=>{var n;const{getBlockRootClientId:o,getTemplateLock:l,getBlockName:i}=e(Wn),s=o(t[0]),a=s?l(s):null,c=i(t[0]);return{srcRootClientId:s,isDraggable:"all"!==a,icon:null===(n=(0,r.getBlockType)(c))||void 0===n?void 0:n.icon}}),[t]),u=(0,s.useRef)(!1),[d,f,g]=function(){const e=(0,s.useRef)(null),t=(0,s.useRef)(null),n=(0,s.useRef)(null),o=(0,s.useRef)(null);return(0,s.useEffect)((()=>()=>{o.current&&(clearInterval(o.current),o.current=null)}),[]),[(0,s.useCallback)((r=>{e.current=r.clientY,n.current=(0,tr.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,s.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)/e;t.current=25*n}else if(o.clientY<l){const e=Math.max(l-50,0),n=Math.max(l-i-50,0)/e;t.current=-25*n}else t.current=0}),[]),()=>{e.current=null,n.current=null,o.current&&(clearInterval(o.current),o.current=null)}]}(),{startDraggingBlocks:h,stopDraggingBlocks:b}=(0,m.useDispatch)(Wn);if((0,s.useEffect)((()=>()=>{u.current&&b()}),[]),!a)return e({isDraggable:!1});const v={type:"block",srcClientIds:t,srcRootClientId:i};return(0,s.createElement)(p.Draggable,{cloneClassname:n,__experimentalTransferDataType:"wp-blocks",transferData:v,onDragStart:e=>{h(t),u.current=!0,d(e),o&&o()},onDragOver:f,onDragEnd:()=>{b(),u.current=!1,g(),l&&l()},__experimentalDragComponent:(0,s.createElement)(du,{count:t.length,icon:c})},(({onDraggableStart:t,onDraggableEnd:n})=>e({draggable:!0,onDragStart:t,onDragEnd:n})))},Ed=function({clientId:e,rootClientId:t,blockElement:n}){const o=kd(e),l=(0,m.useSelect)((n=>{var o;const{getBlock:r,getBlockIndex:l,hasBlockMovingClientId:i,getBlockListSettings:s}=n(Wn),a=l(e,t),{name:c,attributes:u}=r(e);return{index:a,name:c,attributes:u,blockMovingMode:i(),orientation:null===(o=s(t))||void 0===o?void 0:o.orientation}}),[e,t]),{index:a,name:u,attributes:d,blockMovingMode:f,orientation:h}=l,{setNavigationMode:b,removeBlock:v}=(0,m.useDispatch)(Wn),k=(0,s.useRef)(),_=(0,r.getBlockType)(u),y=(0,r.__experimentalGetAccessibleBlockLabel)(_,d,a+1,h);(0,s.useEffect)((()=>{k.current.focus(),(0,Rt.speak)(y)}),[y]);const{hasBlockMovingClientId:E,getBlockIndex:C,getBlockRootClientId:S,getClientIdsOfDescendants:w,getSelectedBlockClientId:B,getMultiSelectedBlocksEndClientId:I,getPreviousBlockClientId:x,getNextBlockClientId:T}=(0,m.useSelect)(Wn),{selectBlock:N,clearSelectedBlock:P,setBlockMovingClientId:R,moveBlockToPosition:M}=(0,m.useDispatch)(Wn),L=c()("block-editor-block-list__block-selection-button",{"is-block-moving-mode":!!f}),A=(0,g.__)("Drag");return(0,s.createElement)("div",{className:L},(0,s.createElement)(p.Flex,{justify:"center",className:"block-editor-block-list__block-selection-button__content"},(0,s.createElement)(p.FlexItem,null,(0,s.createElement)(za,{icon:null==o?void 0:o.icon,showColors:!0})),(0,s.createElement)(p.FlexItem,null,(0,s.createElement)(yd,{clientIds:[e]},(e=>(0,s.createElement)(p.Button,i({icon:uu,className:"block-selection-button_drag-handle","aria-hidden":"true",label:A,tabIndex:"-1"},e))))),(0,s.createElement)(p.FlexItem,null,(0,s.createElement)(p.Button,{ref:k,onClick:()=>b(!1),onKeyDown:function(t){const{keyCode:o}=t,r=o===fa.UP,l=o===fa.DOWN,i=o===fa.LEFT,s=o===fa.RIGHT,a=o===fa.TAB,c=o===fa.ESCAPE,u=o===fa.ENTER,d=o===fa.SPACE,p=t.shiftKey;if(o===fa.BACKSPACE||o===fa.DELETE)return v(e),void t.preventDefault();const m=B(),f=I(),g=x(f||m),h=T(f||m),b=a&&p||r,k=a&&!p||l,_=i,y=s;let L;if(b)L=g;else if(k)L=h;else if(_){var A;L=null!==(A=S(m))&&void 0!==A?A:m}else if(y){var D;L=null!==(D=w([m])[0])&&void 0!==D?D:m}const O=E();if(c&&O&&!t.defaultPrevented&&(R(null),t.preventDefault()),(u||d)&&O){const e=S(O),t=S(m),n=C(O,e);let o=C(m,t);n<o&&e===t&&(o-=1),M(O,e,t,o),N(O),R(null)}if(k||b||_||y)if(L)t.preventDefault(),N(L);else if(a&&m){let e;k?(e=tr.focus.tabbable.findNext(n),e||(e=n.ownerDocument.defaultView.frameElement,e=tr.focus.tabbable.findNext(e))):e=tr.focus.tabbable.findPrevious(n),e&&(t.preventDefault(),e.focus(),P())}},label:y,className:"block-selection-button_select-button"},(0,s.createElement)(_d,{clientId:e})))))};function Cd(e){return Array.from(e.querySelectorAll("[data-toolbar-item]"))}var Sd=function({children:e,focusOnMount:t,__experimentalInitialIndex:n,__experimentalOnIndexChange:o,...r}){const l=(0,s.useRef)(),a=function(e){const[t,n]=(0,s.useState)(!0),o=(0,s.useCallback)((()=>{const t=!tr.focus.tabbable.find(e.current).some((e=>!("toolbarItem"in e.dataset)));t||At()("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)}),[]);return(0,s.useLayoutEffect)((()=>{const t=new window.MutationObserver(o);return t.observe(e.current,{childList:!0,subtree:!0}),()=>t.disconnect()}),[t]),t}(l);return function(e,t,n,o,r){const[l]=(0,s.useState)(t),[i]=(0,s.useState)(o),a=(0,s.useCallback)((()=>{!function(e){const[t]=tr.focus.tabbable.find(e);t&&t.focus()}(e.current)}),[]);(0,Qa.useShortcut)("core/block-editor/focus-toolbar",a),(0,s.useEffect)((()=>{l&&a()}),[n,l,a]),(0,s.useEffect)((()=>{let t=0;return i&&!l&&(t=window.requestAnimationFrame((()=>{const t=Cd(e.current),n=i||0;var o;t[n]&&(o=e.current).contains(o.ownerDocument.activeElement)&&t[n].focus()}))),()=>{if(window.cancelAnimationFrame(t),!r||!e.current)return;const n=Cd(e.current).findIndex((e=>0===e.tabIndex));r(n)}}),[i,l])}(l,t,a,n,o),a?(0,s.createElement)(p.Toolbar,i({label:r["aria-label"],ref:l},r),e):(0,s.createElement)(p.NavigableMenu,i({orientation:"horizontal",role:"toolbar",ref:l},r),e)},wd=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})),Bd=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})),Id=(0,s.createElement)(F.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(F.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),xd=(0,s.createElement)(F.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(F.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));const Td=(e,t)=>"up"===e?"horizontal"===t?(0,g.isRTL)()?wd:Bd:Id:"down"===e?"horizontal"===t?(0,g.isRTL)()?Bd:wd:xd:null,Nd=(e,t)=>"up"===e?"horizontal"===t?(0,g.isRTL)()?(0,g.__)("Move right"):(0,g.__)("Move left"):(0,g.__)("Move up"):"down"===e?"horizontal"===t?(0,g.isRTL)()?(0,g.__)("Move left"):(0,g.__)("Move right"):(0,g.__)("Move down"):null,Pd=(0,s.forwardRef)((({clientIds:e,direction:t,orientation:n,...o},l)=>{const a=(0,d.useInstanceId)(Pd),f=(0,u.castArray)(e).length,{blockType:h,isDisabled:b,rootClientId:v,isFirst:k,isLast:_,firstIndex:y,orientation:E="vertical"}=(0,m.useSelect)((o=>{const{getBlockIndex:l,getBlockRootClientId:i,getBlockOrder:s,getBlock:a,getBlockListSettings:c}=o(Wn),d=(0,u.castArray)(e),p=(0,u.first)(d),m=i(p),f=l(p,m),g=l((0,u.last)(d),m),h=s(m),b=a(p),v=0===f,k=g===h.length-1,{orientation:_}=c(m)||{};return{blockType:b?(0,r.getBlockType)(b.name):null,isDisabled:"up"===t?v:k,rootClientId:m,firstIndex:f,isFirst:v,isLast:k,orientation:n||_}}),[e,t]),{moveBlocksDown:C,moveBlocksUp:S}=(0,m.useDispatch)(Wn),w="up"===t?S:C,B=`block-editor-block-mover-button__description-${a}`;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.Button,i({ref:l,className:c()("block-editor-block-mover-button",`is-${t}-button`),icon:Td(t,E),label:Nd(t,E),"aria-describedby":B},o,{onClick:b?null:t=>{w(e,v),o.onClick&&o.onClick(t)},"aria-disabled":b})),(0,s.createElement)("span",{id:B,className:"block-editor-block-mover-button__description"},function(e,t,n,o,r,l,i){const s=n+1,a=e=>"up"===e?"horizontal"===i?(0,g.isRTL)()?"right":"left":"up":"down"===e?"horizontal"===i?(0,g.isRTL)()?"left":"right":"down":null;if(e>1)return function(e,t,n,o,r){const l=t+1;return r<0&&n?(0,g.__)("Blocks cannot be moved up as they are already at the top"):r>0&&o?(0,g.__)("Blocks cannot be moved down as they are already at the bottom"):r<0&&!n?(0,g.sprintf)(// translators: 1: Number of selected blocks, 2: Position of selected blocks
|
| 27 |
-
(0,
|
| 28 |
-
(0,
|
| 29 |
-
(0,
|
| 30 |
-
(0,
|
| 31 |
-
(0,
|
| 32 |
-
(0,
|
| 33 |
-
(0,
|
| 34 |
-
(0,
|
| 35 |
-
(0,
|
| 36 |
-
(0,
|
| 37 |
-
(0,
|
| 38 |
-
(0,
|
| 39 |
-
(0,
|
| 40 |
-
(0,
|
| 41 |
-
(0,
|
| 42 |
/* translators: %s: Name of the block's parent. */
|
| 43 |
-
(0,
|
| 44 |
/* translators: %s: block title. */
|
| 45 |
-
(0,
|
| 46 |
/* translators: %d: number of blocks. */
|
| 47 |
-
(0,
|
| 48 |
-
(0,
|
| 49 |
-
(0,
|
| 50 |
-
(0,
|
| 51 |
-
(0,g._n)("Moved %d block to clipboard.","Moved %d blocks to clipboard.",r.length),r.length);n(l,{type:"snackbar"})}),[])}function ip(){const{getBlocksByClientId:e,getSelectedBlockClientIds:t,hasMultiSelection:n,getSettings:o}=(0,m.useSelect)(Wn),{flashBlock:l,removeBlocks:i,replaceBlocks:s}=(0,m.useDispatch)(Wn),a=lp();return(0,d.useRefEffect)((c=>{function u(u){const d=t();if(0===d.length)return;if(!n()){const{target:e}=u,{ownerDocument:t}=e;if("copy"===u.type||"cut"===u.type?(0,tr.documentHasUncollapsedSelection)(t):(0,tr.documentHasSelection)(t))return}if(!c.contains(u.target.ownerDocument.activeElement))return;const p=u.defaultPrevented;if(u.preventDefault(),"copy"===u.type||"cut"===u.type){1===d.length&&l(d[0]),a(u.type,d);const t=e(d),n=(0,r.serialize)(t);u.clipboardData.setData("text/plain",n),u.clipboardData.setData("text/html",n)}if("cut"===u.type)i(d);else if("paste"===u.type){if(p)return;const{__experimentalCanUserUseUnfilteredHTML:e}=o(),{plainText:t,html:n}=function({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}}const o=(0,tr.getFilesFromDataTransfer)(e).filter((({type:e})=>/^image\/(?:jpe?g|png|gif)$/.test(e)));return o.length&&!n&&(n=o.map((e=>`<img src="${(0,rp.createBlobURL)(e)}">`)).join(""),t=""),{html:n,plainText:t}}(u),l=(0,r.pasteHandler)({HTML:n,plainText:t,mode:"BLOCKS",canUserUseUnfilteredHTML:e});s(d,l,l.length-1,-1)}}return c.ownerDocument.addEventListener("copy",u),c.ownerDocument.addEventListener("cut",u),c.ownerDocument.addEventListener("paste",u),()=>{c.ownerDocument.removeEventListener("copy",u),c.ownerDocument.removeEventListener("cut",u),c.ownerDocument.removeEventListener("paste",u)}}),[])}var sp=function({children:e}){return(0,s.createElement)("div",{ref:ip()},e)};function ap({clientIds:e,children:t,__experimentalUpdateSelection:n}){const{canInsertBlockType:o,getBlockRootClientId:l,getBlocksByClientId:i,canMoveBlocks:s,canRemoveBlocks:a}=(0,m.useSelect)(Wn),{getDefaultBlockName:c,getGroupingBlockName:d}=(0,m.useSelect)(r.store),p=i(e),f=l(e[0]),g=(0,u.every)(p,(e=>!!e&&(0,r.hasBlockSupport)(e.name,"multiple",!0)&&o(e.name,f))),h=o(c(),f),b=s(e,f),v=a(e,f),{removeBlocks:k,replaceBlocks:_,duplicateBlocks:y,insertAfterBlock:E,insertBeforeBlock:C,flashBlock:S,setBlockMovingClientId:w,setNavigationMode:B,selectBlock:I}=(0,m.useDispatch)(Wn),x=lp();return t({canDuplicate:g,canInsertDefaultBlock:h,canMove:b,canRemove:v,rootClientId:f,blocks:p,onDuplicate:()=>y(e,n),onRemove:()=>k(e,n),onInsertBefore(){C((0,u.first)((0,u.castArray)(e)))},onInsertAfter(){E((0,u.last)((0,u.castArray)(e)))},onMoveTo(){B(!0),I(e[0]),w(e[0])},onGroup(){if(!p.length)return;const t=d(),n=(0,r.switchToBlockType)(p,t);n&&_(e,n)},onUngroup(){if(!p.length)return;const t=p[0].innerBlocks;t.length&&_(e,t)},onCopy(){const e=p.map((({clientId:e})=>e));1===p.length&&S(e[0]),x("copy",e)}})}var cp=(0,d.compose)([(0,m.withSelect)(((e,{clientId:t})=>{const{getBlock:n,getBlockMode:o,getSettings:l}=e(Wn),i=n(t),s=l().codeEditingEnabled;return{mode:o(t),blockType:i?(0,r.getBlockType)(i.name):null,isCodeEditingEnabled:s}})),(0,m.withDispatch)(((e,{onToggle:t=u.noop,clientId:n})=>({onToggleMode(){e(Wn).toggleBlockMode(n),t()}})))])((function({blockType:e,mode:t,onToggleMode:n,small:o=!1,isCodeEditingEnabled:l=!0}){if(!(0,r.hasBlockSupport)(e,"html",!0)||!l)return null;const i="visual"===t?(0,g.__)("Edit as HTML"):(0,g.__)("Edit visually");return(0,s.createElement)(p.MenuItem,{onClick:n},!o&&i)})),up=(0,d.compose)((0,m.withSelect)(((e,{clientId:t})=>{const n=e(Wn).getBlock(t);return{block:n,shouldRender:n&&"core/html"===n.name}})),(0,m.withDispatch)(((e,{block:t})=>({onClick:()=>e(Wn).replaceBlocks(t.clientId,(0,r.rawHandler)({HTML:(0,r.getBlockContent)(t)}))}))))((function({shouldRender:e,onClick:t,small:n}){if(!e)return null;const o=(0,g.__)("Convert to Blocks");return(0,s.createElement)(p.MenuItem,{onClick:t},!n&&o)}));const{Fill:dp,Slot:pp}=(0,p.createSlotFill)("__unstableBlockSettingsMenuFirstItem");dp.Slot=pp;var mp=dp;function fp({clientIds:e,isGroupable:t,isUngroupable:n,blocksSelection:o,groupingBlockName:l,onClose:i=(()=>{})}){const{replaceBlocks:a}=(0,m.useDispatch)(Wn);return t||n?(0,s.createElement)(s.Fragment,null,t&&(0,s.createElement)(p.MenuItem,{onClick:()=>{(()=>{const t=(0,r.switchToBlockType)(o,l);t&&a(e,t)})(),i()}},(0,g._x)("Group","verb")),n&&(0,s.createElement)(p.MenuItem,{onClick:()=>{(()=>{const t=o[0].innerBlocks;t.length&&a(e,t)})(),i()}},(0,g._x)("Ungroup","Ungrouping blocks from within a Group block back into individual blocks within the Editor "))):null}const{Fill:gp,Slot:hp}=(0,p.createSlotFill)("BlockSettingsMenuControls");function bp({...e}){return(0,s.createElement)(p.__experimentalStyleProvider,{document:document},(0,s.createElement)(gp,e))}bp.Slot=({fillProps:e,clientIds:t=null})=>{const{selectedBlocks:n,selectedClientIds:o}=(0,m.useSelect)((e=>{const{getBlocksByClientId:n,getSelectedBlockClientIds:o}=e(Wn),r=null!==t?t:o();return{selectedBlocks:(0,u.map)((0,u.compact)(n(r)),(e=>e.name)),selectedClientIds:r}}),[t]),l=function(){const{clientIds:e,isGroupable:t,isUngroupable:n,blocksSelection:o,groupingBlockName:l}=(0,m.useSelect)((e=>{var t;const{getBlockRootClientId:n,getBlocksByClientId:o,canInsertBlockType:l,getSelectedBlockClientIds:i}=e(Wn),{getGroupingBlockName:s}=e(r.store),a=i(),c=s(),u=l(c,null!=a&&a.length?n(a[0]):void 0),d=o(a),p=1===d.length&&(null===(t=d[0])||void 0===t?void 0:t.name)===c;return{clientIds:a,isGroupable:u&&d.length&&!p,isUngroupable:p&&!!d[0].innerBlocks.length,blocksSelection:d,groupingBlockName:c}}),[]);return{clientIds:e,isGroupable:t,isUngroupable:n,blocksSelection:o,groupingBlockName:l}}(),{isGroupable:a,isUngroupable:c}=l,d=a||c;return(0,s.createElement)(hp,{fillProps:{...e,selectedBlocks:n,selectedClientIds:o}},(t=>{if((null==t?void 0:t.length)>0||d)return(0,s.createElement)(p.MenuGroup,null,t,(0,s.createElement)(fp,i({},l,{onClose:null==e?void 0:e.onClose})))}))};var vp=bp;const kp={className:"block-editor-block-settings-menu__popover",position:"bottom right",isAlternate:!0};function _p({blocks:e,onCopy:t}){const n=(0,d.useCopyToClipboard)((()=>(0,r.serialize)(e)),t);return(0,s.createElement)(p.MenuItem,{ref:n},(0,g.__)("Copy"))}var yp=function({clientIds:e,__experimentalSelectBlock:t,children:n,...o}){const r=(0,u.castArray)(e),l=r.length,a=r[0],c=(0,m.useSelect)((e=>1===e(Wn).getBlockCount()),[]),d=(0,m.useSelect)((e=>{const{getShortcutRepresentation:t}=e(Qa.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")}}),[]),f=(0,s.useCallback)(t?async e=>{const n=await e;n&&n[0]&&t(n[0])}:u.noop,[t]),h=1===l?(0,g.__)("Remove block"):(0,g.__)("Remove blocks");return(0,s.createElement)(ap,{clientIds:e,__experimentalUpdateSelection:!t},(({canDuplicate:t,canInsertDefaultBlock:r,canMove:m,canRemove:b,onDuplicate:v,onInsertAfter:k,onInsertBefore:_,onRemove:y,onCopy:E,onMoveTo:C,blocks:S})=>(0,s.createElement)(p.DropdownMenu,i({icon:op,label:(0,g.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:kp,noIcons:!0},o),(({onClose:o})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.MenuGroup,null,(0,s.createElement)(mp.Slot,{fillProps:{onClose:o}}),1===l&&(0,s.createElement)(up,{clientId:a}),(0,s.createElement)(_p,{blocks:S,onCopy:E}),t&&(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,v,f),shortcut:d.duplicate},(0,g.__)("Duplicate")),r&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,_),shortcut:d.insertBefore},(0,g.__)("Insert before")),(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,k),shortcut:d.insertAfter},(0,g.__)("Insert after"))),m&&!c&&(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,C)},(0,g.__)("Move to")),1===l&&(0,s.createElement)(cp,{clientId:a,onToggle:o})),(0,s.createElement)(vp.Slot,{fillProps:{onClose:o},clientIds:e}),"function"==typeof n?n({onClose:o}):s.Children.map((e=>(0,s.cloneElement)(e,{onClose:o}))),b&&(0,s.createElement)(p.MenuGroup,null,(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,y,f),shortcut:d.remove},h)))))))},Ep=function({clientIds:e,...t}){return(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(p.ToolbarItem,null,(n=>(0,s.createElement)(yp,i({clientIds:e,toggleProps:n},t)))))};function Cp({hideDragHandle:e}){const{blockClientIds:t,blockClientId:n,blockType:o,hasFixedToolbar:l,hasReducedUI:a,isValid:u,isVisual:f}=(0,m.useSelect)((e=>{const{getBlockName:t,getBlockMode:n,getSelectedBlockClientIds:o,isBlockValid:l,getBlockRootClientId:i,getSettings:s}=e(Wn),a=o(),c=a[0],u=i(c),d=s();return{blockClientIds:a,blockClientId:c,blockType:c&&(0,r.getBlockType)(t(c)),hasFixedToolbar:d.hasFixedToolbar,hasReducedUI:d.hasReducedUI,rootClientId:u,isValid:a.every((e=>l(e))),isVisual:a.every((e=>"visual"===n(e)))}}),[]),{toggleBlockHighlight:g}=(0,m.useDispatch)(Wn),h=(0,s.useRef)(),{showMovers:b,gestures:v}=Fd({ref:h,onChange(e){e&&a||g(n,e)}}),k=(0,d.useViewportMatch)("medium","<")||l;if(o&&!(0,r.hasBlockSupport)(o,"__experimentalToolbar",!0))return null;const _=k||b;if(0===t.length)return null;const y=u&&f,E=t.length>1,C=c()("block-editor-block-toolbar",_&&"is-showing-movers");return(0,s.createElement)("div",{className:C},!E&&!k&&(0,s.createElement)(zd,{clientIds:t}),(0,s.createElement)("div",i({ref:h},v),(y||E)&&(0,s.createElement)(p.ToolbarGroup,{className:"block-editor-block-toolbar__block-controls"},(0,s.createElement)(np,{clientIds:t}),(0,s.createElement)(Ld,{clientIds:t,hideDragHandle:e||a}))),y&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(eo.Slot,{group:"parent",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(eo.Slot,{group:"block",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(eo.Slot,{className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(eo.Slot,{group:"inline",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(eo.Slot,{group:"other",className:"block-editor-block-toolbar__slot"})),(0,s.createElement)(Ep,{clientIds:t}))}var Sp=function({focusOnMount:e,isFixed:t,...n}){const{blockType:o,hasParents:l,showParentSelector:a}=(0,m.useSelect)((e=>{const{getBlockName:t,getBlockParents:n,getSelectedBlockClientIds:o}=e(Wn),{getBlockType:l}=e(r.store),i=o(),s=i[0],a=n(s),c=l(t(a[a.length-1]));return{blockType:s&&l(t(s)),hasParents:a.length,showParentSelector:(0,r.hasBlockSupport)(c,"__experimentalParentSelector",!0)&&i.length<=1}}),[]);if(o&&!(0,r.hasBlockSupport)(o,"__experimentalToolbar",!0))return null;const u=c()("block-editor-block-contextual-toolbar",{"has-parent":l&&a,"is-fixed":t});return(0,s.createElement)(Sd,i({focusOnMount:e,className:u
|
| 52 |
-
/* translators: accessibility text for the block toolbar */,"aria-label":(0,g.__)("Block tools")},n),(0,s.createElement)(Cp,{hideDragHandle:t}))};function wp(e){const{isNavigationMode:t,isMultiSelecting:n,hasMultiSelection:o,isTyping:r,isCaretWithinFormattedText:l,getSettings:i,getLastMultiSelectedBlockClientId:s}=e(Wn);return{isNavigationMode:t(),isMultiSelecting:n(),isTyping:r(),isCaretWithinFormattedText:l(),hasMultiSelection:o(),hasFixedToolbar:i().hasFixedToolbar,lastClientId:s()}}function Bp({clientId:e,rootClientId:t,isValid:n,isEmptyDefaultBlock:o,capturingClientId:r,__unstablePopoverSlot:l,__unstableContentRef:i}){const{isNavigationMode:a,isMultiSelecting:u,isTyping:f,isCaretWithinFormattedText:g,hasMultiSelection:h,hasFixedToolbar:b,lastClientId:v}=(0,m.useSelect)(wp,[]),k=(0,m.useSelect)((t=>{const{isBlockInsertionPointVisible:n,getBlockInsertionPoint:o,getBlockOrder:r}=t(Wn);if(!n())return!1;const l=o();return r(l.rootClientId)[l.index]===e}),[e]),_=(0,d.useViewportMatch)("medium"),[y,E]=(0,s.useState)(!1),[C,S]=(0,s.useState)(!1),{stopTyping:w}=(0,m.useDispatch)(Wn),B=!f&&!a&&o&&n,I=a,x=!a&&!b&&_&&!B&&!u&&(!f||g),T=!(a||x||b||o);(0,Qa.useShortcut)("core/block-editor/focus-toolbar",(()=>{E(!0),w(!0)}),{isDisabled:!T}),(0,s.useEffect)((()=>{x||E(!1)}),[x]);const N=(0,s.useRef)(),P=Sa(e),R=Sa(v),M=Sa(r),L=pd(i);if(!(I||x||y||B))return null;let A=P;if(!A)return null;r&&(A=M);let D=A;if(h){if(!R)return null;D={top:A,bottom:R}}const O=B?"top left right":"top right left",{ownerDocument:F}=A,z=B?void 0:F.defaultView.frameElement||(0,tr.getScrollContainer)(A)||F.body;return(0,s.createElement)(p.Popover,{ref:L,noArrow:!0,animate:!1,position:O,focusOnMount:!1,anchorRef:D,className:c()("block-editor-block-list__block-popover",{"is-insertion-point-visible":k}),__unstableStickyBoundaryElement:z,__unstableSlotName:l||null,__unstableBoundaryParent:!0,__unstableObserveElement:A,shouldAnchorIncludePadding:!0,__unstableEditorCanvasWrapper:null==i?void 0:i.current},(x||y)&&(0,s.createElement)("div",{onFocus:function(){S(!0)},onBlur:function(){S(!1)},tabIndex:-1,className:c()("block-editor-block-list__block-popover-inserter",{"is-visible":C})},(0,s.createElement)(id,{clientId:e,rootClientId:t,__experimentalIsQuick:!0})),(x||y)&&(0,s.createElement)(Sp,{focusOnMount:y,__experimentalInitialIndex:N.current,__experimentalOnIndexChange:e=>{N.current=e},key:e}),I&&(0,s.createElement)(Ed,{clientId:e,rootClientId:t,blockElement:A}),B&&(0,s.createElement)("div",{className:"block-editor-block-list__empty-block-inserter"},(0,s.createElement)(id,{position:"bottom right",rootClientId:t,clientId:e,__experimentalIsQuick:!0})))}function Ip(e){const{getSelectedBlockClientId:t,getFirstMultiSelectedBlockClientId:n,getBlockRootClientId:o,getBlock:l,getBlockParents:i,__experimentalGetBlockListSettingsForBlocks:s}=e(Wn),a=t()||n();if(!a)return;const{name:c,attributes:d={},isValid:p}=l(a)||{},m=i(a),f=s(m),g=(0,u.find)(m,(e=>{var t;return null===(t=f[e])||void 0===t?void 0:t.__experimentalCaptureToolbars}));return{clientId:a,rootClientId:o(a),name:c,isValid:p,isEmptyDefaultBlock:c&&(0,r.isUnmodifiedDefaultBlock)({name:c,attributes:d}),capturingClientId:g}}function xp({__unstablePopoverSlot:e,__unstableContentRef:t}){const n=(0,m.useSelect)(Ip,[]);if(!n)return null;const{clientId:o,rootClientId:r,name:l,isValid:i,isEmptyDefaultBlock:a,capturingClientId:c}=n;return l?(0,s.createElement)(Bp,{clientId:o,rootClientId:r,isValid:i,isEmptyDefaultBlock:a,capturingClientId:c,__unstablePopoverSlot:e,__unstableContentRef:t}):null}function Tp({children:e}){const t=(0,s.useContext)(md),n=(0,s.useContext)(p.Disabled.Context);return t||n?e:(At()('wp.components.Popover.Slot name="block-toolbar"',{alternative:"wp.blockEditor.BlockTools"}),(0,s.createElement)(gd,{__unstablePopoverSlot:"block-toolbar"},(0,s.createElement)(xp,{__unstablePopoverSlot:"block-toolbar"}),e))}var Np=(0,d.createHigherOrderComponent)((e=>t=>{const{clientId:n}=qn();return(0,s.createElement)(e,i({},t,{clientId:n}))}),"withClientId"),Pp=Np((({clientId:e,showSeparator:t,isFloating:n,onAddBlock:o,isToggle:r})=>(0,s.createElement)(ud,{className:c()({"block-list-appender__toggle":r}),rootClientId:e,showSeparator:t,isFloating:n,onAddBlock:o}))),Rp=(0,d.compose)([Np,(0,m.withSelect)(((e,{clientId:t})=>{const{getBlockOrder:n}=e(Wn),o=n(t);return{lastBlockClientId:(0,u.last)(o)}}))])((({clientId:e,lastBlockClientId:t})=>(0,s.createElement)(sd,{rootClientId:e,lastBlockClientId:t}))),Mp=window.wp.isShallowEqual,Lp=n.n(Mp);const Ap=new WeakMap;function Dp(e,t){const n=(0,m.useSelect)((e=>e(Wn).getSettings().mediaUpload),[]),{canInsertBlockType:o,getBlockIndex:l,getClientIdsOfDescendants:i}=(0,m.useSelect)(Wn),{insertBlocks:s,moveBlocksToPosition:a,updateBlockAttributes:c,clearSelectedBlock:u}=(0,m.useDispatch)(Wn),d=function(e,t,n,o,l,i,s){return a=>{const{srcRootClientId:c,srcClientIds:u,type:d,blocks:p}=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}(a);if("inserter"===d){s();const n=p.map((e=>(0,r.cloneBlock)(e)));i(n,t,e,!0,null)}if("block"===d){const r=n(u[0],c);if(c===e&&r===t)return;if(u.includes(e)||o(u).some((t=>t===e)))return;const i=c===e,s=u.length;l(u,c,e,i&&r<t?t-s:t)}}}(e,t,l,i,a,s,u),p=function(e,t,n,o,l,i){return s=>{if(!n)return;const a=(0,r.findTransform)((0,r.getBlockTransforms)("from"),(t=>"files"===t.type&&l(t.blockName,e)&&t.isMatch(s)));if(a){const n=a.transform(s,o);i(n,t,e)}}}(e,t,n,c,o,s),f=function(e,t,n){return o=>{const l=(0,r.pasteHandler)({HTML:o,mode:"BLOCKS"});l.length&&n(l,t,e)}}(e,t,s);return e=>{const t=(0,tr.getFilesFromDataTransfer)(e.dataTransfer),n=e.dataTransfer.getData("text/html");t.length?p(t):n?f(n):d(e)}}function Op(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 Fp({rootClientId:e=""}={}){const[t,n]=(0,s.useState)(null),o=(0,m.useSelect)((t=>{const{getTemplateLock:n}=t(Wn);return"all"===n(e)}),[e]),{getBlockListSettings:r}=(0,m.useSelect)(Wn),{showInsertionPoint:l,hideInsertionPoint:i}=(0,m.useDispatch)(Wn),a=Dp(e,t),c=(0,d.useThrottle)((0,s.useCallback)(((t,o)=>{var i;const s=function(e,t,n){const o="horizontal"===n?["left","right"]:["top","bottom"],r=(0,g.isRTL)();let l,i;return e.forEach(((e,n)=>{const s=e.getBoundingClientRect(),[a,c]=Op(t,s,o);(void 0===i||a<i)&&(i=a,l=n+("bottom"===c||!r&&"right"===c||r&&"left"===c?1:0))})),l}(Array.from(o.children).filter((e=>e.classList.contains("wp-block"))),{x:t.clientX,y:t.clientY},null===(i=r(e))||void 0===i?void 0:i.orientation);n(void 0===s?0:s),null!==s&&l(e,s)}),[]),200);return(0,d.__experimentalUseDropZone)({isDisabled:o,onDrop:a,onDragOver(e){c(e,e.currentTarget)},onDragLeave(){c.cancel(),i(),n(null)},onDragEnd(){c.cancel(),i(),n(null)}})}function zp(e){const{clientId:t,allowedBlocks:n,__experimentalDefaultBlock:o,__experimentalDirectInsert:l,template:i,templateLock:a,wrapperRef:c,templateInsertUpdatesSelection:d,__experimentalCaptureToolbars:p,__experimentalAppenderTagName:f,renderAppender:g,orientation:h,placeholder:b,__experimentalLayout:v}=e;!function(e,t,n,o,r,l,i,a){const{updateBlockListSettings:c}=(0,m.useDispatch)(Wn),{blockListSettings:u,parentLock:d}=(0,m.useSelect)((t=>{const n=t(Wn).getBlockRootClientId(e);return{blockListSettings:t(Wn).getBlockListSettings(e),parentLock:t(Wn).getTemplateLock(n)}}),[e]),p=(0,s.useMemo)((()=>t),t);(0,s.useLayoutEffect)((()=>{const t={allowedBlocks:p,templateLock:void 0===r?d:r};if(void 0!==l&&(t.__experimentalCaptureToolbars=l),void 0!==i)t.orientation=i;else{const e=wo(null==a?void 0:a.type);t.orientation=e.getOrientation(a)}void 0!==n&&(t.__experimentalDefaultBlock=n),void 0!==o&&(t.__experimentalDirectInsert=o),Lp()(u,t)||c(e,t)}),[e,u,p,n,o,r,d,l,i,c,a])}(t,n,o,l,a,p,h,v),function(e,t,n,o){const{getSelectedBlocksInitialCaretPosition:l}=(0,m.useSelect)(Wn),{replaceInnerBlocks:i}=(0,m.useDispatch)(Wn),a=(0,m.useSelect)((t=>t(Wn).getBlocks(e)),[e]),c=(0,s.useRef)(null);(0,s.useLayoutEffect)((()=>{if((0===a.length||"all"===n)&&!(0,u.isEqual)(t,c.current)){c.current=t;const n=(0,r.synchronizeBlocksWithTemplate)(a,t);(0,u.isEqual)(n,a)||i(e,n,0===a.length&&o&&0!==n.length,l())}}),[a,t,n,e])}(t,i,a,d);const k=(0,m.useSelect)((e=>{const n=e(Wn).getBlock(t),o=(0,r.getBlockType)(n.name);if(o&&o.providesContext)return function(e,t){Ap.has(t)||Ap.set(t,new WeakMap);const n=Ap.get(t);if(!n.has(e)){const o=(0,u.mapValues)(t.providesContext,(t=>e[t]));n.set(e,o)}return n.get(e)}(n.attributes,o)}),[t]);return(0,s.createElement)(or,{value:k},(0,s.createElement)(Yp,{rootClientId:t,renderAppender:g,__experimentalAppenderTagName:f,__experimentalLayout:v,wrapperRef:c,placeholder:b}))}function Vp(e){return Ha(e),(0,s.createElement)(zp,e)}const Hp=(0,s.forwardRef)(((e,t)=>{const n=Up({ref:t},e);return(0,s.createElement)("div",{className:"block-editor-inner-blocks"},(0,s.createElement)("div",n))}));function Up(e={},t={}){const{clientId:n}=qn(),o=(0,d.useViewportMatch)("medium","<"),{__experimentalCaptureToolbars:l,hasOverlay:a}=(0,m.useSelect)((e=>{if(!n)return{};const{getBlockName:t,isBlockSelected:l,hasSelectedInnerBlock:i,isNavigationMode:s}=e(Wn),a=t(n),c=s()||o;return{__experimentalCaptureToolbars:e(r.store).hasBlockSupport(a,"__experimentalExposeControlsToChildren",!1),hasOverlay:"core/template"!==a&&!l(n)&&!i(n,!0)&&c}}),[n,o]),u=(0,d.useMergeRefs)([e.ref,Fp({rootClientId:n})]),p={__experimentalCaptureToolbars:l,...t},f=p.value&&p.onChange?Vp:zp;return{...e,ref:u,className:c()(e.className,"block-editor-block-list__layout",{"has-overlay":a}),children:n?(0,s.createElement)(f,i({},p,{clientId:n})):(0,s.createElement)(Yp,t)}}Hp.DefaultBlockAppender=Rp,Hp.ButtonBlockAppender=Pp,Hp.Content=(0,r.withBlockContentContext)((({BlockContent:e})=>(0,s.createElement)(e,null)));var Gp=Hp;const Wp=(0,s.createContext)(),$p=(0,s.createContext)();function jp({className:e,...t}){const[n,o]=(0,s.useState)(),r=(0,d.useViewportMatch)("medium"),{isOutlineMode:l,isFocusMode:i,isNavigationMode:a}=(0,m.useSelect)((e=>{const{getSettings:t,isNavigationMode:n}=e(Wn),{outlineMode:o,focusMode:r}=t();return{isOutlineMode:o,isFocusMode:r,isNavigationMode:n()}}),[]),u=Up({ref:(0,d.useMergeRefs)([Wa(),hd(),o]),className:c()("is-root-container",e,{"is-outline-mode":l,"is-focus-mode":i&&r,"is-navigate-mode":a})},t);return(0,s.createElement)(Wp.Provider,{value:n},(0,s.createElement)("div",u))}function Kp(e){return function(){const e=(0,m.useSelect)((e=>e(Wn).getSettings().__experimentalBlockPatterns),[]);(0,s.useEffect)((()=>{if(null==e||!e.length)return;let t,n=-1;const o=()=>{n++,n>=e.length||((0,m.select)(Wn).__experimentalGetParsedPattern(e[n].name),t=bd(o))};return t=bd(o),()=>vd(t)}),[e])}(),(0,s.createElement)(Tp,null,(0,s.createElement)(Kn,{value:$n},(0,s.createElement)(jp,e)))}function qp({placeholder:e,rootClientId:t,renderAppender:n,__experimentalAppenderTagName:o,__experimentalLayout:r=Bo}){const[l,i]=(0,s.useState)(new Set),a=(0,s.useMemo)((()=>{const{IntersectionObserver:e}=window;if(e)return new e((e=>{i((t=>{const n=new Set(t);for(const t of e){const e=t.target.getAttribute("data-block");n[t.isIntersecting?"add":"delete"](e)}return n}))}))}),[i]),{order:c,selectedBlocks:u}=(0,m.useSelect)((e=>{const{getBlockOrder:n,getSelectedBlockClientIds:o}=e(Wn);return{order:n(t),selectedBlocks:o()}}),[t]);return(0,s.createElement)(xo,{value:r},(0,s.createElement)($p.Provider,{value:a},c.map((e=>(0,s.createElement)(m.AsyncModeProvider,{key:e,value:!l.has(e)&&!u.includes(e)},(0,s.createElement)(Ma,{rootClientId:t,clientId:e}))))),c.length<1&&e,(0,s.createElement)(dd,{tagName:o,rootClientId:t,renderAppender:n}))}function Yp(e){return(0,s.createElement)(m.AsyncModeProvider,{value:!1},(0,s.createElement)(qp,e))}Kp.__unstableElementContext=Wp,Rc([Mc,Dc]);const Zp=(e,t,n)=>{if(t){const n=(0,u.find)(e,{slug:t});if(n)return n}return{color:n}},Xp=(e,t)=>(0,u.find)(e,{color:t});function Qp(e,t){if(e&&t)return`has-${(0,u.kebabCase)(t)}-${e}`}const Jp=[];function em(e){if(e)return`has-${e}-gradient-background`}function tm(e,t){const n=(0,u.find)(e,["slug",t]);return n&&n.gradient}function nm(e,t){return(0,u.find)(e,["gradient",t])}function om(e,t){const n=nm(e,t);return n&&n.slug}function rm({gradientAttribute:e="gradient",customGradientAttribute:t="customGradient"}={}){const{clientId:n}=qn(),o=fo("color.gradients")||Jp,{gradient:r,customGradient:l}=(0,m.useSelect)((o=>{const{getBlockAttributes:r}=o(Wn),l=r(n)||{};return{customGradient:l[t],gradient:l[e]}}),[n,e,t]),{updateBlockAttributes:i}=(0,m.useDispatch)(Wn),a=(0,s.useCallback)((r=>{const l=om(o,r);i(n,l?{[e]:l,[t]:void 0}:{[e]:void 0,[t]:r})}),[o,n,i]),c=em(r);let u;return u=r?tm(o,r):l,{gradientClass:c,gradientValue:u,setGradient:a}}
|
| 53 |
-
|
| 54 |
-
const lm=(0,g.__)("(Color: %s)"),im=(0,g.__)("(Gradient: %s)"),sm=["colors","disableCustomColors","gradients","disableCustomGradients"];// translators: first %s: the gradient name or value (e.g. red to green or linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)
|
| 55 |
-
function am({colors:e,gradients:t,label:n,currentTab:o,colorValue:r,gradientValue:l}){let i,a;if("color"===o){if(r){i=r;const t=Xp(e,i),n=t&&t.name;a=(0,g.sprintf)(lm,n||i)}}else if("gradient"===o&&l){i=l;const e=nm(t,i),n=e&&e.name;a=(0,g.sprintf)(im,n||i)}return(0,s.createElement)(s.Fragment,null,n,!!i&&(0,s.createElement)(p.ColorIndicator,{colorValue:i,"aria-label":a}))}function cm({colors:e,gradients:t,disableCustomColors:n,disableCustomGradients:o,className:r,label:l,onColorChange:i,onGradientChange:a,colorValue:d,gradientValue:m,clearable:f}){const h=i&&(!(0,u.isEmpty)(e)||!n),b=a&&(!(0,u.isEmpty)(t)||!o),[v,k]=(0,s.useState)(m?"gradient":!!h&&"color");return h||b?(0,s.createElement)(p.BaseControl,{className:c()("block-editor-color-gradient-control",r)},(0,s.createElement)("fieldset",null,(0,s.createElement)(p.__experimentalVStack,{space:3},(0,s.createElement)("legend",null,(0,s.createElement)("div",{className:"block-editor-color-gradient-control__color-indicator"},(0,s.createElement)(p.BaseControl.VisualLabel,null,(0,s.createElement)(am,{currentTab:v,label:l,colorValue:d,gradientValue:m})))),h&&b&&(0,s.createElement)(p.__experimentalToggleGroupControl,{value:v,onChange:k,label:(0,g.__)("Select color type"),hideLabelFromVision:!0,isBlock:!0},(0,s.createElement)(p.__experimentalToggleGroupControlOption,{value:"color",label:(0,g.__)("Solid")}),(0,s.createElement)(p.__experimentalToggleGroupControlOption,{value:"gradient",label:(0,g.__)("Gradient")})),("color"===v||!b)&&(0,s.createElement)(p.ColorPalette,{value:d,onChange:b?e=>{i(e),a()}:i,colors:e,disableCustomColors:n,clearable:f}),("gradient"===v||!h)&&(0,s.createElement)(p.GradientPicker,{value:m,onChange:h?e=>{a(e),i()}:a,gradients:t,disableCustomGradients:o,clearable:f})))):null}function um(e){const t={};return t.colors=fo("color.palette"),t.gradients=fo("color.gradients"),t.disableCustomColors=!fo("color.custom"),t.disableCustomGradients=!fo("color.customGradient"),(0,s.createElement)(cm,i({},t,e))}var dm=function(e){return(0,u.every)(sm,(t=>e.hasOwnProperty(t)))?(0,s.createElement)(cm,e):(0,s.createElement)(um,e)};const pm=[];function mm(e){const{attributes:{borderColor:t,style:n},setAttributes:o}=e,r=fo("color.palette")||pm,l=!fo("color.custom"),i=!fo("color.customGradient"),[a,c]=(0,s.useState)((()=>{var e,o;return null===(e=Zp(r,t,null==n||null===(o=n.border)||void 0===o?void 0:o.color))||void 0===e?void 0:e.color}));return(0,s.createElement)(dm,{label:(0,g.__)("Color"),colorValue:a,colors:r,gradients:void 0,disableCustomColors:l,disableCustomGradients:i,onColorChange:e=>{c(e);const t=Xp(r,e),l={...n,border:{...null==n?void 0:n.border,color:null!=t&&t.slug?void 0:e}},i=null!=t&&t.slug?t.slug:void 0;o({style:$o(l),borderColor:i})}})}function fm(e,t,n){var o;if(!zm(t,"color")||Vm(t))return e;const{borderColor:r,style:l}=n,i=Qp("border-color",r),s=c()(e.className,{"has-border-color":r||(null==l||null===(o=l.border)||void 0===o?void 0:o.color),[i]:!!i});return e.className=s||void 0,e}const gm=(0,d.createHigherOrderComponent)((e=>t=>{var n,o;const{name:r,attributes:l}=t,{borderColor:a}=l,c=fo("color.palette")||pm;if(!zm(r,"color")||Vm(r))return(0,s.createElement)(e,t);const u={borderColor:a?null===(n=Zp(c,a))||void 0===n?void 0:n.color:void 0};let d=t.wrapperProps;return d={...t.wrapperProps,style:{...u,...null===(o=t.wrapperProps)||void 0===o?void 0:o.style}},(0,s.createElement)(e,i({},t,{wrapperProps:d}))}));function hm(e){return[...e].sort(((t,n)=>e.filter((e=>e===n)).length-e.filter((e=>e===t)).length)).shift()}function bm(e={}){if("string"==typeof e)return e;const t=Object.values(e).map((e=>(0,p.__experimentalParseUnit)(e))),n=t.map((e=>e[0])),o=t.map((e=>e[1])),r=n.every((e=>e===n[0]))?n[0]:"",l=hm(o);return 0===r||r?`${r}${l}`:null}function vm(e={}){const t=bm(e);return isNaN(parseFloat(t))}function km(e){return!!e&&("string"==typeof e||!!Object.values(e).filter((e=>!!e||0===e)).length)}function _m({onChange:e,values:t,...n}){const o=bm(t),r=km(t)&&vm(t),l=r?(0,g.__)("Mixed"):null;return(0,s.createElement)(p.__experimentalUnitControl,i({},n,{"aria-label":(0,g.__)("Border radius"),disableUnits:r,isOnly:!0,value:o,onChange:e,placeholder:l}))}(0,l.addFilter)("blocks.registerBlockType","core/border/addAttributes",(function(e){return zm(e,"color")?e.attributes.borderColor?e:{...e,attributes:{...e.attributes,borderColor:{type:"string"}}}:e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/border/addSaveProps",fm),(0,l.addFilter)("blocks.registerBlockType","core/border/addEditProps",(function(e){if(!zm(e,"color")||Vm(e))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),fm(o,e,n)},e})),(0,l.addFilter)("editor.BlockListBlock","core/border/with-border-color-palette-styles",gm);const ym={topLeft:(0,g.__)("Top left"),topRight:(0,g.__)("Top right"),bottomLeft:(0,g.__)("Bottom left"),bottomRight:(0,g.__)("Bottom right")};function Em({onChange:e,values:t,...n}){const o="string"!=typeof t?t:{topLeft:t,topRight:t,bottomLeft:t,bottomRight:t};return(0,s.createElement)("div",{className:"components-border-radius-control__input-controls-wrapper"},Object.entries(ym).map((([t,r])=>{return(0,s.createElement)(p.__experimentalUnitControl,i({},n,{key:t,"aria-label":r,value:o[t],onChange:(l=t,t=>{e&&e({...o,[l]:t||void 0})})}));var l})))}var Cm=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),Sm=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M15.6 7.3h-.7l1.6-3.5-.9-.4-3.9 8.5H9v1.5h2l-1.3 2.8H8.4c-2 0-3.7-1.7-3.7-3.7s1.7-3.7 3.7-3.7H10V7.3H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H9l-1.4 3.2.9.4 5.7-12.5h1.4c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.9 0 5.2-2.3 5.2-5.2 0-2.9-2.4-5.2-5.2-5.2z"}));function wm({isLinked:e,...t}){const n=e?(0,g.__)("Unlink Radii"):(0,g.__)("Link Radii");return(0,s.createElement)(p.Tooltip,{text:n},(0,s.createElement)(p.Button,i({},t,{className:"component-border-radius-control__linked-button",isPrimary:e,isSecondary:!e,isSmall:!0,icon:e?Cm:Sm,iconSize:16,"aria-label":n})))}const Bm={topLeft:null,topRight:null,bottomLeft:null,bottomRight:null},Im={px:100,em:20,rem:20};function xm({onChange:e,values:t}){const[n,o]=(0,s.useState)(!km(t)||!vm(t)),r=(0,p.__experimentalUseCustomUnits)({availableUnits:fo("spacing.units")||["px","em","rem"]}),l=function(e={}){if("string"==typeof e){const[,t]=(0,p.__experimentalParseUnit)(e);return t||"px"}return hm(Object.values(e).map((e=>{const[,t]=(0,p.__experimentalParseUnit)(e);return t})))||"px"}(t),i=r&&r.find((e=>e.value===l)),a=(null==i?void 0:i.step)||1,[c]=(0,p.__experimentalParseUnit)(bm(t));return(0,s.createElement)("fieldset",{className:"components-border-radius-control"},(0,s.createElement)("legend",null,(0,g.__)("Radius")),(0,s.createElement)("div",{className:"components-border-radius-control__wrapper"},n?(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_m,{className:"components-border-radius-control__unit-control",values:t,min:0,onChange:e,unit:l,units:r}),(0,s.createElement)(p.RangeControl,{className:"components-border-radius-control__range-control",value:c,min:0,max:Im[l],initialPosition:0,withInputField:!1,onChange:t=>{e(void 0!==t?`${t}${l}`:void 0)},step:a})):(0,s.createElement)(Em,{min:0,onChange:e,values:t||Bm,units:r}),(0,s.createElement)(wm,{onClick:()=>o(!n),isLinked:n})))}function Tm(e){var t;const{attributes:{style:n},setAttributes:o}=e;return(0,s.createElement)(xm,{values:null==n||null===(t=n.border)||void 0===t?void 0:t.radius,onChange:e=>{let t={...n,border:{...null==n?void 0:n.border,radius:e}};void 0!==e&&""!==e||(t=$o(t)),o({style:t})}})}var Nm=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none"},(0,s.createElement)(F.Path,{d:"M5 11.25h14v1.5H5z"})),Pm=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none"},(0,s.createElement)(F.Path,{fillRule:"evenodd",d:"M5 11.25h3v1.5H5v-1.5zm5.5 0h3v1.5h-3v-1.5zm8.5 0h-3v1.5h3v-1.5z",clipRule:"evenodd"})),Rm=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none"},(0,s.createElement)(F.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"}));const Mm=[{label:(0,g.__)("Solid"),icon:Nm,value:"solid"},{label:(0,g.__)("Dashed"),icon:Pm,value:"dashed"},{label:(0,g.__)("Dotted"),icon:Rm,value:"dotted"}];function Lm({onChange:e,value:t}){return(0,s.createElement)("fieldset",{className:"components-border-style-control"},(0,s.createElement)("legend",null,(0,g.__)("Style")),(0,s.createElement)("div",{className:"components-border-style-control__buttons"},Mm.map((n=>(0,s.createElement)(p.Button,{key:n.value,icon:n.icon,isSmall:!0,isPressed:n.value===t,onClick:()=>e(n.value===t?void 0:n.value),"aria-label":n.label})))))}const Am=e=>{var t;const{attributes:{style:n},setAttributes:o}=e;return(0,s.createElement)(Lm,{value:null==n||null===(t=n.border)||void 0===t?void 0:t.style,onChange:e=>{const t={...n,border:{...null==n?void 0:n.border,style:e}};o({style:$o(t)})}})},Dm=e=>{const{attributes:{borderColor:t,style:n},setAttributes:o}=e,{width:r,color:l,style:i}=(null==n?void 0:n.border)||{},[a,c]=(0,s.useState)(),[u,d]=(0,s.useState)();(0,s.useEffect)((()=>{"none"!==i&&c(i)}),[i]),(0,s.useEffect)((()=>{(t||l)&&d({name:t||void 0,color:l||void 0})}),[t,l]);const m=(0,p.__experimentalUseCustomUnits)({availableUnits:fo("spacing.units")||["px","em","rem"]});return(0,s.createElement)(p.__experimentalUnitControl,{value:r,label:(0,g.__)("Width"),min:0,onChange:e=>{let r={...n,border:{...null==n?void 0:n.border,width:e}},l=t;const s=0===parseFloat(e);s&&(l=void 0,r.border.color=void 0,r.border.style="none"),s||"none"!==i||(r.border.style=a),s||void 0!==t||(l=null==u?void 0:u.name,r.border.color=null==u?void 0:u.color),void 0!==e&&""!==e||(r=$o(r)),o({borderColor:l,style:r})},units:m})},Om="__experimentalBorder";function Fm(e){const t=Hm(e),n=zm(e.name),o=fo("border.customColor")&&zm(e.name,"color"),r=fo("border.customRadius")&&zm(e.name,"radius"),l=fo("border.customStyle")&&zm(e.name,"style"),i=fo("border.customWidth")&&zm(e.name,"width");return t||!n?null:(0,s.createElement)(Xo,null,(0,s.createElement)(p.PanelBody,{className:"block-editor-hooks__border-controls",title:(0,g.__)("Border"),initialOpen:!1},(i||l)&&(0,s.createElement)("div",{className:"block-editor-hooks__border-controls-row"},i&&(0,s.createElement)(Dm,e),l&&(0,s.createElement)(Am,e)),o&&(0,s.createElement)(mm,e),r&&(0,s.createElement)(Tm,e)))}function zm(e,t="any"){if("web"!==s.Platform.OS)return!1;const n=(0,r.getBlockSupport)(e,Om);return!!(!0===n||("any"===t?null!=n&&n.color||null!=n&&n.radius||null!=n&&n.width||null!=n&&n.style:null!=n&&n[t]))}function Vm(e){const t=(0,r.getBlockSupport)(e,Om);return null==t?void 0:t.__experimentalSkipSerialization}const Hm=()=>[!fo("border.customColor"),!fo("border.customRadius"),!fo("border.customStyle"),!fo("border.customWidth")].every(Boolean),Um=(0,g.__)("(%s: color %s)"),Gm=(0,g.__)("(%s: gradient %s)"),Wm=["colors","disableCustomColors","gradients","disableCustomGradients"],$m=({colors:e,gradients:t,settings:n})=>n.map((({colorValue:n,gradientValue:o,label:r,colors:l,gradients:i},a)=>{if(!n&&!o)return null;let c;if(n){const t=Xp(l||e,n);c=(0,g.sprintf)(Um,r.toLowerCase(),t&&t.name||n)}else{const e=nm(i||t,n);c=(0,g.sprintf)(Gm,r.toLowerCase(),e&&e.name||o)}return(0,s.createElement)(p.ColorIndicator,{key:a,colorValue:n||o,"aria-label":c})})),jm=({className:e,colors:t,gradients:n,disableCustomColors:o,disableCustomGradients:r,children:l,settings:a,title:d,showTitle:m=!0,...f})=>{if((0,u.isEmpty)(t)&&(0,u.isEmpty)(n)&&o&&r&&(0,u.every)(a,(e=>(0,u.isEmpty)(e.colors)&&(0,u.isEmpty)(e.gradients)&&(void 0===e.disableCustomColors||e.disableCustomColors)&&(void 0===e.disableCustomGradients||e.disableCustomGradients))))return null;const g=(0,s.createElement)("span",{className:"block-editor-panel-color-gradient-settings__panel-title"},d,(0,s.createElement)($m,{colors:t,gradients:n,settings:a}));return(0,s.createElement)(p.PanelBody,i({className:c()("block-editor-panel-color-gradient-settings",e),title:m?g:void 0},f),a.map(((e,l)=>(0,s.createElement)(dm,i({key:l,colors:t,gradients:n,disableCustomColors:o,disableCustomGradients:r},e)))),l)},Km=e=>{const t={};return t.colors=fo("color.palette"),t.gradients=fo("color.gradients"),t.disableCustomColors=!fo("color.custom"),t.disableCustomGradients=!fo("color.customGradient"),(0,s.createElement)(jm,i({},t,e))};var qm=e=>(0,u.every)(Wm,(t=>e.hasOwnProperty(t)))?(0,s.createElement)(jm,e):(0,s.createElement)(Km,e);function Ym({colordBackgroundColor:e,colordTextColor:t,backgroundColor:n,textColor:o}){const r=e.brightness()<t.brightness()?(0,g.__)("This color combination may be hard for people to read. Try using a darker background color and/or a brighter text color."):(0,g.__)("This color combination may be hard for people to read. Try using a brighter background color and/or a darker text color.");return(0,s.useEffect)((()=>{(0,Rt.speak)((0,g.__)("This color combination may be hard for people to read."))}),[n,o]),(0,s.createElement)("div",{className:"block-editor-contrast-checker"},(0,s.createElement)(p.Notice,{spokenMessage:null,status:"warning",isDismissible:!1},r))}Rc([Mc,Dc]);var Zm=function({backgroundColor:e,fallbackBackgroundColor:t,fallbackTextColor:n,fontSize:o,isLargeText:r,textColor:l}){if(!e&&!t||!l&&!n)return null;const i=Nc(e||t),a=Nc(l||n);return 1!==i.alpha()||1!==a.alpha()||a.isReadable(i,{level:"AA",size:r||!1!==r&&o>=24?"large":"small"})?null:(0,s.createElement)(Ym,{backgroundColor:e,textColor:l,colordBackgroundColor:i,colordTextColor:a})};function Xm(e){return e.ownerDocument.defaultView.getComputedStyle(e)}function Qm({settings:e,clientId:t,enableContrastChecking:n=!0,showTitle:o=!0}){const[r,l]=(0,s.useState)(),[i,a]=(0,s.useState)(),c=Ca(t);return(0,s.useEffect)((()=>{if(!n)return;if(!c.current)return;a(Xm(c.current).color);let e=c.current,t=Xm(e).backgroundColor;for(;"rgba(0, 0, 0, 0)"===t&&e.parentNode&&e.parentNode.nodeType===e.parentNode.ELEMENT_NODE;)e=e.parentNode,t=Xm(e).backgroundColor;l(t)})),(0,s.createElement)(Xo,null,(0,s.createElement)(qm,{title:(0,g.__)("Color"),initialOpen:!1,settings:e,showTitle:o},n&&(0,s.createElement)(Zm,{backgroundColor:r,textColor:i})))}const Jm="color",ef=[],tf=e=>{const t=(0,r.getBlockSupport)(e,Jm);return t&&(!0===t.link||!0===t.gradient||!1!==t.background||!1!==t.text)},nf=e=>{const t=(0,r.getBlockSupport)(e,Jm);return null==t?void 0:t.__experimentalSkipSerialization},of=e=>{const t=(0,r.getBlockSupport)(e,Jm);return(0,u.isObject)(t)&&!!t.gradients};function rf(e,t,n){var o,r,l,i,s,a;if(!tf(t)||nf(t))return e;const u=of(t),{backgroundColor:d,textColor:p,gradient:m,style:f}=n,g=Qp("background-color",d),h=em(m),b=Qp("color",p),v=c()(e.className,b,h,{[g]:!(u&&null!=f&&null!==(o=f.color)&&void 0!==o&&o.gradient||!g),"has-text-color":p||(null==f||null===(r=f.color)||void 0===r?void 0:r.text),"has-background":d||(null==f||null===(l=f.color)||void 0===l?void 0:l.background)||u&&(m||(null==f||null===(i=f.color)||void 0===i?void 0:i.gradient)),"has-link-color":null==f||null===(s=f.elements)||void 0===s||null===(a=s.link)||void 0===a?void 0:a.color});return e.className=v||void 0,e}const lf=(e,t)=>{const n=/var:preset\|color\|(.+)/.exec(t);return n&&n[1]?Zp(e,n[1]).color:t};function sf(e){var t,n,o,l,i,a,c,d,p;const{name:m,attributes:f}=e,h=fo("color.palette")||ef,b=fo("color.gradients")||ef,v=fo("color.custom"),k=fo("color.customGradient"),_=fo("color.link"),y=fo("color.text"),E=fo("color.background"),C=(0,s.useRef)(f);if((0,s.useEffect)((()=>{C.current=f}),[f]),!tf(m))return null;const S=(e=>{if("web"!==s.Platform.OS)return!1;const t=(0,r.getBlockSupport)(e,Jm);return(0,u.isObject)(t)&&!!t.link})(m)&&_&&(h.length>0||v),w=(e=>{const t=(0,r.getBlockSupport)(e,Jm);return t&&!1!==t.text})(m)&&y&&(h.length>0||v),B=(e=>{const t=(0,r.getBlockSupport)(e,Jm);return t&&!1!==t.background})(m)&&E&&(h.length>0||v),I=of(m)&&(b.length>0||k);if(!(S||w||B||I))return null;const{style:x,textColor:T,backgroundColor:N,gradient:P}=f;let R;if(I&&P)R=tm(b,P);else if(I){var M;R=null==x||null===(M=x.color)||void 0===M?void 0:M.gradient}const L=t=>n=>{var o,r;const l=Xp(h,n),i=t+"Color",s={...C.current.style,color:{...null===(o=C.current)||void 0===o||null===(r=o.style)||void 0===r?void 0:r.color,[t]:null!=l&&l.slug?void 0:n}},a=null!=l&&l.slug?l.slug:void 0,c={style:$o(s),[i]:a};e.setAttributes(c),C.current={...C.current,...c}};return(0,s.createElement)(Qm,{enableContrastChecking:!("web"!==s.Platform.OS||P||null!=x&&null!==(t=x.color)&&void 0!==t&&t.gradient),clientId:e.clientId,settings:[...w?[{label:(0,g.__)("Text color"),onColorChange:L("text"),colorValue:Zp(h,T,null==x||null===(n=x.color)||void 0===n?void 0:n.text).color}]:[],...B||I?[{label:(0,g.__)("Background color"),onColorChange:B?L("background"):void 0,colorValue:Zp(h,N,null==x||null===(o=x.color)||void 0===o?void 0:o.background).color,gradientValue:R,onGradientChange:I?t=>{const n=om(b,t);let o;if(n){var r,l,i;const e={...null===(r=C.current)||void 0===r?void 0:r.style,color:{...null===(l=C.current)||void 0===l||null===(i=l.style)||void 0===i?void 0:i.color,gradient:void 0}};o={style:$o(e),gradient:n}}else{var s,a,c;const e={...null===(s=C.current)||void 0===s?void 0:s.style,color:{...null===(a=C.current)||void 0===a||null===(c=a.style)||void 0===c?void 0:c.color,gradient:t}};o={style:$o(e),gradient:void 0}}e.setAttributes(o),C.current={...C.current,...o}}:void 0}]:[],...S?[{label:(0,g.__)("Link Color"),onColorChange:t=>{const n=Xp(h,t),o=null!=n&&n.slug?`var:preset|color|${n.slug}`:t,r=$o(function(e,t,n){return(0,u.setWith)(e?(0,u.clone)(e):{},["elements","link","color","text"],n,u.clone)}(x,0,o));e.setAttributes({style:r})},colorValue:lf(h,null==x||null===(l=x.elements)||void 0===l||null===(i=l.link)||void 0===i||null===(a=i.color)||void 0===a?void 0:a.text),clearable:!(null==x||null===(c=x.elements)||void 0===c||null===(d=c.link)||void 0===d||null===(p=d.color)||void 0===p||!p.text)}]:[]]})}const af=(0,d.createHigherOrderComponent)((e=>t=>{var n,o,r;const{name:l,attributes:a}=t,{backgroundColor:c,textColor:u}=a,d=fo("color.palette")||ef;if(!tf(l)||nf(l))return(0,s.createElement)(e,t);const p={color:u?null===(n=Zp(d,u))||void 0===n?void 0:n.color:void 0,backgroundColor:c?null===(o=Zp(d,c))||void 0===o?void 0:o.color:void 0};let m=t.wrapperProps;return m={...t.wrapperProps,style:{...p,...null===(r=t.wrapperProps)||void 0===r?void 0:r.style}},(0,s.createElement)(e,i({},t,{wrapperProps:m}))}));(0,l.addFilter)("blocks.registerBlockType","core/color/addAttribute",(function(e){return tf(e)?(e.attributes.backgroundColor||Object.assign(e.attributes,{backgroundColor:{type:"string"}}),e.attributes.textColor||Object.assign(e.attributes,{textColor:{type:"string"}}),of(e)&&!e.attributes.gradient&&Object.assign(e.attributes,{gradient:{type:"string"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/color/addSaveProps",rf),(0,l.addFilter)("blocks.registerBlockType","core/color/addEditProps",(function(e){if(!tf(e)||nf(e))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),rf(o,e,n)},e})),(0,l.addFilter)("editor.BlockListBlock","core/color/with-color-palette-styles",af);var cf=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),uf=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"}));const df=[{name:(0,g.__)("Underline"),value:"underline",icon:cf},{name:(0,g.__)("Strikethrough"),value:"line-through",icon:uf}];function pf({value:e,onChange:t}){return(0,s.createElement)("fieldset",{className:"block-editor-text-decoration-control"},(0,s.createElement)("legend",null,(0,g.__)("Decoration")),(0,s.createElement)("div",{className:"block-editor-text-decoration-control__buttons"},df.map((n=>(0,s.createElement)(p.Button,{key:n.value,icon:n.icon,isSmall:!0,isPressed:n.value===e,onClick:()=>t(n.value===e?void 0:n.value),"aria-label":n.name})))))}const mf="typography.__experimentalTextDecoration";function ff(e){var t;const{attributes:{style:n},setAttributes:o}=e;return gf(e)?null:(0,s.createElement)(pf,{value:null==n||null===(t=n.typography)||void 0===t?void 0:t.textDecoration,onChange:function(e){o({style:$o({...n,typography:{...null==n?void 0:n.typography,textDecoration:e}})})}})}function gf({name:e}={}){const t=!(0,r.hasBlockSupport)(e,mf),n=fo("typography.customTextDecorations");return t||!n}var hf=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),bf=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),vf=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"}));const kf=[{name:(0,g.__)("Uppercase"),value:"uppercase",icon:hf},{name:(0,g.__)("Lowercase"),value:"lowercase",icon:bf},{name:(0,g.__)("Capitalize"),value:"capitalize",icon:vf}];function _f({value:e,onChange:t}){return(0,s.createElement)("fieldset",{className:"block-editor-text-transform-control"},(0,s.createElement)("legend",null,(0,g.__)("Letter case")),(0,s.createElement)("div",{className:"block-editor-text-transform-control__buttons"},kf.map((n=>(0,s.createElement)(p.Button,{key:n.value,icon:n.icon,isSmall:!0,isPressed:e===n.value,"aria-label":n.name,onClick:()=>t(e===n.value?void 0:n.value)})))))}const yf="typography.__experimentalTextTransform";function Ef(e){var t;const{attributes:{style:n},setAttributes:o}=e;return Cf(e)?null:(0,s.createElement)(_f,{value:null==n||null===(t=n.typography)||void 0===t?void 0:t.textTransform,onChange:function(e){o({style:$o({...n,typography:{...null==n?void 0:n.typography,textTransform:e}})})}})}function Cf({name:e}={}){const t=!(0,r.hasBlockSupport)(e,yf),n=fo("typography.customTextTransforms");return t||!n}function Sf(e){const t=!gf(e),n=!Cf(e);return t||n?(0,s.createElement)("div",{className:"block-editor-text-decoration-and-transform"},t&&(0,s.createElement)(ff,e),n&&(0,s.createElement)(Ef,e)):null}function wf({value:e,onChange:t}){const n=function(e){return void 0!==e&&""!==e}(e),o=n?e:"";return(0,s.createElement)("div",{className:"block-editor-line-height-control"},(0,s.createElement)(p.TextControl,{autoComplete:"off",onKeyDown:e=>{const{keyCode:o}=e;o!==fa.ZERO||n||(e.preventDefault(),t("0"))},onChange:e=>{if(n)return void t(e);let o=e;switch(e){case"0.1":o=1.6;break;case"0":o=1.4}t(o)},label:(0,g.__)("Line height"),placeholder:1.5,step:.1,type:"number",value:o,min:0}))}const Bf="typography.lineHeight";function If(e){var t;const{attributes:{style:n}}=e;return xf(e)?null:(0,s.createElement)(wf,{value:null==n||null===(t=n.typography)||void 0===t?void 0:t.lineHeight,onChange:t=>{const o={...n,typography:{...null==n?void 0:n.typography,lineHeight:t}};e.setAttributes({style:$o(o)})}})}function xf({name:e}={}){const t=!fo("typography.customLineHeight");return!(0,r.hasBlockSupport)(e,Bf)||t}const Tf=[{name:(0,g.__)("Regular"),value:"normal"},{name:(0,g.__)("Italic"),value:"italic"}],Nf=[{name:(0,g.__)("Thin"),value:"100"},{name:(0,g.__)("Extra Light"),value:"200"},{name:(0,g.__)("Light"),value:"300"},{name:(0,g.__)("Regular"),value:"400"},{name:(0,g.__)("Medium"),value:"500"},{name:(0,g.__)("Semi Bold"),value:"600"},{name:(0,g.__)("Bold"),value:"700"},{name:(0,g.__)("Extra Bold"),value:"800"},{name:(0,g.__)("Black"),value:"900"}];function Pf(e){const{onChange:t,hasFontStyles:n=!0,hasFontWeights:o=!0,value:{fontStyle:r,fontWeight:l}}=e,i=n||o,a={key:"default",name:(0,g.__)("Default"),style:{fontStyle:void 0,fontWeight:void 0}},c=(0,s.useMemo)((()=>n&&o?(()=>{const e=[a];return Tf.forEach((({name:t,value:n})=>{Nf.forEach((({name:o,value:r})=>{const l="normal"===n?o:(0,g.sprintf)(
|
|
|
|
|
|
|
| 56 |
/* translators: 1: Font weight name. 2: Font style name. */
|
| 57 |
-
(0,
|
| 58 |
-
(0,
|
| 59 |
-
(0,
|
| 60 |
-
(0,g.__)("Currently selected font weight: %s"),u.name):(0,g.__)("No selected font appearance"),options:c,value:u,onChange:({selectedItem:e})=>t(e.style)})}const Rf="typography.__experimentalFontStyle",Mf="typography.__experimentalFontWeight";function Lf(e){var t,n;const{attributes:{style:o},setAttributes:r}=e,l=!Af(e),i=!Df(e);if(!l&&!i)return null;const a=null==o||null===(t=o.typography)||void 0===t?void 0:t.fontStyle,c=null==o||null===(n=o.typography)||void 0===n?void 0:n.fontWeight;return(0,s.createElement)(Pf,{onChange:e=>{r({style:$o({...o,typography:{...null==o?void 0:o.typography,fontStyle:e.fontStyle,fontWeight:e.fontWeight}})})},hasFontStyles:l,hasFontWeights:i,value:{fontStyle:a,fontWeight:c}})}function Af({name:e}={}){const t=(0,r.hasBlockSupport)(e,Rf),n=fo("typography.customFontStyle");return!t||!n}function Df({name:e}={}){const t=(0,r.hasBlockSupport)(e,Mf),n=fo("typography.customFontWeight");return!t||!n}function Of(e){const t=Af(e),n=Df(e);return t&&n}function Ff({value:e="",onChange:t,fontFamilies:n,...o}){const r=fo("typography.fontFamilies");if(n||(n=r),(0,u.isEmpty)(n))return null;const l=[{value:"",label:(0,g.__)("Default")},...n.map((({fontFamily:e,name:t})=>({value:e,label:t||e})))];return(0,s.createElement)(p.SelectControl,i({label:(0,g.__)("Font family"),options:l,value:e,onChange:t,labelPosition:"top"},o))}const zf="typography.__experimentalFontFamily";function Vf(e,t,n){if(!(0,r.hasBlockSupport)(t,zf))return e;if((0,r.hasBlockSupport)(t,"__experimentalSkipTypographySerialization"))return e;if(null==n||!n.fontFamily)return e;const o=new(Wd())(e.className);o.add(`has-${(0,u.kebabCase)(null==n?void 0:n.fontFamily)}-font-family`);const l=o.value;return e.className=l||void 0,e}function Hf({name:e,setAttributes:t,attributes:{fontFamily:n}}){var o;const r=fo("typography.fontFamilies");if(Uf({name:e}))return null;const l=null===(o=(0,u.find)(r,(({slug:e})=>n===e)))||void 0===o?void 0:o.fontFamily;return(0,s.createElement)(Ff,{className:"block-editor-hooks-font-family-control",fontFamilies:r,value:l,onChange:function(e){const n=(0,u.find)(r,(({fontFamily:t})=>t===e));t({fontFamily:null==n?void 0:n.slug})}})}function Uf({name:e}){const t=fo("typography.fontFamilies");return!t||0===t.length||!(0,r.hasBlockSupport)(e,zf)}(0,l.addFilter)("blocks.registerBlockType","core/fontFamily/addAttribute",(function(e){return(0,r.hasBlockSupport)(e,zf)?(e.attributes.fontFamily||Object.assign(e.attributes,{fontFamily:{type:"string"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/fontFamily/addSaveProps",Vf),(0,l.addFilter)("blocks.registerBlockType","core/fontFamily/addEditProps",(function(e){if(!(0,r.hasBlockSupport)(e,zf))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),Vf(o,e,n)},e}));const Gf=(e,t,n)=>{if(t){const n=(0,u.find)(e,{slug:t});if(n)return n}return{size:n}};function Wf(e,t){return(0,u.find)(e,{size:t})||{size:t}}function $f(e){if(e)return`has-${(0,u.kebabCase)(e)}-font-size`}var jf=function(e){const t=fo("typography.fontSizes"),n=!fo("typography.customFontSize");return(0,s.createElement)(p.FontSizePicker,i({},e,{fontSizes:t,disableCustomFontSizes:n}))};const Kf="typography.fontSize";function qf(e,t,n){if(!(0,r.hasBlockSupport)(t,Kf))return e;if((0,r.hasBlockSupport)(t,"typography.__experimentalSkipSerialization"))return e;const o=new(Wd())(e.className);o.add($f(n.fontSize));const l=o.value;return e.className=l||void 0,e}function Yf(e){var t,n;const{attributes:{fontSize:o,style:r},setAttributes:l}=e,i=Zf(e),a=fo("typography.fontSizes");if(i)return null;const c=Gf(a,o,null==r||null===(t=r.typography)||void 0===t?void 0:t.fontSize),u=(null==c?void 0:c.size)||(null==r||null===(n=r.typography)||void 0===n?void 0:n.fontSize)||o;return(0,s.createElement)(jf,{onChange:e=>{const t=Wf(a,e).slug;l({style:$o({...r,typography:{...null==r?void 0:r.typography,fontSize:t?void 0:e}}),fontSize:t})},value:u})}function Zf({name:e}={}){const t=fo("typography.fontSizes"),n=!(null==t||!t.length);return!(0,r.hasBlockSupport)(e,Kf)||!n}const Xf=(0,d.createHigherOrderComponent)((e=>t=>{var n,o;const l=fo("typography.fontSizes"),{name:i,attributes:{fontSize:a,style:c},wrapperProps:u}=t;if(!(0,r.hasBlockSupport)(i,Kf)||(0,r.hasBlockSupport)(i,"typography.__experimentalSkipSerialization")||!a||null!=c&&null!==(n=c.typography)&&void 0!==n&&n.fontSize)return(0,s.createElement)(e,t);const d=Gf(l,a,null==c||null===(o=c.typography)||void 0===o?void 0:o.fontSize).size,p={...t,wrapperProps:{...u,style:{fontSize:d,...null==u?void 0:u.style}}};return(0,s.createElement)(e,p)}),"withFontSizeInlineStyles");function Qf({value:e,onChange:t}){const n=(0,p.__experimentalUseCustomUnits)({availableUnits:fo("spacing.units")||["px","em","rem"],defaultValues:{px:"2",em:".2",rem:".2"}});return(0,s.createElement)(p.__experimentalUnitControl,{label:(0,g.__)("Letter-spacing"),value:e,__unstableInputWidth:"60px",units:n,onChange:t})}(0,l.addFilter)("blocks.registerBlockType","core/font/addAttribute",(function(e){return(0,r.hasBlockSupport)(e,Kf)?(e.attributes.fontSize||Object.assign(e.attributes,{fontSize:{type:"string"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/font/addSaveProps",qf),(0,l.addFilter)("blocks.registerBlockType","core/font/addEditProps",(function(e){if(!(0,r.hasBlockSupport)(e,Kf))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),qf(o,e,n)},e})),(0,l.addFilter)("editor.BlockListBlock","core/font-size/with-font-size-inline-styles",Xf);const Jf="typography.__experimentalLetterSpacing";function eg(e){var t;const{attributes:{style:n},setAttributes:o}=e;return tg(e)?null:(0,s.createElement)(Qf,{value:null==n||null===(t=n.typography)||void 0===t?void 0:t.letterSpacing,onChange:function(e){o({style:$o({...n,typography:{...null==n?void 0:n.typography,letterSpacing:e}})})}})}function tg({name:e}={}){const t=!(0,r.hasBlockSupport)(e,Jf),n=fo("typography.customLetterSpacing");return t||!n}const ng=[Bf,Kf,Rf,Mf,zf,mf,yf,Jf];function og(e){const t=function(e={}){const t=[Of(e),Zf(e),xf(e),Uf(e),gf(e),Cf(e),tg(e)];return t.filter(Boolean).length===t.length}(e),n=rg(e.name);return t||!n?null:(0,s.createElement)(Xo,null,(0,s.createElement)(p.PanelBody,{title:(0,g.__)("Typography")},(0,s.createElement)(Hf,e),(0,s.createElement)(Yf,e),(0,s.createElement)(Lf,e),(0,s.createElement)(If,e),(0,s.createElement)(Sf,e),(0,s.createElement)(eg,e)))}const rg=e=>ng.some((t=>(0,r.hasBlockSupport)(e,t)));function lg(e){const t=(0,r.getBlockSupport)(e,fg);return!!(!0===t||null!=t&&t.blockGap)}function ig({name:e}={}){const t=!fo("spacing.blockGap");return!lg(e)||t}function sg(e){var t;const{clientId:n,attributes:{style:o},setAttributes:r}=e,l=(0,p.__experimentalUseCustomUnits)({availableUnits:fo("spacing.units")||["%","px","em","rem","vw"]}),i=Ca(n);return ig(e)?null:s.Platform.select({web:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.__experimentalUnitControl,{label:(0,g.__)("Block spacing"),__unstableInputWidth:"80px",min:0,onChange:e=>{var t;const n={...o,spacing:{...null==o?void 0:o.spacing,blockGap:e}};r({style:$o(n)});const l=(null===(t=window)||void 0===t?void 0:t.navigator.userAgent)&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome ")&&!window.navigator.userAgent.includes("Chromium ");var s;i.current&&l&&(null===(s=i.current.parentNode)||void 0===s||s.replaceChild(i.current,i.current))},units:l,value:null==o||null===(t=o.spacing)||void 0===t?void 0:t.blockGap})),native:null})}function ag(e){const t=(0,r.getBlockSupport)(e,fg);return!!(!0===t||null!=t&&t.margin)}function cg({name:e}={}){const t=!fo("spacing.customMargin"),n=!_g(e,"margin");return!ag(e)||t||n}function ug(e){var t;const{name:n,attributes:{style:o},setAttributes:r}=e,l=(0,p.__experimentalUseCustomUnits)({availableUnits:fo("spacing.units")||["%","px","em","rem","vw"]}),i=kg(n,"margin"),a=i&&i.some((e=>hg.includes(e)));return cg(e)?null:s.Platform.select({web:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.__experimentalBoxControl,{values:null==o||null===(t=o.spacing)||void 0===t?void 0:t.margin,onChange:e=>{const t={...o,spacing:{...null==o?void 0:o.spacing,margin:e}};r({style:$o(t)})},onChangeShowVisualizer:e=>{const t={...o,visualizers:{margin:e}};r({style:$o(t)})},label:(0,g.__)("Margin"),sides:i,units:l,allowReset:!1,splitOnAxis:a})),native:null})}function dg(e){const t=(0,r.getBlockSupport)(e,fg);return!!(!0===t||null!=t&&t.padding)}function pg({name:e}={}){const t=!fo("spacing.customPadding"),n=!_g(e,"padding");return!dg(e)||t||n}function mg(e){var t;const{name:n,attributes:{style:o},setAttributes:r}=e,l=(0,p.__experimentalUseCustomUnits)({availableUnits:fo("spacing.units")||["%","px","em","rem","vw"]}),i=kg(n,"padding"),a=i&&i.some((e=>hg.includes(e)));return pg(e)?null:s.Platform.select({web:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.__experimentalBoxControl,{values:null==o||null===(t=o.spacing)||void 0===t?void 0:t.padding,onChange:e=>{const t={...o,spacing:{...null==o?void 0:o.spacing,padding:e}};r({style:$o(t)})},onChangeShowVisualizer:e=>{const t={...o,visualizers:{padding:e}};r({style:$o(t)})},label:(0,g.__)("Padding"),sides:i,units:l,allowReset:!1,splitOnAxis:a})),native:null})}const fg="spacing",gg=["top","right","bottom","left"],hg=["vertical","horizontal"];function bg(e){const t=ig(e),n=pg(e),o=cg(e),l=vg(e),i=(a=e.name,"web"===s.Platform.OS&&(lg(a)||dg(a)||ag(a)));var a;if(l||!i)return null;const c=(0,r.getBlockSupport)(e.name,[fg,"__experimentalDefaultControls"]),u=e=>t=>{var n;return{...t,style:{...t.style,spacing:{...null===(n=t.style)||void 0===n?void 0:n.spacing,[e]:void 0}}}};return(0,s.createElement)(Xo,{__experimentalGroup:"dimensions"},!n&&(0,s.createElement)(p.__experimentalToolsPanelItem,{hasValue:()=>function(e){var t,n;return void 0!==(null===(t=e.attributes.style)||void 0===t||null===(n=t.spacing)||void 0===n?void 0:n.padding)}(e),label:(0,g.__)("Padding"),onDeselect:()=>function({attributes:e={},setAttributes:t}){const{style:n}=e;t({style:$o({...n,spacing:{...null==n?void 0:n.spacing,padding:void 0}})})}(e),resetAllFilter:u("padding"),isShownByDefault:null==c?void 0:c.padding,panelId:e.clientId},(0,s.createElement)(mg,e)),!o&&(0,s.createElement)(p.__experimentalToolsPanelItem,{hasValue:()=>function(e){var t,n;return void 0!==(null===(t=e.attributes.style)||void 0===t||null===(n=t.spacing)||void 0===n?void 0:n.margin)}(e),label:(0,g.__)("Margin"),onDeselect:()=>function({attributes:e={},setAttributes:t}){const{style:n}=e;t({style:$o({...n,spacing:{...null==n?void 0:n.spacing,margin:void 0}})})}(e),resetAllFilter:u("margin"),isShownByDefault:null==c?void 0:c.margin,panelId:e.clientId},(0,s.createElement)(ug,e)),!t&&(0,s.createElement)(p.__experimentalToolsPanelItem,{hasValue:()=>function(e){var t,n;return void 0!==(null===(t=e.attributes.style)||void 0===t||null===(n=t.spacing)||void 0===n?void 0:n.blockGap)}(e),label:(0,g.__)("Block spacing"),onDeselect:()=>function({attributes:e={},setAttributes:t}){const{style:n}=e;t({style:{...n,spacing:{...null==n?void 0:n.spacing,blockGap:void 0}}})}(e),resetAllFilter:u("blockGap"),isShownByDefault:null==c?void 0:c.blockGap,panelId:e.clientId},(0,s.createElement)(sg,e)))}const vg=(e={})=>{const t=ig(e),n=pg(e),o=cg(e);return t&&n&&o};function kg(e,t){const n=(0,r.getBlockSupport)(e,fg);if(n&&"boolean"!=typeof n[t])return n[t]}function _g(e,t){const n=kg(e,t);return!(n&&n.some((e=>gg.includes(e)))&&n.some((e=>hg.includes(e)))&&(console.warn(`The ${t} support for the "${e}" block can not be configured to support both axial and arbitrary sides.`),1))}const yg=[...ng,Om,Jm,fg],Eg=e=>yg.some((t=>(0,r.hasBlockSupport)(e,t))),Cg="var:";function Sg(e){return(0,u.startsWith)(e,Cg)?`var(--wp--${e.slice(Cg.length).split("|").join("--")})`:e}function wg(e={}){const t={};return Object.keys(r.__EXPERIMENTAL_STYLE_PROPERTY).forEach((n=>{const o=r.__EXPERIMENTAL_STYLE_PROPERTY[n].value,l=r.__EXPERIMENTAL_STYLE_PROPERTY[n].properties;if((0,u.has)(e,o)&&"elements"!==(0,u.first)(o)){const r=(0,u.get)(e,o);l&&!(0,u.isString)(r)?Object.entries(l).forEach((e=>{const[n,o]=e,l=(0,u.get)(r,[o]);l&&(t[n]=Sg(l))})):t[n]=Sg((0,u.get)(e,o))}})),t}const Bg={"__experimentalBorder.__experimentalSkipSerialization":["border"],"color.__experimentalSkipSerialization":[Jm],"typography.__experimentalSkipSerialization":["typography"],[`${fg}.__experimentalSkipSerialization`]:["spacing"]},Ig={...Bg,[`${fg}`]:["spacing.blockGap"]};function xg(e,t,n,o=Ig){if(!Eg(t))return e;let{style:l}=n;return(0,u.forEach)(o,((e,n)=>{(0,r.getBlockSupport)(t,n)&&(l=(0,u.omit)(l,e))})),e.style={...wg(l),...e.style},e}const Tg=(0,d.createHigherOrderComponent)((e=>t=>{const n=Yn();return(0,s.createElement)(s.Fragment,null,n&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(sf,t),(0,s.createElement)(og,t),(0,s.createElement)(Fm,t),(0,s.createElement)(bg,t)),(0,s.createElement)(e,t))}),"withToolbarControls"),Ng=(0,d.createHigherOrderComponent)((e=>t=>{var n,o;const l=null===(n=t.attributes.style)||void 0===n?void 0:n.elements,a=`wp-elements-${(0,d.useInstanceId)(e)}`,p=function(e,t={}){return(0,u.map)(t,((t,n)=>{const o=wg(t);return(0,u.isEmpty)(o)?"":[`.${e} ${r.__EXPERIMENTAL_ELEMENTS[n]}{`,...(0,u.map)(o,((e,t)=>`\t${(0,u.kebabCase)(t)}: ${e};`)),"}"].join("\n")})).join("\n")}(a,null===(o=t.attributes.style)||void 0===o?void 0:o.elements),m=(0,s.useContext)(Kp.__unstableElementContext);return(0,s.createElement)(s.Fragment,null,l&&m&&(0,s.createPortal)((0,s.createElement)("style",{dangerouslySetInnerHTML:{__html:p}}),m),(0,s.createElement)(e,i({},t,{className:l?c()(t.className,a):t.className})))}));(0,l.addFilter)("blocks.registerBlockType","core/style/addAttribute",(function(e){return Eg(e)?(e.attributes.style||Object.assign(e.attributes,{style:{type:"object"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/style/addSaveProps",xg),(0,l.addFilter)("blocks.registerBlockType","core/style/addEditProps",(function(e){if(!Eg(e))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),xg(o,e,n,Bg)},e})),(0,l.addFilter)("editor.BlockEdit","core/style/with-block-controls",Tg),(0,l.addFilter)("editor.BlockListBlock","core/editor/with-elements-styles",Ng);var Pg=function({colorPalette:e,duotonePalette:t,disableCustomColors:n,disableCustomDuotone:o,value:r,onChange:l}){return(0,s.createElement)(p.Dropdown,{popoverProps:{className:"block-editor-duotone-control__popover",headerTitle:(0,g.__)("Duotone")},renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(p.ToolbarButton,{showTooltip:!0,onClick:t,"aria-haspopup":"true","aria-expanded":e,onKeyDown:n=>{e||n.keyCode!==fa.DOWN||(n.preventDefault(),t())},label:(0,g.__)("Apply duotone filter"),icon:(0,s.createElement)(p.DuotoneSwatch,{values:r})}),renderContent:()=>(0,s.createElement)(p.MenuGroup,{label:(0,g.__)("Duotone")},(0,s.createElement)(p.DuotonePicker,{colorPalette:e,duotonePalette:t,disableCustomColors:n,disableCustomDuotone:o,value:r,onChange:l}))})};const Rg=[];function Mg(e=[]){const t={r:[],g:[],b:[]};return e.forEach((e=>{const n=Nc(e).toRgb();t.r.push(n.r/255),t.g.push(n.g/255),t.b.push(n.b/255)})),t}function Lg({selector:e,id:t,values:n}){const o=`\n${e} {\n\tfilter: url( #${t} );\n}\n`;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.SVG,{xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 0 0",width:"0",height:"0",focusable:"false",role:"none",style:{visibility:"hidden",position:"absolute",left:"-9999px",overflow:"hidden"}},(0,s.createElement)("defs",null,(0,s.createElement)("filter",{id:t},(0,s.createElement)("feColorMatrix",{type:"matrix",values:".299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 0 0 0 1 0"}),(0,s.createElement)("feComponentTransfer",{colorInterpolationFilters:"sRGB"},(0,s.createElement)("feFuncR",{type:"table",tableValues:n.r.join(" ")}),(0,s.createElement)("feFuncG",{type:"table",tableValues:n.g.join(" ")}),(0,s.createElement)("feFuncB",{type:"table",tableValues:n.b.join(" ")}))))),(0,s.createElement)("style",{dangerouslySetInnerHTML:{__html:o}}))}function Ag({attributes:e,setAttributes:t}){var n;const o=null==e?void 0:e.style,r=null==o||null===(n=o.color)||void 0===n?void 0:n.duotone,l=fo("color.duotone")||Rg,i=fo("color.palette")||Rg,a=!fo("color.custom"),c=!fo("color.customDuotone")||0===(null==i?void 0:i.length)&&a;return 0===(null==l?void 0:l.length)&&c?null:(0,s.createElement)(eo,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(Pg,{duotonePalette:l,colorPalette:i,disableCustomDuotone:c,disableCustomColors:a,value:r,onChange:e=>{const n={...o,color:{...null==o?void 0:o.color,duotone:e}};t({style:n})}}))}Rc([Mc]);const Dg=(0,d.createHigherOrderComponent)((e=>t=>{const n=(0,r.hasBlockSupport)(t.name,"color.__experimentalDuotone");return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(e,t),n&&(0,s.createElement)(Ag,t))}),"withDuotoneControls"),Og=(0,d.createHigherOrderComponent)((e=>t=>{var n,o,l;const a=(0,r.getBlockSupport)(t.name,"color.__experimentalDuotone"),u=null==t||null===(n=t.attributes)||void 0===n||null===(o=n.style)||void 0===o||null===(l=o.color)||void 0===l?void 0:l.duotone;if(!a||!u)return(0,s.createElement)(e,t);const p=`wp-duotone-${(0,d.useInstanceId)(e)}`,m=function(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(", ")}(`.editor-styles-wrapper .${p}`,a),f=c()(null==t?void 0:t.className,p),g=(0,s.useContext)(Kp.__unstableElementContext);return(0,s.createElement)(s.Fragment,null,g&&(0,s.createPortal)((0,s.createElement)(Lg,{selector:m,id:p,values:Mg(u)}),g),(0,s.createElement)(e,i({},t,{className:f})))}),"withDuotoneStyles");(0,l.addFilter)("blocks.registerBlockType","core/editor/duotone/add-attributes",(function(e){return(0,r.hasBlockSupport)(e,"color.__experimentalDuotone")?(e.attributes.style||Object.assign(e.attributes,{style:{type:"object"}}),e):e})),(0,l.addFilter)("editor.BlockEdit","core/editor/duotone/with-editor-controls",Dg),(0,l.addFilter)("editor.BlockListBlock","core/editor/duotone/with-styles",Og);const Fg="__experimentalLayout";function zg({setAttributes:e,attributes:t,name:n}){const{layout:o}=t,l=fo("layout"),i=(0,m.useSelect)((e=>{const{getSettings:t}=e(Wn);return t().supportsLayout}),[]),a=(0,r.getBlockSupport)(n,Fg,{}),{allowSwitching:c,allowEditing:u=!0,allowInheriting:d=!0,default:f}=a;if(!u)return null;const h=o||f||{},{inherit:b=!1,type:v="default"}=h;if("default"===v&&!i)return null;const k=wo(v),_=t=>e({layout:t});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Xo,null,(0,s.createElement)(p.PanelBody,{title:(0,g.__)("Layout")},d&&!!l&&(0,s.createElement)(p.ToggleControl,{label:(0,g.__)("Inherit default layout"),checked:!!b,onChange:()=>e({layout:{inherit:!b}})}),!b&&c&&(0,s.createElement)(Vg,{type:v,onChange:t=>e({layout:{type:t}})}),!b&&k&&(0,s.createElement)(k.inspectorControls,{layout:h,onChange:_,layoutBlockSupport:a}))),!b&&k&&(0,s.createElement)(k.toolBarControls,{layout:h,onChange:_,layoutBlockSupport:a}))}function Vg({type:e,onChange:t}){return(0,s.createElement)(p.ButtonGroup,null,So.map((({name:n,label:o})=>(0,s.createElement)(p.Button,{key:n,isPressed:e===n,onClick:()=>t(n)},o))))}const Hg=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n}=t;return[(0,r.hasBlockSupport)(n,Fg)&&(0,s.createElement)(zg,i({key:"layout"},t)),(0,s.createElement)(e,i({key:"edit"},t))]}),"withInspectorControls"),Ug=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n,attributes:o}=t,l=(0,r.hasBlockSupport)(n,Fg),a=(0,d.useInstanceId)(e),u=fo("layout")||{},p=(0,s.useContext)(Kp.__unstableElementContext),{layout:m}=o,{default:f}=(0,r.getBlockSupport)(n,Fg)||{},g=null!=m&&m.inherit?u:m||f||{},h=c()(null==t?void 0:t.className,{[`wp-container-${a}`]:l});return(0,s.createElement)(s.Fragment,null,l&&p&&(0,s.createPortal)((0,s.createElement)(To,{selector:`.wp-container-${a}`,layout:g}),p),(0,s.createElement)(e,i({},t,{className:h})))}));(0,l.addFilter)("blocks.registerBlockType","core/layout/addAttribute",(function(e){return(0,u.has)(e.attributes,["layout","type"])||(0,r.hasBlockSupport)(e,Fg)&&(e.attributes={...e.attributes,layout:{type:"object"}}),e})),(0,l.addFilter)("editor.BlockListBlock","core/editor/layout/with-layout-styles",Ug),(0,l.addFilter)("editor.BlockEdit","core/editor/layout/with-inspector-controls",Hg);const Gg=[];function Wg({borderColor:e,style:t}){var n;const o=(null==t?void 0:t.border)||{},r=Qp("border-color",e);return{className:c()({[r]:!!r,"has-border-color":e||(null==t||null===(n=t.border)||void 0===n?void 0:n.color)})||void 0,style:wg({border:o})}}function $g(e){const t=fo("color.palette")||Gg,n=Wg(e);if(e.borderColor){const o=Zp(t,e.borderColor);n.style.borderColor=o.color}return n}const jg=[];function Kg(e){var t,n,o,r,l,i;const{backgroundColor:s,textColor:a,gradient:u,style:d}=e,p=Qp("background-color",s),m=Qp("color",a),f=em(u),g=f||(null==d||null===(t=d.color)||void 0===t?void 0:t.gradient);return{className:c()(m,f,{[p]:!g&&!!p,"has-text-color":a||(null==d||null===(n=d.color)||void 0===n?void 0:n.text),"has-background":s||(null==d||null===(o=d.color)||void 0===o?void 0:o.background)||u||(null==d||null===(r=d.color)||void 0===r?void 0:r.gradient),"has-link-color":null==d||null===(l=d.elements)||void 0===l||null===(i=l.link)||void 0===i?void 0:i.color})||void 0,style:wg({color:(null==d?void 0:d.color)||{}})}}function qg(e){const{backgroundColor:t,textColor:n,gradient:o}=e,r=fo("color.palette")||jg,l=fo("color.gradients")||jg,i=Kg(e);if(t){const e=Zp(r,t);i.style.backgroundColor=e.color}if(o&&(i.style.background=tm(l,o)),n){const e=Zp(r,n);i.style.color=e.color}return i}function Yg(e){const{style:t}=e;return{style:wg({spacing:(null==t?void 0:t.spacing)||{}})}}function Zg(e){const[t,n]=(0,s.useState)(e);return(0,s.useEffect)((()=>{e&&n(e)}),[e]),t}const Xg=[];function Qg(e,t){const n=(0,u.reduce)(e,((e,t)=>({...e,...(0,u.isString)(t)?{[t]:(0,u.kebabCase)(t)}:t})),{});return(0,d.compose)([t,e=>class extends s.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=Nc(t);return(0,u.maxBy)(e,(({color:e})=>n.contrast(e))).color}(t,e)}createSetters(){return(0,u.reduce)(n,((e,t,n)=>{const o=(0,u.upperFirst)(n),r=`custom${o}`;return e[`set${o}`]=this.createSetColor(n,r),e}),{})}createSetColor(e,t){return n=>{const o=Xp(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},o){return(0,u.reduce)(n,((n,r,l)=>{const i=Zp(t,e[l],e[`custom${(0,u.upperFirst)(l)}`]),s=o[l];return(null==s?void 0:s.color)===i.color&&s?n[l]=s:n[l]={...i,class:Qp(r,i.slug)},n}),{})}render(){return(0,s.createElement)(e,i({},this.props,{colors:void 0},this.state,this.setters,{colorUtils:this.colorUtils}))}}])}function Jg(e){return(...t)=>{const n=(e=>(0,d.createHigherOrderComponent)((t=>n=>(0,s.createElement)(t,i({},n,{colors:e}))),"withCustomColorPalette"))(e);return(0,d.createHigherOrderComponent)(Qg(t,n),"withCustomColors")}}function eh(...e){const t=(0,d.createHigherOrderComponent)((e=>t=>{const n=fo("color.palette")||Xg;return(0,s.createElement)(e,i({},t,{colors:n}))}),"withEditorColorPalette");return(0,d.createHigherOrderComponent)(Qg(e,t),"withColors")}const th=[];var nh=(...e)=>{const t=(0,u.reduce)(e,((e,t)=>(e[t]=`custom${(0,u.upperFirst)(t)}`,e)),{});return(0,d.createHigherOrderComponent)((0,d.compose)([(0,d.createHigherOrderComponent)((e=>t=>{const n=fo("typography.fontSizes")||th;return(0,s.createElement)(e,i({},t,{fontSizes:n}))}),"withFontSizes"),e=>class extends s.Component{constructor(e){super(e),this.setters=this.createSetters(),this.state={}}createSetters(){return(0,u.reduce)(t,((e,t,n)=>(e[`set${(0,u.upperFirst)(n)}`]=this.createSetFontSize(n,t),e)),{})}createSetFontSize(e,t){return n=>{const o=(0,u.find)(this.props.fontSizes,{size: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(!(0,u.some)(t,r))return null;const l=(0,u.reduce)((0,u.pickBy)(t,r),((t,o,r)=>{const l=e[r],i=Gf(n,l,e[o]);return t[r]={...i,class:$f(l)},t}),{});return{...o,...l}}render(){return(0,s.createElement)(e,i({},this.props,{fontSizes:void 0},this.state,this.setters))}}]),"withFontSizes")},oh=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z"})),rh=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M16.4 4.2H7.6v1.5h8.9V4.2zM4 11.2v1.5h16v-1.5H4zm3.6 8.6h8.9v-1.5H7.6v1.5z"})),lh=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z"}));const ih=[{icon:oh,title:(0,g.__)("Align text left"),align:"left"},{icon:rh,title:(0,g.__)("Align text center"),align:"center"},{icon:lh,title:(0,g.__)("Align text right"),align:"right"}],sh={position:"bottom right",isAlternate:!0};var ah=function({value:e,onChange:t,alignmentControls:n=ih,label:o=(0,g.__)("Align"),describedBy:r=(0,g.__)("Change text alignment"),isCollapsed:l=!0,isToolbar:a}){function c(n){return()=>t(e===n?void 0:n)}const d=(0,u.find)(n,(t=>t.align===e)),m=a?p.ToolbarGroup:p.ToolbarDropdownMenu,f=a?{isCollapsed:l}:{};return(0,s.createElement)(m,i({icon:d?d.icon:(0,g.isRTL)()?lh:oh,label:o,toggleProps:{describedBy:r,className:d?"is-pressed":void 0},popoverProps:sh,controls:n.map((t=>{const{align:n}=t,o=e===n;return{...t,isActive:o,role:l?"menuitemradio":void 0,onClick:c(n)}}))},f))};function ch(e){return(0,s.createElement)(ah,i({},e,{isToolbar:!1}))}function uh(e){return(0,s.createElement)(ah,i({},e,{isToolbar:!0}))}var dh={name:"blocks",className:"block-editor-autocompleters__block",triggerPrefix:"/",useItems(e){const{rootClientId:t,selectedBlockName:n}=(0,m.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockName:n,getBlockInsertionPoint:o}=e(Wn),r=t();return{selectedBlockName:r?n(r):null,rootClientId:o().rootClientId}}),[]),[o,r,l]=ku(t,u.noop),i=(0,s.useMemo)((()=>(e.trim()?Ku(o,r,l,e):(0,u.orderBy)(o,["frecency"],["desc"])).filter((e=>e.name!==n)).slice(0,9)),[e,n,o,r,l]);return[(0,s.useMemo)((()=>i.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)(za,{key:"icon",icon:n,showColors:!0}),t),isDisabled:o}}))),[i])]},allowContext:(e,t)=>!(/\S/.test(e)||/\S/.test(t)),getOptionCompletion(e){const{name:t,initialAttributes:n,innerBlocks:o}=e;return{action:"replace",value:(0,r.createBlock)(t,n,(0,r.createBlocksFromInnerBlocksTemplate)(o))}}};const ph=[];function mh({completers:e=ph}){const{name:t}=qn();return(0,s.useMemo)((()=>{let n=e;return(t===(0,r.getDefaultBlockName)()||(0,r.getBlockSupport)(t,"__experimentalSlashInserter",!1))&&(n=n.concat([dh])),(0,l.hasFilter)("editor.Autocomplete.completers")&&(n===e&&(n=n.map(u.clone)),n=(0,l.applyFilters)("editor.Autocomplete.completers",n,t)),n}),[e,t])}var fh=function(e){return(0,s.createElement)(p.Autocomplete,i({},e,{completers:mh(e)}))},gh=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M4.2 9h1.5V5.8H9V4.2H4.2V9zm14 9.2H15v1.5h4.8V15h-1.5v3.2zM15 4.2v1.5h3.2V9h1.5V4.2H15zM5.8 15H4.2v4.8H9v-1.5H5.8V15z"})),hh=function({isActive:e,label:t=(0,g.__)("Toggle full height"),onToggle:n,isDisabled:o}){return(0,s.createElement)(p.ToolbarButton,{isActive:e,icon:gh,label:t,onClick:()=>n(!e),disabled:o})},bh=function(e){const{label:t=(0,g.__)("Change matrix alignment"),onChange:n=u.noop,value:o="center",isDisabled:r}=e,l=(0,s.createElement)(p.__experimentalAlignmentMatrixControl.Icon,{value:o}),i="block-editor-block-alignment-matrix-control",a=`${i}__popover`;return(0,s.createElement)(p.Dropdown,{position:"bottom right",className:i,popoverProps:{className:a,isAlternate:!0},renderToggle:({onToggle:e,isOpen:n})=>(0,s.createElement)(p.ToolbarButton,{onClick:e,"aria-haspopup":"true","aria-expanded":n,onKeyDown:t=>{n||t.keyCode!==fa.DOWN||(t.preventDefault(),e())},label:t,icon:l,showTooltip:!0,disabled:r}),renderContent:()=>(0,s.createElement)(p.__experimentalAlignmentMatrixControl,{hasFocusBorder:!1,onChange:n,value:o})})},vh=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"})),kh=function({rootLabelText:e}){const{selectBlock:t,clearSelectedBlock:n}=(0,m.useDispatch)(Wn),{clientId:o,parents:r,hasSelection:l}=(0,m.useSelect)((e=>{const{getSelectionStart:t,getSelectedBlockClientId:n,getBlockParents:o}=e(Wn),r=n();return{parents:o(r),clientId:r,hasSelection:!!t().clientId}}),[]),i=e||(0,g.__)("Document");return(0,s.createElement)("ul",{className:"block-editor-block-breadcrumb",role:"list","aria-label":(0,g.__)("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)(p.Button,{className:"block-editor-block-breadcrumb__button",variant:"tertiary",onClick:n},i),!l&&i,!!o&&(0,s.createElement)(Co,{icon:vh,className:"block-editor-block-breadcrumb__separator"})),r.map((e=>(0,s.createElement)("li",{key:e},(0,s.createElement)(p.Button,{className:"block-editor-block-breadcrumb__button",variant:"tertiary",onClick:()=>t(e)},(0,s.createElement)(_d,{clientId:e})),(0,s.createElement)(Co,{icon:vh,className:"block-editor-block-breadcrumb__separator"})))),!!o&&(0,s.createElement)("li",{className:"block-editor-block-breadcrumb__current","aria-current":"true"},(0,s.createElement)(_d,{clientId:o})))};function _h({clientId:e,tagName:t="div",wrapperProps:n,className:o}){const[r,l]=(0,s.useState)(!0),[a,u]=(0,s.useState)(!1),{isParentSelected:d,hasChildSelected:p,isDraggingBlocks:f,isParentHighlighted:g}=(0,m.useSelect)((t=>{const{isBlockSelected:n,hasSelectedInnerBlock:o,isDraggingBlocks:r,isBlockHighlighted:l}=t(Wn);return{isParentSelected:n(e),hasChildSelected:o(e,!0),isDraggingBlocks:r(),isParentHighlighted:l(e)}}),[e]),h=c()("block-editor-block-content-overlay",null==n?void 0:n.className,o,{"overlay-active":r,"parent-highlighted":g,"is-dragging-blocks":f});return(0,s.useEffect)((()=>{d||p||r||l(!0),d&&!a&&r&&l(!1),p&&r&&l(!1)}),[d,p,r,a]),(0,s.createElement)(t,i({},n,{className:h,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onMouseUp:r?()=>l(!1):void 0}),null==n?void 0:n.children)}const yh=()=>(0,s.createElement)(p.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 20 20"},(0,s.createElement)(p.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"})),Eh=({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)(yh,null))),Ch=({TextColor:e,BackgroundColor:t})=>({onToggle:n,isOpen:o})=>(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(p.ToolbarButton,{className:"components-toolbar__control block-library-colors-selector__toggle",label:(0,g.__)("Open Colors Selector"),onClick:n,onKeyDown:e=>{o||e.keyCode!==fa.DOWN||(e.preventDefault(),n())},icon:(0,s.createElement)(t,null,(0,s.createElement)(e,null,(0,s.createElement)(Eh,null)))}));var Sh=({children:e,...t})=>(0,s.createElement)(p.Dropdown,{position:"bottom right",className:"block-library-colors-selector",contentClassName:"block-library-colors-selector__popover",renderToggle:Ch(t),renderContent:()=>e}),wh=(0,s.createElement)(F.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(F.Path,{d:"M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"}));const Bh=Js(p.__experimentalTreeGridRow);function Ih({isSelected:e,position:t,level:n,rowCount:o,children:r,className:l,path:a,...u}){const d=na({isSelected:e,adjustScrolling:!1,enableAnimation:!0,triggerAnimationOnChange:a.join("_")});return(0,s.createElement)(Bh,i({ref:d,className:c()("block-editor-list-view-leaf",l),level:n,positionInSet:t,setSize:o},u),r)}const xh=(e,t)=>(0,u.isArray)(t)&&t.length?-1!==t.indexOf(e):t===e;function Th({onClick:e}){return(0,s.createElement)("span",{className:"block-editor-list-view__expander",onClick:t=>e(t,{forceToggle:!0}),"aria-hidden":"true"},(0,s.createElement)(Co,{icon:vh}))}var Nh=(0,s.forwardRef)((function e({className:t,block:{clientId:n},isSelected:o,onClick:r,onToggleExpanded:l,position:i,siblingBlockCount:a,level:u,tabIndex:m,onFocus:f,onDragStart:h,onDragEnd:b,draggable:v},k){const _=kd(n),y=`list-view-block-select-button__${(0,d.useInstanceId)(e)}`,E=((e,t,n)=>(0,g.sprintf)(
|
| 61 |
/* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */
|
| 62 |
-
(0,g.__)("Block %1$d of %2$d, Level %3$d"),e,t,n))(i,a,u);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.Button,{className:c()("block-editor-list-view-block-select-button",t),onClick:r,"aria-describedby":y,ref:k,tabIndex:m,onFocus:f,onDragStart:h,onDragEnd:b,draggable:v},(0,s.createElement)(Th,{onClick:l}),(0,s.createElement)(za,{icon:null==_?void 0:_.icon,showColors:!0}),(0,s.createElement)(_d,{clientId:n}),(null==_?void 0:_.anchor)&&(0,s.createElement)("span",{className:"block-editor-list-view-block-select-button__anchor"},_.anchor),o&&(0,s.createElement)(p.VisuallyHidden,null,(0,g.__)("(selected block)"))),(0,s.createElement)("div",{className:"block-editor-list-view-block-select-button__description",id:y},E))})),Ph=(0,s.forwardRef)((({onClick:e,onToggleExpanded:t,block:n,isSelected:o,position:r,siblingBlockCount:l,level:a,...u},d)=>{const{clientId:p}=n,{blockMovingClientId:f,selectedBlockInBlockEditor:g}=(0,m.useSelect)((e=>{const{getBlockRootClientId:t,hasBlockMovingClientId:n,getSelectedBlockClientId:o}=e(Wn);return{rootClientId:t(p)||"",blockMovingClientId:n(),selectedBlockInBlockEditor:o()}}),[p]),h=f&&g===p,b=c()("block-editor-list-view-block-contents",{"is-dropping-before":h});return(0,s.createElement)(yd,{clientIds:[n.clientId]},(({draggable:c,onDragStart:p,onDragEnd:m})=>(0,s.createElement)(Nh,i({ref:d,className:b,block:n,onClick:e,onToggleExpanded:t,isSelected:o,position:r,siblingBlockCount:l,level:a,draggable:c,onDragStart:p,onDragEnd:m},u))))}));const Rh=(0,s.createContext)({__experimentalFeatures:!1,__experimentalPersistentListViewFeatures:!1}),Mh=()=>(0,s.useContext)(Rh);function Lh({block:e,isSelected:t,isDragged:n,isBranchSelected:o,isLastOfSelectedBranch:r,onClick:l,onToggleExpanded:i,position:a,level:u,rowCount:d,siblingBlockCount:f,showBlockMovers:g,path:h,isExpanded:b}){const v=(0,s.useRef)(null),[k,_]=(0,s.useState)(!1),{clientId:y}=e,{toggleBlockHighlight:E}=(0,m.useDispatch)(Wn),C=g&&f>0,S=c()("block-editor-list-view-block__mover-cell",{"is-visible":k||t}),{__experimentalFeatures:w,__experimentalPersistentListViewFeatures:B,isTreeGridMounted:I}=Mh(),x=c()("block-editor-list-view-block__menu-cell",{"is-visible":k||t});(0,s.useEffect)((()=>{B&&!I&&t&&v.current.focus()}),[]);const T=B?E:()=>{},N=()=>{_(!0),T(y,!0)},P=()=>{_(!1),T(y,!1)},R=c()({"is-selected":t,"is-branch-selected":B&&o,"is-last-of-selected-branch":B&&r,"is-dragging":n});return(0,s.createElement)(Ih,{className:R,onMouseEnter:N,onMouseLeave:P,onFocus:N,onBlur:P,level:u,position:a,rowCount:d,path:h,id:`list-view-block-${y}`,"data-block":y,isExpanded:b},(0,s.createElement)(p.__experimentalTreeGridCell,{className:"block-editor-list-view-block__contents-cell",colSpan:C?void 0:2,ref:v},(({ref:n,tabIndex:o,onFocus:r})=>(0,s.createElement)("div",{className:"block-editor-list-view-block__contents-container"},(0,s.createElement)(Ph,{block:e,onClick:l,onToggleExpanded:i,isSelected:t,position:a,siblingBlockCount:f,level:u,ref:n,tabIndex:o,onFocus:r})))),C&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.__experimentalTreeGridCell,{className:S,withoutGridItem:!0},(0,s.createElement)(p.__experimentalTreeGridItem,null,(({ref:e,tabIndex:t,onFocus:n})=>(0,s.createElement)(Rd,{orientation:"vertical",clientIds:[y],ref:e,tabIndex:t,onFocus:n}))),(0,s.createElement)(p.__experimentalTreeGridItem,null,(({ref:e,tabIndex:t,onFocus:n})=>(0,s.createElement)(Md,{orientation:"vertical",clientIds:[y],ref:e,tabIndex:t,onFocus:n}))))),w&&(0,s.createElement)(p.__experimentalTreeGridCell,{className:x},(({ref:e,tabIndex:t,onFocus:n})=>(0,s.createElement)(yp,{clientIds:[y],icon:op,toggleProps:{ref:e,className:"block-editor-list-view-block__menu",tabIndex:t,onFocus:n},disableOpenOnArrowDown:!0,__experimentalSelectBlock:l}))))}function Ah({parentBlockClientId:e,position:t,level:n,rowCount:o,path:r}){const l=(0,m.useSelect)((t=>{const{isBlockBeingDragged:n,isAncestorBeingDragged:o}=t(Wn);return n(e)||o(e)}),[e]),i=`list-view-appender-row__description_${(0,d.useInstanceId)(Ah)}`,a=(0,g.sprintf)(
|
| 63 |
-
/* translators: 1: The numerical position of the block that will be inserted. 2: The level of nesting for the block that will be inserted. */
|
| 64 |
-
(0,g.__)("Add block at position %1$d, Level %2$d"),t,n);return(0,s.createElement)(Ih,{className:c()({"is-dragging":l}),level:n,position:t,rowCount:o,path:r},(0,s.createElement)(p.__experimentalTreeGridCell,{className:"block-editor-list-view-appender__cell",colSpan:"3"},(({ref:t,tabIndex:n,onFocus:o})=>(0,s.createElement)("div",{className:"block-editor-list-view-appender__container"},(0,s.createElement)(id,{rootClientId:e,__experimentalIsQuick:!0,"aria-describedby":i,toggleProps:{ref:t,tabIndex:n,onFocus:o}}),(0,s.createElement)("div",{className:"block-editor-list-view-appender__description",id:i},a)))))}function Dh(e){const{blocks:t,selectBlock:n,showAppender:o,showBlockMovers:r,showNestedBlocks:l,parentBlockClientId:i,level:a=1,terminatedLevels:c=[],path:d=[],isBranchSelected:p=!1,isLastOfBranch:f=!1}=e,{expandedState:g,expand:h,collapse:b,draggedClientIds:v,selectedClientIds:k}=Mh(),_=!i,y=(0,u.compact)(t),E=e=>o&&!_&&xh(e,k),C=E(i),S=y.length,w=C?S+1:S,B=w;return(0,s.createElement)(s.Fragment,null,(0,u.map)(y,((e,t)=>{var i;const{clientId:u,innerBlocks:_}=e,y=t+1,C=w===y?[...c,a]:c,B=[...d,y],I=l&&!!_&&!!_.length,x=E(u),T=I||x,N=xh(u,k),P=p||N&&T,R=t===S-1,M=N||f&&R,L=f&&!T&&R,A=T?null===(i=g[u])||void 0===i||i:void 0,D=!(null==v||!v.includes(u));return(0,s.createElement)(m.AsyncModeProvider,{key:u,value:!N},(0,s.createElement)(Lh,{block:e,onClick:e=>{e.stopPropagation(),n(u)},onToggleExpanded:e=>{e.stopPropagation(),!0===A?b(u):!1===A&&h(u)},isDragged:D,isSelected:N,isBranchSelected:P,isLastOfSelectedBranch:L,level:a,position:y,rowCount:w,siblingBlockCount:S,showBlockMovers:r,terminatedLevels:c,path:B,isExpanded:A}),T&&A&&!D&&(0,s.createElement)(Dh,{blocks:_,selectBlock:n,isBranchSelected:P,isLastOfBranch:M,showAppender:o,showBlockMovers:r,showNestedBlocks:l,parentBlockClientId:u,level:a+1,terminatedLevels:C,path:B}))})),C&&(0,s.createElement)(Ah,{parentBlockClientId:i,position:w,rowCount:B,level:a,terminatedLevels:c,path:[...d,B]}))}function Oh({listViewRef:e,blockDropTarget:t}){const{rootClientId:n,clientId:o,dropPosition:r}=t||{},[l,i]=(0,s.useMemo)((()=>e.current?[n?e.current.querySelector(`[data-block="${n}"]`):void 0,o?e.current.querySelector(`[data-block="${o}"]`):void 0]:[]),[n,o]),a=i||l,c=(0,s.useCallback)((()=>{if(!l)return 0;const e=a.getBoundingClientRect();return l.querySelector(".block-editor-block-icon").getBoundingClientRect().right-e.left}),[l,a]),u=(0,s.useMemo)((()=>{if(!a)return{};const e=c();return{width:a.offsetWidth-e}}),[c,a]),d=(0,s.useCallback)((()=>{if(!a)return{};const e=a.ownerDocument,t=a.getBoundingClientRect(),n=c(),o={left:t.left+n,right:t.right,width:0,height:t.height,ownerDocument:e};return"top"===r?{...o,top:t.top,bottom:t.top}:"bottom"===r||"inside"===r?{...o,top:t.bottom,bottom:t.bottom}:{}}),[a,r,c]);return a?(0,s.createElement)(p.Popover,{noArrow:!0,animate:!1,getAnchorRect:d,focusOnMount:!1,className:"block-editor-list-view-drop-indicator"},(0,s.createElement)("div",{style:u,className:"block-editor-list-view-drop-indicator__line"})):null}function Fh(e,t){return t.left<=e.x&&t.right>=e.x&&t.top<=e.y&&t.bottom>=e.y}Dh.defaultProps={selectBlock:()=>{}};const zh=["top","bottom"];const Vh=()=>{},Hh=(e,t)=>{switch(t.type){case"expand":return{...e,[t.clientId]:!0};case"collapse":return{...e,[t.clientId]:!1};default:return e}};var Uh=(0,s.forwardRef)((function({blocks:e,showOnlyCurrentHierarchy:t,onSelect:n=Vh,__experimentalFeatures:o,__experimentalPersistentListViewFeatures:r,...l},a){const{clientIdsTree:c,selectedClientIds:u,draggedClientIds:f}=function(e,t,n){const{selectedClientIds:o,draggedClientIds:r}=(0,m.useSelect)((e=>{const{getSelectedBlockClientId:t,getSelectedBlockClientIds:o,getDraggedBlockClientIds:r}=e(Wn);return n?{selectedClientIds:o(),draggedClientIds:r()}:{selectedClientIds:t(),draggedClientIds:r()}}),[n]);return{clientIdsTree:((e,t,n)=>(0,m.useSelect)((o=>{const{getBlockHierarchyRootClientId:r,__unstableGetClientIdsTree:l,__unstableGetClientIdWithClientIdsTree:i}=o(Wn);if(e)return e;const s=t&&!Array.isArray(t);if(!n||!s)return l();const a=i(r(t));return a&&(!xh(a.clientId,t)||a.innerBlocks&&0!==a.innerBlocks.length)?[a]:l()}),[e,t,n]))(e,o,t),selectedClientIds:o,draggedClientIds:r}}(e,t,r),{selectBlock:h}=(0,m.useDispatch)(Wn),b=(0,s.useCallback)((e=>{h(e),n(e)}),[h,n]),[v,k]=(0,s.useReducer)(Hh,{}),{ref:_,target:y}=function(){const{getBlockRootClientId:e,getBlockIndex:t,getBlockCount:n,getDraggedBlockClientIds:o,canInsertBlocks:r}=(0,m.useSelect)(Wn),[l,i]=(0,s.useState)(),{rootClientId:a,blockIndex:c}=l||{},u=Dp(a,c),p=o(),f=(0,d.useThrottle)((0,s.useCallback)(((o,l)=>{const s={x:o.clientX,y:o.clientY},a=!(null==p||!p.length),c=function(e,t){let n,o,r,l;for(const i of e){if(i.isDraggedBlock)continue;const s=i.element.getBoundingClientRect(),[a,c]=Op(t,s,zh),u=Fh(t,s);if(void 0===r||a<r||u){r=a;const t=e.indexOf(i),d=e[t-1];if("top"===c&&d&&d.rootClientId===i.rootClientId&&!d.isDraggedBlock?(o=d,n="bottom",l=d.element.getBoundingClientRect()):(o=i,n=c,l=s),u)break}}if(!o)return;const i="bottom"===n;if(i&&o.canInsertDraggedBlocksAsChild&&(o.innerBlockCount>0||function(e,t){const n=t.left+t.width/2;return e.x>n}(t,l)))return{rootClientId:o.clientId,blockIndex:0,dropPosition:"inside"};if(!o.canInsertDraggedBlocksAsSibling)return;const s=i?1:0;return{rootClientId:o.rootClientId,clientId:o.clientId,blockIndex:o.blockIndex+s,dropPosition:n}}(Array.from(l.querySelectorAll("[data-block]")).map((o=>{const l=o.dataset.block,i=e(l);return{clientId:l,rootClientId:i,blockIndex:t(l,i),element:o,isDraggedBlock:!!a&&p.includes(l),innerBlockCount:n(l),canInsertDraggedBlocksAsSibling:!a||r(p,i),canInsertDraggedBlocksAsChild:!a||r(p,l)}})),s);c&&i(c)}),[p]),200);return{ref:(0,d.__experimentalUseDropZone)({onDrop:u,onDragOver(e){f(e,e.currentTarget)},onDragEnd(){f.cancel(),i(null)}}),target:l}}(),E=(0,s.useRef)(),C=(0,d.useMergeRefs)([E,_,a]),S=(0,s.useRef)(!1);(0,s.useEffect)((()=>{S.current=!0}),[]);const w=(0,s.useCallback)((e=>{e&&k({type:"expand",clientId:e})}),[k]),B=(0,s.useCallback)((e=>{e&&k({type:"collapse",clientId:e})}),[k]),I=(0,s.useMemo)((()=>({__experimentalFeatures:o,__experimentalPersistentListViewFeatures:r,isTreeGridMounted:S.current,draggedClientIds:f,selectedClientIds:u,expandedState:v,expand:w,collapse:B})),[o,r,S.current,f,u,v,w,B]);return(0,s.createElement)(m.AsyncModeProvider,{value:!0},(0,s.createElement)(Oh,{listViewRef:E,blockDropTarget:y}),(0,s.createElement)(p.__experimentalTreeGrid,{className:"block-editor-list-view-tree","aria-label":(0,g.__)("Block navigation structure"),ref:C,onCollapseRow:e=>{var t;B(null==e||null===(t=e.dataset)||void 0===t?void 0:t.block)},onExpandRow:e=>{var t;w(null==e||null===(t=e.dataset)||void 0===t?void 0:t.block)}},(0,s.createElement)(Rh.Provider,{value:I},(0,s.createElement)(Dh,i({blocks:c,selectBlock:b},l)))))}));function Gh({isEnabled:e,onToggle:t,isOpen:n,innerRef:o,...r}){return(0,s.createElement)(p.Button,i({},r,{ref:o,icon:wh,"aria-expanded":n,"aria-haspopup":"true",onClick:e?t:void 0
|
| 65 |
-
/* translators: button label text should, if possible, be under 16 characters. */,label:(0,g.__)("List view"),className:"block-editor-block-navigation","aria-disabled":!e}))}var Wh=(0,s.forwardRef)((function({isDisabled:e,__experimentalFeatures:t,...n},o){const r=(0,m.useSelect)((e=>!!e(Wn).getBlockCount()),[])&&!e;return(0,s.createElement)(p.Dropdown,{contentClassName:"block-editor-block-navigation__popover",position:"bottom right",renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(Gh,i({},n,{innerRef:o,isOpen:e,onToggle:t,isEnabled:r})),renderContent:()=>(0,s.createElement)("div",{className:"block-editor-block-navigation__container"},(0,s.createElement)("p",{className:"block-editor-block-navigation__label"},(0,g.__)("List view")),(0,s.createElement)(Uh,{showNestedBlocks:!0,showOnlyCurrentHierarchy:!0,__experimentalFeatures:t}))})})),$h=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),jh=function({icon:e=$h,label:t=(0,g.__)("Choose variation"),instructions:n=(0,g.__)("Select a variation to start with."),variations:o,onSelect:r,allowSkip:l}){const i=c()("block-editor-block-variation-picker",{"has-many-variations":o.length>4});return(0,s.createElement)(p.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,g.__)("Block variations")},o.map((e=>(0,s.createElement)("li",{key:e.name},(0,s.createElement)(p.Button,{variant:"secondary",icon: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",role:"presentation"},e.title))))),l&&(0,s.createElement)("div",{className:"block-editor-block-variation-picker__skip"},(0,s.createElement)(p.Button,{variant:"link",onClick:()=>r()},(0,g.__)("Skip"))))},Kh=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z",fillRule:"evenodd",clipRule:"evenodd"}));const qh="carousel",Yh="grid",Zh=({onStartBlank:e,onBlockPatternSelect:t})=>(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__actions"},(0,s.createElement)(p.Button,{onClick:e},(0,g.__)("Start blank")),(0,s.createElement)(p.Button,{variant:"primary",onClick:t},(0,g.__)("Choose"))),Xh=({handlePrevious:e,handleNext:t,activeSlide:n,totalSlides:o})=>(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__navigation"},(0,s.createElement)(p.Button,{icon:Bd,label:(0,g.__)("Previous pattern"),onClick:e,disabled:0===n}),(0,s.createElement)(p.Button,{icon:wd,label:(0,g.__)("Next pattern"),onClick:t,disabled:n===o-1}));var Qh=({viewMode:e,setViewMode:t,handlePrevious:n,handleNext:o,activeSlide:r,totalSlides:l,onBlockPatternSelect:i,onStartBlank:a})=>{const c=e===qh,u=(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__display-controls"},(0,s.createElement)(p.Button,{icon:io,label:(0,g.__)("Carousel view"),onClick:()=>t(qh),isPressed:c}),(0,s.createElement)(p.Button,{icon:Kh,label:(0,g.__)("Grid view"),onClick:()=>t(Yh),isPressed:e===Yh}));return(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__toolbar"},c&&(0,s.createElement)(Xh,{handlePrevious:n,handleNext:o,activeSlide:r,totalSlides:l}),u,c&&(0,s.createElement)(Zh,{onBlockPatternSelect:i,onStartBlank:a}))};const Jh=({viewMode:e,activeSlide:t,patterns:n,onBlockPatternSelect:o})=>{const r=(0,p.__unstableUseCompositeState)(),l="block-editor-block-pattern-setup__container";if(e===qh){const e=new Map([[t,"active-slide"],[t-1,"previous-slide"],[t+1,"next-slide"]]);return(0,s.createElement)("div",{className:l},(0,s.createElement)("ul",{className:"carousel-container"},n.map(((t,n)=>(0,s.createElement)(tb,{className:e.get(n)||"",key:t.name,pattern:t})))))}return(0,s.createElement)(p.__unstableComposite,i({},r,{role:"listbox",className:l,"aria-label":(0,g.__)("Patterns list")}),n.map((e=>(0,s.createElement)(eb,{key:e.name,pattern:e,onSelect:o,composite:r}))))};function eb({pattern:e,onSelect:t,composite:n}){const o="block-editor-block-pattern-setup-list",{blocks:r,title:l,description:a,viewportWidth:c=700}=e,u=(0,d.useInstanceId)(eb,`${o}__item-description`);return(0,s.createElement)("div",{className:`${o}__list-item`,"aria-label":e.title,"aria-describedby":e.description?u:void 0},(0,s.createElement)(p.__unstableCompositeItem,i({role:"option",as:"div"},n,{className:`${o}__item`,onClick:()=>t(r)}),(0,s.createElement)(iu,{blocks:r,viewportWidth:c}),(0,s.createElement)("div",{className:`${o}__item-title`},l)),!!a&&(0,s.createElement)(p.VisuallyHidden,{id:u},a))}function tb({className:e,pattern:t}){const{blocks:n,title:o,description:r}=t,l=(0,d.useInstanceId)(tb,"block-editor-block-pattern-setup-list__item-description");return(0,s.createElement)("li",{className:`pattern-slide ${e}`,"aria-label":o,"aria-describedby":r?l:void 0},(0,s.createElement)(iu,{blocks:n,__experimentalLive:!0}),!!r&&(0,s.createElement)(p.VisuallyHidden,{id:l},r))}var nb=({clientId:e,blockName:t,filterPatternsFn:n,startBlankComponent:o,onBlockPatternSelect:l})=>{const[i,a]=(0,s.useState)(qh),[c,u]=(0,s.useState)(0),[d,p]=(0,s.useState)(!1),{replaceBlock:f}=(0,m.useDispatch)(Wn),g=function(e,t,n){return(0,m.useSelect)((o=>{const{getBlockRootClientId:r,__experimentalGetPatternsByBlockTypes:l,__experimentalGetAllowedPatterns:i}=o(Wn),s=r(e);return n?i(s).filter(n):l(t,s)}),[e,t,n])}(e,t,n);if(null==g||!g.length||d)return o;const h=l||(t=>{const n=t.map((e=>(0,r.cloneBlock)(e)));f(e,n)});return(0,s.createElement)("div",{className:`block-editor-block-pattern-setup view-mode-${i}`},(0,s.createElement)(Qh,{viewMode:i,setViewMode:a,activeSlide:c,totalSlides:g.length,handleNext:()=>{u((e=>e+1))},handlePrevious:()=>{u((e=>e-1))},onBlockPatternSelect:()=>{h(g[c].blocks)},onStartBlank:()=>{p(!0)}}),(0,s.createElement)(Jh,{viewMode:i,activeSlide:c,patterns:g,onBlockPatternSelect:h}))};const ob=(e,t)=>{if(!t||!e)return;const n=t.filter((({attributes:t})=>!(!t||!Object.keys(t).length)&&(0,u.isMatch)(e,t)));return 1===n.length?n[0]:void 0};var rb=function({blockClientId:e}){const[t,n]=(0,s.useState)(),{updateBlockAttributes:o}=(0,m.useDispatch)(Wn),{variations:l,blockAttributes:i}=(0,m.useSelect)((t=>{const{getBlockVariations:n}=t(r.store),{getBlockName:o,getBlockAttributes:l}=t(Wn),i=e&&o(e);return{variations:i&&n(i,"transform"),blockAttributes:l(e)}}),[e]);if((0,s.useEffect)((()=>{var e;n(null===(e=ob(i,l))||void 0===e?void 0:e.name)}),[i,l]),null==l||!l.length)return null;const a=l.map((({name:e,title:t,description:n})=>({value:e,label:t,info:n}))),c=t=>{o(e,{...l.find((({name:e})=>e===t)).attributes})},u="block-editor-block-variation-transforms";return(0,s.createElement)(p.DropdownMenu,{className:u,label:(0,g.__)("Transform to variation"),text:(0,g.__)("Transform to variation"),popoverProps:{position:"bottom center",className:`${u}__popover`},icon:xd,toggleProps:{iconPosition:"right"}},(()=>(0,s.createElement)("div",{className:`${u}__container`},(0,s.createElement)(p.MenuGroup,null,(0,s.createElement)(p.MenuItemsChoice,{choices:a,value:t,onSelect:c})))))};const lb=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z"})),ib=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z"})),sb={top:{icon:(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M9 20h6V9H9v11zM4 4v1.5h16V4H4z"})),title:(0,g._x)("Align top","Block vertical alignment setting")},center:{icon:ib,title:(0,g._x)("Align middle","Block vertical alignment setting")},bottom:{icon:lb,title:(0,g._x)("Align bottom","Block vertical alignment setting")}},ab=["top","center","bottom"],cb={isAlternate:!0};var ub=function({value:e,onChange:t,controls:n=ab,isCollapsed:o=!0,isToolbar:r}){const l=sb[e],a=sb.top,c=r?p.ToolbarGroup:p.ToolbarDropdownMenu,u=r?{isCollapsed:o}:{};return(0,s.createElement)(c,i({popoverProps:cb,icon:l?l.icon:a.icon,label:(0,g._x)("Change vertical alignment","Block vertical alignment setting label"),controls:n.map((n=>{return{...sb[n],isActive:e===n,role:o?"menuitemradio":void 0,onClick:(r=n,()=>t(e===r?void 0:r))};var r}))},u))};function db(e){return(0,s.createElement)(ub,i({},e,{isToolbar:!1}))}function pb(e){return(0,s.createElement)(ub,i({},e,{isToolbar:!0}))}var mb=(0,d.createHigherOrderComponent)((e=>t=>{const n=fo("color.palette"),o=!fo("color.custom"),r=void 0===t.colors?n:t.colors,l=void 0===t.disableCustomColors?o:t.disableCustomColors,a=!(0,u.isEmpty)(r)||!l;return(0,s.createElement)(e,i({},t,{colors:r,disableCustomColors:l,hasColorsToChoose:a}))}),"withColorContext"),fb=mb(p.ColorPalette);function gb({onChange:e,value:t,...n}){return(0,s.createElement)(dm,i({},n,{onColorChange:e,colorValue:t,gradients:[],disableCustomGradients:!0}))}var hb=function(e,t){return(hb=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])})(e,t)},bb=function(){return(bb=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}).apply(this,arguments)};function vb(e,t,n,o){void 0===o&&(o=0);var r=Tb(e,t,o),l=r.width,i=r.height;return e>=t*n&&l>t*n?{width:t*n,height:t}:l>t*n?{width:e,height:e/n}:l>i*n?{width:i*n,height:i}:{width:l,height:l/n}}function kb(e,t,n,o,r){void 0===r&&(r=0);var l=Tb(t.width,t.height,r),i=l.width,s=l.height;return{x:_b(e.x,i,n.width,o),y:_b(e.y,s,n.height,o)}}function _b(e,t,n,o){var r=t*o/2-n/2;return Math.min(r,Math.max(e,-r))}function yb(e,t){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function Eb(e,t){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI}function Cb(e,t,n,o,r,l,i){void 0===l&&(l=0),void 0===i&&(i=!0);var s=i&&0===l?Sb:wb,a={x:s(100,((t.width-n.width/r)/2-e.x/r)/t.width*100),y:s(100,((t.height-n.height/r)/2-e.y/r)/t.height*100),width:s(100,n.width/t.width*100/r),height:s(100,n.height/t.height*100/r)},c=Math.round(s(t.naturalWidth,a.width*t.naturalWidth/100)),u=Math.round(s(t.naturalHeight,a.height*t.naturalHeight/100)),d=t.naturalWidth>=t.naturalHeight*o?{width:Math.round(u*o),height:u}:{width:c,height:Math.round(c/o)};return{croppedAreaPercentages:a,croppedAreaPixels:bb(bb({},d),{x:Math.round(s(t.naturalWidth-d.width,a.x*t.naturalWidth/100)),y:Math.round(s(t.naturalHeight-d.height,a.y*t.naturalHeight/100))})}}function Sb(e,t){return Math.min(e,Math.max(0,t))}function wb(e,t){return t}function Bb(e,t,n){var o=t.width/t.naturalWidth,r=function(e,t,n){var o=t.width/t.naturalWidth;if(n)return n.height>n.width?n.height/o/e.height:n.width/o/e.width;var r=e.width/e.height;return t.naturalWidth>=t.naturalHeight*r?t.naturalHeight/e.height:t.naturalWidth/e.width}(e,t,n),l=o*r;return{crop:{x:((t.naturalWidth-e.width)/2-e.x)*l,y:((t.naturalHeight-e.height)/2-e.y)*l},zoom:r}}function Ib(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function xb(e,t,n,o,r){var l=Math.cos,i=Math.sin,s=r*Math.PI/180;return[(e-n)*l(s)-(t-o)*i(s)+n,(e-n)*i(s)+(t-o)*l(s)+o]}function Tb(e,t,n){var o=e/2,r=t/2,l=[xb(0,0,o,r,n),xb(e,0,o,r,n),xb(e,t,o,r,n),xb(0,t,o,r,n)],i=Math.min.apply(Math,l.map((function(e){return e[0]}))),s=Math.max.apply(Math,l.map((function(e){return e[0]}))),a=Math.min.apply(Math,l.map((function(e){return e[1]})));return{width:s-i,height:Math.max.apply(Math,l.map((function(e){return e[1]})))-a}}function Nb(){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 Pb=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.imageRef=null,n.videoRef=null,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.lastPinchDistance=0,n.lastPinchRotation=0,n.rafDragTimeout=null,n.rafPinchTimeout=null,n.wheelTimer=null,n.state={cropSize:null,hasWheelJustStarted:!1},n.preventZoomSafari=function(e){return e.preventDefault()},n.cleanEvents=function(){document.removeEventListener("mousemove",n.onMouseMove),document.removeEventListener("mouseup",n.onDragStopped),document.removeEventListener("touchmove",n.onTouchMove),document.removeEventListener("touchend",n.onDragStopped)},n.clearScrollEvent=function(){n.containerRef&&n.containerRef.removeEventListener("wheel",n.onWheel),n.wheelTimer&&clearTimeout(n.wheelTimer)},n.onMediaLoad=function(){n.computeSizes(),n.emitCropData(),n.setInitialCrop(),n.props.onMediaLoaded&&n.props.onMediaLoaded(n.mediaSize)},n.setInitialCrop=function(){var e=n.props,t=e.initialCroppedAreaPixels,o=e.cropSize;if(t){var r=Bb(t,n.mediaSize,o),l=r.crop,i=r.zoom;n.props.onCropChange(l),n.props.onZoomChange&&n.props.onZoomChange(i)}},n.computeSizes=function(){var e,t,o,r,l=n.imageRef||n.videoRef;if(l){n.mediaSize={width:l.offsetWidth,height:l.offsetHeight,naturalWidth:(null===(e=n.imageRef)||void 0===e?void 0:e.naturalWidth)||(null===(t=n.videoRef)||void 0===t?void 0:t.videoWidth)||0,naturalHeight:(null===(o=n.imageRef)||void 0===o?void 0:o.naturalHeight)||(null===(r=n.videoRef)||void 0===r?void 0:r.videoHeight)||0};var i=n.props.cropSize?n.props.cropSize:vb(l.offsetWidth,l.offsetHeight,n.props.aspect,n.props.rotation);n.setState({cropSize:i},n.recomputeCropPosition)}n.containerRef&&(n.containerRect=n.containerRef.getBoundingClientRect())},n.onMouseDown=function(e){e.preventDefault(),document.addEventListener("mousemove",n.onMouseMove),document.addEventListener("mouseup",n.onDragStopped),n.onDragStart(t.getMousePoint(e))},n.onMouseMove=function(e){return n.onDrag(t.getMousePoint(e))},n.onTouchStart=function(e){e.preventDefault(),document.addEventListener("touchmove",n.onTouchMove,{passive:!1}),document.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.onDragStart=function(e){var t,o,r=e.x,l=e.y;n.dragStartPosition={x:r,y:l},n.dragStartCrop=bb({},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.rafDragTimeout&&window.cancelAnimationFrame(n.rafDragTimeout),n.rafDragTimeout=window.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?kb(l,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):l;n.props.onCropChange(i)}}))},n.onDragStopped=function(){var e,t;n.cleanEvents(),n.emitCropData(),null===(t=(e=n.props).onInteractionEnd)||void 0===t||t.call(e)},n.onWheel=function(e){e.preventDefault();var o=t.getMousePoint(e),r=n.props.zoom-e.deltaY*n.props.zoomSpeed/200;n.setNewZoom(r,o),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=window.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){if(n.state.cropSize&&n.props.onZoomChange){var o=n.getPointOnContainer(t),r=n.getPointOnMedia(o),l=Math.min(n.props.maxZoom,Math.max(e,n.props.minZoom)),i={x:r.x*l-o.x,y:r.y*l-o.y},s=n.props.restrictPosition?kb(i,n.mediaSize,n.state.cropSize,l,n.props.rotation):i;n.props.onCropChange(s),n.props.onZoomChange(l)}},n.emitCropData=function(){if(n.state.cropSize){var e=Cb(n.props.restrictPosition?kb(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),t=e.croppedAreaPercentages,o=e.croppedAreaPixels;n.props.onCropComplete&&n.props.onCropComplete(t,o)}},n.recomputeCropPosition=function(){if(n.state.cropSize){var e=n.props.restrictPosition?kb(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 __(){this.constructor=e}hb(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}(t,e),t.prototype.componentDidMount=function(){window.addEventListener("resize",this.computeSizes),this.containerRef&&(this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.preventZoomSafari),this.containerRef.addEventListener("gesturechange",this.preventZoomSafari)),this.props.disableAutomaticStylesInjection||(this.styleRef=document.createElement("style"),this.styleRef.setAttribute("type","text/css"),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}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\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 will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\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",document.head.appendChild(this.styleRef)),this.imageRef&&this.imageRef.complete&&this.onMediaLoad()},t.prototype.componentWillUnmount=function(){window.removeEventListener("resize",this.computeSizes),this.containerRef&&(this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.containerRef.removeEventListener("gesturechange",this.preventZoomSafari)),this.styleRef&&this.styleRef.remove(),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent()},t.prototype.componentDidUpdate=function(e){e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():e.cropSize!==this.props.cropSize&&this.computeSizes(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent())},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=yb(n,o),this.lastPinchRotation=Eb(n,o),this.onDragStart(Ib(n,o))},t.prototype.onPinchMove=function(e){var n=this,o=t.getTouchPoint(e.touches[0]),r=t.getTouchPoint(e.touches[1]),l=Ib(o,r);this.onDrag(l),this.rafPinchTimeout&&window.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=window.requestAnimationFrame((function(){var e=yb(o,r),t=n.props.zoom*(e/n.lastPinchDistance);n.setNewZoom(t,l),n.lastPinchDistance=e;var i=Eb(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.crop,i=l.x,s=l.y,a=t.rotation,c=t.zoom,u=t.cropShape,d=t.showGrid,p=t.style,m=p.containerStyle,f=p.cropAreaStyle,g=p.mediaStyle,h=t.classes,b=h.containerClassName,v=h.cropAreaClassName,k=h.mediaClassName;return Vr().createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(t){return e.containerRef=t},"data-testid":"container",style:m,className:Nb("reactEasyCrop_Container",b)},n?Vr().createElement("img",bb({alt:"",className:Nb("reactEasyCrop_Image",k)},r,{src:n,ref:function(t){return e.imageRef=t},style:bb(bb({},g),{transform:"translate("+i+"px, "+s+"px) rotate("+a+"deg) scale("+c+")"}),onLoad:this.onMediaLoad})):o&&Vr().createElement("video",bb({autoPlay:!0,loop:!0,muted:!0,className:Nb("reactEasyCrop_Video",k)},r,{src:o,ref:function(t){return e.videoRef=t},onLoadedMetadata:this.onMediaLoad,style:bb(bb({},g),{transform:"translate("+i+"px, "+s+"px) rotate("+a+"deg) scale("+c+")"}),controls:!1})),this.state.cropSize&&Vr().createElement("div",{style:bb(bb({},f),{width:this.state.cropSize.width,height:this.state.cropSize.height}),"data-testid":"cropper",className:Nb("reactEasyCrop_CropArea","round"===u&&"reactEasyCrop_CropAreaRound",d&&"reactEasyCrop_CropAreaGrid",v)}))},t.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:3,minZoom:1,cropShape:"rect",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}(Vr().Component);const Rb={position:"bottom right",isAlternate:!0};var Mb=window.wp.apiFetch,Lb=n.n(Mb);const Ab=(0,s.createContext)({}),Db=()=>(0,s.useContext)(Ab);function Ob({id:e,url:t,naturalWidth:n,naturalHeight:o,isEditing:r,onFinishEditing:i,onSaveImage:a,children:c}){const u=function(e,t){const n=function({url:e,naturalWidth:t,naturalHeight:n}){const[o,r]=(0,s.useState)(),[i,a]=(0,s.useState)(),[c,u]=(0,s.useState)({x:0,y:0}),[d,p]=(0,s.useState)(),[m,f]=(0,s.useState)(),[g,h]=(0,s.useState)(),[b,v]=(0,s.useState)(),k=(0,s.useCallback)((()=>{u({x:0,y:0}),p(100),f(0),h(t/n),v(t/n)}),[t,n,u,p,f,h,v]),_=(0,s.useCallback)((()=>{const o=(m+90)%360;let i=t/n;if(m%180==90&&(i=n/t),0===o)return r(),f(o),h(1/g),void u({x:-c.y*i,y:c.x*i});const s=new window.Image;s.src=e,s.onload=function(e){const t=document.createElement("canvas");let n=0,l=0;o%180?(t.width=e.target.height,t.height=e.target.width):(t.width=e.target.width,t.height=e.target.height),90!==o&&180!==o||(n=t.width),270!==o&&180!==o||(l=t.height);const s=t.getContext("2d");s.translate(n,l),s.rotate(o*Math.PI/180),s.drawImage(e.target,0,0),t.toBlob((e=>{r(URL.createObjectURL(e)),f(o),h(1/g),u({x:-c.y*i,y:c.x*i})}))};const a=(0,l.applyFilters)("media.crossOrigin",void 0,e);"string"==typeof a&&(s.crossOrigin=a)}),[m,t,n,r,f,h,u]);return(0,s.useMemo)((()=>({editedUrl:o,setEditedUrl:r,crop:i,setCrop:a,position:c,setPosition:u,zoom:d,setZoom:p,rotation:m,setRotation:f,rotateClockwise:_,aspect:g,setAspect:h,defaultAspect:b,initializeTransformValues:k})),[o,r,i,a,c,u,d,p,m,f,_,g,h,b,k])}(e),{initializeTransformValues:o}=n;return(0,s.useEffect)((()=>{t&&o()}),[t,o]),n}({url:t,naturalWidth:n,naturalHeight:o},r),d=function({crop:e,rotation:t,height:n,width:o,aspect:r,url:l,id:i,onSaveImage:a,onFinishEditing:c}){const{createErrorNotice:u}=(0,m.useDispatch)(Su.store),[d,p]=(0,s.useState)(!1),f=(0,s.useCallback)((()=>{p(!1),c()}),[p,c]),h=(0,s.useCallback)((()=>{p(!0);let s={};(e.width<99.9||e.height<99.9)&&(s=e),t>0&&(s.rotation=t),s.src=l,Lb()({path:`/wp/v2/media/${i}/edit`,method:"POST",data:s}).then((e=>{a({id:e.id,url:e.source_url,height:n&&o?o/r:void 0})})).catch((e=>{u((0,g.sprintf)(
|
| 66 |
/* translators: 1. Error message */
|
| 67 |
-
(0,g.__)("Could not edit image. %s"),e.message),{id:"image-editing-error",type:"snackbar"})})).finally((()=>{p(!1),c()}))}),[p,e,t,n,o,r,l,a,u,p,c]);return(0,s.useMemo)((()=>({isInProgress:d,apply:h,cancel:f})),[d,h,f])}({id:e,url:t,onSaveImage:a,onFinishEditing:i,...u}),p=(0,s.useMemo)((()=>({...u,...d})),[u,d]);return(0,s.createElement)(Ab.Provider,{value:p},c)}function Fb({url:e,width:t,height:n,clientWidth:o,naturalHeight:r,naturalWidth:l}){const{isInProgress:i,editedUrl:a,position:u,zoom:d,aspect:m,setPosition:f,setCrop:g,setZoom:h,rotation:b}=Db();let v=n||o*r/l;return b%180==90&&(v=o*l/r),(0,s.createElement)("div",{className:c()("wp-block-image__crop-area",{"is-applying":i}),style:{width:t||o,height:v}},(0,s.createElement)(Pb,{image:a||e,disabled:i,minZoom:1,maxZoom:3,crop:u,zoom:d/100,aspect:m,onCropChange:f,onCropComplete:e=>{g(e)},onZoomChange:e=>{h(100*e)}}),i&&(0,s.createElement)(p.Spinner,null))}var zb=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"}));function Vb(){const{isInProgress:e,zoom:t,setZoom:n}=Db();return(0,s.createElement)(p.Dropdown,{contentClassName:"wp-block-image__zoom",popoverProps:Rb,renderToggle:({isOpen:t,onToggle:n})=>(0,s.createElement)(p.ToolbarButton,{icon:zb,label:(0,g.__)("Zoom"),onClick:n,"aria-expanded":t,disabled:e}),renderContent:()=>(0,s.createElement)(p.RangeControl,{label:(0,g.__)("Zoom"),min:100,max:300,value:Math.round(t),onChange:n})})}var Hb=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),Ub=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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 Gb({aspectRatios:e,isDisabled:t,label:n,onClick:o,value:r}){return(0,s.createElement)(p.MenuGroup,{label:n},e.map((({title:e,aspect:n})=>(0,s.createElement)(p.MenuItem,{key:n,disabled:t,onClick:()=>{o(n)},role:"menuitemradio",isSelected:n===r,icon:n===r?Hb:void 0},e))))}function Wb({toggleProps:e}){const{isInProgress:t,aspect:n,setAspect:o,defaultAspect:r}=Db();return(0,s.createElement)(p.DropdownMenu,{icon:Ub,label:(0,g.__)("Aspect Ratio"),popoverProps:Rb,toggleProps:e,className:"wp-block-image__aspect-ratio"},(({onClose:e})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Gb,{isDisabled:t,onClick:t=>{o(t),e()},value:n,aspectRatios:[{title:(0,g.__)("Original"),aspect:r},{title:(0,g.__)("Square"),aspect:1}]}),(0,s.createElement)(Gb,{label:(0,g.__)("Landscape"),isDisabled:t,onClick:t=>{o(t),e()},value:n,aspectRatios:[{title:(0,g.__)("16:10"),aspect:1.6},{title:(0,g.__)("16:9"),aspect:16/9},{title:(0,g.__)("4:3"),aspect:4/3},{title:(0,g.__)("3:2"),aspect:1.5}]}),(0,s.createElement)(Gb,{label:(0,g.__)("Portrait"),isDisabled:t,onClick:t=>{o(t),e()},value:n,aspectRatios:[{title:(0,g.__)("10:16"),aspect:.625},{title:(0,g.__)("9:16"),aspect:9/16},{title:(0,g.__)("3:4"),aspect:3/4},{title:(0,g.__)("2:3"),aspect:2/3}]}))))}var $b=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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 jb(){const{isInProgress:e,rotateClockwise:t}=Db();return(0,s.createElement)(p.ToolbarButton,{icon:$b,label:(0,g.__)("Rotate"),onClick:t,disabled:e})}function Kb(){const{isInProgress:e,apply:t,cancel:n}=Db();return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.ToolbarButton,{onClick:t,disabled:e},(0,g.__)("Apply")),(0,s.createElement)(p.ToolbarButton,{onClick:n},(0,g.__)("Cancel")))}function qb({url:e,width:t,height:n,clientWidth:o,naturalHeight:r,naturalWidth:l}){return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Fb,{url:e,width:t,height:n,clientWidth:o,naturalHeight:r,naturalWidth:l}),(0,s.createElement)(eo,null,(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(Vb,null),(0,s.createElement)(p.ToolbarItem,null,(e=>(0,s.createElement)(Wb,{toggleProps:e}))),(0,s.createElement)(jb,null)),(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(Kb,null))))}const Yb=[25,50,75,100];function Zb({imageWidth:e,imageHeight:t,imageSizeOptions:n=[],isResizable:o=!0,slug:r,width:l,height:i,onChange:a,onChangeImage:c=u.noop}){const{currentHeight:d,currentWidth:m,updateDimension:f,updateDimensions:h}=function(e,t,n,o,r){var l,i;const[a,c]=(0,s.useState)(null!==(l=null!=t?t:o)&&void 0!==l?l:""),[u,d]=(0,s.useState)(null!==(i=null!=e?e:n)&&void 0!==i?i:"");return(0,s.useEffect)((()=>{void 0===t&&void 0!==o&&c(o),void 0===e&&void 0!==n&&d(n)}),[o,n]),(0,s.useEffect)((()=>{void 0!==t&&Number.parseInt(t)!==Number.parseInt(a)&&c(t),void 0!==e&&Number.parseInt(e)!==Number.parseInt(u)&&d(e)}),[t,e]),{currentHeight:u,currentWidth:a,updateDimension:(e,t)=>{"width"===e?c(t):d(t),r({[e]:""===t?void 0:parseInt(t,10)})},updateDimensions:(e,t)=>{d(null!=e?e:n),c(null!=t?t:o),r({height:e,width:t})}}}(i,l,t,e,a);return(0,s.createElement)(s.Fragment,null,!(0,u.isEmpty)(n)&&(0,s.createElement)(p.SelectControl,{label:(0,g.__)("Image size"),value:r,options:n,onChange:c}),o&&(0,s.createElement)("div",{className:"block-editor-image-size-control"},(0,s.createElement)("p",{className:"block-editor-image-size-control__row"},(0,g.__)("Image dimensions")),(0,s.createElement)("div",{className:"block-editor-image-size-control__row"},(0,s.createElement)(p.TextControl,{type:"number",className:"block-editor-image-size-control__width",label:(0,g.__)("Width"),value:m,min:1,onChange:e=>f("width",e)}),(0,s.createElement)(p.TextControl,{type:"number",className:"block-editor-image-size-control__height",label:(0,g.__)("Height"),value:d,min:1,onChange:e=>f("height",e)})),(0,s.createElement)("div",{className:"block-editor-image-size-control__row"},(0,s.createElement)(p.ButtonGroup,{"aria-label":(0,g.__)("Image size presets")},Yb.map((n=>{const o=Math.round(e*(n/100)),r=Math.round(t*(n/100)),l=m===o&&d===r;return(0,s.createElement)(p.Button,{key:n,isSmall:!0,variant:l?"primary":void 0,isPressed:l,onClick:()=>h(r,o)},n,"%")}))),(0,s.createElement)(p.Button,{isSmall:!0,onClick:()=>h()},(0,g.__)("Reset")))))}var Xb=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,s.createElement)(F.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"})),Qb=({value:e,onChange:t=u.noop,settings:n})=>{if(!n||!n.length)return null;const o=n=>o=>{t({...e,[n.id]:o})},r=n.map((t=>(0,s.createElement)(p.ToggleControl,{className:"block-editor-link-control__setting",key:t.id,label:t.title,onChange:o(t),checked:!!e&&!!e[t.id]})));return(0,s.createElement)("fieldset",{className:"block-editor-link-control__settings"},(0,s.createElement)(p.VisuallyHidden,{as:"legend"},(0,g.__)("Currently selected link settings")),r)};class Jb extends s.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,s.createRef)(),this.inputRef=(0,s.createRef)(),this.updateSuggestions=(0,u.debounce)(this.updateSuggestions.bind(this),200),this.suggestionNodes=[],this.isUpdatingSuggestions=!1,this.state={suggestions:[],showSuggestions:!1,selectedSuggestion:null,suggestionsListboxId:"",suggestionOptionIdPrefix:""}}componentDidUpdate(e){const{showSuggestions:t,selectedSuggestion:n}=this.state,{value:o}=this.props;t&&null!==n&&this.suggestionNodes[n]&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,va()(this.suggestionNodes[n],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),this.props.setTimeout((()=>{this.scrollingIntoView=!1}),100)),e.value!==o&&this.shouldShowInitialSuggestions()&&this.updateSuggestions()}componentDidMount(){this.shouldShowInitialSuggestions()&&this.updateSuggestions()}componentWillUnmount(){var e,t;null===(e=this.suggestionsRequest)||void 0===e||null===(t=e.cancel)||void 0===t||t.call(e),delete this.suggestionsRequest}bindSuggestionNode(e){return t=>{this.suggestionNodes[e]=t}}shouldShowInitialSuggestions(){const{suggestions:e}=this.state,{__experimentalShowInitialSuggestions:t=!1,value:n}=this.props;return!this.isUpdatingSuggestions&&t&&!(n&&n.length)&&!(e&&e.length)}updateSuggestions(e=""){var t;const{__experimentalFetchLinkSuggestions:n,__experimentalHandleURLSuggestions:o}=this.props;if(!n)return;const r=!(null!==(t=e)&&void 0!==t&&t.length);if(e=e.trim(),!r&&(e.length<2||!o&&(0,Pu.isURL)(e)))return void this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});this.isUpdatingSuggestions=!0,this.setState({selectedSuggestion:null,loading:!0});const l=n(e,{isInitialSuggestions:r});l.then((e=>{this.suggestionsRequest===l&&(this.setState({suggestions:e,loading:!1,showSuggestions:!!e.length}),e.length?this.props.debouncedSpeak((0,g.sprintf)(
|
| 68 |
/* translators: %s: number of results. */
|
| 69 |
-
(0,
|
| 70 |
/* translators: %s: search term. */
|
| 71 |
-
(0,
|
| 72 |
/* translators: %s: search term. */
|
| 73 |
-
(0,g.__)('Search results for "%s"'),n),S=(0,s.createElement)(m?s.Fragment:p.VisuallyHidden,{},(0,s.createElement)("span",{className:"block-editor-link-control__search-results-label",id:E},C));return(0,s.createElement)("div",{className:"block-editor-link-control__search-results-wrapper"},S,(0,s.createElement)("div",i({},r,{className:b,"aria-labelledby":E}),a.map(((e,t)=>_&&rv===e.type?(0,s.createElement)(tv,{searchTerm:n,buttonText:f,onClick:()=>o(e),key:e.type,itemProps:l(e,t),isSelected:t===u}):rv===e.type?null:(0,s.createElement)(ov,{key:`${e.id}-${e.type}`,itemProps:l(e,t),suggestion:e,index:t,onClick:()=>{o(e)},isSelected:t===u,isURL:v.includes(e.type.toLowerCase()),searchTerm:n,shouldShowType:y})))))}function sv(e){const t=(0,u.startsWith)(e,"#");return(0,Pu.isURL)(e)||e&&e.includes("www.")||t}const av=()=>Promise.resolve([]),cv=e=>{let t="URL";const n=(0,Pu.getProtocol)(e)||"";return n.includes("mailto")&&(t="mailto"),n.includes("tel")&&(t="tel"),(0,u.startsWith)(e,"#")&&(t="internal"),Promise.resolve([{id:e,title:e,url:"URL"===t?(0,Pu.prependHTTP)(e):e,type:t}])};const uv=()=>Promise.resolve([]),dv=(0,s.forwardRef)((({value:e,children:t,currentLink:n={},className:o=null,placeholder:r=null,withCreateSuggestion:l=!1,onCreateSuggestion:i=u.noop,onChange:a=u.noop,onSelect:c=u.noop,showSuggestions:p=!0,renderSuggestions:f=(e=>(0,s.createElement)(iv,e)),fetchSuggestions:h=null,allowDirectEntry:b=!0,showInitialSuggestions:v=!1,suggestionsQuery:k={},withURLSuggestion:_=!0,createSuggestionButtonText:y},E)=>{const C=function(e,t,n,o){const{fetchSearchSuggestions:r}=(0,m.useSelect)((e=>{const{getSettings:t}=e(Wn);return{fetchSearchSuggestions:t().__experimentalFetchLinkSuggestions}}),[]),l=t?cv:av;return(0,s.useCallback)(((t,{isInitialSuggestions:i})=>sv(t)?l(t,{isInitialSuggestions:i}):(async(e,t,n,o,r,l)=>{const{isInitialSuggestions:i}=t;let s=await Promise.all([n(e,t),o(e)]);return s=e.includes(" ")||!l||i?s[0]:s[0].concat(s[1]),i||sv(e)||!r?s:s.concat({title:e,url:e,type:rv})})(t,{...e,isInitialSuggestions:i},r,l,n,o)),[l,r,n])}(k,b,l,_),S=p?h||C:uv,w=(0,d.useInstanceId)(dv),[B,I]=(0,s.useState)(),x=async e=>{let t=e;if(rv!==e.type)(b||t&&Object.keys(t).length>=1)&&c({...(0,u.omit)(n,"id","url"),...t},t);else try{var o;t=await i(e.title),null!==(o=t)&&void 0!==o&&o.url&&c(t)}catch(e){}};return(0,s.createElement)("div",null,(0,s.createElement)(ev,{className:o,value:e,onChange:(e,t)=>{a(e),I(t)},placeholder:null!=r?r:(0,g.__)("Search or type url"),__experimentalRenderSuggestions:p?t=>f({...t,instanceId:w,withCreateSuggestion:l,currentInputValue:e,createSuggestionButtonText:y,suggestionsQuery:k,handleSuggestionClick:e=>{t.handleSuggestionClick&&t.handleSuggestionClick(e),x(e)}}):null,__experimentalFetchLinkSuggestions:S,__experimentalHandleURLSuggestions:!0,__experimentalShowInitialSuggestions:v,onSubmit:(t,n)=>{var o;const r=t||B;r||null!=e&&null!==(o=e.trim())&&void 0!==o&&o.length?x(r||{url:e}):n.preventDefault()},ref:E}),t)}));var pv=dv,mv=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"}));const{Slot:fv,Fill:gv}=(0,p.createSlotFill)("BlockEditorLinkControlViewer");function hv(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}`)}}function bv({value:e,onEditClick:t,hasRichPreviews:n=!1}){const o=n?null==e?void 0:e.url:null,{richData:r,isFetching:l}=function(e){const[t,n]=(0,s.useReducer)(hv,{richData:null,isFetching:!1}),{fetchRichUrlData:o}=(0,m.useSelect)((e=>{const{getSettings:t}=e(Wn);return{fetchRichUrlData:t().__experimentalFetchRichUrlData}}),[]);return(0,s.useEffect)((()=>{if(null!=e&&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}(o),i=r&&Object.keys(r).length,a=e&&(0,Pu.filterURLForDisplay)((0,Pu.safeDecodeURI)(e.url),16)||"",u=!e.url.length;let d;return d=null!=r&&r.icon?(0,s.createElement)("img",{src:null==r?void 0:r.icon,alt:""}):u?(0,s.createElement)(Co,{icon:mv,size:32}):(0,s.createElement)(Co,{icon:nv}),(0,s.createElement)("div",{"aria-label":(0,g.__)("Currently selected"),"aria-selected":"true",className:c()("block-editor-link-control__search-item",{"is-current":!0,"is-rich":i,"is-fetching":!!l,"is-preview":!0,"is-error":u})},(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:c()("block-editor-link-control__search-item-icon",{"is-image":null==r?void 0:r.icon})},d),(0,s.createElement)("span",{className:"block-editor-link-control__search-item-details"},u?(0,s.createElement)("span",{className:"block-editor-link-control__search-item-error-notice"},"Link is empty"):(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.ExternalLink,{className:"block-editor-link-control__search-item-title",href:e.url},(null==r?void 0:r.title)||(null==e?void 0:e.title)||a),(null==e?void 0:e.url)&&(0,s.createElement)("span",{className:"block-editor-link-control__search-item-info"},a)))),(0,s.createElement)(p.Button,{variant:"secondary",onClick:()=>t(),className:"block-editor-link-control__search-item-action"},(0,g.__)("Edit")),(0,s.createElement)(fv,{fillProps:e})),(i&&((null==r?void 0:r.image)||(null==r?void 0:r.description))||l)&&(0,s.createElement)("div",{className:"block-editor-link-control__search-item-bottom"},((null==r?void 0:r.image)||l)&&(0,s.createElement)("div",{"aria-hidden":!(null!=r&&r.image),className:c()("block-editor-link-control__search-item-image",{"is-placeholder":!(null!=r&&r.image)})},(null==r?void 0:r.image)&&(0,s.createElement)("img",{src:null==r?void 0:r.image,alt:""})),((null==r?void 0:r.description)||l)&&(0,s.createElement)("div",{"aria-hidden":!(null!=r&&r.description),className:c()("block-editor-link-control__search-item-description",{"is-placeholder":!(null!=r&&r.description)})},(null==r?void 0:r.description)&&(0,s.createElement)(p.__experimentalText,{truncate:!0,numberOfLines:"2"},r.description))))}function vv({searchInputPlaceholder:e,value:t,settings:n=lv,onChange:o=u.noop,onRemove:r,noDirectEntry:l=!1,showSuggestions:i=!0,showInitialSuggestions:a,forceIsEditingLink:c,createSuggestion:d,withCreateSuggestion:m,inputValue:f="",suggestionsQuery:h={},noURLSuggestion:b=!1,createSuggestionButtonText:v,hasRichPreviews:k=!1}){var _;void 0===m&&d&&(m=!0);const y=(0,s.useRef)(!0),E=(0,s.useRef)(),[C,S]=(0,s.useState)(t&&t.url||""),w=f||C,[B,I]=(0,s.useState)(void 0!==c?c:!t||!t.url),x=(0,s.useRef)(!1),T=!(null!=w&&null!==(_=w.trim())&&void 0!==_&&_.length);function N(){var e;x.current=!(null===(e=E.current)||void 0===e||!e.contains(E.current.ownerDocument.activeElement)),I(!1)}(0,s.useEffect)((()=>{void 0!==c&&c!==B&&I(c)}),[c]),(0,s.useEffect)((()=>{y.current?y.current=!1:((tr.focus.focusable.find(E.current)[0]||E.current).focus(),x.current=!1)}),[B]);const{createPage:P,isCreatingPage:R,errorMessage:M}=function(e){const t=(0,s.useRef)(),[n,o]=(0,s.useState)(!1),[r,l]=(0,s.useState)(null);return(0,s.useEffect)((()=>()=>{t.current&&t.current.cancel()}),[]),{createPage:async function(n){o(!0),l(null);try{return t.current=(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}}})(Promise.resolve(e(n))),await t.current.promise}catch(e){if(e&&e.isCanceled)return;throw l(e.message||(0,g.__)("An unknown error occurred during creation. Please try again.")),e}finally{o(!1)}},isCreatingPage:n,errorMessage:r}}(d),L=()=>{w!==(null==t?void 0:t.url)&&o({url:w}),N()},A=r&&t&&!B&&!R,D=!(null==n||!n.length);return(0,s.createElement)("div",{tabIndex:-1,ref:E,className:"block-editor-link-control"},R&&(0,s.createElement)("div",{className:"block-editor-link-control__loading"},(0,s.createElement)(p.Spinner,null)," ",(0,g.__)("Creating"),"…"),(B||!t)&&!R&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"block-editor-link-control__search-input-wrapper"},(0,s.createElement)(pv,{currentLink:t,className:"block-editor-link-control__search-input",placeholder:e,value:w,withCreateSuggestion:m,onCreateSuggestion:P,onChange:S,onSelect:e=>{o(e),N()},showInitialSuggestions:a,allowDirectEntry:!l,showSuggestions:i,suggestionsQuery:h,withURLSuggestion:!b,createSuggestionButtonText:v},(0,s.createElement)("div",{className:"block-editor-link-control__search-actions"},(0,s.createElement)(p.Button,{onClick:()=>L(),onKeyDown:e=>{const{keyCode:t}=e;t!==fa.ENTER||T||(e.preventDefault(),L())},label:(0,g.__)("Submit"),icon:Xb,className:"block-editor-link-control__search-submit",disabled:T})))),M&&(0,s.createElement)(p.Notice,{className:"block-editor-link-control__search-error",status:"error",isDismissible:!1},M)),t&&!B&&!R&&(0,s.createElement)(bv,{key:null==t?void 0:t.url,value:t,onEditClick:()=>I(!0),hasRichPreviews:k}),(D||A)&&(0,s.createElement)("div",{className:"block-editor-link-control__tools"},(0,s.createElement)(Qb,{value:t,settings:n,onChange:o}),A&&(0,s.createElement)(p.Button,{className:"block-editor-link-control__unlink",isDestructive:!0,variant:"link",onClick:r},(0,g.__)("Unlink"))))}vv.ViewerFill=gv;var kv=vv,_v=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),yv=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),Ev=(0,p.withFilters)("editor.MediaUpload")((()=>null)),Cv=function({fallback:e=null,children:t}){return(0,m.useSelect)((e=>{const{getSettings:t}=e(Wn);return!!t().mediaUpload}),[])?t:e},Sv=(0,d.compose)([(0,m.withDispatch)((e=>{const{createNotice:t,removeNotice:n}=e(Su.store);return{createNotice:t,removeNotice:n}})),(0,p.withFilters)("editor.MediaReplaceFlow")])((({mediaURL:e,mediaId:t,allowedTypes:n,accept:o,onSelect:r,onSelectURL:l,onFilesUpload:i=u.noop,name:a=(0,g.__)("Replace"),createNotice:c,removeNotice:d,children:f})=>{const[h,b]=(0,s.useState)(e),v=(0,m.useSelect)((e=>e(Wn).getSettings().mediaUpload),[]),k=(0,s.createRef)(),_=(0,u.uniqueId)("block-editor/media-replace-flow/error-notice/"),y=e=>{const t=document.createElement("div");t.innerHTML=(0,s.renderToString)(e);const n=t.textContent||t.innerText||"";setTimeout((()=>{c("error",n,{speak:!0,id:_,isDismissible:!0})}),1e3)},E=e=>{b(e.url),r(e),(0,Rt.speak)((0,g.__)("The media file has been replaced")),d(_)},C=e=>{e.keyCode===fa.DOWN&&(e.preventDefault(),e.target.click())};return(0,s.createElement)(p.Dropdown,{popoverProps:{isAlternate:!0},contentClassName:"block-editor-media-replace-flow__options",renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(p.ToolbarButton,{ref:k,"aria-expanded":e,"aria-haspopup":"true",onClick:t,onKeyDown:C},a),renderContent:({onClose:e})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.NavigableMenu,{className:"block-editor-media-replace-flow__media-upload-menu"},(0,s.createElement)(Ev,{value:t,onSelect:e=>E(e),allowedTypes:n,render:({open:e})=>(0,s.createElement)(p.MenuItem,{icon:_v,onClick:e},(0,g.__)("Open Media Library"))}),(0,s.createElement)(Cv,null,(0,s.createElement)(p.FormFileUpload,{onChange:e=>{(e=>{const t=e.target.files;i(t),v({allowedTypes:n,filesList:t,onFileChange:([e])=>{E(e)},onError:y})})(e)},accept:o,render:({openFileDialog:e})=>(0,s.createElement)(p.MenuItem,{icon:yv,onClick:()=>{e()}},(0,g.__)("Upload"))})),f),l&&(0,s.createElement)("form",{className:"block-editor-media-flow__url-input"},(0,s.createElement)("span",{className:"block-editor-media-replace-flow__image-url-label"},(0,g.__)("Current media URL:")),(0,s.createElement)(kv,{value:{url:h},settings:[],showSuggestions:!1,onChange:({url:e})=>{b(e),l(e),k.current.focus()}})))})})),wv=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"}));function Bv({url:e,urlLabel:t,className:n}){const o=c()(n,"block-editor-url-popover__link-viewer-url");return e?(0,s.createElement)(p.ExternalLink,{className:o,href:e},t||(0,Pu.filterURLForDisplay)((0,Pu.safeDecodeURI)(e))):(0,s.createElement)("span",{className:o})}function Iv({additionalControls:e,children:t,renderSettings:n,position:o="bottom center",focusOnMount:r="firstElement",...l}){const[a,c]=(0,s.useState)(!1),u=!!n&&a;return(0,s.createElement)(p.Popover,i({className:"block-editor-url-popover",focusOnMount:r,position:o},l),(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)(p.Button,{className:"block-editor-url-popover__settings-toggle",icon:xd,label:(0,g.__)("Link settings"),onClick:()=>{c(!a)},"aria-expanded":a})),u&&(0,s.createElement)("div",{className:"block-editor-url-popover__row block-editor-url-popover__settings"},n())),e&&!u&&(0,s.createElement)("div",{className:"block-editor-url-popover__additional-controls"},e))}Iv.LinkEditor=function({autocompleteRef:e,className:t,onChangeInputValue:n,value:o,...r}){return(0,s.createElement)("form",i({className:c()("block-editor-url-popover__link-editor",t)},r),(0,s.createElement)(ev,{value:o,onChange:n,autocompleteRef:e}),(0,s.createElement)(p.Button,{icon:Xb,label:(0,g.__)("Apply"),type:"submit"}))},Iv.LinkViewer=function({className:e,linkClassName:t,onEditLinkClick:n,url:o,urlLabel:r,...l}){return(0,s.createElement)("div",i({className:c()("block-editor-url-popover__link-viewer",e)},l),(0,s.createElement)(Bv,{url:o,urlLabel:r,className:t}),n&&(0,s.createElement)(p.Button,{icon:wv,label:(0,g.__)("Edit"),onClick:n}))};var xv=Iv;const Tv=({src:e,onChange:t,onSubmit:n,onClose:o})=>(0,s.createElement)(xv,{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,g.__)("URL"),placeholder:(0,g.__)("Paste or type URL"),onChange:t,value:e}),(0,s.createElement)(p.Button,{className:"block-editor-media-placeholder__url-input-submit-button",icon:Xb,label:(0,g.__)("Apply"),type:"submit"})));var Nv=(0,p.withFilters)("editor.MediaPlaceholder")((function({value:e={},allowedTypes:t,className:n,icon:o,labels:r={},mediaPreview:l,notices:i,isAppender:a,accept:d,addToGallery:f,multiple:h=!1,handleUpload:b=!0,dropZoneUIOnly:v,disableDropZone:k,disableMediaButtons:_,onError:y,onSelect:E,onCancel:C,onSelectURL:S,onDoubleClick:w,onFilesPreUpload:B=u.noop,onHTMLDrop:I=u.noop,children:x,mediaLibraryButton:T,placeholder:N,style:P}){const R=(0,m.useSelect)((e=>{const{getSettings:t}=e(Wn);return t().mediaUpload}),[]),[M,L]=(0,s.useState)(""),[A,D]=(0,s.useState)(!1);(0,s.useEffect)((()=>{var t;L(null!==(t=null==e?void 0:e.src)&&void 0!==t?t:"")}),[null==e?void 0:e.src]);const O=e=>{L(e.target.value)},F=()=>{D(!0)},z=()=>{D(!1)},V=e=>{e.preventDefault(),M&&S&&(S(M),z())},H=n=>{if(!b)return E(n);let o;if(B(n),h)if(f){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)))));E(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=E;else o=([e])=>E(e);R({allowedTypes:t,filesList:n,onFileChange:o,onError:y})},U=e=>{H(e.target.files)},G=null!=N?N:e=>{let{instructions:u,title:d}=r;if(R||S||(u=(0,g.__)("To edit this block, you need permission to upload media.")),void 0===u||void 0===d){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===u&&R&&(u=(0,g.__)("Upload a media file or pick one from your media library."),r?u=(0,g.__)("Upload an audio file, pick one from your media library, or add one with a URL."):l?u=(0,g.__)("Upload an image file, pick one from your media library, or add one with a URL."):i&&(u=(0,g.__)("Upload a video file, pick one from your media library, or add one with a URL."))),void 0===d&&(d=(0,g.__)("Media"),r?d=(0,g.__)("Audio"):l?d=(0,g.__)("Image"):i&&(d=(0,g.__)("Video")))}const m=c()("block-editor-media-placeholder",n,{"is-appender":a});return(0,s.createElement)(p.Placeholder,{icon:o,label:d,instructions:u,className:m,notices:i,onDoubleClick:w,preview:l,style:P},e,x)},W=()=>k?null:(0,s.createElement)(p.DropZone,{onFilesDrop:H,onHTMLDrop:I}),$=()=>C&&(0,s.createElement)(p.Button,{className:"block-editor-media-placeholder__cancel-button",title:(0,g.__)("Cancel"),variant:"link",onClick:C},(0,g.__)("Cancel")),j=()=>S&&(0,s.createElement)("div",{className:"block-editor-media-placeholder__url-input-container"},(0,s.createElement)(p.Button,{className:"block-editor-media-placeholder__button",onClick:F,isPressed:A,variant:"tertiary"},(0,g.__)("Insert from URL")),A&&(0,s.createElement)(Tv,{src:M,onChange:O,onSubmit:V,onClose:z}));return v||_?(v&&At()("wp.blockEditor.MediaPlaceholder dropZoneUIOnly prop",{since:"5.4",alternative:"disableMediaButtons"}),(0,s.createElement)(Cv,null,W())):(0,s.createElement)(Cv,{fallback:G(j())},(()=>{const n=null!=T?T:({open:e})=>(0,s.createElement)(p.Button,{variant:"tertiary",onClick:()=>{e()}},(0,g.__)("Media Library")),o=(0,s.createElement)(Ev,{addToGallery:f,gallery:h&&!(!t||0===t.length)&&t.every((e=>"image"===e||e.startsWith("image/"))),multiple:h,onSelect:E,allowedTypes:t,value:Array.isArray(e)?e.map((({id:e})=>e)):e.id,render:n});if(R&&a)return(0,s.createElement)(s.Fragment,null,W(),(0,s.createElement)(p.FormFileUpload,{onChange:U,accept:d,multiple:h,render:({openFileDialog:e})=>{const t=(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.Button,{variant:"primary",className:c()("block-editor-media-placeholder__button","block-editor-media-placeholder__upload-button"),onClick:e},(0,g.__)("Upload")),o,j(),$());return G(t)}}));if(R){const e=(0,s.createElement)(s.Fragment,null,W(),(0,s.createElement)(p.FormFileUpload,{variant:"primary",className:c()("block-editor-media-placeholder__button","block-editor-media-placeholder__upload-button"),onChange:U,accept:d,multiple:h},(0,g.__)("Upload")),o,j(),$());return G(e)}return G(o)})())})),Pv=({colorSettings:e,...t})=>{const n=e.map((({value:e,onChange:t,...n})=>({...n,colorValue:e,onColorChange:t})));return(0,s.createElement)(qm,i({settings:n,gradients:[],disableCustomGradients:!0},t))};const Rv={position:"bottom right",isAlternate:!0};var Mv=()=>(0,s.createElement)(s.Fragment,null,["bold","italic","link"].map((e=>(0,s.createElement)(p.Slot,{name:`RichText.ToolbarControls.${e}`,key:e}))),(0,s.createElement)(p.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)(p.ToolbarItem,null,(n=>(0,s.createElement)(p.DropdownMenu,{icon:xd
|
| 74 |
-
/* translators: button label text should, if possible, be under 16 characters. */,label:(0,g.__)("More"),toggleProps:{...n,className:c()(n.className,{"is-pressed":t})},controls:(0,u.orderBy)(e.map((([{props:e}])=>e)),"title"),popoverProps:Rv})))}))),Lv=({inline:e,anchorRef:t})=>e?(0,s.createElement)(p.Popover,{noArrow:!0,position:"top center",focusOnMount:!1,anchorRef:t,className:"block-editor-rich-text__inline-format-toolbar",__unstableSlotName:"block-toolbar"},(0,s.createElement)("div",{className:"block-editor-rich-text__inline-format-toolbar-group"},(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(Mv,null)))):(0,s.createElement)(eo,{group:"inline"},(0,s.createElement)(Mv,null));function Av(){const{didAutomaticChange:e,getSettings:t}=(0,m.useSelect)(Wn);return(0,d.useRefEffect)((n=>{function o(n){const{keyCode:o}=n;n.defaultPrevented||o!==fa.DELETE&&o!==fa.BACKSPACE&&o!==fa.ESCAPE||e()&&(n.preventDefault(),t().__experimentalUndo())}return n.addEventListener("keydown",o),()=>{n.removeEventListener("keydown",o)}}),[])}function Dv(e){return e.filter((({type:e})=>/^image\/(?:jpe?g|png|gif)$/.test(e))).map((e=>`<img src="${(0,rp.createBlobURL)(e)}">`)).join("")}var Ov=window.wp.shortcode;function Fv(e,t){if(null!=t&&t.length){let n=e.formats.length;for(;n--;)e.formats[n]=[...t,...e.formats[n]||[]]}}function zv(e){if(!0===e||"p"===e||"li"===e)return!0===e?"p":e}function Vv({allowedFormats:e,formattingControls:t,disableFormats:n}){return n?Vv.EMPTY_ARRAY:e||t?e||(At()("wp.blockEditor.RichText formattingControls prop",{since:"5.4",alternative:"allowedFormats"}),t.map((e=>`core/${e}`))):void 0}function Hv({value:e,pastedBlocks:t=[],onReplace:n,onSplit:o,onSplitMiddle:r,multilineTag:l}){if(!n||!o)return;const i=[],[s,a]=(0,Mt.split)(e),c=t.length>0;let u=-1;const d=(0,Mt.isEmpty)(s)&&!(0,Mt.isEmpty)(a);c&&(0,Mt.isEmpty)(s)||(i.push(o((0,Mt.toHTMLString)({value:s,multilineTag:l}),!d)),u+=1),c?(i.push(...t),u+=t.length):r&&i.push(r()),(c||r)&&(0,Mt.isEmpty)(a)||i.push(o((0,Mt.toHTMLString)({value:a,multilineTag:l}),d)),n(i,c?u:1,c?-1:0)}function Uv(e,t){return t?(0,Mt.replace)(e,/\n+/g,Mt.__UNSTABLE_LINE_SEPARATOR):(0,Mt.replace)(e,new RegExp(Mt.__UNSTABLE_LINE_SEPARATOR,"g"),"\n")}function Gv(e){const t=(0,s.useRef)(e);return t.current=e,(0,d.useRefEffect)((e=>{function n(e){const{isSelected:n,disableFormats:o,onChange:l,value:i,formatTypes:s,tagName:a,onReplace:c,onSplit:u,onSplitMiddle:d,__unstableEmbedURLOnPaste:p,multilineTag:m,preserveWhiteSpace:f,pastePlainText:g}=t.current;if(!n)return void e.preventDefault();const{clipboardData:h}=e;let b="",v="";try{b=h.getData("text/plain"),v=h.getData("text/html")}catch(e){try{v=h.getData("Text")}catch(e){return}}if(v=function(e){return e.replace(/.*<!--StartFragment-->/s,"").replace(/<!--EndFragment-->.*/s,"")}(v),e.preventDefault(),window.console.log("Received HTML:\n\n",v),window.console.log("Received plain text:\n\n",b),o)return void l((0,Mt.insert)(i,b));const k=s.reduce(((e,{__unstablePasteRule:t})=>(t&&e===i&&(e=t(i,{html:v,plainText:b})),e)),i);if(k!==i)return void l(k);const _=[...(0,tr.getFilesFromDataTransfer)(h)];if("true"===h.getData("rich-text")){const e=h.getData("rich-text-multi-line-tag")||void 0;let t=(0,Mt.create)({html:v,multilineTag:e,multilineWrapperTags:"li"===e?["ul","ol"]:void 0,preserveWhiteSpace:f});return t=Uv(t,!!m),Fv(t,i.activeFormats),void l((0,Mt.insert)(i,t))}if(g)return void l((0,Mt.insert)(i,(0,Mt.create)({text:b})));if(_&&_.length&&!v){const e=(0,r.pasteHandler)({HTML:Dv(_),mode:"BLOCKS",tagName:a,preserveWhiteSpace:f});return window.console.log("Received items:\n\n",_),void(c&&(0,Mt.isEmpty)(i)?c(e):Hv({value:i,pastedBlocks:e,onReplace:c,onSplit:u,onSplitMiddle:d,multilineTag:m}))}let y=c&&u?"AUTO":"INLINE";var E;"AUTO"===y&&(0,Mt.isEmpty)(i)&&(E=b,(0,Ov.regexp)(".*").test(E))&&(y="BLOCKS"),p&&(0,Mt.isEmpty)(i)&&(0,Pu.isURL)(b.trim())&&(y="BLOCKS");const C=(0,r.pasteHandler)({HTML:v,plainText:b,mode:y,tagName:a,preserveWhiteSpace:f});if("string"==typeof C){let e=(0,Mt.create)({html:C});e=Uv(e,!!m),Fv(e,i.activeFormats),l((0,Mt.insert)(i,e))}else C.length>0&&(c&&(0,Mt.isEmpty)(i)?c(C,C.length-1,-1):Hv({value:i,pastedBlocks:C,onReplace:c,onSplit:u,onSplitMiddle:d,multilineTag:m}))}return e.addEventListener("paste",n),()=>{e.removeEventListener("paste",n)}}),[])}function Wv(e){const{__unstableMarkLastChangeAsPersistent:t,__unstableMarkAutomaticChange:n}=(0,m.useDispatch)(Wn),o=(0,s.useRef)(e);return o.current=e,(0,d.useRefEffect)((e=>{function l(){const{value:e,onReplace:t}=o.current;if(!t)return;const{start:l,text:i}=e;if(" "!==i.slice(l-1,l))return;const s=i.slice(0,l).trim(),a=(0,r.getBlockTransforms)("from").filter((({type:e})=>"prefix"===e)),c=(0,r.findTransform)(a,(({prefix:e})=>s===e));if(!c)return;const u=(0,Mt.toHTMLString)({value:(0,Mt.slice)(e,l,i.length)});t([c.transform(u)]),n()}function i(e){const{inputType:r,type:i}=e,{value:s,onChange:a,__unstableAllowPrefixTransformations:c,formatTypes:u}=o.current;if("insertText"!==r&&"compositionend"!==i)return;c&&l&&l();const d=u.reduce(((e,{__unstableInputRule:t})=>(t&&(e=t(e)),e)),s);d!==s&&(t(),a({...d,activeFormats:s.activeFormats}),n())}return e.addEventListener("input",i),e.addEventListener("compositionend",i),()=>{e.removeEventListener("input",i),e.removeEventListener("compositionend",i)}}),[])}function $v(e){const{__unstableMarkAutomaticChange:t}=(0,m.useDispatch)(Wn),n=(0,s.useRef)(e);return n.current=e,(0,d.useRefEffect)((e=>{function o(e){if(e.defaultPrevented)return;const{removeEditorOnlyFormats:o,value:l,onReplace:i,onSplit:s,onSplitMiddle:a,multilineTag:c,onChange:u,disableLineBreaks:d,onSplitAtEnd:p}=n.current;if(e.keyCode!==fa.ENTER)return;e.preventDefault();const m={...l};m.formats=o(l);const f=i&&s;if(i){const e=(0,r.getBlockTransforms)("from").filter((({type:e})=>"enter"===e)),n=(0,r.findTransform)(e,(e=>e.regExp.test(m.text)));n&&(i([n.transform({content:m.text})]),t())}if(c)e.shiftKey?d||u((0,Mt.insert)(m,"\n")):f&&(0,Mt.__unstableIsEmptyLine)(m)?Hv({value:m,onReplace:i,onSplit:s,onSplitMiddle:a,multilineTag:c}):u((0,Mt.__unstableInsertLineSeparator)(m));else{const{text:t,start:n,end:o}=m,r=p&&n===o&&o===t.length;e.shiftKey||!f&&!r?d||u((0,Mt.insert)(m,"\n")):!f&&r?p():f&&Hv({value:m,onReplace:i,onSplit:s,onSplitMiddle:a,multilineTag:c})}}return e.addEventListener("keydown",o),()=>{e.removeEventListener("keydown",o)}}),[])}function jv(e){return e(Mt.store).getFormatTypes()}Vv.EMPTY_ARRAY=[];const Kv=new Set(["a","audio","button","details","embed","iframe","input","label","select","textarea","video"]);function qv(e){return(0,d.useRefEffect)((t=>{function n(t){for(const n of e.current)n(t)}return t.addEventListener("keydown",n),()=>{t.removeEventListener("keydown",n)}}),[])}function Yv(e){return(0,d.useRefEffect)((t=>{function n(t){for(const n of e.current)n(t)}return t.addEventListener("input",n),()=>{t.removeEventListener("input",n)}}),[])}function Zv({formatTypes:e,onChange:t,onFocus:n,value:o,forwardedRef:r}){return e.map((e=>{const{name:l,edit:i}=e;if(!i)return null;const a=(0,Mt.getActiveFormat)(o,l),c=void 0!==a,u=(0,Mt.getActiveObject)(o),d=void 0!==u&&u.type===l;return(0,s.createElement)(i,{key:l,isActive:c,activeAttributes:c&&a.attributes||{},isObjectActive:d,activeObjectAttributes:d&&u.attributes||{},value:o,onChange:t,onFocus:n,contentRef:r})}))}const Xv=(0,s.createContext)(),Qv=(0,s.createContext)(),Jv=(0,s.forwardRef)((function e({children:t,tagName:n="div",value:o="",onChange:l,isSelected:a,multiline:f,inlineToolbar:g,wrapperClassName:h,autocompleters:b,onReplace:v,placeholder:k,allowedFormats:_,formattingControls:y,withoutInteractiveFormatting:E,onRemove:C,onMerge:S,onSplit:w,__unstableOnSplitAtEnd:B,__unstableOnSplitMiddle:I,identifier:x,preserveWhiteSpace:T,__unstablePastePlainText:N,__unstableEmbedURLOnPaste:P,__unstableDisableFormats:R,disableLineBreaks:M,unstableOnFocus:L,__unstableAllowPrefixTransformations:A,...D},O){const F=(0,d.useInstanceId)(e);x=x||F,D=function(e){return(0,u.omit)(e,["__unstableMobileNoFocusOnMount","deleteEnter","placeholderTextColor","textAlign","selectionColor","tagsToEliminate","rootTagsToEliminate","disableEditingMenu","fontSize","fontFamily","fontWeight","fontStyle","minWidth","maxWidth","setRef"])}(D);const z=(0,s.useRef)(),{clientId:V}=qn(),{selectionStart:H,selectionEnd:U,isSelected:G,disabled:W}=(0,m.useSelect)((e=>{const{getSelectionStart:t,getSelectionEnd:n,isMultiSelecting:o,hasMultiSelection:r}=e(Wn),l=t(),i=n();let s;return void 0===a?s=l.clientId===V&&l.attributeKey===x:a&&(s=l.clientId===V),{selectionStart:s?l.offset:void 0,selectionEnd:s?i.offset:void 0,isSelected:s,disabled:o()||r()}})),{selectionChange:$}=(0,m.useDispatch)(Wn),j=zv(f),K=Vv({allowedFormats:_,formattingControls:y,disableFormats:R}),q=!K||K.length>0;let Y=o,Z=l;Array.isArray(o)&&(Y=r.children.toHTML(o),Z=e=>l(r.children.fromDOM((0,Mt.__unstableCreateElement)(document,e).childNodes)));const X=(0,s.useCallback)(((e,t)=>{$(V,x,e,t)}),[V,x]),{formatTypes:Q,prepareHandlers:J,valueHandlers:ee,changeHandlers:te,dependencies:ne}=function({clientId:e,identifier:t,withoutInteractiveFormatting:n,allowedFormats:o}){const r=(0,m.useSelect)(jv,[]),l=(0,s.useMemo)((()=>r.filter((({name:e,tagName:t})=>!(o&&!o.includes(e)||n&&Kv.has(t))))),[r,o,Kv]),i=(0,m.useSelect)((n=>l.reduce(((o,r)=>(r.__experimentalGetPropsForEditableTreePreparation&&(o[r.name]=r.__experimentalGetPropsForEditableTreePreparation(n,{richTextIdentifier:t,blockClientId:e})),o)),{})),[l,e,t]),a=(0,m.useDispatch)(),c=[],u=[],d=[],p=[];return l.forEach((n=>{if(n.__experimentalCreatePrepareEditableTree){const o=i[n.name],r=n.__experimentalCreatePrepareEditableTree(o,{richTextIdentifier:t,blockClientId:e});n.__experimentalCreateOnChangeEditableValue?u.push(r):c.push(r);for(const e in o)p.push(o[e])}if(n.__experimentalCreateOnChangeEditableValue){let o={};n.__experimentalGetPropsForEditableTreeChangeHandler&&(o=n.__experimentalGetPropsForEditableTreeChangeHandler(a,{richTextIdentifier:t,blockClientId:e})),d.push(n.__experimentalCreateOnChangeEditableValue({...i[n.name]||{},...o},{richTextIdentifier:t,blockClientId:e}))}})),{formatTypes:l,prepareHandlers:c,valueHandlers:u,changeHandlers:d,dependencies:p}}({clientId:V,identifier:x,withoutInteractiveFormatting:E,allowedFormats:K});function oe(e){return Q.forEach((t=>{t.__experimentalCreatePrepareEditableTree&&(e=(0,Mt.removeFormat)(e,t.name,0,e.text.length))})),e.formats}const{value:re,onChange:le,ref:ie}=(0,Mt.__unstableUseRichText)({value:Y,onChange(e,{__unstableFormats:t,__unstableText:n}){Z(e),Object.values(te).forEach((e=>{e(t,n)}))},selectionStart:H,selectionEnd:U,onSelectionChange:X,placeholder:k,__unstableIsSelected:G,__unstableMultilineTag:j,__unstableDisableFormats:R,preserveWhiteSpace:T,__unstableDependencies:[...ne,n],__unstableAfterParse:function(e){return ee.reduce(((t,n)=>n(t,e.text)),e.formats)},__unstableBeforeSerialize:oe,__unstableAddInvisibleFormats:function(e){return J.reduce(((t,n)=>n(t,e.text)),e.formats)}}),se=function(e){return(0,p.__unstableUseAutocompleteProps)({...e,completers:mh(e)})}({onReplace:v,completers:b,record:re,onChange:le});!function({value:e}){const t=e.activeFormats&&!!e.activeFormats.length,{isCaretWithinFormattedText:n}=(0,m.useSelect)(Wn),{enterFormattedText:o,exitFormattedText:r}=(0,m.useDispatch)(Wn);(0,s.useEffect)((()=>{t?n()||o():n()&&r()}),[t])}({value:re}),function({html:e,value:t}){const n=(0,s.useRef)(),o=t.activeFormats&&!!t.activeFormats.length,{__unstableMarkLastChangeAsPersistent:r}=(0,m.useDispatch)(Wn);(0,s.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:Y,value:re});const ae=(0,s.useRef)(new Set),ce=(0,s.useRef)(new Set);function ue(){z.current.focus()}const de=n,pe=(0,s.createElement)(s.Fragment,null,G&&(0,s.createElement)(Xv.Provider,{value:ae},(0,s.createElement)(Qv.Provider,{value:ce},(0,s.createElement)(p.Popover.__unstableSlotNameProvider,{value:"__unstable-block-tools-after"},t&&t({value:re,onChange:le,onFocus:ue}),(0,s.createElement)(Zv,{value:re,onChange:le,onFocus:ue,formatTypes:Q,forwardedRef:z})))),G&&q&&(0,s.createElement)(Lv,{inline:g,anchorRef:z.current}),(0,s.createElement)(de,i({role:"textbox","aria-multiline":!0,"aria-label":k},D,se,{ref:(0,d.useMergeRefs)([se.ref,D.ref,ie,Wv({value:re,onChange:le,__unstableAllowPrefixTransformations:A,formatTypes:Q,onReplace:v}),(0,d.useRefEffect)((e=>{function t(e){(fa.isKeyboardEvent.primary(e,"z")||fa.isKeyboardEvent.primary(e,"y")||fa.isKeyboardEvent.primaryShift(e,"z"))&&e.preventDefault()}return e.addEventListener("keydown",t),()=>{e.addEventListener("keydown",t)}}),[]),qv(ae),Yv(ce),Av(),Gv({isSelected:G,disableFormats:R,onChange:le,value:re,formatTypes:Q,tagName:n,onReplace:v,onSplit:w,onSplitMiddle:I,__unstableEmbedURLOnPaste:P,multilineTag:j,preserveWhiteSpace:T,pastePlainText:N}),$v({removeEditorOnlyFormats:oe,value:re,onReplace:v,onSplit:w,onSplitMiddle:I,multilineTag:j,onChange:le,disableLineBreaks:M,onSplitAtEnd:B}),z,O]),contentEditable:!W||void 0,suppressContentEditableWarning:!W,className:c()("block-editor-rich-text__editable",D.className,"rich-text"),onFocus:L,onKeyDown:function(e){const{keyCode:t}=e;if(!e.defaultPrevented&&(t===fa.DELETE||t===fa.BACKSPACE)){const{start:n,end:o,text:r}=re,l=t===fa.BACKSPACE,i=re.activeFormats&&!!re.activeFormats.length;if(!(0,Mt.isCollapsed)(re)||i||l&&0!==n||!l&&o!==r.length)return;S&&S(!l),C&&(0,Mt.isEmpty)(re)&&l&&C(!l),e.preventDefault()}}})));if(!h)return pe;At()("wp.blockEditor.RichText wrapperClassName prop",{since:"5.4",alternative:"className prop or create your own wrapper div"});const me=c()("block-editor-rich-text",h);return(0,s.createElement)("div",{className:me},pe)}));Jv.Content=({value:e,tagName:t,multiline:n,...o})=>{Array.isArray(e)&&(e=r.children.toHTML(e));const l=zv(n);!e&&l&&(e=`<${l}></${l}>`);const i=(0,s.createElement)(s.RawHTML,null,e);return t?(0,s.createElement)(t,(0,u.omit)(o,["format"]),i):i},Jv.isEmpty=e=>!e||0===e.length;var ek=Jv;const tk=(0,s.forwardRef)(((e,t)=>(0,s.createElement)(ek,i({ref:t},e,{__unstableDisableFormats:!0,preserveWhiteSpace:!0}))));tk.Content=({value:e="",tagName:t="div",...n})=>(0,s.createElement)(t,n,e);var nk=tk,ok=(0,s.forwardRef)((({__experimentalVersion:e,...t},n)=>{if(2===e)return(0,s.createElement)(nk,i({ref:n},t));const{className:o,onChange:r,...l}=t;return(0,s.createElement)(kr.Z,i({ref:n,className:c()("block-editor-plain-text",o),onChange:e=>r(e.target.value)},l))}));function rk({property:e,viewport:t,desc:n}){const o=(0,d.useInstanceId)(rk),r=n||(0,g.sprintf)(
|
| 1 |
+
!function(){var e={9367:function(e,t){var n,o;void 0===(o="function"==typeof(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&&d()},s=function(t){window.removeEventListener("resize",i,!1),e.removeEventListener("input",d,!1),e.removeEventListener("keyup",d,!1),e.removeEventListener("autosize:destroy",s,!1),e.removeEventListener("autosize:update",d,!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",d,!1),window.addEventListener("resize",i,!1),e.addEventListener("input",d,!1),e.addEventListener("autosize:update",d,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",r.set(e,{destroy:s,update:d}),"vertical"===(a=window.getComputedStyle(e,null)).resize?e.style.resize="none":"both"===a.resize&&(e.style.resize="horizontal"),t="content-box"===a.boxSizing?-(parseFloat(a.paddingTop)+parseFloat(a.paddingBottom)):parseFloat(a.borderTopWidth)+parseFloat(a.borderBottomWidth),isNaN(t)&&(t=0),d()}var a;function c(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function u(){if(0!==e.scrollHeight){var o=function(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}(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 d(){u();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"),u(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==n.overflowY&&(c("hidden"),u(),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)})),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})?n.apply(t,[e,t]):n)||(e.exports=o)},4184:function(e,t){var n;!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)for(var s in n)o.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},1934:function(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()}))]}},5913:function(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}function r(e){return{newPos:e.newPos,components:e.components.slice(0)}}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]:{},l=n.callback;"function"==typeof n&&(l=n,n={}),this.options=n;var i=this;function s(e){return l?(setTimeout((function(){l(void 0,e)}),0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e));var a=(t=this.removeEmpty(this.tokenize(t))).length,c=e.length,u=1,d=a+c,p=[{newPos:-1,components:[]}],m=this.extractCommon(p[0],t,e,0);if(p[0].newPos+1>=a&&m+1>=c)return s([{value:this.join(t),count:t.length}]);function f(){for(var n=-1*u;n<=u;n+=2){var l=void 0,d=p[n-1],m=p[n+1],f=(m?m.newPos:0)-n;d&&(p[n-1]=void 0);var h=d&&d.newPos+1<a,g=m&&0<=f&&f<c;if(h||g){if(!h||g&&d.newPos<m.newPos?(l=r(m),i.pushComponent(l.components,void 0,!0)):((l=d).newPos++,i.pushComponent(l.components,!0,void 0)),f=i.extractCommon(l,t,e,n),l.newPos+1>=a&&f+1>=c)return s(o(i,l.components,t,e,i.useLongestToken));p[n]=l}else p[n]=void 0}u++}if(l)!function e(){setTimeout((function(){if(u>d)return l();f()||e()}),0)}();else for(;u<=d;){var h=f();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("")}}},7630:function(e,t,n){"use strict";var o;t.Kx=function(e,t,n){return r.diff(e,t,n)};var r=new(((o=n(5913))&&o.__esModule?o:{default:o}).default)},9010:function(e,t,n){"use strict";var o=n(4657);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=!(!p||!t.frameElement),f=o.offset(e),h=o.outerHeight(e),g=o.outerWidth(e),v=void 0,b=void 0,k=void 0,_=void 0,y=void 0,E=void 0,C=void 0,w=void 0,S=void 0,B=void 0;m&&(t=t.document.scrollingElement||t.document.body),p||m?(C=t,B=o.height(C),S=o.width(C),w={left:o.scrollLeft(C),top:o.scrollTop(C)},y={left:f.left-w.left-c,top:f.top-w.top-a},E={left:f.left+g-(w.left+S)+d,top:f.top+h-(w.top+B)+u},_=w):(v=o.offset(t),b=t.clientHeight,k=t.clientWidth,_={left:t.scrollLeft,top:t.scrollTop},y={left:f.left-(v.left+(parseFloat(o.css(t,"borderLeftWidth"))||0))-c,top:f.top-(v.top+(parseFloat(o.css(t,"borderTopWidth"))||0))-a},E={left:f.left+g-(v.left+k+(parseFloat(o.css(t,"borderRightWidth"))||0))+d,top:f.top+h-(v.top+b+(parseFloat(o.css(t,"borderBottomWidth"))||0))+u}),y.top<0||E.top>0?!0===i?o.scrollTop(t,_.top+y.top):!1===i?o.scrollTop(t,_.top+E.top):y.top<0?o.scrollTop(t,_.top+y.top):o.scrollTop(t,_.top+E.top):l||((i=void 0===i||!!i)?o.scrollTop(t,_.top+y.top):o.scrollTop(t,_.top+E.top)),r&&(y.left<0||E.left>0?!0===s?o.scrollLeft(t,_.left+y.left):!1===s?o.scrollLeft(t,_.left+E.left):y.left<0?o.scrollLeft(t,_.left+y.left):o.scrollLeft(t,_.left+E.left):l||((s=void 0===s||!!s)?o.scrollLeft(t,_.left+y.left):o.scrollLeft(t,_.left+E.left)))}},4979:function(e,t,n){"use strict";e.exports=n(9010)},4657:function(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=void 0;function u(e,t){for(var n=0;n<e.length;n++)t(e[n])}function d(e){return"border-box"===c(e,"boxSizing")}"undefined"!=typeof window&&(c=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.currentStyle&&e.currentStyle[t];if(s.test(n)&&!a.test(t)){var o=e.style,r=o.left,l=e.runtimeStyle.left;e.runtimeStyle.left=e.currentStyle.left,o.left="fontSize"===t?"1em":n||0,n=o.pixelLeft+"px",o.left=r,e.runtimeStyle.left=l}return""===n?"auto":n});var p=["margin","border","padding"];function m(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])}function f(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;s="border"===r?r+n[i]+"Width":r+n[i],o+=parseFloat(c(e,s))||0}return o}function h(e){return null!=e&&e==e.window}var g={};function v(e,t,n){if(h(e))return"width"===t?g.viewportWidth(e):g.viewportHeight(e);if(9===e.nodeType)return"width"===t?g.docWidth(e):g.docHeight(e);var o="width"===t?["Left","Right"]:["Top","Bottom"],r="width"===t?e.offsetWidth:e.offsetHeight,l=(c(e),d(e)),i=0;(null==r||r<=0)&&(r=void 0,(null==(i=c(e,t))||Number(i)<0)&&(i=e.style[t]||0),i=parseFloat(i)||0),void 0===n&&(n=l?1:-1);var s=void 0!==r||l,a=r||i;if(-1===n)return s?a-f(e,["border","padding"],o):i;if(s){var u=2===n?-f(e,["border"],o):f(e,["margin"],o);return a+(1===n?0:u)}return i+f(e,p.slice(n),o)}u(["Width","Height"],(function(e){g["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],g["viewport"+e](n))},g["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 b={position:"absolute",visibility:"hidden",display:"block"};function k(e){var t=void 0,n=arguments;return 0!==e.offsetWidth?t=v.apply(void 0,n):m(e,b,(function(){t=v.apply(void 0,n)})),t}function _(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)):c(e,t);for(var l in t)t.hasOwnProperty(l)&&_(e,l,t[l])}u(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);g["outer"+t]=function(t,n){return t&&k(t,e,n?0:1)};var n="width"===e?["Left","Right"]:["Top","Bottom"];g[e]=function(t,o){return void 0===o?t&&k(t,e,-1):t?(c(t),d(t)&&(o+=f(t,["padding","border"],n)),_(t,e,o)):void 0}})),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"===_(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(_(e,l))||0,o[l]=r+t[l]-n[l]);_(e,o)}(e,t)},isWindow:h,each:u,css:_,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(h(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(h(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},g)},5717:function(e){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},8303:function(e,t,n){var o=n(1934);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}},2703:function(e,t,n){"use strict";var o=n(414);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,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}},5697:function(e,t,n){e.exports=n(2703)()},414:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4857: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 __(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),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(3804),a=n(5697),c=n(9367),u=n(8303),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}))}))},4042:function(e,t,n){"use strict";var o=n(4857);t.Z=o.TextareaAutosize},3692:function(e){var t=e.exports=function(e){return new n(e)};function n(e){this.value=e}function o(e,t,n){var o=[],i=[],u=!0;return function e(d){var p=n?r(d):d,m={},f=!0,h={node:p,node_:d,path:[].concat(o),parent:i[i.length-1],parents:i,key:o.slice(-1)[0],isRoot:0===o.length,level:o.length,circular:null,update:function(e,t){h.isRoot||(h.parent.node[h.key]=e),h.node=e,t&&(f=!1)},delete:function(e){delete h.parent.node[h.key],e&&(f=!1)},remove:function(e){s(h.parent.node)?h.parent.node.splice(h.key,1):delete h.parent.node[h.key],e&&(f=!1)},keys:null,before:function(e){m.before=e},after:function(e){m.after=e},pre:function(e){m.pre=e},post:function(e){m.post=e},stop:function(){u=!1},block:function(){f=!1}};if(!u)return h;function g(){if("object"==typeof h.node&&null!==h.node){h.keys&&h.node_===h.node||(h.keys=l(h.node)),h.isLeaf=0==h.keys.length;for(var e=0;e<i.length;e++)if(i[e].node_===d){h.circular=i[e];break}}else h.isLeaf=!0,h.keys=null;h.notLeaf=!h.isLeaf,h.notRoot=!h.isRoot}g();var v=t.call(h,h.node);return void 0!==v&&h.update&&h.update(v),m.before&&m.before.call(h,h.node),f?("object"!=typeof h.node||null===h.node||h.circular||(i.push(h),g(),a(h.keys,(function(t,r){o.push(t),m.pre&&m.pre.call(h,h.node[t],t);var l=e(h.node[t]);n&&c.call(h.node,t)&&(h.node[t]=l.node),l.isLast=r==h.keys.length-1,l.isFirst=0==r,m.post&&m.post.call(h,l),o.pop()})),i.pop()),m.after&&m.after.call(h,h.node),h):h}(e).node}function r(e){if("object"==typeof e&&null!==e){var t;if(s(e))t=[];else if("[object Date]"===i(e))t=new Date(e.getTime?e.getTime():e);else if("[object RegExp]"===i(e))t=new RegExp(e);else if(function(e){return"[object Error]"===i(e)}(e))t={message:e.message};else if(function(e){return"[object Boolean]"===i(e)}(e))t=new Boolean(e);else if(function(e){return"[object Number]"===i(e)}(e))t=new Number(e);else if(function(e){return"[object String]"===i(e)}(e))t=new String(e);else if(Object.create&&Object.getPrototypeOf)t=Object.create(Object.getPrototypeOf(e));else if(e.constructor===Object)t={};else{var n=e.constructor&&e.constructor.prototype||e.__proto__||{},o=function(){};o.prototype=n,t=new o}return a(l(e),(function(n){t[n]=e[n]})),t}return e}n.prototype.get=function(e){for(var t=this.value,n=0;n<e.length;n++){var o=e[n];if(!t||!c.call(t,o)){t=void 0;break}t=t[o]}return t},n.prototype.has=function(e){for(var t=this.value,n=0;n<e.length;n++){var o=e[n];if(!t||!c.call(t,o))return!1;t=t[o]}return!0},n.prototype.set=function(e,t){for(var n=this.value,o=0;o<e.length-1;o++){var r=e[o];c.call(n,r)||(n[r]={}),n=n[r]}return n[e[o]]=t,t},n.prototype.map=function(e){return o(this.value,e,!0)},n.prototype.forEach=function(e){return this.value=o(this.value,e,!1),this.value},n.prototype.reduce=function(e,t){var n=1===arguments.length,o=n?this.value:t;return this.forEach((function(t){this.isRoot&&n||(o=e.call(this,o,t))})),o},n.prototype.paths=function(){var e=[];return this.forEach((function(t){e.push(this.path)})),e},n.prototype.nodes=function(){var e=[];return this.forEach((function(t){e.push(this.node)})),e},n.prototype.clone=function(){var e=[],t=[];return function n(o){for(var i=0;i<e.length;i++)if(e[i]===o)return t[i];if("object"==typeof o&&null!==o){var s=r(o);return e.push(o),t.push(s),a(l(o),(function(e){s[e]=n(o[e])})),e.pop(),t.pop(),s}return o}(this.value)};var l=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function i(e){return Object.prototype.toString.call(e)}var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n,e)};a(l(n.prototype),(function(e){t[e]=function(t){var o=[].slice.call(arguments,1),r=new n(t);return r[e].apply(r,o)}}));var c=Object.hasOwnProperty||function(e,t){return t in e}},3804:function(e){"use strict";e.exports=window.React}},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=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(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=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};!function(){"use strict";n.r(o),n.d(o,{AlignmentControl:function(){return bg},AlignmentToolbar:function(){return kg},Autocomplete:function(){return Cg},BlockAlignmentControl:function(){return Fo},BlockAlignmentToolbar:function(){return zo},BlockBreadcrumb:function(){return xg},BlockColorsStyleSelector:function(){return Rg},BlockContextProvider:function(){return lr},BlockControls:function(){return Zn},BlockEdit:function(){return cr},BlockEditorKeyboardShortcuts:function(){return $k},BlockEditorProvider:function(){return Wa},BlockFormatControls:function(){return Yn},BlockIcon:function(){return Ha},BlockInspector:function(){return Hk},BlockList:function(){return nm},BlockMover:function(){return Gd},BlockNavigationDropdown:function(){return ev},BlockPreview:function(){return au},BlockSelectionClearer:function(){return Ka},BlockSettingsMenu:function(){return Pp},BlockSettingsMenuControls:function(){return Ip},BlockTitle:function(){return Td},BlockToolbar:function(){return Mp},BlockTools:function(){return Uk},BlockVerticalAlignmentControl:function(){return yv},BlockVerticalAlignmentToolbar:function(){return Ev},ButtonBlockAppender:function(){return kd},ButtonBlockerAppender:function(){return bd},ColorPalette:function(){return wv},ColorPaletteControl:function(){return Sv},ContrastChecker:function(){return rf},CopyHandler:function(){return gp},DefaultBlockAppender:function(){return gd},FontSizePicker:function(){return zf},InnerBlocks:function(){return Qp},Inserter:function(){return hd},InspectorAdvancedControls:function(){return Qo},InspectorControls:function(){return Jo},JustifyContentControl:function(){return go},JustifyToolbar:function(){return vo},LineHeightControl:function(){return yf},MediaPlaceholder:function(){return Vb},MediaReplaceFlow:function(){return Ab},MediaUpload:function(){return Rb},MediaUploadCheck:function(){return Lb},MultiSelectScrollIntoView:function(){return jk},NavigableToolbar:function(){return Rd},ObserveTyping:function(){return Zk},PanelColorSettings:function(){return Hb},PlainText:function(){return mk},PreserveScrollInReorder:function(){return Xk},RichText:function(){return uk},RichTextShortcut:function(){return gk},RichTextToolbarButton:function(){return vk},SETTINGS_DEFAULTS:function(){return v},SkipToSelectedBlock:function(){return Ak},ToolSelector:function(){return _k},Typewriter:function(){return t_},URLInput:function(){return ub},URLInputButton:function(){return wk},URLPopover:function(){return Fb},Warning:function(){return dr},WritingFlow:function(){return oc},__experimentalBlockAlignmentMatrixControl:function(){return Bg},__experimentalBlockContentOverlay:function(){return Tg},__experimentalBlockFullHeightAligmentControl:function(){return Sg},__experimentalBlockPatternSetup:function(){return pv},__experimentalBlockVariationPicker:function(){return nv},__experimentalBlockVariationTransforms:function(){return fv},__experimentalBorderRadiusControl:function(){return xm},__experimentalBorderStyleControl:function(){return Lm},__experimentalColorGradientControl:function(){return am},__experimentalDuotoneControl:function(){return Vh},__experimentalFontAppearanceControl:function(){return _f},__experimentalFontFamilyControl:function(){return Pf},__experimentalGetBorderClassesAndStyles:function(){return Jh},__experimentalGetColorClassesAndStyles:function(){return ng},__experimentalGetGradientClass:function(){return Gm},__experimentalGetGradientObjectByGradientValue:function(){return $m},__experimentalGetMatchingVariation:function(){return mv},__experimentalGetSpacingClassesAndStyles:function(){return rg},__experimentalImageEditingProvider:function(){return Kv},__experimentalImageEditor:function(){return rb},__experimentalImageSizeControl:function(){return ib},__experimentalImageURLInputUI:function(){return Mk},__experimentalLayoutStyle:function(){return Po},__experimentalLetterSpacingControl:function(){return ih},__experimentalLibrary:function(){return Gk},__experimentalLinkControl:function(){return Nb},__experimentalLinkControlSearchInput:function(){return Eb},__experimentalLinkControlSearchItem:function(){return mb},__experimentalLinkControlSearchResults:function(){return gb},__experimentalListView:function(){return Qg},__experimentalPanelColorGradientSettings:function(){return nf},__experimentalPreviewOptions:function(){return Rk},__experimentalResponsiveBlockControl:function(){return hk},__experimentalTextDecorationControl:function(){return qf},__experimentalTextTransformControl:function(){return nh},__experimentalUnitControl:function(){return yk},__experimentalUseBorderProps:function(){return eg},__experimentalUseColorProps:function(){return og},__experimentalUseCustomSides:function(){return xh},__experimentalUseGradient:function(){return Km},__experimentalUseNoRecursiveRenders:function(){return l_},__experimentalUseResizeCanvas:function(){return Lk},__unstableBlockSettingsMenuFirstItem:function(){return Ep},__unstableEditorStyles:function(){return lu},__unstableIframe:function(){return ic},__unstableInserterMenuExtension:function(){return rd},__unstableRichTextInputEvent:function(){return bk},__unstableUseBlockSelectionClearer:function(){return ja},__unstableUseCanvasClickRedirect:function(){return o_},__unstableUseClipboardHandler:function(){return hp},__unstableUseMouseMoveTypingReset:function(){return qk},__unstableUseTypewriter:function(){return e_},__unstableUseTypingObserver:function(){return Yk},createCustomColorsHOC:function(){return ag},getColorClassName:function(){return dm},getColorObjectByAttributeValues:function(){return cm},getColorObjectByColorValue:function(){return um},getFontSize:function(){return Df},getFontSizeClass:function(){return Ff},getFontSizeObjectByValue:function(){return Of},getGradientSlugByValue:function(){return jm},getGradientValueBySlug:function(){return Wm},getPxFromCssUnit:function(){return p_},store:function(){return Vn},storeConfig:function(){return zn},transformStyles:function(){return nu},useBlockDisplayInformation:function(){return xd},useBlockEditContext:function(){return Wn},useBlockProps:function(){return Na},useCachedTruthy:function(){return lg},useInnerBlocksProps:function(){return Xp},useSetting:function(){return mo},validateThemeColors:function(){return i_},validateThemeGradients:function(){return s_},withColorContext:function(){return Cv},withColors:function(){return cg},withFontSizes:function(){return dg}});var e={};n.r(e),n.d(e,{__experimentalGetActiveBlockIdByBlockNames:function(){return Tt},__experimentalGetAllowedBlocks:function(){return ct},__experimentalGetAllowedPatterns:function(){return mt},__experimentalGetBlockListSettingsForBlocks:function(){return kt},__experimentalGetDirectInsertBlock:function(){return ut},__experimentalGetLastBlockAttributeChanges:function(){return Et},__experimentalGetParsedPattern:function(){return dt},__experimentalGetPatternTransformItems:function(){return ht},__experimentalGetPatternsByBlockTypes:function(){return ft},__experimentalGetReusableBlockTitle:function(){return _t},__unstableGetBlockWithoutInnerBlocks:function(){return $},__unstableGetClientIdWithClientIdsTree:function(){return K},__unstableGetClientIdsTree:function(){return q},__unstableIsLastBlockChangeIgnored:function(){return yt},areInnerBlocksControlled:function(){return xt},canInsertBlockType:function(){return Ye},canInsertBlocks:function(){return Ze},canMoveBlock:function(){return Je},canMoveBlocks:function(){return et},canRemoveBlock:function(){return Xe},canRemoveBlocks:function(){return Qe},didAutomaticChange:function(){return Bt},getAdjacentBlockClientId:function(){return me},getBlock:function(){return W},getBlockAttributes:function(){return G},getBlockCount:function(){return J},getBlockHierarchyRootClientId:function(){return de},getBlockIndex:function(){return xe},getBlockInsertionPoint:function(){return Ue},getBlockListSettings:function(){return gt},getBlockMode:function(){return Ae},getBlockName:function(){return H},getBlockOrder:function(){return Ie},getBlockParents:function(){return ce},getBlockParentsByBlockName:function(){return ue},getBlockRootClientId:function(){return ae},getBlockSelectionEnd:function(){return oe},getBlockSelectionStart:function(){return ne},getBlockTransformItems:function(){return st},getBlocks:function(){return j},getBlocksByClientId:function(){return Q},getClientIdsOfDescendants:function(){return Y},getClientIdsWithDescendants:function(){return Z},getDraggedBlockClientIds:function(){return Fe},getFirstMultiSelectedBlockClientId:function(){return _e},getGlobalBlockCount:function(){return X},getInserterItems:function(){return it},getLastMultiSelectedBlockClientId:function(){return ye},getLowestCommonAncestorWithSelectedBlock:function(){return pe},getMultiSelectedBlockClientIds:function(){return be},getMultiSelectedBlocks:function(){return ke},getMultiSelectedBlocksEndClientId:function(){return Be},getMultiSelectedBlocksStartClientId:function(){return Se},getNextBlockClientId:function(){return he},getPreviousBlockClientId:function(){return fe},getSelectedBlock:function(){return se},getSelectedBlockClientId:function(){return ie},getSelectedBlockClientIds:function(){return ve},getSelectedBlockCount:function(){return re},getSelectedBlocksInitialCaretPosition:function(){return ge},getSelectionEnd:function(){return te},getSelectionStart:function(){return ee},getSettings:function(){return vt},getTemplate:function(){return $e},getTemplateLock:function(){return je},hasBlockMovingClientId:function(){return St},hasInserterItems:function(){return at},hasMultiSelection:function(){return Me},hasSelectedBlock:function(){return le},hasSelectedInnerBlock:function(){return Ne},isAncestorBeingDragged:function(){return Ve},isAncestorMultiSelected:function(){return we},isBlockBeingDragged:function(){return ze},isBlockHighlighted:function(){return It},isBlockInsertionPointVisible:function(){return Ge},isBlockMultiSelected:function(){return Ce},isBlockSelected:function(){return Te},isBlockValid:function(){return U},isBlockWithinSelection:function(){return Pe},isCaretWithinFormattedText:function(){return He},isDraggingBlocks:function(){return Oe},isFirstMultiSelectedBlock:function(){return Ee},isLastBlockChangePersistent:function(){return bt},isMultiSelecting:function(){return Re},isNavigationMode:function(){return wt},isSelectionEnabled:function(){return Le},isTyping:function(){return De},isValidTemplate:function(){return We},wasBlockJustInserted:function(){return Nt}});var t={};n.r(t),n.d(t,{__unstableMarkAutomaticChange:function(){return Tn},__unstableMarkLastChangeAsPersistent:function(){return In},__unstableMarkNextChangeAsNotPersistent:function(){return xn},__unstableSaveReusableBlock:function(){return Bn},clearSelectedBlock:function(){return Kt},duplicateBlocks:function(){return Mn},enterFormattedText:function(){return kn},exitFormattedText:function(){return yn},flashBlock:function(){return Dn},hideInsertionPoint:function(){return sn},insertAfterBlock:function(){return Ln},insertBeforeBlock:function(){return Rn},insertBlock:function(){return on},insertBlocks:function(){return rn},insertDefaultBlock:function(){return Cn},mergeBlocks:function(){return un},moveBlockToPosition:function(){return nn},moveBlocksDown:function(){return Jt},moveBlocksToPosition:function(){return tn},moveBlocksUp:function(){return en},multiSelect:function(){return jt},receiveBlocks:function(){return Ft},removeBlock:function(){return pn},removeBlocks:function(){return dn},replaceBlock:function(){return Xt},replaceBlocks:function(){return Zt},replaceInnerBlocks:function(){return mn},resetBlocks:function(){return At},resetSelection:function(){return Ot},selectBlock:function(){return Ht},selectNextBlock:function(){return Gt},selectPreviousBlock:function(){return Ut},selectionChange:function(){return En},setBlockMovingClientId:function(){return Pn},setHasControlledInnerBlocks:function(){return On},setNavigationMode:function(){return Nn},setTemplateValidity:function(){return an},showInsertionPoint:function(){return ln},startDraggingBlocks:function(){return vn},startMultiSelect:function(){return Wt},startTyping:function(){return hn},stopDraggingBlocks:function(){return bn},stopMultiSelect:function(){return $t},stopTyping:function(){return gn},synchronizeTemplate:function(){return cn},toggleBlockHighlight:function(){return An},toggleBlockMode:function(){return fn},toggleSelection:function(){return qt},updateBlock:function(){return Vt},updateBlockAttributes:function(){return zt},updateBlockListSettings:function(){return wn},updateSettings:function(){return Sn},validateBlocksToTemplate:function(){return Dt}});var r=window.wp.blocks,l=window.wp.hooks;function i(){return(i=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}).apply(this,arguments)}(0,l.addFilter)("blocks.registerBlockType","core/compat/migrateLightBlockWrapper",(function(e){const{apiVersion:t=1}=e;return t<2&&(0,r.hasBlockSupport)(e,"lightBlockWrapper",!1)&&(e.apiVersion=2),e}));var s=window.wp.element,a=n(4184),c=n.n(a),u=window.lodash,d=window.wp.compose,p=window.wp.components,m=window.wp.data,f={default:(0,p.createSlotFill)("BlockControls"),block:(0,p.createSlotFill)("BlockControlsBlock"),inline:(0,p.createSlotFill)("BlockFormatControls"),other:(0,p.createSlotFill)("BlockControlsOther"),parent:(0,p.createSlotFill)("BlockControlsParent")},h=window.wp.i18n;const g={insertUsage:{}},v={alignWide:!1,supportsLayout:!0,colors:[{name:(0,h.__)("Black"),slug:"black",color:"#000000"},{name:(0,h.__)("Cyan bluish gray"),slug:"cyan-bluish-gray",color:"#abb8c3"},{name:(0,h.__)("White"),slug:"white",color:"#ffffff"},{name:(0,h.__)("Pale pink"),slug:"pale-pink",color:"#f78da7"},{name:(0,h.__)("Vivid red"),slug:"vivid-red",color:"#cf2e2e"},{name:(0,h.__)("Luminous vivid orange"),slug:"luminous-vivid-orange",color:"#ff6900"},{name:(0,h.__)("Luminous vivid amber"),slug:"luminous-vivid-amber",color:"#fcb900"},{name:(0,h.__)("Light green cyan"),slug:"light-green-cyan",color:"#7bdcb5"},{name:(0,h.__)("Vivid green cyan"),slug:"vivid-green-cyan",color:"#00d084"},{name:(0,h.__)("Pale cyan blue"),slug:"pale-cyan-blue",color:"#8ed1fc"},{name:(0,h.__)("Vivid cyan blue"),slug:"vivid-cyan-blue",color:"#0693e3"},{name:(0,h.__)("Vivid purple"),slug:"vivid-purple",color:"#9b51e0"}],fontSizes:[{name:(0,h._x)("Small","font size name"),size:13,slug:"small"},{name:(0,h._x)("Normal","font size name"),size:16,slug:"normal"},{name:(0,h._x)("Medium","font size name"),size:20,slug:"medium"},{name:(0,h._x)("Large","font size name"),size:36,slug:"large"},{name:(0,h._x)("Huge","font size name"),size:42,slug:"huge"}],imageDefaultSize:"large",imageSizes:[{slug:"thumbnail",name:(0,h.__)("Thumbnail")},{slug:"medium",name:(0,h.__)("Medium")},{slug:"large",name:(0,h.__)("Large")},{slug:"full",name:(0,h.__)("Full Size")}],imageEditing:!0,maxWidth:580,allowedBlockTypes:!0,maxUploadFileSize:0,allowedMimeTypes:null,__experimentalCanUserUseUnfilteredHTML:!1,__experimentalBlockDirectory:!1,__mobileEnablePageTemplates:!1,__experimentalBlockPatterns:[],__experimentalBlockPatternCategories:[],__experimentalSpotlightEntityBlocks:[],__unstableGalleryWithImageBlocks:!1,gradients:[{name:(0,h.__)("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,h.__)("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,h.__)("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,h.__)("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,h.__)("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,h.__)("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,h.__)("Blush light purple"),gradient:"linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)",slug:"blush-light-purple"},{name:(0,h.__)("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,h.__)("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,h.__)("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,h.__)("Electric grass"),gradient:"linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)",slug:"electric-grass"},{name:(0,h.__)("Midnight"),gradient:"linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)",slug:"midnight"}]};function b(e,t,n){return[...e.slice(0,n),...(0,u.castArray)(t),...e.slice(n)]}function k(e,t,n,o=1){const r=[...e];return r.splice(t,o),b(r,e.slice(t,t+o),n)}function _(e,t=""){const n={[t]:[]};return e.forEach((e=>{const{clientId:o,innerBlocks:r}=e;n[t].push(o),Object.assign(n,_(r,o))})),n}function y(e,t=""){return e.reduce(((e,n)=>Object.assign(e,{[n.clientId]:t},y(n.innerBlocks,n.clientId))),{})}function E(e,t=u.identity){const n={},o=[...e];for(;o.length;){const{innerBlocks:e,...r}=o.shift();o.push(...e),n[r.clientId]=t(r)}return n}function C(e){return E(e,(e=>(0,u.omit)(e,"attributes")))}function w(e){return E(e,(e=>e.attributes))}function S(e,t="",n={}){return(0,u.reduce)(e[t],((t,o)=>n[o]?t:[...t,o,...S(e,o)]),[])}function B(e,t){return"UPDATE_BLOCK_ATTRIBUTES"===e.type&&void 0!==t&&"UPDATE_BLOCK_ATTRIBUTES"===t.type&&(0,u.isEqual)(e.clientIds,t.clientIds)&&function(e,t){return(0,u.isEqual)((0,u.keys)(e),(0,u.keys)(t))}(e.attributes,t.attributes)}function I(e,t){const n={},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[e.clientId]={};for(const t of r)n[t.clientId]=Object.assign(n[t.clientId],{...e.byClientId[t.clientId],attributes:e.attributes[t.clientId],innerBlocks:t.innerBlocks.map((e=>n[e.clientId]))});return n}function x(e,t,n,o=!1){const r=new Set([]),l=new Set;for(const t of n){let n=o?t:e.parents[t];do{if(e.controlledInnerBlocks[n]){l.add(n);break}r.add(n),n=e.parents[n]}while(void 0!==n)}for(const e of r)t[e]={...t[e]};for(const n of r)t[n].innerBlocks=(e.order[n]||[]).map((e=>t[e]));for(const n of l)t["controlled||"+n]={innerBlocks:(e.order[n]||[]).map((e=>t[e]))};return t}const T=(0,u.flow)(m.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=(0,u.mapValues)(t.attributes,((n,r)=>{const{name:l}=t.byClientId[r];return"core/block"===l&&n.ref===e?{...n,ref:o}:n}))}return e(t,n)}),(e=>(t={},n)=>{const o=e(t,n);if(o===t)return t;switch(o.tree=t.tree?t.tree:{},n.type){case"RECEIVE_BLOCKS":case"INSERT_BLOCKS":{const e=I(o,n.blocks);o.tree=x(o,{...o.tree,...e},n.rootClientId?[n.rootClientId]:[""],!0);break}case"UPDATE_BLOCK":o.tree=x(o,{...o.tree,[n.clientId]:{...o.tree[n.clientId],...o.byClientId[n.clientId],attributes:o.attributes[n.clientId]}},[n.clientId],!1);break;case"UPDATE_BLOCK_ATTRIBUTES":{const e=n.clientIds.reduce(((e,t)=>(e[t]={...o.tree[t],attributes:o.attributes[t]},e)),{});o.tree=x(o,{...o.tree,...e},n.clientIds,!1);break}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const e=I(o,n.blocks);o.tree=x(o,{...(0,u.omit)(o.tree,n.replacedClientIds.concat(n.replacedClientIds.map((e=>"controlled||"+e)))),...e},n.blocks.map((e=>e.clientId)),!1);const r=[];for(const e of n.clientIds)void 0===t.parents[e]||""!==t.parents[e]&&!o.byClientId[t.parents[e]]||r.push(t.parents[e]);o.tree=x(o,o.tree,r,!0);break}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":const e=[];for(const r of n.clientIds)void 0===t.parents[r]||""!==t.parents[r]&&!o.byClientId[t.parents[r]]||e.push(t.parents[r]);o.tree=x(o,(0,u.omit)(o.tree,n.removedClientIds.concat(n.removedClientIds.map((e=>"controlled||"+e)))),e,!0);break;case"MOVE_BLOCKS_TO_POSITION":{const e=[];n.fromRootClientId&&e.push(n.fromRootClientId),n.toRootClientId&&e.push(n.toRootClientId),n.fromRootClientId&&n.fromRootClientId||e.push(""),o.tree=x(o,o.tree,e,!0);break}case"MOVE_BLOCKS_UP":case"MOVE_BLOCKS_DOWN":{const e=[n.rootClientId?n.rootClientId:""];o.tree=x(o,o.tree,e,!0);break}case"SAVE_REUSABLE_BLOCK_SUCCESS":{const e=(0,u.keys)((0,u.omitBy)(o.attributes,((e,t)=>"core/block"!==o.byClientId[t].name||e.ref!==n.updatedId)));o.tree=x(o,{...o.tree,...e.reduce(((e,t)=>(e[t]={...o.byClientId[t],attributes:o.attributes[t],innerBlocks:o.tree[t].innerBlocks},e)),{})},e,!1)}}return o}),(e=>(t,n)=>{const o=e=>{let o=e;for(let r=0;r<o.length;r++)!t.order[o[r]]||n.keepControlledInnerBlocks&&n.keepControlledInnerBlocks[o[r]]||(o===e&&(o=[...o]),o.push(...t.order[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[n.rootClientId]&&(r=e(r,{type:"REMOVE_BLOCKS",keepControlledInnerBlocks:o,clientIds:t.order[n.rootClientId]}));let l=r;return n.blocks.length&&(l=e(l,{...n,type:"INSERT_BLOCKS",index:0}),l.order={...l.order,...(0,u.reduce)(o,((e,n,o)=>(t.order[o]&&(e[o]=t.order[o]),e)),{})}),l}),(e=>(t,n)=>{if("RESET_BLOCKS"===n.type){var o,r,l;const e=S(null!==(o=null==t?void 0:t.order)&&void 0!==o?o:{},"",null!==(r=null==t?void 0:t.controlledInnerBlocks)&&void 0!==r?r:{}),i=Object.keys((0,u.pickBy)(null!==(l=null==t?void 0:t.controlledInnerBlocks)&&void 0!==l?l:{})),s={...t,byClientId:{...(0,u.omit)(null==t?void 0:t.byClientId,e),...C(n.blocks)},attributes:{...(0,u.omit)(null==t?void 0:t.attributes,e),...w(n.blocks)},order:{...(0,u.omit)(null==t?void 0:t.order,e),...(0,u.omit)(_(n.blocks),i)},parents:{...(0,u.omit)(null==t?void 0:t.parents,e),...y(n.blocks)},controlledInnerBlocks:(null==t?void 0:t.controlledInnerBlocks)||{}},a=I(s,n.blocks);return s.tree={...(0,u.omit)(null==t?void 0:t.tree,e),...a,"":{innerBlocks:n.blocks.map((e=>a[e.clientId]))}},s}return e(t,n)}),(function(e){let t,n=!1;return(o,r)=>{let l=e(o,r);const i="MARK_LAST_CHANGE_AS_PERSISTENT"===r.type||n;if(o===l&&!i){var s;n="MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"===r.type;const e=null===(s=null==o?void 0:o.isPersistentChange)||void 0===s||s;return o.isPersistentChange===e?o:{...l,isPersistentChange:e}}return l={...l,isPersistentChange:i?!n:!B(r,t)},t=r,n="MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"===r.type,l}}),(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}}))({byClientId(e={},t){switch(t.type){case"RECEIVE_BLOCKS":case"INSERT_BLOCKS":return{...e,...C(t.blocks)};case"UPDATE_BLOCK":if(!e[t.clientId])return e;const n=(0,u.omit)(t.updates,"attributes");return(0,u.isEmpty)(n)?e:{...e,[t.clientId]:{...e[t.clientId],...n}};case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":return t.blocks?{...(0,u.omit)(e,t.replacedClientIds),...C(t.blocks)}:e;case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":return(0,u.omit)(e,t.removedClientIds)}return e},attributes(e={},t){switch(t.type){case"RECEIVE_BLOCKS":case"INSERT_BLOCKS":return{...e,...w(t.blocks)};case"UPDATE_BLOCK":return e[t.clientId]&&t.updates.attributes?{...e,[t.clientId]:{...e[t.clientId],...t.updates.attributes}}:e;case"UPDATE_BLOCK_ATTRIBUTES":{if(t.clientIds.every((t=>!e[t])))return e;const n=t.clientIds.reduce(((n,o)=>({...n,[o]:(0,u.reduce)(t.uniqueByBlock?t.attributes[o]:t.attributes,((t,n,r)=>{var l,i;return n!==t[r]&&((t=(l=e[o])===(i=t)?{...l}:i)[r]=n),t}),e[o])})),{});return t.clientIds.every((t=>n[t]===e[t]))?e:{...e,...n}}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":return t.blocks?{...(0,u.omit)(e,t.replacedClientIds),...w(t.blocks)}:e;case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":return(0,u.omit)(e,t.removedClientIds)}return e},order(e={},t){switch(t.type){case"RECEIVE_BLOCKS":{const n=_(t.blocks);return{...e,...(0,u.omit)(n,""),"":((null==e?void 0:e[""])||[]).concat(n[""])}}case"INSERT_BLOCKS":{const{rootClientId:n=""}=t,o=e[n]||[],r=_(t.blocks,n),{index:l=o.length}=t;return{...e,...r,[n]:b(o,r[n],l)}}case"MOVE_BLOCKS_TO_POSITION":{const{fromRootClientId:n="",toRootClientId:o="",clientIds:r}=t,{index:l=e[o].length}=t;if(n===o){const t=e[o].indexOf(r[0]);return{...e,[o]:k(e[o],t,l,r.length)}}return{...e,[n]:(0,u.without)(e[n],...r),[o]:b(e[o],r,l)}}case"MOVE_BLOCKS_UP":{const{clientIds:n,rootClientId:o=""}=t,r=(0,u.first)(n),l=e[o];if(!l.length||r===(0,u.first)(l))return e;const i=l.indexOf(r);return{...e,[o]:k(l,i,i-1,n.length)}}case"MOVE_BLOCKS_DOWN":{const{clientIds:n,rootClientId:o=""}=t,r=(0,u.first)(n),l=(0,u.last)(n),i=e[o];if(!i.length||l===(0,u.last)(i))return e;const s=i.indexOf(r);return{...e,[o]:k(i,s,s+1,n.length)}}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const{clientIds:n}=t;if(!t.blocks)return e;const o=_(t.blocks);return(0,u.flow)([e=>(0,u.omit)(e,t.replacedClientIds),e=>({...e,...(0,u.omit)(o,"")}),e=>(0,u.mapValues)(e,(e=>(0,u.reduce)(e,((e,t)=>t===n[0]?[...e,...o[""]]:(-1===n.indexOf(t)&&e.push(t),e)),[])))])(e)}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":return(0,u.flow)([e=>(0,u.omit)(e,t.removedClientIds),e=>(0,u.mapValues)(e,(e=>(0,u.without)(e,...t.removedClientIds)))])(e)}return e},parents(e={},t){switch(t.type){case"RECEIVE_BLOCKS":return{...e,...y(t.blocks)};case"INSERT_BLOCKS":return{...e,...y(t.blocks,t.rootClientId||"")};case"MOVE_BLOCKS_TO_POSITION":return{...e,...t.clientIds.reduce(((e,n)=>(e[n]=t.toRootClientId||"",e)),{})};case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":return{...(0,u.omit)(e,t.replacedClientIds),...y(t.blocks,e[t.clientIds[0]])};case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":return(0,u.omit)(e,t.removedClientIds)}return e},controlledInnerBlocks:(e={},{type:t,clientId:n,hasControlledInnerBlocks:o})=>"SET_HAS_CONTROLLED_INNER_BLOCKS"===t?{...e,[n]:o}:e});function N(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}var P,M,R=(0,m.combineReducers)({blocks:T,isTyping:function(e=!1,t){switch(t.type){case"START_TYPING":return!0;case"STOP_TYPING":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},isCaretWithinFormattedText:function(e=!1,t){switch(t.type){case"ENTER_FORMATTED_TEXT":return!0;case"EXIT_FORMATTED_TEXT":return!1}return e},selection:function(e={},t){var n,o;switch(t.type){case"SELECTION_CHANGE":return{selectionStart:{clientId:t.clientId,attributeKey:t.attributeKey,offset:t.startOffset},selectionEnd:{clientId:t.clientId,attributeKey:t.attributeKey,offset:t.endOffset}};case"RESET_SELECTION":const{selectionStart:r,selectionEnd:l}=t;return{selectionStart:r,selectionEnd:l};case"MULTI_SELECT":const{start:i,end:s}=t;return{selectionStart:{clientId:i},selectionEnd:{clientId:s}};case"RESET_BLOCKS":const a=null==e||null===(n=e.selectionStart)||void 0===n?void 0:n.clientId,c=null==e||null===(o=e.selectionEnd)||void 0===o?void 0:o.clientId;if(!a&&!c)return e;if(!t.blocks.some((e=>e.clientId===a)))return{selectionStart:{},selectionEnd:{}};if(!t.blocks.some((e=>e.clientId===c)))return{...e,selectionEnd:e.selectionStart}}return{selectionStart:N(e.selectionStart,t),selectionEnd:N(e.selectionEnd,t)}},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){switch(t.type){case"TOGGLE_SELECTION":return t.isSelectionEnabled}return e},initialPosition:function(e=null,t){return"REPLACE_BLOCKS"===t.type&&void 0!==t.initialPosition||["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(0,u.omit)(e,t.clientIds);case"UPDATE_BLOCK_LIST_SETTINGS":{const{clientId:n}=t;return t.settings?(0,u.isEqual)(e[n],t.settings)?e:{...e,[n]:t.settings}:e.hasOwnProperty(n)?(0,u.omit)(e,n):e}}return e},insertionPoint:function(e=null,t){switch(t.type){case"SHOW_INSERTION_POINT":const{rootClientId:e,index:n,__unstableWithInserter:o}=t;return{rootClientId:e,index:n,__unstableWithInserter:o};case"HIDE_INSERTION_POINT":return null}return e},template:function(e={isValid:!0},t){switch(t.type){case"SET_TEMPLATE_VALIDITY":return{...e,isValid:t.isValid}}return e},settings:function(e=v,t){switch(t.type){case"UPDATE_SETTINGS":return{...e,...t.settings}}return e},preferences:function(e=g,t){switch(t.type){case"INSERT_BLOCKS":case"REPLACE_BLOCKS":return t.blocks.reduce(((e,n)=>{const{attributes:o,name:l}=n,i=(0,m.select)(r.store).getActiveBlockVariation(l,o);let s=null!=i&&i.name?`${l}/${i.name}`:l;const a={name:s};return"core/block"===l&&(a.ref=o.ref,s+="/"+o.ref),{...e,insertUsage:{...e.insertUsage,[s]:{time:t.time,count:e.insertUsage[s]?e.insertUsage[s].count+1:1,insert:a}}}}),e)}return e},lastBlockAttributesChange:function(e,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 null},isNavigationMode:function(e=!1,t){return"INSERT_BLOCKS"!==t.type&&("SET_NAVIGATION_MODE"===t.type?t.isNavigationMode:e)},hasBlockMovingClientId:function(e=null,t){return"SET_BLOCK_MOVING_MODE"===t.type?t.hasBlockMovingClientId:"SET_NAVIGATION_MODE"===t.type?null:e},automaticChangeStatus:function(e,t){switch(t.type){case"MARK_AUTOMATIC_CHANGE":return"pending";case"MARK_AUTOMATIC_CHANGE_FINAL":return"pending"===e?"final":void 0;case"SELECTION_CHANGE":return"final"!==e?e:void 0;case"START_TYPING":case"STOP_TYPING":return 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){var n;switch(t.type){case"INSERT_BLOCKS":return t.blocks.length?{clientId:t.blocks[0].clientId,source:null===(n=t.meta)||void 0===n?void 0:n.source}:e;case"RESET_BLOCKS":return{}}return e}});function L(e){return[e]}function A(){var e={clear:function(){e.head=null}};return e}function D(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 O(e,t){var n,o;function r(){n=M?new WeakMap:A()}function l(){var n,r,l,i,s,a=arguments.length;for(i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];for(s=t.apply(null,i),(n=o(s)).isUniqueByDependants||(n.lastDependants&&!D(s,n.lastDependants,0)&&n.clear(),n.lastDependants=s),r=n.head;r;){if(D(r.args,i,1))return r!==n.head&&(r.prev.next=r.next,r.next&&(r.next.prev=r.prev),r.next=n.head,r.prev=null,n.head.prev=r,n.head=r),r.val;r=r.next}return r={val:e.apply(null,i)},i[0]=null,r.args=i,n.head&&(n.head.prev=r,r.next=n.head),n.head=r,r.val}return t||(t=L),o=M?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(P)||((l=A()).isUniqueByDependants=a,s.set(P,l)),s.get(P)}:function(){return n},l.getDependants=t,l.clear=r,r(),l}P={},M="undefined"!=typeof WeakMap;var F=window.wp.primitives,z=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"}));const V=[];function H(e,t){const n=e.blocks.byClientId[t],o="core/social-link";if("web"!==s.Platform.OS&&(null==n?void 0:n.name)===o){const n=e.blocks.attributes[t],{service:r}=n;return r?`core/social-link-${r}`:o}return n?n.name:null}function U(e,t){const n=e.blocks.byClientId[t];return!!n&&n.isValid}function G(e,t){return e.blocks.byClientId[t]?e.blocks.attributes[t]:null}function W(e,t){return e.blocks.byClientId[t]?e.blocks.tree[t]:null}const $=O(((e,t)=>{const n=e.blocks.byClientId[t];return n?{...n,attributes:G(e,t)}:null}),((e,t)=>[e.blocks.byClientId[t],e.blocks.attributes[t]]));function j(e,t){var n;const o=t&&xt(e,t)?"controlled||"+t:t||"";return(null===(n=e.blocks.tree[o])||void 0===n?void 0:n.innerBlocks)||V}const K=O(((e,t)=>({clientId:t,innerBlocks:q(e,t)})),(e=>[e.blocks.order])),q=O(((e,t="")=>(0,u.map)(Ie(e,t),(t=>K(e,t)))),(e=>[e.blocks.order])),Y=(e,t)=>(0,u.flatMap)(t,(t=>{const n=Ie(e,t);return[...n,...Y(e,n)]})),Z=O((e=>{const t=Ie(e);return[...t,...Y(e,t)]}),(e=>[e.blocks.order])),X=O(((e,t)=>{const n=Z(e);return t?(0,u.reduce)(n,((n,o)=>e.blocks.byClientId[o].name===t?n+1:n),0):n.length}),(e=>[e.blocks.order,e.blocks.byClientId])),Q=O(((e,t)=>(0,u.map)((0,u.castArray)(t),(t=>W(e,t)))),((e,t)=>(0,u.map)((0,u.castArray)(t),(t=>e.blocks.tree[t]))));function J(e,t){return Ie(e,t).length}function ee(e){return e.selection.selectionStart}function te(e){return e.selection.selectionEnd}function ne(e){return e.selection.selectionStart.clientId}function oe(e){return e.selection.selectionEnd.clientId}function re(e){return be(e).length||(e.selection.selectionStart.clientId?1:0)}function le(e){const{selectionStart:t,selectionEnd:n}=e.selection;return!!t.clientId&&t.clientId===n.clientId}function ie(e){const{selectionStart:t,selectionEnd:n}=e.selection,{clientId:o}=t;return o&&o===n.clientId?o:null}function se(e){const t=ie(e);return t?W(e,t):null}function ae(e,t){return void 0!==e.blocks.parents[t]?e.blocks.parents[t]:null}const ce=O(((e,t,n=!1)=>{const o=[];let r=t;for(;e.blocks.parents[r];)r=e.blocks.parents[r],o.push(r);return n?o:o.reverse()}),(e=>[e.blocks.parents])),ue=O(((e,t,n,o=!1)=>{const r=ce(e,t,o);return(0,u.map)((0,u.filter)((0,u.map)(r,(t=>({id:t,name:H(e,t)}))),(({name:e})=>Array.isArray(n)?n.includes(e):e===n)),(({id:e})=>e))}),(e=>[e.blocks.parents]));function de(e,t){let n,o=t;do{n=o,o=e.blocks.parents[o]}while(o);return n}function pe(e,t){const n=ie(e),o=[...ce(e,t),t],r=[...ce(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 me(e,t,n=1){if(void 0===t&&(t=ie(e)),void 0===t&&(t=n<0?_e(e):ye(e)),!t)return null;const o=ae(e,t);if(null===o)return null;const{order:r}=e.blocks,l=r[o],i=l.indexOf(t)+1*n;return i<0||i===l.length?null:l[i]}function fe(e,t){return me(e,t,-1)}function he(e,t){return me(e,t,1)}function ge(e){return e.initialPosition}const ve=O((e=>{const{selectionStart:t,selectionEnd:n}=e.selection;if(void 0===t.clientId||void 0===n.clientId)return V;if(t.clientId===n.clientId)return[t.clientId];const o=ae(e,t.clientId);if(null===o)return V;const r=Ie(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 be(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId===n.clientId?V:ve(e)}const ke=O((e=>{const t=be(e);return t.length?t.map((t=>W(e,t))):V}),(e=>[...ve.getDependants(e),e.blocks.byClientId,e.blocks.order,e.blocks.attributes]));function _e(e){return(0,u.first)(be(e))||null}function ye(e){return(0,u.last)(be(e))||null}function Ee(e,t){return _e(e)===t}function Ce(e,t){return-1!==be(e).indexOf(t)}const we=O(((e,t)=>{let n=t,o=!1;for(;n&&!o;)n=ae(e,n),o=Ce(e,n);return o}),(e=>[e.blocks.order,e.selection.selectionStart.clientId,e.selection.selectionEnd.clientId]));function Se(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId===n.clientId?null:t.clientId||null}function Be(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId===n.clientId?null:n.clientId||null}function Ie(e,t){return e.blocks.order[t||""]||V}function xe(e,t,n){return Ie(e,n).indexOf(t)}function Te(e,t){const{selectionStart:n,selectionEnd:o}=e.selection;return n.clientId===o.clientId&&n.clientId===t}function Ne(e,t,n=!1){return(0,u.some)(Ie(e,t),(t=>Te(e,t)||Ce(e,t)||n&&Ne(e,t,n)))}function Pe(e,t){if(!t)return!1;const n=be(e),o=n.indexOf(t);return o>-1&&o<n.length-1}function Me(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId!==n.clientId}function Re(e){return e.isMultiSelecting}function Le(e){return e.isSelectionEnabled}function Ae(e,t){return e.blocksMode[t]||"visual"}function De(e){return e.isTyping}function Oe(e){return!!e.draggedBlocks.length}function Fe(e){return e.draggedBlocks}function ze(e,t){return e.draggedBlocks.includes(t)}function Ve(e,t){if(!Oe(e))return!1;const n=ce(e,t);return(0,u.some)(n,(t=>ze(e,t)))}function He(e){return e.isCaretWithinFormattedText}function Ue(e){let t,n;const{insertionPoint:o,selection:{selectionEnd:r}}=e;if(null!==o)return o;const{clientId:l}=r;return l?(t=ae(e,l)||void 0,n=xe(e,r.clientId,t)+1):n=Ie(e).length,{rootClientId:t,index:n}}function Ge(e){return null!==e.insertionPoint}function We(e){return e.template.isValid}function $e(e){return e.settings.template}function je(e,t){if(!t)return e.settings.templateLock;const n=gt(e,t);return n?n.templateLock:null}const Ke=(e,t,n=null)=>(0,u.isBoolean)(e)?e:(0,u.isArray)(e)?!(!e.includes("core/post-content")||null!==t)||e.includes(t):n,qe=(e,t,n=null)=>{let o;if(t&&"object"==typeof t?(o=t,t=o.name):o=(0,r.getBlockType)(t),!o)return!1;const{allowedBlockTypes:l}=vt(e);if(!Ke(l,t,!0))return!1;if(je(e,n))return!1;const i=gt(e,n);if(n&&void 0===i)return!1;const s=null==i?void 0:i.allowedBlocks,a=Ke(s,t),c=o.parent,u=H(e,n),d=Ke(c,u);return null!==a&&null!==d?a||d:null!==a?a:null===d||d},Ye=O(qe,((e,t,n)=>[e.blockListSettings[n],e.blocks.byClientId[n],e.settings.allowedBlockTypes,e.settings.templateLock]));function Ze(e,t,n=null){return t.every((t=>Ye(e,H(e,t),n)))}function Xe(e,t,n=null){const o=G(e,t);if(null===o)return!0;const{lock:r}=o,l=!!je(e,n);return void 0===r||void 0===(null==r?void 0:r.remove)?!l:!(null!=r&&r.remove)}function Qe(e,t,n=null){return t.every((t=>Xe(e,t,n)))}function Je(e,t,n=null){const o=G(e,t);if(null===o)return;const{lock:r}=o,l="all"===je(e,n);return void 0===r||void 0===(null==r?void 0:r.move)?!l:!(null!=r&&r.move)}function et(e,t,n=null){return t.every((t=>Je(e,t,n)))}function tt(e,t){var n,o;return null!==(n=null===(o=e.preferences.insertUsage)||void 0===o?void 0:o[t])&&void 0!==n?n:null}const nt=(e,t,n)=>!!(0,r.hasBlockSupport)(t,"inserter",!0)&&qe(e,t.name,n),ot=(e,t)=>n=>{const o=`${t.id}/${n.name}`,{time:r,count:l=0}=tt(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:rt(r,l)}},rt=(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}},lt=(e,{buildScope:t="inserter"})=>n=>{const o=n.name;let l=!1;(0,r.hasBlockSupport)(n.name,"multiple",!0)||(l=(0,u.some)(Q(e,Z(e)),{name:n.name}));const{time:i,count:s=0}=tt(e,o)||{},a={id:o,name:n.name,title:n.title,icon:n.icon,isDisabled:l,frecency:rt(i,s)};if("transform"===t)return a;const c=(0,r.getBlockVariations)(n.name,"inserter");return{...a,initialAttributes:{},description:n.description,category:n.category,keywords:n.keywords,variations:c,example:n.example,utility:1}},it=O(((e,t=null)=>{const n=lt(e,{buildScope:"inserter"}),o=/^\s*<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/,l=(0,r.getBlockTypes)().filter((n=>nt(e,n,t))).map(n),i=qe(e,"core/block",t)?Ct(e).map((t=>{let n=z;if("web"===s.Platform.OS){const e=("string"==typeof t.content.raw?t.content.raw:t.content).match(o);if(e){const[,,t="core/",o]=e,l=(0,r.getBlockType)(t+o);l&&(n=l.icon)}}const l=`core/block/${t.id}`,{time:i,count:a=0}=tt(e,l)||{},c=rt(i,a);return{id:l,name:"core/block",initialAttributes:{ref:t.id},title:t.title.raw,icon:n,category:"reusable",keywords:[],isDisabled:!1,utility:1,frecency:c}})):[],a=l.filter((({variations:e=[]})=>!e.some((({isDefault:e})=>e)))),c=[];for(const t of l){const{variations:n=[]}=t;if(n.length){const o=ot(e,t);c.push(...n.map(o))}}const u=(e,t)=>{const{core:n,noncore:o}=e;return(t.name.startsWith("core/")?n:o).push(t),e},d=a.reduce(u,{core:[],noncore:[]}),p=c.reduce(u,{core:[],noncore:[]});return[...d.core,...p.core,...d.noncore,...p.noncore,...i]}),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId,e.blocks.order,e.preferences.insertUsage,e.settings.allowedBlockTypes,e.settings.templateLock,Ct(e),(0,r.getBlockTypes)()])),st=O(((e,t,n=null)=>{const o=lt(e,{buildScope:"transform"}),l=(0,r.getBlockTypes)().filter((t=>nt(e,t,n))).map(o),i=(0,u.mapKeys)(l,(({name:e})=>e)),s=(0,r.getPossibleBlockTransformations)(t).reduce(((e,t)=>(i[null==t?void 0:t.name]&&e.push(i[t.name]),e)),[]);return(0,u.orderBy)(s,(e=>i[e.name].frecency),"desc")}),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId,e.preferences.insertUsage,e.settings.allowedBlockTypes,e.settings.templateLock,(0,r.getBlockTypes)()])),at=O(((e,t=null)=>!!(0,u.some)((0,r.getBlockTypes)(),(n=>nt(e,n,t)))||qe(e,"core/block",t)&&Ct(e).length>0),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId,e.settings.allowedBlockTypes,e.settings.templateLock,Ct(e),(0,r.getBlockTypes)()])),ct=O(((e,t=null)=>{if(t)return(0,u.filter)((0,r.getBlockTypes)(),(n=>nt(e,n,t)))}),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId,e.settings.allowedBlockTypes,e.settings.templateLock,(0,r.getBlockTypes)()])),ut=O(((e,t=null)=>{var n,o;if(!t)return;const r=null===(n=e.blockListSettings[t])||void 0===n?void 0:n.__experimentalDefaultBlock,l=null===(o=e.blockListSettings[t])||void 0===o?void 0:o.__experimentalDirectInsert;return r&&l?"function"==typeof l?l(W(e,t))?r:null:r:void 0}),((e,t)=>[e.blockListSettings[t],e.blocks.tree[t]])),dt=O(((e,t)=>{const n=e.settings.__experimentalBlockPatterns.find((({name:e})=>e===t));return n?{...n,blocks:(0,r.parse)(n.content)}:null}),(e=>[e.settings.__experimentalBlockPatterns])),pt=O((e=>{const t=e.settings.__experimentalBlockPatterns,{allowedBlockTypes:n}=vt(e);return t.filter((({inserter:e=!0})=>!!e)).map((({name:t})=>dt(e,t))).filter((({blocks:e})=>((e,t)=>{if((0,u.isBoolean)(t))return t;const n=[...e];for(;n.length>0;){var o;const e=n.shift();if(!Ke(t,e.name||e.blockName,!0))return!1;null===(o=e.innerBlocks)||void 0===o||o.forEach((e=>{n.push(e)}))}return!0})(e,n)))}),(e=>[e.settings.__experimentalBlockPatterns,e.settings.allowedBlockTypes])),mt=O(((e,t=null)=>{const n=pt(e);return(0,u.filter)(n,(({blocks:n})=>n.every((({name:n})=>Ye(e,n,t)))))}),((e,t)=>[e.settings.__experimentalBlockPatterns,e.settings.allowedBlockTypes,e.settings.templateLock,e.blockListSettings[t],e.blocks.byClientId[t]])),ft=O(((e,t,n=null)=>{if(!t)return V;const o=mt(e,n),r=Array.isArray(t)?t:[t];return o.filter((e=>{var t,n;return null==e||null===(t=e.blockTypes)||void 0===t||null===(n=t.some)||void 0===n?void 0:n.call(t,(e=>r.includes(e)))}))}),((e,t)=>[...mt.getDependants(e,t)])),ht=O(((e,t,n=null)=>{if(!t)return V;if(t.some((({clientId:t,innerBlocks:n})=>n.length||xt(e,t))))return V;const o=Array.from(new Set(t.map((({name:e})=>e))));return ft(e,o,n)}),((e,t)=>[...ft.getDependants(e,t)]));function gt(e,t){return e.blockListSettings[t]}function vt(e){return e.settings}function bt(e){return e.blocks.isPersistentChange}const kt=O(((e,t=[])=>t.reduce(((t,n)=>e.blockListSettings[n]?{...t,[n]:e.blockListSettings[n]}:t),{})),(e=>[e.blockListSettings])),_t=O(((e,t)=>{var n;const o=(0,u.find)(Ct(e),(e=>e.id===t));return o?null===(n=o.title)||void 0===n?void 0:n.raw:null}),(e=>[Ct(e)]));function yt(e){return e.blocks.isIgnoredChange}function Et(e){return e.lastBlockAttributesChange}function Ct(e){var t,n;return null!==(t=null==e||null===(n=e.settings)||void 0===n?void 0:n.__experimentalReusableBlocks)&&void 0!==t?t:V}function wt(e){return e.isNavigationMode}function St(e){return e.hasBlockMovingClientId}function Bt(e){return!!e.automaticChangeStatus}function It(e,t){return e.highlightedBlock===t}function xt(e,t){return!!e.blocks.controlledInnerBlocks[t]}const Tt=O(((e,t)=>{if(!t.length)return null;const n=ie(e);if(t.includes(H(e,n)))return n;const o=be(e),r=ue(e,n||o[0],t);return r?(0,u.last)(r):null}),((e,t)=>[e.selection.selectionStart.clientId,e.selection.selectionEnd.clientId,t]));function Nt(e,t,n){const{lastBlockInserted:o}=e;return o.clientId===t&&o.source===n}var Pt=window.wp.a11y,Mt=window.wp.richText,Rt=window.wp.deprecated,Lt=n.n(Rt);const At=e=>({dispatch:t})=>{t({type:"RESET_BLOCKS",blocks:e}),t(Dt(e))},Dt=e=>({select:t,dispatch:n})=>{const o=t.getTemplate(),l=t.getTemplateLock(),i=!o||"all"!==l||(0,r.doBlocksMatchTemplate)(e,o);if(i!==t.isValidTemplate())return n.setTemplateValidity(i),i};function Ot(e,t,n){return{type:"RESET_SELECTION",selectionStart:e,selectionEnd:t,initialPosition:n}}function Ft(e){return Lt()('wp.data.dispatch( "core/block-editor" ).receiveBlocks',{since:"5.9",alternative:"resetBlocks or insertBlocks"}),{type:"RECEIVE_BLOCKS",blocks:e}}function zt(e,t,n=!1){return{type:"UPDATE_BLOCK_ATTRIBUTES",clientIds:(0,u.castArray)(e),attributes:t,uniqueByBlock:n}}function Vt(e,t){return{type:"UPDATE_BLOCK",clientId:e,updates:t}}function Ht(e,t=0){return{type:"SELECT_BLOCK",initialPosition:t,clientId:e}}const Ut=e=>({select:t,dispatch:n})=>{const o=t.getPreviousBlockClientId(e);o&&n.selectBlock(o,-1)},Gt=e=>({select:t,dispatch:n})=>{const o=t.getNextBlockClientId(e);o&&n.selectBlock(o)};function Wt(){return{type:"START_MULTI_SELECT"}}function $t(){return{type:"STOP_MULTI_SELECT"}}const jt=(e,t)=>({select:n,dispatch:o})=>{if(n.getBlockRootClientId(e)!==n.getBlockRootClientId(t))return;o({type:"MULTI_SELECT",start:e,end:t});const r=n.getSelectedBlockCount();(0,Pt.speak)((0,h.sprintf)(
|
| 2 |
/* translators: %s: number of selected blocks */
|
| 3 |
+
(0,h._n)("%s block selected.","%s blocks selected.",r),r),"assertive")};function Kt(){return{type:"CLEAR_SELECTED_BLOCK"}}function qt(e=!0){return{type:"TOGGLE_SELECTION",isSelectionEnabled:e}}function Yt(e,t){var n,o;const l=null!==(n=null==t||null===(o=t.__experimentalPreferredStyleVariations)||void 0===o?void 0:o.value)&&void 0!==n?n:{};return e.map((e=>{var t;const n=e.name;if(!(0,r.hasBlockSupport)(n,"defaultStylePicker",!0))return e;if(!l[n])return e;const o=null===(t=e.attributes)||void 0===t?void 0:t.className;if(null!=o&&o.includes("is-style-"))return e;const{attributes:i={}}=e,s=l[n];return{...e,attributes:{...i,className:`${o||""} is-style-${s}`.trim()}}}))}const Zt=(e,t,n,o=0,r)=>({select:l,dispatch:i})=>{e=(0,u.castArray)(e),t=Yt((0,u.castArray)(t),l.getSettings());const s=l.getBlockRootClientId((0,u.first)(e));for(let e=0;e<t.length;e++){const n=t[e];if(!l.canInsertBlockType(n.name,s))return}i({type:"REPLACE_BLOCKS",clientIds:e,blocks:t,time:Date.now(),indexToSelect:n,initialPosition:o,meta:r}),i((({select:e,dispatch:t})=>{if(e.getBlockCount()>0)return;const{__unstableHasCustomAppender:n}=e.getSettings();n||t.insertDefaultBlock()}))};function Xt(e,t){return Zt(e,t)}const Qt=e=>(t,n)=>({select:o,dispatch:r})=>{o.canMoveBlocks(t,n)&&r({type:e,clientIds:(0,u.castArray)(t),rootClientId:n})},Jt=Qt("MOVE_BLOCKS_DOWN"),en=Qt("MOVE_BLOCKS_UP"),tn=(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 nn(e,t="",n="",o){return tn([e],t,n,o)}function on(e,t,n,o,r){return rn([e],t,n,o,0,r)}const rn=(e,t,n,o=!0,r=0,l)=>({select:i,dispatch:s})=>{(0,u.isObject)(r)&&(l=r,r=0,Lt()("meta argument in wp.data.dispatch('core/block-editor')",{since:"10.1",plugin:"Gutenberg",hint:"The meta argument is now the 6th argument of the function"})),e=Yt((0,u.castArray)(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 ln(e,t,n={}){const{__unstableWithInserter:o}=n;return{type:"SHOW_INSERTION_POINT",rootClientId:e,index:t,__unstableWithInserter:o}}function sn(){return{type:"HIDE_INSERTION_POINT"}}function an(e){return{type:"SET_TEMPLATE_VALIDITY",isValid:e}}const cn=()=>({select:e,dispatch:t})=>{t({type:"SYNCHRONIZE_TEMPLATE"});const n=e.getBlocks(),o=e.getTemplate(),l=(0,r.synchronizeBlocksWithTemplate)(n,o);t.resetBlocks(l)},un=(e,t)=>({select:n,dispatch:o})=>{const l=[e,t];o({type:"MERGE_BLOCKS",blocks:l});const[i,s]=l,a=n.getBlock(i),c=(0,r.getBlockType)(a.name);if(c&&!c.merge)return void o.selectBlock(a.clientId);const d=n.getBlock(s),p=(0,r.getBlockType)(d.name),{clientId:m,attributeKey:f,offset:h}=n.getSelectionStart(),g=(m===i?c:p).attributes[f],v=(m===i||m===s)&&void 0!==f&&void 0!==h&&!!g;g||("number"==typeof f?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 f):window.console.error("The RichText identifier prop does not match any attributes defined by the block."));const b=(0,r.cloneBlock)(a),k=(0,r.cloneBlock)(d);if(v){const e=m===i?b:k,t=e.attributes[f],{multiline:n,__unstableMultilineWrapperTags:o,__unstablePreserveWhiteSpace:r}=g,l=(0,Mt.insert)((0,Mt.create)({html:t,multilineTag:n,multilineWrapperTags:o,preserveWhiteSpace:r}),"",h,h);e.attributes[f]=(0,Mt.toHTMLString)({value:l,multilineTag:n,preserveWhiteSpace:r})}const _=a.name===d.name?[k]:(0,r.switchToBlockType)(k,a.name);if(!_||!_.length)return;const y=c.merge(b.attributes,_[0].attributes);if(v){const e=(0,u.findKey)(y,(e=>"string"==typeof e&&-1!==e.indexOf(""))),t=y[e],{multiline:n,__unstableMultilineWrapperTags:r,__unstablePreserveWhiteSpace:l}=c.attributes[e],i=(0,Mt.create)({html:t,multilineTag:n,multilineWrapperTags:r,preserveWhiteSpace:l}),s=i.text.indexOf(""),d=(0,Mt.remove)(i,s,s+1),p=(0,Mt.toHTMLString)({value:d,multilineTag:n,preserveWhiteSpace:l});y[e]=p,o.selectionChange(a.clientId,e,s,s)}o.replaceBlocks([a.clientId,d.clientId],[{...a,attributes:{...a.attributes,...y}},..._.slice(1)],0)},dn=(e,t=!0)=>({select:n,dispatch:o})=>{if(!e||!e.length)return;e=(0,u.castArray)(e);const r=n.getBlockRootClientId(e[0]);n.canRemoveBlocks(e,r)&&(t&&o.selectPreviousBlock(e[0]),o({type:"REMOVE_BLOCKS",clientIds:e}),o((({select:e,dispatch:t})=>{if(e.getBlockCount()>0)return;const{__unstableHasCustomAppender:n}=e.getSettings();n||t.insertDefaultBlock()})))};function pn(e,t){return dn([e],t)}function mn(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 fn(e){return{type:"TOGGLE_BLOCK_MODE",clientId:e}}function hn(){return{type:"START_TYPING"}}function gn(){return{type:"STOP_TYPING"}}function vn(e=[]){return{type:"START_DRAGGING_BLOCKS",clientIds:e}}function bn(){return{type:"STOP_DRAGGING_BLOCKS"}}function kn(){return{type:"ENTER_FORMATTED_TEXT"}}function yn(){return{type:"EXIT_FORMATTED_TEXT"}}function En(e,t,n,o){return{type:"SELECTION_CHANGE",clientId:e,attributeKey:t,startOffset:n,endOffset:o}}function Cn(e,t,n){const o=(0,r.getDefaultBlockName)();if(o)return on((0,r.createBlock)(o,e),n,t)}function wn(e,t){return{type:"UPDATE_BLOCK_LIST_SETTINGS",clientId:e,settings:t}}function Sn(e){return{type:"UPDATE_SETTINGS",settings:e}}function Bn(e,t){return{type:"SAVE_REUSABLE_BLOCK_SUCCESS",id:e,updatedId:t}}function In(){return{type:"MARK_LAST_CHANGE_AS_PERSISTENT"}}function xn(){return{type:"MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"}}const Tn=()=>({dispatch:e})=>{e({type:"MARK_AUTOMATIC_CHANGE"});const{requestIdleCallback:t=(e=>setTimeout(e,100))}=window;t((()=>{e({type:"MARK_AUTOMATIC_CHANGE_FINAL"})}))},Nn=(e=!0)=>({dispatch:t})=>{t({type:"SET_NAVIGATION_MODE",isNavigationMode:e}),e?(0,Pt.speak)((0,h.__)("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.")):(0,Pt.speak)((0,h.__)("You are currently in edit mode. To return to the navigation mode, press Escape."))},Pn=(e=null)=>({dispatch:t})=>{t({type:"SET_BLOCK_MOVING_MODE",hasBlockMovingClientId:e}),e&&(0,Pt.speak)((0,h.__)("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."))},Mn=(e,t=!0)=>({select:n,dispatch:o})=>{if(!e||!e.length)return;const l=n.getBlocksByClientId(e);if((0,u.some)(l,(e=>!e)))return;if(l.map((e=>e.name)).some((e=>!(0,r.hasBlockSupport)(e,"multiple",!0))))return;const i=n.getBlockRootClientId(e[0]),s=n.getBlockIndex((0,u.last)((0,u.castArray)(e)),i),a=l.map((e=>(0,r.__experimentalCloneSanitizedBlock)(e)));return o.insertBlocks(a,s+1,i,t),a.length>1&&t&&o.multiSelect((0,u.first)(a).clientId,(0,u.last)(a).clientId),a.map((e=>e.clientId))},Rn=e=>({select:t,dispatch:n})=>{if(!e)return;const o=t.getBlockRootClientId(e);if(t.getTemplateLock(o))return;const r=t.getBlockIndex(e,o);return n.insertDefaultBlock({},o,r)},Ln=e=>({select:t,dispatch:n})=>{if(!e)return;const o=t.getBlockRootClientId(e);if(t.getTemplateLock(o))return;const r=t.getBlockIndex(e,o);return n.insertDefaultBlock({},o,r+1)};function An(e,t){return{type:"TOGGLE_BLOCK_HIGHLIGHT",clientId:e,isHighlighted:t}}const Dn=e=>async({dispatch:t})=>{t(An(e,!0)),await new Promise((e=>setTimeout(e,150))),t(An(e,!1))};function On(e,t){return{type:"SET_HAS_CONTROLLED_INNER_BLOCKS",hasControlledInnerBlocks:t,clientId:e}}const Fn="core/block-editor",zn={reducer:R,selectors:e,actions:t,__experimentalUseThunks:!0},Vn=(0,m.createReduxStore)(Fn,{...zn,persist:["preferences"]});(0,m.registerStore)(Fn,{...zn,persist:["preferences"]});const Hn={name:"",isSelected:!1},Un=(0,s.createContext)(Hn),{Provider:Gn}=Un;function Wn(){return(0,s.useContext)(Un)}function $n(){const{isSelected:e,clientId:t,name:n}=Wn();return(0,m.useSelect)((o=>{if(e)return!0;const{getBlockName:r,isFirstMultiSelectedBlock:l,getMultiSelectedBlockClientIds:i}=o(Vn);return!!l(t)&&i().every((e=>r(e)===n))}),[t,e,n])}function jn({group:e="default",controls:t,children:n,__experimentalShareWithChildBlocks:o=!1}){const l=function(e,t){const n=$n(),{clientId:o}=Wn(),l=(0,m.useSelect)((e=>{const{getBlockName:n,hasSelectedInnerBlock:l}=e(Vn),{hasBlockSupport:i}=e(r.store);return t&&i(n(o),"__experimentalExposeControlsToChildren",!1)&&l(o)}),[t,o]);var i;return n?null===(i=f[e])||void 0===i?void 0:i.Fill:l?f.parent.Fill:null}(e,o);return l?(0,s.createElement)(p.__experimentalStyleProvider,{document:document},(0,s.createElement)(l,null,(o=>{const r=(0,u.isEmpty)(o)?null:o;return(0,s.createElement)(p.__experimentalToolbarContext.Provider,{value:r},"default"===e&&(0,s.createElement)(p.ToolbarGroup,{controls:t}),n)}))):null}function Kn({group:e="default",...t}){const n=(0,s.useContext)(p.__experimentalToolbarContext),o=f[e].Slot,r=(0,p.__experimentalUseSlot)(o.__unstableName);return Boolean(r.fills&&r.fills.length)?"default"===e?(0,s.createElement)(o,i({},t,{bubblesVirtually:!0,fillProps:n})):(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(o,i({},t,{bubblesVirtually:!0,fillProps:n}))):null}const qn=jn;qn.Slot=Kn;const Yn=e=>(0,s.createElement)(jn,i({group:"inline"},e));Yn.Slot=e=>(0,s.createElement)(Kn,i({group:"inline"},e));var Zn=qn,Xn=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M5 15h14V9H5v6zm0 4.8h14v-1.5H5v1.5zM5 4.2v1.5h14V4.2H5z"})),Qn=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M4 9v6h14V9H4zm8-4.8H4v1.5h8V4.2zM4 19.8h8v-1.5H4v1.5z"})),Jn=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M7 9v6h10V9H7zM5 19.8h14v-1.5H5v1.5zM5 4.3v1.5h14V4.3H5z"})),eo=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M6 15h14V9H6v6zm6-10.8v1.5h8V4.2h-8zm0 15.6h8v-1.5h-8v1.5z"})),to=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M5 9v6h14V9H5zm11-4.8H8v1.5h8V4.2zM8 19.8h8v-1.5H8v1.5z"})),no=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M5 4v11h14V4H5zm3 15.8h8v-1.5H8v1.5z"})),oo=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M9 9v6h11V9H9zM4 20h1.5V4H4v16z"})),ro=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M20 9h-7.2V4h-1.6v5H4v6h7.2v5h1.6v-5H20z"})),lo=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z"})),io=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z"})),so=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M14.3 6.7l-1.1 1.1 4 4H4v1.5h13.3l-4.1 4.4 1.1 1.1 5.8-6.3z"})),ao=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M16.2 13.2l-4 4V4h-1.5v13.3l-4.5-4.1-1 1.1 6.2 5.8 5.8-5.8-1-1.1z"}));function co(e,t=""){return e.split(",").map((e=>`.editor-styles-wrapper ${e} ${t}`)).join(",")}const uo={"color.palette":e=>void 0===e.colors?void 0:e.colors,"color.gradients":e=>void 0===e.gradients?void 0: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=>void 0===e.fontSizes?void 0: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},po={"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"};function mo(e){const{name:t}=Wn();return(0,m.useSelect)((n=>{var o;const l=n(Vn).getSettings(),i=(e=>po[e]||e)(e),s=`__experimentalFeatures.${i}`,a=`__experimentalFeatures.blocks.${t}.${i}`,c=null!==(o=(0,u.get)(l,a))&&void 0!==o?o:(0,u.get)(l,s);var d,p;if(void 0!==c)return r.__EXPERIMENTAL_PATHS_WITH_MERGE[i]?null!==(d=null!==(p=c.user)&&void 0!==p?p:c.theme)&&void 0!==d?d:c.core:c;const m=uo[i]?uo[i](l):void 0;return void 0!==m?m:"typography.dropCap"===i||void 0}),[t,e])}const fo={left:oo,center:ro,right:lo,"space-between":io};var ho=function({allowedControls:e=["left","center","right","space-between"],isCollapsed:t=!0,onChange:n,value:o,popoverProps:r,isToolbar:l}){const a=e=>{n(e===o?void 0:e)},c=o?fo[o]:fo.left,u=[{name:"left",icon:oo,title:(0,h.__)("Justify items left"),isActive:"left"===o,onClick:()=>a("left")},{name:"center",icon:ro,title:(0,h.__)("Justify items center"),isActive:"center"===o,onClick:()=>a("center")},{name:"right",icon:lo,title:(0,h.__)("Justify items right"),isActive:"right"===o,onClick:()=>a("right")},{name:"space-between",icon:io,title:(0,h.__)("Space between items"),isActive:"space-between"===o,onClick:()=>a("space-between")}],d=l?p.ToolbarGroup:p.ToolbarDropdownMenu,m=l?{isCollapsed:t}:{};return(0,s.createElement)(d,i({icon:c,popoverProps:r,label:(0,h.__)("Change items justification"),controls:u.filter((t=>e.includes(t.name)))},m))};function go(e){return(0,s.createElement)(ho,i({},e,{isToolbar:!1}))}function vo(e){return(0,s.createElement)(ho,i({},e,{isToolbar:!0}))}const bo={left:"flex-start",right:"flex-end",center:"center","space-between":"space-between"},ko={left:"flex-start",right:"flex-end",center:"center"},_o=["wrap","nowrap"];var yo={name:"flex",label:(0,h.__)("Flex"),inspectorControls:function({layout:e={},onChange:t}){const{allowOrientation:n=!0}=e;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.Flex,null,(0,s.createElement)(p.FlexItem,null,(0,s.createElement)(Eo,{layout:e,onChange:t})),(0,s.createElement)(p.FlexItem,null,n&&(0,s.createElement)(wo,{layout:e,onChange:t}))),(0,s.createElement)(Co,{layout:e,onChange:t}))},toolBarControls:function({layout:e={},onChange:t,layoutBlockSupport:n}){return null!=n&&n.allowSwitching?null:(0,s.createElement)(Zn,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(Eo,{layout:e,onChange:t,isToolbar:!0}))},save:function({selector:e,layout:t}){const{orientation:n="horizontal",setCascadingProperties:o=!1}=t,r=null!==mo("spacing.blockGap"),l=bo[t.justifyContent]||bo.left,i=_o.includes(t.flexWrap)?t.flexWrap:"wrap";let a=`\n\t\tflex-direction: row;\n\t\talign-items: center;\n\t\tjustify-content: ${l};\n\t\t`;o&&(a+=`\n\t\t\t--layout-justification-setting: ${l};\n\t\t\t--layout-direction: row;\n\t\t\t--layout-wrap: ${i};\n\t\t\t--layout-justify: ${l};\n\t\t\t--layout-align: center;\n\t\t\t`);const c=ko[t.justifyContent]||ko.left;let u=`\n\t\tflex-direction: column;\n\t\talign-items: ${c};\n\t\t`;return o&&(u+=`\n\t\t\t--layout-justification-setting: ${c};\n\t\t\t--layout-direction: column;\n\t\t\t--layout-justify: initial;\n\t\t\t--layout-align: ${c};\n\t\t\t`),(0,s.createElement)("style",null,`\n\t\t\t\t${co(e)} {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tgap: ${r?"var( --wp--style--block-gap, 0.5em )":"0.5em"};\n\t\t\t\t\tflex-wrap: ${i};\n\t\t\t\t\t${"horizontal"===n?a:u}\n\t\t\t\t}\n\n\t\t\t\t${co(e,"> *")} {\n\t\t\t\t\tmargin: 0;\n\t\t\t\t}\n\t\t\t`)},getOrientation(e){const{orientation:t="horizontal"}=e;return t},getAlignments:()=>[]};function Eo({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"),n)return(0,s.createElement)(go,{allowedControls:i,value:o,onChange:l,popoverProps:{position:"bottom right",isAlternate:!0}});const a=[{value:"left",icon:oo,label:(0,h.__)("Justify items left")},{value:"center",icon:ro,label:(0,h.__)("Justify items center")},{value:"right",icon:lo,label:(0,h.__)("Justify items right")}];return"horizontal"===r&&a.push({value:"space-between",icon:io,label:(0,h.__)("Space between items")}),(0,s.createElement)("fieldset",{className:"block-editor-hooks__flex-layout-justification-controls"},(0,s.createElement)("legend",null,(0,h.__)("Justification")),(0,s.createElement)("div",null,a.map((({value:e,icon:t,label:n})=>(0,s.createElement)(p.Button,{key:e,label:n,icon:t,isPressed:o===e,onClick:()=>l(e)})))))}function Co({layout:e,onChange:t}){const{flexWrap:n="wrap"}=e;return(0,s.createElement)(p.ToggleControl,{label:(0,h.__)("Allow to wrap to multiple lines"),onChange:n=>{t({...e,flexWrap:n?"wrap":"nowrap"})},checked:"wrap"===n})}function wo({layout:e,onChange:t}){const{orientation:n="horizontal"}=e;return(0,s.createElement)("fieldset",{className:"block-editor-hooks__flex-layout-orientation-controls"},(0,s.createElement)("legend",null,(0,h.__)("Orientation")),(0,s.createElement)(p.Button,{label:"horizontal",icon:so,isPressed:"horizontal"===n,onClick:()=>t({...e,orientation:"horizontal"})}),(0,s.createElement)(p.Button,{label:"vertical",icon:ao,isPressed:"vertical"===n,onClick:()=>t({...e,orientation:"vertical"})}))}var So=function({icon:e,size:t=24,...n}){return(0,s.cloneElement)(e,{width:t,height:t,...n})};const Bo=[{name:"default",label:(0,h.__)("Flow"),inspectorControls:function({layout:e,onChange:t}){const{wideSize:n,contentSize:o}=e,r=(0,p.__experimentalUseCustomUnits)({availableUnits:mo("spacing.units")||["%","px","em","rem","vw"]});return(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)(p.__experimentalUnitControl,{label:(0,h.__)("Content"),labelPosition:"top",__unstableInputWidth:"80px",value:o||n||"",onChange:n=>{n=0>parseFloat(n)?"0":n,t({...e,contentSize:n})},units:r}),(0,s.createElement)(So,{icon:Jn})),(0,s.createElement)("div",{className:"block-editor-hooks__layout-controls-unit"},(0,s.createElement)(p.__experimentalUnitControl,{label:(0,h.__)("Wide"),labelPosition:"top",__unstableInputWidth:"80px",value:n||o||"",onChange:n=>{n=0>parseFloat(n)?"0":n,t({...e,wideSize:n})},units:r}),(0,s.createElement)(So,{icon:to}))),(0,s.createElement)("div",{className:"block-editor-hooks__layout-controls-reset"},(0,s.createElement)(p.Button,{variant:"secondary",isSmall:!0,disabled:!o&&!n,onClick:()=>t({contentSize:void 0,wideSize:void 0,inherit:!1})},(0,h.__)("Reset"))),(0,s.createElement)("p",{className:"block-editor-hooks__layout-controls-helptext"},(0,h.__)("Customize the width for all elements that are assigned to the center or wide columns.")))},toolBarControls:function(){return null},save:function({selector:e,layout:t={}}){const{contentSize:n,wideSize:o}=t,r=null!==mo("spacing.blockGap");let l=n||o?`\n\t\t\t\t\t${co(e,"> *")} {\n\t\t\t\t\t\tmax-width: ${null!=n?n:o};\n\t\t\t\t\t\tmargin-left: auto !important;\n\t\t\t\t\t\tmargin-right: auto !important;\n\t\t\t\t\t}\n\n\t\t\t\t\t${co(e,'> [data-align="wide"]')} {\n\t\t\t\t\t\tmax-width: ${null!=o?o:n};\n\t\t\t\t\t}\n\n\t\t\t\t\t${co(e,'> [data-align="full"]')} {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`:"";return l+=`\n\t\t\t${co(e,'> [data-align="left"]')} {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-right: 2em;\n\t\t\t}\n\n\t\t\t${co(e,'> [data-align="right"]')} {\n\t\t\t\tfloat: right;\n\t\t\t\tmargin-left: 2em;\n\t\t\t}\n\n\t\t`,r&&(l+=`\n\t\t\t\t${co(e,"> *")} {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\tmargin-bottom: 0;\n\t\t\t\t}\n\t\t\t\t${co(e,"> * + *")} {\n\t\t\t\t\tmargin-top: var( --wp--style--block-gap );\n\t\t\t\t}\n\t\t\t`),(0,s.createElement)("style",null,l)},getOrientation:()=>"vertical",getAlignments(e){const t=function(e){const{contentSize:t,wideSize:n}=e,o={},r=/^(?!0)\d+(px|em|rem|vw|vh|%)?$/i;return r.test(t)&&(
|
| 4 |
// translators: %s: container size (i.e. 600px etc)
|
| 5 |
+
o.none=(0,h.sprintf)((0,h.__)("Max %s wide"),t)),r.test(n)&&(
|
| 6 |
// translators: %s: container size (i.e. 600px etc)
|
| 7 |
+
o.wide=(0,h.sprintf)((0,h.__)("Max %s wide"),n)),o}(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}},yo];function Io(e="default"){return Bo.find((t=>t.name===e))}const xo={type:"default"},To=(0,s.createContext)(xo),No=To.Provider;function Po({layout:e={},...t}){const n=Io(e.type);return n?(0,s.createElement)(n.save,i({layout:e},t)):null}const Mo=["none","left","center","right","wide","full"],Ro=["wide","full"];function Lo(e=Mo){e.includes("none")||(e=["none",...e]);const{wideControlsEnabled:t=!1,themeSupportsLayout:n}=(0,m.useSelect)((e=>{const{getSettings:t}=e(Vn),n=t();return{wideControlsEnabled:n.alignWide,themeSupportsLayout:n.supportsLayout}}),[]),o=(0,s.useContext)(To),r=Io(null==o?void 0:o.type),l=r.getAlignments(o);if(n){const t=l.filter((({name:t})=>e.includes(t)));return 1===t.length&&"none"===t[0].name?[]:t}if("default"!==r.name)return[];const{alignments:i=Mo}=o,a=e.filter((e=>(o.alignments||t||!Ro.includes(e))&&i.includes(e))).map((e=>({name:e})));return 1===a.length&&"none"===a[0].name?[]:a}const Ao={none:{icon:Xn,title:(0,h.__)("None")},left:{icon:Qn,title:(0,h.__)("Align left")},center:{icon:Jn,title:(0,h.__)("Align center")},right:{icon:eo,title:(0,h.__)("Align right")},wide:{icon:to,title:(0,h.__)("Wide width")},full:{icon:no,title:(0,h.__)("Full width")}},Do={isAlternate:!0};var Oo=function({value:e,onChange:t,controls:n,isToolbar:o,isCollapsed:r=!0}){const l=Lo(n);if(!l.length)return null;function a(n){t([e,"none"].includes(n)?void 0:n)}const u=Ao[e],d=Ao.none,m=o?p.ToolbarGroup:p.ToolbarDropdownMenu,f={popoverProps:Do,icon:u?u.icon:d.icon,label:(0,h.__)("Align"),toggleProps:{describedBy:(0,h.__)("Change alignment")}},g=o||s.Platform.isNative?{isCollapsed:o?r:void 0,controls:l.map((({name:t})=>({...Ao[t],isActive:e===t||!e&&"none"===t,role:r?"menuitemradio":void 0,onClick:()=>a(t)})))}:{children:({onClose:t})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.MenuGroup,{className:"block-editor-block-alignment-control__menu-group"},l.map((({name:n,info:o})=>{const{icon:r,title:l}=Ao[n],i=n===e||!e&&"none"===n;return(0,s.createElement)(p.MenuItem,{key:n,icon:r,iconPosition:"left",className:c()("components-dropdown-menu__menu-item",{"is-active":i}),isSelected:i,onClick:()=>{a(n),t()},role:"menuitemradio",info:o},l)}))))};return(0,s.createElement)(m,i({},f,g))};function Fo(e){return(0,s.createElement)(Oo,i({},e,{isToolbar:!1}))}function zo(e){return(0,s.createElement)(Oo,i({},e,{isToolbar:!0}))}const Vo=["left","center","right","wide","full"],Ho=["wide","full"];function Uo(e,t=!0,n=!0){let o;return o=Array.isArray(e)?Vo.filter((t=>e.includes(t))):!0===e?[...Vo]:[],!n||!0===e&&!t?(0,u.without)(o,...Ho):o}const Go=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n}=t,o=Lo(Uo((0,r.getBlockSupport)(n,"align"),(0,r.hasBlockSupport)(n,"alignWide",!0))).map((({name:e})=>e));return(0,s.createElement)(s.Fragment,null,!!o.length&&(0,s.createElement)(Zn,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(Fo,{value:t.attributes.align,onChange:e=>{if(!e){var n,o;const l=(0,r.getBlockType)(t.name);(null==l||null===(n=l.attributes)||void 0===n||null===(o=n.align)||void 0===o?void 0:o.default)&&(e="")}t.setAttributes({align:e})},controls:o})),(0,s.createElement)(e,t))}),"withToolbarControls"),Wo=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n,attributes:o}=t,{align:l}=o,a=Lo(Uo((0,r.getBlockSupport)(n,"align"),(0,r.hasBlockSupport)(n,"alignWide",!0)));if(void 0===l)return(0,s.createElement)(e,t);let c=t.wrapperProps;return a.some((e=>e.name===l))&&(c={...c,"data-align":l}),(0,s.createElement)(e,i({},t,{wrapperProps:c}))}));(0,l.addFilter)("blocks.registerBlockType","core/align/addAttribute",(function(e){return(0,u.has)(e.attributes,["align","type"])||(0,r.hasBlockSupport)(e,"align")&&(e.attributes={...e.attributes,align:{type:"string",enum:[...Vo,""]}}),e})),(0,l.addFilter)("editor.BlockListBlock","core/editor/align/with-data-align",Wo),(0,l.addFilter)("editor.BlockEdit","core/editor/align/with-toolbar-controls",Go),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/align/addAssignedAlign",(function(e,t,n){const{align:o}=n;return Uo((0,r.getBlockSupport)(t,"align"),(0,r.hasBlockSupport)(t,"alignWide",!0)).includes(o)&&(e.className=c()(`align${o}`,e.className)),e})),(0,l.addFilter)("blocks.registerBlockType","core/lock/addAttribute",(function(e){return(0,u.has)(e.attributes,["lock","type"])||(e.attributes={...e.attributes,lock:{type:"object"}}),e})),window.wp.warning;var $o={default:(0,p.createSlotFill)("InspectorControls"),advanced:(0,p.createSlotFill)("InspectorAdvancedControls"),dimensions:(0,p.createSlotFill)("InspectorControlsDimensions"),typography:(0,p.createSlotFill)("InspectorControlsTypography")};function jo({__experimentalGroup:e="default",children:t}){var n;const o=$n(),r=null===(n=$o[e])||void 0===n?void 0:n.Fill;return r?o?(0,s.createElement)(p.__experimentalStyleProvider,{document:document},(0,s.createElement)(r,null,(e=>{const n=(0,u.isEmpty)(e)?null:e;return(0,s.createElement)(p.__experimentalToolsPanelContext.Provider,{value:n},t)}))):null:("undefined"!=typeof process&&process.env,null)}const Ko=e=>{if(!(0,u.isObject)(e)||Array.isArray(e))return e;const t=(0,u.pickBy)((0,u.mapValues)(e,Ko),u.identity);return(0,u.isEmpty)(t)?void 0:t};function qo({children:e,group:t,label:n}){const{clientId:o,attributes:r}=(0,m.useSelect)((e=>{const{getBlockAttributes:t,getSelectedBlockClientId:n}=e(Vn),o=n();return{clientId:o,attributes:t(o)}}),[]),{updateBlockAttributes:l}=(0,m.useDispatch)(Vn);return(0,s.createElement)(p.__experimentalToolsPanel,{className:`${t}-block-support-panel`,label:n,resetAll:(e=[])=>{const{style:t}=r;let n={style:t};e.forEach((e=>{n={...n,...e(n)}})),n={...n,style:Ko(n.style)},l(o,n)},key:o,panelId:o,hasInnerWrapper:!0,shouldRenderPlaceholderItems:!0},e)}function Yo({Slot:e,...t}){const n=(0,s.useContext)(p.__experimentalToolsPanelContext);return(0,s.createElement)(e,i({},t,{fillProps:n}))}function Zo({__experimentalGroup:e="default",bubblesVirtually:t=!0,label:n,...o}){var r;const l=null===(r=$o[e])||void 0===r?void 0:r.Slot,a=(0,p.__experimentalUseSlot)(null==l?void 0:l.__unstableName);return l&&a?Boolean(a.fills&&a.fills.length)?n?(0,s.createElement)(qo,{group:e,label:n},(0,s.createElement)(Yo,i({},o,{bubblesVirtually:t,Slot:l}))):(0,s.createElement)(l,i({},o,{bubblesVirtually:t})):null:("undefined"!=typeof process&&process.env,null)}const Xo=jo;Xo.Slot=Zo;const Qo=e=>(0,s.createElement)(jo,i({},e,{__experimentalGroup:"advanced"}));Qo.Slot=e=>(0,s.createElement)(Zo,i({},e,{__experimentalGroup:"advanced"})),Qo.slotName="InspectorAdvancedControls";var Jo=Xo;const er=/[\s#]/g,tr=(0,d.createHigherOrderComponent)((e=>t=>{if((0,r.hasBlockSupport)(t.name,"anchor")&&t.isSelected){const n="web"===s.Platform.OS,o=(0,s.createElement)(p.TextControl,{className:"html-anchor-control",label:(0,h.__)("HTML anchor"),help:(0,s.createElement)(s.Fragment,null,(0,h.__)("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."),n&&(0,s.createElement)(p.ExternalLink,{href:(0,h.__)("https://wordpress.org/support/article/page-jumps/")},(0,h.__)("Learn more about anchors"))),value:t.attributes.anchor||"",placeholder:n?null:(0,h.__)("Add an anchor"),onChange:e=>{e=e.replace(er,"-"),t.setAttributes({anchor:e})},autoCapitalize:"none",autoComplete:"off"});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(e,t),n&&(0,s.createElement)(Jo,{__experimentalGroup:"advanced"},o),!n&&"core/heading"===t.name&&(0,s.createElement)(Jo,null,(0,s.createElement)(p.PanelBody,{title:(0,h.__)("Heading settings")},o)))}return(0,s.createElement)(e,t)}),"withInspectorControl");(0,l.addFilter)("blocks.registerBlockType","core/anchor/attribute",(function(e){return(0,u.has)(e.attributes,["anchor","type"])||(0,r.hasBlockSupport)(e,"anchor")&&(e.attributes={...e.attributes,anchor:{type:"string",source:"attribute",attribute:"id",selector:"*"}}),e})),(0,l.addFilter)("editor.BlockEdit","core/editor/anchor/with-inspector-control",tr),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/anchor/save-props",(function(e,t,n){return(0,r.hasBlockSupport)(t,"anchor")&&(e.id=""===n.anchor?null:n.anchor),e}));const nr=(0,d.createHigherOrderComponent)((e=>t=>(0,r.hasBlockSupport)(t.name,"customClassName",!0)&&t.isSelected?(0,s.createElement)(s.Fragment,null,(0,s.createElement)(e,t),(0,s.createElement)(Jo,{__experimentalGroup:"advanced"},(0,s.createElement)(p.TextControl,{autoComplete:"off",label:(0,h.__)("Additional CSS class(es)"),value:t.attributes.className||"",onChange:e=>{t.setAttributes({className:""!==e?e:void 0})},help:(0,h.__)("Separate multiple classes with spaces.")}))):(0,s.createElement)(e,t)),"withInspectorControl");(0,l.addFilter)("blocks.registerBlockType","core/custom-class-name/attribute",(function(e){return(0,r.hasBlockSupport)(e,"customClassName",!0)&&(e.attributes={...e.attributes,className:{type:"string"}}),e})),(0,l.addFilter)("editor.BlockEdit","core/editor/custom-class-name/with-inspector-control",nr),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/custom-class-name/save-props",(function(e,t,n){return(0,r.hasBlockSupport)(t,"customClassName",!0)&&n.className&&(e.className=c()(e.className,n.className)),e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/generated-class-name/save-props",(function(e,t){return(0,r.hasBlockSupport)(t,"className",!0)&&("string"==typeof e.className?e.className=(0,u.uniq)([(0,r.getBlockDefaultClassName)(t.name),...e.className.split(" ")]).join(" ").trim():e.className=(0,r.getBlockDefaultClassName)(t.name)),e}));var or=window.wp.dom;const rr=(0,s.createContext)({});function lr({value:e,children:t}){const n=(0,s.useContext)(rr),o=(0,s.useMemo)((()=>({...n,...e})),[n,e]);return(0,s.createElement)(rr.Provider,{value:o,children:t})}var ir=rr;const sr={};var ar=(0,p.withFilters)("editor.BlockEdit")((e=>{const{attributes:t={},name:n}=e,o=(0,r.getBlockType)(n),l=(0,s.useContext)(ir),a=(0,s.useMemo)((()=>o&&o.usesContext?(0,u.pick)(l,o.usesContext):sr),[o,l]);if(!o)return null;const d=o.edit||o.save;if(o.apiVersion>1)return(0,s.createElement)(d,i({},e,{context:a}));const p=(0,r.hasBlockSupport)(o,"className",!0)?(0,r.getBlockDefaultClassName)(n):null,m=c()(p,t.className);return(0,s.createElement)(d,i({},e,{context:a,className:m}))}));function cr(e){const{name:t,isSelected:n,clientId:o}=e,r={name:t,isSelected:n,clientId:o};return(0,s.createElement)(Gn,{value:(0,s.useMemo)((()=>r),Object.values(r))},(0,s.createElement)(ar,e))}var ur=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z"})),dr=function({className:e,actions:t,children:n,secondaryActions:o}){return(0,s.createElement)("div",{className:c()(e,"block-editor-warning")},(0,s.createElement)("div",{className:"block-editor-warning__contents"},(0,s.createElement)("p",{className:"block-editor-warning__message"},n),(s.Children.count(t)>0||o)&&(0,s.createElement)("div",{className:"block-editor-warning__actions"},s.Children.count(t)>0&&s.Children.map(t,((e,t)=>(0,s.createElement)("span",{key:t,className:"block-editor-warning__action"},e))),o&&(0,s.createElement)(p.DropdownMenu,{className:"block-editor-warning__secondary",icon:ur,label:(0,h.__)("More options"),popoverProps:{position:"bottom left",className:"block-editor-warning__dropdown"},noIcons:!0},(()=>(0,s.createElement)(p.MenuGroup,null,o.map(((e,t)=>(0,s.createElement)(p.MenuItem,{onClick:e.onClick,key:t},e.title)))))))))},pr=n(7630);function mr({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)(s.RawHTML,null,(0,or.safeHTML)(n)))),(0,s.createElement)("div",{className:"block-editor-block-compare__action"},(0,s.createElement)(p.Button,{variant:"secondary",tabIndex:"0",onClick:o},r)))}var fr=function({block:e,onKeep:t,onConvert:n,convertor:o,convertButtonText:l}){const i=(a=o(e),(0,u.castArray)(a).map((e=>(0,r.getSaveContent)(e.name,e.attributes,e.innerBlocks))).join(""));var a;const d=(p=e.originalContent,m=i,(0,pr.Kx)(p,m).map(((e,t)=>{const n=c()({"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 p,m;return(0,s.createElement)("div",{className:"block-editor-block-compare__wrapper"},(0,s.createElement)(mr,{title:(0,h.__)("Current"),className:"block-editor-block-compare__current",action:t,actionText:(0,h.__)("Convert to HTML"),rawContent:e.originalContent,renderedContent:e.originalContent}),(0,s.createElement)(mr,{title:(0,h.__)("After Conversion"),className:"block-editor-block-compare__converted",action:n,actionText:l,rawContent:d,renderedContent:i}))};const hr=e=>(0,r.rawHandler)({HTML:e.originalContent});var gr=(0,d.compose)([(0,m.withSelect)(((e,{clientId:t})=>({block:e(Vn).getBlock(t)}))),(0,m.withDispatch)(((e,{block:t})=>{const{replaceBlock:n}=e(Vn);return{convertToClassic(){n(t.clientId,(e=>(0,r.createBlock)("core/freeform",{content:e.originalContent}))(t))},convertToHTML(){n(t.clientId,(e=>(0,r.createBlock)("core/html",{content:e.originalContent}))(t))},convertToBlocks(){n(t.clientId,hr(t))},attemptBlockRecovery(){n(t.clientId,(({name:e,attributes:t,innerBlocks:n})=>(0,r.createBlock)(e,t,n))(t))}}}))])((function({convertToHTML:e,convertToBlocks:t,convertToClassic:n,attemptBlockRecovery:o,block:l}){const i=!!(0,r.getBlockType)("core/html"),[a,c]=(0,s.useState)(!1),u=(0,s.useCallback)((()=>c(!0)),[]),d=(0,s.useCallback)((()=>c(!1)),[]),m=(0,s.useMemo)((()=>[{
|
| 8 |
// translators: Button to fix block content
|
| 9 |
+
title:(0,h._x)("Resolve","imperative verb"),onClick:u},i&&{title:(0,h.__)("Convert to HTML"),onClick:e},{title:(0,h.__)("Convert to Classic Block"),onClick:n}].filter(Boolean)),[u,e,n]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(dr,{actions:[(0,s.createElement)(p.Button,{key:"recover",onClick:o,variant:"primary"},(0,h.__)("Attempt Block Recovery"))],secondaryActions:m},(0,h.__)("This block contains unexpected or invalid content.")),a&&(0,s.createElement)(p.Modal,{title:// translators: Dialog title to fix block content
|
| 10 |
+
(0,h.__)("Resolve Block"),onRequestClose:d,className:"block-editor-block-compare"},(0,s.createElement)(fr,{block:l,onKeep:e,onConvert:t,convertor:hr,convertButtonText:(0,h.__)("Convert to Blocks")})))}));const vr=(0,s.createElement)(dr,{className:"block-editor-block-list__block-crash-warning"},(0,h.__)("This block has encountered an error and cannot be previewed."));var br=()=>vr;class kr extends s.Component{constructor(){super(...arguments),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?this.props.fallback:this.props.children}}var _r=kr,yr=n(4042),Er=function({clientId:e}){const[t,n]=(0,s.useState)(""),o=(0,m.useSelect)((t=>t(Vn).getBlock(e)),[e]),{updateBlock:l}=(0,m.useDispatch)(Vn);return(0,s.useEffect)((()=>{n((0,r.getBlockContent)(o))}),[o]),(0,s.createElement)(yr.Z,{className:"block-editor-block-list__block-html-textarea",value:t,onBlur:()=>{const i=(0,r.getBlockType)(o.name);if(!i)return;const s=(0,r.getBlockAttributes)(i,t,o.attributes),a=t||(0,r.getSaveContent)(i,s),c=!t||(0,r.isValidBlockContent)(i,s,a);l(e,{attributes:s,originalContent:a,isValid:c}),t||n({content:a})},onChange:e=>n(e.target.value)})};let Cr=Fr();const wr=e=>Lr(e,Cr);let Sr=Fr();wr.write=e=>Lr(e,Sr);let Br=Fr();wr.onStart=e=>Lr(e,Br);let Ir=Fr();wr.onFrame=e=>Lr(e,Ir);let xr=Fr();wr.onFinish=e=>Lr(e,xr);let Tr=[];wr.setTimeout=(e,t)=>{let n=wr.now()+t,o=()=>{let e=Tr.findIndex((e=>e.cancel==o));~e&&Tr.splice(e,1),Vr.count-=~e?1:0},r={time:n,handler:e,cancel:o};return Tr.splice(Nr(n),0,r),Vr.count+=1,Ar(),r};let Nr=e=>~(~Tr.findIndex((t=>t.time>e))||~Tr.length);wr.cancel=e=>{Cr.delete(e),Sr.delete(e)},wr.sync=e=>{Rr=!0,wr.batchedUpdates(e),Rr=!1},wr.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function o(...e){t=e,wr.onStart(n)}return o.handler=e,o.cancel=()=>{Br.delete(n),t=null},o};let Pr="undefined"!=typeof window?window.requestAnimationFrame:()=>{};wr.use=e=>Pr=e,wr.now="undefined"!=typeof performance?()=>performance.now():Date.now,wr.batchedUpdates=e=>e(),wr.catch=console.error,wr.frameLoop="always",wr.advance=()=>{"demand"!==wr.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):Or()};let Mr=-1,Rr=!1;function Lr(e,t){Rr?(t.delete(e),e(0)):(t.add(e),Ar())}function Ar(){Mr<0&&(Mr=0,"demand"!==wr.frameLoop&&Pr(Dr))}function Dr(){~Mr&&(Pr(Dr),wr.batchedUpdates(Or))}function Or(){let e=Mr;Mr=wr.now();let t=Nr(Mr);t&&(zr(Tr.splice(0,t),(e=>e.handler())),Vr.count-=t),Br.flush(),Cr.flush(e?Math.min(64,Mr-e):16.667),Ir.flush(),Sr.flush(),xr.flush()}function Fr(){let e=new Set,t=e;return{add(n){Vr.count+=t!=e||e.has(n)?0:1,e.add(n)},delete:n=>(Vr.count-=t==e&&e.has(n)?1:0,e.delete(n)),flush(n){t.size&&(e=new Set,Vr.count-=t.size,zr(t,(t=>t(n)&&e.add(t))),Vr.count+=e.size,t=e)}}}function zr(e,t){e.forEach((e=>{try{t(e)}catch(e){wr.catch(e)}}))}const Vr={count:0,clear(){Mr=-1,Tr=[],Br=Fr(),Cr=Fr(),Ir=Fr(),Sr=Fr(),xr=Fr(),Vr.count=0}};var Hr=n(3804),Ur=n.n(Hr);function Gr(){}const Wr={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 $r(e,t){if(Wr.arr(e)){if(!Wr.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}const jr=(e,t)=>e.forEach(t);function Kr(e,t,n){for(const o in e)e.hasOwnProperty(o)&&t.call(n,e[o],o)}const qr=e=>Wr.und(e)?[]:Wr.arr(e)?e:[e];function Yr(e,t){if(e.size){const n=Array.from(e);e.clear(),jr(n,t)}}const Zr=(e,...t)=>Yr(e,(e=>e(...t)));let Xr,Qr,Jr=null,el=!1,tl=Gr;var nl=Object.freeze({__proto__:null,get createStringInterpolator(){return Xr},get to(){return Qr},get colors(){return Jr},get skipAnimation(){return el},get willAdvance(){return tl},assign:e=>{e.to&&(Qr=e.to),e.now&&(wr.now=e.now),void 0!==e.colors&&(Jr=e.colors),null!=e.skipAnimation&&(el=e.skipAnimation),e.createStringInterpolator&&(Xr=e.createStringInterpolator),e.requestAnimationFrame&&wr.use(e.requestAnimationFrame),e.batchedUpdates&&(wr.batchedUpdates=e.batchedUpdates),e.willAdvance&&(tl=e.willAdvance),e.frameLoop&&(wr.frameLoop=e.frameLoop)}});const ol=new Set;let rl=[],ll=[],il=0;const sl={get idle(){return!ol.size&&!rl.length},start(e){il>e.priority?(ol.add(e),wr.onStart(al)):(cl(e),wr(dl))},advance:dl,sort(e){if(il)wr.onFrame((()=>sl.sort(e)));else{const t=rl.indexOf(e);~t&&(rl.splice(t,1),ul(e))}},clear(){rl=[],ol.clear()}};function al(){ol.forEach(cl),ol.clear(),wr(dl)}function cl(e){rl.includes(e)||ul(e)}function ul(e){rl.splice(function(t,n){const o=t.findIndex((t=>t.priority>e.priority));return o<0?t.length:o}(rl),0,e)}function dl(e){const t=ll;for(let n=0;n<rl.length;n++){const o=rl[n];il=o.priority,o.idle||(tl(o),o.advance(e),o.idle||t.push(o))}return il=0,ll=rl,ll.length=0,rl=t,rl.length>0}const pl="[-+]?\\d*\\.?\\d+",ml=pl+"%";function fl(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}const hl=new RegExp("rgb"+fl(pl,pl,pl)),gl=new RegExp("rgba"+fl(pl,pl,pl,pl)),vl=new RegExp("hsl"+fl(pl,ml,ml)),bl=new RegExp("hsla"+fl(pl,ml,ml,pl)),kl=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,_l=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,yl=/^#([0-9a-fA-F]{6})$/,El=/^#([0-9a-fA-F]{8})$/;function Cl(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 wl(e,t,n){const o=n<.5?n*(1+t):n+t-n*t,r=2*n-o,l=Cl(r,o,e+1/3),i=Cl(r,o,e),s=Cl(r,o,e-1/3);return Math.round(255*l)<<24|Math.round(255*i)<<16|Math.round(255*s)<<8}function Sl(e){const t=parseInt(e,10);return t<0?0:t>255?255:t}function Bl(e){return(parseFloat(e)%360+360)%360/360}function Il(e){const t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function xl(e){const t=parseFloat(e);return t<0?0:t>100?1:t/100}function Tl(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=yl.exec(e))?parseInt(t[1]+"ff",16)>>>0:Jr&&void 0!==Jr[e]?Jr[e]:(t=hl.exec(e))?(Sl(t[1])<<24|Sl(t[2])<<16|Sl(t[3])<<8|255)>>>0:(t=gl.exec(e))?(Sl(t[1])<<24|Sl(t[2])<<16|Sl(t[3])<<8|Il(t[4]))>>>0:(t=kl.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=El.exec(e))?parseInt(t[1],16)>>>0:(t=_l.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=vl.exec(e))?(255|wl(Bl(t[1]),xl(t[2]),xl(t[3])))>>>0:(t=bl.exec(e))?(wl(Bl(t[1]),xl(t[2]),xl(t[3]))|Il(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})`)}const Nl=(e,t,n)=>{if(Wr.fun(e))return e;if(Wr.arr(e))return Nl({range:e,output:t,extrapolate:n});if(Wr.str(e.output[0]))return Xr(e);const 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=>{const 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)}};function Pl(){return(Pl=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}).apply(this,arguments)}const Ml=Symbol.for("FluidValue.get"),Rl=Symbol.for("FluidValue.observers"),Ll=e=>Boolean(e&&e[Ml]),Al=e=>e&&e[Ml]?e[Ml]():e,Dl=e=>e[Rl]||null;function Ol(e,t){let n=e[Rl];n&&n.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}class Fl{constructor(e){if(this[Ml]=void 0,this[Rl]=void 0,!e&&!(e=this.get))throw Error("Unknown getter");zl(this,e)}}const zl=(e,t)=>Ul(e,Ml,t);function Vl(e,t){if(e[Ml]){let n=e[Rl];n||Ul(e,Rl,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function Hl(e,t){let n=e[Rl];if(n&&n.has(t)){const o=n.size-1;o?n.delete(t):e[Rl]=null,e.observerRemoved&&e.observerRemoved(o,t)}}const Ul=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),Gl=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,Wl=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi;let $l;const jl=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,Kl=(e,t,n,o,r)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(o)}, ${r})`,ql=e=>{$l||($l=Jr?new RegExp(`(${Object.keys(Jr).join("|")})(?!\\w)`,"g"):/^\b$/);const t=e.output.map((e=>Al(e).replace(Wl,Tl).replace($l,Tl))),n=t.map((e=>e.match(Gl).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=>Nl(Pl({},e,{output:t}))));return e=>{let n=0;return t[0].replace(Gl,(()=>String(o[n++](e)))).replace(jl,Kl)}},Yl="react-spring: ",Zl=e=>{const t=e;let n=!1;if("function"!=typeof t)throw new TypeError(`${Yl}once requires a function parameter`);return(...e)=>{n||(t(...e),n=!0)}},Xl=Zl(console.warn),Ql=Zl(console.warn);function Jl(e){return Wr.str(e)&&("#"==e[0]||/\d/.test(e)||e in(Jr||{}))}const ei=e=>(0,Hr.useEffect)(e,ti),ti=[];function ni(){const e=(0,Hr.useState)()[1],t=(0,Hr.useState)(oi)[0];return ei(t.unmount),()=>{t.current&&e({})}}function oi(){const e={current:!0,unmount:()=>()=>{e.current=!1}};return e}function ri(e){const t=(0,Hr.useRef)();return(0,Hr.useEffect)((()=>{t.current=e})),t.current}const li="undefined"!=typeof window&&window.document&&window.document.createElement?Hr.useLayoutEffect:Hr.useEffect,ii=Symbol.for("Animated:node"),si=e=>e&&e[ii],ai=(e,t)=>{return n=e,o=ii,r=t,Object.defineProperty(n,o,{value:r,writable:!0,configurable:!0});var n,o,r},ci=e=>e&&e[ii]&&e[ii].getPayload();class ui{constructor(){this.payload=void 0,ai(this,this)}getPayload(){return this.payload||[]}}class di extends ui{constructor(e){super(),this.done=!0,this.elapsedTime=void 0,this.lastPosition=void 0,this.lastVelocity=void 0,this.v0=void 0,this.durationProgress=0,this._value=e,Wr.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new di(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Wr.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(){const{done:e}=this;this.done=!1,Wr.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}}class pi extends di{constructor(e){super(0),this._string=null,this._toString=void 0,this._toString=Nl({output:[e,e]})}static create(e){return new pi(e)}getValue(){let e=this._string;return null==e?this._string=this._toString(this._value):e}setValue(e){if(Wr.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=Nl({output:[this.getValue(),e]})),this._value=0,super.reset()}}const mi={dependencies:null};class fi extends ui{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return Kr(this.source,((n,o)=>{var r;(r=n)&&r[ii]===r?t[o]=n.getValue(e):Ll(n)?t[o]=Al(n):e||(t[o]=n)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&jr(this.payload,(e=>e.reset()))}_makePayload(e){if(e){const t=new Set;return Kr(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){mi.dependencies&&Ll(e)&&mi.dependencies.add(e);const t=ci(e);t&&jr(t,(e=>this.add(e)))}}class hi extends fi{constructor(e){super(e)}static create(e){return new hi(e)}getValue(){return this.source.map((e=>e.getValue()))}setValue(e){const t=this.getPayload();return e.length==t.length?t.map(((t,n)=>t.setValue(e[n]))).some(Boolean):(super.setValue(e.map(gi)),!0)}}function gi(e){return(Jl(e)?pi:di).create(e)}function vi(e){const t=si(e);return t?t.constructor:Wr.arr(e)?hi:Jl(e)?pi:di}function bi(){return(bi=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}).apply(this,arguments)}const ki=(e,t)=>{const n=!Wr.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,Hr.forwardRef)(((o,r)=>{const l=(0,Hr.useRef)(null),i=n&&(0,Hr.useCallback)((e=>{l.current=function(e,t){return e&&(Wr.fun(e)?e(t):e.current=t),t}(r,e)}),[r]),[s,a]=function(e,t){const n=new Set;return mi.dependencies=n,e.style&&(e=bi({},e,{style:t.createAnimatedStyle(e.style)})),e=new fi(e),mi.dependencies=null,[e,n]}(o,t),c=ni(),u=()=>{const e=l.current;n&&!e||!1===(!!e&&t.applyAnimatedValues(e,s.getValue(!0)))&&c()},d=new _i(u,a),p=(0,Hr.useRef)();li((()=>{const e=p.current;p.current=d,jr(a,(e=>Vl(e,d))),e&&(jr(e.deps,(t=>Hl(t,e))),wr.cancel(e.update))})),(0,Hr.useEffect)(u,[]),ei((()=>()=>{const e=p.current;jr(e.deps,(t=>Hl(t,e)))}));const m=t.getComponentProps(s.getValue());return Hr.createElement(e,bi({},m,{ref:i}))}))};class _i{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&wr.write(this.update)}}const yi=Symbol.for("AnimatedComponent"),Ei=e=>Wr.str(e)?e:e&&Wr.str(e.displayName)?e.displayName:Wr.fun(e)&&e.name||null;function Ci(){return(Ci=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}).apply(this,arguments)}function wi(e,...t){return Wr.fun(e)?e(...t):e}const Si=(e,t)=>!0===e||!!(t&&e&&(Wr.fun(e)?e(t):qr(e).includes(t))),Bi=(e,t)=>Wr.obj(e)?t&&e[t]:e,Ii=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,xi=e=>e,Ti=(e,t=xi)=>{let n=Ni;e.default&&!0!==e.default&&(e=e.default,n=Object.keys(e));const o={};for(const r of n){const n=t(e[r],r);Wr.und(n)||(o[r]=n)}return o},Ni=["config","onProps","onStart","onChange","onPause","onResume","onRest"],Pi={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 Mi(e){const t=function(e){const t={};let n=0;if(Kr(e,((e,o)=>{Pi[o]||(t[o]=e,n++)})),n)return t}(e);if(t){const n={to:t};return Kr(e,((e,o)=>o in t||(n[o]=e))),n}return Ci({},e)}function Ri(e){return e=Al(e),Wr.arr(e)?e.map(Ri):Jl(e)?nl.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function Li(e){for(const t in e)return!0;return!1}function Ai(e){return Wr.fun(e)||Wr.arr(e)&&Wr.obj(e[0])}function Di(e,t){var n;null==(n=e.ref)||n.delete(e),null==t||t.delete(e)}function Oi(e,t){var n;t&&e.ref!==t&&(null==(n=e.ref)||n.delete(e),t.add(e),e.ref=t)}const Fi=Ci({},{tension:170,friction:26},{mass:1,damping:1,easing:e=>e,clamp:!1});class zi{constructor(){this.tension=void 0,this.friction=void 0,this.frequency=void 0,this.damping=void 0,this.mass=void 0,this.velocity=0,this.restVelocity=void 0,this.precision=void 0,this.progress=void 0,this.duration=void 0,this.easing=void 0,this.clamp=void 0,this.bounce=void 0,this.decay=void 0,this.round=void 0,Object.assign(this,Fi)}}function Vi(e,t){if(Wr.und(t.decay)){const n=!Wr.und(t.tension)||!Wr.und(t.friction);!n&&Wr.und(t.frequency)&&Wr.und(t.damping)&&Wr.und(t.mass)||(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}else e.duration=void 0}const Hi=[];class Ui{constructor(){this.changed=!1,this.values=Hi,this.toValues=null,this.fromValues=Hi,this.to=void 0,this.from=void 0,this.config=new zi,this.immediate=!1}}function Gi(e,{key:t,props:n,defaultProps:o,state:r,actions:l}){return new Promise(((i,s)=>{var a;let c,u,d=Si(null!=(a=n.cancel)?a:null==o?void 0:o.cancel,t);if(d)f();else{Wr.und(n.pause)||(r.paused=Si(n.pause,t));let e=null==o?void 0:o.pause;!0!==e&&(e=r.paused||Si(e,t)),c=wi(n.delay||0,t),e?(r.resumeQueue.add(m),l.pause()):(l.resume(),m())}function p(){r.resumeQueue.add(m),r.timeouts.delete(u),u.cancel(),c=u.time-wr.now()}function m(){c>0?(u=wr.setTimeout(f,c),r.pauseQueue.add(p),r.timeouts.add(u)):f()}function f(){r.pauseQueue.delete(p),r.timeouts.delete(u),e<=(r.cancelId||0)&&(d=!0);try{l.start(Ci({},n,{callId:e,cancel:d}),i)}catch(e){s(e)}}}))}const Wi=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?Ki(e.get()):t.every((e=>e.noop))?$i(e.get()):ji(e.get(),t.every((e=>e.finished))),$i=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),ji=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),Ki=e=>({value:e,cancelled:!0,finished:!1});function qi(e,t,n,o){const{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;const c=Ti(t,((e,t)=>"onRest"===t?void 0:e));let u,d;const p=new Promise(((e,t)=>(u=e,d=t))),m=e=>{const t=r<=(n.cancelId||0)&&Ki(o)||r!==n.asyncId&&ji(o,!1);if(t)throw e.result=t,d(e),e},f=(e,t)=>{const l=new Zi,i=new Xi;return(async()=>{if(nl.skipAnimation)throw Yi(n),i.result=ji(o,!1),d(i),i;m(l);const s=Wr.obj(e)?Ci({},e):Ci({},t,{to:e});s.parentId=r,Kr(c,((e,t)=>{Wr.und(s[t])&&(s[t]=e)}));const a=await o.start(s);return m(l),n.paused&&await new Promise((e=>{n.resumeQueue.add(e)})),a})()};let h;if(nl.skipAnimation)return Yi(n),ji(o,!1);try{let t;t=Wr.arr(e)?(async e=>{for(const t of e)await f(t)})(e):Promise.resolve(e(f,o.stop.bind(o))),await Promise.all([t.then(u),p]),h=ji(o.get(),!0,!1)}catch(e){if(e instanceof Zi)h=e.result;else{if(!(e instanceof Xi))throw e;h=e.result}}finally{r==n.asyncId&&(n.asyncId=l,n.asyncTo=l?s:void 0,n.promise=l?a:void 0)}return Wr.fun(i)&&wr.batchedUpdates((()=>{i(h,o,o.item)})),h})():a}function Yi(e,t){Yr(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}class Zi extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."),this.result=void 0}}class Xi extends Error{constructor(){super("SkipAnimationSignal"),this.result=void 0}}const Qi=e=>e instanceof es;let Ji=1;class es extends Fl{constructor(...e){super(...e),this.id=Ji++,this.key=void 0,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){const e=si(this);return e&&e.getValue()}to(...e){return nl.to(this,e)}interpolate(...e){return Xl(`${Yl}The "interpolate" function is deprecated in v9 (use "to" instead)`),nl.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){Ol(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||sl.sort(this),Ol(this,{type:"priority",parent:this,priority:e})}}const ts=Symbol.for("SpringPhase"),ns=e=>(1&e[ts])>0,os=e=>(2&e[ts])>0,rs=e=>(4&e[ts])>0,ls=(e,t)=>t?e[ts]|=3:e[ts]&=-3,is=(e,t)=>t?e[ts]|=4:e[ts]&=-5;class ss extends es{constructor(e,t){if(super(),this.key=void 0,this.animation=new Ui,this.queue=void 0,this.defaultProps={},this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!Wr.und(e)||!Wr.und(t)){const n=Wr.obj(e)?Ci({},e):Ci({},t,{from:e});Wr.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(os(this)||this._state.asyncTo)||rs(this)}get goal(){return Al(this.animation.to)}get velocity(){const e=si(this);return e instanceof di?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return ns(this)}get isAnimating(){return os(this)}get isPaused(){return rs(this)}advance(e){let t=!0,n=!1;const o=this.animation;let{config:r,toValues:l}=o;const i=ci(o.to);!i&&Ll(o.to)&&(l=qr(Al(o.to))),o.values.forEach(((s,a)=>{if(s.done)return;const c=s.constructor==pi?1:i?i[a].lastPosition:l[a];let u=o.immediate,d=c;if(!u){if(d=s.lastPosition,r.tension<=0)return void(s.done=!0);let t=s.elapsedTime+=e;const n=o.fromValues[a],l=null!=s.v0?s.v0:s.v0=Wr.arr(r.velocity)?r.velocity[a]:r.velocity;let i;if(Wr.und(r.duration))if(r.decay){const e=!0===r.decay?.998:r.decay,o=Math.exp(-(1-e)*t);d=n+l/(1-e)*(1-o),u=Math.abs(s.lastPosition-d)<.1,i=l*o}else{i=null==s.lastVelocity?l:s.lastVelocity;const t=r.precision||(n==c?.005:Math.min(1,.001*Math.abs(c-n))),o=r.restVelocity||t/10,a=r.clamp?0:r.bounce,p=!Wr.und(a),m=n==c?s.v0>0:n<c;let f,h=!1;const g=1,v=Math.ceil(e/g);for(let e=0;e<v&&(f=Math.abs(i)>o,f||(u=Math.abs(c-d)<=t,!u));++e)p&&(h=d==c||d>c==m,h&&(i=-i*a,d=c)),i+=(1e-6*-r.tension*(d-c)+.001*-r.friction*i)/r.mass*g,d+=i*g}else{let o=1;r.duration>0&&(this._memoizedDuration!==r.duration&&(this._memoizedDuration=r.duration,s.durationProgress>0&&(s.elapsedTime=r.duration*s.durationProgress,t=s.elapsedTime+=e)),o=(r.progress||0)+t/this._memoizedDuration,o=o>1?1:o<0?0:o,s.durationProgress=o),d=n+r.easing(o)*(c-n),i=(d-s.lastPosition)/e,u=1==o}s.lastVelocity=i,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)}));const s=si(this),a=s.getValue();if(t){const e=Al(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 wr.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(os(this)){const{to:e,config:t}=this.animation;wr.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 Wr.und(e)?(n=this.queue||[],this.queue=[]):n=[Wr.obj(e)?e:Ci({},t,{to:e})],Promise.all(n.map((e=>this._update(e)))).then((e=>Wi(this,e)))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),Yi(this._state,e&&this._lastCallId),wr.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){const t=this.key||"";let{to:n,from:o}=e;n=Wr.obj(n)?n[t]:n,(null==n||Ai(n))&&(n=void 0),o=Wr.obj(o)?o[t]:o,null==o&&(o=void 0);const r={to:n,from:o};return ns(this)||(e.reverse&&([n,o]=[o,n]),o=Al(o),Wr.und(o)?si(this)||this._set(n):this._set(o)),r}_update(e,t){let n=Ci({},e);const{key:o,defaultProps:r}=this;n.default&&Object.assign(r,Ti(n,((e,t)=>/^on/.test(t)?Bi(e,o):e))),fs(this,n,"onProps"),hs(this,"onProps",n,this);const l=this._prepareNode(n);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const i=this._state;return Gi(++this._lastCallId,{key:o,props:n,defaultProps:r,state:i,actions:{pause:()=>{rs(this)||(is(this,!0),Zr(i.pauseQueue),hs(this,"onPause",ji(this,as(this,this.animation.to)),this))},resume:()=>{rs(this)&&(is(this,!1),os(this)&&this._resume(),Zr(i.resumeQueue),hs(this,"onResume",ji(this,as(this,this.animation.to)),this))},start:this._merge.bind(this,l)}}).then((e=>{if(n.loop&&e.finished&&(!t||!e.noop)){const e=cs(n);if(e)return this._update(e,!0)}return e}))}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(Ki(this));const o=!Wr.und(e.to),r=!Wr.und(e.from);if(o||r){if(!(t.callId>this._lastToId))return n(Ki(this));this._lastToId=t.callId}const{key:l,defaultProps:i,animation:s}=this,{to:a,from:c}=s;let{to:u=a,from:d=c}=e;!r||o||t.default&&!Wr.und(u)||(u=d),t.reverse&&([u,d]=[d,u]);const p=!$r(d,c);p&&(s.from=d),d=Al(d);const m=!$r(u,a);m&&this._focus(u);const f=Ai(t.to),{config:h}=s,{decay:g,velocity:v}=h;(o||r)&&(h.velocity=0),t.config&&!f&&function(e,t,n){n&&(Vi(n=Ci({},n),t),t=Ci({},n,t)),Vi(e,t),Object.assign(e,t);for(const t in Fi)null==e[t]&&(e[t]=Fi[t]);let{mass:o,frequency:r,damping:l}=e;Wr.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)}(h,wi(t.config,l),t.config!==i.config?wi(i.config,l):void 0);let b=si(this);if(!b||Wr.und(u))return n(ji(this,!0));const k=Wr.und(t.reset)?r&&!t.default:!Wr.und(d)&&Si(t.reset,l),_=k?d:this.get(),y=Ri(u),E=Wr.num(y)||Wr.arr(y)||Jl(y),C=!f&&(!E||Si(i.immediate||t.immediate,l));if(m){const e=vi(u);if(e!==b.constructor){if(!C)throw Error(`Cannot animate between ${b.constructor.name} and ${e.name}, as the "to" prop suggests`);b=this._set(y)}}const w=b.constructor;let S=Ll(u),B=!1;if(!S){const e=k||!ns(this)&&p;(m||e)&&(B=$r(Ri(_),y),S=!B),($r(s.immediate,C)||C)&&$r(h.decay,g)&&$r(h.velocity,v)||(S=!0)}if(B&&os(this)&&(s.changed&&!k?S=!0:S||this._stop(a)),!f&&((S||Ll(a))&&(s.values=b.getPayload(),s.toValues=Ll(u)?null:w==pi?[1]:qr(y)),s.immediate!=C&&(s.immediate=C,C||k||this._set(a)),S)){const{onRest:e}=s;jr(ms,(e=>fs(this,t,e)));const o=ji(this,as(this,a));Zr(this._pendingCalls,o),this._pendingCalls.add(n),s.changed&&wr.batchedUpdates((()=>{s.changed=!k,null==e||e(o,this),k?wi(i.onRest,o):null==s.onStart||s.onStart(o,this)}))}k&&this._set(_),f?n(qi(t.to,t,this._state,this)):S?this._start():os(this)&&!m?this._pendingCalls.add(n):n($i(_))}_focus(e){const t=this.animation;e!==t.to&&(Dl(this)&&this._detach(),t.to=e,Dl(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;Ll(t)&&(Vl(t,this),Qi(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;Ll(e)&&Hl(e,this)}_set(e,t=!0){const n=Al(e);if(!Wr.und(n)){const e=si(this);if(!e||!$r(n,e.getValue())){const o=vi(n);e&&e.constructor==o?e.setValue(n):ai(this,o.create(n)),e&&wr.batchedUpdates((()=>{this._onChange(n,t)}))}}return si(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,hs(this,"onStart",ji(this,as(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),wi(this.animation.onChange,e,this)),wi(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;si(this).reset(Al(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),os(this)||(ls(this,!0),rs(this)||this._resume())}_resume(){nl.skipAnimation?this.finish():sl.start(this)}_stop(e,t){if(os(this)){ls(this,!1);const n=this.animation;jr(n.values,(e=>{e.done=!0})),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Ol(this,{type:"idle",parent:this});const o=t?Ki(this.get()):ji(this.get(),as(this,null!=e?e:n.to));Zr(this._pendingCalls,o),n.changed&&(n.changed=!1,hs(this,"onRest",o,this))}}}function as(e,t){const n=Ri(t);return $r(Ri(e.get()),n)}function cs(e,t=e.loop,n=e.to){let o=wi(t);if(o){const r=!0!==o&&Mi(o),l=(r||e).reverse,i=!r||r.reset;return us(Ci({},e,{loop:t,default:!1,pause:void 0,to:!l||Ai(n)?n:void 0,from:i?e.from:void 0,reset:i},r))}}function us(e){const{to:t,from:n}=e=Mi(e),o=new Set;return Wr.obj(t)&&ps(t,o),Wr.obj(n)&&ps(n,o),e.keys=o.size?Array.from(o):null,e}function ds(e){const t=us(e);return Wr.und(t.default)&&(t.default=Ti(t)),t}function ps(e,t){Kr(e,((e,n)=>null!=e&&t.add(n)))}const ms=["onStart","onRest","onChange","onPause","onResume"];function fs(e,t,n){e.animation[n]=t[n]!==Ii(t,n)?Bi(t[n],e.key):void 0}function hs(e,t,...n){var o,r,l,i;null==(o=(r=e.animation)[t])||o.call(r,...n),null==(l=(i=e.defaultProps)[t])||l.call(i,...n)}const gs=["onStart","onChange","onRest"];let vs=1;class bs{constructor(e,t){this.id=vs++,this.springs={},this.queue=[],this.ref=void 0,this._flush=void 0,this._initialProps=void 0,this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._item=void 0,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start(Ci({default:!0},e))}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every((e=>e.idle))}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each(((t,n)=>e[n]=t.get())),e}set(e){for(const t in e){const n=e[t];Wr.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(us(e)),this}start(e){let{queue:t}=this;return e?t=qr(e).map(us):this.queue=[],this._flush?this._flush(this,t):(Ss(this,t),ks(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;jr(qr(t),(t=>n[t].stop(!!e)))}else Yi(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(Wr.und(e))this.start({pause:!0});else{const t=this.springs;jr(qr(e),(e=>t[e].pause()))}return this}resume(e){if(Wr.und(e))this.start({pause:!1});else{const t=this.springs;jr(qr(e),(e=>t[e].resume()))}return this}each(e){Kr(this.springs,e)}_onFrame(){const{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,Yr(e,(([e,t])=>{t.value=this.get(),e(t,this,this._item)})));const l=!o&&this._started,i=r||l&&n.size?this.get():null;r&&t.size&&Yr(t,(([e,t])=>{t.value=i,e(t,this,this._item)})),l&&(this._started=!1,Yr(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)}wr.onFrame(this._onFrame)}}function ks(e,t){return Promise.all(t.map((t=>_s(e,t)))).then((t=>Wi(e,t)))}async function _s(e,t,n){const{keys:o,to:r,from:l,loop:i,onRest:s,onResolve:a}=t,c=Wr.obj(t.default)&&t.default;i&&(t.loop=!1),!1===r&&(t.to=null),!1===l&&(t.from=null);const u=Wr.arr(r)||Wr.fun(r)?r:void 0;u?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):jr(gs,(n=>{const o=t[n];if(Wr.fun(o)){const r=e._events[n];t[n]=({finished:e,cancelled:t})=>{const 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])}}));const d=e._state;t.pause===!d.paused?(d.paused=t.pause,Zr(t.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(t.pause=!0);const p=(o||Object.keys(e.springs)).map((n=>e.springs[n].start(t))),m=!0===t.cancel||!0===Ii(t,"cancel");(u||m&&d.asyncId)&&p.push(Gi(++e._lastAsyncId,{props:t,state:d,actions:{pause:Gr,resume:Gr,start(t,n){m?(Yi(d,e._lastAsyncId),n(Ki(e))):(t.onRest=s,n(qi(u,t,d,e)))}}})),d.paused&&await new Promise((e=>{d.resumeQueue.add(e)}));const f=Wi(e,await Promise.all(p));if(i&&f.finished&&(!n||!f.noop)){const n=cs(t,i,r);if(n)return Ss(e,[n]),_s(e,n,!0)}return a&&wr.batchedUpdates((()=>a(f,e,e.item))),f}function ys(e,t){const n=Ci({},e.springs);return t&&jr(qr(t),(e=>{Wr.und(e.keys)&&(e=us(e)),Wr.obj(e.to)||(e=Ci({},e,{to:void 0})),ws(n,e,(e=>Cs(e)))})),Es(e,n),n}function Es(e,t){Kr(t,((t,n)=>{e.springs[n]||(e.springs[n]=t,Vl(t,e))}))}function Cs(e,t){const n=new ss;return n.key=e,t&&Vl(n,t),n}function ws(e,t,n){t.keys&&jr(t.keys,(o=>{(e[o]||(e[o]=n(o)))._prepareNode(t)}))}function Ss(e,t){jr(t,(t=>{ws(e.springs,t,(t=>Cs(t,e)))}))}const Bs=["children"],Is=e=>{let{children:t}=e,n=function(e,t){if(null==e)return{};var n,o,r={},l=Object.keys(e);for(o=0;o<l.length;o++)n=l[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,Bs);const o=(0,Hr.useContext)(xs),r=n.pause||!!o.pause,l=n.immediate||!!o.immediate;n=function(e,t){const[n]=(0,Hr.useState)((()=>({inputs:t,result:e()}))),o=(0,Hr.useRef)(),r=o.current;let 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,Hr.useEffect)((()=>{o.current=l,r==n&&(n.inputs=n.result=void 0)}),[l]),l.result}((()=>({pause:r,immediate:l})),[r,l]);const{Provider:i}=xs;return Hr.createElement(i,{value:n},t)},xs=(Ts=Is,Ns={},Object.assign(Ts,Hr.createContext(Ns)),Ts.Provider._context=Ts,Ts.Consumer._context=Ts,Ts);var Ts,Ns;Is.Provider=xs.Provider,Is.Consumer=xs.Consumer;const Ps=()=>{const e=[],t=function(t){Ql(`${Yl}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`);const o=[];return jr(e,((e,r)=>{if(Wr.und(t))o.push(e.start());else{const l=n(t,e,r);l&&o.push(e.start(l))}})),o};t.current=e,t.add=function(t){e.includes(t)||e.push(t)},t.delete=function(t){const n=e.indexOf(t);~n&&e.splice(n,1)},t.pause=function(){return jr(e,(e=>e.pause(...arguments))),this},t.resume=function(){return jr(e,(e=>e.resume(...arguments))),this},t.set=function(t){jr(e,(e=>e.set(t)))},t.start=function(t){const n=[];return jr(e,((e,o)=>{if(Wr.und(t))n.push(e.start());else{const r=this._getProps(t,e,o);r&&n.push(e.start(r))}})),n},t.stop=function(){return jr(e,(e=>e.stop(...arguments))),this},t.update=function(t){return jr(e,((e,n)=>e.update(this._getProps(t,e,n)))),this};const n=function(e,t,n){return Wr.fun(e)?e(n,t):e};return t._getProps=n,t};function Ms(e,t,n){const o=Wr.fun(t)&&t;o&&!n&&(n=[]);const r=(0,Hr.useMemo)((()=>o||3==arguments.length?Ps():void 0),[]),l=(0,Hr.useRef)(0),i=ni(),s=(0,Hr.useMemo)((()=>({ctrls:[],queue:[],flush(e,t){const n=ys(e,t);return l.current>0&&!s.queue.length&&!Object.keys(n).some((t=>!e.springs[t]))?ks(e,t):new Promise((o=>{Es(e,n),s.queue.push((()=>{o(ks(e,t))})),i()}))}})),[]),a=(0,Hr.useRef)([...s.ctrls]),c=[],u=ri(e)||0;function d(e,n){for(let r=e;r<n;r++){const e=a.current[r]||(a.current[r]=new bs(null,s.flush)),n=o?o(r,e):t[r];n&&(c[r]=ds(n))}}(0,Hr.useMemo)((()=>{jr(a.current.slice(e,u),(e=>{Di(e,r),e.stop(!0)})),a.current.length=e,d(u,e)}),[e]),(0,Hr.useMemo)((()=>{d(0,Math.min(u,e))}),n);const p=a.current.map(((e,t)=>ys(e,c[t]))),m=(0,Hr.useContext)(Is),f=ri(m),h=m!==f&&Li(m);li((()=>{l.current++,s.ctrls=a.current;const{queue:e}=s;e.length&&(s.queue=[],jr(e,(e=>e()))),jr(a.current,((e,t)=>{null==r||r.add(e),h&&e.start({default:m});const n=c[t];n&&(Oi(e,n.ref),e.ref?e.queue.push(n):e.start(n))}))})),ei((()=>()=>{jr(s.ctrls,(e=>e.stop(!0)))}));const g=p.map((e=>Ci({},e)));return r?[g,r]:g}let Rs;!function(e){e.MOUNT="mount",e.ENTER="enter",e.UPDATE="update",e.LEAVE="leave"}(Rs||(Rs={}));class Ls extends es{constructor(e,t){super(),this.key=void 0,this.idle=!0,this.calc=void 0,this._active=new Set,this.source=e,this.calc=Nl(...t);const n=this._get(),o=vi(n);ai(this,o.create(n))}advance(e){const t=this._get();$r(t,this.get())||(si(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&Ds(this._active)&&Os(this)}_get(){const e=Wr.arr(this.source)?this.source.map(Al):qr(Al(this.source));return this.calc(...e)}_start(){this.idle&&!Ds(this._active)&&(this.idle=!1,jr(ci(this),(e=>{e.done=!1})),nl.skipAnimation?(wr.batchedUpdates((()=>this.advance())),Os(this)):sl.start(this))}_attach(){let e=1;jr(qr(this.source),(t=>{Ll(t)&&Vl(t,this),Qi(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){jr(qr(this.source),(e=>{Ll(e)&&Hl(e,this)})),this._active.clear(),Os(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=qr(this.source).reduce(((e,t)=>Math.max(e,(Qi(t)?t.priority:0)+1)),0))}}function As(e){return!1!==e.idle}function Ds(e){return!e.size||Array.from(e).every(As)}function Os(e){e.idle||(e.idle=!0,jr(ci(e),(e=>{e.done=!0})),Ol(e,{type:"idle",parent:e}))}nl.assign({createStringInterpolator:ql,to:(e,t)=>new Ls(e,t)}),sl.advance;var Fs=window.ReactDOM;function zs(e,t){if(null==e)return{};var n,o,r={},l=Object.keys(e);for(o=0;o<l.length;o++)n=l[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}const Vs=["style","children","scrollTop","scrollLeft"],Hs=/^--/;function Us(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||Hs.test(e)||Ws.hasOwnProperty(e)&&Ws[e]?(""+t).trim():t+"px"}const Gs={};let Ws={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};const $s=["Webkit","Ms","Moz","O"];Ws=Object.keys(Ws).reduce(((e,t)=>($s.forEach((n=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(n,t)]=e[t])),e)),Ws);const js=["x","y","z"],Ks=/^(matrix|translate|scale|rotate|skew)/,qs=/^(translate)/,Ys=/^(rotate|skew)/,Zs=(e,t)=>Wr.num(e)&&0!==e?e+t:e,Xs=(e,t)=>Wr.arr(e)?e.every((e=>Xs(e,t))):Wr.num(e)?e===t:parseFloat(e)===t;class Qs extends fi{constructor(e){let{x:t,y:n,z:o}=e,r=zs(e,js);const l=[],i=[];(t||n||o)&&(l.push([t||0,n||0,o||0]),i.push((e=>[`translate3d(${e.map((e=>Zs(e,"px"))).join(",")})`,Xs(e,0)]))),Kr(r,((e,t)=>{if("transform"===t)l.push([e||""]),i.push((e=>[e,""===e]));else if(Ks.test(t)){if(delete r[t],Wr.und(e))return;const n=qs.test(t)?"px":Ys.test(t)?"deg":"";l.push(qr(e)),i.push("rotate3d"===t?([e,t,o,r])=>[`rotate3d(${e},${t},${o},${Zs(r,n)})`,Xs(r,0)]:e=>[`${t}(${e.map((e=>Zs(e,n))).join(",")})`,Xs(e,t.startsWith("scale")?1:0)])}})),l.length&&(r.transform=new Js(l,i)),super(r)}}class Js extends Fl{constructor(e,t){super(),this._value=null,this.inputs=e,this.transforms=t}get(){return this._value||(this._value=this._get())}_get(){let e="",t=!0;return jr(this.inputs,((n,o)=>{const r=Al(n[0]),[l,i]=this.transforms[o](Wr.arr(r)?r:n.map(Al));e+=" "+l,t=t&&i})),t?"none":e}observerAdded(e){1==e&&jr(this.inputs,(e=>jr(e,(e=>Ll(e)&&Vl(e,this)))))}observerRemoved(e){0==e&&jr(this.inputs,(e=>jr(e,(e=>Ll(e)&&Hl(e,this)))))}eventObserved(e){"change"==e.type&&(this._value=null),Ol(this,e)}}const ea=["scrollTop","scrollLeft"];nl.assign({batchedUpdates:Fs.unstable_batchedUpdates,createStringInterpolator:ql,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}});const ta=((e,{applyAnimatedValues:t=(()=>!1),createAnimatedStyle:n=(e=>new fi(e)),getComponentProps:o=(e=>e)}={})=>{const r={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:o},l=e=>{const t=Ei(e)||"Anonymous";return(e=Wr.str(e)?l[e]||(l[e]=ki(e,r)):e[yi]||(e[yi]=ki(e,r))).displayName=`Animated(${t})`,e};return Kr(e,((t,n)=>{Wr.arr(e)&&(n=Ei(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;const n="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName,o=t,{style:r,children:l,scrollTop:i,scrollLeft:s}=o,a=zs(o,Vs),c=Object.values(a),u=Object.keys(a).map((t=>n||e.hasAttribute(t)?t:Gs[t]||(Gs[t]=t.replace(/([A-Z])/g,(e=>"-"+e.toLowerCase())))));void 0!==l&&(e.textContent=l);for(let t in r)if(r.hasOwnProperty(t)){const n=Us(t,r[t]);Hs.test(t)?e.style.setProperty(t,n):e.style[t]=n}u.forEach(((t,n)=>{e.setAttribute(t,c[n])})),void 0!==i&&(e.scrollTop=i),void 0!==s&&(e.scrollLeft=s)},createAnimatedStyle:e=>new Qs(e),getComponentProps:e=>zs(e,ea)}).animated,na=e=>e+1,oa=e=>({top:e.offsetTop,left:e.offsetLeft});var ra=function({isSelected:e,adjustScrolling:t,enableAnimation:n,triggerAnimationOnChange:o}){const r=(0,s.useRef)(),l=(0,d.useReducedMotion)()||!n,[i,a]=(0,s.useReducer)(na,0),[c,u]=(0,s.useReducer)(na,0),[p,m]=(0,s.useState)({x:0,y:0}),f=(0,s.useMemo)((()=>r.current?oa(r.current):null),[o]),h=(0,s.useMemo)((()=>{if(!t||!r.current)return()=>{};const e=(0,or.getScrollContainer)(r.current);if(!e)return()=>{};const n=r.current.getBoundingClientRect();return()=>{const t=r.current.getBoundingClientRect().top-n.top;t&&(e.scrollTop+=t)}}),[o,t]);function g({value:t}){let{x:n,y:o}=t;n=Math.round(n),o=Math.round(o),n===g.x&&o===g.y||(function({x:t,y:n}){if(!r.current)return;const o=0===t&&0===n;r.current.style.transformOrigin=o?"":"center",r.current.style.transform=o?"":`translate3d(${t}px,${n}px,0)`,r.current.style.zIndex=!e||o?"":"1",h()}({x:n,y:o}),g.x=n,g.y=o)}return(0,s.useLayoutEffect)((()=>{i&&u()}),[i]),(0,s.useLayoutEffect)((()=>{if(!f)return;if(l)return void h();r.current.style.transform="";const e=oa(r.current);a(),m({x:Math.round(f.left-e.left),y:Math.round(f.top-e.top)})}),[o]),g.x=0,g.y=0,function(e,t){const n=Wr.fun(e),[[o],r]=Ms(1,n?e:[e],n?t||[]:t)}({from:{x:p.x,y:p.y},to:{x:0,y:0},reset:i!==c,config:{mass:5,tension:2e3,friction:200},immediate:l,onChange:g}),r};const la=".block-editor-block-list__block",ia=".block-list-appender";function sa(e,t){return t.closest([la,ia].join(","))===e}function aa(e){const t=(0,s.useRef)(),n=function(e){return(0,m.useSelect)((t=>{const{getSelectedBlocksInitialCaretPosition:n,isMultiSelecting:o,isNavigationMode:r,isBlockSelected:l}=t(Vn);if(l(e)&&!o()&&!r())return n()}),[e])}(e);return(0,s.useEffect)((()=>{if(null==n)return;if(!t.current)return;const{ownerDocument:e}=t.current;if(t.current.contains(e.activeElement))return;const o=or.focus.tabbable.find(t.current).filter((e=>(0,or.isTextField)(e))),r=-1===n,l=(r?u.last:u.first)(o)||t.current;sa(t.current,l)?(0,or.placeCaretAtHorizontalEdge)(l,r):t.current.focus()}),[n]),t}function ca(e){if(e.defaultPrevented)return;const t="mouseover"===e.type?"add":"remove";e.preventDefault(),e.currentTarget.classList[t]("is-hovered")}function ua(){const e=(0,m.useSelect)((e=>{const{isNavigationMode:t,getSettings:n}=e(Vn);return t()||n().outlineMode}),[]);return(0,d.useRefEffect)((t=>{if(e)return t.addEventListener("mouseout",ca),t.addEventListener("mouseover",ca),()=>{t.removeEventListener("mouseout",ca),t.removeEventListener("mouseover",ca),t.classList.remove("is-hovered")}}),[e])}function da(e){return(0,m.useSelect)((t=>{const{isBlockBeingDragged:n,isBlockHighlighted:o,isBlockSelected:l,isBlockMultiSelected:i,getBlockName:s,getSettings:a,hasSelectedInnerBlock:u,isTyping:d,__experimentalGetActiveBlockIdByBlockNames:p}=t(Vn),{__experimentalSpotlightEntityBlocks:m,outlineMode:f}=a(),h=n(e),g=l(e),v=s(e),b=u(e,!0),k=p(m);return c()({"is-selected":g,"is-highlighted":o(e),"is-multi-selected":i(e),"is-reusable":(0,r.isReusableBlock)((0,r.getBlockType)(v)),"is-dragging":h,"has-child-selected":b,"has-active-entity":k,"is-active-entity":k===e,"remove-outline":g&&f&&d()})}),[e])}function pa(e){return(0,m.useSelect)((t=>{const n=t(Vn).getBlockName(e),o=(0,r.getBlockType)(n);if((null==o?void 0:o.apiVersion)>1)return(0,r.getBlockDefaultClassName)(n)}),[e])}function ma(e){return(0,m.useSelect)((t=>{const{getBlockName:n,getBlockAttributes:o}=t(Vn),l=o(e);if(null==l||!l.className)return;const i=(0,r.getBlockType)(n(e));return(null==i?void 0:i.apiVersion)>1?l.className:void 0}),[e])}function fa(e){return(0,m.useSelect)((t=>{const{hasBlockMovingClientId:n,canInsertBlockType:o,getBlockName:r,getBlockRootClientId:l,isBlockSelected:i}=t(Vn);if(!i(e))return;const s=n();return s?c()("is-block-moving-mode",{"can-insert-moving-block":o(r(s),l(e))}):void 0}),[e])}function ha(e){const{isBlockSelected:t}=(0,m.useSelect)(Vn),{selectBlock:n,selectionChange:o}=(0,m.useDispatch)(Vn);return(0,d.useRefEffect)((r=>{function l(l){t(e)?l.target.isContentEditable||o(e):sa(r,l.target)&&n(e)}return r.addEventListener("focusin",l),()=>{r.removeEventListener("focusin",l)}}),[t,n])}var ga=window.wp.keycodes;function va(e){const t=(0,m.useSelect)((t=>t(Vn).isBlockSelected(e)),[e]),{getBlockRootClientId:n,getBlockIndex:o}=(0,m.useSelect)(Vn),{insertDefaultBlock:r,removeBlock:l}=(0,m.useDispatch)(Vn);return(0,d.useRefEffect)((i=>{if(t)return i.addEventListener("keydown",s),i.addEventListener("dragstart",a),()=>{i.removeEventListener("keydown",s),i.removeEventListener("dragstart",a)};function s(t){const{keyCode:s,target:a}=t;s!==ga.ENTER&&s!==ga.BACKSPACE&&s!==ga.DELETE||a!==i||(0,or.isTextField)(a)||(t.preventDefault(),s===ga.ENTER?r({},n(e),o(e)+1):l(e))}function a(e){e.preventDefault()}}),[e,t,n,o,r,l])}function ba(e){const{isNavigationMode:t,isBlockSelected:n}=(0,m.useSelect)(Vn),{setNavigationMode:o,selectBlock:r}=(0,m.useDispatch)(Vn);return(0,d.useRefEffect)((l=>{function i(l){t()&&!l.defaultPrevented&&(l.preventDefault(),n(e)?o(!1):r(e))}return l.addEventListener("mousedown",i),()=>{l.addEventListener("mousedown",i)}}),[e,t,n,o])}var ka=n(4979),_a=n.n(ka);function ya(e){const t=(0,s.useRef)(),n=(0,m.useSelect)((t=>{const{isBlockSelected:n,getBlockSelectionEnd:o}=t(Vn);return n(e)||o()===e}),[e]);return(0,s.useEffect)((()=>{if(!n)return;const e=t.current;if(!e)return;if(e.contains(e.ownerDocument.activeElement))return;const o=(0,or.getScrollContainer)(e)||e.ownerDocument.defaultView;o&&_a()(e,o,{onlyScrollIfNeeded:!0})}),[n]),t}const Ea=(0,s.createContext)();function Ca({children:e}){const t=(0,s.useMemo)((()=>({refs:new Map,callbacks:new Map})),[]);return(0,s.createElement)(Ea.Provider,{value:t},e)}function wa(e){const{refs:t,callbacks:n}=(0,s.useContext)(Ea),o=(0,s.useRef)();return(0,s.useLayoutEffect)((()=>(t.set(o,e),()=>{t.delete(o)})),[e]),(0,d.useRefEffect)((t=>{o.current=t,n.forEach(((n,o)=>{e===n&&o(t)}))}),[e])}function Sa(e){const{refs:t}=(0,s.useContext)(Ea),n=(0,s.useRef)();return n.current=e,(0,s.useMemo)((()=>({get current(){let e=null;for(const[o,r]of t.entries())r===n.current&&o.current&&(e=o.current);return e}})),[])}function Ba(e){const{callbacks:t}=(0,s.useContext)(Ea),n=Sa(e),[o,r]=(0,s.useState)(null);return(0,s.useLayoutEffect)((()=>{if(e)return t.set(r,e),()=>{t.delete(r)}}),[e]),n.current||o}function Ia(e,t){Array.from(e.closest(".is-root-container").querySelectorAll(".rich-text")).forEach((e=>{t?e.setAttribute("contenteditable",!0):e.removeAttribute("contenteditable")}))}function xa(e){const{startMultiSelect:t,stopMultiSelect:n,multiSelect:o,selectBlock:r}=(0,m.useDispatch)(Vn),{isSelectionEnabled:l,isBlockSelected:i,getBlockParents:s,getBlockSelectionStart:a,hasMultiSelection:c}=(0,m.useSelect)(Vn);return(0,d.useRefEffect)((u=>{const{ownerDocument:d}=u,{defaultView:p}=d;let m,f;function h({isSelectionEnd:t}){const n=p.getSelection();if(!n.rangeCount||n.isCollapsed)return void Ia(u,!0);const l=function(e){for(;e&&e.nodeType!==e.ELEMENT_NODE;)e=e.parentNode;if(!e)return;const t=e.closest(la);return t?t.id.slice("block-".length):void 0}(n.focusNode);if(e===l){if(r(e),t&&(Ia(u,!0),n.rangeCount)){const{commonAncestorContainer:e}=n.getRangeAt(0);m.contains(e)&&m.focus()}}else{const t=[...s(e),e],n=[...s(l),l],r=Math.min(t.length,n.length)-1;o(t[r],n[r])}}function g(){d.removeEventListener("selectionchange",h),p.removeEventListener("mouseup",g),f=p.requestAnimationFrame((()=>{h({isSelectionEnd:!0}),n()}))}function v({buttons:n}){1===n&&l()&&i(e)&&(m=d.activeElement,t(),d.addEventListener("selectionchange",h),p.addEventListener("mouseup",g),Ia(u,!1))}function b(t){if(l()&&0===t.button)if(t.shiftKey){const n=a(),r=s(n);if(n&&n!==e&&(null==r||!r.includes(e))){const l=[...r,n],i=[...s(e),e],a=Math.min(l.length,i.length)-1,c=l[a],d=i[a];c!==d&&(Ia(u,!1),o(c,d),t.preventDefault())}}else c()&&r(e)}return u.addEventListener("mousedown",b),u.addEventListener("mouseleave",v),()=>{u.removeEventListener("mousedown",b),u.removeEventListener("mouseleave",v),d.removeEventListener("selectionchange",h),p.removeEventListener("mouseup",g),p.cancelAnimationFrame(f)}}),[e,t,n,o,r,l,i,s])}function Ta(){const e=(0,s.useContext)(em);return(0,d.useRefEffect)((t=>{if(e)return e.observe(t),()=>{e.unobserve(t)}}),[e])}function Na(e={},{__unstableIsHtml:t}={}){const{clientId:n,className:o,wrapperProps:l={},isAligned:i}=(0,s.useContext)(Pa),{index:a,mode:u,name:p,blockApiVersion:f,blockTitle:g,isPartOfSelection:v,adjustScrolling:b,enableAnimation:k}=(0,m.useSelect)((e=>{const{getBlockRootClientId:t,getBlockIndex:o,getBlockMode:l,getBlockName:i,isTyping:s,getGlobalBlockCount:a,isBlockSelected:c,isBlockMultiSelected:u,isAncestorMultiSelected:d,isFirstMultiSelectedBlock:p}=e(Vn),m=c(n),f=u(n)||d(n),h=i(n),g=t(n),v=(0,r.getBlockType)(h);return{index:o(n,g),mode:l(n),name:h,blockApiVersion:(null==v?void 0:v.apiVersion)||1,blockTitle:null==v?void 0:v.title,isPartOfSelection:m||f,adjustScrolling:m||p(n),enableAnimation:!s()&&a()<=200}}),[n]),_=(0,h.sprintf)((0,h.__)("Block: %s"),g),y="html"!==u||t?"":"-visual",E=(0,d.useMergeRefs)([e.ref,aa(n),ya(n),wa(n),ha(n),xa(n),va(n),ba(n),ua(),Ta(),ra({isSelected:v,adjustScrolling:b,enableAnimation:k,triggerAnimationOnChange:a})]),C=Wn();return f<2&&n===C.clientId&&"undefined"!=typeof process&&process.env,{...l,...e,ref:E,id:`block-${n}${y}`,tabIndex:0,role:"document","aria-label":_,"data-block":n,"data-type":p,"data-title":g,className:c()(c()("block-editor-block-list__block",{"wp-block":!i}),o,e.className,l.className,da(n),pa(n),ma(n),fa(n)),style:{...l.style,...e.style}}}Na.save=r.__unstableGetBlockProps;const Pa=(0,s.createContext)();function Ma({children:e,isHtml:t,...n}){return(0,s.createElement)("div",Na(n,{__unstableIsHtml:t}),e)}const Ra=(0,m.withSelect)(((e,{clientId:t,rootClientId:n})=>{const{isBlockSelected:o,getBlockMode:r,isSelectionEnabled:l,getTemplateLock:i,__unstableGetBlockWithoutInnerBlocks:s,canRemoveBlock:a,canMoveBlock:c}=e(Vn),u=s(t),d=o(t),p=i(n),m=a(t,n),f=c(t,n),{name:h,attributes:g,isValid:v}=u||{};return{mode:r(t),isSelectionEnabled:l(),isLocked:!!p,canRemove:m,canMove:f,block:u,name:h,attributes:g,isValid:v,isSelected:d}})),La=(0,m.withDispatch)(((e,t,{select:n})=>{const{updateBlockAttributes:o,insertBlocks:l,mergeBlocks:i,replaceBlocks:s,toggleSelection:a,__unstableMarkLastChangeAsPersistent:c}=e(Vn);return{setAttributes(e){const{getMultiSelectedBlockClientIds:r}=n(Vn),l=r(),{clientId:i}=t,s=l.length?l:[i];o(s,e)},onInsertBlocks(e,n){const{rootClientId:o}=t;l(e,n,o)},onInsertBlocksAfter(e){const{clientId:o,rootClientId:r}=t,{getBlockIndex:i}=n(Vn),s=i(o,r);l(e,s+1,r)},onMerge(e){const{clientId:o}=t,{getPreviousBlockClientId:r,getNextBlockClientId:l}=n(Vn);if(e){const e=l(o);e&&i(o,e)}else{const e=r(o);e&&i(e,o)}},onReplace(e,n,o){e.length&&!(0,r.isUnmodifiedDefaultBlock)(e[e.length-1])&&c(),s([t.clientId],e,n,o)},toggleSelection(e){a(e)}}}));var Aa=(0,d.compose)(d.pure,Ra,La,(0,d.ifCondition)((({block:e})=>!!e)),(0,p.withFilters)("editor.BlockListBlock"))((function({mode:e,isLocked:t,canRemove:n,clientId:o,isSelected:l,isSelectionEnabled:i,className:a,name:d,isValid:p,attributes:f,wrapperProps:h,setAttributes:g,onReplace:v,onInsertBlocksAfter:b,onMerge:k,toggleSelection:_}){const{removeBlock:y}=(0,m.useDispatch)(Vn),E=(0,s.useCallback)((()=>y(o)),[o]);let C=(0,s.createElement)(cr,{name:d,isSelected:l,attributes:f,setAttributes:g,insertBlocksAfter:t?void 0:b,onReplace:n?v:void 0,onRemove:n?E:void 0,mergeBlocks:n?k:void 0,clientId:o,isSelectionEnabled:i,toggleSelection:_});const w=(0,r.getBlockType)(d);null!=w&&w.getEditWrapperProps&&(h=function(e,t){const n={...e,...t};return e&&t&&e.className&&t.className&&(n.className=c()(e.className,t.className)),e&&t&&e.style&&t.style&&(n.style={...e.style,...t.style}),n}(h,w.getEditWrapperProps(f)));const S=h&&!!h["data-align"];let B;if(S&&(C=(0,s.createElement)("div",{className:"wp-block","data-align":h["data-align"]},C)),p)B="html"===e?(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{style:{display:"none"}},C),(0,s.createElement)(Ma,{isHtml:!0},(0,s.createElement)(Er,{clientId:o}))):(null==w?void 0:w.apiVersion)>1?C:(0,s.createElement)(Ma,h,C);else{const e=(0,r.getSaveContent)(w,f);B=(0,s.createElement)(Ma,{className:"has-warning"},(0,s.createElement)(gr,{clientId:o}),(0,s.createElement)(s.RawHTML,null,(0,or.safeHTML)(e)))}const I={clientId:o,className:a,wrapperProps:(0,u.omit)(h,["data-align"]),isAligned:S},x=(0,s.useMemo)((()=>I),Object.values(I));return(0,s.createElement)(Pa.Provider,{value:x},(0,s.createElement)(_r,{fallback:(0,s.createElement)(Ma,{className:"has-warning"},(0,s.createElement)(br,null))},B))})),Da=window.wp.htmlEntities,Oa=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));const Fa=[(0,s.createInterpolateElement)((0,h.__)("While writing, you can press <kbd>/</kbd> to quickly insert new blocks."),{kbd:(0,s.createElement)("kbd",null)}),(0,s.createInterpolateElement)((0,h.__)("Indent a list by pressing <kbd>space</kbd> at the beginning of a line."),{kbd:(0,s.createElement)("kbd",null)}),(0,s.createInterpolateElement)((0,h.__)("Outdent a list by pressing <kbd>backspace</kbd> at the beginning of a line."),{kbd:(0,s.createElement)("kbd",null)}),(0,h.__)("Drag files into the editor to automatically insert media blocks."),(0,h.__)("Change a block's type by pressing the block icon on the toolbar.")];var za=function(){const[e]=(0,s.useState)(Math.floor(Math.random()*Fa.length));return(0,s.createElement)(p.Tip,null,Fa[e])},Va=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),Ha=(0,s.memo)((function({icon:e,showColors:t=!1,className:n}){var o;"block-default"===(null===(o=e)||void 0===o?void 0:o.src)&&(e={src:Va});const r=(0,s.createElement)(p.Icon,{icon:e&&e.src?e.src:e}),l=t?{backgroundColor:e&&e.background,color:e&&e.foreground}:{};return(0,s.createElement)("span",{style:l,className:c()("block-editor-block-icon",n,{"has-colors":t})},r)})),Ua=function({title:e,icon:t,description:n,blockType:o}){return o&&(Lt()("`blockType` property in `BlockCard component`",{since:"5.7",alternative:"`title, icon and description` properties"}),({title:e,icon:t,description:n}=o)),(0,s.createElement)("div",{className:"block-editor-block-card"},(0,s.createElement)(Ha,{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),(0,s.createElement)("span",{className:"block-editor-block-card__description"},n)))};function Ga({clientId:e=null,value:t,selection:n,onChange:o=u.noop,onInput:l=u.noop}){const i=(0,m.useRegistry)(),{resetBlocks:a,resetSelection:c,replaceInnerBlocks:d,setHasControlledInnerBlocks:p,__unstableMarkNextChangeAsNotPersistent:f}=i.dispatch(Vn),{getBlockName:h,getBlocks:g}=i.select(Vn),v=(0,s.useRef)({incoming:null,outgoing:[]}),b=(0,s.useRef)(!1),k=(0,s.useRef)(l),_=(0,s.useRef)(o);(0,s.useEffect)((()=>{k.current=l,_.current=o}),[l,o]),(0,s.useEffect)((()=>{v.current.outgoing.includes(t)?(0,u.last)(v.current.outgoing)===t&&(v.current.outgoing=[]):g(e)!==t&&(v.current.outgoing=[],(()=>{if(t)if(f(),e){p(e,!0),f();const n=t.map((e=>(0,r.cloneBlock)(e)));b.current&&(v.current.incoming=n),d(e,n)}else b.current&&(v.current.incoming=t),a(t)})(),n&&c(n.selectionStart,n.selectionEnd,n.initialPosition))}),[t,e]),(0,s.useEffect)((()=>{const{getSelectionStart:t,getSelectionEnd:n,getSelectedBlocksInitialCaretPosition:o,isLastBlockChangePersistent:r,__unstableIsLastBlockChangeIgnored:l}=i.select(Vn);let s=g(e),a=r(),c=!1;b.current=!0;const u=i.subscribe((()=>{if(null!==e&&null===h(e))return;const i=r(),u=g(e),d=u!==s;if(s=u,d&&(v.current.incoming||l()))return v.current.incoming=null,void(a=i);(d||c&&!d&&i&&!a)&&(a=i,v.current.outgoing.push(s),(a?_.current:k.current)(s,{selection:{selectionStart:t(),selectionEnd:n(),initialPosition:o()}})),c=d}));return()=>u()}),[i,e])}var Wa=(0,d.createHigherOrderComponent)((e=>(0,m.withRegistry)((({useSubRegistry:t=!0,registry:n,...o})=>{if(!t)return(0,s.createElement)(e,i({registry:n},o));const[r,l]=(0,s.useState)(null);return(0,s.useEffect)((()=>{const e=(0,m.createRegistry)({},n);e.registerStore(Fn,zn),l(e)}),[n]),r?(0,s.createElement)(m.RegistryProvider,{value:r},(0,s.createElement)(e,i({registry:r},o))):null}))),"withRegistryProvider")((function(e){const{children:t,settings:n}=e,{updateSettings:o}=(0,m.useDispatch)(Vn);return(0,s.useEffect)((()=>{o(n)}),[n]),Ga(e),(0,s.createElement)(Ca,null,t)}));function $a({onClick:e}){return(0,s.createElement)("div",{tabIndex:0,role:"button",onClick:e,onKeyPress:e},(0,s.createElement)(p.Disabled,null,(0,s.createElement)(nm,null)))}function ja(){const{hasSelectedBlock:e,hasMultiSelection:t}=(0,m.useSelect)(Vn),{clearSelectedBlock:n}=(0,m.useDispatch)(Vn);return(0,d.useRefEffect)((o=>{function r(r){(e()||t())&&r.target===o&&n()}return o.addEventListener("mousedown",r),()=>{o.removeEventListener("mousedown",r)}}),[e,t,n])}function Ka(e){return(0,s.createElement)("div",i({ref:ja()},e))}function qa(e,t){const n="start"===t?"firstChild":"lastChild",o="start"===t?"nextSibling":"previousSibling";for(;e[n];)for(e=e[n];e.nodeType===e.TEXT_NODE&&/^[ \t\n]*$/.test(e.data)&&e[o];)e=e[o];return e}function Ya(e){const{isMultiSelecting:t,getMultiSelectedBlockClientIds:n,hasMultiSelection:o,getSelectedBlockClientId:r}=e(Vn);return{isMultiSelecting:t(),multiSelectedBlockClientIds:n(),hasMultiSelection:o(),selectedBlockClientId:r()}}function Za(){const{isMultiSelecting:e,multiSelectedBlockClientIds:t,hasMultiSelection:n,selectedBlockClientId:o}=(0,m.useSelect)(Ya,[]),r=Sa(o),l=Sa((0,u.first)(t)),i=Sa((0,u.last)(t));return(0,d.useRefEffect)((s=>{const{ownerDocument:a}=s,{defaultView:c}=a;if(!n||e){if(!o||e)return;const t=c.getSelection();if(t.rangeCount&&!t.isCollapsed){const e=r.current,{startContainer:n,endContainer:o}=t.getRangeAt(0);!e||e.contains(n)&&e.contains(o)||t.removeAllRanges()}return}const{length:u}=t;if(u<2)return;if(!l.current||!i.current)return;s.focus();const d=c.getSelection(),p=a.createRange(),m=qa(l.current,"start"),f=qa(i.current,"end");var h;h=s,Array.from(h.querySelectorAll(".rich-text")).forEach((e=>{e.removeAttribute("contenteditable")})),p.setStartBefore(m),p.setEndAfter(f),d.removeAllRanges(),d.addRange(p)}),[n,e,t,o])}function Xa(e){const{tagName:t}=e;return"INPUT"===t||"BUTTON"===t||"SELECT"===t||"TEXTAREA"===t}function Qa(e,t,n,o){let r,l=or.focus.focusable.find(n);return t&&(l=(0,u.reverse)(l)),l=l.slice(l.indexOf(e)+1),o&&(r=e.getBoundingClientRect()),(0,u.find)(l,(function(e){if(!or.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 Ja(){const{getSelectedBlockClientId:e,getMultiSelectedBlocksStartClientId:t,getMultiSelectedBlocksEndClientId:n,getPreviousBlockClientId:o,getNextBlockClientId:r,getFirstMultiSelectedBlockClientId:l,getLastMultiSelectedBlockClientId:i,getSettings:s,hasMultiSelection:a}=(0,m.useSelect)(Vn),{multiSelect:c,selectBlock:u}=(0,m.useDispatch)(Vn);return(0,d.useRefEffect)((d=>{let p;function m(){p=null}function f(l){const i=e(),s=t(),a=n(),d=o(a||i),p=r(a||i),m=l?d:p;m&&(s===m?u(m):c(s||i,m))}function h(e){const t=l(),n=i(),o=e?t:n;o&&u(o)}function g(t){const{keyCode:l,target:i}=t,c=l===ga.UP,u=l===ga.DOWN,m=l===ga.LEFT,g=l===ga.RIGHT,v=c||m,b=m||g,k=c||u,_=b||k,y=t.shiftKey,E=y||t.ctrlKey||t.altKey||t.metaKey,C=k?or.isVerticalEdge:or.isHorizontalEdge,{ownerDocument:w}=d,{defaultView:S}=w;if(a())return void(_&&((y?f:h)(v),t.preventDefault()));if(k?p||(p=(0,or.computeCaretRect)(S)):p=null,t.defaultPrevented)return;if(!_)return;if(!function(e,t,n){if((t===ga.UP||t===ga.DOWN)&&!n)return!0;const{tagName:o}=e;return"INPUT"!==o&&"TEXTAREA"!==o}(i,l,E))return;const B=(0,or.isRTL)(i)?!v:v,{keepCaretInsideBlock:I}=s(),x=e();if(y){const e=n(),l=o(e||x),s=r(e||x);(v&&l||!v&&s)&&function(e,t){const n=Qa(e,t,d);return!n||!function(e,t){return e.closest(la)===t.closest(la)}(e,n)}(i,v)&&C(i,v)&&(f(v),t.preventDefault())}else if(k&&(0,or.isVerticalEdge)(i,v)&&!I){const e=Qa(i,v,d,!0);e&&((0,or.placeCaretAtVerticalEdge)(e,v,p),t.preventDefault())}else if(b&&S.getSelection().isCollapsed&&(0,or.isHorizontalEdge)(i,B)&&!I){const e=Qa(i,B,d);(0,or.placeCaretAtHorizontalEdge)(e,v),t.preventDefault()}}return d.addEventListener("mousedown",m),d.addEventListener("keydown",g),()=>{d.removeEventListener("mousedown",m),d.removeEventListener("keydown",g)}}),[])}var ec=window.wp.keyboardShortcuts;function tc(){const{getBlockOrder:e,getSelectedBlockClientIds:t,getBlockRootClientId:n}=(0,m.useSelect)(Vn),{multiSelect:o}=(0,m.useDispatch)(Vn),r=(0,ec.__unstableUseShortcutEventMatch)();return(0,d.useRefEffect)((l=>{function i(l){if(!r("core/block-editor/select-all",l))return;if(!(0,or.isEntirelySelected)(l.target))return;const i=t(),[s]=i,a=n(s);let c=e(a);i.length===c.length&&(c=e(n(a)));const d=(0,u.first)(c),p=(0,u.last)(c);d!==p&&(o(d,p),l.preventDefault())}return l.addEventListener("keydown",i),()=>{l.removeEventListener("keydown",i)}}),[])}function nc(){const[e,t,n]=function(){const e=(0,s.useRef)(),t=(0,s.useRef)(),n=(0,s.useRef)(),o=(0,s.useRef)(),{hasMultiSelection:r,getSelectedBlockClientId:l,getBlockCount:i}=(0,m.useSelect)(Vn),{setNavigationMode:a}=(0,m.useDispatch)(Vn),c=(0,m.useSelect)((e=>e(Vn).isNavigationMode()),[])?void 0:"0",u=(0,s.useRef)();function p(t){if(u.current)u.current=null;else if(r())e.current.focus();else if(l())o.current.focus();else{a(!0);const n=t.target.compareDocumentPosition(e.current)&t.target.DOCUMENT_POSITION_FOLLOWING?"findNext":"findPrevious";or.focus.tabbable[n](t.target).focus()}}const f=(0,s.createElement)("div",{ref:t,tabIndex:c,onFocus:p}),h=(0,s.createElement)("div",{ref:n,tabIndex:c,onFocus:p}),g=(0,d.useRefEffect)((s=>{function c(e){if(e.defaultPrevented)return;if(e.keyCode===ga.ESCAPE&&!r())return e.preventDefault(),void a(!0);if(e.keyCode!==ga.TAB)return;const o=e.shiftKey,i=o?"findPrevious":"findNext";if(!r()&&!l())return void(e.target===s&&a(!0));if(Xa(e.target)&&Xa(or.focus.tabbable[i](e.target)))return;const c=o?t:n;u.current=!0,c.current.focus({preventScroll:!0})}function d(e){o.current=e.target;const{ownerDocument:t}=s;e.relatedTarget||t.activeElement!==t.body||0!==i()||s.focus()}function p(o){var r;if(o.keyCode!==ga.TAB)return;if("region"===(null===(r=o.target)||void 0===r?void 0:r.getAttribute("role")))return;if(e.current===o.target)return;const l=o.shiftKey?"findPrevious":"findNext",i=or.focus.tabbable[l](o.target);i!==t.current&&i!==n.current||(o.preventDefault(),i.focus({preventScroll:!0}))}const{ownerDocument:m}=s,{defaultView:f}=m;return f.addEventListener("keydown",p),s.addEventListener("keydown",c),s.addEventListener("focusout",d),()=>{f.removeEventListener("keydown",p),s.removeEventListener("keydown",c),s.removeEventListener("focusout",d)}}),[]);return[f,(0,d.useMergeRefs)([e,g]),h]}(),o=(0,m.useSelect)((e=>e(Vn).hasMultiSelection()),[]);return[e,(0,d.useMergeRefs)([t,Za(),tc(),Ja(),(0,d.useRefEffect)((e=>{if(e.tabIndex=-1,o)return e.setAttribute("aria-label",(0,h.__)("Multiple selected blocks")),()=>{e.removeAttribute("aria-label")}}),[o])]),n]}var oc=(0,s.forwardRef)((function({children:e,...t},n){const[o,r,l]=nc();return(0,s.createElement)(s.Fragment,null,o,(0,s.createElement)("div",i({},t,{ref:(0,d.useMergeRefs)([r,n]),className:c()(t.className,"block-editor-writing-flow")}),e),l)}));const rc="editor-styles-wrapper";function lc(e){return(0,s.useMemo)((()=>{const t=document.implementation.createHTMLDocument("");return t.body.innerHTML=e,Array.from(t.body.children)}),[e])}var ic=(0,s.forwardRef)((function({contentRef:e,children:t,head:n,tabIndex:o=0,...r},l){var a,u;const[,m]=(0,s.useReducer)((()=>({}))),[f,g]=(0,s.useState)(),[v,b]=(0,s.useState)([]),k=lc(null===(a=window.__editorAssets)||void 0===a?void 0:a.styles),_=lc(null===(u=window.__editorAssets)||void 0===u?void 0:u.scripts),y=ja(),[E,C,w]=nc(),S=(0,d.useRefEffect)((e=>{function t(){const{contentDocument:t,ownerDocument:n}=e,{readyState:o,documentElement:r}=t;return("interactive"===o||"complete"===o)&&(function(e){const{defaultView:t}=e,{frameElement:n}=t;function o(e){const o=Object.getPrototypeOf(e).constructor.name,r=window[o],l={};for(const t in e)l[t]=e[t];if(e instanceof t.MouseEvent){const e=n.getBoundingClientRect();l.clientX+=e.left,l.clientY+=e.top}const i=new r(e.type,l);!n.dispatchEvent(i)&&e.preventDefault()}const r=["dragover"];for(const t of r)e.addEventListener(t,o)}(t),g(t),y(r),b(Array.from(n.body.classList).filter((e=>e.startsWith("admin-color-")||"wp-embed-responsive"===e))),t.dir=n.dir,r.removeChild(t.head),r.removeChild(t.body),!0)}t()||e.addEventListener("load",(()=>{t()}))}),[]),B=(0,d.useRefEffect)((e=>{_.reduce(((t,n)=>t.then((()=>async function(e,{id:t,src:n}){return new Promise(((o,r)=>{const l=e.ownerDocument.createElement("script");l.id=t,n?(l.src=n,l.onload=()=>o(),l.onerror=()=>r()):o(),e.appendChild(l)}))}(e,n)))),Promise.resolve()).finally((()=>{m()}))}),[]),I=(0,d.useMergeRefs)([e,y,C]);return(0,s.useEffect)((()=>{var e;f&&(e=f,Array.from(document.styleSheets).forEach((t=>{try{t.cssRules}catch(e){return}const{ownerNode:n,cssRules:o}=t;if(o&&"LINK"===n.tagName&&"wp-reset-editor-styles-css"!==n.id&&Array.from(o).find((({selectorText:e})=>e&&(e.includes(`.${rc}`)||e.includes(".wp-block"))))&&!e.getElementById(n.id)){console.warn(`Stylesheet ${n.id} was not properly added.\nFor blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).\nFor themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`,n.outerHTML),e.head.appendChild(n.cloneNode(!0));const t=n.id.replace("-css","-inline-css"),o=document.getElementById(t);o&&e.head.appendChild(o.cloneNode(!0))}})))}),[f]),n=(0,s.createElement)(s.Fragment,null,(0,s.createElement)("style",null,"body{margin:0}"),k.map((({tagName:e,href:t,id:n,rel:o,media:r,textContent:l})=>{const i=e.toLowerCase();return"style"===i?(0,s.createElement)(i,{id:n,key:n},l):(0,s.createElement)(i,{href:t,id:n,rel:o,media:r,key:n})})),n),(0,s.createElement)(s.Fragment,null,o>=0&&E,(0,s.createElement)("iframe",i({},r,{ref:(0,d.useMergeRefs)([l,S]),tabIndex:o,title:(0,h.__)("Editor canvas")}),f&&(0,s.createPortal)((0,s.createElement)(s.Fragment,null,(0,s.createElement)("head",{ref:B},n),(0,s.createElement)("body",{ref:I,className:c()(rc,...v)},(0,s.createElement)(p.__experimentalStyleProvider,{document:f},t))),f.documentElement)),o>=0&&w)})),sc={grad:.9,turn:360,rad:360/(2*Math.PI)},ac=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},cc=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},uc=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},dc=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},pc=function(e){return{r:uc(e.r,0,255),g:uc(e.g,0,255),b:uc(e.b,0,255),a:uc(e.a)}},mc=function(e){return{r:cc(e.r),g:cc(e.g),b:cc(e.b),a:cc(e.a,3)}},fc=/^#([0-9a-f]{3,8})$/i,hc=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},gc=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}},vc=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}},bc=function(e){return{h:dc(e.h),s:uc(e.s,0,100),l:uc(e.l,0,100),a:uc(e.a)}},kc=function(e){return{h:cc(e.h),s:cc(e.s),l:cc(e.l),a:cc(e.a,3)}},_c=function(e){return vc((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},yc=function(e){return{h:(t=gc(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},Ec=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Cc=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,wc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Sc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bc={string:[[function(e){var t=fc.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?cc(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?cc(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=wc.exec(e)||Sc.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:pc({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=Ec.exec(e)||Cc.exec(e);if(!t)return null;var n,o,r=bc({h:(n=t[1],o=t[2],void 0===o&&(o="deg"),Number(n)*(sc[o]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return _c(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 ac(t)&&ac(n)&&ac(o)?pc({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(!ac(t)||!ac(n)||!ac(o))return null;var i=bc({h:Number(t),s:Number(n),l:Number(o),a:Number(l)});return _c(i)},"hsl"],[function(e){var t=e.h,n=e.s,o=e.v,r=e.a,l=void 0===r?1:r;if(!ac(t)||!ac(n)||!ac(o))return null;var i=function(e){return{h:dc(e.h),s:uc(e.s,0,100),v:uc(e.v,0,100),a:uc(e.a)}}({h:Number(t),s:Number(n),v:Number(o),a:Number(l)});return vc(i)},"hsv"]]},Ic=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]},xc=function(e,t){var n=yc(e);return{h:n.h,s:uc(n.s+100*t,0,100),l:n.l,a:n.a}},Tc=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Nc=function(e,t){var n=yc(e);return{h:n.h,s:n.s,l:uc(n.l+100*t,0,100),a:n.a}},Pc=function(){function e(e){this.parsed=function(e){return"string"==typeof e?Ic(e.trim(),Bc.string):"object"==typeof e&&null!==e?Ic(e,Bc.object):[null,void 0]}(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 cc(Tc(this.rgba),2)},e.prototype.isDark=function(){return Tc(this.rgba)<.5},e.prototype.isLight=function(){return Tc(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=mc(this.rgba)).r,n=e.g,o=e.b,l=(r=e.a)<1?hc(cc(255*r)):"","#"+hc(t)+hc(n)+hc(o)+l;var e,t,n,o,r,l},e.prototype.toRgb=function(){return mc(this.rgba)},e.prototype.toRgbString=function(){return t=(e=mc(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 kc(yc(this.rgba))},e.prototype.toHslString=function(){return t=(e=kc(yc(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=gc(this.rgba),{h:cc(e.h),s:cc(e.s),v:cc(e.v),a:cc(e.a,3)};var e},e.prototype.invert=function(){return Mc({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),Mc(xc(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Mc(xc(this.rgba,-e))},e.prototype.grayscale=function(){return Mc(xc(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Mc(Nc(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Mc(Nc(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?Mc({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):cc(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=yc(this.rgba);return"number"==typeof e?Mc({h:e,s:t.s,l:t.l,a:t.a}):cc(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Mc(e).toHex()},e}(),Mc=function(e){return e instanceof Pc?e:new Pc(e)},Rc=[],Lc=function(e){e.forEach((function(e){Rc.indexOf(e)<0&&(e(Pc,Bc),Rc.push(e))}))};function Ac(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 Dc=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},Oc=function(e){return.2126*Dc(e.r)+.7152*Dc(e.g)+.0722*Dc(e.b)};function Fc(e){e.prototype.luminance=function(){return e=Oc(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=Oc(l))>(a=Oc(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}}var zc=n(3692),Vc=n.n(zc);const Hc=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function Uc(e,t){t=t||{};let n=1,o=1;function r(e){const t=e.match(/\n/g);t&&(n+=t.length);const r=e.lastIndexOf("\n");o=~r?e.length-r:o+e.length}function l(){const e={line:n,column:o};return function(t){return t.position=new i(e),m(),t}}function i(e){this.start=e,this.end={line:n,column:o},this.source=t.source}i.prototype.content=e;const s=[];function a(r){const l=new Error(t.source+":"+n+":"+o+": "+r);if(l.reason=r,l.filename=t.source,l.line=n,l.column=o,l.source=e,!t.silent)throw l;s.push(l)}function c(){return p(/^{\s*/)}function u(){return p(/^}/)}function d(){let t;const n=[];for(m(),f(n);e.length&&"}"!==e.charAt(0)&&(t=w()||S());)!1!==t&&(n.push(t),f(n));return n}function p(t){const n=t.exec(e);if(!n)return;const o=n[0];return r(o),e=e.slice(o.length),n}function m(){p(/^\s*/)}function f(e){let t;for(e=e||[];t=h();)!1!==t&&e.push(t);return e}function h(){const t=l();if("/"!==e.charAt(0)||"*"!==e.charAt(1))return;let n=2;for(;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return a("End of comment missing");const i=e.slice(2,n-2);return o+=2,r(i),e=e.slice(n),o+=2,t({type:"comment",comment:i})}function g(){const e=p(/^([^{]+)/);if(e)return Gc(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(function(e){return e.replace(/,/g,"")})).split(/\s*(?![^(]*\)),\s*/).map((function(e){return e.replace(/\u200C/g,",")}))}function v(){const e=l();let t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!t)return;if(t=Gc(t[0]),!p(/^:\s*/))return a("property missing ':'");const n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),o=e({type:"declaration",property:t.replace(Hc,""),value:n?Gc(n[0]).replace(Hc,""):""});return p(/^[;\s]*/),o}function b(){const e=[];if(!c())return a("missing '{'");let t;for(f(e);t=v();)!1!==t&&(e.push(t),f(e));return u()?e:a("missing '}'")}function k(){let e;const t=[],n=l();for(;e=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),p(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:b()})}const _=C("import"),y=C("charset"),E=C("namespace");function C(e){const t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){const n=l(),o=p(t);if(!o)return;const r={type:e};return r[e]=o[1].trim(),n(r)}}function w(){if("@"===e[0])return function(){const e=l();let t=p(/^@([-\w]+)?keyframes\s*/);if(!t)return;const n=t[1];if(t=p(/^([-\w]+)\s*/),!t)return a("@keyframes missing name");const o=t[1];if(!c())return a("@keyframes missing '{'");let r,i=f();for(;r=k();)i.push(r),i=i.concat(f());return u()?e({type:"keyframes",name:o,vendor:n,keyframes:i}):a("@keyframes missing '}'")}()||function(){const e=l(),t=p(/^@media *([^{]+)/);if(!t)return;const n=Gc(t[1]);if(!c())return a("@media missing '{'");const o=f().concat(d());return u()?e({type:"media",media:n,rules:o}):a("@media missing '}'")}()||function(){const e=l(),t=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:Gc(t[1]),media:Gc(t[2])})}()||function(){const e=l(),t=p(/^@supports *([^{]+)/);if(!t)return;const n=Gc(t[1]);if(!c())return a("@supports missing '{'");const o=f().concat(d());return u()?e({type:"supports",supports:n,rules:o}):a("@supports missing '}'")}()||_()||y()||E()||function(){const e=l(),t=p(/^@([-\w]+)?document *([^{]+)/);if(!t)return;const n=Gc(t[1]),o=Gc(t[2]);if(!c())return a("@document missing '{'");const r=f().concat(d());return u()?e({type:"document",document:o,vendor:n,rules:r}):a("@document missing '}'")}()||function(){const e=l();if(!p(/^@page */))return;const t=g()||[];if(!c())return a("@page missing '{'");let n,o=f();for(;n=v();)o.push(n),o=o.concat(f());return u()?e({type:"page",selectors:t,declarations:o}):a("@page missing '}'")}()||function(){const e=l();if(!p(/^@host\s*/))return;if(!c())return a("@host missing '{'");const t=f().concat(d());return u()?e({type:"host",rules:t}):a("@host missing '}'")}()||function(){const e=l();if(!p(/^@font-face\s*/))return;if(!c())return a("@font-face missing '{'");let t,n=f();for(;t=v();)n.push(t),n=n.concat(f());return u()?e({type:"font-face",declarations:n}):a("@font-face missing '}'")}()}function S(){const e=l(),t=g();return t?(f(),e({type:"rule",selectors:t,declarations:b()})):a("selector missing")}return Wc(function(){const e=d();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:s}}}())}function Gc(e){return e?e.replace(/^\s+|\s+$/g,""):""}function Wc(e,t){const n=e&&"string"==typeof e.type,o=n?e:t;for(const t in e){const n=e[t];Array.isArray(n)?n.forEach((function(e){Wc(e,o)})):n&&"object"==typeof n&&Wc(n,o)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var $c=n(5717),jc=n.n($c),Kc=qc;function qc(e){this.options=e||{}}qc.prototype.emit=function(e){return e},qc.prototype.visit=function(e){return this[e.type](e)},qc.prototype.mapVisit=function(e,t){let n="";t=t||"";for(let o=0,r=e.length;o<r;o++)n+=this.visit(e[o]),t&&o<r-1&&(n+=this.emit(t));return n};var Yc=Zc;function Zc(e){Kc.call(this,e)}jc()(Zc,Kc),Zc.prototype.compile=function(e){return e.stylesheet.rules.map(this.visit,this).join("")},Zc.prototype.comment=function(e){return this.emit("",e.position)},Zc.prototype.import=function(e){return this.emit("@import "+e.import+";",e.position)},Zc.prototype.media=function(e){return this.emit("@media "+e.media,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},Zc.prototype.document=function(e){const t="@"+(e.vendor||"")+"document "+e.document;return this.emit(t,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},Zc.prototype.charset=function(e){return this.emit("@charset "+e.charset+";",e.position)},Zc.prototype.namespace=function(e){return this.emit("@namespace "+e.namespace+";",e.position)},Zc.prototype.supports=function(e){return this.emit("@supports "+e.supports,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},Zc.prototype.keyframes=function(e){return this.emit("@"+(e.vendor||"")+"keyframes "+e.name,e.position)+this.emit("{")+this.mapVisit(e.keyframes)+this.emit("}")},Zc.prototype.keyframe=function(e){const t=e.declarations;return this.emit(e.values.join(","),e.position)+this.emit("{")+this.mapVisit(t)+this.emit("}")},Zc.prototype.page=function(e){const t=e.selectors.length?e.selectors.join(", "):"";return this.emit("@page "+t,e.position)+this.emit("{")+this.mapVisit(e.declarations)+this.emit("}")},Zc.prototype["font-face"]=function(e){return this.emit("@font-face",e.position)+this.emit("{")+this.mapVisit(e.declarations)+this.emit("}")},Zc.prototype.host=function(e){return this.emit("@host",e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},Zc.prototype["custom-media"]=function(e){return this.emit("@custom-media "+e.name+" "+e.media+";",e.position)},Zc.prototype.rule=function(e){const t=e.declarations;return t.length?this.emit(e.selectors.join(","),e.position)+this.emit("{")+this.mapVisit(t)+this.emit("}"):""},Zc.prototype.declaration=function(e){return this.emit(e.property+":"+e.value,e.position)+this.emit(";")};var Xc=Qc;function Qc(e){e=e||{},Kc.call(this,e),this.indentation=e.indent}jc()(Qc,Kc),Qc.prototype.compile=function(e){return this.stylesheet(e)},Qc.prototype.stylesheet=function(e){return this.mapVisit(e.stylesheet.rules,"\n\n")},Qc.prototype.comment=function(e){return this.emit(this.indent()+"/*"+e.comment+"*/",e.position)},Qc.prototype.import=function(e){return this.emit("@import "+e.import+";",e.position)},Qc.prototype.media=function(e){return this.emit("@media "+e.media,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")},Qc.prototype.document=function(e){const t="@"+(e.vendor||"")+"document "+e.document;return this.emit(t,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")},Qc.prototype.charset=function(e){return this.emit("@charset "+e.charset+";",e.position)},Qc.prototype.namespace=function(e){return this.emit("@namespace "+e.namespace+";",e.position)},Qc.prototype.supports=function(e){return this.emit("@supports "+e.supports,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")},Qc.prototype.keyframes=function(e){return this.emit("@"+(e.vendor||"")+"keyframes "+e.name,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.keyframes,"\n")+this.emit(this.indent(-1)+"}")},Qc.prototype.keyframe=function(e){const t=e.declarations;return this.emit(this.indent())+this.emit(e.values.join(", "),e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(t,"\n")+this.emit(this.indent(-1)+"\n"+this.indent()+"}\n")},Qc.prototype.page=function(e){const t=e.selectors.length?e.selectors.join(", ")+" ":"";return this.emit("@page "+t,e.position)+this.emit("{\n")+this.emit(this.indent(1))+this.mapVisit(e.declarations,"\n")+this.emit(this.indent(-1))+this.emit("\n}")},Qc.prototype["font-face"]=function(e){return this.emit("@font-face ",e.position)+this.emit("{\n")+this.emit(this.indent(1))+this.mapVisit(e.declarations,"\n")+this.emit(this.indent(-1))+this.emit("\n}")},Qc.prototype.host=function(e){return this.emit("@host",e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")},Qc.prototype["custom-media"]=function(e){return this.emit("@custom-media "+e.name+" "+e.media+";",e.position)},Qc.prototype.rule=function(e){const t=this.indent(),n=e.declarations;return n.length?this.emit(e.selectors.map((function(e){return t+e})).join(",\n"),e.position)+this.emit(" {\n")+this.emit(this.indent(1))+this.mapVisit(n,"\n")+this.emit(this.indent(-1))+this.emit("\n"+this.indent()+"}"):""},Qc.prototype.declaration=function(e){return this.emit(this.indent())+this.emit(e.property+": "+e.value,e.position)+this.emit(";")},Qc.prototype.indent=function(e){return this.level=this.level||1,null!==e?(this.level+=e,""):Array(this.level).join(this.indentation||" ")};function Jc(e){return 0!==e.value.indexOf("data:")&&0!==e.value.indexOf("#")&&(t=e.value,!/^\/(?!\/)/.test(t)&&!function(e){return/^(?:https?:)?\/\//.test(e)}(e.value));var t}function eu(e,t){return new URL(e,t).toString()}const tu=/^(body|html|:root).*$/;var nu=(e,t="")=>(0,u.map)(e,(({css:e,baseURL:n,__experimentalNoWrapper:o=!1})=>{const r=[];return t&&!o&&r.push(((e,t=[])=>n=>"rule"===n.type?{...n,selectors:n.selectors.map((n=>t.includes(n.trim())?n:n.match(tu)?n.replace(/^(body|html|:root)/,e):e+" "+n))}:n)(t)),n&&r.push((l=n,e=>{if("declaration"===e.type){const r=function(e){const t=/url\((\s*)(['"]?)(.+?)\2(\s*)\)/g;let n;const o=[];for(;null!==(n=t.exec(e));){const e={source:n[0],before:n[1],quote:n[2],value:n[3],after:n[4]};Jc(e)&&o.push(e)}return o}(e.value).map((o=l,e=>({...e,newUrl:"url("+e.before+e.quote+eu(e.value,o)+e.quote+e.after+")"})));return{...e,value:(t=e.value,n=r,n.forEach((e=>{t=t.replace(e.source,e.newUrl)})),t)}}var t,n,o;return e})),r.length?function(e,t){try{const r=Uc(e);return n=Vc().map(r,(function(e){if(!e)return e;const n=t(e);return this.update(n)})),((o=o||{}).compress?new Yc(o):new Xc(o)).compile(n)}catch(e){return console.warn("Error while traversing the CSS: "+e),null}var n,o}(e,(0,d.compose)(r)):e;var l}));const ou=".editor-styles-wrapper";function ru(e){return(0,s.useCallback)((e=>{if(!e)return;const{ownerDocument:t}=e,{defaultView:n,body:o}=t,r=t.querySelector(ou);let l;if(r)l=n.getComputedStyle(r,null).getPropertyValue("background-color");else{const e=t.createElement("div");e.classList.add("editor-styles-wrapper"),o.appendChild(e),l=n.getComputedStyle(e,null).getPropertyValue("background-color"),o.removeChild(e)}const i=Mc(l);i.luminance()>.5||0===i.alpha()?o.classList.remove("is-dark-theme"):o.classList.add("is-dark-theme")}),[e])}function lu({styles:e}){const t=(0,s.useMemo)((()=>nu(e,ou)),[e]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("style",{ref:ru(e)}),t.map(((e,t)=>(0,s.createElement)("style",{key:t},e))))}let iu;Lc([Ac,Fc]);var su=function({viewportWidth:e,__experimentalPadding:t}){const[n,{width:o}]=(0,d.useResizeObserver)(),[r,{height:l}]=(0,d.useResizeObserver)(),i=(0,m.useSelect)((e=>e(Vn).getSettings().styles),[]);iu=iu||(0,d.pure)(nm);const a=o/e;return(0,s.createElement)("div",{className:"block-editor-block-preview__container"},n,(0,s.createElement)(p.Disabled,{className:"block-editor-block-preview__content",style:{transform:`scale(${a})`,height:l*a}},(0,s.createElement)(ic,{head:(0,s.createElement)(lu,{styles:i}),contentRef:(0,d.useRefEffect)((e=>{const{ownerDocument:{documentElement:n}}=e;n.style.position="absolute",n.style.width="100%",e.style.padding=t+"px"}),[]),"aria-hidden":!0,tabIndex:-1,style:{position:"absolute",width:e,height:l,pointerEvents:"none"}},r,(0,s.createElement)(iu,{renderAppender:!1}))))},au=(0,s.memo)((function({blocks:e,__experimentalPadding:t=0,viewportWidth:n=1200,__experimentalLive:o=!1,__experimentalOnClick:r}){const l=(0,m.useSelect)((e=>e(Vn).getSettings()),[]),i=(0,s.useMemo)((()=>{const e={...l};return e.__experimentalBlockPatterns=[],e}),[l]),a=(0,s.useMemo)((()=>(0,u.castArray)(e)),[e]);return e&&0!==e.length?(0,s.createElement)(Wa,{value:a,settings:i},o?(0,s.createElement)($a,{onClick:r}):(0,s.createElement)(su,{viewportWidth:n,__experimentalPadding:t})):null})),cu=function({item:e}){var t,n;const{name:o,title:l,icon:i,description:a,initialAttributes:c}=e,u=(0,r.getBlockType)(o),d=(0,r.isReusableBlock)(e);return(0,s.createElement)("div",{className:"block-editor-inserter__preview-container"},(0,s.createElement)("div",{className:"block-editor-inserter__preview"},d||null!=u&&u.example?(0,s.createElement)("div",{className:"block-editor-inserter__preview-content"},(0,s.createElement)(au,{__experimentalPadding:16,viewportWidth:null!==(t=null===(n=u.example)||void 0===n?void 0:n.viewportWidth)&&void 0!==t?t:500,blocks:u.example?(0,r.getBlockFromExample)(e.name,{attributes:{...u.example.attributes,...c},innerBlocks:u.example.innerBlocks}):(0,r.createBlock)(o,c)})):(0,s.createElement)("div",{className:"block-editor-inserter__preview-content-missing"},(0,h.__)("No Preview Available."))),!d&&(0,s.createElement)(Ua,{title:l,icon:i,description:a}))},uu=(0,s.createContext)(),du=(0,s.forwardRef)((function({isFirst:e,as:t,children:n,...o},r){const l=(0,s.useContext)(uu);return(0,s.createElement)(p.__unstableCompositeItem,i({ref:r,state:l,role:"option",focusable:!0},o),(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)(p.Button,r,n)}))})),pu=(0,s.createElement)(F.SVG,{width:"18",height:"18",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18"},(0,s.createElement)(F.Path,{d:"M5 4h2V2H5v2zm6-2v2h2V2h-2zm-6 8h2V8H5v2zm6 0h2V8h-2v2zm-6 6h2v-2H5v2zm6 0h2v-2h-2v2z"}));function mu({count:e,icon:t}){return(0,s.createElement)("div",{className:"block-editor-block-draggable-chip-wrapper"},(0,s.createElement)("div",{className:"block-editor-block-draggable-chip"},(0,s.createElement)(p.Flex,{justify:"center",className:"block-editor-block-draggable-chip__content"},(0,s.createElement)(p.FlexItem,null,t?(0,s.createElement)(Ha,{icon:t}):(0,h.sprintf)(
|
| 11 |
/* translators: %d: Number of blocks. */
|
| 12 |
+
(0,h._n)("%d block","%d blocks",e),e)),(0,s.createElement)(p.FlexItem,null,(0,s.createElement)(Ha,{icon:pu})))))}var fu=({isEnabled:e,blocks:t,icon:n,children:o})=>{const r={type:"inserter",blocks:t};return(0,s.createElement)(p.Draggable,{__experimentalTransferDataType:"wp-blocks",transferData:r,__experimentalDragComponent:(0,s.createElement)(mu,{count:t.length,icon:n})},(({onDraggableStart:t,onDraggableEnd:n})=>o({draggable:e,onDragStart:e?t:void 0,onDragEnd:e?n:void 0})))};function hu(e=window){const{platform:t}=e.navigator;return-1!==t.indexOf("Mac")||["iPad","iPhone"].includes(t)}var gu=(0,s.memo)((function({className:e,isFirst:t,item:n,onSelect:o,onHover:l,isDraggable:a,...u}){const d=(0,s.useRef)(!1),p=n.icon?{backgroundColor:n.icon.background,color:n.icon.foreground}:{},m=(0,s.useMemo)((()=>[(0,r.createBlock)(n.name,n.initialAttributes,(0,r.createBlocksFromInnerBlocksTemplate)(n.innerBlocks))]),[n.name,n.initialAttributes,n.initialAttributes]);return(0,s.createElement)(fu,{isEnabled:a&&!n.disabled,blocks:m,icon:n.icon},(({draggable:r,onDragStart:a,onDragEnd:m})=>(0,s.createElement)("div",{className:"block-editor-block-types-list__list-item",draggable:r,onDragStart:e=>{d.current=!0,a&&(l(null),a(e))},onDragEnd:e=>{d.current=!1,m&&m(e)}},(0,s.createElement)(du,i({isFirst:t,className:c()("block-editor-block-types-list__item",e),disabled:n.isDisabled,onClick:e=>{e.preventDefault(),o(n,hu()?e.metaKey:e.ctrlKey),l(null)},onKeyDown:e=>{const{keyCode:t}=e;t===ga.ENTER&&(e.preventDefault(),o(n,hu()?e.metaKey:e.ctrlKey),l(null))},onFocus:()=>{d.current||l(n)},onMouseEnter:()=>{d.current||l(n)},onMouseLeave:()=>l(null),onBlur:()=>l(null)},u),(0,s.createElement)("span",{className:"block-editor-block-types-list__item-icon",style:p},(0,s.createElement)(Ha,{icon:n.icon,showColors:!0})),(0,s.createElement)("span",{className:"block-editor-block-types-list__item-title"},n.title)))))})),vu=(0,s.forwardRef)((function(e,t){const[n,o]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{n&&(0,Pt.speak)((0,h.__)("Use left and right arrow keys to move through blocks"))}),[n]),(0,s.createElement)("div",i({ref:t,role:"listbox","aria-orientation":"horizontal",onFocus:()=>{o(!0)},onBlur:e=>{!e.currentTarget.contains(e.relatedTarget)&&o(!1)}},e))})),bu=(0,s.forwardRef)((function(e,t){const n=(0,s.useContext)(uu);return(0,s.createElement)(p.__unstableCompositeGroup,i({state:n,role:"presentation",ref:t},e))})),ku=function({items:e=[],onSelect:t,onHover:n=(()=>{}),children:o,label:l,isDraggable:i=!0}){return(0,s.createElement)(vu,{className:"block-editor-block-types-list","aria-label":l},function(e,t){const n=[];for(let t=0,o=e.length;t<o;t+=3)n.push(e.slice(t,t+3));return n}(e).map(((e,o)=>(0,s.createElement)(bu,{key:o},e.map(((e,l)=>(0,s.createElement)(gu,{key:e.id,item:e,className:(0,r.getBlockMenuDefaultClassName)(e.id),onSelect:t,onHover:n,isDraggable:i,isFirst:0===o&&0===l})))))),o)},_u=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)(p.Icon,{icon:t})),(0,s.createElement)("div",{className:"block-editor-inserter__panel-content"},n))},yu=(e,t)=>{const{categories:n,collections:o,items:l}=(0,m.useSelect)((t=>{const{getInserterItems:n}=t(Vn),{getCategories:o,getCollections:l}=t(r.store);return{categories:o(),collections:l(),items:n(e)}}),[e]);return[l,n,o,(0,s.useCallback)((({name:e,initialAttributes:n,innerBlocks:o},l)=>{const i=(0,r.createBlock)(e,n,(0,r.createBlocksFromInnerBlocksTemplate)(o));t(i,void 0,l)}),[t])]},Eu=function({children:e}){const t=(0,p.__unstableUseCompositeState)({shift:!0,wrap:"horizontal"});return(0,s.createElement)(uu.Provider,{value:t},e)};const Cu=[];var wu=function({rootClientId:e,onInsert:t,onHover:n,showMostUsedBlocks:o}){const[r,l,i,a]=yu(e,t),c=(0,s.useMemo)((()=>(0,u.orderBy)(r,["frecency"],["desc"]).slice(0,6)),[r]),p=(0,s.useMemo)((()=>r.filter((e=>!e.category))),[r]),m=(0,s.useMemo)((()=>(0,u.flow)((e=>e.filter((e=>e.category&&"reusable"!==e.category))),(e=>(0,u.groupBy)(e,"category")))(r)),[r]),f=(0,s.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,s.useEffect)((()=>()=>n(null)),[]);const g=(0,d.useAsyncList)(l),v=l.length===g.length,b=(0,s.useMemo)((()=>Object.entries(i)),[i]),k=(0,d.useAsyncList)(v?b:Cu);return(0,s.createElement)(Eu,null,(0,s.createElement)("div",null,o&&!!c.length&&(0,s.createElement)(_u,{title:(0,h._x)("Most used","blocks")},(0,s.createElement)(ku,{items:c,onSelect:a,onHover:n,label:(0,h._x)("Most used","blocks")})),(0,u.map)(g,(e=>{const t=m[e.slug];return t&&t.length?(0,s.createElement)(_u,{key:e.slug,title:e.title,icon:e.icon},(0,s.createElement)(ku,{items:t,onSelect:a,onHover:n,label:e.title})):null})),v&&p.length>0&&(0,s.createElement)(_u,{className:"block-editor-inserter__uncategorized-blocks-panel",title:(0,h.__)("Uncategorized")},(0,s.createElement)(ku,{items:p,onSelect:a,onHover:n,label:(0,h.__)("Uncategorized")})),(0,u.map)(k,(([e,t])=>{const o=f[e];return o&&o.length?(0,s.createElement)(_u,{key:e,title:t.title,icon:t.icon},(0,s.createElement)(ku,{items:o,onSelect:a,onHover:n,label:t.title})):null}))))},Su=function({selectedCategory:e,patternCategories:t,onClickCategory:n,openPatternExplorer:o}){const r=(0,d.useViewportMatch)("medium","<"),l=c()("block-editor-inserter__panel-header","block-editor-inserter__panel-header-patterns");return(0,s.createElement)(p.Flex,{justify:"space-between",align:"start",gap:"4",className:l},(0,s.createElement)(p.FlexItem,{isBlock:!0},(0,s.createElement)(p.SelectControl,{className:"block-editor-inserter__panel-dropdown",label:(0,h.__)("Filter patterns"),hideLabelFromVision:!0,value:e.name,onChange:e=>{n(t.find((t=>e===t.name)))},onBlur:e=>{null!=e&&e.relatedTarget||e.stopPropagation()},options:(()=>{const e=[];return t.map((t=>e.push({value:t.name,label:t.label}))),e})()})),!r&&(0,s.createElement)(p.FlexItem,null,(0,s.createElement)(p.Button,{variant:"secondary",className:"block-editor-inserter__patterns-explorer-expand",label:(0,h.__)("Explore all patterns"),onClick:()=>o()},(0,h._x)("Explore","Label for showing all block patterns"))))},Bu=window.wp.notices,Iu=(e,t)=>{const{patternCategories:n,patterns:o}=(0,m.useSelect)((e=>{const{__experimentalGetAllowedPatterns:n,getSettings:o}=e(Vn);return{patterns:n(t),patternCategories:o().__experimentalBlockPatternCategories}}),[t]),{createSuccessNotice:l}=(0,m.useDispatch)(Bu.store);return[o,n,(0,s.useCallback)(((t,n)=>{e((0,u.map)(n,(e=>(0,r.cloneBlock)(e))),t.name),l((0,h.sprintf)(
|
| 13 |
/* translators: %s: block pattern title. */
|
| 14 |
+
(0,h.__)('Block pattern "%s" inserted.'),t.title),{type:"snackbar"})}),[])]};function xu({isDraggable:e,pattern:t,onClick:n,composite:o}){const{blocks:r,viewportWidth:l}=t,a=`block-editor-block-patterns-list__item-description-${(0,d.useInstanceId)(xu)}`;return(0,s.createElement)(fu,{isEnabled:e,blocks:r},(({draggable:e,onDragStart:c,onDragEnd:u})=>(0,s.createElement)("div",{className:"block-editor-block-patterns-list__list-item","aria-label":t.title,"aria-describedby":t.description?a:void 0,draggable:e,onDragStart:c,onDragEnd:u},(0,s.createElement)(p.__unstableCompositeItem,i({role:"option",as:"div"},o,{className:"block-editor-block-patterns-list__item",onClick:()=>n(t,r)}),(0,s.createElement)(au,{blocks:r,viewportWidth:l}),(0,s.createElement)("div",{className:"block-editor-block-patterns-list__item-title"},t.title),!!t.description&&(0,s.createElement)(p.VisuallyHidden,{id:a},t.description)))))}function Tu(){return(0,s.createElement)("div",{className:"block-editor-block-patterns-list__item is-placeholder"})}var Nu=function({isDraggable:e,blockPatterns:t,shownPatterns:n,onClickPattern:o,orientation:r,label:l=(0,h.__)("Block Patterns")}){const a=(0,p.__unstableUseCompositeState)({orientation:r});return(0,s.createElement)(p.__unstableComposite,i({},a,{role:"listbox",className:"block-editor-block-patterns-list","aria-label":l}),t.map((t=>n.includes(t)?(0,s.createElement)(xu,{key:t.name,pattern:t,onClick:o,isDraggable:e,composite:a}):(0,s.createElement)(Tu,{key:t.name}))))};function Pu({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)(p.Button,{key:t,label:r,className:`${o}__categories-list__item`,isPressed:e===t,onClick:()=>{n(t)}},r))))}function Mu({filterValue:e,setFilterValue:t}){return(0,s.createElement)("div",{className:"block-editor-block-patterns-explorer__search"},(0,s.createElement)(p.SearchControl,{onChange:t,value:e,label:(0,h.__)("Search for patterns"),placeholder:(0,h.__)("Search")}))}var Ru=function({selectedCategory:e,patternCategories:t,onClickCategory:n,filterValue:o,setFilterValue:r}){return(0,s.createElement)("div",{className:"block-editor-block-patterns-explorer__sidebar"},(0,s.createElement)(Mu,{filterValue:o,setFilterValue:r}),!o&&(0,s.createElement)(Pu,{selectedCategory:e,patternCategories:t,onClickCategory:n}))},Lu=function(){return(0,s.createElement)("div",{className:"block-editor-inserter__no-results"},(0,s.createElement)(So,{className:"block-editor-inserter__no-results-icon",icon:Va}),(0,s.createElement)("p",null,(0,h.__)("No results found.")))},Au=function({rootClientId:e="",insertionIndex:t,clientId:n,isAppender:o,onSelect:l,shouldFocusBlock:i=!0}){const{getSelectedBlock:a}=(0,m.useSelect)(Vn),{destinationRootClientId:c,destinationIndex:d}=(0,m.useSelect)((r=>{const{getSelectedBlockClientId:l,getBlockRootClientId:i,getBlockIndex:s,getBlockOrder:a}=r(Vn),c=l();let u,d=e;return void 0!==t?u=t:n?u=s(n,d):!o&&c?(d=i(c),u=s(c,d)+1):u=a(d).length,{destinationRootClientId:d,destinationIndex:u}}),[e,t,n,o]),{replaceBlocks:p,insertBlocks:f,showInsertionPoint:g,hideInsertionPoint:v}=(0,m.useDispatch)(Vn),b=(0,s.useCallback)(((e,t,n=!1)=>{const s=a();!o&&s&&(0,r.isUnmodifiedDefaultBlock)(s)?p(s.clientId,e,null,i||n?0:null,t):f(e,d,c,!0,i||n?0:null,t);const m=(0,h.sprintf)(// translators: %d: the name of the block that has been added
|
| 15 |
+
(0,h._n)("%d block added.","%d blocks added.",(0,u.castArray)(e).length),(0,u.castArray)(e).length);(0,Pt.speak)(m),l&&l()}),[o,a,p,f,c,d,l,i]),k=(0,s.useCallback)((e=>{e?g(c,d):v()}),[g,v,c,d]);return[c,b,k]};const Du=e=>e.name||"",Ou=e=>e.title,Fu=e=>e.description||"",zu=e=>e.keywords||[],Vu=e=>e.category,Hu=()=>null;function Uu(e=""){return(e=(e=(0,u.deburr)(e)).replace(/^\//,"")).toLowerCase()}const Gu=(e="")=>(0,u.words)(Uu(e)),Wu=(e,t,n,o)=>0===Gu(o).length?e:$u(e,o,{getCategory:e=>{var n;return null===(n=(0,u.find)(t,{slug:e.category}))||void 0===n?void 0:n.title},getCollection:e=>{var t;return null===(t=n[e.name.split("/")[0]])||void 0===t?void 0:t.title}}),$u=(e=[],t="",n={})=>{if(0===Gu(t).length)return e;const o=e.map((e=>[e,ju(e,t,n)])).filter((([,e])=>e>0));return o.sort((([,e],[,t])=>t-e)),o.map((([e])=>e))};function ju(e,t,n={}){const{getName:o=Du,getTitle:r=Ou,getDescription:l=Fu,getKeywords:i=zu,getCategory:s=Vu,getCollection:a=Hu}=n,c=o(e),d=r(e),p=l(e),m=i(e),f=s(e),h=a(e),g=Uu(t),v=Uu(d);let b=0;if(g===v)b+=30;else if(v.startsWith(g))b+=20;else{const e=[c,d,p,...m,f,h].join(" ");0===(k=(0,u.words)(g),_=e,(0,u.differenceWith)(k,Gu(_),((e,t)=>t.includes(e)))).length&&(b+=10)}var k,_;return 0!==b&&c.startsWith("core/")&&b++,b}function Ku({filterValue:e,filteredBlockPatternsLength:t}){return e?(0,s.createElement)(p.__experimentalHeading,{level:2,lineHeight:"48px",className:"block-editor-block-patterns-explorer__search-results-count"},(0,h.sprintf)(
|
| 16 |
+
/* translators: %d: number of patterns. %s: block pattern search query */
|
| 17 |
+
(0,h._n)('%1$d pattern found for "%2$s"','%1$d patterns found for "%2$s"',t),t,e)):null}var qu=function({filterValue:e,selectedCategory:t,patternCategories:n}){const o=(0,d.useDebounce)(Pt.speak,500),[r,l]=Au({shouldFocusBlock:!0}),[i,,a]=Iu(l,r),c=(0,s.useMemo)((()=>n.map((e=>e.name))),[n]),u=(0,s.useMemo)((()=>e?$u(i,e):i.filter((e=>{var n,o;return"uncategorized"===t?!(null!==(n=e.categories)&&void 0!==n&&n.length)||e.categories.every((e=>!c.includes(e))):null===(o=e.categories)||void 0===o?void 0:o.includes(t)}))),[e,t,i]);(0,s.useEffect)((()=>{if(!e)return;const t=u.length,n=(0,h.sprintf)(
|
| 18 |
/* translators: %d: number of results. */
|
| 19 |
+
(0,h._n)("%d result found.","%d results found.",t),t);o(n)}),[e,o]);const p=(0,d.useAsyncList)(u,{step:2}),m=!(null==u||!u.length);return(0,s.createElement)("div",{className:"block-editor-block-patterns-explorer__list"},m&&(0,s.createElement)(Ku,{filterValue:e,filteredBlockPatternsLength:u.length}),(0,s.createElement)(Eu,null,!m&&(0,s.createElement)(Lu,null),m&&(0,s.createElement)(Nu,{shownPatterns:p,blockPatterns:u,onClickPattern:a,isDraggable:!1})))};function Yu({initialCategory:e,patternCategories:t}){const[n,o]=(0,s.useState)(""),[r,l]=(0,s.useState)(null==e?void 0:e.name);return(0,s.createElement)("div",{className:"block-editor-block-patterns-explorer"},(0,s.createElement)(Ru,{selectedCategory:r,patternCategories:t,onClickCategory:l,filterValue:n,setFilterValue:o}),(0,s.createElement)(qu,{filterValue:n,selectedCategory:r,patternCategories:t}))}var Zu=function({onModalClose:e,...t}){return(0,s.createElement)(p.Modal,{title:(0,h.__)("Patterns"),closeLabel:(0,h.__)("Close"),onRequestClose:e,isFullScreen:!0},(0,s.createElement)(Yu,t))};function Xu({rootClientId:e,onInsert:t,selectedCategory:n,populatedCategories:o}){const[r,,l]=Iu(t,e),i=(0,s.useCallback)((e=>{var t;if(null===(t=e.categories)||void 0===t||!t.length)return 1/0;const n=o.reduce(((e,{name:t},n)=>(e[t]=n,e)),{});return Math.min(...e.categories.map((e=>void 0!==n[e]?n[e]:1/0)))}),[o]),a=(0,s.useMemo)((()=>r.filter((e=>{var t;return"uncategorized"===n.name?i(e)===1/0:null===(t=e.categories)||void 0===t?void 0:t.includes(n.name)}))),[r,n]),c=(0,s.useMemo)((()=>a.sort(((e,t)=>i(e)-i(t)))),[a,i]),u=(0,d.useAsyncList)(c);return a.length?(0,s.createElement)("div",{className:"block-editor-inserter__panel-content"},(0,s.createElement)(Nu,{shownPatterns:u,blockPatterns:a,onClickPattern:l,label:n.label,orientation:"vertical",isDraggable:!0})):null}var Qu=function({rootClientId:e,onInsert:t,onClickCategory:n,selectedCategory:o}){const[r,l]=(0,s.useState)(!1),[i,a]=Iu(),c=(0,s.useCallback)((e=>!(!e.categories||!e.categories.length)&&e.categories.some((e=>a.some((t=>t.name===e))))),[a]),u=(0,s.useMemo)((()=>{const e=a.filter((e=>i.some((t=>{var n;return null===(n=t.categories)||void 0===n?void 0:n.includes(e.name)})))).sort((({name:e},{name:t})=>[e,t].includes("featured")?"featured"===e?-1:1:0));return i.some((e=>!c(e)))&&!e.find((e=>"uncategorized"===e.name))&&e.push({name:"uncategorized",label:(0,h._x)("Uncategorized")}),e}),[i,a]),d=o||u[0];return(0,s.createElement)(s.Fragment,null,!r&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Su,{selectedCategory:d,patternCategories:u,onClickCategory:n,openPatternExplorer:()=>l(!0)}),(0,s.createElement)(Xu,{rootClientId:e,onInsert:t,selectedCategory:d,populatedCategories:u})),r&&(0,s.createElement)(Zu,{initialCategory:d,patternCategories:u,onModalClose:()=>l(!1)}))},Ju=window.wp.url;function ed({onHover:e,onInsert:t,rootClientId:n}){const[o,,,r]=yu(n,t),l=(0,s.useMemo)((()=>o.filter((({category:e})=>"reusable"===e))),[o]);return 0===l.length?(0,s.createElement)(Lu,null):(0,s.createElement)(_u,{title:(0,h.__)("Reusable blocks")},(0,s.createElement)(ku,{items:l,onSelect:r,onHover:e,label:(0,h.__)("Reusable blocks")}))}var td=function({rootClientId:e,onInsert:t,onHover:n}){return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(ed,{onHover:n,onInsert:t,rootClientId:e}),(0,s.createElement)("div",{className:"block-editor-inserter__manage-reusable-blocks-container"},(0,s.createElement)("a",{className:"block-editor-inserter__manage-reusable-blocks",href:(0,Ju.addQueryArgs)("edit.php",{post_type:"wp_block"})},(0,h.__)("Manage Reusable blocks"))))};const{Fill:nd,Slot:od}=(0,p.createSlotFill)("__unstableInserterMenuExtension");nd.Slot=od;var rd=nd;const ld=[];var id=function({filterValue:e,onSelect:t,onHover:n,rootClientId:o,clientId:r,isAppender:l,__experimentalInsertionIndex:i,maxBlockPatterns:a,maxBlockTypes:c,showBlockDirectory:m=!1,isDraggable:f=!0,shouldFocusBlock:g=!0}){const v=(0,d.useDebounce)(Pt.speak,500),[b,k]=Au({onSelect:t,rootClientId:o,clientId:r,isAppender:l,insertionIndex:i,shouldFocusBlock:g}),[_,y,E,C]=yu(b,k),[w,,S]=Iu(k,b),B=(0,s.useMemo)((()=>{const t=Wu((0,u.orderBy)(_,["frecency"],["desc"]),y,E,e);return void 0!==c?t.slice(0,c):t}),[e,_,y,E,c]),I=(0,s.useMemo)((()=>{const t=$u(w,e);return void 0!==a?t.slice(0,a):t}),[e,w,a]);(0,s.useEffect)((()=>{if(!e)return;const t=B.length+I.length,n=(0,h.sprintf)(
|
| 20 |
+
/* translators: %d: number of results. */
|
| 21 |
+
(0,h._n)("%d result found.","%d results found.",t),t);v(n)}),[e,v]);const x=(0,d.useAsyncList)(B,{step:9}),T=(0,d.useAsyncList)(x.length===B.length?I:ld),N=!(0,u.isEmpty)(B)||!(0,u.isEmpty)(I);return(0,s.createElement)(Eu,null,!m&&!N&&(0,s.createElement)(Lu,null),!!B.length&&(0,s.createElement)(_u,{title:(0,s.createElement)(p.VisuallyHidden,null,(0,h.__)("Blocks"))},(0,s.createElement)(ku,{items:x,onSelect:C,onHover:n,label:(0,h.__)("Blocks"),isDraggable:f})),!!B.length&&!!I.length&&(0,s.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"}),!!I.length&&(0,s.createElement)(_u,{title:(0,s.createElement)(p.VisuallyHidden,null,(0,h.__)("Block Patterns"))},(0,s.createElement)("div",{className:"block-editor-inserter__quick-inserter-patterns"},(0,s.createElement)(Nu,{shownPatterns:T,blockPatterns:I,onClickPattern:S,isDraggable:f}))),m&&(0,s.createElement)(rd.Slot,{fillProps:{onSelect:C,onHover:n,filterValue:e,hasItems:N,rootClientId:b}},(e=>e.length?e:N?null:(0,s.createElement)(Lu,null))))};const sd={name:"blocks",
|
| 22 |
/* translators: Blocks tab title in the block inserter. */
|
| 23 |
+
title:(0,h.__)("Blocks")},ad={name:"patterns",
|
| 24 |
/* translators: Patterns tab title in the block inserter. */
|
| 25 |
+
title:(0,h.__)("Patterns")},cd={name:"reusable",
|
| 26 |
/* translators: Reusable blocks tab title in the block inserter. */
|
| 27 |
+
title:(0,h.__)("Reusable")};var ud=function({children:e,showPatterns:t=!1,showReusableBlocks:n=!1,onSelect:o}){const r=(0,s.useMemo)((()=>{const e=[sd];return t&&e.push(ad),n&&e.push(cd),e}),[sd,t,ad,n,cd]);return(0,s.createElement)(p.TabPanel,{className:"block-editor-inserter__tabs",tabs:r,onSelect:o},e)},dd=function({rootClientId:e,clientId:t,isAppender:n,__experimentalInsertionIndex:o,onSelect:r,showInserterHelpPanel:l,showMostUsedBlocks:i,__experimentalFilterValue:a="",shouldFocusBlock:c=!0}){const[u,d]=(0,s.useState)(a),[f,g]=(0,s.useState)(null),[v,b]=(0,s.useState)(null),[k,_,y]=Au({rootClientId:e,clientId:t,isAppender:n,insertionIndex:o,shouldFocusBlock:c}),{showPatterns:E,hasReusableBlocks:C}=(0,m.useSelect)((e=>{var t;const{__experimentalGetAllowedPatterns:n,getSettings:o}=e(Vn);return{showPatterns:!!n(k).length,hasReusableBlocks:!(null===(t=o().__experimentalReusableBlocks)||void 0===t||!t.length)}}),[k]),w=(0,s.useCallback)(((e,t,n)=>{_(e,t,n),r()}),[_,r]),S=(0,s.useCallback)(((e,t)=>{_(e,{patternName:t}),r()}),[_,r]),B=(0,s.useCallback)((e=>{y(!!e),g(e)}),[y,g]),I=(0,s.useCallback)((e=>{b(e)}),[b]),x=(0,s.useMemo)((()=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"block-editor-inserter__block-list"},(0,s.createElement)(wu,{rootClientId:k,onInsert:w,onHover:B,showMostUsedBlocks:i})),l&&(0,s.createElement)("div",{className:"block-editor-inserter__tips"},(0,s.createElement)(p.VisuallyHidden,{as:"h2"},(0,h.__)("A tip for using the block editor")),(0,s.createElement)(za,null)))),[k,w,B,u,i,l]),T=(0,s.useMemo)((()=>(0,s.createElement)(Qu,{rootClientId:k,onInsert:S,onClickCategory:I,selectedCategory:v})),[k,S,I,v]),N=(0,s.useMemo)((()=>(0,s.createElement)(td,{rootClientId:k,onInsert:w,onHover:B})),[k,w,B]),P=(0,s.useCallback)((e=>"blocks"===e.name?x:"patterns"===e.name?T:N),[x,T,N]);return(0,s.createElement)("div",{className:"block-editor-inserter__menu"},(0,s.createElement)("div",{className:"block-editor-inserter__main-area"},(0,s.createElement)("div",{className:"block-editor-inserter__content"},(0,s.createElement)(p.SearchControl,{className:"block-editor-inserter__search",onChange:e=>{f&&g(null),d(e)},value:u,label:(0,h.__)("Search for blocks and patterns"),placeholder:(0,h.__)("Search")}),!!u&&(0,s.createElement)(id,{filterValue:u,onSelect:r,onHover:B,rootClientId:e,clientId:t,isAppender:n,__experimentalInsertionIndex:o,showBlockDirectory:!0,shouldFocusBlock:c}),!u&&(E||C)&&(0,s.createElement)(ud,{showPatterns:E,showReusableBlocks:C},P),!u&&!E&&!C&&x)),l&&f&&(0,s.createElement)(cu,{item:f}))};function pd({onSelect:e,rootClientId:t,clientId:n,isAppender:o}){const[r,l]=(0,s.useState)(""),[i,a]=Au({onSelect:e,rootClientId:t,clientId:n,isAppender:o}),[u]=yu(i,a),[d]=Iu(a,i),f=d.length&&!!r,g=f&&d.length>6||u.length>6,{setInserterIsOpened:v,insertionIndex:b}=(0,m.useSelect)((e=>{const{getSettings:o,getBlockIndex:r,getBlockCount:l}=e(Vn),i=r(n,t);return{setInserterIsOpened:o().__experimentalSetIsInserterOpened,insertionIndex:-1===i?l():i}}),[n,t]);return(0,s.useEffect)((()=>{v&&v(!1)}),[v]),(0,s.createElement)("div",{className:c()("block-editor-inserter__quick-inserter",{"has-search":g,"has-expand":v})},g&&(0,s.createElement)(p.SearchControl,{className:"block-editor-inserter__search",value:r,onChange:e=>{l(e)},label:(0,h.__)("Search for blocks and patterns"),placeholder:(0,h.__)("Search")}),(0,s.createElement)("div",{className:"block-editor-inserter__quick-inserter-results"},(0,s.createElement)(id,{filterValue:r,onSelect:e,rootClientId:t,clientId:n,isAppender:o,maxBlockPatterns:f?2:0,maxBlockTypes:6,isDraggable:!1})),v&&(0,s.createElement)(p.Button,{className:"block-editor-inserter__quick-inserter-expand",onClick:()=>{v({rootClientId:t,insertionIndex:b,filterValue:r})},"aria-label":(0,h.__)("Browse all. This will open the main inserter panel in the editor toolbar.")},(0,h.__)("Browse all")))}const md=({onToggle:e,disabled:t,isOpen:n,blockTitle:o,hasSingleBlockType:r,toggleProps:l={}})=>{let a;a=r?(0,h.sprintf)(// translators: %s: the name of the block when there is only one
|
| 28 |
+
(0,h._x)("Add %s","directly add the only allowed block"),o):(0,h._x)("Add block","Generic label for block inserter button");const{onClick:c,...u}=l;return(0,s.createElement)(p.Button,i({icon:Oa,label:a,tooltipPosition:"bottom",onClick:function(t){e&&e(t),c&&c(t)},className:"block-editor-inserter__toggle","aria-haspopup":!r&&"true","aria-expanded":!r&&n,disabled:t},u))};class fd extends s.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=md}=this.props;return a({onToggle:e,isOpen:t,disabled:n||!s,blockTitle:o,hasSingleBlockType:r,directInsertBlock:l,toggleProps:i})}renderContent({onClose:e}){const{rootClientId:t,clientId:n,isAppender:o,showInserterHelpPanel:r,__experimentalIsQuick:l}=this.props;return l?(0,s.createElement)(pd,{onSelect:()=>{e()},rootClientId:t,clientId:n,isAppender:o}):(0,s.createElement)(dd,{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||null!=n&&n.length?this.renderToggle({onToggle:o}):(0,s.createElement)(p.Dropdown,{className:"block-editor-inserter",contentClassName:c()("block-editor-inserter__popover",{"is-quick":r}),position:e,onToggle:this.onToggle,expandOnMobile:!0,headerTitle:(0,h.__)("Add a block"),renderToggle:this.renderToggle,renderContent:this.renderContent,onClose:l})}}var hd=(0,d.compose)([(0,m.withSelect)(((e,{clientId:t,rootClientId:n})=>{const{getBlockRootClientId:o,hasInserterItems:l,__experimentalGetAllowedBlocks:i,__experimentalGetDirectInsertBlock:s}=e(Vn),{getBlockVariations:a}=e(r.store),c=i(n=n||o(t)||void 0),d=s(n),p=1===(0,u.size)(c)&&0===(0,u.size)(a(c[0].name,"inserter"));let m=!1;return p&&(m=c[0]),{hasItems:l(n),hasSingleBlockType:p,blockTitle:m?m.title:"",allowedBlockType:m,directInsertBlock:d,rootClientId:n}})),(0,m.withDispatch)(((e,t,{select:n})=>({insertOnlyAllowedBlock(){const{rootClientId:o,clientId:l,isAppender:i,hasSingleBlockType:s,allowedBlockType:a,directInsertBlock:c,onSelectOrClose:u}=t;if(!(s||null!=c&&c.length))return;const{insertBlock:d}=e(Vn);d(null!=c&&c.length?(0,r.createBlock)(...c):(0,r.createBlock)(a.name),function(){const{getBlockIndex:e,getBlockSelectionEnd:t,getBlockOrder:r,getBlockRootClientId:s}=n(Vn);if(l)return e(l,o);const a=t();return!i&&a&&s(a)===o?e(a,o)+1:r(o).length}(),o),u&&u();const p=(0,h.sprintf)(// translators: %s: the name of the block that has been added
|
| 29 |
+
(0,h.__)("%s block added"),a.title);(0,Pt.speak)(p)}}))),(0,d.ifCondition)((({hasItems:e,isAppender:t,rootClientId:n,clientId:o})=>e||!t&&!n&&!o))])(fd),gd=(0,d.compose)((0,m.withSelect)(((e,t)=>{const{getBlockCount:n,getBlockName:o,isBlockValid:l,getSettings:i,getTemplateLock:s}=e(Vn),a=!n(t.rootClientId),c=o(t.lastBlockClientId)===(0,r.getDefaultBlockName)(),u=l(t.lastBlockClientId),{bodyPlaceholder:d}=i();return{isVisible:a||!c||!u,showPrompt:a,isLocked:!!s(t.rootClientId),placeholder:d}})),(0,m.withDispatch)(((e,t)=>{const{insertDefaultBlock:n,startTyping:o}=e(Vn);return{onAppend(){const{rootClientId:e}=t;n(void 0,e),o()}}})))((function({isLocked:e,isVisible:t,onAppend:n,showPrompt:o,placeholder:r,rootClientId:l}){if(e||!t)return null;const i=(0,Da.decodeEntities)(r)||(0,h.__)("Type / to choose a block");return(0,s.createElement)("div",{"data-root-client-id":l||"",className:c()("block-editor-default-block-appender",{"has-visible-prompt":o})},(0,s.createElement)("p",{tabIndex:"0",contentEditable:!0,suppressContentEditableWarning:!0,role:"button","aria-label":(0,h.__)("Add block"),className:"block-editor-default-block-appender__content",onFocus:n},o?i:"\ufeff"),(0,s.createElement)(hd,{rootClientId:l,position:"bottom right",isAppender:!0,__experimentalIsQuick:!0}))}));function vd({rootClientId:e,className:t,onFocus:n,tabIndex:o},r){return(0,s.createElement)(hd,{position:"bottom center",rootClientId:e,__experimentalIsQuick:!0,renderToggle:({onToggle:e,disabled:l,isOpen:i,blockTitle:a,hasSingleBlockType:u})=>{let d;d=u?(0,h.sprintf)(// translators: %s: the name of the block when there is only one
|
| 30 |
+
(0,h._x)("Add %s","directly add the only allowed block"),a):(0,h._x)("Add block","Generic label for block inserter button");const m=!u;let f=(0,s.createElement)(p.Button,{ref:r,onFocus:n,tabIndex:o,className:c()(t,"block-editor-button-block-appender"),onClick:e,"aria-haspopup":m?"true":void 0,"aria-expanded":m?i:void 0,disabled:l,label:d},!u&&(0,s.createElement)(p.VisuallyHidden,{as:"span"},d),(0,s.createElement)(So,{icon:Oa}));return(m||u)&&(f=(0,s.createElement)(p.Tooltip,{text:d},f)),f},isAppender:!0})}const bd=(0,s.forwardRef)(((e,t)=>(Lt()("wp.blockEditor.ButtonBlockerAppender",{alternative:"wp.blockEditor.ButtonBlockAppender"}),vd(e,t))));var kd=(0,s.forwardRef)(vd),_d=(0,m.withSelect)(((e,{rootClientId:t})=>{const{getBlockOrder:n,canInsertBlockType:o,getTemplateLock:l,getSelectedBlockClientId:i}=e(Vn);return{isLocked:!!l(t),blockClientIds:n(t),canInsertDefaultBlock:o((0,r.getDefaultBlockName)(),t),selectedBlockClientId:i()}}))((function({blockClientIds:e,rootClientId:t,canInsertDefaultBlock:n,isLocked:o,renderAppender:r,className:l,selectedBlockClientId:i,tagName:a="div"}){if(o||!1===r)return null;let d;if(r)d=(0,s.createElement)(r,null);else{const o=!t,r=i===t,l=i&&!e.includes(i);if(!o&&!r&&(!i||l))return null;d=n?(0,s.createElement)(gd,{rootClientId:t,lastBlockClientId:(0,u.last)(e)}):(0,s.createElement)(kd,{rootClientId:t,className:"block-list-appender__toggle"})}return(0,s.createElement)(a,{tabIndex:-1,className:c()("block-list-appender wp-block",l),"data-block":!0},d)}));function yd(e){return(0,d.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])}const Ed=(0,s.createContext)();function Cd({__unstablePopoverSlot:e,__unstableContentRef:t}){const{selectBlock:n}=(0,m.useDispatch)(Vn),o=(0,s.useContext)(Ed),r=(0,s.useRef)(),{orientation:l,previousClientId:i,nextClientId:a,rootClientId:u,isInserterShown:f}=(0,m.useSelect)((e=>{var t;const{getBlockOrder:n,getBlockListSettings:o,getBlockInsertionPoint:r,isBlockBeingDragged:l,getPreviousBlockClientId:i,getNextBlockClientId:s}=e(Vn),a=r(),c=n(a.rootClientId);if(!c.length)return{};let u=c[a.index-1],d=c[a.index];for(;l(u);)u=i(u);for(;l(d);)d=s(d);return{previousClientId:u,nextClientId:d,orientation:(null===(t=o(a.rootClientId))||void 0===t?void 0:t.orientation)||"vertical",rootClientId:a.rootClientId,isInserterShown:null==a?void 0:a.__unstableWithInserter}}),[]),g=Ba(i),v=Ba(a),b="vertical"===l,k=(0,s.useMemo)((()=>{if(!g&&!v)return{};const e=g?g.getBoundingClientRect():null,t=v?v.getBoundingClientRect():null;if(b)return{width:g?g.offsetWidth:v.offsetWidth,height:t&&e?t.top-e.bottom:0};let n=0;return e&&t&&(n=(0,h.isRTL)()?e.left-t.right:t.left-e.right),{width:n,height:g?g.offsetHeight:v.offsetHeight}}),[g,v]),_=(0,s.useCallback)((()=>{if(!g&&!v)return{};const{ownerDocument:e}=g||v,t=g?g.getBoundingClientRect():null,n=v?v.getBoundingClientRect():null;return b?(0,h.isRTL)()?{top:t?t.bottom:n.top,left:t?t.right:n.right,right:t?t.left:n.left,bottom:n?n.top:t.bottom,ownerDocument:e}:{top:t?t.bottom:n.top,left:t?t.left:n.left,right:t?t.right:n.right,bottom:n?n.top:t.bottom,ownerDocument:e}:(0,h.isRTL)()?{top:t?t.top:n.top,left:t?t.left:n.right,right:n?n.right:t.left,bottom:t?t.bottom:n.bottom,ownerDocument:e}:{top:t?t.top:n.top,left:t?t.right:n.left,right:n?n.left:t.right,bottom:t?t.bottom:n.bottom,ownerDocument:e}}),[g,v]),y=yd(t),E=(0,d.useReducedMotion)(),C=c()("block-editor-block-list__insertion-point","is-"+l),w=g&&v&&f,S={start:{...b?{height:0,left:"50%",right:"50%",y:0}:{width:0,top:"50%",bottom:"50%",x:0},opacity:0},rest:{...b?{height:4,left:0,right:0,y:-2}:{width:4,top:0,bottom:0,x:-2},opacity:1,borderRadius:"2px",transition:{delay:w?.4:0}},hover:{...b?{height:4,left:0,right:0,y:-2}:{width:4,top:0,bottom:0,x:-2},opacity:1,borderRadius:"2px",transition:{delay:.4}}},B={start:{scale:E?1:0},rest:{scale:1,transition:{delay:.2}}};return(0,s.createElement)(p.Popover,{ref:y,noArrow:!0,animate:!1,getAnchorRect:_,focusOnMount:!1,className:"block-editor-block-list__insertion-point-popover",__unstableSlotName:e||null,key:a+"--"+u},(0,s.createElement)(p.__unstableMotion.div,{layout:!E,initial:E?"rest":"start",animate:"rest",whileHover:"hover",whileTap:"pressed",exit:"start",ref:r,tabIndex:-1,onClick:function(e){e.target===r.current&&a&&n(a,-1)},onFocus:function(e){e.target!==r.current&&(o.current=!0)},className:c()(C,{"is-with-inserter":w}),style:k},(0,s.createElement)(p.__unstableMotion.div,{variants:S,className:"block-editor-block-list__insertion-point-indicator"}),w&&(0,s.createElement)(p.__unstableMotion.div,{variants:B,className:c()("block-editor-block-list__insertion-point-inserter")},(0,s.createElement)(hd,{position:"bottom center",clientId:a,rootClientId:u,__experimentalIsQuick:!0,onToggle:e=>{o.current=e},onSelectOrClose:()=>{o.current=!1}}))))}function wd({children:e,__unstablePopoverSlot:t,__unstableContentRef:n}){const o=(0,m.useSelect)((e=>e(Vn).isBlockInsertionPointVisible()),[]);return(0,s.createElement)(Ed.Provider,{value:(0,s.useRef)(!1)},o&&(0,s.createElement)(Cd,{__unstablePopoverSlot:t,__unstableContentRef:n}),e)}function Sd(){const e=(0,s.useContext)(Ed),t=(0,m.useSelect)((e=>e(Vn).getSettings().hasReducedUI),[]),{getBlockListSettings:n,getBlockRootClientId:o,getBlockIndex:r,isBlockInsertionPointVisible:l,isMultiSelecting:i,getSelectedBlockClientIds:a,getTemplateLock:c}=(0,m.useSelect)(Vn),{showInsertionPoint:u,hideInsertionPoint:p}=(0,m.useDispatch)(Vn);return(0,d.useRefEffect)((o=>{if(!t)return o.addEventListener("mousemove",s),()=>{o.removeEventListener("mousemove",s)};function s(t){var o,s;if(e.current)return;if(i())return;if(!t.target.classList.contains("block-editor-block-list__layout"))return void(l()&&p());let d;if(t.target.classList.contains("is-root-container")||(d=(t.target.getAttribute("data-block")?t.target:t.target.closest("[data-block]")).getAttribute("data-block")),c(d))return;const m=(null===(o=n(d))||void 0===o?void 0:o.orientation)||"vertical",f=t.target.getBoundingClientRect(),h=t.clientY-f.top,g=t.clientX-f.left;let v=Array.from(t.target.children).find((e=>e.classList.contains("wp-block")&&"vertical"===m&&e.offsetTop>h||e.classList.contains("wp-block")&&"horizontal"===m&&e.offsetLeft>g));if(!v)return;if(!v.id&&(v=v.firstElementChild,!v))return;if(null===(s=v.parentElement)||void 0===s?void 0:s.closest(".block-editor-block-content-overlay.overlay-active"))return;const b=v.id.slice("block-".length);if(!b)return;if(a().includes(b))return;const k=v.getBoundingClientRect();if("horizontal"===m&&(t.clientY>k.bottom||t.clientY<k.top)||"vertical"===m&&(t.clientX>k.right||t.clientX<k.left))return void(l()&&p());const _=r(b,d);0!==_?u(d,_,{__unstableWithInserter:!0}):l()&&p()}}),[e,n,o,r,l,i,u,p,a])}const Bd="undefined"==typeof window?e=>{setTimeout((()=>e(Date.now())),0)}:window.requestIdleCallback||window.requestAnimationFrame,Id="undefined"==typeof window?clearTimeout:window.cancelIdleCallback||window.cancelAnimationFrame;function xd(e){return(0,m.useSelect)((t=>{if(!e)return null;const{getBlockName:n,getBlockAttributes:o}=t(Vn),{getBlockType:l,getActiveBlockVariation:i}=t(r.store),s=n(e),a=l(s);if(!a)return null;const c=o(e),u=i(s,c),d={title:a.title,icon:a.icon,description:a.description,anchor:null==c?void 0:c.anchor};return u?{title:u.title||a.title,icon:u.icon||a.icon,description:u.description||a.description}:d}),[e])}function Td({clientId:e}){const{attributes:t,name:n,reusableBlockTitle:o}=(0,m.useSelect)((t=>{if(!e)return{};const{getBlockName:n,getBlockAttributes:o,__experimentalGetReusableBlockTitle:l}=t(Vn),i=n(e);if(!i)return{};const s=(0,r.isReusableBlock)((0,r.getBlockType)(i));return{attributes:o(e),name:i,reusableBlockTitle:s&&l(o(e).ref)}}),[e]),l=xd(e);if(!n||!l)return null;const i=(0,r.getBlockType)(n),s=i?(0,r.__experimentalGetBlockLabel)(i,t):null,a=o||s;return a&&a!==i.title?(0,u.truncate)(a,{length:35}):l.title}var Nd=({children:e,clientIds:t,cloneClassname:n,onDragStart:o,onDragEnd:l})=>{const{srcRootClientId:i,isDraggable:a,icon:c}=(0,m.useSelect)((e=>{var n;const{getBlockRootClientId:o,getTemplateLock:l,getBlockName:i}=e(Vn),s=o(t[0]),a=s?l(s):null,c=i(t[0]);return{srcRootClientId:s,isDraggable:"all"!==a,icon:null===(n=(0,r.getBlockType)(c))||void 0===n?void 0:n.icon}}),[t]),u=(0,s.useRef)(!1),[d,f,h]=function(){const e=(0,s.useRef)(null),t=(0,s.useRef)(null),n=(0,s.useRef)(null),o=(0,s.useRef)(null);return(0,s.useEffect)((()=>()=>{o.current&&(clearInterval(o.current),o.current=null)}),[]),[(0,s.useCallback)((r=>{e.current=r.clientY,n.current=(0,or.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,s.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)/e;t.current=25*n}else if(o.clientY<l){const e=Math.max(l-50,0),n=Math.max(l-i-50,0)/e;t.current=-25*n}else t.current=0}),[]),()=>{e.current=null,n.current=null,o.current&&(clearInterval(o.current),o.current=null)}]}(),{startDraggingBlocks:g,stopDraggingBlocks:v}=(0,m.useDispatch)(Vn);if((0,s.useEffect)((()=>()=>{u.current&&v()}),[]),!a)return e({isDraggable:!1});const b={type:"block",srcClientIds:t,srcRootClientId:i};return(0,s.createElement)(p.Draggable,{cloneClassname:n,__experimentalTransferDataType:"wp-blocks",transferData:b,onDragStart:e=>{g(t),u.current=!0,d(e),o&&o()},onDragOver:f,onDragEnd:()=>{v(),u.current=!1,h(),l&&l()},__experimentalDragComponent:(0,s.createElement)(mu,{count:t.length,icon:c})},(({onDraggableStart:t,onDraggableEnd:n})=>e({draggable:!0,onDragStart:t,onDragEnd:n})))},Pd=function({clientId:e,rootClientId:t,blockElement:n}){const o=xd(e),l=(0,m.useSelect)((n=>{var o;const{getBlock:r,getBlockIndex:l,hasBlockMovingClientId:i,getBlockListSettings:s}=n(Vn),a=l(e,t),{name:c,attributes:u}=r(e);return{index:a,name:c,attributes:u,blockMovingMode:i(),orientation:null===(o=s(t))||void 0===o?void 0:o.orientation}}),[e,t]),{index:a,name:u,attributes:d,blockMovingMode:f,orientation:g}=l,{setNavigationMode:v,removeBlock:b}=(0,m.useDispatch)(Vn),k=(0,s.useRef)(),_=(0,r.getBlockType)(u),y=(0,r.__experimentalGetAccessibleBlockLabel)(_,d,a+1,g);(0,s.useEffect)((()=>{k.current.focus(),(0,Pt.speak)(y)}),[y]);const{hasBlockMovingClientId:E,getBlockIndex:C,getBlockRootClientId:w,getClientIdsOfDescendants:S,getSelectedBlockClientId:B,getMultiSelectedBlocksEndClientId:I,getPreviousBlockClientId:x,getNextBlockClientId:T}=(0,m.useSelect)(Vn),{selectBlock:N,clearSelectedBlock:P,setBlockMovingClientId:M,moveBlockToPosition:R}=(0,m.useDispatch)(Vn),L=c()("block-editor-block-list__block-selection-button",{"is-block-moving-mode":!!f}),A=(0,h.__)("Drag");return(0,s.createElement)("div",{className:L},(0,s.createElement)(p.Flex,{justify:"center",className:"block-editor-block-list__block-selection-button__content"},(0,s.createElement)(p.FlexItem,null,(0,s.createElement)(Ha,{icon:null==o?void 0:o.icon,showColors:!0})),(0,s.createElement)(p.FlexItem,null,(0,s.createElement)(Nd,{clientIds:[e]},(e=>(0,s.createElement)(p.Button,i({icon:pu,className:"block-selection-button_drag-handle","aria-hidden":"true",label:A,tabIndex:"-1"},e))))),(0,s.createElement)(p.FlexItem,null,(0,s.createElement)(p.Button,{ref:k,onClick:()=>v(!1),onKeyDown:function(t){const{keyCode:o}=t,r=o===ga.UP,l=o===ga.DOWN,i=o===ga.LEFT,s=o===ga.RIGHT,a=o===ga.TAB,c=o===ga.ESCAPE,u=o===ga.ENTER,d=o===ga.SPACE,p=t.shiftKey;if(o===ga.BACKSPACE||o===ga.DELETE)return b(e),void t.preventDefault();const m=B(),f=I(),h=x(f||m),g=T(f||m),v=a&&p||r,k=a&&!p||l,_=i,y=s;let L;if(v)L=h;else if(k)L=g;else if(_){var A;L=null!==(A=w(m))&&void 0!==A?A:m}else if(y){var D;L=null!==(D=S([m])[0])&&void 0!==D?D:m}const O=E();if(c&&O&&!t.defaultPrevented&&(M(null),t.preventDefault()),(u||d)&&O){const e=w(O),t=w(m),n=C(O,e);let o=C(m,t);n<o&&e===t&&(o-=1),R(O,e,t,o),N(O),M(null)}if(k||v||_||y)if(L)t.preventDefault(),N(L);else if(a&&m){let e;k?(e=or.focus.tabbable.findNext(n),e||(e=n.ownerDocument.defaultView.frameElement,e=or.focus.tabbable.findNext(e))):e=or.focus.tabbable.findPrevious(n),e&&(t.preventDefault(),e.focus(),P())}},label:y,className:"block-selection-button_select-button"},(0,s.createElement)(Td,{clientId:e})))))};function Md(e){return Array.from(e.querySelectorAll("[data-toolbar-item]"))}var Rd=function({children:e,focusOnMount:t,__experimentalInitialIndex:n,__experimentalOnIndexChange:o,...r}){const l=(0,s.useRef)(),a=function(e){const[t,n]=(0,s.useState)(!0),o=(0,s.useCallback)((()=>{const t=!or.focus.tabbable.find(e.current).some((e=>!("toolbarItem"in e.dataset)));t||Lt()("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)}),[]);return(0,s.useLayoutEffect)((()=>{const t=new window.MutationObserver(o);return t.observe(e.current,{childList:!0,subtree:!0}),()=>t.disconnect()}),[t]),t}(l);return function(e,t,n,o,r){const[l]=(0,s.useState)(t),[i]=(0,s.useState)(o),a=(0,s.useCallback)((()=>{!function(e){const[t]=or.focus.tabbable.find(e);t&&t.focus()}(e.current)}),[]);(0,ec.useShortcut)("core/block-editor/focus-toolbar",a),(0,s.useEffect)((()=>{l&&a()}),[n,l,a]),(0,s.useEffect)((()=>{let t=0;return i&&!l&&(t=window.requestAnimationFrame((()=>{const t=Md(e.current),n=i||0;var o;t[n]&&(o=e.current).contains(o.ownerDocument.activeElement)&&t[n].focus()}))),()=>{if(window.cancelAnimationFrame(t),!r||!e.current)return;const n=Md(e.current).findIndex((e=>0===e.tabIndex));r(n)}}),[i,l])}(l,t,a,n,o),a?(0,s.createElement)(p.Toolbar,i({label:r["aria-label"],ref:l},r),e):(0,s.createElement)(p.NavigableMenu,i({orientation:"horizontal",role:"toolbar",ref:l},r),e)},Ld=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})),Ad=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})),Dd=(0,s.createElement)(F.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(F.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),Od=(0,s.createElement)(F.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(F.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));const Fd=(e,t)=>"up"===e?"horizontal"===t?(0,h.isRTL)()?Ld:Ad:Dd:"down"===e?"horizontal"===t?(0,h.isRTL)()?Ad:Ld:Od:null,zd=(e,t)=>"up"===e?"horizontal"===t?(0,h.isRTL)()?(0,h.__)("Move right"):(0,h.__)("Move left"):(0,h.__)("Move up"):"down"===e?"horizontal"===t?(0,h.isRTL)()?(0,h.__)("Move left"):(0,h.__)("Move right"):(0,h.__)("Move down"):null,Vd=(0,s.forwardRef)((({clientIds:e,direction:t,orientation:n,...o},l)=>{const a=(0,d.useInstanceId)(Vd),f=(0,u.castArray)(e).length,{blockType:g,isDisabled:v,rootClientId:b,isFirst:k,isLast:_,firstIndex:y,orientation:E="vertical"}=(0,m.useSelect)((o=>{const{getBlockIndex:l,getBlockRootClientId:i,getBlockOrder:s,getBlock:a,getBlockListSettings:c}=o(Vn),d=(0,u.castArray)(e),p=(0,u.first)(d),m=i(p),f=l(p,m),h=l((0,u.last)(d),m),g=s(m),v=a(p),b=0===f,k=h===g.length-1,{orientation:_}=c(m)||{};return{blockType:v?(0,r.getBlockType)(v.name):null,isDisabled:"up"===t?b:k,rootClientId:m,firstIndex:f,isFirst:b,isLast:k,orientation:n||_}}),[e,t]),{moveBlocksDown:C,moveBlocksUp:w}=(0,m.useDispatch)(Vn),S="up"===t?w:C,B=`block-editor-block-mover-button__description-${a}`;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.Button,i({ref:l,className:c()("block-editor-block-mover-button",`is-${t}-button`),icon:Fd(t,E),label:zd(t,E),"aria-describedby":B},o,{onClick:v?null:t=>{S(e,b),o.onClick&&o.onClick(t)},"aria-disabled":v})),(0,s.createElement)("span",{id:B,className:"block-editor-block-mover-button__description"},function(e,t,n,o,r,l,i){const s=n+1,a=e=>"up"===e?"horizontal"===i?(0,h.isRTL)()?"right":"left":"up":"down"===e?"horizontal"===i?(0,h.isRTL)()?"left":"right":"down":null;if(e>1)return function(e,t,n,o,r){const l=t+1;return r<0&&n?(0,h.__)("Blocks cannot be moved up as they are already at the top"):r>0&&o?(0,h.__)("Blocks cannot be moved down as they are already at the bottom"):r<0&&!n?(0,h.sprintf)(// translators: 1: Number of selected blocks, 2: Position of selected blocks
|
| 31 |
+
(0,h._n)("Move %1$d block from position %2$d up by one place","Move %1$d blocks from position %2$d up by one place",e),e,l):r>0&&!o?(0,h.sprintf)(// translators: 1: Number of selected blocks, 2: Position of selected blocks
|
| 32 |
+
(0,h._n)("Move %1$d block from position %2$d down by one place","Move %1$d blocks from position %2$d down by one place",e),e,l):void 0}(e,n,o,r,l);if(o&&r)return(0,h.sprintf)(// translators: %s: Type of block (i.e. Text, Image etc)
|
| 33 |
+
(0,h.__)("Block %s is the only block, and cannot be moved"),t);if(l>0&&!r){const e=a("down");if("down"===e)return(0,h.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
|
| 34 |
+
(0,h.__)("Move %1$s block from position %2$d down to position %3$d"),t,s,s+1);if("left"===e)return(0,h.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
|
| 35 |
+
(0,h.__)("Move %1$s block from position %2$d left to position %3$d"),t,s,s+1);if("right"===e)return(0,h.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
|
| 36 |
+
(0,h.__)("Move %1$s block from position %2$d right to position %3$d"),t,s,s+1)}if(l>0&&r){const e=a("down");if("down"===e)return(0,h.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc)
|
| 37 |
+
(0,h.__)("Block %1$s is at the end of the content and can’t be moved down"),t);if("left"===e)return(0,h.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc)
|
| 38 |
+
(0,h.__)("Block %1$s is at the end of the content and can’t be moved left"),t);if("right"===e)return(0,h.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc)
|
| 39 |
+
(0,h.__)("Block %1$s is at the end of the content and can’t be moved right"),t)}if(l<0&&!o){const e=a("up");if("up"===e)return(0,h.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
|
| 40 |
+
(0,h.__)("Move %1$s block from position %2$d up to position %3$d"),t,s,s-1);if("left"===e)return(0,h.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
|
| 41 |
+
(0,h.__)("Move %1$s block from position %2$d left to position %3$d"),t,s,s-1);if("right"===e)return(0,h.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
|
| 42 |
+
(0,h.__)("Move %1$s block from position %2$d right to position %3$d"),t,s,s-1)}if(l<0&&o){const e=a("up");if("up"===e)return(0,h.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc)
|
| 43 |
+
(0,h.__)("Block %1$s is at the beginning of the content and can’t be moved up"),t);if("left"===e)return(0,h.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc)
|
| 44 |
+
(0,h.__)("Block %1$s is at the beginning of the content and can’t be moved left"),t);if("right"===e)return(0,h.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc)
|
| 45 |
+
(0,h.__)("Block %1$s is at the beginning of the content and can’t be moved right"),t)}}(f,g&&g.title,y,k,_,"up"===t?-1:1,E)))})),Hd=(0,s.forwardRef)(((e,t)=>(0,s.createElement)(Vd,i({direction:"up",ref:t},e)))),Ud=(0,s.forwardRef)(((e,t)=>(0,s.createElement)(Vd,i({direction:"down",ref:t},e))));var Gd=(0,m.withSelect)(((e,{clientIds:t})=>{var n;const{getBlock:o,getBlockIndex:l,getBlockListSettings:i,canMoveBlocks:s,getBlockOrder:a,getBlockRootClientId:c}=e(Vn),d=(0,u.castArray)(t),p=(0,u.first)(d),m=o(p),f=c((0,u.first)(d)),h=l(p,f),g=0===h,v=l((0,u.last)(d),f)===a(f).length-1;return{blockType:m?(0,r.getBlockType)(m.name):null,canMove:s(t,f),rootClientId:f,firstIndex:h,isFirst:g,isLast:v,orientation:null===(n=i(f))||void 0===n?void 0:n.orientation}}))((function({isFirst:e,isLast:t,clientIds:n,canMove:o,isHidden:r,rootClientId:l,orientation:a,hideDragHandle:u}){const[d,m]=(0,s.useState)(!1),f=()=>m(!0),g=()=>m(!1);if(!o||e&&t&&!l)return null;const v=(0,h.__)("Drag");return(0,s.createElement)("div",{className:c()("block-editor-block-mover",{"is-visible":d||!r,"is-horizontal":"horizontal"===a})},!u&&(0,s.createElement)(Nd,{clientIds:n,cloneClassname:"block-editor-block-mover__drag-clone"},(e=>(0,s.createElement)(p.Button,i({icon:pu,className:"block-editor-block-mover__drag-handle","aria-hidden":"true",label:v,tabIndex:"-1"},e)))),(0,s.createElement)(p.ToolbarGroup,{className:"block-editor-block-mover__move-button-container"},(0,s.createElement)(p.ToolbarItem,{onFocus:f,onBlur:g},(e=>(0,s.createElement)(Hd,i({clientIds:n},e)))),(0,s.createElement)(p.ToolbarItem,{onFocus:f,onBlur:g},(e=>(0,s.createElement)(Ud,i({clientIds:n},e))))))}));const{clearTimeout:Wd,setTimeout:$d}=window;function jd({ref:e,isFocused:t,debounceTimeout:n=200,onChange:o=u.noop}){const[r,l]=(0,s.useState)(!1),i=(0,s.useRef)(),a=t=>{null!=e&&e.current&&l(t),o(t)},c=()=>{const e=i.current;e&&Wd&&Wd(e)};return(0,s.useEffect)((()=>()=>c()),[]),{showMovers:r,debouncedShowMovers:e=>{e&&e.stopPropagation(),c(),r||a(!0)},debouncedHideMovers:o=>{o&&o.stopPropagation(),c(),i.current=$d((()=>{(()=>{const n=(null==e?void 0:e.current)&&e.current.matches(":hover");return!t&&!n})()&&a(!1)}),n)}}}function Kd({ref:e,debounceTimeout:t=200,onChange:n=u.noop}){const[o,r]=(0,s.useState)(!1),{showMovers:l,debouncedShowMovers:i,debouncedHideMovers:a}=jd({ref:e,debounceTimeout:t,isFocused:o,onChange:n}),c=(0,s.useRef)(!1),d=()=>(null==e?void 0:e.current)&&e.current.contains(e.current.ownerDocument.activeElement);return(0,s.useEffect)((()=>{const t=e.current,n=()=>{d()&&(r(!0),i())},o=()=>{d()||(r(!1),a())};return t&&!c.current&&(t.addEventListener("focus",n,!0),t.addEventListener("blur",o,!0),c.current=!0),()=>{t&&(t.removeEventListener("focus",n),t.removeEventListener("blur",o))}}),[e,c,r,i,a]),{showMovers:l,gestures:{onMouseMove:i,onMouseLeave:a}}}function qd(){const{selectBlock:e,toggleBlockHighlight:t}=(0,m.useDispatch)(Vn),{firstParentClientId:n,shouldHide:o,hasReducedUI:l}=(0,m.useSelect)((e=>{const{getBlockName:t,getBlockParents:n,getSelectedBlockClientId:o,getSettings:l}=e(Vn),{hasBlockSupport:i}=e(r.store),s=n(o()),a=s[s.length-1],c=t(a),u=(0,r.getBlockType)(c),d=l();return{firstParentClientId:a,shouldHide:!i(u,"__experimentalParentSelector",!0),hasReducedUI:d.hasReducedUI}}),[]),a=xd(n),c=(0,s.useRef)(),{gestures:u}=Kd({ref:c,onChange(e){e&&l||t(n,e)}});return o||void 0===n?null:(0,s.createElement)("div",i({className:"block-editor-block-parent-selector",key:n,ref:c},u),(0,s.createElement)(p.ToolbarButton,{className:"block-editor-block-parent-selector__button",onClick:()=>e(n),label:(0,h.sprintf)(
|
| 46 |
/* translators: %s: Name of the block's parent. */
|
| 47 |
+
(0,h.__)("Select %s"),a.title),showTooltip:!0,icon:(0,s.createElement)(Ha,{icon:a.icon})}))}var Yd=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M20.2 8v11c0 .7-.6 1.2-1.2 1.2H6v1.5h13c1.5 0 2.7-1.2 2.7-2.8V8zM18 16.4V4.6c0-.9-.7-1.6-1.6-1.6H4.6C3.7 3 3 3.7 3 4.6v11.8c0 .9.7 1.6 1.6 1.6h11.8c.9 0 1.6-.7 1.6-1.6zm-13.5 0V4.6c0-.1.1-.1.1-.1h11.8c.1 0 .1.1.1.1v11.8c0 .1-.1.1-.1.1H4.6l-.1-.1z"}));function Zd({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)(p.Popover,{className:"block-editor-block-switcher__preview__popover",position:"bottom right",focusOnMount:!1},(0,s.createElement)("div",{className:"block-editor-block-switcher__preview"},(0,s.createElement)("div",{className:"block-editor-block-switcher__preview-title"},(0,h.__)("Preview")),(0,s.createElement)(au,{viewportWidth:500,blocks:e})))))}var Xd=({className:e,possibleBlockTransformations:t,onSelect:n,blocks:o})=>{const[l,i]=(0,s.useState)();return(0,s.createElement)(p.MenuGroup,{label:(0,h.__)("Transform to"),className:e},l&&(0,s.createElement)(Zd,{blocks:(0,r.switchToBlockType)(o,l)}),t.map((e=>{const{name:t,icon:o,title:l,isDisabled:a}=e;return(0,s.createElement)(p.MenuItem,{key:t,className:(0,r.getBlockMenuDefaultClassName)(t),onClick:e=>{e.preventDefault(),n(t)},disabled:a,onMouseLeave:()=>i(null),onMouseEnter:()=>i(t)},(0,s.createElement)(Ha,{icon:o,showColors:!0}),l)})))},Qd=window.wp.tokenList,Jd=n.n(Qd);const ep={};function tp({genericPreviewBlock:e,viewportWidth:t,style:n,isActive:o,onBlur:r,onHover:l,onSelect:i,styleClassName:a,itemRole:u}){const d=(0,s.useMemo)((()=>({...e,attributes:{...e.attributes,className:a}})),[e,a]);return(0,s.createElement)("div",{key:n.name,className:c()("block-editor-block-styles__item",{"is-active":o}),onClick:()=>i(),onKeyDown:e=>{ga.ENTER!==e.keyCode&&ga.SPACE!==e.keyCode||(e.preventDefault(),i())},onMouseEnter:l,onMouseLeave:r,role:u||"button",tabIndex:"0","aria-label":n.label||n.name},(0,s.createElement)("div",{className:"block-editor-block-styles__item-preview"},(0,s.createElement)(au,{viewportWidth:t,blocks:d})),(0,s.createElement)("div",{className:"block-editor-block-styles__item-label"},n.label||n.name))}var np=function({clientId:e,onSwitch:t=u.noop,onHoverClassName:n=u.noop,itemRole:o}){const{styles:l,block:i,type:a,className:c}=(0,m.useSelect)((t=>{const{getBlock:n}=t(Vn),o=n(e);if(!o)return ep;const l=(0,r.getBlockType)(o.name),{getBlockStyles:i}=t(r.store);return{block:o,type:l,styles:i(o.name),className:o.attributes.className||""}}),[e]),{updateBlockAttributes:d}=(0,m.useDispatch)(Vn),p=function(e,t){return(0,s.useMemo)((()=>{const n=null==t?void 0:t.example,o=null==t?void 0:t.name;return n&&o?(0,r.getBlockFromExample)(o,{attributes:n.attributes,innerBlocks:n.innerBlocks}):e?(0,r.cloneBlock)(e):void 0}),[null!=t&&t.example?null==e?void 0:e.name:e,t])}(i,a);if(!l||0===l.length)return null;const f=(0,u.find)(l,"isDefault")?l:[{name:"default",label:(0,h._x)("Default","block style"),isDefault:!0},...l],g=function(e,t){for(const n of new(Jd())(t).values()){if(-1===n.indexOf("is-style-"))continue;const t=n.substring(9),o=(0,u.find)(e,{name:t});if(o)return o}return(0,u.find)(e,"isDefault")}(f,c);return(0,s.createElement)("div",{className:"block-editor-block-styles"},f.map((r=>{var l,i;const u=function(e,t,n){const o=new(Jd())(e);return t&&o.remove("is-style-"+t.name),o.add("is-style-"+n.name),o.value}(c,g,r);return(0,s.createElement)(tp,{genericPreviewBlock:p,viewportWidth:null!==(l=null===(i=a.example)||void 0===i?void 0:i.viewportWidth)&&void 0!==l?l:500,className:c,isActive:g===r,key:r.name,onSelect:()=>{d(e,{className:u}),n(null),t()},onBlur:()=>n(null),onHover:()=>n(u),style:r,styleClassName:u,itemRole:o})})))};function op({hoveredBlock:e,onSwitch:t}){const{name:n,clientId:o}=e,[l,i]=(0,s.useState)(),a=(0,m.useSelect)((e=>e(r.store).getBlockType(n)),[n]);return(0,s.createElement)(p.MenuGroup,{label:(0,h.__)("Styles"),className:"block-editor-block-switcher__styles__menugroup"},l&&(0,s.createElement)(Zd,{blocks:a&&a.example?(0,r.getBlockFromExample)(a.name,{attributes:{...a.example.attributes,className:l},innerBlocks:a.example.innerBlocks}):(0,r.cloneBlock)(e,{className:l})}),(0,s.createElement)(np,{clientId:o,onSwitch:t,onHoverClassName:i,itemRole:"menuitem"}))}const rp=(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=rp(e,t,n);if(o)return o}}},lp=(e,t)=>{const n=((e,t)=>{const n=(0,r.__experimentalGetBlockAttributesNamesByRole)(e,"content");return null!=n&&n.length?n.reduce(((e,n)=>(t[n]&&(e[n]=t[n]),e)),{}):t})(t.name,t.attributes);e.attributes={...e.attributes,...n}};function ip({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)(p.Popover,{className:"block-editor-block-switcher__preview__popover",position:"bottom right"},(0,s.createElement)("div",{className:"block-editor-block-switcher__preview"},(0,s.createElement)("div",{className:"block-editor-block-switcher__preview-title"},(0,h.__)("Preview")),(0,s.createElement)(sp,{patterns:e,onSelect:t})))))}function sp({patterns:e,onSelect:t}){const n=(0,p.__unstableUseCompositeState)();return(0,s.createElement)(p.__unstableComposite,i({},n,{role:"listbox",className:"block-editor-block-switcher__preview-patterns-container","aria-label":(0,h.__)("Patterns list")}),e.map((e=>(0,s.createElement)(ap,{key:e.name,pattern:e,onSelect:t,composite:n}))))}function ap({pattern:e,onSelect:t,composite:n}){const o="block-editor-block-switcher__preview-patterns-container",r=(0,d.useInstanceId)(ap,`${o}-list__item-description`);return(0,s.createElement)("div",{className:`${o}-list__list-item`,"aria-label":e.title,"aria-describedby":e.description?r:void 0},(0,s.createElement)(p.__unstableCompositeItem,i({role:"option",as:"div"},n,{className:`${o}-list__item`,onClick:()=>t(e.transformedBlocks)}),(0,s.createElement)(au,{blocks:e.transformedBlocks,viewportWidth:e.viewportWidth||500}),(0,s.createElement)("div",{className:`${o}-list__item-title`},e.title)),!!e.description&&(0,s.createElement)(p.VisuallyHidden,{id:r},e.description))}var cp=function({blocks:e,patterns:t,onSelect:n}){const[o,l]=(0,s.useState)(!1),i=((e,t)=>(0,s.useMemo)((()=>e.reduce(((e,n)=>{const o=((e,t)=>{const n=t.map((e=>(0,r.cloneBlock)(e))),o=new Set;for(const t of e){let e=!1;for(const r of n){const n=rp(r,t.name,o);if(n){e=!0,o.add(n.clientId),lp(n,t);break}}if(!e)return}return n})(t,n.blocks);return o&&e.push({...n,transformedBlocks:o}),e}),[])),[e,t]))(t,e);return i.length?(0,s.createElement)(p.MenuGroup,{className:"block-editor-block-switcher__pattern__transforms__menugroup"},o&&(0,s.createElement)(ip,{patterns:i,onSelect:n}),(0,s.createElement)(p.MenuItem,{onClick:e=>{e.preventDefault(),l(!o)},icon:Ld},(0,h.__)("Patterns"))):null};const up=({clientIds:e,blocks:t})=>{const{replaceBlocks:n}=(0,m.useDispatch)(Vn),o=xd(t[0].clientId),{possibleBlockTransformations:l,canRemove:i,hasBlockStyles:a,icon:c,blockTitle:d,patterns:f}=(0,m.useSelect)((n=>{var l;const{getBlockRootClientId:i,getBlockTransformItems:s,__experimentalGetPatternTransformItems:a}=n(Vn),{getBlockStyles:c,getBlockType:d}=n(r.store),{canRemoveBlocks:p}=n(Vn),m=i((0,u.castArray)(e)[0]),[{name:f}]=t,h=1===t.length,g=h&&c(f);let v;var b;h?v=null==o?void 0:o.icon:v=1===(0,u.uniq)(t.map((({name:e})=>e))).length?null===(b=d(f))||void 0===b?void 0:b.icon:Yd;return{possibleBlockTransformations:s(t,m),canRemove:p(e,m),hasBlockStyles:!(null==g||!g.length),icon:v,blockTitle:null===(l=d(f))||void 0===l?void 0:l.title,patterns:a(t,m)}}),[e,t,null==o?void 0:o.icon]),g=1===t.length&&(0,r.isReusableBlock)(t[0]),v=1===t.length&&(0,r.isTemplatePart)(t[0]),b=!!l.length&&i,k=!(null==f||!f.length)&&i;if(!a&&!b)return(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(p.ToolbarButton,{disabled:!0,className:"block-editor-block-switcher__no-switcher-icon",title:d,icon:(0,s.createElement)(Ha,{icon:c,showColors:!0})}));const _=d,y=1===t.length?(0,h.sprintf)(
|
| 48 |
/* translators: %s: block title. */
|
| 49 |
+
(0,h.__)("%s: Change block type or style"),d):(0,h.sprintf)(
|
| 50 |
/* translators: %d: number of blocks. */
|
| 51 |
+
(0,h._n)("Change type of %d block","Change type of %d blocks",t.length),t.length),E=a||b||k;return(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(p.ToolbarItem,null,(o=>(0,s.createElement)(p.DropdownMenu,{className:"block-editor-block-switcher",label:_,popoverProps:{position:"bottom right",isAlternate:!0,className:"block-editor-block-switcher__popover"},icon:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Ha,{icon:c,className:"block-editor-block-switcher__toggle",showColors:!0}),(g||v)&&(0,s.createElement)("span",{className:"block-editor-block-switcher__toggle-text"},(0,s.createElement)(Td,{clientId:e}))),toggleProps:{describedBy:y,...o},menuProps:{orientation:"both"}},(({onClose:o})=>E&&(0,s.createElement)("div",{className:"block-editor-block-switcher__container"},k&&(0,s.createElement)(cp,{blocks:t,patterns:f,onSelect:t=>{(t=>{n(e,t)})(t),o()}}),b&&(0,s.createElement)(Xd,{className:"block-editor-block-switcher__transforms__menugroup",possibleBlockTransformations:l,blocks:t,onSelect:l=>{(o=>{n(e,(0,r.switchToBlockType)(t,o))})(l),o()}}),a&&(0,s.createElement)(op,{hoveredBlock:t[0],onSwitch:o})))))))};var dp=({clientIds:e})=>{const t=(0,m.useSelect)((t=>t(Vn).getBlocksByClientId(e)),[e]);return!t.length||t.some((e=>!e))?null:(0,s.createElement)(up,{clientIds:e,blocks:t})},pp=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})),mp=window.wp.blob;function fp(){const{getBlockName:e}=(0,m.useSelect)(Vn),{getBlockType:t}=(0,m.useSelect)(r.store),{createSuccessNotice:n}=(0,m.useDispatch)(Bu.store);return(0,s.useCallback)(((o,r)=>{let l="";if(1===r.length){var i;const n=r[0],s=null===(i=t(e(n)))||void 0===i?void 0:i.title;l="copy"===o?(0,h.sprintf)(// Translators: Name of the block being copied, e.g. "Paragraph".
|
| 52 |
+
(0,h.__)('Copied "%s" to clipboard.'),s):(0,h.sprintf)(// Translators: Name of the block being cut, e.g. "Paragraph".
|
| 53 |
+
(0,h.__)('Moved "%s" to clipboard.'),s)}else l="copy"===o?(0,h.sprintf)(// Translators: %d: Number of blocks being copied.
|
| 54 |
+
(0,h._n)("Copied %d block to clipboard.","Copied %d blocks to clipboard.",r.length),r.length):(0,h.sprintf)(// Translators: %d: Number of blocks being cut.
|
| 55 |
+
(0,h._n)("Moved %d block to clipboard.","Moved %d blocks to clipboard.",r.length),r.length);n(l,{type:"snackbar"})}),[])}function hp(){const{getBlocksByClientId:e,getSelectedBlockClientIds:t,hasMultiSelection:n,getSettings:o}=(0,m.useSelect)(Vn),{flashBlock:l,removeBlocks:i,replaceBlocks:s}=(0,m.useDispatch)(Vn),a=fp();return(0,d.useRefEffect)((c=>{function u(u){const d=t();if(0===d.length)return;if(!n()){const{target:e}=u,{ownerDocument:t}=e;if("copy"===u.type||"cut"===u.type?(0,or.documentHasUncollapsedSelection)(t):(0,or.documentHasSelection)(t))return}if(!c.contains(u.target.ownerDocument.activeElement))return;const p=u.defaultPrevented;if(u.preventDefault(),"copy"===u.type||"cut"===u.type){1===d.length&&l(d[0]),a(u.type,d);const t=e(d),n=(0,r.serialize)(t);u.clipboardData.setData("text/plain",n),u.clipboardData.setData("text/html",n)}if("cut"===u.type)i(d);else if("paste"===u.type){if(p)return;const{__experimentalCanUserUseUnfilteredHTML:e}=o(),{plainText:t,html:n}=function({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}}const o=(0,or.getFilesFromDataTransfer)(e).filter((({type:e})=>/^image\/(?:jpe?g|png|gif)$/.test(e)));return o.length&&!n&&(n=o.map((e=>`<img src="${(0,mp.createBlobURL)(e)}">`)).join(""),t=""),{html:n,plainText:t}}(u),l=(0,r.pasteHandler)({HTML:n,plainText:t,mode:"BLOCKS",canUserUseUnfilteredHTML:e});s(d,l,l.length-1,-1)}}return c.ownerDocument.addEventListener("copy",u),c.ownerDocument.addEventListener("cut",u),c.ownerDocument.addEventListener("paste",u),()=>{c.ownerDocument.removeEventListener("copy",u),c.ownerDocument.removeEventListener("cut",u),c.ownerDocument.removeEventListener("paste",u)}}),[])}var gp=function({children:e}){return(0,s.createElement)("div",{ref:hp()},e)};function vp({clientIds:e,children:t,__experimentalUpdateSelection:n}){const{canInsertBlockType:o,getBlockRootClientId:l,getBlocksByClientId:i,canMoveBlocks:s,canRemoveBlocks:a}=(0,m.useSelect)(Vn),{getDefaultBlockName:c,getGroupingBlockName:d}=(0,m.useSelect)(r.store),p=i(e),f=l(e[0]),h=(0,u.every)(p,(e=>!!e&&(0,r.hasBlockSupport)(e.name,"multiple",!0)&&o(e.name,f))),g=o(c(),f),v=s(e,f),b=a(e,f),{removeBlocks:k,replaceBlocks:_,duplicateBlocks:y,insertAfterBlock:E,insertBeforeBlock:C,flashBlock:w,setBlockMovingClientId:S,setNavigationMode:B,selectBlock:I}=(0,m.useDispatch)(Vn),x=fp();return t({canDuplicate:h,canInsertDefaultBlock:g,canMove:v,canRemove:b,rootClientId:f,blocks:p,onDuplicate:()=>y(e,n),onRemove:()=>k(e,n),onInsertBefore(){C((0,u.first)((0,u.castArray)(e)))},onInsertAfter(){E((0,u.last)((0,u.castArray)(e)))},onMoveTo(){B(!0),I(e[0]),S(e[0])},onGroup(){if(!p.length)return;const t=d(),n=(0,r.switchToBlockType)(p,t);n&&_(e,n)},onUngroup(){if(!p.length)return;const t=p[0].innerBlocks;t.length&&_(e,t)},onCopy(){const e=p.map((({clientId:e})=>e));1===p.length&&w(e[0]),x("copy",e)}})}var bp=(0,d.compose)([(0,m.withSelect)(((e,{clientId:t})=>{const{getBlock:n,getBlockMode:o,getSettings:l}=e(Vn),i=n(t),s=l().codeEditingEnabled;return{mode:o(t),blockType:i?(0,r.getBlockType)(i.name):null,isCodeEditingEnabled:s}})),(0,m.withDispatch)(((e,{onToggle:t=u.noop,clientId:n})=>({onToggleMode(){e(Vn).toggleBlockMode(n),t()}})))])((function({blockType:e,mode:t,onToggleMode:n,small:o=!1,isCodeEditingEnabled:l=!0}){if(!(0,r.hasBlockSupport)(e,"html",!0)||!l)return null;const i="visual"===t?(0,h.__)("Edit as HTML"):(0,h.__)("Edit visually");return(0,s.createElement)(p.MenuItem,{onClick:n},!o&&i)})),kp=(0,d.compose)((0,m.withSelect)(((e,{clientId:t})=>{const n=e(Vn).getBlock(t);return{block:n,shouldRender:n&&"core/html"===n.name}})),(0,m.withDispatch)(((e,{block:t})=>({onClick:()=>e(Vn).replaceBlocks(t.clientId,(0,r.rawHandler)({HTML:(0,r.getBlockContent)(t)}))}))))((function({shouldRender:e,onClick:t,small:n}){if(!e)return null;const o=(0,h.__)("Convert to Blocks");return(0,s.createElement)(p.MenuItem,{onClick:t},!n&&o)}));const{Fill:_p,Slot:yp}=(0,p.createSlotFill)("__unstableBlockSettingsMenuFirstItem");_p.Slot=yp;var Ep=_p;function Cp({clientIds:e,isGroupable:t,isUngroupable:n,blocksSelection:o,groupingBlockName:l,onClose:i=(()=>{})}){const{replaceBlocks:a}=(0,m.useDispatch)(Vn);return t||n?(0,s.createElement)(s.Fragment,null,t&&(0,s.createElement)(p.MenuItem,{onClick:()=>{(()=>{const t=(0,r.switchToBlockType)(o,l);t&&a(e,t)})(),i()}},(0,h._x)("Group","verb")),n&&(0,s.createElement)(p.MenuItem,{onClick:()=>{(()=>{const t=o[0].innerBlocks;t.length&&a(e,t)})(),i()}},(0,h._x)("Ungroup","Ungrouping blocks from within a Group block back into individual blocks within the Editor "))):null}const{Fill:wp,Slot:Sp}=(0,p.createSlotFill)("BlockSettingsMenuControls");function Bp({...e}){return(0,s.createElement)(p.__experimentalStyleProvider,{document:document},(0,s.createElement)(wp,e))}Bp.Slot=({fillProps:e,clientIds:t=null})=>{const{selectedBlocks:n,selectedClientIds:o}=(0,m.useSelect)((e=>{const{getBlocksByClientId:n,getSelectedBlockClientIds:o}=e(Vn),r=null!==t?t:o();return{selectedBlocks:(0,u.map)((0,u.compact)(n(r)),(e=>e.name)),selectedClientIds:r}}),[t]),l=function(){const{clientIds:e,isGroupable:t,isUngroupable:n,blocksSelection:o,groupingBlockName:l}=(0,m.useSelect)((e=>{var t;const{getBlockRootClientId:n,getBlocksByClientId:o,canInsertBlockType:l,getSelectedBlockClientIds:i}=e(Vn),{getGroupingBlockName:s}=e(r.store),a=i(),c=s(),u=l(c,null!=a&&a.length?n(a[0]):void 0),d=o(a),p=1===d.length&&(null===(t=d[0])||void 0===t?void 0:t.name)===c;return{clientIds:a,isGroupable:u&&d.length&&!p,isUngroupable:p&&!!d[0].innerBlocks.length,blocksSelection:d,groupingBlockName:c}}),[]);return{clientIds:e,isGroupable:t,isUngroupable:n,blocksSelection:o,groupingBlockName:l}}(),{isGroupable:a,isUngroupable:c}=l,d=a||c;return(0,s.createElement)(Sp,{fillProps:{...e,selectedBlocks:n,selectedClientIds:o}},(t=>{if((null==t?void 0:t.length)>0||d)return(0,s.createElement)(p.MenuGroup,null,t,(0,s.createElement)(Cp,i({},l,{onClose:null==e?void 0:e.onClose})))}))};var Ip=Bp;const xp={className:"block-editor-block-settings-menu__popover",position:"bottom right",isAlternate:!0};function Tp({blocks:e,onCopy:t}){const n=(0,d.useCopyToClipboard)((()=>(0,r.serialize)(e)),t);return(0,s.createElement)(p.MenuItem,{ref:n},(0,h.__)("Copy"))}var Np=function({clientIds:e,__experimentalSelectBlock:t,children:n,...o}){const l=(0,u.castArray)(e),a=l.length,c=l[0],{onlyBlock:d,title:f}=(0,m.useSelect)((e=>{var t;const{getBlockCount:n,getBlockName:o}=e(Vn),{getBlockType:l}=e(r.store);return{onlyBlock:1===n(),title:null===(t=l(o(c)))||void 0===t?void 0:t.title}}),[c]),g=(0,m.useSelect)((e=>{const{getShortcutRepresentation:t}=e(ec.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")}}),[]),v=(0,s.useCallback)(t?async e=>{const n=await e;n&&n[0]&&t(n[0])}:u.noop,[t]),b=(0,h.sprintf)(
|
| 56 |
+
/* translators: %s: block name */
|
| 57 |
+
(0,h.__)("Remove %s"),f),k=1===a?b:(0,h.__)("Remove blocks");return(0,s.createElement)(vp,{clientIds:e,__experimentalUpdateSelection:!t},(({canDuplicate:t,canInsertDefaultBlock:r,canMove:l,canRemove:m,onDuplicate:f,onInsertAfter:b,onInsertBefore:_,onRemove:y,onCopy:E,onMoveTo:C,blocks:w})=>(0,s.createElement)(p.DropdownMenu,i({icon:pp,label:(0,h.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:xp,noIcons:!0},o),(({onClose:o})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.MenuGroup,null,(0,s.createElement)(Ep.Slot,{fillProps:{onClose:o}}),1===a&&(0,s.createElement)(kp,{clientId:c}),(0,s.createElement)(Tp,{blocks:w,onCopy:E}),t&&(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,f,v),shortcut:g.duplicate},(0,h.__)("Duplicate")),r&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,_),shortcut:g.insertBefore},(0,h.__)("Insert before")),(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,b),shortcut:g.insertAfter},(0,h.__)("Insert after"))),l&&!d&&(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,C)},(0,h.__)("Move to")),1===a&&(0,s.createElement)(bp,{clientId:c,onToggle:o})),(0,s.createElement)(Ip.Slot,{fillProps:{onClose:o},clientIds:e}),"function"==typeof n?n({onClose:o}):s.Children.map((e=>(0,s.cloneElement)(e,{onClose:o}))),m&&(0,s.createElement)(p.MenuGroup,null,(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,y,v),shortcut:g.remove},k)))))))},Pp=function({clientIds:e,...t}){return(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(p.ToolbarItem,null,(n=>(0,s.createElement)(Np,i({clientIds:e,toggleProps:n},t)))))};function Mp({hideDragHandle:e}){const{blockClientIds:t,blockClientId:n,blockType:o,hasFixedToolbar:l,hasReducedUI:a,isValid:u,isVisual:f}=(0,m.useSelect)((e=>{const{getBlockName:t,getBlockMode:n,getSelectedBlockClientIds:o,isBlockValid:l,getBlockRootClientId:i,getSettings:s}=e(Vn),a=o(),c=a[0],u=i(c),d=s();return{blockClientIds:a,blockClientId:c,blockType:c&&(0,r.getBlockType)(t(c)),hasFixedToolbar:d.hasFixedToolbar,hasReducedUI:d.hasReducedUI,rootClientId:u,isValid:a.every((e=>l(e))),isVisual:a.every((e=>"visual"===n(e)))}}),[]),{toggleBlockHighlight:h}=(0,m.useDispatch)(Vn),g=(0,s.useRef)(),{showMovers:v,gestures:b}=Kd({ref:g,onChange(e){e&&a||h(n,e)}}),k=(0,d.useViewportMatch)("medium","<")||l;if(o&&!(0,r.hasBlockSupport)(o,"__experimentalToolbar",!0))return null;const _=k||v;if(0===t.length)return null;const y=u&&f,E=t.length>1,C=c()("block-editor-block-toolbar",_&&"is-showing-movers");return(0,s.createElement)("div",{className:C},!E&&!k&&(0,s.createElement)(qd,{clientIds:t}),(0,s.createElement)("div",i({ref:g},b),(y||E)&&(0,s.createElement)(p.ToolbarGroup,{className:"block-editor-block-toolbar__block-controls"},(0,s.createElement)(dp,{clientIds:t}),(0,s.createElement)(Gd,{clientIds:t,hideDragHandle:e||a}))),y&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Zn.Slot,{group:"parent",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(Zn.Slot,{group:"block",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(Zn.Slot,{className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(Zn.Slot,{group:"inline",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(Zn.Slot,{group:"other",className:"block-editor-block-toolbar__slot"})),(0,s.createElement)(Pp,{clientIds:t}))}var Rp=function({focusOnMount:e,isFixed:t,...n}){const{blockType:o,hasParents:l,showParentSelector:a}=(0,m.useSelect)((e=>{const{getBlockName:t,getBlockParents:n,getSelectedBlockClientIds:o}=e(Vn),{getBlockType:l}=e(r.store),i=o(),s=i[0],a=n(s),c=l(t(a[a.length-1]));return{blockType:s&&l(t(s)),hasParents:a.length,showParentSelector:(0,r.hasBlockSupport)(c,"__experimentalParentSelector",!0)&&i.length<=1}}),[]);if(o&&!(0,r.hasBlockSupport)(o,"__experimentalToolbar",!0))return null;const u=c()("block-editor-block-contextual-toolbar",{"has-parent":l&&a,"is-fixed":t});return(0,s.createElement)(Rd,i({focusOnMount:e,className:u
|
| 58 |
+
/* translators: accessibility text for the block toolbar */,"aria-label":(0,h.__)("Block tools")},n),(0,s.createElement)(Mp,{hideDragHandle:t}))};function Lp(e){const{isNavigationMode:t,isMultiSelecting:n,hasMultiSelection:o,isTyping:r,isCaretWithinFormattedText:l,getSettings:i,getLastMultiSelectedBlockClientId:s}=e(Vn);return{isNavigationMode:t(),isMultiSelecting:n(),isTyping:r(),isCaretWithinFormattedText:l(),hasMultiSelection:o(),hasFixedToolbar:i().hasFixedToolbar,lastClientId:s()}}function Ap({clientId:e,rootClientId:t,isValid:n,isEmptyDefaultBlock:o,capturingClientId:r,__unstablePopoverSlot:l,__unstableContentRef:i}){const{isNavigationMode:a,isMultiSelecting:u,isTyping:f,isCaretWithinFormattedText:h,hasMultiSelection:g,hasFixedToolbar:v,lastClientId:b}=(0,m.useSelect)(Lp,[]),k=(0,m.useSelect)((t=>{const{isBlockInsertionPointVisible:n,getBlockInsertionPoint:o,getBlockOrder:r}=t(Vn);if(!n())return!1;const l=o();return r(l.rootClientId)[l.index]===e}),[e]),_=(0,d.useViewportMatch)("medium"),[y,E]=(0,s.useState)(!1),[C,w]=(0,s.useState)(!1),{stopTyping:S}=(0,m.useDispatch)(Vn),B=!f&&!a&&o&&n,I=a,x=!a&&!v&&_&&!B&&!u&&(!f||h),T=!(a||x||v||o);(0,ec.useShortcut)("core/block-editor/focus-toolbar",(()=>{E(!0),S(!0)}),{isDisabled:!T}),(0,s.useEffect)((()=>{x||E(!1)}),[x]);const N=(0,s.useRef)(),P=Ba(e),M=Ba(b),R=Ba(r),L=yd(i);if(!(I||x||y||B))return null;let A=P;if(!A)return null;r&&(A=R);let D=A;if(g){if(!M)return null;D={top:A,bottom:M}}const O=B?"top left right":"top right left",{ownerDocument:F}=A,z=B?void 0:F.defaultView.frameElement||(0,or.getScrollContainer)(A)||F.body;return(0,s.createElement)(p.Popover,{ref:L,noArrow:!0,animate:!1,position:O,focusOnMount:!1,anchorRef:D,className:c()("block-editor-block-list__block-popover",{"is-insertion-point-visible":k}),__unstableStickyBoundaryElement:z,__unstableSlotName:l||null,__unstableBoundaryParent:!0,__unstableObserveElement:A,shouldAnchorIncludePadding:!0,__unstableEditorCanvasWrapper:null==i?void 0:i.current},(x||y)&&(0,s.createElement)("div",{onFocus:function(){w(!0)},onBlur:function(){w(!1)},tabIndex:-1,className:c()("block-editor-block-list__block-popover-inserter",{"is-visible":C})},(0,s.createElement)(hd,{clientId:e,rootClientId:t,__experimentalIsQuick:!0})),(x||y)&&(0,s.createElement)(Rp,{focusOnMount:y,__experimentalInitialIndex:N.current,__experimentalOnIndexChange:e=>{N.current=e},key:e}),I&&(0,s.createElement)(Pd,{clientId:e,rootClientId:t,blockElement:A}),B&&(0,s.createElement)("div",{className:"block-editor-block-list__empty-block-inserter"},(0,s.createElement)(hd,{position:"bottom right",rootClientId:t,clientId:e,__experimentalIsQuick:!0})))}function Dp(e){const{getSelectedBlockClientId:t,getFirstMultiSelectedBlockClientId:n,getBlockRootClientId:o,getBlock:l,getBlockParents:i,__experimentalGetBlockListSettingsForBlocks:s}=e(Vn),a=t()||n();if(!a)return;const{name:c,attributes:d={},isValid:p}=l(a)||{},m=i(a),f=s(m),h=(0,u.find)(m,(e=>{var t;return null===(t=f[e])||void 0===t?void 0:t.__experimentalCaptureToolbars}));return{clientId:a,rootClientId:o(a),name:c,isValid:p,isEmptyDefaultBlock:c&&(0,r.isUnmodifiedDefaultBlock)({name:c,attributes:d}),capturingClientId:h}}function Op({__unstablePopoverSlot:e,__unstableContentRef:t}){const n=(0,m.useSelect)(Dp,[]);if(!n)return null;const{clientId:o,rootClientId:r,name:l,isValid:i,isEmptyDefaultBlock:a,capturingClientId:c}=n;return l?(0,s.createElement)(Ap,{clientId:o,rootClientId:r,isValid:i,isEmptyDefaultBlock:a,capturingClientId:c,__unstablePopoverSlot:e,__unstableContentRef:t}):null}function Fp({children:e}){const t=(0,s.useContext)(Ed),n=(0,s.useContext)(p.Disabled.Context);return t||n?e:(Lt()('wp.components.Popover.Slot name="block-toolbar"',{alternative:"wp.blockEditor.BlockTools"}),(0,s.createElement)(wd,{__unstablePopoverSlot:"block-toolbar"},(0,s.createElement)(Op,{__unstablePopoverSlot:"block-toolbar"}),e))}var zp=(0,d.createHigherOrderComponent)((e=>t=>{const{clientId:n}=Wn();return(0,s.createElement)(e,i({},t,{clientId:n}))}),"withClientId"),Vp=zp((({clientId:e,showSeparator:t,isFloating:n,onAddBlock:o,isToggle:r})=>(0,s.createElement)(kd,{className:c()({"block-list-appender__toggle":r}),rootClientId:e,showSeparator:t,isFloating:n,onAddBlock:o}))),Hp=(0,d.compose)([zp,(0,m.withSelect)(((e,{clientId:t})=>{const{getBlockOrder:n}=e(Vn),o=n(t);return{lastBlockClientId:(0,u.last)(o)}}))])((({clientId:e,lastBlockClientId:t})=>(0,s.createElement)(gd,{rootClientId:e,lastBlockClientId:t}))),Up=window.wp.isShallowEqual,Gp=n.n(Up);const Wp=new WeakMap;function $p(e,t){const n=(0,m.useSelect)((e=>e(Vn).getSettings().mediaUpload),[]),{canInsertBlockType:o,getBlockIndex:l,getClientIdsOfDescendants:i}=(0,m.useSelect)(Vn),{insertBlocks:s,moveBlocksToPosition:a,updateBlockAttributes:c,clearSelectedBlock:u}=(0,m.useDispatch)(Vn),d=function(e,t,n,o,l,i,s){return a=>{const{srcRootClientId:c,srcClientIds:u,type:d,blocks:p}=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}(a);if("inserter"===d){s();const n=p.map((e=>(0,r.cloneBlock)(e)));i(n,t,e,!0,null)}if("block"===d){const r=n(u[0],c);if(c===e&&r===t)return;if(u.includes(e)||o(u).some((t=>t===e)))return;const i=c===e,s=u.length;l(u,c,e,i&&r<t?t-s:t)}}}(e,t,l,i,a,s,u),p=function(e,t,n,o,l,i){return s=>{if(!n)return;const a=(0,r.findTransform)((0,r.getBlockTransforms)("from"),(t=>"files"===t.type&&l(t.blockName,e)&&t.isMatch(s)));if(a){const n=a.transform(s,o);i(n,t,e)}}}(e,t,n,c,o,s),f=function(e,t,n){return o=>{const l=(0,r.pasteHandler)({HTML:o,mode:"BLOCKS"});l.length&&n(l,t,e)}}(e,t,s);return e=>{const t=(0,or.getFilesFromDataTransfer)(e.dataTransfer),n=e.dataTransfer.getData("text/html");t.length?p(t):n?f(n):d(e)}}function jp(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 Kp({rootClientId:e=""}={}){const[t,n]=(0,s.useState)(null),o=(0,m.useSelect)((t=>{const{getTemplateLock:n}=t(Vn);return"all"===n(e)}),[e]),{getBlockListSettings:r}=(0,m.useSelect)(Vn),{showInsertionPoint:l,hideInsertionPoint:i}=(0,m.useDispatch)(Vn),a=$p(e,t),c=(0,d.useThrottle)((0,s.useCallback)(((t,o)=>{var i;const s=function(e,t,n){const o="horizontal"===n?["left","right"]:["top","bottom"],r=(0,h.isRTL)();let l,i;return e.forEach(((e,n)=>{const s=e.getBoundingClientRect(),[a,c]=jp(t,s,o);(void 0===i||a<i)&&(i=a,l=n+("bottom"===c||!r&&"right"===c||r&&"left"===c?1:0))})),l}(Array.from(o.children).filter((e=>e.classList.contains("wp-block"))),{x:t.clientX,y:t.clientY},null===(i=r(e))||void 0===i?void 0:i.orientation);n(void 0===s?0:s),null!==s&&l(e,s)}),[]),200);return(0,d.__experimentalUseDropZone)({isDisabled:o,onDrop:a,onDragOver(e){c(e,e.currentTarget)},onDragLeave(){c.cancel(),i(),n(null)},onDragEnd(){c.cancel(),i(),n(null)}})}function qp(e){const{clientId:t,allowedBlocks:n,__experimentalDefaultBlock:o,__experimentalDirectInsert:l,template:i,templateLock:a,wrapperRef:c,templateInsertUpdatesSelection:d,__experimentalCaptureToolbars:p,__experimentalAppenderTagName:f,renderAppender:h,orientation:g,placeholder:v,__experimentalLayout:b}=e;!function(e,t,n,o,r,l,i,a){const{updateBlockListSettings:c}=(0,m.useDispatch)(Vn),{blockListSettings:u,parentLock:d}=(0,m.useSelect)((t=>{const n=t(Vn).getBlockRootClientId(e);return{blockListSettings:t(Vn).getBlockListSettings(e),parentLock:t(Vn).getTemplateLock(n)}}),[e]),p=(0,s.useMemo)((()=>t),t);(0,s.useLayoutEffect)((()=>{const t={allowedBlocks:p,templateLock:void 0===r?d:r};if(void 0!==l&&(t.__experimentalCaptureToolbars=l),void 0!==i)t.orientation=i;else{const e=Io(null==a?void 0:a.type);t.orientation=e.getOrientation(a)}void 0!==n&&(t.__experimentalDefaultBlock=n),void 0!==o&&(t.__experimentalDirectInsert=o),Gp()(u,t)||c(e,t)}),[e,u,p,n,o,r,d,l,i,c,a])}(t,n,o,l,a,p,g,b),function(e,t,n,o){const{getSelectedBlocksInitialCaretPosition:l}=(0,m.useSelect)(Vn),{replaceInnerBlocks:i}=(0,m.useDispatch)(Vn),a=(0,m.useSelect)((t=>t(Vn).getBlocks(e)),[e]),c=(0,s.useRef)(null);(0,s.useLayoutEffect)((()=>{if((0===a.length||"all"===n)&&!(0,u.isEqual)(t,c.current)){c.current=t;const n=(0,r.synchronizeBlocksWithTemplate)(a,t);(0,u.isEqual)(n,a)||i(e,n,0===a.length&&o&&0!==n.length,l())}}),[a,t,n,e])}(t,i,a,d);const k=(0,m.useSelect)((e=>{const n=e(Vn).getBlock(t),o=(0,r.getBlockType)(n.name);if(o&&o.providesContext)return function(e,t){Wp.has(t)||Wp.set(t,new WeakMap);const n=Wp.get(t);if(!n.has(e)){const o=(0,u.mapValues)(t.providesContext,(t=>e[t]));n.set(e,o)}return n.get(e)}(n.attributes,o)}),[t]);return(0,s.createElement)(lr,{value:k},(0,s.createElement)(rm,{rootClientId:t,renderAppender:h,__experimentalAppenderTagName:f,__experimentalLayout:b,wrapperRef:c,placeholder:v}))}function Yp(e){return Ga(e),(0,s.createElement)(qp,e)}const Zp=(0,s.forwardRef)(((e,t)=>{const n=Xp({ref:t},e);return(0,s.createElement)("div",{className:"block-editor-inner-blocks"},(0,s.createElement)("div",n))}));function Xp(e={},t={}){const{clientId:n}=Wn(),o=(0,d.useViewportMatch)("medium","<"),{__experimentalCaptureToolbars:l,hasOverlay:a}=(0,m.useSelect)((e=>{if(!n)return{};const{getBlockName:t,isBlockSelected:l,hasSelectedInnerBlock:i,isNavigationMode:s}=e(Vn),a=t(n),c=s()||o;return{__experimentalCaptureToolbars:e(r.store).hasBlockSupport(a,"__experimentalExposeControlsToChildren",!1),hasOverlay:"core/template"!==a&&!l(n)&&!i(n,!0)&&c}}),[n,o]),u=(0,d.useMergeRefs)([e.ref,Kp({rootClientId:n})]),p={__experimentalCaptureToolbars:l,...t},f=p.value&&p.onChange?Yp:qp;return{...e,ref:u,className:c()(e.className,"block-editor-block-list__layout",{"has-overlay":a}),children:n?(0,s.createElement)(f,i({},p,{clientId:n})):(0,s.createElement)(rm,t)}}Xp.save=r.__unstableGetInnerBlocksProps,Zp.DefaultBlockAppender=Hp,Zp.ButtonBlockAppender=Vp,Zp.Content=()=>Xp.save().children;var Qp=Zp;const Jp=(0,s.createContext)(),em=(0,s.createContext)();function tm({className:e,...t}){const[n,o]=(0,s.useState)(),r=(0,d.useViewportMatch)("medium"),{isOutlineMode:l,isFocusMode:i,isNavigationMode:a}=(0,m.useSelect)((e=>{const{getSettings:t,isNavigationMode:n}=e(Vn),{outlineMode:o,focusMode:r}=t();return{isOutlineMode:o,isFocusMode:r,isNavigationMode:n()}}),[]),u=Xp({ref:(0,d.useMergeRefs)([ja(),Sd(),o]),className:c()("is-root-container",e,{"is-outline-mode":l,"is-focus-mode":i&&r,"is-navigate-mode":a})},t);return(0,s.createElement)(Jp.Provider,{value:n},(0,s.createElement)("div",u))}function nm(e){return function(){const e=(0,m.useSelect)((e=>e(Vn).getSettings().__experimentalBlockPatterns),[]);(0,s.useEffect)((()=>{if(null==e||!e.length)return;let t,n=-1;const o=()=>{n++,n>=e.length||((0,m.select)(Vn).__experimentalGetParsedPattern(e[n].name),t=Bd(o))};return t=Bd(o),()=>Id(t)}),[e])}(),(0,s.createElement)(Fp,null,(0,s.createElement)(Gn,{value:Hn},(0,s.createElement)(tm,e)))}function om({placeholder:e,rootClientId:t,renderAppender:n,__experimentalAppenderTagName:o,__experimentalLayout:r=xo}){const[l,i]=(0,s.useState)(new Set),a=(0,s.useMemo)((()=>{const{IntersectionObserver:e}=window;if(e)return new e((e=>{i((t=>{const n=new Set(t);for(const t of e){const e=t.target.getAttribute("data-block");n[t.isIntersecting?"add":"delete"](e)}return n}))}))}),[i]),{order:c,selectedBlocks:u}=(0,m.useSelect)((e=>{const{getBlockOrder:n,getSelectedBlockClientIds:o}=e(Vn);return{order:n(t),selectedBlocks:o()}}),[t]);return(0,s.createElement)(No,{value:r},(0,s.createElement)(em.Provider,{value:a},c.map((e=>(0,s.createElement)(m.AsyncModeProvider,{key:e,value:!l.has(e)&&!u.includes(e)},(0,s.createElement)(Aa,{rootClientId:t,clientId:e}))))),c.length<1&&e,(0,s.createElement)(_d,{tagName:o,rootClientId:t,renderAppender:n}))}function rm(e){return(0,s.createElement)(m.AsyncModeProvider,{value:!1},(0,s.createElement)(om,e))}nm.__unstableElementContext=Jp;const lm=["colors","disableCustomColors","gradients","disableCustomGradients"];function im({colors:e,gradients:t,disableCustomColors:n,disableCustomGradients:o,__experimentalHasMultipleOrigins:r,className:l,label:i,onColorChange:a,onGradientChange:d,colorValue:m,gradientValue:f,clearable:g,showTitle:v=!0}){const b=a&&(!(0,u.isEmpty)(e)||!n),k=d&&(!(0,u.isEmpty)(t)||!o),[_,y]=(0,s.useState)(f?"gradient":!!b&&"color");return b||k?(0,s.createElement)(p.BaseControl,{className:c()("block-editor-color-gradient-control",l)},(0,s.createElement)("fieldset",null,(0,s.createElement)(p.__experimentalVStack,{spacing:1},v&&(0,s.createElement)("legend",null,(0,s.createElement)("div",{className:"block-editor-color-gradient-control__color-indicator"},(0,s.createElement)(p.BaseControl.VisualLabel,null,i))),b&&k&&(0,s.createElement)(p.__experimentalToggleGroupControl,{value:_,onChange:y,label:(0,h.__)("Select color type"),hideLabelFromVision:!0,isBlock:!0},(0,s.createElement)(p.__experimentalToggleGroupControlOption,{value:"color",label:(0,h.__)("Solid")}),(0,s.createElement)(p.__experimentalToggleGroupControlOption,{value:"gradient",label:(0,h.__)("Gradient")})),("color"===_||!k)&&(0,s.createElement)(p.ColorPalette,{value:m,onChange:k?e=>{a(e),d()}:a,colors:e,disableCustomColors:n,__experimentalHasMultipleOrigins:r,clearable:g}),("gradient"===_||!b)&&(0,s.createElement)(p.GradientPicker,{value:f,onChange:b?e=>{d(e),a()}:d,gradients:t,disableCustomGradients:o,__experimentalHasMultipleOrigins:r,clearable:g})))):null}function sm(e){const t={};return t.colors=mo("color.palette"),t.gradients=mo("color.gradients"),t.disableCustomColors=!mo("color.custom"),t.disableCustomGradients=!mo("color.customGradient"),(0,s.createElement)(im,i({},t,e))}var am=function(e){return(0,u.every)(lm,(t=>e.hasOwnProperty(t)))?(0,s.createElement)(im,e):(0,s.createElement)(sm,e)};Lc([Ac,Fc]);const cm=(e,t,n)=>{if(t){const n=(0,u.find)(e,{slug:t});if(n)return n}return{color:n}},um=(e,t)=>(0,u.find)(e,{color:t});function dm(e,t){if(e&&t)return`has-${(0,u.kebabCase)(t)}-${e}`}const pm=[];function mm(e){const{attributes:{borderColor:t,style:n},setAttributes:o}=e,r=mo("color.palette")||pm,l=!mo("color.custom"),i=!mo("color.customGradient"),[a,c]=(0,s.useState)((()=>{var e,o;return null===(e=cm(r,t,null==n||null===(o=n.border)||void 0===o?void 0:o.color))||void 0===e?void 0:e.color}));return(0,s.createElement)(am,{label:(0,h.__)("Color"),colorValue:a,colors:r,gradients:void 0,disableCustomColors:l,disableCustomGradients:i,onColorChange:e=>{c(e);const t=um(r,e),l={...n,border:{...null==n?void 0:n.border,color:null!=t&&t.slug?void 0:e}},i=null!=t&&t.slug?t.slug:void 0;o({style:Ko(l),borderColor:i})}})}function fm(e,t,n){var o;if(!zm(t,"color")||Vm(t))return e;const{borderColor:r,style:l}=n,i=dm("border-color",r),s=c()(e.className,{"has-border-color":r||(null==l||null===(o=l.border)||void 0===o?void 0:o.color),[i]:!!i});return e.className=s||void 0,e}const hm=(0,d.createHigherOrderComponent)((e=>t=>{var n,o;const{name:r,attributes:l}=t,{borderColor:a}=l,c=mo("color.palette")||pm;if(!zm(r,"color")||Vm(r))return(0,s.createElement)(e,t);const u={borderColor:a?null===(n=cm(c,a))||void 0===n?void 0:n.color:void 0};let d=t.wrapperProps;return d={...t.wrapperProps,style:{...u,...null===(o=t.wrapperProps)||void 0===o?void 0:o.style}},(0,s.createElement)(e,i({},t,{wrapperProps:d}))}));function gm(e){return[...e].sort(((t,n)=>e.filter((e=>e===n)).length-e.filter((e=>e===t)).length)).shift()}function vm(e={}){if("string"==typeof e)return e;const t=Object.values(e).map((e=>(0,p.__experimentalParseUnit)(e))),n=t.map((e=>e[0])),o=t.map((e=>e[1])),r=n.every((e=>e===n[0]))?n[0]:"",l=gm(o);return 0===r||r?`${r}${l}`:null}function bm(e={}){const t=vm(e);return isNaN(parseFloat(t))}function km(e){return!!e&&("string"==typeof e||!!Object.values(e).filter((e=>!!e||0===e)).length)}function _m({onChange:e,values:t,...n}){const o=vm(t),r=km(t)&&bm(t),l=r?(0,h.__)("Mixed"):null;return(0,s.createElement)(p.__experimentalUnitControl,i({},n,{"aria-label":(0,h.__)("Border radius"),disableUnits:r,isOnly:!0,value:o,onChange:e,placeholder:l}))}(0,l.addFilter)("blocks.registerBlockType","core/border/addAttributes",(function(e){return zm(e,"color")?e.attributes.borderColor?e:{...e,attributes:{...e.attributes,borderColor:{type:"string"}}}:e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/border/addSaveProps",fm),(0,l.addFilter)("blocks.registerBlockType","core/border/addEditProps",(function(e){if(!zm(e,"color")||Vm(e))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),fm(o,e,n)},e})),(0,l.addFilter)("editor.BlockListBlock","core/border/with-border-color-palette-styles",hm);const ym={topLeft:(0,h.__)("Top left"),topRight:(0,h.__)("Top right"),bottomLeft:(0,h.__)("Bottom left"),bottomRight:(0,h.__)("Bottom right")};function Em({onChange:e,values:t,...n}){const o="string"!=typeof t?t:{topLeft:t,topRight:t,bottomLeft:t,bottomRight:t};return(0,s.createElement)("div",{className:"components-border-radius-control__input-controls-wrapper"},Object.entries(ym).map((([t,r])=>{return(0,s.createElement)(p.__experimentalUnitControl,i({},n,{key:t,"aria-label":r,value:o[t],onChange:(l=t,t=>{e&&e({...o,[l]:t||void 0})})}));var l})))}var Cm=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),wm=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M15.6 7.3h-.7l1.6-3.5-.9-.4-3.9 8.5H9v1.5h2l-1.3 2.8H8.4c-2 0-3.7-1.7-3.7-3.7s1.7-3.7 3.7-3.7H10V7.3H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H9l-1.4 3.2.9.4 5.7-12.5h1.4c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.9 0 5.2-2.3 5.2-5.2 0-2.9-2.4-5.2-5.2-5.2z"}));function Sm({isLinked:e,...t}){const n=e?(0,h.__)("Unlink Radii"):(0,h.__)("Link Radii");return(0,s.createElement)(p.Tooltip,{text:n},(0,s.createElement)(p.Button,i({},t,{className:"component-border-radius-control__linked-button",isPrimary:e,isSecondary:!e,isSmall:!0,icon:e?Cm:wm,iconSize:16,"aria-label":n})))}const Bm={topLeft:null,topRight:null,bottomLeft:null,bottomRight:null},Im={px:100,em:20,rem:20};function xm({onChange:e,values:t}){const[n,o]=(0,s.useState)(!km(t)||!bm(t)),r=(0,p.__experimentalUseCustomUnits)({availableUnits:mo("spacing.units")||["px","em","rem"]}),l=function(e={}){if("string"==typeof e){const[,t]=(0,p.__experimentalParseUnit)(e);return t||"px"}return gm(Object.values(e).map((e=>{const[,t]=(0,p.__experimentalParseUnit)(e);return t})))||"px"}(t),i=r&&r.find((e=>e.value===l)),a=(null==i?void 0:i.step)||1,[c]=(0,p.__experimentalParseUnit)(vm(t));return(0,s.createElement)("fieldset",{className:"components-border-radius-control"},(0,s.createElement)("legend",null,(0,h.__)("Radius")),(0,s.createElement)("div",{className:"components-border-radius-control__wrapper"},n?(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_m,{className:"components-border-radius-control__unit-control",values:t,min:0,onChange:e,unit:l,units:r}),(0,s.createElement)(p.RangeControl,{className:"components-border-radius-control__range-control",value:c,min:0,max:Im[l],initialPosition:0,withInputField:!1,onChange:t=>{e(void 0!==t?`${t}${l}`:void 0)},step:a})):(0,s.createElement)(Em,{min:0,onChange:e,values:t||Bm,units:r}),(0,s.createElement)(Sm,{onClick:()=>o(!n),isLinked:n})))}function Tm(e){var t;const{attributes:{style:n},setAttributes:o}=e;return(0,s.createElement)(xm,{values:null==n||null===(t=n.border)||void 0===t?void 0:t.radius,onChange:e=>{let t={...n,border:{...null==n?void 0:n.border,radius:e}};void 0!==e&&""!==e||(t=Ko(t)),o({style:t})}})}var Nm=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none"},(0,s.createElement)(F.Path,{d:"M5 11.25h14v1.5H5z"})),Pm=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none"},(0,s.createElement)(F.Path,{fillRule:"evenodd",d:"M5 11.25h3v1.5H5v-1.5zm5.5 0h3v1.5h-3v-1.5zm8.5 0h-3v1.5h3v-1.5z",clipRule:"evenodd"})),Mm=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none"},(0,s.createElement)(F.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"}));const Rm=[{label:(0,h.__)("Solid"),icon:Nm,value:"solid"},{label:(0,h.__)("Dashed"),icon:Pm,value:"dashed"},{label:(0,h.__)("Dotted"),icon:Mm,value:"dotted"}];function Lm({onChange:e,value:t}){return(0,s.createElement)("fieldset",{className:"components-border-style-control"},(0,s.createElement)("legend",null,(0,h.__)("Style")),(0,s.createElement)("div",{className:"components-border-style-control__buttons"},Rm.map((n=>(0,s.createElement)(p.Button,{key:n.value,icon:n.icon,isSmall:!0,isPressed:n.value===t,onClick:()=>e(n.value===t?void 0:n.value),"aria-label":n.label})))))}const Am=e=>{var t;const{attributes:{style:n},setAttributes:o}=e;return(0,s.createElement)(Lm,{value:null==n||null===(t=n.border)||void 0===t?void 0:t.style,onChange:e=>{const t={...n,border:{...null==n?void 0:n.border,style:e}};o({style:Ko(t)})}})},Dm=e=>{const{attributes:{borderColor:t,style:n},setAttributes:o}=e,{width:r,color:l,style:i}=(null==n?void 0:n.border)||{},[a,c]=(0,s.useState)(),[u,d]=(0,s.useState)();(0,s.useEffect)((()=>{"none"!==i&&c(i)}),[i]),(0,s.useEffect)((()=>{(t||l)&&d({name:t||void 0,color:l||void 0})}),[t,l]);const m=(0,p.__experimentalUseCustomUnits)({availableUnits:mo("spacing.units")||["px","em","rem"]});return(0,s.createElement)(p.__experimentalUnitControl,{value:r,label:(0,h.__)("Width"),min:0,onChange:e=>{let r={...n,border:{...null==n?void 0:n.border,width:e}},l=t;const s=0===parseFloat(e);s&&(l=void 0,r.border.color=void 0,r.border.style="none"),s||"none"!==i||(r.border.style=a),s||void 0!==t||(l=null==u?void 0:u.name,r.border.color=null==u?void 0:u.color),void 0!==e&&""!==e||(r=Ko(r)),o({borderColor:l,style:r})},units:m})},Om="__experimentalBorder";function Fm(e){const t=Hm(e),n=zm(e.name),o=mo("border.color")&&zm(e.name,"color"),r=mo("border.radius")&&zm(e.name,"radius"),l=mo("border.style")&&zm(e.name,"style"),i=mo("border.width")&&zm(e.name,"width");return t||!n?null:(0,s.createElement)(Jo,null,(0,s.createElement)(p.PanelBody,{className:"block-editor-hooks__border-controls",title:(0,h.__)("Border"),initialOpen:!1},(i||l)&&(0,s.createElement)("div",{className:"block-editor-hooks__border-controls-row"},i&&(0,s.createElement)(Dm,e),l&&(0,s.createElement)(Am,e)),o&&(0,s.createElement)(mm,e),r&&(0,s.createElement)(Tm,e)))}function zm(e,t="any"){if("web"!==s.Platform.OS)return!1;const n=(0,r.getBlockSupport)(e,Om);return!!(!0===n||("any"===t?null!=n&&n.color||null!=n&&n.radius||null!=n&&n.width||null!=n&&n.style:null!=n&&n[t]))}function Vm(e){const t=(0,r.getBlockSupport)(e,Om);return null==t?void 0:t.__experimentalSkipSerialization}const Hm=()=>[!mo("border.color"),!mo("border.radius"),!mo("border.style"),!mo("border.width")].every(Boolean),Um=[];function Gm(e){if(e)return`has-${e}-gradient-background`}function Wm(e,t){const n=(0,u.find)(e,["slug",t]);return n&&n.gradient}function $m(e,t){return(0,u.find)(e,["gradient",t])}function jm(e,t){const n=$m(e,t);return n&&n.slug}function Km({gradientAttribute:e="gradient",customGradientAttribute:t="customGradient"}={}){const{clientId:n}=Wn(),o=mo("color.gradients")||Um,{gradient:r,customGradient:l}=(0,m.useSelect)((o=>{const{getBlockAttributes:r}=o(Vn),l=r(n)||{};return{customGradient:l[t],gradient:l[e]}}),[n,e,t]),{updateBlockAttributes:i}=(0,m.useDispatch)(Vn),a=(0,s.useCallback)((r=>{const l=jm(o,r);i(n,l?{[e]:l,[t]:void 0}:{[e]:void 0,[t]:r})}),[o,n,i]),c=Gm(r);let u;return u=r?Wm(o,r):l,{gradientClass:c,gradientValue:u,setGradient:a}}
|
| 59 |
+
// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)
|
| 60 |
+
const qm=(0,h.__)("(%s: color %s)"),Ym=(0,h.__)("(%s: gradient %s)"),Zm=["colors","disableCustomColors","gradients","disableCustomGradients"],Xm=({colors:e,gradients:t,settings:n})=>n.map((({colorValue:n,gradientValue:o,label:r,colors:l,gradients:i},a)=>{if(!n&&!o)return null;let c;if(n){const t=um(l||e,n);c=(0,h.sprintf)(qm,r.toLowerCase(),t&&t.name||n)}else{const e=$m(i||t,n);c=(0,h.sprintf)(Ym,r.toLowerCase(),e&&e.name||o)}return(0,s.createElement)(p.ColorIndicator,{key:a,colorValue:n||o,"aria-label":c})})),Qm=({className:e,colors:t,gradients:n,disableCustomColors:o,disableCustomGradients:r,children:l,settings:a,title:d,showTitle:m=!0,__experimentalHasMultipleOrigins:f,...h})=>{if((0,u.isEmpty)(t)&&(0,u.isEmpty)(n)&&o&&r&&(0,u.every)(a,(e=>(0,u.isEmpty)(e.colors)&&(0,u.isEmpty)(e.gradients)&&(void 0===e.disableCustomColors||e.disableCustomColors)&&(void 0===e.disableCustomGradients||e.disableCustomGradients))))return null;const g=(0,s.createElement)("span",{className:"block-editor-panel-color-gradient-settings__panel-title"},d,(0,s.createElement)(Xm,{colors:t,gradients:n,settings:a}));return(0,s.createElement)(p.PanelBody,i({className:c()("block-editor-panel-color-gradient-settings",e),title:m?g:void 0},h),a.map(((e,l)=>(0,s.createElement)(am,i({showTitle:m,key:l,colors:t,gradients:n,disableCustomColors:o,disableCustomGradients:r,__experimentalHasMultipleOrigins:f},e)))),l)};// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)
|
| 61 |
+
function Jm(){return{disableCustomColors:!mo("color.custom"),disableCustomGradients:!mo("color.customGradient")}}const ef=e=>{const t=Jm();return t.colors=mo("color.palette"),t.gradients=mo("color.gradients"),(0,s.createElement)(Qm,i({},t,e))},tf=e=>{const t=Jm(),n=mo("color.palette.user"),o=mo("color.palette.theme"),r=mo("color.palette.core");t.colors=(0,s.useMemo)((()=>{const e=[];return r&&r.length&&e.push({name:(0,h.__)("Core"),colors:r}),o&&o.length&&e.push({name:(0,h.__)("Theme"),colors:o}),n&&n.length&&e.push({name:(0,h.__)("User"),colors:n}),e}),[r,o,n]);const l=mo("color.gradients.user"),a=mo("color.gradients.theme"),c=mo("color.gradients.core");return t.gradients=(0,s.useMemo)((()=>{const e=[];return c&&c.length&&e.push({name:(0,h.__)("Core"),gradients:c}),a&&a.length&&e.push({name:(0,h.__)("Theme"),gradients:a}),l&&l.length&&e.push({name:(0,h.__)("User"),gradients:l}),e}),[l,a,c]),(0,s.createElement)(Qm,i({},t,e))};var nf=e=>(0,u.every)(Zm,(t=>e.hasOwnProperty(t)))?(0,s.createElement)(Qm,e):e.__experimentalHasMultipleOrigins?(0,s.createElement)(tf,e):(0,s.createElement)(ef,e);function of({colordBackgroundColor:e,colordTextColor:t,backgroundColor:n,textColor:o}){const r=e.brightness()<t.brightness()?(0,h.__)("This color combination may be hard for people to read. Try using a darker background color and/or a brighter text color."):(0,h.__)("This color combination may be hard for people to read. Try using a brighter background color and/or a darker text color.");return(0,s.useEffect)((()=>{(0,Pt.speak)((0,h.__)("This color combination may be hard for people to read."))}),[n,o]),(0,s.createElement)("div",{className:"block-editor-contrast-checker"},(0,s.createElement)(p.Notice,{spokenMessage:null,status:"warning",isDismissible:!1},r))}Lc([Ac,Fc]);var rf=function({backgroundColor:e,fallbackBackgroundColor:t,fallbackTextColor:n,fontSize:o,isLargeText:r,textColor:l}){if(!e&&!t||!l&&!n)return null;const i=Mc(e||t),a=Mc(l||n);return 1!==i.alpha()||1!==a.alpha()||a.isReadable(i,{level:"AA",size:r||!1!==r&&o>=24?"large":"small"})?null:(0,s.createElement)(of,{backgroundColor:e,textColor:l,colordBackgroundColor:i,colordTextColor:a})};function lf(e){return e.ownerDocument.defaultView.getComputedStyle(e)}function sf({settings:e,clientId:t,enableContrastChecking:n=!0,showTitle:o=!0}){const[r,l]=(0,s.useState)(),[i,a]=(0,s.useState)(),c=Sa(t);return(0,s.useEffect)((()=>{if(!n)return;if(!c.current)return;a(lf(c.current).color);let e=c.current,t=lf(e).backgroundColor;for(;"rgba(0, 0, 0, 0)"===t&&e.parentNode&&e.parentNode.nodeType===e.parentNode.ELEMENT_NODE;)e=e.parentNode,t=lf(e).backgroundColor;l(t)})),(0,s.createElement)(Jo,null,(0,s.createElement)(nf,{title:(0,h.__)("Color"),initialOpen:!1,settings:e,showTitle:o,__experimentalHasMultipleOrigins:!0},n&&(0,s.createElement)(rf,{backgroundColor:r,textColor:i})))}const af="color",cf=[],uf=e=>{const t=(0,r.getBlockSupport)(e,af);return t&&(!0===t.link||!0===t.gradient||!1!==t.background||!1!==t.text)},df=e=>{const t=(0,r.getBlockSupport)(e,af);return null==t?void 0:t.__experimentalSkipSerialization},pf=e=>{const t=(0,r.getBlockSupport)(e,af);return(0,u.isObject)(t)&&!!t.gradients};function mf(e,t,n){var o,r,l,i,s,a;if(!uf(t)||df(t))return e;const u=pf(t),{backgroundColor:d,textColor:p,gradient:m,style:f}=n,h=dm("background-color",d),g=Gm(m),v=dm("color",p),b=c()(e.className,v,g,{[h]:!(u&&null!=f&&null!==(o=f.color)&&void 0!==o&&o.gradient||!h),"has-text-color":p||(null==f||null===(r=f.color)||void 0===r?void 0:r.text),"has-background":d||(null==f||null===(l=f.color)||void 0===l?void 0:l.background)||u&&(m||(null==f||null===(i=f.color)||void 0===i?void 0:i.gradient)),"has-link-color":null==f||null===(s=f.elements)||void 0===s||null===(a=s.link)||void 0===a?void 0:a.color});return e.className=b||void 0,e}const ff=(e,t)=>{const n=/var:preset\|color\|(.+)/.exec(t);return n&&n[1]?cm(e,n[1]).color:t};function hf(e){var t,n,o,l,i,a,c,d,p;const{name:m,attributes:f}=e,g=mo("color.palette")||cf,v=mo("color.gradients")||cf,b=mo("color.custom"),k=mo("color.customGradient"),_=mo("color.link"),y=mo("color.text"),E=mo("color.background"),C=(0,s.useRef)(f);if((0,s.useEffect)((()=>{C.current=f}),[f]),!uf(m))return null;const w=(e=>{if("web"!==s.Platform.OS)return!1;const t=(0,r.getBlockSupport)(e,af);return(0,u.isObject)(t)&&!!t.link})(m)&&_&&(g.length>0||b),S=(e=>{const t=(0,r.getBlockSupport)(e,af);return t&&!1!==t.text})(m)&&y&&(g.length>0||b),B=(e=>{const t=(0,r.getBlockSupport)(e,af);return t&&!1!==t.background})(m)&&E&&(g.length>0||b),I=pf(m)&&(v.length>0||k);if(!(w||S||B||I))return null;const{style:x,textColor:T,backgroundColor:N,gradient:P}=f;let M;if(I&&P)M=Wm(v,P);else if(I){var R;M=null==x||null===(R=x.color)||void 0===R?void 0:R.gradient}const L=t=>n=>{var o,r;const l=um(g,n),i=t+"Color",s={...C.current.style,color:{...null===(o=C.current)||void 0===o||null===(r=o.style)||void 0===r?void 0:r.color,[t]:null!=l&&l.slug?void 0:n}},a=null!=l&&l.slug?l.slug:void 0,c={style:Ko(s),[i]:a};e.setAttributes(c),C.current={...C.current,...c}};return(0,s.createElement)(sf,{enableContrastChecking:!("web"!==s.Platform.OS||P||null!=x&&null!==(t=x.color)&&void 0!==t&&t.gradient),clientId:e.clientId,settings:[...S?[{label:(0,h.__)("Text color"),onColorChange:L("text"),colorValue:cm(g,T,null==x||null===(n=x.color)||void 0===n?void 0:n.text).color}]:[],...B||I?[{label:(0,h.__)("Background color"),onColorChange:B?L("background"):void 0,colorValue:cm(g,N,null==x||null===(o=x.color)||void 0===o?void 0:o.background).color,gradientValue:M,onGradientChange:I?t=>{const n=jm(v,t);let o;if(n){var r,l,i;const e={...null===(r=C.current)||void 0===r?void 0:r.style,color:{...null===(l=C.current)||void 0===l||null===(i=l.style)||void 0===i?void 0:i.color,gradient:void 0}};o={style:Ko(e),gradient:n}}else{var s,a,c;const e={...null===(s=C.current)||void 0===s?void 0:s.style,color:{...null===(a=C.current)||void 0===a||null===(c=a.style)||void 0===c?void 0:c.color,gradient:t}};o={style:Ko(e),gradient:void 0}}e.setAttributes(o),C.current={...C.current,...o}}:void 0}]:[],...w?[{label:(0,h.__)("Link Color"),onColorChange:t=>{const n=um(g,t),o=null!=n&&n.slug?`var:preset|color|${n.slug}`:t,r=Ko(function(e,t,n){return(0,u.setWith)(e?(0,u.clone)(e):{},["elements","link","color","text"],n,u.clone)}(x,0,o));e.setAttributes({style:r})},colorValue:ff(g,null==x||null===(l=x.elements)||void 0===l||null===(i=l.link)||void 0===i||null===(a=i.color)||void 0===a?void 0:a.text),clearable:!(null==x||null===(c=x.elements)||void 0===c||null===(d=c.link)||void 0===d||null===(p=d.color)||void 0===p||!p.text)}]:[]]})}const gf=(0,d.createHigherOrderComponent)((e=>t=>{var n,o,r;const{name:l,attributes:a}=t,{backgroundColor:c,textColor:u}=a,d=mo("color.palette")||cf;if(!uf(l)||df(l))return(0,s.createElement)(e,t);const p={color:u?null===(n=cm(d,u))||void 0===n?void 0:n.color:void 0,backgroundColor:c?null===(o=cm(d,c))||void 0===o?void 0:o.color:void 0};let m=t.wrapperProps;return m={...t.wrapperProps,style:{...p,...null===(r=t.wrapperProps)||void 0===r?void 0:r.style}},(0,s.createElement)(e,i({},t,{wrapperProps:m}))}));(0,l.addFilter)("blocks.registerBlockType","core/color/addAttribute",(function(e){return uf(e)?(e.attributes.backgroundColor||Object.assign(e.attributes,{backgroundColor:{type:"string"}}),e.attributes.textColor||Object.assign(e.attributes,{textColor:{type:"string"}}),pf(e)&&!e.attributes.gradient&&Object.assign(e.attributes,{gradient:{type:"string"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/color/addSaveProps",mf),(0,l.addFilter)("blocks.registerBlockType","core/color/addEditProps",(function(e){if(!uf(e)||df(e))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),mf(o,e,n)},e})),(0,l.addFilter)("editor.BlockListBlock","core/color/with-color-palette-styles",gf);const vf=[{name:(0,h.__)("Regular"),value:"normal"},{name:(0,h.__)("Italic"),value:"italic"}],bf=[{name:(0,h.__)("Thin"),value:"100"},{name:(0,h.__)("Extra Light"),value:"200"},{name:(0,h.__)("Light"),value:"300"},{name:(0,h.__)("Regular"),value:"400"},{name:(0,h.__)("Medium"),value:"500"},{name:(0,h.__)("Semi Bold"),value:"600"},{name:(0,h.__)("Bold"),value:"700"},{name:(0,h.__)("Extra Bold"),value:"800"},{name:(0,h.__)("Black"),value:"900"}],kf=(e,t)=>e?t?(0,h.__)("Appearance"):(0,h.__)("Font style"):(0,h.__)("Font weight");function _f(e){const{onChange:t,hasFontStyles:n=!0,hasFontWeights:o=!0,value:{fontStyle:r,fontWeight:l}}=e,i=n||o,a=kf(n,o),c={key:"default",name:(0,h.__)("Default"),style:{fontStyle:void 0,fontWeight:void 0}},u=(0,s.useMemo)((()=>n&&o?(()=>{const e=[c];return vf.forEach((({name:t,value:n})=>{bf.forEach((({name:o,value:r})=>{const l="normal"===n?o:(0,h.sprintf)(
|
| 62 |
/* translators: 1: Font weight name. 2: Font style name. */
|
| 63 |
+
(0,h.__)("%1$s %2$s"),o,t);e.push({key:`${n}-${r}`,name:l,style:{fontStyle:n,fontWeight:r}})}))})),e})():n?(()=>{const e=[c];return vf.forEach((({name:t,value:n})=>{e.push({key:n,name:t,style:{fontStyle:n,fontWeight:void 0}})})),e})():(()=>{const e=[c];return bf.forEach((({name:t,value:n})=>{e.push({key:n,name:t,style:{fontStyle:void 0,fontWeight:n}})})),e})()),[e.options]),d=u.find((e=>e.style.fontStyle===r&&e.style.fontWeight===l))||u[0];return i&&(0,s.createElement)(p.CustomSelectControl,{className:"components-font-appearance-control",label:a,describedBy:d?n?o?(0,h.sprintf)(// translators: %s: Currently selected font appearance.
|
| 64 |
+
(0,h.__)("Currently selected font appearance: %s"),d.name):(0,h.sprintf)(// translators: %s: Currently selected font style.
|
| 65 |
+
(0,h.__)("Currently selected font style: %s"),d.name):(0,h.sprintf)(// translators: %s: Currently selected font weight.
|
| 66 |
+
(0,h.__)("Currently selected font weight: %s"),d.name):(0,h.__)("No selected font appearance"),options:u,value:d,onChange:({selectedItem:e})=>t(e.style)})}function yf({value:e,onChange:t}){const n=function(e){return void 0!==e&&""!==e}(e),o=n?e:"";return(0,s.createElement)("div",{className:"block-editor-line-height-control"},(0,s.createElement)(p.TextControl,{autoComplete:"off",onKeyDown:e=>{const{keyCode:o}=e;o!==ga.ZERO||n||(e.preventDefault(),t("0"))},onChange:e=>{if(n)return void t(e);let o=e;switch(e){case"0.1":o=1.6;break;case"0":o=1.4}t(o)},label:(0,h.__)("Line height"),placeholder:1.5,step:.1,type:"number",value:o,min:0}))}const Ef="typography.lineHeight";function Cf(e){var t;const{attributes:{style:n},setAttributes:o}=e;return(0,s.createElement)(yf,{value:null==n||null===(t=n.typography)||void 0===t?void 0:t.lineHeight,onChange:e=>{const t={...n,typography:{...null==n?void 0:n.typography,lineHeight:e}};o({style:Ko(t)})}})}function wf({name:e}={}){const t=!mo("typography.lineHeight");return!(0,r.hasBlockSupport)(e,Ef)||t}const Sf="typography.__experimentalFontStyle",Bf="typography.__experimentalFontWeight";function If(e){var t,n;const{attributes:{style:o},setAttributes:r}=e,l=!xf(e),i=!Tf(e),a=null==o||null===(t=o.typography)||void 0===t?void 0:t.fontStyle,c=null==o||null===(n=o.typography)||void 0===n?void 0:n.fontWeight;return(0,s.createElement)(_f,{onChange:e=>{r({style:Ko({...o,typography:{...null==o?void 0:o.typography,fontStyle:e.fontStyle,fontWeight:e.fontWeight}})})},hasFontStyles:l,hasFontWeights:i,value:{fontStyle:a,fontWeight:c}})}function xf({name:e}={}){const t=(0,r.hasBlockSupport)(e,Sf),n=mo("typography.fontStyle");return!t||!n}function Tf({name:e}={}){const t=(0,r.hasBlockSupport)(e,Bf),n=mo("typography.fontWeight");return!t||!n}function Nf(e){const t=xf(e),n=Tf(e);return t&&n}function Pf({value:e="",onChange:t,fontFamilies:n,...o}){const r=mo("typography.fontFamilies");if(n||(n=r),(0,u.isEmpty)(n))return null;const l=[{value:"",label:(0,h.__)("Default")},...n.map((({fontFamily:e,name:t})=>({value:e,label:t||e})))];return(0,s.createElement)(p.SelectControl,i({label:(0,h.__)("Font family"),options:l,value:e,onChange:t,labelPosition:"top"},o))}const Mf="typography.__experimentalFontFamily";function Rf(e,t,n){if(!(0,r.hasBlockSupport)(t,Mf))return e;if((0,r.hasBlockSupport)(t,"typography.__experimentalSkipSerialization"))return e;if(null==n||!n.fontFamily)return e;const o=new(Jd())(e.className);o.add(`has-${(0,u.kebabCase)(null==n?void 0:n.fontFamily)}-font-family`);const l=o.value;return e.className=l||void 0,e}function Lf({setAttributes:e,attributes:{fontFamily:t}}){var n;const o=mo("typography.fontFamilies"),r=null===(n=(0,u.find)(o,(({slug:e})=>t===e)))||void 0===n?void 0:n.fontFamily;return(0,s.createElement)(Pf,{className:"block-editor-hooks-font-family-control",fontFamilies:o,value:r,onChange:function(t){const n=(0,u.find)(o,(({fontFamily:e})=>e===t));e({fontFamily:null==n?void 0:n.slug})}})}function Af({name:e}){const t=mo("typography.fontFamilies");return!t||0===t.length||!(0,r.hasBlockSupport)(e,Mf)}(0,l.addFilter)("blocks.registerBlockType","core/fontFamily/addAttribute",(function(e){return(0,r.hasBlockSupport)(e,Mf)?(e.attributes.fontFamily||Object.assign(e.attributes,{fontFamily:{type:"string"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/fontFamily/addSaveProps",Rf),(0,l.addFilter)("blocks.registerBlockType","core/fontFamily/addEditProps",(function(e){if(!(0,r.hasBlockSupport)(e,Mf))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),Rf(o,e,n)},e}));const Df=(e,t,n)=>{if(t){const n=(0,u.find)(e,{slug:t});if(n)return n}return{size:n}};function Of(e,t){return(0,u.find)(e,{size:t})||{size:t}}function Ff(e){if(e)return`has-${(0,u.kebabCase)(e)}-font-size`}var zf=function(e){const t=mo("typography.fontSizes"),n=!mo("typography.customFontSize");return(0,s.createElement)(p.FontSizePicker,i({},e,{fontSizes:t,disableCustomFontSizes:n}))};const Vf="typography.fontSize";function Hf(e,t,n){if(!(0,r.hasBlockSupport)(t,Vf))return e;if((0,r.hasBlockSupport)(t,"typography.__experimentalSkipSerialization"))return e;const o=new(Jd())(e.className);o.add(Ff(n.fontSize));const l=o.value;return e.className=l||void 0,e}function Uf(e){var t,n;const{attributes:{fontSize:o,style:r},setAttributes:l}=e,i=mo("typography.fontSizes"),a=Df(i,o,null==r||null===(t=r.typography)||void 0===t?void 0:t.fontSize),c=(null==a?void 0:a.size)||(null==r||null===(n=r.typography)||void 0===n?void 0:n.fontSize)||o;return(0,s.createElement)(zf,{onChange:e=>{const t=Of(i,e).slug;l({style:Ko({...r,typography:{...null==r?void 0:r.typography,fontSize:t?void 0:e}}),fontSize:t})},value:c,withReset:!1})}function Gf({name:e}={}){const t=mo("typography.fontSizes"),n=!(null==t||!t.length);return!(0,r.hasBlockSupport)(e,Vf)||!n}const Wf=(0,d.createHigherOrderComponent)((e=>t=>{var n,o;const l=mo("typography.fontSizes"),{name:i,attributes:{fontSize:a,style:c},wrapperProps:u}=t;if(!(0,r.hasBlockSupport)(i,Vf)||(0,r.hasBlockSupport)(i,"typography.__experimentalSkipSerialization")||!a||null!=c&&null!==(n=c.typography)&&void 0!==n&&n.fontSize)return(0,s.createElement)(e,t);const d=Df(l,a,null==c||null===(o=c.typography)||void 0===o?void 0:o.fontSize).size,p={...t,wrapperProps:{...u,style:{fontSize:d,...null==u?void 0:u.style}}};return(0,s.createElement)(e,p)}),"withFontSizeInlineStyles");(0,l.addFilter)("blocks.registerBlockType","core/font/addAttribute",(function(e){return(0,r.hasBlockSupport)(e,Vf)?(e.attributes.fontSize||Object.assign(e.attributes,{fontSize:{type:"string"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/font/addSaveProps",Hf),(0,l.addFilter)("blocks.registerBlockType","core/font/addEditProps",(function(e){if(!(0,r.hasBlockSupport)(e,Vf))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),Hf(o,e,n)},e})),(0,l.addFilter)("editor.BlockListBlock","core/font-size/with-font-size-inline-styles",Wf);var $f=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),jf=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"}));const Kf=[{name:(0,h.__)("Underline"),value:"underline",icon:$f},{name:(0,h.__)("Strikethrough"),value:"line-through",icon:jf}];function qf({value:e,onChange:t}){return(0,s.createElement)("fieldset",{className:"block-editor-text-decoration-control"},(0,s.createElement)("legend",null,(0,h.__)("Decoration")),(0,s.createElement)("div",{className:"block-editor-text-decoration-control__buttons"},Kf.map((n=>(0,s.createElement)(p.Button,{key:n.value,icon:n.icon,isSmall:!0,isPressed:n.value===e,onClick:()=>t(n.value===e?void 0:n.value),"aria-label":n.name})))))}const Yf="typography.__experimentalTextDecoration";function Zf(e){var t;const{attributes:{style:n},setAttributes:o}=e;return(0,s.createElement)(qf,{value:null==n||null===(t=n.typography)||void 0===t?void 0:t.textDecoration,onChange:function(e){o({style:Ko({...n,typography:{...null==n?void 0:n.typography,textDecoration:e}})})}})}function Xf({name:e}={}){const t=!(0,r.hasBlockSupport)(e,Yf),n=mo("typography.textDecoration");return t||!n}var Qf=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),Jf=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),eh=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"}));const th=[{name:(0,h.__)("Uppercase"),value:"uppercase",icon:Qf},{name:(0,h.__)("Lowercase"),value:"lowercase",icon:Jf},{name:(0,h.__)("Capitalize"),value:"capitalize",icon:eh}];function nh({value:e,onChange:t}){return(0,s.createElement)("fieldset",{className:"block-editor-text-transform-control"},(0,s.createElement)("legend",null,(0,h.__)("Letter case")),(0,s.createElement)("div",{className:"block-editor-text-transform-control__buttons"},th.map((n=>(0,s.createElement)(p.Button,{key:n.value,icon:n.icon,isSmall:!0,isPressed:e===n.value,"aria-label":n.name,onClick:()=>t(e===n.value?void 0:n.value)})))))}const oh="typography.__experimentalTextTransform";function rh(e){var t;const{attributes:{style:n},setAttributes:o}=e;return(0,s.createElement)(nh,{value:null==n||null===(t=n.typography)||void 0===t?void 0:t.textTransform,onChange:function(e){o({style:Ko({...n,typography:{...null==n?void 0:n.typography,textTransform:e}})})}})}function lh({name:e}={}){const t=!(0,r.hasBlockSupport)(e,oh),n=mo("typography.textTransform");return t||!n}function ih({value:e,onChange:t,__unstableInputWidth:n="60px"}){const o=(0,p.__experimentalUseCustomUnits)({availableUnits:mo("spacing.units")||["px","em","rem"],defaultValues:{px:"2",em:".2",rem:".2"}});return(0,s.createElement)(p.__experimentalUnitControl,{label:(0,h.__)("Letter-spacing"),value:e,__unstableInputWidth:n,units:o,onChange:t})}const sh="typography.__experimentalLetterSpacing";function ah(e){var t;const{attributes:{style:n},setAttributes:o}=e;return(0,s.createElement)(ih,{value:null==n||null===(t=n.typography)||void 0===t?void 0:t.letterSpacing,onChange:function(e){o({style:Ko({...n,typography:{...null==n?void 0:n.typography,letterSpacing:e}})})},__unstableInputWidth:!1})}function ch({name:e}={}){const t=!(0,r.hasBlockSupport)(e,sh),n=mo("typography.letterSpacing");return t||!n}const uh="typography",dh=[Ef,Vf,Sf,Bf,Mf,Yf,oh,sh];function ph(e){const{clientId:t}=e,n=Af(e),o=Gf(e),l=Nf(e),i=wf(e),a=Xf(e),c=lh(e),u=ch(e),d=!xf(e),m=!Tf(e),f=function(e={}){const t=[Nf(e),Gf(e),wf(e),Af(e),Xf(e),lh(e),ch(e)];return t.filter(Boolean).length===t.length}(e),g=mh(e.name);if(f||!g)return null;const v=(0,r.getBlockSupport)(e.name,[uh,"__experimentalDefaultControls"]),b=e=>t=>{var n;return{...t,style:{...t.style,typography:{...null===(n=t.style)||void 0===n?void 0:n.typography,[e]:void 0}}}};return(0,s.createElement)(Jo,{__experimentalGroup:"typography"},!n&&(0,s.createElement)(p.__experimentalToolsPanelItem,{hasValue:()=>function(e){return!!e.attributes.fontFamily}(e),label:(0,h.__)("Font family"),onDeselect:()=>function({setAttributes:e}){e({fontFamily:void 0})}(e),isShownByDefault:null==v?void 0:v.fontFamily,resetAllFilter:e=>({...e,fontFamily:void 0}),panelId:t},(0,s.createElement)(Lf,e)),!o&&(0,s.createElement)(p.__experimentalToolsPanelItem,{hasValue:()=>function(e){var t;const{fontSize:n,style:o}=e.attributes;return!!n||!(null==o||null===(t=o.typography)||void 0===t||!t.fontSize)}(e),label:(0,h.__)("Font size"),onDeselect:()=>function({attributes:e={},setAttributes:t}){const{style:n}=e;t({fontSize:void 0,style:Ko({...n,typography:{...null==n?void 0:n.typography,fontSize:void 0}})})}(e),isShownByDefault:null==v?void 0:v.fontSize,resetAllFilter:e=>{var t;return{...e,fontSize:void 0,style:{...e.style,typography:{...null===(t=e.style)||void 0===t?void 0:t.typography,fontSize:void 0}}}},panelId:t},(0,s.createElement)(Uf,e)),!l&&(0,s.createElement)(p.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>function(e){var t;const{fontStyle:n,fontWeight:o}=(null===(t=e.attributes.style)||void 0===t?void 0:t.typography)||{};return!!n||!!o}(e),label:kf(d,m),onDeselect:()=>function({attributes:e={},setAttributes:t}){const{style:n}=e;t({style:Ko({...n,typography:{...null==n?void 0:n.typography,fontStyle:void 0,fontWeight:void 0}})})}(e),isShownByDefault:null==v?void 0:v.fontAppearance,resetAllFilter:e=>{var t;return{...e,style:{...e.style,typography:{...null===(t=e.style)||void 0===t?void 0:t.typography,fontStyle:void 0,fontWeight:void 0}}}},panelId:t},(0,s.createElement)(If,e)),!i&&(0,s.createElement)(p.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>function(e){var t,n;return!(null===(t=e.attributes.style)||void 0===t||null===(n=t.typography)||void 0===n||!n.lineHeight)}(e),label:(0,h.__)("Line height"),onDeselect:()=>function({attributes:e={},setAttributes:t}){const{style:n}=e;t({style:Ko({...n,typography:{...null==n?void 0:n.typography,lineHeight:void 0}})})}(e),isShownByDefault:null==v?void 0:v.lineHeight,resetAllFilter:b("lineHeight"),panelId:t},(0,s.createElement)(Cf,e)),!a&&(0,s.createElement)(p.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>function(e){var t,n;return!(null===(t=e.attributes.style)||void 0===t||null===(n=t.typography)||void 0===n||!n.textDecoration)}(e),label:(0,h.__)("Decoration"),onDeselect:()=>function({attributes:e={},setAttributes:t}){const{style:n}=e;t({style:Ko({...n,typography:{...null==n?void 0:n.typography,textDecoration:void 0}})})}(e),isShownByDefault:null==v?void 0:v.textDecoration,resetAllFilter:b("textDecoration"),panelId:t},(0,s.createElement)(Zf,e)),!c&&(0,s.createElement)(p.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>function(e){var t,n;return!(null===(t=e.attributes.style)||void 0===t||null===(n=t.typography)||void 0===n||!n.textTransform)}(e),label:(0,h.__)("Letter case"),onDeselect:()=>function({attributes:e={},setAttributes:t}){const{style:n}=e;t({style:Ko({...n,typography:{...null==n?void 0:n.typography,textTransform:void 0}})})}(e),isShownByDefault:null==v?void 0:v.textTransform,resetAllFilter:b("textTransform"),panelId:t},(0,s.createElement)(rh,e)),!u&&(0,s.createElement)(p.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>function(e){var t,n;return!(null===(t=e.attributes.style)||void 0===t||null===(n=t.typography)||void 0===n||!n.letterSpacing)}(e),label:(0,h.__)("Letter-spacing"),onDeselect:()=>function({attributes:e={},setAttributes:t}){const{style:n}=e;t({style:Ko({...n,typography:{...null==n?void 0:n.typography,letterSpacing:void 0}})})}(e),isShownByDefault:null==v?void 0:v.letterSpacing,resetAllFilter:b("letterSpacing"),panelId:t},(0,s.createElement)(ah,e)))}const mh=e=>dh.some((t=>(0,r.hasBlockSupport)(e,t)));function fh(e){const t=(0,r.getBlockSupport)(e,Ch);return!!(!0===t||null!=t&&t.blockGap)}function hh({name:e}={}){const t=!mo("spacing.blockGap");return!fh(e)||t}function gh(e){var t;const{clientId:n,attributes:{style:o},setAttributes:r}=e,l=(0,p.__experimentalUseCustomUnits)({availableUnits:mo("spacing.units")||["%","px","em","rem","vw"]}),i=Sa(n);return hh(e)?null:s.Platform.select({web:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.__experimentalUnitControl,{label:(0,h.__)("Block spacing"),__unstableInputWidth:"80px",min:0,onChange:e=>{var t;const n={...o,spacing:{...null==o?void 0:o.spacing,blockGap:e}};r({style:Ko(n)});const l=(null===(t=window)||void 0===t?void 0:t.navigator.userAgent)&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome ")&&!window.navigator.userAgent.includes("Chromium ");var s;i.current&&l&&(null===(s=i.current.parentNode)||void 0===s||s.replaceChild(i.current,i.current))},units:l,value:null==o||null===(t=o.spacing)||void 0===t?void 0:t.blockGap})),native:null})}function vh(e){const t=(0,r.getBlockSupport)(e,Ch);return!!(!0===t||null!=t&&t.margin)}function bh({name:e}={}){const t=!mo("spacing.margin"),n=!Th(e,"margin");return!vh(e)||t||n}function kh(e){var t;const{name:n,attributes:{style:o},setAttributes:r}=e,l=(0,p.__experimentalUseCustomUnits)({availableUnits:mo("spacing.units")||["%","px","em","rem","vw"]}),i=xh(n,"margin"),a=i&&i.some((e=>Sh.includes(e)));return bh(e)?null:s.Platform.select({web:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.__experimentalBoxControl,{values:null==o||null===(t=o.spacing)||void 0===t?void 0:t.margin,onChange:e=>{const t={...o,spacing:{...null==o?void 0:o.spacing,margin:e}};r({style:Ko(t)})},onChangeShowVisualizer:e=>{const t={...o,visualizers:{margin:e}};r({style:Ko(t)})},label:(0,h.__)("Margin"),sides:i,units:l,allowReset:!1,splitOnAxis:a})),native:null})}function _h(e){const t=(0,r.getBlockSupport)(e,Ch);return!!(!0===t||null!=t&&t.padding)}function yh({name:e}={}){const t=!mo("spacing.padding"),n=!Th(e,"padding");return!_h(e)||t||n}function Eh(e){var t;const{name:n,attributes:{style:o},setAttributes:r}=e,l=(0,p.__experimentalUseCustomUnits)({availableUnits:mo("spacing.units")||["%","px","em","rem","vw"]}),i=xh(n,"padding"),a=i&&i.some((e=>Sh.includes(e)));return yh(e)?null:s.Platform.select({web:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.__experimentalBoxControl,{values:null==o||null===(t=o.spacing)||void 0===t?void 0:t.padding,onChange:e=>{const t={...o,spacing:{...null==o?void 0:o.spacing,padding:e}};r({style:Ko(t)})},onChangeShowVisualizer:e=>{const t={...o,visualizers:{padding:e}};r({style:Ko(t)})},label:(0,h.__)("Padding"),sides:i,units:l,allowReset:!1,splitOnAxis:a})),native:null})}const Ch="spacing",wh=["top","right","bottom","left"],Sh=["vertical","horizontal"];function Bh(e){const t=hh(e),n=yh(e),o=bh(e),l=Ih(e),i=(a=e.name,"web"===s.Platform.OS&&(fh(a)||_h(a)||vh(a)));var a;if(l||!i)return null;const c=(0,r.getBlockSupport)(e.name,[Ch,"__experimentalDefaultControls"]),u=e=>t=>{var n;return{...t,style:{...t.style,spacing:{...null===(n=t.style)||void 0===n?void 0:n.spacing,[e]:void 0}}}};return(0,s.createElement)(Jo,{__experimentalGroup:"dimensions"},!n&&(0,s.createElement)(p.__experimentalToolsPanelItem,{hasValue:()=>function(e){var t,n;return void 0!==(null===(t=e.attributes.style)||void 0===t||null===(n=t.spacing)||void 0===n?void 0:n.padding)}(e),label:(0,h.__)("Padding"),onDeselect:()=>function({attributes:e={},setAttributes:t}){const{style:n}=e;t({style:Ko({...n,spacing:{...null==n?void 0:n.spacing,padding:void 0}})})}(e),resetAllFilter:u("padding"),isShownByDefault:null==c?void 0:c.padding,panelId:e.clientId},(0,s.createElement)(Eh,e)),!o&&(0,s.createElement)(p.__experimentalToolsPanelItem,{hasValue:()=>function(e){var t,n;return void 0!==(null===(t=e.attributes.style)||void 0===t||null===(n=t.spacing)||void 0===n?void 0:n.margin)}(e),label:(0,h.__)("Margin"),onDeselect:()=>function({attributes:e={},setAttributes:t}){const{style:n}=e;t({style:Ko({...n,spacing:{...null==n?void 0:n.spacing,margin:void 0}})})}(e),resetAllFilter:u("margin"),isShownByDefault:null==c?void 0:c.margin,panelId:e.clientId},(0,s.createElement)(kh,e)),!t&&(0,s.createElement)(p.__experimentalToolsPanelItem,{hasValue:()=>function(e){var t,n;return void 0!==(null===(t=e.attributes.style)||void 0===t||null===(n=t.spacing)||void 0===n?void 0:n.blockGap)}(e),label:(0,h.__)("Block spacing"),onDeselect:()=>function({attributes:e={},setAttributes:t}){const{style:n}=e;t({style:{...n,spacing:{...null==n?void 0:n.spacing,blockGap:void 0}}})}(e),resetAllFilter:u("blockGap"),isShownByDefault:null==c?void 0:c.blockGap,panelId:e.clientId},(0,s.createElement)(gh,e)))}const Ih=(e={})=>{const t=hh(e),n=yh(e),o=bh(e);return t&&n&&o};function xh(e,t){const n=(0,r.getBlockSupport)(e,Ch);if(n&&"boolean"!=typeof n[t])return n[t]}function Th(e,t){const n=xh(e,t);return!(n&&n.some((e=>wh.includes(e)))&&n.some((e=>Sh.includes(e)))&&(console.warn(`The ${t} support for the "${e}" block can not be configured to support both axial and arbitrary sides.`),1))}const Nh=[...dh,Om,af,Ch],Ph=e=>Nh.some((t=>(0,r.hasBlockSupport)(e,t))),Mh="var:";function Rh(e){return(0,u.startsWith)(e,Mh)?`var(--wp--${e.slice(Mh.length).split("|").join("--")})`:e}function Lh(e={}){const t={};return Object.keys(r.__EXPERIMENTAL_STYLE_PROPERTY).forEach((n=>{const o=r.__EXPERIMENTAL_STYLE_PROPERTY[n].value,l=r.__EXPERIMENTAL_STYLE_PROPERTY[n].properties;if((0,u.has)(e,o)&&"elements"!==(0,u.first)(o)){const r=(0,u.get)(e,o);l&&!(0,u.isString)(r)?Object.entries(l).forEach((e=>{const[n,o]=e,l=(0,u.get)(r,[o]);l&&(t[n]=Rh(l))})):t[n]=Rh((0,u.get)(e,o))}})),t}const Ah={"__experimentalBorder.__experimentalSkipSerialization":["border"],"color.__experimentalSkipSerialization":[af],"typography.__experimentalSkipSerialization":[uh],[`${Ch}.__experimentalSkipSerialization`]:["spacing"]},Dh={...Ah,[`${Ch}`]:["spacing.blockGap"]};function Oh(e,t,n,o=Dh){if(!Ph(t))return e;let{style:l}=n;return(0,u.forEach)(o,((e,n)=>{(0,r.getBlockSupport)(t,n)&&(l=(0,u.omit)(l,e))})),e.style={...Lh(l),...e.style},e}const Fh=(0,d.createHigherOrderComponent)((e=>t=>{const n=$n();return(0,s.createElement)(s.Fragment,null,n&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(hf,t),(0,s.createElement)(ph,t),(0,s.createElement)(Fm,t),(0,s.createElement)(Bh,t)),(0,s.createElement)(e,t))}),"withToolbarControls"),zh=(0,d.createHigherOrderComponent)((e=>t=>{var n,o;const l=null===(n=t.attributes.style)||void 0===n?void 0:n.elements,a=`wp-elements-${(0,d.useInstanceId)(e)}`,p=function(e,t={}){return(0,u.map)(t,((t,n)=>{const o=Lh(t);return(0,u.isEmpty)(o)?"":[`.${e} ${r.__EXPERIMENTAL_ELEMENTS[n]}{`,...(0,u.map)(o,((e,t)=>`\t${(0,u.kebabCase)(t)}: ${e};`)),"}"].join("\n")})).join("\n")}(a,null===(o=t.attributes.style)||void 0===o?void 0:o.elements),m=(0,s.useContext)(nm.__unstableElementContext);return(0,s.createElement)(s.Fragment,null,l&&m&&(0,s.createPortal)((0,s.createElement)("style",{dangerouslySetInnerHTML:{__html:p}}),m),(0,s.createElement)(e,i({},t,{className:l?c()(t.className,a):t.className})))}));(0,l.addFilter)("blocks.registerBlockType","core/style/addAttribute",(function(e){return Ph(e)?(e.attributes.style||Object.assign(e.attributes,{style:{type:"object"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/style/addSaveProps",Oh),(0,l.addFilter)("blocks.registerBlockType","core/style/addEditProps",(function(e){if(!Ph(e))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),Oh(o,e,n,Ah)},e})),(0,l.addFilter)("editor.BlockEdit","core/style/with-block-controls",Fh),(0,l.addFilter)("editor.BlockListBlock","core/editor/with-elements-styles",zh);var Vh=function({colorPalette:e,duotonePalette:t,disableCustomColors:n,disableCustomDuotone:o,value:r,onChange:l}){return(0,s.createElement)(p.Dropdown,{popoverProps:{className:"block-editor-duotone-control__popover",headerTitle:(0,h.__)("Duotone"),isAlternate:!0},renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(p.ToolbarButton,{showTooltip:!0,onClick:t,"aria-haspopup":"true","aria-expanded":e,onKeyDown:n=>{e||n.keyCode!==ga.DOWN||(n.preventDefault(),t())},label:(0,h.__)("Apply duotone filter"),icon:(0,s.createElement)(p.DuotoneSwatch,{values:r})}),renderContent:()=>(0,s.createElement)(p.MenuGroup,{label:(0,h.__)("Duotone")},(0,s.createElement)("div",{className:"block-editor-duotone-control__description"},(0,h.__)("Create a two-tone color effect without losing your original image.")),(0,s.createElement)(p.DuotonePicker,{colorPalette:e,duotonePalette:t,disableCustomColors:n,disableCustomDuotone:o,value:r,onChange:l}))})};const Hh=[];function Uh(e=[]){const t={r:[],g:[],b:[],a:[]};return e.forEach((e=>{const n=Mc(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}function Gh({selector:e,id:t,values:n}){const o=`\n${e} {\n\tfilter: url( #${t} );\n}\n`;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.SVG,{xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 0 0",width:"0",height:"0",focusable:"false",role:"none",style:{visibility:"hidden",position:"absolute",left:"-9999px",overflow:"hidden"}},(0,s.createElement)("defs",null,(0,s.createElement)("filter",{id:t},(0,s.createElement)("feColorMatrix",{colorInterpolationFilters:"sRGB",type:"matrix",values:" .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "}),(0,s.createElement)("feComponentTransfer",{colorInterpolationFilters:"sRGB"},(0,s.createElement)("feFuncR",{type:"table",tableValues:n.r.join(" ")}),(0,s.createElement)("feFuncG",{type:"table",tableValues:n.g.join(" ")}),(0,s.createElement)("feFuncB",{type:"table",tableValues:n.b.join(" ")}),(0,s.createElement)("feFuncA",{type:"table",tableValues:n.a.join(" ")})),(0,s.createElement)("feComposite",{in2:"SourceGraphic",operator:"in"})))),(0,s.createElement)("style",{dangerouslySetInnerHTML:{__html:o}}))}function Wh({attributes:e,setAttributes:t}){var n;const o=null==e?void 0:e.style,r=null==o||null===(n=o.color)||void 0===n?void 0:n.duotone,l=mo("color.duotone")||Hh,i=mo("color.palette")||Hh,a=!mo("color.custom"),c=!mo("color.customDuotone")||0===(null==i?void 0:i.length)&&a;return 0===(null==l?void 0:l.length)&&c?null:(0,s.createElement)(Zn,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(Vh,{duotonePalette:l,colorPalette:i,disableCustomDuotone:c,disableCustomColors:a,value:r,onChange:e=>{const n={...o,color:{...null==o?void 0:o.color,duotone:e}};t({style:n})}}))}Lc([Ac]);const $h=(0,d.createHigherOrderComponent)((e=>t=>{const n=(0,r.hasBlockSupport)(t.name,"color.__experimentalDuotone");return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(e,t),n&&(0,s.createElement)(Wh,t))}),"withDuotoneControls"),jh=(0,d.createHigherOrderComponent)((e=>t=>{var n,o,l;const a=(0,r.getBlockSupport)(t.name,"color.__experimentalDuotone"),u=null==t||null===(n=t.attributes)||void 0===n||null===(o=n.style)||void 0===o||null===(l=o.color)||void 0===l?void 0:l.duotone;if(!a||!u)return(0,s.createElement)(e,t);const p=`wp-duotone-${(0,d.useInstanceId)(e)}`,m=function(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(", ")}(`.editor-styles-wrapper .${p}`,a),f=c()(null==t?void 0:t.className,p),h=(0,s.useContext)(nm.__unstableElementContext);return(0,s.createElement)(s.Fragment,null,h&&(0,s.createPortal)((0,s.createElement)(Gh,{selector:m,id:p,values:Uh(u)}),h),(0,s.createElement)(e,i({},t,{className:f})))}),"withDuotoneStyles");(0,l.addFilter)("blocks.registerBlockType","core/editor/duotone/add-attributes",(function(e){return(0,r.hasBlockSupport)(e,"color.__experimentalDuotone")?(e.attributes.style||Object.assign(e.attributes,{style:{type:"object"}}),e):e})),(0,l.addFilter)("editor.BlockEdit","core/editor/duotone/with-editor-controls",$h),(0,l.addFilter)("editor.BlockListBlock","core/editor/duotone/with-styles",jh);const Kh="__experimentalLayout";function qh({setAttributes:e,attributes:t,name:n}){const{layout:o}=t,l=mo("layout"),i=(0,m.useSelect)((e=>{const{getSettings:t}=e(Vn);return t().supportsLayout}),[]),a=(0,r.getBlockSupport)(n,Kh,{}),{allowSwitching:c,allowEditing:u=!0,allowInheriting:d=!0,default:f}=a;if(!u)return null;const g=o||f||{},{inherit:v=!1,type:b="default"}=g;if("default"===b&&!i)return null;const k=Io(b),_=t=>e({layout:t});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Jo,null,(0,s.createElement)(p.PanelBody,{title:(0,h.__)("Layout")},d&&!!l&&(0,s.createElement)(p.ToggleControl,{label:(0,h.__)("Inherit default layout"),checked:!!v,onChange:()=>e({layout:{inherit:!v}})}),!v&&c&&(0,s.createElement)(Yh,{type:b,onChange:t=>e({layout:{type:t}})}),!v&&k&&(0,s.createElement)(k.inspectorControls,{layout:g,onChange:_,layoutBlockSupport:a}))),!v&&k&&(0,s.createElement)(k.toolBarControls,{layout:g,onChange:_,layoutBlockSupport:a}))}function Yh({type:e,onChange:t}){return(0,s.createElement)(p.ButtonGroup,null,Bo.map((({name:n,label:o})=>(0,s.createElement)(p.Button,{key:n,isPressed:e===n,onClick:()=>t(n)},o))))}const Zh=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n}=t;return[(0,r.hasBlockSupport)(n,Kh)&&(0,s.createElement)(qh,i({key:"layout"},t)),(0,s.createElement)(e,i({key:"edit"},t))]}),"withInspectorControls"),Xh=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n,attributes:o}=t,l=(0,r.hasBlockSupport)(n,Kh),a=(0,d.useInstanceId)(e),u=mo("layout")||{},p=(0,s.useContext)(nm.__unstableElementContext),{layout:m}=o,{default:f}=(0,r.getBlockSupport)(n,Kh)||{},h=null!=m&&m.inherit?u:m||f||{},g=c()(null==t?void 0:t.className,{[`wp-container-${a}`]:l});return(0,s.createElement)(s.Fragment,null,l&&p&&(0,s.createPortal)((0,s.createElement)(Po,{selector:`.wp-container-${a}`,layout:h}),p),(0,s.createElement)(e,i({},t,{className:g})))}));(0,l.addFilter)("blocks.registerBlockType","core/layout/addAttribute",(function(e){return(0,u.has)(e.attributes,["layout","type"])||(0,r.hasBlockSupport)(e,Kh)&&(e.attributes={...e.attributes,layout:{type:"object"}}),e})),(0,l.addFilter)("editor.BlockListBlock","core/editor/layout/with-layout-styles",Xh),(0,l.addFilter)("editor.BlockEdit","core/editor/layout/with-inspector-controls",Zh);const Qh=[];function Jh({borderColor:e,style:t}){var n;const o=(null==t?void 0:t.border)||{},r=dm("border-color",e);return{className:c()({[r]:!!r,"has-border-color":e||(null==t||null===(n=t.border)||void 0===n?void 0:n.color)})||void 0,style:Lh({border:o})}}function eg(e){const t=mo("color.palette")||Qh,n=Jh(e);if(e.borderColor){const o=cm(t,e.borderColor);n.style.borderColor=o.color}return n}const tg=[];function ng(e){var t,n,o,r,l,i;const{backgroundColor:s,textColor:a,gradient:u,style:d}=e,p=dm("background-color",s),m=dm("color",a),f=Gm(u),h=f||(null==d||null===(t=d.color)||void 0===t?void 0:t.gradient);return{className:c()(m,f,{[p]:!h&&!!p,"has-text-color":a||(null==d||null===(n=d.color)||void 0===n?void 0:n.text),"has-background":s||(null==d||null===(o=d.color)||void 0===o?void 0:o.background)||u||(null==d||null===(r=d.color)||void 0===r?void 0:r.gradient),"has-link-color":null==d||null===(l=d.elements)||void 0===l||null===(i=l.link)||void 0===i?void 0:i.color})||void 0,style:Lh({color:(null==d?void 0:d.color)||{}})}}function og(e){const{backgroundColor:t,textColor:n,gradient:o}=e,r=mo("color.palette")||tg,l=mo("color.gradients")||tg,i=ng(e);if(t){const e=cm(r,t);i.style.backgroundColor=e.color}if(o&&(i.style.background=Wm(l,o)),n){const e=cm(r,n);i.style.color=e.color}return i}function rg(e){const{style:t}=e;return{style:Lh({spacing:(null==t?void 0:t.spacing)||{}})}}function lg(e){const[t,n]=(0,s.useState)(e);return(0,s.useEffect)((()=>{e&&n(e)}),[e]),t}const ig=[];function sg(e,t){const n=(0,u.reduce)(e,((e,t)=>({...e,...(0,u.isString)(t)?{[t]:(0,u.kebabCase)(t)}:t})),{});return(0,d.compose)([t,e=>class extends s.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=Mc(t);return(0,u.maxBy)(e,(({color:e})=>n.contrast(e))).color}(t,e)}createSetters(){return(0,u.reduce)(n,((e,t,n)=>{const o=(0,u.upperFirst)(n),r=`custom${o}`;return e[`set${o}`]=this.createSetColor(n,r),e}),{})}createSetColor(e,t){return n=>{const o=um(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},o){return(0,u.reduce)(n,((n,r,l)=>{const i=cm(t,e[l],e[`custom${(0,u.upperFirst)(l)}`]),s=o[l];return(null==s?void 0:s.color)===i.color&&s?n[l]=s:n[l]={...i,class:dm(r,i.slug)},n}),{})}render(){return(0,s.createElement)(e,i({},this.props,{colors:void 0},this.state,this.setters,{colorUtils:this.colorUtils}))}}])}function ag(e){return(...t)=>{const n=(e=>(0,d.createHigherOrderComponent)((t=>n=>(0,s.createElement)(t,i({},n,{colors:e}))),"withCustomColorPalette"))(e);return(0,d.createHigherOrderComponent)(sg(t,n),"withCustomColors")}}function cg(...e){const t=(0,d.createHigherOrderComponent)((e=>t=>{const n=mo("color.palette")||ig;return(0,s.createElement)(e,i({},t,{colors:n}))}),"withEditorColorPalette");return(0,d.createHigherOrderComponent)(sg(e,t),"withColors")}const ug=[];var dg=(...e)=>{const t=(0,u.reduce)(e,((e,t)=>(e[t]=`custom${(0,u.upperFirst)(t)}`,e)),{});return(0,d.createHigherOrderComponent)((0,d.compose)([(0,d.createHigherOrderComponent)((e=>t=>{const n=mo("typography.fontSizes")||ug;return(0,s.createElement)(e,i({},t,{fontSizes:n}))}),"withFontSizes"),e=>class extends s.Component{constructor(e){super(e),this.setters=this.createSetters(),this.state={}}createSetters(){return(0,u.reduce)(t,((e,t,n)=>(e[`set${(0,u.upperFirst)(n)}`]=this.createSetFontSize(n,t),e)),{})}createSetFontSize(e,t){return n=>{const o=(0,u.find)(this.props.fontSizes,{size: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(!(0,u.some)(t,r))return null;const l=(0,u.reduce)((0,u.pickBy)(t,r),((t,o,r)=>{const l=e[r],i=Df(n,l,e[o]);return t[r]={...i,class:Ff(l)},t}),{});return{...o,...l}}render(){return(0,s.createElement)(e,i({},this.props,{fontSizes:void 0},this.state,this.setters))}}]),"withFontSizes")},pg=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z"})),mg=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M16.4 4.2H7.6v1.5h8.9V4.2zM4 11.2v1.5h16v-1.5H4zm3.6 8.6h8.9v-1.5H7.6v1.5z"})),fg=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z"}));const hg=[{icon:pg,title:(0,h.__)("Align text left"),align:"left"},{icon:mg,title:(0,h.__)("Align text center"),align:"center"},{icon:fg,title:(0,h.__)("Align text right"),align:"right"}],gg={position:"bottom right",isAlternate:!0};var vg=function({value:e,onChange:t,alignmentControls:n=hg,label:o=(0,h.__)("Align"),describedBy:r=(0,h.__)("Change text alignment"),isCollapsed:l=!0,isToolbar:a}){function c(n){return()=>t(e===n?void 0:n)}const d=(0,u.find)(n,(t=>t.align===e)),m=a?p.ToolbarGroup:p.ToolbarDropdownMenu,f=a?{isCollapsed:l}:{};return(0,s.createElement)(m,i({icon:d?d.icon:(0,h.isRTL)()?fg:pg,label:o,toggleProps:{describedBy:r},popoverProps:gg,controls:n.map((t=>{const{align:n}=t,o=e===n;return{...t,isActive:o,role:l?"menuitemradio":void 0,onClick:c(n)}}))},f))};function bg(e){return(0,s.createElement)(vg,i({},e,{isToolbar:!1}))}function kg(e){return(0,s.createElement)(vg,i({},e,{isToolbar:!0}))}var _g={name:"blocks",className:"block-editor-autocompleters__block",triggerPrefix:"/",useItems(e){const{rootClientId:t,selectedBlockName:n}=(0,m.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockName:n,getBlockInsertionPoint:o}=e(Vn),r=t();return{selectedBlockName:r?n(r):null,rootClientId:o().rootClientId}}),[]),[o,r,l]=yu(t,u.noop),i=(0,s.useMemo)((()=>(e.trim()?Wu(o,r,l,e):(0,u.orderBy)(o,["frecency"],["desc"])).filter((e=>e.name!==n)).slice(0,9)),[e,n,o,r,l]);return[(0,s.useMemo)((()=>i.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)(Ha,{key:"icon",icon:n,showColors:!0}),t),isDisabled:o}}))),[i])]},allowContext:(e,t)=>!(/\S/.test(e)||/\S/.test(t)),getOptionCompletion(e){const{name:t,initialAttributes:n,innerBlocks:o}=e;return{action:"replace",value:(0,r.createBlock)(t,n,(0,r.createBlocksFromInnerBlocksTemplate)(o))}}};const yg=[];function Eg({completers:e=yg}){const{name:t}=Wn();return(0,s.useMemo)((()=>{let n=e;return(t===(0,r.getDefaultBlockName)()||(0,r.getBlockSupport)(t,"__experimentalSlashInserter",!1))&&(n=n.concat([_g])),(0,l.hasFilter)("editor.Autocomplete.completers")&&(n===e&&(n=n.map(u.clone)),n=(0,l.applyFilters)("editor.Autocomplete.completers",n,t)),n}),[e,t])}var Cg=function(e){return(0,s.createElement)(p.Autocomplete,i({},e,{completers:Eg(e)}))},wg=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M4.2 9h1.5V5.8H9V4.2H4.2V9zm14 9.2H15v1.5h4.8V15h-1.5v3.2zM15 4.2v1.5h3.2V9h1.5V4.2H15zM5.8 15H4.2v4.8H9v-1.5H5.8V15z"})),Sg=function({isActive:e,label:t=(0,h.__)("Toggle full height"),onToggle:n,isDisabled:o}){return(0,s.createElement)(p.ToolbarButton,{isActive:e,icon:wg,label:t,onClick:()=>n(!e),disabled:o})},Bg=function(e){const{label:t=(0,h.__)("Change matrix alignment"),onChange:n=u.noop,value:o="center",isDisabled:r}=e,l=(0,s.createElement)(p.__experimentalAlignmentMatrixControl.Icon,{value:o}),i="block-editor-block-alignment-matrix-control",a=`${i}__popover`;return(0,s.createElement)(p.Dropdown,{position:"bottom right",className:i,popoverProps:{className:a,isAlternate:!0},renderToggle:({onToggle:e,isOpen:n})=>(0,s.createElement)(p.ToolbarButton,{onClick:e,"aria-haspopup":"true","aria-expanded":n,onKeyDown:t=>{n||t.keyCode!==ga.DOWN||(t.preventDefault(),e())},label:t,icon:l,showTooltip:!0,disabled:r}),renderContent:()=>(0,s.createElement)(p.__experimentalAlignmentMatrixControl,{hasFocusBorder:!1,onChange:n,value:o})})},Ig=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"})),xg=function({rootLabelText:e}){const{selectBlock:t,clearSelectedBlock:n}=(0,m.useDispatch)(Vn),{clientId:o,parents:r,hasSelection:l}=(0,m.useSelect)((e=>{const{getSelectionStart:t,getSelectedBlockClientId:n,getBlockParents:o}=e(Vn),r=n();return{parents:o(r),clientId:r,hasSelection:!!t().clientId}}),[]),i=e||(0,h.__)("Document");return(0,s.createElement)("ul",{className:"block-editor-block-breadcrumb",role:"list","aria-label":(0,h.__)("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)(p.Button,{className:"block-editor-block-breadcrumb__button",variant:"tertiary",onClick:n},i),!l&&i,!!o&&(0,s.createElement)(So,{icon:Ig,className:"block-editor-block-breadcrumb__separator"})),r.map((e=>(0,s.createElement)("li",{key:e},(0,s.createElement)(p.Button,{className:"block-editor-block-breadcrumb__button",variant:"tertiary",onClick:()=>t(e)},(0,s.createElement)(Td,{clientId:e})),(0,s.createElement)(So,{icon:Ig,className:"block-editor-block-breadcrumb__separator"})))),!!o&&(0,s.createElement)("li",{className:"block-editor-block-breadcrumb__current","aria-current":"true"},(0,s.createElement)(Td,{clientId:o})))};function Tg({clientId:e,tagName:t="div",wrapperProps:n,className:o}){const[r,l]=(0,s.useState)(!0),[a,u]=(0,s.useState)(!1),{isParentSelected:d,hasChildSelected:p,isDraggingBlocks:f,isParentHighlighted:h}=(0,m.useSelect)((t=>{const{isBlockSelected:n,hasSelectedInnerBlock:o,isDraggingBlocks:r,isBlockHighlighted:l}=t(Vn);return{isParentSelected:n(e),hasChildSelected:o(e,!0),isDraggingBlocks:r(),isParentHighlighted:l(e)}}),[e]),g=c()("block-editor-block-content-overlay",null==n?void 0:n.className,o,{"overlay-active":r,"parent-highlighted":h,"is-dragging-blocks":f});return(0,s.useEffect)((()=>{d||p||r||l(!0),d&&!a&&r&&l(!1),p&&r&&l(!1)}),[d,p,r,a]),(0,s.createElement)(t,i({},n,{className:g,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onMouseUp:r?()=>l(!1):void 0}),null==n?void 0:n.children)}const Ng=()=>(0,s.createElement)(p.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 20 20"},(0,s.createElement)(p.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"})),Pg=({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)(Ng,null))),Mg=({TextColor:e,BackgroundColor:t})=>({onToggle:n,isOpen:o})=>(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(p.ToolbarButton,{className:"components-toolbar__control block-library-colors-selector__toggle",label:(0,h.__)("Open Colors Selector"),onClick:n,onKeyDown:e=>{o||e.keyCode!==ga.DOWN||(e.preventDefault(),n())},icon:(0,s.createElement)(t,null,(0,s.createElement)(e,null,(0,s.createElement)(Pg,null)))}));var Rg=({children:e,...t})=>(0,s.createElement)(p.Dropdown,{position:"bottom right",className:"block-library-colors-selector",contentClassName:"block-library-colors-selector__popover",renderToggle:Mg(t),renderContent:()=>e}),Lg=(0,s.createElement)(F.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(F.Path,{d:"M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"}));const Ag=ta(p.__experimentalTreeGridRow);function Dg({isSelected:e,position:t,level:n,rowCount:o,children:r,className:l,path:a,...u}){const d=ra({isSelected:e,adjustScrolling:!1,enableAnimation:!0,triggerAnimationOnChange:a});return(0,s.createElement)(Ag,i({ref:d,className:c()("block-editor-list-view-leaf",l),level:n,positionInSet:t,setSize:o},u),r)}function Og({onClick:e}){return(0,s.createElement)("span",{className:"block-editor-list-view__expander",onClick:t=>e(t,{forceToggle:!0}),"aria-hidden":"true"},(0,s.createElement)(So,{icon:Ig}))}var Fg=(0,s.forwardRef)((function e({className:t,block:{clientId:n},isSelected:o,onClick:r,onToggleExpanded:l,position:i,siblingBlockCount:a,level:u,tabIndex:m,onFocus:f,onDragStart:g,onDragEnd:v,draggable:b},k){const _=xd(n),y=`list-view-block-select-button__${(0,d.useInstanceId)(e)}`,E=((e,t,n)=>(0,h.sprintf)(
|
| 67 |
/* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */
|
| 68 |
+
(0,h.__)("Block %1$d of %2$d, Level %3$d"),e,t,n))(i,a,u);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.Button,{className:c()("block-editor-list-view-block-select-button",t),onClick:r,"aria-describedby":y,ref:k,tabIndex:m,onFocus:f,onDragStart:g,onDragEnd:v,draggable:b},(0,s.createElement)(Og,{onClick:l}),(0,s.createElement)(Ha,{icon:null==_?void 0:_.icon,showColors:!0}),(0,s.createElement)(Td,{clientId:n}),(null==_?void 0:_.anchor)&&(0,s.createElement)("span",{className:"block-editor-list-view-block-select-button__anchor"},_.anchor),o&&(0,s.createElement)(p.VisuallyHidden,null,(0,h.__)("(selected block)"))),(0,s.createElement)("div",{className:"block-editor-list-view-block-select-button__description",id:y},E))})),zg=(0,s.forwardRef)((({onClick:e,onToggleExpanded:t,block:n,isSelected:o,position:r,siblingBlockCount:l,level:a,...u},d)=>{const{clientId:p}=n,{blockMovingClientId:f,selectedBlockInBlockEditor:h}=(0,m.useSelect)((e=>{const{getBlockRootClientId:t,hasBlockMovingClientId:n,getSelectedBlockClientId:o}=e(Vn);return{rootClientId:t(p)||"",blockMovingClientId:n(),selectedBlockInBlockEditor:o()}}),[p]),g=f&&h===p,v=c()("block-editor-list-view-block-contents",{"is-dropping-before":g});return(0,s.createElement)(Nd,{clientIds:[n.clientId]},(({draggable:c,onDragStart:p,onDragEnd:m})=>(0,s.createElement)(Fg,i({ref:d,className:v,block:n,onClick:e,onToggleExpanded:t,isSelected:o,position:r,siblingBlockCount:l,level:a,draggable:c,onDragStart:p,onDragEnd:m},u))))}));const Vg=(0,s.createContext)({__experimentalFeatures:!1,__experimentalPersistentListViewFeatures:!1}),Hg=()=>(0,s.useContext)(Vg);var Ug=(0,s.memo)((function({block:e,isDragged:t,isSelected:n,isBranchSelected:o,selectBlock:r,position:l,level:i,rowCount:a,siblingBlockCount:u,showBlockMovers:d,path:f,isExpanded:h}){const g=(0,s.useRef)(null),[v,b]=(0,s.useState)(!1),{clientId:k}=e,{toggleBlockHighlight:_}=(0,m.useDispatch)(Vn),{__experimentalFeatures:y,__experimentalPersistentListViewFeatures:E,__experimentalHideContainerBlockActions:C,isTreeGridMounted:w,expand:S,collapse:B}=Hg(),I=d&&u>0,x=c()("block-editor-list-view-block__mover-cell",{"is-visible":v||n}),T=c()("block-editor-list-view-block__menu-cell",{"is-visible":v||n});(0,s.useEffect)((()=>{E&&!w&&n&&g.current.focus()}),[]);const N=E?_:()=>{},P=(0,s.useCallback)((()=>{b(!0),N(k,!0)}),[k,b,N]),M=(0,s.useCallback)((()=>{b(!1),N(k,!1)}),[k,b,N]),R=(0,s.useCallback)((e=>{e.stopPropagation(),r(k)}),[k,r]),L=(0,s.useCallback)((e=>{e.stopPropagation(),!0===h?B(k):!1===h&&S(k)}),[k,S,B,h]),A=y&&(!C||C&&i>1),D=y&&!A;let O;I?O=2:D&&(O=3);const F=c()({"is-selected":n,"is-branch-selected":E&&o,"is-dragging":t,"has-single-cell":D});return(0,s.createElement)(Dg,{className:F,onMouseEnter:P,onMouseLeave:M,onFocus:P,onBlur:M,level:i,position:l,rowCount:a,path:f,id:`list-view-block-${k}`,"data-block":k,isExpanded:h},(0,s.createElement)(p.__experimentalTreeGridCell,{className:"block-editor-list-view-block__contents-cell",colSpan:O,ref:g},(({ref:t,tabIndex:o,onFocus:r})=>(0,s.createElement)("div",{className:"block-editor-list-view-block__contents-container"},(0,s.createElement)(zg,{block:e,onClick:R,onToggleExpanded:L,isSelected:n,position:l,siblingBlockCount:u,level:i,ref:t,tabIndex:o,onFocus:r})))),I&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.__experimentalTreeGridCell,{className:x,withoutGridItem:!0},(0,s.createElement)(p.__experimentalTreeGridItem,null,(({ref:e,tabIndex:t,onFocus:n})=>(0,s.createElement)(Hd,{orientation:"vertical",clientIds:[k],ref:e,tabIndex:t,onFocus:n}))),(0,s.createElement)(p.__experimentalTreeGridItem,null,(({ref:e,tabIndex:t,onFocus:n})=>(0,s.createElement)(Ud,{orientation:"vertical",clientIds:[k],ref:e,tabIndex:t,onFocus:n}))))),A&&(0,s.createElement)(p.__experimentalTreeGridCell,{className:T},(({ref:e,tabIndex:t,onFocus:n})=>(0,s.createElement)(Np,{clientIds:[k],icon:pp,toggleProps:{ref:e,className:"block-editor-list-view-block__menu",tabIndex:t,onFocus:n},disableOpenOnArrowDown:!0,__experimentalSelectBlock:R}))))}));function Gg(e,t,n){var o;return(null==n?void 0:n.includes(e.clientId))?0:null===(o=t[e.clientId])||void 0===o||o?1+e.innerBlocks.reduce(Wg(t,n),0):1}const Wg=(e,t)=>(n,o)=>{var r;return(null==t?void 0:t.includes(o.clientId))?n:(null===(r=e[o.clientId])||void 0===r||r)&&o.innerBlocks.length>0?n+Gg(o,e,t):n+1};function $g(e){const{blocks:t,selectBlock:n,showBlockMovers:o,showNestedBlocks:r,selectedClientIds:l,level:i=1,path:a="",isBranchSelected:c=!1,listPosition:d=0,fixedListWindow:p}=e,{expandedState:f,draggedClientIds:h,__experimentalPersistentListViewFeatures:g}=Hg(),v=(0,u.compact)(t),b=v.length;let k=d;return(0,s.createElement)(s.Fragment,null,v.map(((e,t)=>{var d;const{clientId:_,innerBlocks:y}=e;t>0&&(k+=Gg(v[t-1],f,h));const E=g,{itemInView:C}=p,w=!E||C(k),S=t+1,B=a.length>0?`${a}_${S}`:`${S}`,I=r&&!!y&&!!y.length,x=I?null===(d=f[_])||void 0===d||d:void 0,T=!(null==h||!h.includes(_)),N=T||w,P=((e,t)=>(0,u.isArray)(t)&&t.length?-1!==t.indexOf(e):t===e)(_,l),M=c||P&&I;return(0,s.createElement)(m.AsyncModeProvider,{key:_,value:!P},N&&(0,s.createElement)(Ug,{block:e,selectBlock:n,isSelected:P,isBranchSelected:M,isDragged:T,level:i,position:S,rowCount:b,siblingBlockCount:b,showBlockMovers:o,path:B,isExpanded:x,listPosition:k}),!N&&(0,s.createElement)("tr",null,(0,s.createElement)("td",{className:"block-editor-list-view-placeholder"})),I&&x&&!T&&(0,s.createElement)($g,{blocks:y,selectBlock:n,showBlockMovers:o,showNestedBlocks:r,level:i+1,path:B,listPosition:k+1,fixedListWindow:p,isBranchSelected:M,selectedClientIds:l}))})))}$g.defaultProps={selectBlock:()=>{}};var jg=(0,s.memo)($g);function Kg({listViewRef:e,blockDropTarget:t}){const{rootClientId:n,clientId:o,dropPosition:r}=t||{},[l,i]=(0,s.useMemo)((()=>e.current?[n?e.current.querySelector(`[data-block="${n}"]`):void 0,o?e.current.querySelector(`[data-block="${o}"]`):void 0]:[]),[n,o]),a=i||l,c=(0,s.useCallback)((()=>{if(!l)return 0;const e=a.getBoundingClientRect();return l.querySelector(".block-editor-block-icon").getBoundingClientRect().right-e.left}),[l,a]),u=(0,s.useMemo)((()=>{if(!a)return{};const e=c();return{width:a.offsetWidth-e}}),[c,a]),d=(0,s.useCallback)((()=>{if(!a)return{};const e=a.ownerDocument,t=a.getBoundingClientRect(),n=c(),o={left:t.left+n,right:t.right,width:0,height:t.height,ownerDocument:e};return"top"===r?{...o,top:t.top,bottom:t.top}:"bottom"===r||"inside"===r?{...o,top:t.bottom,bottom:t.bottom}:{}}),[a,r,c]);return a?(0,s.createElement)(p.Popover,{noArrow:!0,animate:!1,getAnchorRect:d,focusOnMount:!1,className:"block-editor-list-view-drop-indicator"},(0,s.createElement)("div",{style:u,className:"block-editor-list-view-drop-indicator__line"})):null}function qg(e,t){return t.left<=e.x&&t.right>=e.x&&t.top<=e.y&&t.bottom>=e.y}const Yg=["top","bottom"];const Zg=()=>{},Xg=(e,t)=>{switch(t.type){case"expand":return{...e,[t.clientId]:!0};case"collapse":return{...e,[t.clientId]:!1};default:return e}};var Qg=(0,s.forwardRef)((function({blocks:e,onSelect:t=Zg,__experimentalFeatures:n,__experimentalPersistentListViewFeatures:o,__experimentalHideContainerBlockActions:r,showNestedBlocks:l,showBlockMovers:a,...c},u){const{clientIdsTree:f,draggedClientIds:g,selectedClientIds:v}=function(e){return(0,m.useSelect)((t=>{const{getDraggedBlockClientIds:n,getSelectedBlockClientIds:o,__unstableGetClientIdsTree:r}=t(Vn);return{selectedClientIds:o(),draggedClientIds:n(),clientIdsTree:e||r()}}),[e])}(e),{selectBlock:b}=(0,m.useDispatch)(Vn),{visibleBlockCount:k}=(0,m.useSelect)((e=>{const{getGlobalBlockCount:t,getClientIdsOfDescendants:n}=e(Vn),o=(null==g?void 0:g.length)>0?n(g).length+1:0;return{visibleBlockCount:t()-o}}),[g]),_=(0,s.useCallback)((e=>{b(e),t(e)}),[b,t]),[y,E]=(0,s.useReducer)(Xg,{}),{ref:C,target:w}=function(){const{getBlockRootClientId:e,getBlockIndex:t,getBlockCount:n,getDraggedBlockClientIds:o,canInsertBlocks:r}=(0,m.useSelect)(Vn),[l,i]=(0,s.useState)(),{rootClientId:a,blockIndex:c}=l||{},u=$p(a,c),p=o(),f=(0,d.useThrottle)((0,s.useCallback)(((o,l)=>{const s={x:o.clientX,y:o.clientY},a=!(null==p||!p.length),c=function(e,t){let n,o,r,l;for(const i of e){if(i.isDraggedBlock)continue;const s=i.element.getBoundingClientRect(),[a,c]=jp(t,s,Yg),u=qg(t,s);if(void 0===r||a<r||u){r=a;const t=e.indexOf(i),d=e[t-1];if("top"===c&&d&&d.rootClientId===i.rootClientId&&!d.isDraggedBlock?(o=d,n="bottom",l=d.element.getBoundingClientRect()):(o=i,n=c,l=s),u)break}}if(!o)return;const i="bottom"===n;if(i&&o.canInsertDraggedBlocksAsChild&&(o.innerBlockCount>0||function(e,t){const n=t.left+t.width/2;return e.x>n}(t,l)))return{rootClientId:o.clientId,blockIndex:0,dropPosition:"inside"};if(!o.canInsertDraggedBlocksAsSibling)return;const s=i?1:0;return{rootClientId:o.rootClientId,clientId:o.clientId,blockIndex:o.blockIndex+s,dropPosition:n}}(Array.from(l.querySelectorAll("[data-block]")).map((o=>{const l=o.dataset.block,i=e(l);return{clientId:l,rootClientId:i,blockIndex:t(l,i),element:o,isDraggedBlock:!!a&&p.includes(l),innerBlockCount:n(l),canInsertDraggedBlocksAsSibling:!a||r(p,i),canInsertDraggedBlocksAsChild:!a||r(p,l)}})),s);c&&i(c)}),[p]),200);return{ref:(0,d.__experimentalUseDropZone)({onDrop:u,onDragOver(e){f(e,e.currentTarget)},onDragEnd(){f.cancel(),i(null)}}),target:l}}(),S=(0,s.useRef)(),B=(0,d.useMergeRefs)([S,C,u]),I=(0,s.useRef)(!1);(0,s.useEffect)((()=>{I.current=!0}),[]);const[x]=(0,d.__experimentalUseFixedWindowList)(S,36,k,{useWindowing:o,windowOverscan:40}),T=(0,s.useCallback)((e=>{e&&E({type:"expand",clientId:e})}),[E]),N=(0,s.useCallback)((e=>{e&&E({type:"collapse",clientId:e})}),[E]),P=(0,s.useCallback)((e=>{var t;T(null==e||null===(t=e.dataset)||void 0===t?void 0:t.block)}),[T]),M=(0,s.useCallback)((e=>{var t;N(null==e||null===(t=e.dataset)||void 0===t?void 0:t.block)}),[N]),R=(0,s.useMemo)((()=>({__experimentalFeatures:n,__experimentalPersistentListViewFeatures:o,__experimentalHideContainerBlockActions:r,isTreeGridMounted:I.current,draggedClientIds:g,expandedState:y,expand:T,collapse:N})),[n,o,r,I.current,g,y,T,N]);return(0,s.createElement)(m.AsyncModeProvider,{value:!0},(0,s.createElement)(Kg,{listViewRef:S,blockDropTarget:w}),(0,s.createElement)(p.__experimentalTreeGrid,{className:"block-editor-list-view-tree","aria-label":(0,h.__)("Block navigation structure"),ref:B,onCollapseRow:M,onExpandRow:P},(0,s.createElement)(Vg.Provider,{value:R},(0,s.createElement)(jg,i({blocks:f,selectBlock:_,showNestedBlocks:l,showBlockMovers:a,fixedListWindow:x,selectedClientIds:v},c)))))}));function Jg({isEnabled:e,onToggle:t,isOpen:n,innerRef:o,...r}){return(0,s.createElement)(p.Button,i({},r,{ref:o,icon:Lg,"aria-expanded":n,"aria-haspopup":"true",onClick:e?t:void 0
|
| 69 |
+
/* translators: button label text should, if possible, be under 16 characters. */,label:(0,h.__)("List view"),className:"block-editor-block-navigation","aria-disabled":!e}))}var ev=(0,s.forwardRef)((function({isDisabled:e,__experimentalFeatures:t,...n},o){const r=(0,m.useSelect)((e=>!!e(Vn).getBlockCount()),[])&&!e;return(0,s.createElement)(p.Dropdown,{contentClassName:"block-editor-block-navigation__popover",position:"bottom right",renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(Jg,i({},n,{innerRef:o,isOpen:e,onToggle:t,isEnabled:r})),renderContent:()=>(0,s.createElement)("div",{className:"block-editor-block-navigation__container"},(0,s.createElement)("p",{className:"block-editor-block-navigation__label"},(0,h.__)("List view")),(0,s.createElement)(Qg,{showNestedBlocks:!0,__experimentalFeatures:t}))})})),tv=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),nv=function({icon:e=tv,label:t=(0,h.__)("Choose variation"),instructions:n=(0,h.__)("Select a variation to start with."),variations:o,onSelect:r,allowSkip:l}){const i=c()("block-editor-block-variation-picker",{"has-many-variations":o.length>4});return(0,s.createElement)(p.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,h.__)("Block variations")},o.map((e=>(0,s.createElement)("li",{key:e.name},(0,s.createElement)(p.Button,{variant:"secondary",icon: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",role:"presentation"},e.title))))),l&&(0,s.createElement)("div",{className:"block-editor-block-variation-picker__skip"},(0,s.createElement)(p.Button,{variant:"link",onClick:()=>r()},(0,h.__)("Skip"))))},ov=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z",fillRule:"evenodd",clipRule:"evenodd"}));const rv="carousel",lv="grid",iv=({onStartBlank:e,onBlockPatternSelect:t})=>(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__actions"},(0,s.createElement)(p.Button,{onClick:e},(0,h.__)("Start blank")),(0,s.createElement)(p.Button,{variant:"primary",onClick:t},(0,h.__)("Choose"))),sv=({handlePrevious:e,handleNext:t,activeSlide:n,totalSlides:o})=>(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__navigation"},(0,s.createElement)(p.Button,{icon:Ad,label:(0,h.__)("Previous pattern"),onClick:e,disabled:0===n}),(0,s.createElement)(p.Button,{icon:Ld,label:(0,h.__)("Next pattern"),onClick:t,disabled:n===o-1}));var av=({viewMode:e,setViewMode:t,handlePrevious:n,handleNext:o,activeSlide:r,totalSlides:l,onBlockPatternSelect:i,onStartBlank:a})=>{const c=e===rv,u=(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__display-controls"},(0,s.createElement)(p.Button,{icon:no,label:(0,h.__)("Carousel view"),onClick:()=>t(rv),isPressed:c}),(0,s.createElement)(p.Button,{icon:ov,label:(0,h.__)("Grid view"),onClick:()=>t(lv),isPressed:e===lv}));return(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__toolbar"},c&&(0,s.createElement)(sv,{handlePrevious:n,handleNext:o,activeSlide:r,totalSlides:l}),u,c&&(0,s.createElement)(iv,{onBlockPatternSelect:i,onStartBlank:a}))};const cv=({viewMode:e,activeSlide:t,patterns:n,onBlockPatternSelect:o})=>{const r=(0,p.__unstableUseCompositeState)(),l="block-editor-block-pattern-setup__container";if(e===rv){const e=new Map([[t,"active-slide"],[t-1,"previous-slide"],[t+1,"next-slide"]]);return(0,s.createElement)("div",{className:l},(0,s.createElement)("ul",{className:"carousel-container"},n.map(((t,n)=>(0,s.createElement)(dv,{className:e.get(n)||"",key:t.name,pattern:t})))))}return(0,s.createElement)(p.__unstableComposite,i({},r,{role:"listbox",className:l,"aria-label":(0,h.__)("Patterns list")}),n.map((e=>(0,s.createElement)(uv,{key:e.name,pattern:e,onSelect:o,composite:r}))))};function uv({pattern:e,onSelect:t,composite:n}){const o="block-editor-block-pattern-setup-list",{blocks:r,title:l,description:a,viewportWidth:c=700}=e,u=(0,d.useInstanceId)(uv,`${o}__item-description`);return(0,s.createElement)("div",{className:`${o}__list-item`,"aria-label":e.title,"aria-describedby":e.description?u:void 0},(0,s.createElement)(p.__unstableCompositeItem,i({role:"option",as:"div"},n,{className:`${o}__item`,onClick:()=>t(r)}),(0,s.createElement)(au,{blocks:r,viewportWidth:c}),(0,s.createElement)("div",{className:`${o}__item-title`},l)),!!a&&(0,s.createElement)(p.VisuallyHidden,{id:u},a))}function dv({className:e,pattern:t}){const{blocks:n,title:o,description:r}=t,l=(0,d.useInstanceId)(dv,"block-editor-block-pattern-setup-list__item-description");return(0,s.createElement)("li",{className:`pattern-slide ${e}`,"aria-label":o,"aria-describedby":r?l:void 0},(0,s.createElement)(au,{blocks:n,__experimentalLive:!0}),!!r&&(0,s.createElement)(p.VisuallyHidden,{id:l},r))}var pv=({clientId:e,blockName:t,filterPatternsFn:n,startBlankComponent:o,onBlockPatternSelect:l})=>{const[i,a]=(0,s.useState)(rv),[c,u]=(0,s.useState)(0),[d,p]=(0,s.useState)(!1),{replaceBlock:f}=(0,m.useDispatch)(Vn),h=function(e,t,n){return(0,m.useSelect)((o=>{const{getBlockRootClientId:r,__experimentalGetPatternsByBlockTypes:l,__experimentalGetAllowedPatterns:i}=o(Vn),s=r(e);return n?i(s).filter(n):l(t,s)}),[e,t,n])}(e,t,n);if(null==h||!h.length||d)return o;const g=l||(t=>{const n=t.map((e=>(0,r.cloneBlock)(e)));f(e,n)});return(0,s.createElement)("div",{className:`block-editor-block-pattern-setup view-mode-${i}`},(0,s.createElement)(av,{viewMode:i,setViewMode:a,activeSlide:c,totalSlides:h.length,handleNext:()=>{u((e=>e+1))},handlePrevious:()=>{u((e=>e-1))},onBlockPatternSelect:()=>{g(h[c].blocks)},onStartBlank:()=>{p(!0)}}),(0,s.createElement)(cv,{viewMode:i,activeSlide:c,patterns:h,onBlockPatternSelect:g}))};const mv=(e,t)=>{if(!t||!e)return;const n=t.filter((({attributes:t})=>!(!t||!Object.keys(t).length)&&(0,u.isMatch)(e,t)));return 1===n.length?n[0]:void 0};var fv=function({blockClientId:e}){const[t,n]=(0,s.useState)(),{updateBlockAttributes:o}=(0,m.useDispatch)(Vn),{variations:l,blockAttributes:i}=(0,m.useSelect)((t=>{const{getBlockVariations:n}=t(r.store),{getBlockName:o,getBlockAttributes:l}=t(Vn),i=e&&o(e);return{variations:i&&n(i,"transform"),blockAttributes:l(e)}}),[e]);if((0,s.useEffect)((()=>{var e;n(null===(e=mv(i,l))||void 0===e?void 0:e.name)}),[i,l]),null==l||!l.length)return null;const a=l.map((({name:e,title:t,description:n})=>({value:e,label:t,info:n}))),c=t=>{o(e,{...l.find((({name:e})=>e===t)).attributes})},u="block-editor-block-variation-transforms";return(0,s.createElement)(p.DropdownMenu,{className:u,label:(0,h.__)("Transform to variation"),text:(0,h.__)("Transform to variation"),popoverProps:{position:"bottom center",className:`${u}__popover`},icon:Od,toggleProps:{iconPosition:"right"}},(()=>(0,s.createElement)("div",{className:`${u}__container`},(0,s.createElement)(p.MenuGroup,null,(0,s.createElement)(p.MenuItemsChoice,{choices:a,value:t,onSelect:c})))))};const hv=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z"})),gv=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z"})),vv={top:{icon:(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M9 20h6V9H9v11zM4 4v1.5h16V4H4z"})),title:(0,h._x)("Align top","Block vertical alignment setting")},center:{icon:gv,title:(0,h._x)("Align middle","Block vertical alignment setting")},bottom:{icon:hv,title:(0,h._x)("Align bottom","Block vertical alignment setting")}},bv=["top","center","bottom"],kv={isAlternate:!0};var _v=function({value:e,onChange:t,controls:n=bv,isCollapsed:o=!0,isToolbar:r}){const l=vv[e],a=vv.top,c=r?p.ToolbarGroup:p.ToolbarDropdownMenu,u=r?{isCollapsed:o}:{};return(0,s.createElement)(c,i({popoverProps:kv,icon:l?l.icon:a.icon,label:(0,h._x)("Change vertical alignment","Block vertical alignment setting label"),controls:n.map((n=>{return{...vv[n],isActive:e===n,role:o?"menuitemradio":void 0,onClick:(r=n,()=>t(e===r?void 0:r))};var r}))},u))};function yv(e){return(0,s.createElement)(_v,i({},e,{isToolbar:!1}))}function Ev(e){return(0,s.createElement)(_v,i({},e,{isToolbar:!0}))}var Cv=(0,d.createHigherOrderComponent)((e=>t=>{const n=mo("color.palette"),o=!mo("color.custom"),r=void 0===t.colors?n:t.colors,l=void 0===t.disableCustomColors?o:t.disableCustomColors,a=!(0,u.isEmpty)(r)||!l;return(0,s.createElement)(e,i({},t,{colors:r,disableCustomColors:l,hasColorsToChoose:a}))}),"withColorContext"),wv=Cv(p.ColorPalette);function Sv({onChange:e,value:t,...n}){return(0,s.createElement)(am,i({},n,{onColorChange:e,colorValue:t,gradients:[],disableCustomGradients:!0}))}var Bv=function(e,t){return(Bv=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])})(e,t)},Iv=function(){return(Iv=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}).apply(this,arguments)};function xv(e,t,n,o){void 0===o&&(o=0);var r=zv(e,t,o),l=r.width,i=r.height;return e>=t*n&&l>t*n?{width:t*n,height:t}:l>t*n?{width:e,height:e/n}:l>i*n?{width:i*n,height:i}:{width:l,height:l/n}}function Tv(e,t,n,o,r){void 0===r&&(r=0);var l=zv(t.width,t.height,r),i=l.width,s=l.height;return{x:Nv(e.x,i,n.width,o),y:Nv(e.y,s,n.height,o)}}function Nv(e,t,n,o){var r=t*o/2-n/2;return Math.min(r,Math.max(e,-r))}function Pv(e,t){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function Mv(e,t){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI}function Rv(e,t,n,o,r,l,i){void 0===l&&(l=0),void 0===i&&(i=!0);var s=i&&0===l?Lv:Av,a={x:s(100,((t.width-n.width/r)/2-e.x/r)/t.width*100),y:s(100,((t.height-n.height/r)/2-e.y/r)/t.height*100),width:s(100,n.width/t.width*100/r),height:s(100,n.height/t.height*100/r)},c=Math.round(s(t.naturalWidth,a.width*t.naturalWidth/100)),u=Math.round(s(t.naturalHeight,a.height*t.naturalHeight/100)),d=t.naturalWidth>=t.naturalHeight*o?{width:Math.round(u*o),height:u}:{width:c,height:Math.round(c/o)};return{croppedAreaPercentages:a,croppedAreaPixels:Iv(Iv({},d),{x:Math.round(s(t.naturalWidth-d.width,a.x*t.naturalWidth/100)),y:Math.round(s(t.naturalHeight-d.height,a.y*t.naturalHeight/100))})}}function Lv(e,t){return Math.min(e,Math.max(0,t))}function Av(e,t){return t}function Dv(e,t,n){var o=t.width/t.naturalWidth,r=function(e,t,n){var o=t.width/t.naturalWidth;if(n)return n.height>n.width?n.height/o/e.height:n.width/o/e.width;var r=e.width/e.height;return t.naturalWidth>=t.naturalHeight*r?t.naturalHeight/e.height:t.naturalWidth/e.width}(e,t,n),l=o*r;return{crop:{x:((t.naturalWidth-e.width)/2-e.x)*l,y:((t.naturalHeight-e.height)/2-e.y)*l},zoom:r}}function Ov(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function Fv(e,t,n,o,r){var l=Math.cos,i=Math.sin,s=r*Math.PI/180;return[(e-n)*l(s)-(t-o)*i(s)+n,(e-n)*i(s)+(t-o)*l(s)+o]}function zv(e,t,n){var o=e/2,r=t/2,l=[Fv(0,0,o,r,n),Fv(e,0,o,r,n),Fv(e,t,o,r,n),Fv(0,t,o,r,n)],i=Math.min.apply(Math,l.map((function(e){return e[0]}))),s=Math.max.apply(Math,l.map((function(e){return e[0]}))),a=Math.min.apply(Math,l.map((function(e){return e[1]})));return{width:s-i,height:Math.max.apply(Math,l.map((function(e){return e[1]})))-a}}function Vv(){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 Hv=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.imageRef=null,n.videoRef=null,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.lastPinchDistance=0,n.lastPinchRotation=0,n.rafDragTimeout=null,n.rafPinchTimeout=null,n.wheelTimer=null,n.state={cropSize:null,hasWheelJustStarted:!1},n.preventZoomSafari=function(e){return e.preventDefault()},n.cleanEvents=function(){document.removeEventListener("mousemove",n.onMouseMove),document.removeEventListener("mouseup",n.onDragStopped),document.removeEventListener("touchmove",n.onTouchMove),document.removeEventListener("touchend",n.onDragStopped)},n.clearScrollEvent=function(){n.containerRef&&n.containerRef.removeEventListener("wheel",n.onWheel),n.wheelTimer&&clearTimeout(n.wheelTimer)},n.onMediaLoad=function(){n.computeSizes(),n.emitCropData(),n.setInitialCrop(),n.props.onMediaLoaded&&n.props.onMediaLoaded(n.mediaSize)},n.setInitialCrop=function(){var e=n.props,t=e.initialCroppedAreaPixels,o=e.cropSize;if(t){var r=Dv(t,n.mediaSize,o),l=r.crop,i=r.zoom;n.props.onCropChange(l),n.props.onZoomChange&&n.props.onZoomChange(i)}},n.computeSizes=function(){var e,t,o,r,l=n.imageRef||n.videoRef;if(l){n.mediaSize={width:l.offsetWidth,height:l.offsetHeight,naturalWidth:(null===(e=n.imageRef)||void 0===e?void 0:e.naturalWidth)||(null===(t=n.videoRef)||void 0===t?void 0:t.videoWidth)||0,naturalHeight:(null===(o=n.imageRef)||void 0===o?void 0:o.naturalHeight)||(null===(r=n.videoRef)||void 0===r?void 0:r.videoHeight)||0};var i=n.props.cropSize?n.props.cropSize:xv(l.offsetWidth,l.offsetHeight,n.props.aspect,n.props.rotation);n.setState({cropSize:i},n.recomputeCropPosition)}n.containerRef&&(n.containerRect=n.containerRef.getBoundingClientRect())},n.onMouseDown=function(e){e.preventDefault(),document.addEventListener("mousemove",n.onMouseMove),document.addEventListener("mouseup",n.onDragStopped),n.onDragStart(t.getMousePoint(e))},n.onMouseMove=function(e){return n.onDrag(t.getMousePoint(e))},n.onTouchStart=function(e){e.preventDefault(),document.addEventListener("touchmove",n.onTouchMove,{passive:!1}),document.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.onDragStart=function(e){var t,o,r=e.x,l=e.y;n.dragStartPosition={x:r,y:l},n.dragStartCrop=Iv({},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.rafDragTimeout&&window.cancelAnimationFrame(n.rafDragTimeout),n.rafDragTimeout=window.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?Tv(l,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):l;n.props.onCropChange(i)}}))},n.onDragStopped=function(){var e,t;n.cleanEvents(),n.emitCropData(),null===(t=(e=n.props).onInteractionEnd)||void 0===t||t.call(e)},n.onWheel=function(e){e.preventDefault();var o=t.getMousePoint(e),r=n.props.zoom-e.deltaY*n.props.zoomSpeed/200;n.setNewZoom(r,o),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=window.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){if(n.state.cropSize&&n.props.onZoomChange){var o=n.getPointOnContainer(t),r=n.getPointOnMedia(o),l=Math.min(n.props.maxZoom,Math.max(e,n.props.minZoom)),i={x:r.x*l-o.x,y:r.y*l-o.y},s=n.props.restrictPosition?Tv(i,n.mediaSize,n.state.cropSize,l,n.props.rotation):i;n.props.onCropChange(s),n.props.onZoomChange(l)}},n.emitCropData=function(){if(n.state.cropSize){var e=Rv(n.props.restrictPosition?Tv(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),t=e.croppedAreaPercentages,o=e.croppedAreaPixels;n.props.onCropComplete&&n.props.onCropComplete(t,o)}},n.recomputeCropPosition=function(){if(n.state.cropSize){var e=n.props.restrictPosition?Tv(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 __(){this.constructor=e}Bv(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}(t,e),t.prototype.componentDidMount=function(){window.addEventListener("resize",this.computeSizes),this.containerRef&&(this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.preventZoomSafari),this.containerRef.addEventListener("gesturechange",this.preventZoomSafari)),this.props.disableAutomaticStylesInjection||(this.styleRef=document.createElement("style"),this.styleRef.setAttribute("type","text/css"),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}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\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 will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\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",document.head.appendChild(this.styleRef)),this.imageRef&&this.imageRef.complete&&this.onMediaLoad()},t.prototype.componentWillUnmount=function(){window.removeEventListener("resize",this.computeSizes),this.containerRef&&(this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.containerRef.removeEventListener("gesturechange",this.preventZoomSafari)),this.styleRef&&this.styleRef.remove(),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent()},t.prototype.componentDidUpdate=function(e){e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():e.cropSize!==this.props.cropSize&&this.computeSizes(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent())},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=Pv(n,o),this.lastPinchRotation=Mv(n,o),this.onDragStart(Ov(n,o))},t.prototype.onPinchMove=function(e){var n=this,o=t.getTouchPoint(e.touches[0]),r=t.getTouchPoint(e.touches[1]),l=Ov(o,r);this.onDrag(l),this.rafPinchTimeout&&window.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=window.requestAnimationFrame((function(){var e=Pv(o,r),t=n.props.zoom*(e/n.lastPinchDistance);n.setNewZoom(t,l),n.lastPinchDistance=e;var i=Mv(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.crop,i=l.x,s=l.y,a=t.rotation,c=t.zoom,u=t.cropShape,d=t.showGrid,p=t.style,m=p.containerStyle,f=p.cropAreaStyle,h=p.mediaStyle,g=t.classes,v=g.containerClassName,b=g.cropAreaClassName,k=g.mediaClassName;return Ur().createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(t){return e.containerRef=t},"data-testid":"container",style:m,className:Vv("reactEasyCrop_Container",v)},n?Ur().createElement("img",Iv({alt:"",className:Vv("reactEasyCrop_Image",k)},r,{src:n,ref:function(t){return e.imageRef=t},style:Iv(Iv({},h),{transform:"translate("+i+"px, "+s+"px) rotate("+a+"deg) scale("+c+")"}),onLoad:this.onMediaLoad})):o&&Ur().createElement("video",Iv({autoPlay:!0,loop:!0,muted:!0,className:Vv("reactEasyCrop_Video",k)},r,{src:o,ref:function(t){return e.videoRef=t},onLoadedMetadata:this.onMediaLoad,style:Iv(Iv({},h),{transform:"translate("+i+"px, "+s+"px) rotate("+a+"deg) scale("+c+")"}),controls:!1})),this.state.cropSize&&Ur().createElement("div",{style:Iv(Iv({},f),{width:this.state.cropSize.width,height:this.state.cropSize.height}),"data-testid":"cropper",className:Vv("reactEasyCrop_CropArea","round"===u&&"reactEasyCrop_CropAreaRound",d&&"reactEasyCrop_CropAreaGrid",b)}))},t.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:3,minZoom:1,cropShape:"rect",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}(Ur().Component);const Uv={position:"bottom right",isAlternate:!0};var Gv=window.wp.apiFetch,Wv=n.n(Gv);const $v=(0,s.createContext)({}),jv=()=>(0,s.useContext)($v);function Kv({id:e,url:t,naturalWidth:n,naturalHeight:o,isEditing:r,onFinishEditing:i,onSaveImage:a,children:c}){const u=function(e,t){const n=function({url:e,naturalWidth:t,naturalHeight:n}){const[o,r]=(0,s.useState)(),[i,a]=(0,s.useState)(),[c,u]=(0,s.useState)({x:0,y:0}),[d,p]=(0,s.useState)(),[m,f]=(0,s.useState)(),[h,g]=(0,s.useState)(),[v,b]=(0,s.useState)(),k=(0,s.useCallback)((()=>{u({x:0,y:0}),p(100),f(0),g(t/n),b(t/n)}),[t,n,u,p,f,g,b]),_=(0,s.useCallback)((()=>{const o=(m+90)%360;let i=t/n;if(m%180==90&&(i=n/t),0===o)return r(),f(o),g(1/h),void u({x:-c.y*i,y:c.x*i});const s=new window.Image;s.src=e,s.onload=function(e){const t=document.createElement("canvas");let n=0,l=0;o%180?(t.width=e.target.height,t.height=e.target.width):(t.width=e.target.width,t.height=e.target.height),90!==o&&180!==o||(n=t.width),270!==o&&180!==o||(l=t.height);const s=t.getContext("2d");s.translate(n,l),s.rotate(o*Math.PI/180),s.drawImage(e.target,0,0),t.toBlob((e=>{r(URL.createObjectURL(e)),f(o),g(1/h),u({x:-c.y*i,y:c.x*i})}))};const a=(0,l.applyFilters)("media.crossOrigin",void 0,e);"string"==typeof a&&(s.crossOrigin=a)}),[m,t,n,r,f,g,u]);return(0,s.useMemo)((()=>({editedUrl:o,setEditedUrl:r,crop:i,setCrop:a,position:c,setPosition:u,zoom:d,setZoom:p,rotation:m,setRotation:f,rotateClockwise:_,aspect:h,setAspect:g,defaultAspect:v,initializeTransformValues:k})),[o,r,i,a,c,u,d,p,m,f,_,h,g,v,k])}(e),{initializeTransformValues:o}=n;return(0,s.useEffect)((()=>{t&&o()}),[t,o]),n}({url:t,naturalWidth:n,naturalHeight:o},r),d=function({crop:e,rotation:t,height:n,width:o,aspect:r,url:l,id:i,onSaveImage:a,onFinishEditing:c}){const{createErrorNotice:u}=(0,m.useDispatch)(Bu.store),[d,p]=(0,s.useState)(!1),f=(0,s.useCallback)((()=>{p(!1),c()}),[p,c]),g=(0,s.useCallback)((()=>{p(!0);let s={};(e.width<99.9||e.height<99.9)&&(s=e),t>0&&(s.rotation=t),s.src=l,Wv()({path:`/wp/v2/media/${i}/edit`,method:"POST",data:s}).then((e=>{a({id:e.id,url:e.source_url,height:n&&o?o/r:void 0})})).catch((e=>{u((0,h.sprintf)(
|
|
|
|
|
|
|
| 70 |
/* translators: 1. Error message */
|
| 71 |
+
(0,h.__)("Could not edit image. %s"),e.message),{id:"image-editing-error",type:"snackbar"})})).finally((()=>{p(!1),c()}))}),[p,e,t,n,o,r,l,a,u,p,c]);return(0,s.useMemo)((()=>({isInProgress:d,apply:g,cancel:f})),[d,g,f])}({id:e,url:t,onSaveImage:a,onFinishEditing:i,...u}),p=(0,s.useMemo)((()=>({...u,...d})),[u,d]);return(0,s.createElement)($v.Provider,{value:p},c)}function qv({url:e,width:t,height:n,clientWidth:o,naturalHeight:r,naturalWidth:l}){const{isInProgress:i,editedUrl:a,position:u,zoom:d,aspect:m,setPosition:f,setCrop:h,setZoom:g,rotation:v}=jv();let b=n||o*r/l;return v%180==90&&(b=o*l/r),(0,s.createElement)("div",{className:c()("wp-block-image__crop-area",{"is-applying":i}),style:{width:t||o,height:b}},(0,s.createElement)(Hv,{image:a||e,disabled:i,minZoom:1,maxZoom:3,crop:u,zoom:d/100,aspect:m,onCropChange:f,onCropComplete:e=>{h(e)},onZoomChange:e=>{g(100*e)}}),i&&(0,s.createElement)(p.Spinner,null))}var Yv=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"}));function Zv(){const{isInProgress:e,zoom:t,setZoom:n}=jv();return(0,s.createElement)(p.Dropdown,{contentClassName:"wp-block-image__zoom",popoverProps:Uv,renderToggle:({isOpen:t,onToggle:n})=>(0,s.createElement)(p.ToolbarButton,{icon:Yv,label:(0,h.__)("Zoom"),onClick:n,"aria-expanded":t,disabled:e}),renderContent:()=>(0,s.createElement)(p.RangeControl,{label:(0,h.__)("Zoom"),min:100,max:300,value:Math.round(t),onChange:n})})}var Xv=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),Qv=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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 Jv({aspectRatios:e,isDisabled:t,label:n,onClick:o,value:r}){return(0,s.createElement)(p.MenuGroup,{label:n},e.map((({title:e,aspect:n})=>(0,s.createElement)(p.MenuItem,{key:n,disabled:t,onClick:()=>{o(n)},role:"menuitemradio",isSelected:n===r,icon:n===r?Xv:void 0},e))))}function eb({toggleProps:e}){const{isInProgress:t,aspect:n,setAspect:o,defaultAspect:r}=jv();return(0,s.createElement)(p.DropdownMenu,{icon:Qv,label:(0,h.__)("Aspect Ratio"),popoverProps:Uv,toggleProps:e,className:"wp-block-image__aspect-ratio"},(({onClose:e})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Jv,{isDisabled:t,onClick:t=>{o(t),e()},value:n,aspectRatios:[{title:(0,h.__)("Original"),aspect:r},{title:(0,h.__)("Square"),aspect:1}]}),(0,s.createElement)(Jv,{label:(0,h.__)("Landscape"),isDisabled:t,onClick:t=>{o(t),e()},value:n,aspectRatios:[{title:(0,h.__)("16:10"),aspect:1.6},{title:(0,h.__)("16:9"),aspect:16/9},{title:(0,h.__)("4:3"),aspect:4/3},{title:(0,h.__)("3:2"),aspect:1.5}]}),(0,s.createElement)(Jv,{label:(0,h.__)("Portrait"),isDisabled:t,onClick:t=>{o(t),e()},value:n,aspectRatios:[{title:(0,h.__)("10:16"),aspect:.625},{title:(0,h.__)("9:16"),aspect:9/16},{title:(0,h.__)("3:4"),aspect:3/4},{title:(0,h.__)("2:3"),aspect:2/3}]}))))}var tb=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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 nb(){const{isInProgress:e,rotateClockwise:t}=jv();return(0,s.createElement)(p.ToolbarButton,{icon:tb,label:(0,h.__)("Rotate"),onClick:t,disabled:e})}function ob(){const{isInProgress:e,apply:t,cancel:n}=jv();return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.ToolbarButton,{onClick:t,disabled:e},(0,h.__)("Apply")),(0,s.createElement)(p.ToolbarButton,{onClick:n},(0,h.__)("Cancel")))}function rb({url:e,width:t,height:n,clientWidth:o,naturalHeight:r,naturalWidth:l}){return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(qv,{url:e,width:t,height:n,clientWidth:o,naturalHeight:r,naturalWidth:l}),(0,s.createElement)(Zn,null,(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(Zv,null),(0,s.createElement)(p.ToolbarItem,null,(e=>(0,s.createElement)(eb,{toggleProps:e}))),(0,s.createElement)(nb,null)),(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(ob,null))))}const lb=[25,50,75,100];function ib({imageWidth:e,imageHeight:t,imageSizeOptions:n=[],isResizable:o=!0,slug:r,width:l,height:i,onChange:a,onChangeImage:c=u.noop}){const{currentHeight:d,currentWidth:m,updateDimension:f,updateDimensions:g}=function(e,t,n,o,r){var l,i;const[a,c]=(0,s.useState)(null!==(l=null!=t?t:o)&&void 0!==l?l:""),[u,d]=(0,s.useState)(null!==(i=null!=e?e:n)&&void 0!==i?i:"");return(0,s.useEffect)((()=>{void 0===t&&void 0!==o&&c(o),void 0===e&&void 0!==n&&d(n)}),[o,n]),(0,s.useEffect)((()=>{void 0!==t&&Number.parseInt(t)!==Number.parseInt(a)&&c(t),void 0!==e&&Number.parseInt(e)!==Number.parseInt(u)&&d(e)}),[t,e]),{currentHeight:u,currentWidth:a,updateDimension:(e,t)=>{"width"===e?c(t):d(t),r({[e]:""===t?void 0:parseInt(t,10)})},updateDimensions:(e,t)=>{d(null!=e?e:n),c(null!=t?t:o),r({height:e,width:t})}}}(i,l,t,e,a);return(0,s.createElement)(s.Fragment,null,!(0,u.isEmpty)(n)&&(0,s.createElement)(p.SelectControl,{label:(0,h.__)("Image size"),value:r,options:n,onChange:c}),o&&(0,s.createElement)("div",{className:"block-editor-image-size-control"},(0,s.createElement)("p",{className:"block-editor-image-size-control__row"},(0,h.__)("Image dimensions")),(0,s.createElement)("div",{className:"block-editor-image-size-control__row"},(0,s.createElement)(p.TextControl,{type:"number",className:"block-editor-image-size-control__width",label:(0,h.__)("Width"),value:m,min:1,onChange:e=>f("width",e)}),(0,s.createElement)(p.TextControl,{type:"number",className:"block-editor-image-size-control__height",label:(0,h.__)("Height"),value:d,min:1,onChange:e=>f("height",e)})),(0,s.createElement)("div",{className:"block-editor-image-size-control__row"},(0,s.createElement)(p.ButtonGroup,{"aria-label":(0,h.__)("Image size presets")},lb.map((n=>{const o=Math.round(e*(n/100)),r=Math.round(t*(n/100)),l=m===o&&d===r;return(0,s.createElement)(p.Button,{key:n,isSmall:!0,variant:l?"primary":void 0,isPressed:l,onClick:()=>g(r,o)},n,"%")}))),(0,s.createElement)(p.Button,{isSmall:!0,onClick:()=>g()},(0,h.__)("Reset")))))}var sb=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,s.createElement)(F.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"})),ab=({value:e,onChange:t=u.noop,settings:n})=>{if(!n||!n.length)return null;const o=n=>o=>{t({...e,[n.id]:o})},r=n.map((t=>(0,s.createElement)(p.ToggleControl,{className:"block-editor-link-control__setting",key:t.id,label:t.title,onChange:o(t),checked:!!e&&!!e[t.id]})));return(0,s.createElement)("fieldset",{className:"block-editor-link-control__settings"},(0,s.createElement)(p.VisuallyHidden,{as:"legend"},(0,h.__)("Currently selected link settings")),r)};class cb extends s.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,s.createRef)(),this.inputRef=(0,s.createRef)(),this.updateSuggestions=(0,u.debounce)(this.updateSuggestions.bind(this),200),this.suggestionNodes=[],this.isUpdatingSuggestions=!1,this.state={suggestions:[],showSuggestions:!1,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,_a()(this.suggestionNodes[n],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),this.props.setTimeout((()=>{this.scrollingIntoView=!1}),100)),e.value===o||this.props.disableSuggestions||this.isUpdatingSuggestions||(null!=o&&o.length?this.updateSuggestions(o):r&&this.updateSuggestions())}componentDidMount(){this.shouldShowInitialSuggestions()&&this.updateSuggestions()}componentWillUnmount(){var e,t;null===(e=this.suggestionsRequest)||void 0===e||null===(t=e.cancel)||void 0===t||t.call(e),delete this.suggestionsRequest}bindSuggestionNode(e){return t=>{this.suggestionNodes[e]=t}}shouldShowInitialSuggestions(){const{suggestions:e}=this.state,{__experimentalShowInitialSuggestions:t=!1,value:n}=this.props;return!this.isUpdatingSuggestions&&t&&!(n&&n.length)&&!(e&&e.length)}updateSuggestions(e=""){var t;const{__experimentalFetchLinkSuggestions:n,__experimentalHandleURLSuggestions:o}=this.props;if(!n)return;const r=!(null!==(t=e)&&void 0!==t&&t.length);if(e=e.trim(),!r&&(e.length<2||!o&&(0,Ju.isURL)(e)))return void this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});this.isUpdatingSuggestions=!0,this.setState({selectedSuggestion:null,loading:!0});const l=n(e,{isInitialSuggestions:r});l.then((e=>{this.suggestionsRequest===l&&(this.setState({suggestions:e,loading:!1,showSuggestions:!!e.length}),e.length?this.props.debouncedSpeak((0,h.sprintf)(
|
| 72 |
/* translators: %s: number of results. */
|
| 73 |
+
(0,h._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",e.length),e.length),"assertive"):this.props.debouncedSpeak((0,h.__)("No results."),"assertive"),this.isUpdatingSuggestions=!1)})).catch((()=>{this.suggestionsRequest===l&&(this.setState({loading:!1}),this.isUpdatingSuggestions=!1)})),this.suggestionsRequest=l}onChange(e){const t=e.target.value;this.props.onChange(t),this.props.disableSuggestions||this.updateSuggestions(t)}onFocus(){const{suggestions:e}=this.state,{disableSuggestions:t,value:n}=this.props;!n||t||this.isUpdatingSuggestions||e&&e.length||this.updateSuggestions(n)}onKeyDown(e){const{showSuggestions:t,selectedSuggestion:n,suggestions:o,loading:r}=this.state;if(!t||!o.length||r){switch(e.keyCode){case ga.UP:0!==e.target.selectionStart&&(e.preventDefault(),e.target.setSelectionRange(0,0));break;case ga.DOWN:this.props.value.length!==e.target.selectionStart&&(e.preventDefault(),e.target.setSelectionRange(this.props.value.length,this.props.value.length));break;case ga.ENTER:this.props.onSubmit&&this.props.onSubmit(null,e)}return}const l=this.state.suggestions[this.state.selectedSuggestion];switch(e.keyCode){case ga.UP:{e.preventDefault();const t=n?n-1:o.length-1;this.setState({selectedSuggestion:t});break}case ga.DOWN:{e.preventDefault();const t=null===n||n===o.length-1?0:n+1;this.setState({selectedSuggestion:t});break}case ga.TAB:null!==this.state.selectedSuggestion&&(this.selectLink(l),this.props.speak((0,h.__)("Link selected.")));break;case ga.ENTER: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{label:e,className:t,isFullWidth:n,instanceId:o,placeholder:r=(0,h.__)("Paste URL or type to search"),__experimentalRenderControl:l,value:i=""}=this.props,{loading:a,showSuggestions:u,selectedSuggestion:d,suggestionsListboxId:m,suggestionOptionIdPrefix:f}=this.state,g={id:`url-input-control-${o}`,label:e,className:c()("block-editor-url-input",t,{"is-full-width":n})},v={value:i,required:!0,className:"block-editor-url-input__input",type:"text",onChange:this.onChange,onFocus:this.onFocus,placeholder:r,onKeyDown:this.onKeyDown,role:"combobox","aria-label":(0,h.__)("URL"),"aria-expanded":u,"aria-autocomplete":"list","aria-owns":m,"aria-activedescendant":null!==d?`${f}-${d}`:void 0,ref:this.inputRef};return l?l(g,v,a):(0,s.createElement)(p.BaseControl,g,(0,s.createElement)("input",v),a&&(0,s.createElement)(p.Spinner,null))}renderSuggestions(){const{className:e,__experimentalRenderSuggestions:t,value:n="",__experimentalShowInitialSuggestions:o=!1}=this.props,{showSuggestions:r,suggestions:l,selectedSuggestion:a,suggestionsListboxId:d,suggestionOptionIdPrefix:m,loading:f}=this.state,h={id:d,ref:this.autocompleteRef,role:"listbox"},g=(e,t)=>({role:"option",tabIndex:"-1",id:`${m}-${t}`,ref:this.bindSuggestionNode(t),"aria-selected":t===a});return(0,u.isFunction)(t)&&r&&l.length?t({suggestions:l,selectedSuggestion:a,suggestionsListProps:h,buildSuggestionItemProps:g,isLoading:f,handleSuggestionClick:this.handleOnClick,isInitialSuggestions:o&&!(n&&n.length)}):!(0,u.isFunction)(t)&&r&&l.length?(0,s.createElement)(p.Popover,{position:"bottom",noArrow:!0,focusOnMount:!1},(0,s.createElement)("div",i({},h,{className:c()("block-editor-url-input__suggestions",`${e}__suggestions`)}),l.map(((e,t)=>(0,s.createElement)(p.Button,i({},g(0,t),{key:e.id,className:c()("block-editor-url-input__suggestion",{"is-selected":t===a}),onClick:()=>this.handleOnClick(e)}),e.title))))):null}}var ub=(0,d.compose)(d.withSafeTimeout,p.withSpokenMessages,d.withInstanceId,(0,m.withSelect)(((e,t)=>{if((0,u.isFunction)(t.__experimentalFetchLinkSuggestions))return;const{getSettings:n}=e(Vn);return{__experimentalFetchLinkSuggestions:n().__experimentalFetchLinkSuggestions}})))(cb),db=({searchTerm:e,onClick:t,itemProps:n,isSelected:o,buttonText:r})=>{if(!e)return null;let l;return l=r?(0,u.isFunction)(r)?r(e):r:(0,s.createInterpolateElement)((0,h.sprintf)(
|
| 74 |
/* translators: %s: search term. */
|
| 75 |
+
(0,h.__)("Create: <mark>%s</mark>"),e),{mark:(0,s.createElement)("mark",null)}),(0,s.createElement)(p.Button,i({},n,{className:c()("block-editor-link-control__search-create block-editor-link-control__search-item",{"is-selected":o}),onClick:t}),(0,s.createElement)(So,{className:"block-editor-link-control__search-item-icon",icon:Oa}),(0,s.createElement)("span",{className:"block-editor-link-control__search-item-header"},(0,s.createElement)("span",{className:"block-editor-link-control__search-item-title"},l)))},pb=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),mb=({itemProps:e,suggestion:t,isSelected:n=!1,onClick:o,isURL:r=!1,searchTerm:l="",shouldShowType:a=!1})=>(0,s.createElement)(p.Button,i({},e,{onClick:o,className:c()("block-editor-link-control__search-item",{"is-selected":n,"is-url":r,"is-entity":!r})}),r&&(0,s.createElement)(So,{className:"block-editor-link-control__search-item-icon",icon:pb}),(0,s.createElement)("span",{className:"block-editor-link-control__search-item-header"},(0,s.createElement)("span",{className:"block-editor-link-control__search-item-title"},(0,s.createElement)(p.TextHighlight,{text:t.title,highlight:l})),(0,s.createElement)("span",{"aria-hidden":!r,className:"block-editor-link-control__search-item-info"},!r&&((0,Ju.filterURLForDisplay)((0,Ju.safeDecodeURI)(t.url))||""),r&&(0,h.__)("Press ENTER to add this link"))),a&&t.type&&(0,s.createElement)("span",{className:"block-editor-link-control__search-item-type"},"post_tag"===t.type?"tag":t.type));const fb="__CREATE__",hb=[{id:"opensInNewTab",title:(0,h.__)("Open in new tab")}];function gb({instanceId:e,withCreateSuggestion:t,currentInputValue:n,handleSuggestionClick:o,suggestionsListProps:r,buildSuggestionItemProps:l,suggestions:a,selectedSuggestion:u,isLoading:d,isInitialSuggestions:m,createSuggestionButtonText:f,suggestionsQuery:g}){const v=c()("block-editor-link-control__search-results",{"is-loading":d}),b=["url","mailto","tel","internal"],k=1===a.length&&b.includes(a[0].type.toLowerCase()),_=t&&!k&&!m,y=!(null!=g&&g.type),E=`block-editor-link-control-search-results-label-${e}`,C=m?(0,h.__)("Recently updated"):(0,h.sprintf)(
|
| 76 |
/* translators: %s: search term. */
|
| 77 |
+
(0,h.__)('Search results for "%s"'),n),w=(0,s.createElement)(m?s.Fragment:p.VisuallyHidden,{},(0,s.createElement)("span",{className:"block-editor-link-control__search-results-label",id:E},C));return(0,s.createElement)("div",{className:"block-editor-link-control__search-results-wrapper"},w,(0,s.createElement)("div",i({},r,{className:v,"aria-labelledby":E}),a.map(((e,t)=>_&&fb===e.type?(0,s.createElement)(db,{searchTerm:n,buttonText:f,onClick:()=>o(e),key:e.type,itemProps:l(e,t),isSelected:t===u}):fb===e.type?null:(0,s.createElement)(mb,{key:`${e.id}-${e.type}`,itemProps:l(e,t),suggestion:e,index:t,onClick:()=>{o(e)},isSelected:t===u,isURL:b.includes(e.type.toLowerCase()),searchTerm:n,shouldShowType:y})))))}function vb(e){const t=(0,u.startsWith)(e,"#");return(0,Ju.isURL)(e)||e&&e.includes("www.")||t}const bb=()=>Promise.resolve([]),kb=e=>{let t="URL";const n=(0,Ju.getProtocol)(e)||"";return n.includes("mailto")&&(t="mailto"),n.includes("tel")&&(t="tel"),(0,u.startsWith)(e,"#")&&(t="internal"),Promise.resolve([{id:e,title:e,url:"URL"===t?(0,Ju.prependHTTP)(e):e,type:t}])};const _b=()=>Promise.resolve([]),yb=(0,s.forwardRef)((({value:e,children:t,currentLink:n={},className:o=null,placeholder:r=null,withCreateSuggestion:l=!1,onCreateSuggestion:i=u.noop,onChange:a=u.noop,onSelect:p=u.noop,showSuggestions:f=!0,renderSuggestions:g=(e=>(0,s.createElement)(gb,e)),fetchSuggestions:v=null,allowDirectEntry:b=!0,showInitialSuggestions:k=!1,suggestionsQuery:_={},withURLSuggestion:y=!0,createSuggestionButtonText:E,useLabel:C=!1},w)=>{const S=function(e,t,n,o){const{fetchSearchSuggestions:r}=(0,m.useSelect)((e=>{const{getSettings:t}=e(Vn);return{fetchSearchSuggestions:t().__experimentalFetchLinkSuggestions}}),[]),l=t?kb:bb;return(0,s.useCallback)(((t,{isInitialSuggestions:i})=>vb(t)?l(t,{isInitialSuggestions:i}):(async(e,t,n,o,r,l)=>{const{isInitialSuggestions:i}=t;let s=await Promise.all([n(e,t),o(e)]);return s=e.includes(" ")||!l||i?s[0]:s[0].concat(s[1]),i||vb(e)||!r?s:s.concat({title:e,url:e,type:fb})})(t,{...e,isInitialSuggestions:i},r,l,n,o)),[l,r,n])}(_,b,l,y),B=f?v||S:_b,I=(0,d.useInstanceId)(yb),[x,T]=(0,s.useState)(),N=async e=>{let t=e;if(fb!==e.type)(b||t&&Object.keys(t).length>=1)&&p({...(0,u.omit)(n,"id","url"),...t},t);else try{var o;t=await i(e.title),null!==(o=t)&&void 0!==o&&o.url&&p(t)}catch(e){}},P=c()(o,{"has-no-label":!C});return(0,s.createElement)("div",{className:"block-editor-link-control__search-input-container"},(0,s.createElement)(ub,{label:C?"URL":void 0,className:P,value:e,onChange:(e,t)=>{a(e),T(t)},placeholder:null!=r?r:(0,h.__)("Search or type url"),__experimentalRenderSuggestions:f?t=>g({...t,instanceId:I,withCreateSuggestion:l,currentInputValue:e,createSuggestionButtonText:E,suggestionsQuery:_,handleSuggestionClick:e=>{t.handleSuggestionClick&&t.handleSuggestionClick(e),N(e)}}):null,__experimentalFetchLinkSuggestions:B,__experimentalHandleURLSuggestions:!0,__experimentalShowInitialSuggestions:k,onSubmit:(t,n)=>{var o;const r=t||x;r||null!=e&&null!==(o=e.trim())&&void 0!==o&&o.length?N(r||{url:e}):n.preventDefault()},ref:w}),t)}));var Eb=yb,Cb=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.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"})),wb=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"}));const{Slot:Sb,Fill:Bb}=(0,p.createSlotFill)("BlockEditorLinkControlViewer");function Ib(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}`)}}function xb({value:e,onEditClick:t,hasRichPreviews:n=!1,hasUnlinkControl:o=!1,onRemove:r}){const l=n?null==e?void 0:e.url:null,{richData:i,isFetching:a}=function(e){const[t,n]=(0,s.useReducer)(Ib,{richData:null,isFetching:!1}),{fetchRichUrlData:o}=(0,m.useSelect)((e=>{const{getSettings:t}=e(Vn);return{fetchRichUrlData:t().__experimentalFetchRichUrlData}}),[]);return(0,s.useEffect)((()=>{if(null!=e&&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}(l),u=i&&Object.keys(i).length,d=e&&(0,Ju.filterURLForDisplay)((0,Ju.safeDecodeURI)(e.url),16)||"",f=(null==i?void 0:i.title)||(null==e?void 0:e.title)||d,g=!e.url.length;let v;return v=null!=i&&i.icon?(0,s.createElement)("img",{src:null==i?void 0:i.icon,alt:""}):g?(0,s.createElement)(So,{icon:Cb,size:32}):(0,s.createElement)(So,{icon:pb}),(0,s.createElement)("div",{"aria-label":(0,h.__)("Currently selected"),"aria-selected":"true",className:c()("block-editor-link-control__search-item",{"is-current":!0,"is-rich":u,"is-fetching":!!a,"is-preview":!0,"is-error":g})},(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:c()("block-editor-link-control__search-item-icon",{"is-image":null==i?void 0:i.icon})},v),(0,s.createElement)("span",{className:"block-editor-link-control__search-item-details"},g?(0,s.createElement)("span",{className:"block-editor-link-control__search-item-error-notice"},"Link is empty"):(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.ExternalLink,{className:"block-editor-link-control__search-item-title",href:e.url},(0,or.__unstableStripHTML)(f)),(null==e?void 0:e.url)&&(0,s.createElement)("span",{className:"block-editor-link-control__search-item-info"},d)))),(0,s.createElement)(p.Button,{icon:wb,label:(0,h.__)("Edit"),className:"block-editor-link-control__search-item-action",onClick:t,iconSize:24}),o&&(0,s.createElement)(p.Button,{icon:wm,label:(0,h.__)("Unlink"),className:"block-editor-link-control__search-item-action block-editor-link-control__unlink",onClick:r,iconSize:24}),(0,s.createElement)(Sb,{fillProps:e})),(u&&((null==i?void 0:i.image)||(null==i?void 0:i.description))||a)&&(0,s.createElement)("div",{className:"block-editor-link-control__search-item-bottom"},((null==i?void 0:i.image)||a)&&(0,s.createElement)("div",{"aria-hidden":!(null!=i&&i.image),className:c()("block-editor-link-control__search-item-image",{"is-placeholder":!(null!=i&&i.image)})},(null==i?void 0:i.image)&&(0,s.createElement)("img",{src:null==i?void 0:i.image,alt:""})),((null==i?void 0:i.description)||a)&&(0,s.createElement)("div",{"aria-hidden":!(null!=i&&i.description),className:c()("block-editor-link-control__search-item-description",{"is-placeholder":!(null!=i&&i.description)})},(null==i?void 0:i.description)&&(0,s.createElement)(p.__experimentalText,{truncate:!0,numberOfLines:"2"},i.description))))}function Tb({searchInputPlaceholder:e,value:t,settings:n=hb,onChange:o=u.noop,onRemove:r,noDirectEntry:l=!1,showSuggestions:i=!0,showInitialSuggestions:a,forceIsEditingLink:d,createSuggestion:m,withCreateSuggestion:f,inputValue:g="",suggestionsQuery:v={},noURLSuggestion:b=!1,createSuggestionButtonText:k,hasRichPreviews:_=!1,hasTextControl:y=!1,renderControlB
|
|
|
