Version Description
Download this release
Release Info
Developer | gutenbergplugin |
Plugin | Gutenberg |
Version | 11.7.0 |
Comparing to | |
See all releases |
Code changes from version 11.6.0 to 11.7.0
- build/api-fetch/index.js +12 -3
- build/api-fetch/index.min.asset.php +1 -1
- build/api-fetch/index.min.js +1 -1
- build/block-directory/index.js +92 -107
- build/block-directory/index.min.asset.php +1 -1
- build/block-directory/index.min.js +11 -11
- build/block-editor/index.js +768 -1402
- build/block-editor/index.min.asset.php +1 -1
- build/block-editor/index.min.js +63 -59
build/api-fetch/index.js
CHANGED
@@ -508,16 +508,25 @@ function parseAndThrowError(response, shouldParseResponse = true) {
|
|
508 |
*/
|
509 |
|
510 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
/**
|
512 |
* Middleware handling media upload failures and retries.
|
513 |
*
|
514 |
* @type {import('../types').APIFetchMiddleware}
|
515 |
*/
|
516 |
|
517 |
-
const mediaUploadMiddleware = (options, next) => {
|
518 |
-
const isMediaUploadRequest = options.path && options.path.indexOf('/wp/v2/media') !== -1 || options.url && options.url.indexOf('/wp/v2/media') !== -1;
|
519 |
|
520 |
-
|
|
|
521 |
return next(options);
|
522 |
}
|
523 |
|
508 |
*/
|
509 |
|
510 |
|
511 |
+
/**
|
512 |
+
* @param {import('../types').APIFetchOptions} options
|
513 |
+
* @return {boolean} True if the request is for media upload.
|
514 |
+
*/
|
515 |
+
|
516 |
+
function isMediaUploadRequest(options) {
|
517 |
+
const isCreateMethod = !!options.method && options.method === 'POST';
|
518 |
+
const isMediaEndpoint = !!options.path && options.path.indexOf('/wp/v2/media') !== -1 || !!options.url && options.url.indexOf('/wp/v2/media') !== -1;
|
519 |
+
return isMediaEndpoint && isCreateMethod;
|
520 |
+
}
|
521 |
/**
|
522 |
* Middleware handling media upload failures and retries.
|
523 |
*
|
524 |
* @type {import('../types').APIFetchMiddleware}
|
525 |
*/
|
526 |
|
|
|
|
|
527 |
|
528 |
+
const mediaUploadMiddleware = (options, next) => {
|
529 |
+
if (!isMediaUploadRequest(options)) {
|
530 |
return next(options);
|
531 |
}
|
532 |
|
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' => '84a05b2df76d7af2c946b839f1860969');
|
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 j}});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})};function o(e){const t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map((e=>e.split("="))).sort(((e,t)=>e[0].localeCompare(t[0]))).map((e=>e.join("="))).join("&"):n}var a=window.wp.url;const s=({path:e,url:t,...r},n)=>({...r,url:t&&(0,a.addQueryArgs)(t,n),path:e&&(0,a.addQueryArgs)(e,n)}),i=e=>e.json?e.json():Promise.reject(e),c=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 d=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 j({...s(e,{per_page:100}),parse:!1}),n=await i(r);if(!Array.isArray(n))return n;let o=c(r);if(!o)return n;let a=[].concat(n);for(;o;){const t=await j({...e,path:void 0,url:o,parse:!1}),r=await i(t);a=a.concat(r),o=c(t)}return a};const p=new Set(["PATCH","PUT","DELETE"]),u="GET",l=(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=>h(e,t)));function h(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 f={Accept:"application/json, */*;q=0.1"},w={credentials:"include"},m=[(e,t)=>("string"!=typeof e.url||(0,a.hasQueryArg)(e.url,"_locale")||(e.url=(0,a.addQueryArgs)(e.url,{_locale:"user"})),"string"!=typeof e.path||(0,a.hasQueryArg)(e.path,"_locale")||(e.path=(0,a.addQueryArgs)(e.path,{_locale:"user"})),t(e)),n,(e,t)=>{const{method:r=u}=e;return p.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},d],g=e=>{if(e.status>=200&&e.status<300)return e;throw e};let y=e=>{const{url:t,path:n,data:o,parse:a=!0,...s}=e;let{body:i,headers:c}=e;return c={...f,...c},o&&(i=JSON.stringify(o),c["Content-Type"]="application/json"),window.fetch(t||n||window.location.href,{...w,...s,body:i,headers:c}).then((e=>Promise.resolve(e).then(g).catch((e=>h(e,a))).then((e=>l(e,a)))),(e=>{if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:(0,r.__)("You are probably offline.")}}))};function _(e){return m.reduceRight(((e,t)=>r=>t(r,e)),y)(e).catch((t=>"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(_.nonceEndpoint).then(g).then((e=>e.text())).then((t=>(_.nonceMiddleware.nonce=t,_(e))))))}_.use=function(e){m.unshift(e)},_.setFetchHandler=function(e){y=e},_.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},_.createPreloadingMiddleware=function(e){const t=Object.keys(e).reduce(((t,r)=>(t[o(r)]=e[r],t)),{});return(e,r)=>{const{parse:n=!0}=e;if("string"==typeof e.path){const r=e.method||"GET",a=o(e.path);if("GET"===r&&t[a]){const e=t[a];return delete t[a],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][a])return Promise.resolve(n?t[r][a].body:t[r][a])}return r(e)}},_.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})})),_.fetchAllMiddleware=d,_.mediaUploadMiddleware=(e,t)=>{if(!(e.path&&-1!==e.path.indexOf("/wp/v2/media")
|
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 j}});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})};function o(e){const t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map((e=>e.split("="))).sort(((e,t)=>e[0].localeCompare(t[0]))).map((e=>e.join("="))).join("&"):n}var a=window.wp.url;const s=({path:e,url:t,...r},n)=>({...r,url:t&&(0,a.addQueryArgs)(t,n),path:e&&(0,a.addQueryArgs)(e,n)}),i=e=>e.json?e.json():Promise.reject(e),c=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 d=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 j({...s(e,{per_page:100}),parse:!1}),n=await i(r);if(!Array.isArray(n))return n;let o=c(r);if(!o)return n;let a=[].concat(n);for(;o;){const t=await j({...e,path:void 0,url:o,parse:!1}),r=await i(t);a=a.concat(r),o=c(t)}return a};const p=new Set(["PATCH","PUT","DELETE"]),u="GET",l=(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=>h(e,t)));function h(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 f={Accept:"application/json, */*;q=0.1"},w={credentials:"include"},m=[(e,t)=>("string"!=typeof e.url||(0,a.hasQueryArg)(e.url,"_locale")||(e.url=(0,a.addQueryArgs)(e.url,{_locale:"user"})),"string"!=typeof e.path||(0,a.hasQueryArg)(e.path,"_locale")||(e.path=(0,a.addQueryArgs)(e.path,{_locale:"user"})),t(e)),n,(e,t)=>{const{method:r=u}=e;return p.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},d],g=e=>{if(e.status>=200&&e.status<300)return e;throw e};let y=e=>{const{url:t,path:n,data:o,parse:a=!0,...s}=e;let{body:i,headers:c}=e;return c={...f,...c},o&&(i=JSON.stringify(o),c["Content-Type"]="application/json"),window.fetch(t||n||window.location.href,{...w,...s,body:i,headers:c}).then((e=>Promise.resolve(e).then(g).catch((e=>h(e,a))).then((e=>l(e,a)))),(e=>{if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:(0,r.__)("You are probably offline.")}}))};function _(e){return m.reduceRight(((e,t)=>r=>t(r,e)),y)(e).catch((t=>"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(_.nonceEndpoint).then(g).then((e=>e.text())).then((t=>(_.nonceMiddleware.nonce=t,_(e))))))}_.use=function(e){m.unshift(e)},_.setFetchHandler=function(e){y=e},_.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},_.createPreloadingMiddleware=function(e){const t=Object.keys(e).reduce(((t,r)=>(t[o(r)]=e[r],t)),{});return(e,r)=>{const{parse:n=!0}=e;if("string"==typeof e.path){const r=e.method||"GET",a=o(e.path);if("GET"===r&&t[a]){const e=t[a];return delete t[a],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][a])return Promise.resolve(n?t[r][a].body:t[r][a])}return r(e)}},_.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})})),_.fetchAllMiddleware=d,_.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))):h(t,e.parse)})).then((t=>l(t,e.parse)))};var j=_;(window.wp=window.wp||{}).apiFetch=t.default}();
|
build/block-directory/index.js
CHANGED
@@ -83,6 +83,13 @@ __webpack_require__.d(actions_namespaceObject, {
|
|
83 |
"uninstallBlockType": function() { return uninstallBlockType; }
|
84 |
});
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
;// CONCATENATED MODULE: external ["wp","element"]
|
87 |
var external_wp_element_namespaceObject = window["wp"]["element"];
|
88 |
;// CONCATENATED MODULE: external ["wp","plugins"]
|
@@ -95,8 +102,6 @@ var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
|
|
95 |
var external_wp_data_namespaceObject = window["wp"]["data"];
|
96 |
;// CONCATENATED MODULE: external ["wp","editor"]
|
97 |
var external_wp_editor_namespaceObject = window["wp"]["editor"];
|
98 |
-
;// CONCATENATED MODULE: external ["wp","dataControls"]
|
99 |
-
var external_wp_dataControls_namespaceObject = window["wp"]["dataControls"];
|
100 |
;// CONCATENATED MODULE: external "lodash"
|
101 |
var external_lodash_namespaceObject = window["lodash"];
|
102 |
;// CONCATENATED MODULE: ./packages/block-directory/build-module/store/reducer.js
|
@@ -256,11 +261,9 @@ function hasBlockType(blockType, blocks = []) {
|
|
256 |
*/
|
257 |
|
258 |
function isRequestingDownloadableBlocks(state, filterValue) {
|
259 |
-
|
260 |
-
return false;
|
261 |
-
}
|
262 |
|
263 |
-
return state.downloadableBlocks[filterValue].isRequesting;
|
264 |
}
|
265 |
/**
|
266 |
* Returns the available uninstalled blocks.
|
@@ -272,11 +275,9 @@ function isRequestingDownloadableBlocks(state, filterValue) {
|
|
272 |
*/
|
273 |
|
274 |
function getDownloadableBlocks(state, filterValue) {
|
275 |
-
|
276 |
-
return [];
|
277 |
-
}
|
278 |
|
279 |
-
return state.downloadableBlocks[filterValue].results;
|
280 |
}
|
281 |
/**
|
282 |
* Returns the block types that have been installed on the server in this
|
@@ -356,12 +357,12 @@ function getErrorNoticeForBlock(state, blockId) {
|
|
356 |
//# sourceMappingURL=selectors.js.map
|
357 |
;// CONCATENATED MODULE: external ["wp","i18n"]
|
358 |
var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
|
359 |
-
;// CONCATENATED MODULE: external ["wp","notices"]
|
360 |
-
var external_wp_notices_namespaceObject = window["wp"]["notices"];
|
361 |
;// CONCATENATED MODULE: external ["wp","apiFetch"]
|
362 |
var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
|
363 |
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
|
364 |
-
;// CONCATENATED MODULE:
|
|
|
|
|
365 |
/**
|
366 |
* WordPress dependencies
|
367 |
*/
|
@@ -407,47 +408,33 @@ const loadAsset = el => {
|
|
407 |
};
|
408 |
/**
|
409 |
* Load the asset files for a block
|
410 |
-
*
|
411 |
-
* @param {Array} assets A collection of URLs for the assets.
|
412 |
-
*
|
413 |
-
* @return {Object} Control descriptor.
|
414 |
*/
|
415 |
|
416 |
-
function loadAssets(
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
/*
|
439 |
-
* Load each asset in order, as they may depend upon an earlier loaded script.
|
440 |
-
* Stylesheets and Inline Scripts will resolve immediately upon insertion.
|
441 |
-
*/
|
442 |
-
|
443 |
-
for (const newAsset of newAssets) {
|
444 |
-
await loadAsset(newAsset);
|
445 |
-
}
|
446 |
}
|
447 |
-
|
448 |
-
|
449 |
-
/* harmony default export */ var store_controls = (controls);
|
450 |
-
//# sourceMappingURL=controls.js.map
|
451 |
;// CONCATENATED MODULE: ./packages/block-directory/build-module/store/utils/get-plugin-url.js
|
452 |
/**
|
453 |
* Get the plugin's direct API link out of a block-directory response.
|
@@ -478,7 +465,6 @@ function getPluginUrl(block) {
|
|
478 |
|
479 |
|
480 |
|
481 |
-
|
482 |
/**
|
483 |
* Internal dependencies
|
484 |
*/
|
@@ -525,54 +511,56 @@ function receiveDownloadableBlocks(downloadableBlocks, filterValue) {
|
|
525 |
* @return {boolean} Whether the block was successfully installed & loaded.
|
526 |
*/
|
527 |
|
528 |
-
|
|
|
|
|
|
|
529 |
const {
|
530 |
-
id
|
531 |
-
assets
|
532 |
} = block;
|
533 |
let success = false;
|
534 |
-
|
535 |
|
536 |
try {
|
537 |
-
|
538 |
|
539 |
const url = getPluginUrl(block);
|
540 |
let links = {};
|
541 |
|
542 |
if (url) {
|
543 |
-
|
|
|
544 |
url,
|
545 |
data: {
|
546 |
status: 'active'
|
547 |
-
}
|
548 |
-
method: 'PUT'
|
549 |
});
|
550 |
} else {
|
551 |
-
const response =
|
|
|
552 |
path: 'wp/v2/plugins',
|
553 |
data: {
|
554 |
-
slug:
|
555 |
status: 'active'
|
556 |
-
}
|
557 |
-
method: 'POST'
|
558 |
}); // Add the `self` link for newly-installed blocks.
|
559 |
|
560 |
links = response._links;
|
561 |
}
|
562 |
|
563 |
-
|
564 |
links: { ...block.links,
|
565 |
...links
|
566 |
}
|
567 |
});
|
568 |
-
|
569 |
-
const registeredBlocks =
|
570 |
|
571 |
if (!registeredBlocks.some(i => i.name === block.name)) {
|
572 |
throw new Error((0,external_wp_i18n_namespaceObject.__)('Error registering block. Try reloading the page.'));
|
573 |
}
|
574 |
|
575 |
-
|
576 |
(0,external_wp_i18n_namespaceObject.__)('Block %s installed and added.'), block.title), {
|
577 |
speak: true,
|
578 |
type: 'snackbar'
|
@@ -594,40 +582,44 @@ function* installBlockType(block) {
|
|
594 |
message = fatalAPIErrors[error.code];
|
595 |
}
|
596 |
|
597 |
-
|
598 |
-
|
599 |
speak: true,
|
600 |
isDismissible: true
|
601 |
});
|
602 |
}
|
603 |
|
604 |
-
|
605 |
return success;
|
606 |
-
}
|
607 |
/**
|
608 |
* Action triggered to uninstall a block plugin.
|
609 |
*
|
610 |
* @param {Object} block The blockType object.
|
611 |
*/
|
612 |
|
613 |
-
|
|
|
|
|
|
|
614 |
try {
|
615 |
-
|
616 |
-
|
|
|
|
|
617 |
data: {
|
618 |
status: 'inactive'
|
619 |
-
}
|
620 |
-
method: 'PUT'
|
621 |
});
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
});
|
626 |
-
|
627 |
} catch (error) {
|
628 |
-
|
629 |
}
|
630 |
-
}
|
631 |
/**
|
632 |
* Returns an action object used to add a block type to the "newly installed"
|
633 |
* tracking list.
|
@@ -722,32 +714,28 @@ function clearErrorNotice(blockId) {
|
|
722 |
*/
|
723 |
|
724 |
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
try {
|
732 |
-
yield fetchDownloadableBlocks(filterValue);
|
733 |
-
const results = yield (0,external_wp_dataControls_namespaceObject.apiFetch)({
|
734 |
-
path: `wp/v2/block-directory/search?term=${filterValue}`
|
735 |
-
});
|
736 |
-
const blocks = results.map(result => (0,external_lodash_namespaceObject.mapKeys)(result, (value, key) => {
|
737 |
-
return (0,external_lodash_namespaceObject.camelCase)(key);
|
738 |
-
}));
|
739 |
-
yield receiveDownloadableBlocks(blocks, filterValue);
|
740 |
-
} catch (error) {}
|
741 |
}
|
742 |
|
743 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
744 |
//# sourceMappingURL=resolvers.js.map
|
745 |
;// CONCATENATED MODULE: ./packages/block-directory/build-module/store/index.js
|
746 |
/**
|
747 |
* WordPress dependencies
|
748 |
*/
|
749 |
|
750 |
-
|
751 |
/**
|
752 |
* Internal dependencies
|
753 |
*/
|
@@ -756,7 +744,6 @@ function clearErrorNotice(blockId) {
|
|
756 |
|
757 |
|
758 |
|
759 |
-
|
760 |
/**
|
761 |
* Module Constants
|
762 |
*/
|
@@ -774,10 +761,8 @@ const storeConfig = {
|
|
774 |
reducer: reducer,
|
775 |
selectors: selectors_namespaceObject,
|
776 |
actions: actions_namespaceObject,
|
777 |
-
|
778 |
-
|
779 |
-
},
|
780 |
-
resolvers: resolvers
|
781 |
};
|
782 |
/**
|
783 |
* Store definition for the block directory namespace.
|
@@ -1571,7 +1556,7 @@ function InstallButton({
|
|
1571 |
block,
|
1572 |
clientId
|
1573 |
}) {
|
1574 |
-
const isInstallingBlock = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isInstalling(block.id));
|
1575 |
const {
|
1576 |
installBlockType
|
1577 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
83 |
"uninstallBlockType": function() { return uninstallBlockType; }
|
84 |
});
|
85 |
|
86 |
+
// NAMESPACE OBJECT: ./packages/block-directory/build-module/store/resolvers.js
|
87 |
+
var resolvers_namespaceObject = {};
|
88 |
+
__webpack_require__.r(resolvers_namespaceObject);
|
89 |
+
__webpack_require__.d(resolvers_namespaceObject, {
|
90 |
+
"getDownloadableBlocks": function() { return resolvers_getDownloadableBlocks; }
|
91 |
+
});
|
92 |
+
|
93 |
;// CONCATENATED MODULE: external ["wp","element"]
|
94 |
var external_wp_element_namespaceObject = window["wp"]["element"];
|
95 |
;// CONCATENATED MODULE: external ["wp","plugins"]
|
102 |
var external_wp_data_namespaceObject = window["wp"]["data"];
|
103 |
;// CONCATENATED MODULE: external ["wp","editor"]
|
104 |
var external_wp_editor_namespaceObject = window["wp"]["editor"];
|
|
|
|
|
105 |
;// CONCATENATED MODULE: external "lodash"
|
106 |
var external_lodash_namespaceObject = window["lodash"];
|
107 |
;// CONCATENATED MODULE: ./packages/block-directory/build-module/store/reducer.js
|
261 |
*/
|
262 |
|
263 |
function isRequestingDownloadableBlocks(state, filterValue) {
|
264 |
+
var _state$downloadableBl, _state$downloadableBl2;
|
|
|
|
|
265 |
|
266 |
+
return (_state$downloadableBl = (_state$downloadableBl2 = state.downloadableBlocks[filterValue]) === null || _state$downloadableBl2 === void 0 ? void 0 : _state$downloadableBl2.isRequesting) !== null && _state$downloadableBl !== void 0 ? _state$downloadableBl : false;
|
267 |
}
|
268 |
/**
|
269 |
* Returns the available uninstalled blocks.
|
275 |
*/
|
276 |
|
277 |
function getDownloadableBlocks(state, filterValue) {
|
278 |
+
var _state$downloadableBl3, _state$downloadableBl4;
|
|
|
|
|
279 |
|
280 |
+
return (_state$downloadableBl3 = (_state$downloadableBl4 = state.downloadableBlocks[filterValue]) === null || _state$downloadableBl4 === void 0 ? void 0 : _state$downloadableBl4.results) !== null && _state$downloadableBl3 !== void 0 ? _state$downloadableBl3 : [];
|
281 |
}
|
282 |
/**
|
283 |
* Returns the block types that have been installed on the server in this
|
357 |
//# sourceMappingURL=selectors.js.map
|
358 |
;// CONCATENATED MODULE: external ["wp","i18n"]
|
359 |
var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
|
|
|
|
|
360 |
;// CONCATENATED MODULE: external ["wp","apiFetch"]
|
361 |
var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
|
362 |
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
|
363 |
+
;// CONCATENATED MODULE: external ["wp","notices"]
|
364 |
+
var external_wp_notices_namespaceObject = window["wp"]["notices"];
|
365 |
+
;// CONCATENATED MODULE: ./packages/block-directory/build-module/store/load-assets.js
|
366 |
/**
|
367 |
* WordPress dependencies
|
368 |
*/
|
408 |
};
|
409 |
/**
|
410 |
* Load the asset files for a block
|
|
|
|
|
|
|
|
|
411 |
*/
|
412 |
|
413 |
+
async function loadAssets() {
|
414 |
+
/*
|
415 |
+
* Fetch the current URL (post-new.php, or post.php?post=1&action=edit) and compare the
|
416 |
+
* JavaScript and CSS assets loaded between the pages. This imports the required assets
|
417 |
+
* for the block into the current page while not requiring that we know them up-front.
|
418 |
+
* In the future this can be improved by reliance upon block.json and/or a script-loader
|
419 |
+
* dependency API.
|
420 |
+
*/
|
421 |
+
const response = await external_wp_apiFetch_default()({
|
422 |
+
url: document.location.href,
|
423 |
+
parse: false
|
424 |
+
});
|
425 |
+
const data = await response.text();
|
426 |
+
const doc = new window.DOMParser().parseFromString(data, 'text/html');
|
427 |
+
const newAssets = Array.from(doc.querySelectorAll('link[rel="stylesheet"],script')).filter(asset => asset.id && !document.getElementById(asset.id));
|
428 |
+
/*
|
429 |
+
* Load each asset in order, as they may depend upon an earlier loaded script.
|
430 |
+
* Stylesheets and Inline Scripts will resolve immediately upon insertion.
|
431 |
+
*/
|
432 |
+
|
433 |
+
for (const newAsset of newAssets) {
|
434 |
+
await loadAsset(newAsset);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
}
|
436 |
+
}
|
437 |
+
//# sourceMappingURL=load-assets.js.map
|
|
|
|
|
438 |
;// CONCATENATED MODULE: ./packages/block-directory/build-module/store/utils/get-plugin-url.js
|
439 |
/**
|
440 |
* Get the plugin's direct API link out of a block-directory response.
|
465 |
|
466 |
|
467 |
|
|
|
468 |
/**
|
469 |
* Internal dependencies
|
470 |
*/
|
511 |
* @return {boolean} Whether the block was successfully installed & loaded.
|
512 |
*/
|
513 |
|
514 |
+
const installBlockType = block => async ({
|
515 |
+
registry,
|
516 |
+
dispatch
|
517 |
+
}) => {
|
518 |
const {
|
519 |
+
id
|
|
|
520 |
} = block;
|
521 |
let success = false;
|
522 |
+
dispatch.clearErrorNotice(id);
|
523 |
|
524 |
try {
|
525 |
+
dispatch.setIsInstalling(id, true); // If we have a wp:plugin link, the plugin is installed but inactive.
|
526 |
|
527 |
const url = getPluginUrl(block);
|
528 |
let links = {};
|
529 |
|
530 |
if (url) {
|
531 |
+
await external_wp_apiFetch_default()({
|
532 |
+
method: 'PUT',
|
533 |
url,
|
534 |
data: {
|
535 |
status: 'active'
|
536 |
+
}
|
|
|
537 |
});
|
538 |
} else {
|
539 |
+
const response = await external_wp_apiFetch_default()({
|
540 |
+
method: 'POST',
|
541 |
path: 'wp/v2/plugins',
|
542 |
data: {
|
543 |
+
slug: id,
|
544 |
status: 'active'
|
545 |
+
}
|
|
|
546 |
}); // Add the `self` link for newly-installed blocks.
|
547 |
|
548 |
links = response._links;
|
549 |
}
|
550 |
|
551 |
+
dispatch.addInstalledBlockType({ ...block,
|
552 |
links: { ...block.links,
|
553 |
...links
|
554 |
}
|
555 |
});
|
556 |
+
await loadAssets();
|
557 |
+
const registeredBlocks = registry.select(external_wp_blocks_namespaceObject.store).getBlockTypes();
|
558 |
|
559 |
if (!registeredBlocks.some(i => i.name === block.name)) {
|
560 |
throw new Error((0,external_wp_i18n_namespaceObject.__)('Error registering block. Try reloading the page.'));
|
561 |
}
|
562 |
|
563 |
+
registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is the block title.
|
564 |
(0,external_wp_i18n_namespaceObject.__)('Block %s installed and added.'), block.title), {
|
565 |
speak: true,
|
566 |
type: 'snackbar'
|
582 |
message = fatalAPIErrors[error.code];
|
583 |
}
|
584 |
|
585 |
+
dispatch.setErrorNotice(id, message, isFatal);
|
586 |
+
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(message, {
|
587 |
speak: true,
|
588 |
isDismissible: true
|
589 |
});
|
590 |
}
|
591 |
|
592 |
+
dispatch.setIsInstalling(id, false);
|
593 |
return success;
|
594 |
+
};
|
595 |
/**
|
596 |
* Action triggered to uninstall a block plugin.
|
597 |
*
|
598 |
* @param {Object} block The blockType object.
|
599 |
*/
|
600 |
|
601 |
+
const uninstallBlockType = block => async ({
|
602 |
+
registry,
|
603 |
+
dispatch
|
604 |
+
}) => {
|
605 |
try {
|
606 |
+
const url = getPluginUrl(block);
|
607 |
+
await external_wp_apiFetch_default()({
|
608 |
+
method: 'PUT',
|
609 |
+
url,
|
610 |
data: {
|
611 |
status: 'inactive'
|
612 |
+
}
|
|
|
613 |
});
|
614 |
+
await external_wp_apiFetch_default()({
|
615 |
+
method: 'DELETE',
|
616 |
+
url
|
617 |
});
|
618 |
+
dispatch.removeInstalledBlockType(block);
|
619 |
} catch (error) {
|
620 |
+
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(error.message || (0,external_wp_i18n_namespaceObject.__)('An error occurred.'));
|
621 |
}
|
622 |
+
};
|
623 |
/**
|
624 |
* Returns an action object used to add a block type to the "newly installed"
|
625 |
* tracking list.
|
714 |
*/
|
715 |
|
716 |
|
717 |
+
const resolvers_getDownloadableBlocks = filterValue => async ({
|
718 |
+
dispatch
|
719 |
+
}) => {
|
720 |
+
if (!filterValue) {
|
721 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
722 |
}
|
723 |
|
724 |
+
try {
|
725 |
+
dispatch(fetchDownloadableBlocks(filterValue));
|
726 |
+
const results = await external_wp_apiFetch_default()({
|
727 |
+
path: `wp/v2/block-directory/search?term=${filterValue}`
|
728 |
+
});
|
729 |
+
const blocks = results.map(result => (0,external_lodash_namespaceObject.mapKeys)(result, (value, key) => (0,external_lodash_namespaceObject.camelCase)(key)));
|
730 |
+
dispatch(receiveDownloadableBlocks(blocks, filterValue));
|
731 |
+
} catch {}
|
732 |
+
};
|
733 |
//# sourceMappingURL=resolvers.js.map
|
734 |
;// CONCATENATED MODULE: ./packages/block-directory/build-module/store/index.js
|
735 |
/**
|
736 |
* WordPress dependencies
|
737 |
*/
|
738 |
|
|
|
739 |
/**
|
740 |
* Internal dependencies
|
741 |
*/
|
744 |
|
745 |
|
746 |
|
|
|
747 |
/**
|
748 |
* Module Constants
|
749 |
*/
|
761 |
reducer: reducer,
|
762 |
selectors: selectors_namespaceObject,
|
763 |
actions: actions_namespaceObject,
|
764 |
+
resolvers: resolvers_namespaceObject,
|
765 |
+
__experimentalUseThunks: true
|
|
|
|
|
766 |
};
|
767 |
/**
|
768 |
* Store definition for the block directory namespace.
|
1556 |
block,
|
1557 |
clientId
|
1558 |
}) {
|
1559 |
+
const isInstallingBlock = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isInstalling(block.id), [block.id]);
|
1560 |
const {
|
1561 |
installBlockType
|
1562 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
build/block-directory/index.min.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-
|
1 |
+
<?php return array('dependencies' => array('lodash', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives'), 'version' => '992e3fec0ab35bbf35df6b0db8f6f5ae');
|
build/block-directory/index.min.js
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
-
!function(){"use strict";var e={n:function(t){var l=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(l,{a:l}),l},d:function(t,l){for(var n in l)e.o(l,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:l[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:function(){return
|
2 |
-
(0,
|
3 |
/* translators: %s: number of stars. */
|
4 |
-
(0,
|
5 |
/* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */
|
6 |
-
(0,
|
7 |
/* translators: %1$s: block title, %2$s: author name. */
|
8 |
-
(0,
|
9 |
/* translators: %d: number of available blocks. */
|
10 |
-
(0,
|
11 |
/* translators: %s: Name of the block author. */
|
12 |
-
(0,
|
13 |
-
(0,
|
14 |
/* translators: %s: block name */
|
15 |
-
(0,
|
16 |
/* translators: %s: block name */
|
17 |
-
(0,
|
18 |
/* translators: %s: block name */
|
19 |
-
(0,
|
1 |
+
!function(){"use strict";var e={n:function(t){var l=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(l,{a:l}),l},d:function(t,l){for(var n in l)e.o(l,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:l[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:function(){return x}});var l={};e.r(l),e.d(l,{getDownloadableBlocks:function(){return _},getErrorNoticeForBlock:function(){return h},getErrorNotices:function(){return y},getInstalledBlockTypes:function(){return w},getNewBlockTypes:function(){return g},getUnusedBlockTypes:function(){return E},isInstalling:function(){return f},isRequestingDownloadableBlocks:function(){return b}});var n={};e.r(n),e.d(n,{addInstalledBlockType:function(){return P},clearErrorNotice:function(){return F},fetchDownloadableBlocks:function(){return S},installBlockType:function(){return O},receiveDownloadableBlocks:function(){return C},removeInstalledBlockType:function(){return R},setErrorNotice:function(){return M},setIsInstalling:function(){return A},uninstallBlockType:function(){return D}});var o={};e.r(o),e.d(o,{getDownloadableBlocks:function(){return V}});var r=window.wp.element,a=window.wp.plugins,s=window.wp.hooks,i=window.wp.blocks,c=window.wp.data,d=window.wp.editor,u=window.lodash,m=(0,c.combineReducers)({downloadableBlocks:(e={},t)=>{switch(t.type){case"FETCH_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{isRequesting:!0}};case"RECEIVE_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{results:t.downloadableBlocks,isRequesting:!1}}}return e},blockManagement:(e={installedBlockTypes:[],isInstalling:{}},t)=>{switch(t.type){case"ADD_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:[...e.installedBlockTypes,t.item]};case"REMOVE_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:e.installedBlockTypes.filter((e=>e.name!==t.item.name))};case"SET_INSTALLING_BLOCK":return{...e,isInstalling:{...e.isInstalling,[t.blockId]:t.isInstalling}}}return e},errorNotices:(e={},t)=>{switch(t.type){case"SET_ERROR_NOTICE":return{...e,[t.blockId]:{message:t.message,isFatal:t.isFatal}};case"CLEAR_ERROR_NOTICE":return(0,u.omit)(e,t.blockId)}return e}}),p=window.wp.blockEditor;function k(e,t=[]){if(!t.length)return!1;if(t.some((({name:t})=>t===e.name)))return!0;for(let l=0;l<t.length;l++)if(k(e,t[l].innerBlocks))return!0;return!1}function b(e,t){var l,n;return null!==(l=null===(n=e.downloadableBlocks[t])||void 0===n?void 0:n.isRequesting)&&void 0!==l&&l}function _(e,t){var l,n;return null!==(l=null===(n=e.downloadableBlocks[t])||void 0===n?void 0:n.results)&&void 0!==l?l:[]}function w(e){return e.blockManagement.installedBlockTypes}const g=(0,c.createRegistrySelector)((e=>t=>{const l=e(p.store).getBlocks();return w(t).filter((e=>k(e,l)))})),E=(0,c.createRegistrySelector)((e=>t=>{const l=e(p.store).getBlocks();return w(t).filter((e=>!k(e,l)))}));function f(e,t){return e.blockManagement.isInstalling[t]||!1}function y(e){return e.errorNotices}function h(e,t){return e.errorNotices[t]}var v=window.wp.i18n,B=window.wp.apiFetch,N=e.n(B),I=window.wp.notices;const T=e=>new Promise(((t,l)=>{const n=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach((t=>{e[t]&&(n[t]=e[t])})),e.innerHTML&&n.appendChild(document.createTextNode(e.innerHTML)),n.onload=()=>t(!0),n.onerror=()=>l(new Error("Error loading asset.")),document.body.appendChild(n),("link"===n.nodeName.toLowerCase()||"script"===n.nodeName.toLowerCase()&&!n.src)&&t()}));function L(e){if(!e)return!1;const t=e.links["wp:plugin"]||e.links.self;return!(!t||!t.length)&&t[0].href}function S(e){return{type:"FETCH_DOWNLOADABLE_BLOCKS",filterValue:e}}function C(e,t){return{type:"RECEIVE_DOWNLOADABLE_BLOCKS",downloadableBlocks:e,filterValue:t}}const O=e=>async({registry:t,dispatch:l})=>{const{id:n}=e;let o=!1;l.clearErrorNotice(n);try{l.setIsInstalling(n,!0);const r=L(e);let a={};if(r?await N()({method:"PUT",url:r,data:{status:"active"}}):a=(await N()({method:"POST",path:"wp/v2/plugins",data:{slug:n,status:"active"}}))._links,l.addInstalledBlockType({...e,links:{...e.links,...a}}),await async function(){const e=await N()({url:document.location.href,parse:!1}),t=await e.text(),l=(new window.DOMParser).parseFromString(t,"text/html"),n=Array.from(l.querySelectorAll('link[rel="stylesheet"],script')).filter((e=>e.id&&!document.getElementById(e.id)));for(const e of n)await T(e)}(),!t.select(i.store).getBlockTypes().some((t=>t.name===e.name)))throw new Error((0,v.__)("Error registering block. Try reloading the page."));t.dispatch(I.store).createInfoNotice((0,v.sprintf)(// translators: %s is the block title.
|
2 |
+
(0,v.__)("Block %s installed and added."),e.title),{speak:!0,type:"snackbar"}),o=!0}catch(e){let o=e.message||(0,v.__)("An error occurred."),r=e instanceof Error;const a={folder_exists:(0,v.__)("This block is already installed. Try reloading the page."),unable_to_connect_to_filesystem:(0,v.__)("Error installing block. You can reload the page and try again.")};a[e.code]&&(r=!0,o=a[e.code]),l.setErrorNotice(n,o,r),t.dispatch(I.store).createErrorNotice(o,{speak:!0,isDismissible:!0})}return l.setIsInstalling(n,!1),o},D=e=>async({registry:t,dispatch:l})=>{try{const t=L(e);await N()({method:"PUT",url:t,data:{status:"inactive"}}),await N()({method:"DELETE",url:t}),l.removeInstalledBlockType(e)}catch(e){t.dispatch(I.store).createErrorNotice(e.message||(0,v.__)("An error occurred."))}};function P(e){return{type:"ADD_INSTALLED_BLOCK_TYPE",item:e}}function R(e){return{type:"REMOVE_INSTALLED_BLOCK_TYPE",item:e}}function A(e,t){return{type:"SET_INSTALLING_BLOCK",blockId:e,isInstalling:t}}function M(e,t,l=!1){return{type:"SET_ERROR_NOTICE",blockId:e,message:t,isFatal:l}}function F(e){return{type:"CLEAR_ERROR_NOTICE",blockId:e}}const V=e=>async({dispatch:t})=>{if(e)try{t(S(e));t(C((await N()({path:`wp/v2/block-directory/search?term=${e}`})).map((e=>(0,u.mapKeys)(e,((e,t)=>(0,u.camelCase)(t))))),e))}catch{}},H={reducer:m,selectors:l,actions:n,resolvers:o,__experimentalUseThunks:!0},x=(0,c.createReduxStore)("core/block-directory",H);function $(){const{uninstallBlockType:e}=(0,c.useDispatch)(x),t=(0,c.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:l}=e(d.store);return l()&&!t()}),[]),l=(0,c.useSelect)((e=>e(x).getUnusedBlockTypes()),[]);return(0,r.useEffect)((()=>{t&&l.length&&l.forEach((t=>{e(t),(0,i.unregisterBlockType)(t.name)}))}),[t]),null}(0,c.register)(x);var K=window.wp.components,z=window.wp.compose,U=window.wp.coreData;function Y(){return(Y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e}).apply(this,arguments)}var j=window.wp.htmlEntities,q=function({icon:e,size:t=24,...l}){return(0,r.cloneElement)(e,{width:t,height:t,...l})},G=window.wp.primitives,W=(0,r.createElement)(G.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(G.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"})),J=(0,r.createElement)(G.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(G.Path,{d:"M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39v7.143z"})),Q=(0,r.createElement)(G.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(G.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})),X=function({rating:e}){const t=.5*Math.round(e/.5),l=Math.floor(e),n=Math.ceil(e-l),o=5-(l+n);return(0,r.createElement)("span",{"aria-label":(0,v.sprintf)(
|
3 |
/* translators: %s: number of stars. */
|
4 |
+
(0,v.__)("%s out of 5 stars"),t)},(0,u.times)(l,(e=>(0,r.createElement)(q,{key:`full_stars_${e}`,className:"block-directory-block-ratings__star-full",icon:W,size:16}))),(0,u.times)(n,(e=>(0,r.createElement)(q,{key:`half_stars_${e}`,className:"block-directory-block-ratings__star-half-full",icon:J,size:16}))),(0,u.times)(o,(e=>(0,r.createElement)(q,{key:`empty_stars_${e}`,className:"block-directory-block-ratings__star-empty",icon:Q,size:16}))))},Z=({rating:e})=>(0,r.createElement)("span",{className:"block-directory-block-ratings"},(0,r.createElement)(X,{rating:e})),ee=function({icon:e}){const t="block-directory-downloadable-block-icon";return null!==e.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/)?(0,r.createElement)("img",{className:t,src:e,alt:""}):(0,r.createElement)(p.BlockIcon,{className:t,icon:e,showColors:!0})},te=({block:e})=>{const t=(0,c.useSelect)((t=>t(x).getErrorNoticeForBlock(e.id)),[e]);return t?(0,r.createElement)("div",{className:"block-directory-downloadable-block-notice"},(0,r.createElement)("div",{className:"block-directory-downloadable-block-notice__content"},t.message,t.isFatal?" "+(0,v.__)("Try reloading the page."):null)):null};function le({title:e,rating:t,ratingCount:l},{hasNotice:n,isInstalled:o,isInstalling:r}){const a=.5*Math.round(t/.5);return!o&&n?(0,v.sprintf)("Retry installing %s.",(0,j.decodeEntities)(e)):o?(0,v.sprintf)("Add %s.",(0,j.decodeEntities)(e)):r?(0,v.sprintf)("Installing %s.",(0,j.decodeEntities)(e)):l<1?(0,v.sprintf)("Install %s.",(0,j.decodeEntities)(e)):(0,v.sprintf)(
|
5 |
/* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */
|
6 |
+
(0,v._n)("Install %1$s. %2$s stars with %3$s review.","Install %1$s. %2$s stars with %3$s reviews.",l),(0,j.decodeEntities)(e),a,l)}var ne=function({composite:e,item:t,onClick:l}){const{author:n,description:o,icon:a,rating:s,title:d}=t,u=!!(0,i.getBlockType)(t.name),{hasNotice:m,isInstalling:p,isInstallable:k}=(0,c.useSelect)((e=>{const{getErrorNoticeForBlock:l,isInstalling:n}=e(x),o=l(t.id),r=o&&o.isFatal;return{hasNotice:!!o,isInstalling:n(t.id),isInstallable:!r}}),[t]);let b="";return u?b=(0,v.__)("Installed!"):p&&(b=(0,v.__)("Installing…")),(0,r.createElement)(K.__unstableCompositeItem,Y({role:"option",as:K.Button},e,{className:"block-directory-downloadable-block-list-item",onClick:e=>{e.preventDefault(),l()},isBusy:p,disabled:p||!k,label:le(t,{hasNotice:m,isInstalled:u,isInstalling:p}),showTooltip:!0,tooltipPosition:"top center"}),(0,r.createElement)("div",{className:"block-directory-downloadable-block-list-item__icon"},(0,r.createElement)(ee,{icon:a,title:d}),p?(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__spinner"},(0,r.createElement)(K.Spinner,null)):(0,r.createElement)(Z,{rating:s})),(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__details"},(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__title"},(0,r.createInterpolateElement)((0,v.sprintf)(
|
7 |
/* translators: %1$s: block title, %2$s: author name. */
|
8 |
+
(0,v.__)("%1$s <span>by %2$s</span>"),(0,j.decodeEntities)(d),n),{span:(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__author"})})),m?(0,r.createElement)(te,{block:t}):(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__desc"},b||(0,j.decodeEntities)(o)),k&&!(u||p)&&(0,r.createElement)(K.VisuallyHidden,null,(0,v.__)("Install block")))))},oe=function({items:e,onHover:t=u.noop,onSelect:l}){const n=(0,K.__unstableUseCompositeState)(),{installBlockType:o}=(0,c.useDispatch)(x);return e.length?(0,r.createElement)(K.__unstableComposite,Y({},n,{role:"listbox",className:"block-directory-downloadable-blocks-list","aria-label":(0,v.__)("Blocks available for install")}),e.map((e=>(0,r.createElement)(ne,{key:e.id,composite:n,onClick:()=>{(0,i.getBlockType)(e.name)?l(e):o(e).then((t=>{t&&l(e)})),t(null)},onHover:t,item:e})))):null},re=window.wp.a11y,ae=function({children:e,downloadableItems:t,hasLocalBlocks:l}){const n=t.length;return(0,r.useEffect)((()=>{(0,re.speak)((0,v.sprintf)(
|
9 |
/* translators: %d: number of available blocks. */
|
10 |
+
(0,v._n)("%d additional block is available to install.","%d additional blocks are available to install.",n),n))}),[n]),(0,r.createElement)(r.Fragment,null,!l&&(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,r.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"}),(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel"},(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel__header"},(0,r.createElement)("h2",{className:"block-directory-downloadable-blocks-panel__title"},(0,v.__)("Available to install")),(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description"},(0,v.__)("Select a block to install and add it to your post."))),e))},se=(0,r.createElement)(G.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(G.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"})),ie=function(){return(0,r.createElement)("div",{className:"block-editor-inserter__no-results"},(0,r.createElement)(q,{className:"block-editor-inserter__no-results-icon",icon:se}),(0,r.createElement)("p",null,(0,v.__)("No results found.")))},ce=(0,z.compose)([(0,c.withSelect)(((e,{filterValue:t,rootClientId:l=null})=>{const{getDownloadableBlocks:n,isRequestingDownloadableBlocks:o}=e(x),{canInsertBlockType:r}=e(p.store),a=e(U.store).canUser("read","block-directory/search");return{downloadableItems:a?n(t).filter((e=>r(e,l,!0))):[],hasPermission:a,isLoading:o(t)}}))])((function({downloadableItems:e,onSelect:t,onHover:l,hasLocalBlocks:n,hasPermission:o,isLoading:a,isTyping:s}){return void 0===o||a||s?(0,r.createElement)(r.Fragment,null,o&&!n&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,r.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"})),(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel has-blocks-loading"},(0,r.createElement)(K.Spinner,null))):!1===o?n?null:(0,r.createElement)(ie,null):e.length?(0,r.createElement)(ae,{downloadableItems:e,hasLocalBlocks:n},(0,r.createElement)(oe,{items:e,onSelect:t,onHover:l})):!n&&(0,r.createElement)(ie,null)})),de=function(){const[e,t]=(0,r.useState)(""),l=(0,u.debounce)(t,400);return(0,r.createElement)(p.__unstableInserterMenuExtension,null,(({onSelect:t,onHover:n,filterValue:o,hasItems:a,rootClientId:s})=>(e!==o&&l(o),e?(0,r.createElement)(ce,{onSelect:t,onHover:n,rootClientId:s,filterValue:e,hasLocalBlocks:a,isTyping:o!==e}):null)))},ue=window.wp.editPost;function me({items:e}){return e.length?(0,r.createElement)("ul",{className:"block-directory-compact-list"},e.map((({icon:e,id:t,title:l,author:n})=>(0,r.createElement)("li",{key:t,className:"block-directory-compact-list__item"},(0,r.createElement)(ee,{icon:e,title:l}),(0,r.createElement)("div",{className:"block-directory-compact-list__item-details"},(0,r.createElement)("div",{className:"block-directory-compact-list__item-title"},l),(0,r.createElement)("div",{className:"block-directory-compact-list__item-author"},(0,v.sprintf)(
|
11 |
/* translators: %s: Name of the block author. */
|
12 |
+
(0,v.__)("By %s"),n))))))):null}function pe(){const e=(0,c.useSelect)((e=>e(x).getNewBlockTypes()),[]);return e.length?(0,r.createElement)(ue.PluginPrePublishPanel,{icon:se,title:(0,v.sprintf)(// translators: %d: number of blocks (number).
|
13 |
+
(0,v._n)("Added: %d block","Added: %d blocks",e.length),e.length),initialOpen:!0},(0,r.createElement)("p",{className:"installed-blocks-pre-publish-panel__copy"},(0,v._n)("The following block has been added to your site.","The following blocks have been added to your site.",e.length)),(0,r.createElement)(me,{items:e})):null}function ke({attributes:e,block:t,clientId:l}){const n=(0,c.useSelect)((e=>e(x).isInstalling(t.id)),[t.id]),{installBlockType:o}=(0,c.useDispatch)(x),{replaceBlock:a}=(0,c.useDispatch)(p.store);return(0,r.createElement)(K.Button,{onClick:()=>o(t).then((n=>{if(n){const n=(0,i.getBlockType)(t.name),[o]=(0,i.parse)(e.originalContent);o&&a(l,(0,i.createBlock)(n.name,o.attributes,o.innerBlocks))}})),disabled:n,isBusy:n,variant:"primary"},(0,v.sprintf)(
|
14 |
/* translators: %s: block name */
|
15 |
+
(0,v.__)("Install %s"),t.title))}const be=({originalBlock:e,...t})=>{const{originalName:l,originalUndelimitedContent:n}=t.attributes,{replaceBlock:o}=(0,c.useDispatch)(p.store),a=!!n,s=(0,i.getBlockType)("core/html");let d=(0,v.sprintf)(
|
16 |
/* translators: %s: block name */
|
17 |
+
(0,v.__)("Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely."),e.title||l);const u=[(0,r.createElement)(ke,{key:"install",block:e,attributes:t.attributes,clientId:t.clientId})];return a&&s&&(d=(0,v.sprintf)(
|
18 |
/* translators: %s: block name */
|
19 |
+
(0,v.__)("Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."),e.title||l),u.push((0,r.createElement)(K.Button,{key:"convert",onClick:()=>{o(t.clientId,(0,i.createBlock)("core/html",{content:n}))},variant:"link"},(0,v.__)("Keep as HTML")))),(0,r.createElement)("div",(0,p.useBlockProps)(),(0,r.createElement)(p.Warning,{actions:u},d),(0,r.createElement)(r.RawHTML,null,n))};(0,a.registerPlugin)("block-directory",{render:()=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)($,null),(0,r.createElement)(de,null),(0,r.createElement)(pe,null))}),(0,s.addFilter)("blocks.registerBlockType","block-directory/fallback",((e,t)=>{return"core/missing"!==t||(e.edit=(l=e.edit,e=>{const{originalName:t}=e.attributes,{block:n,hasPermission:o}=(0,c.useSelect)((e=>{const{getDownloadableBlocks:l}=e(x),n=l("block:"+t).filter((({name:e})=>t===e));return{hasPermission:e(U.store).canUser("read","block-directory/search"),block:n.length&&n[0]}}),[t]);return o&&n?(0,r.createElement)(be,Y({},e,{originalBlock:n})):(0,r.createElement)(l,e)})),e;var l})),(window.wp=window.wp||{}).blockDirectory=t}();
|
build/block-editor/index.js
CHANGED
@@ -1733,1207 +1733,6 @@ var TextareaAutosize_1 = __webpack_require__(4857);
|
|
1733 |
exports.Z = TextareaAutosize_1.TextareaAutosize;
|
1734 |
|
1735 |
|
1736 |
-
/***/ }),
|
1737 |
-
|
1738 |
-
/***/ 7621:
|
1739 |
-
/***/ (function(module, exports, __webpack_require__) {
|
1740 |
-
|
1741 |
-
var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.2
|
1742 |
-
// https://github.com/bgrins/TinyColor
|
1743 |
-
// Brian Grinstead, MIT License
|
1744 |
-
|
1745 |
-
(function(Math) {
|
1746 |
-
|
1747 |
-
var trimLeft = /^\s+/,
|
1748 |
-
trimRight = /\s+$/,
|
1749 |
-
tinyCounter = 0,
|
1750 |
-
mathRound = Math.round,
|
1751 |
-
mathMin = Math.min,
|
1752 |
-
mathMax = Math.max,
|
1753 |
-
mathRandom = Math.random;
|
1754 |
-
|
1755 |
-
function tinycolor (color, opts) {
|
1756 |
-
|
1757 |
-
color = (color) ? color : '';
|
1758 |
-
opts = opts || { };
|
1759 |
-
|
1760 |
-
// If input is already a tinycolor, return itself
|
1761 |
-
if (color instanceof tinycolor) {
|
1762 |
-
return color;
|
1763 |
-
}
|
1764 |
-
// If we are called as a function, call using new instead
|
1765 |
-
if (!(this instanceof tinycolor)) {
|
1766 |
-
return new tinycolor(color, opts);
|
1767 |
-
}
|
1768 |
-
|
1769 |
-
var rgb = inputToRGB(color);
|
1770 |
-
this._originalInput = color,
|
1771 |
-
this._r = rgb.r,
|
1772 |
-
this._g = rgb.g,
|
1773 |
-
this._b = rgb.b,
|
1774 |
-
this._a = rgb.a,
|
1775 |
-
this._roundA = mathRound(100*this._a) / 100,
|
1776 |
-
this._format = opts.format || rgb.format;
|
1777 |
-
this._gradientType = opts.gradientType;
|
1778 |
-
|
1779 |
-
// Don't let the range of [0,255] come back in [0,1].
|
1780 |
-
// Potentially lose a little bit of precision here, but will fix issues where
|
1781 |
-
// .5 gets interpreted as half of the total, instead of half of 1
|
1782 |
-
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
1783 |
-
if (this._r < 1) { this._r = mathRound(this._r); }
|
1784 |
-
if (this._g < 1) { this._g = mathRound(this._g); }
|
1785 |
-
if (this._b < 1) { this._b = mathRound(this._b); }
|
1786 |
-
|
1787 |
-
this._ok = rgb.ok;
|
1788 |
-
this._tc_id = tinyCounter++;
|
1789 |
-
}
|
1790 |
-
|
1791 |
-
tinycolor.prototype = {
|
1792 |
-
isDark: function() {
|
1793 |
-
return this.getBrightness() < 128;
|
1794 |
-
},
|
1795 |
-
isLight: function() {
|
1796 |
-
return !this.isDark();
|
1797 |
-
},
|
1798 |
-
isValid: function() {
|
1799 |
-
return this._ok;
|
1800 |
-
},
|
1801 |
-
getOriginalInput: function() {
|
1802 |
-
return this._originalInput;
|
1803 |
-
},
|
1804 |
-
getFormat: function() {
|
1805 |
-
return this._format;
|
1806 |
-
},
|
1807 |
-
getAlpha: function() {
|
1808 |
-
return this._a;
|
1809 |
-
},
|
1810 |
-
getBrightness: function() {
|
1811 |
-
//http://www.w3.org/TR/AERT#color-contrast
|
1812 |
-
var rgb = this.toRgb();
|
1813 |
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
1814 |
-
},
|
1815 |
-
getLuminance: function() {
|
1816 |
-
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
1817 |
-
var rgb = this.toRgb();
|
1818 |
-
var RsRGB, GsRGB, BsRGB, R, G, B;
|
1819 |
-
RsRGB = rgb.r/255;
|
1820 |
-
GsRGB = rgb.g/255;
|
1821 |
-
BsRGB = rgb.b/255;
|
1822 |
-
|
1823 |
-
if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}
|
1824 |
-
if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}
|
1825 |
-
if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}
|
1826 |
-
return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);
|
1827 |
-
},
|
1828 |
-
setAlpha: function(value) {
|
1829 |
-
this._a = boundAlpha(value);
|
1830 |
-
this._roundA = mathRound(100*this._a) / 100;
|
1831 |
-
return this;
|
1832 |
-
},
|
1833 |
-
toHsv: function() {
|
1834 |
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
1835 |
-
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
|
1836 |
-
},
|
1837 |
-
toHsvString: function() {
|
1838 |
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
1839 |
-
var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
|
1840 |
-
return (this._a == 1) ?
|
1841 |
-
"hsv(" + h + ", " + s + "%, " + v + "%)" :
|
1842 |
-
"hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
|
1843 |
-
},
|
1844 |
-
toHsl: function() {
|
1845 |
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
1846 |
-
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
|
1847 |
-
},
|
1848 |
-
toHslString: function() {
|
1849 |
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
1850 |
-
var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
|
1851 |
-
return (this._a == 1) ?
|
1852 |
-
"hsl(" + h + ", " + s + "%, " + l + "%)" :
|
1853 |
-
"hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
|
1854 |
-
},
|
1855 |
-
toHex: function(allow3Char) {
|
1856 |
-
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
1857 |
-
},
|
1858 |
-
toHexString: function(allow3Char) {
|
1859 |
-
return '#' + this.toHex(allow3Char);
|
1860 |
-
},
|
1861 |
-
toHex8: function(allow4Char) {
|
1862 |
-
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
1863 |
-
},
|
1864 |
-
toHex8String: function(allow4Char) {
|
1865 |
-
return '#' + this.toHex8(allow4Char);
|
1866 |
-
},
|
1867 |
-
toRgb: function() {
|
1868 |
-
return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
|
1869 |
-
},
|
1870 |
-
toRgbString: function() {
|
1871 |
-
return (this._a == 1) ?
|
1872 |
-
"rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
|
1873 |
-
"rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
|
1874 |
-
},
|
1875 |
-
toPercentageRgb: function() {
|
1876 |
-
return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
|
1877 |
-
},
|
1878 |
-
toPercentageRgbString: function() {
|
1879 |
-
return (this._a == 1) ?
|
1880 |
-
"rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
|
1881 |
-
"rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
1882 |
-
},
|
1883 |
-
toName: function() {
|
1884 |
-
if (this._a === 0) {
|
1885 |
-
return "transparent";
|
1886 |
-
}
|
1887 |
-
|
1888 |
-
if (this._a < 1) {
|
1889 |
-
return false;
|
1890 |
-
}
|
1891 |
-
|
1892 |
-
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
1893 |
-
},
|
1894 |
-
toFilter: function(secondColor) {
|
1895 |
-
var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
1896 |
-
var secondHex8String = hex8String;
|
1897 |
-
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
1898 |
-
|
1899 |
-
if (secondColor) {
|
1900 |
-
var s = tinycolor(secondColor);
|
1901 |
-
secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
1902 |
-
}
|
1903 |
-
|
1904 |
-
return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
|
1905 |
-
},
|
1906 |
-
toString: function(format) {
|
1907 |
-
var formatSet = !!format;
|
1908 |
-
format = format || this._format;
|
1909 |
-
|
1910 |
-
var formattedString = false;
|
1911 |
-
var hasAlpha = this._a < 1 && this._a >= 0;
|
1912 |
-
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
1913 |
-
|
1914 |
-
if (needsAlphaFormat) {
|
1915 |
-
// Special case for "transparent", all other non-alpha formats
|
1916 |
-
// will return rgba when there is transparency.
|
1917 |
-
if (format === "name" && this._a === 0) {
|
1918 |
-
return this.toName();
|
1919 |
-
}
|
1920 |
-
return this.toRgbString();
|
1921 |
-
}
|
1922 |
-
if (format === "rgb") {
|
1923 |
-
formattedString = this.toRgbString();
|
1924 |
-
}
|
1925 |
-
if (format === "prgb") {
|
1926 |
-
formattedString = this.toPercentageRgbString();
|
1927 |
-
}
|
1928 |
-
if (format === "hex" || format === "hex6") {
|
1929 |
-
formattedString = this.toHexString();
|
1930 |
-
}
|
1931 |
-
if (format === "hex3") {
|
1932 |
-
formattedString = this.toHexString(true);
|
1933 |
-
}
|
1934 |
-
if (format === "hex4") {
|
1935 |
-
formattedString = this.toHex8String(true);
|
1936 |
-
}
|
1937 |
-
if (format === "hex8") {
|
1938 |
-
formattedString = this.toHex8String();
|
1939 |
-
}
|
1940 |
-
if (format === "name") {
|
1941 |
-
formattedString = this.toName();
|
1942 |
-
}
|
1943 |
-
if (format === "hsl") {
|
1944 |
-
formattedString = this.toHslString();
|
1945 |
-
}
|
1946 |
-
if (format === "hsv") {
|
1947 |
-
formattedString = this.toHsvString();
|
1948 |
-
}
|
1949 |
-
|
1950 |
-
return formattedString || this.toHexString();
|
1951 |
-
},
|
1952 |
-
clone: function() {
|
1953 |
-
return tinycolor(this.toString());
|
1954 |
-
},
|
1955 |
-
|
1956 |
-
_applyModification: function(fn, args) {
|
1957 |
-
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
1958 |
-
this._r = color._r;
|
1959 |
-
this._g = color._g;
|
1960 |
-
this._b = color._b;
|
1961 |
-
this.setAlpha(color._a);
|
1962 |
-
return this;
|
1963 |
-
},
|
1964 |
-
lighten: function() {
|
1965 |
-
return this._applyModification(lighten, arguments);
|
1966 |
-
},
|
1967 |
-
brighten: function() {
|
1968 |
-
return this._applyModification(brighten, arguments);
|
1969 |
-
},
|
1970 |
-
darken: function() {
|
1971 |
-
return this._applyModification(darken, arguments);
|
1972 |
-
},
|
1973 |
-
desaturate: function() {
|
1974 |
-
return this._applyModification(desaturate, arguments);
|
1975 |
-
},
|
1976 |
-
saturate: function() {
|
1977 |
-
return this._applyModification(saturate, arguments);
|
1978 |
-
},
|
1979 |
-
greyscale: function() {
|
1980 |
-
return this._applyModification(greyscale, arguments);
|
1981 |
-
},
|
1982 |
-
spin: function() {
|
1983 |
-
return this._applyModification(spin, arguments);
|
1984 |
-
},
|
1985 |
-
|
1986 |
-
_applyCombination: function(fn, args) {
|
1987 |
-
return fn.apply(null, [this].concat([].slice.call(args)));
|
1988 |
-
},
|
1989 |
-
analogous: function() {
|
1990 |
-
return this._applyCombination(analogous, arguments);
|
1991 |
-
},
|
1992 |
-
complement: function() {
|
1993 |
-
return this._applyCombination(complement, arguments);
|
1994 |
-
},
|
1995 |
-
monochromatic: function() {
|
1996 |
-
return this._applyCombination(monochromatic, arguments);
|
1997 |
-
},
|
1998 |
-
splitcomplement: function() {
|
1999 |
-
return this._applyCombination(splitcomplement, arguments);
|
2000 |
-
},
|
2001 |
-
triad: function() {
|
2002 |
-
return this._applyCombination(triad, arguments);
|
2003 |
-
},
|
2004 |
-
tetrad: function() {
|
2005 |
-
return this._applyCombination(tetrad, arguments);
|
2006 |
-
}
|
2007 |
-
};
|
2008 |
-
|
2009 |
-
// If input is an object, force 1 into "1.0" to handle ratios properly
|
2010 |
-
// String input requires "1.0" as input, so 1 will be treated as 1
|
2011 |
-
tinycolor.fromRatio = function(color, opts) {
|
2012 |
-
if (typeof color == "object") {
|
2013 |
-
var newColor = {};
|
2014 |
-
for (var i in color) {
|
2015 |
-
if (color.hasOwnProperty(i)) {
|
2016 |
-
if (i === "a") {
|
2017 |
-
newColor[i] = color[i];
|
2018 |
-
}
|
2019 |
-
else {
|
2020 |
-
newColor[i] = convertToPercentage(color[i]);
|
2021 |
-
}
|
2022 |
-
}
|
2023 |
-
}
|
2024 |
-
color = newColor;
|
2025 |
-
}
|
2026 |
-
|
2027 |
-
return tinycolor(color, opts);
|
2028 |
-
};
|
2029 |
-
|
2030 |
-
// Given a string or object, convert that input to RGB
|
2031 |
-
// Possible string inputs:
|
2032 |
-
//
|
2033 |
-
// "red"
|
2034 |
-
// "#f00" or "f00"
|
2035 |
-
// "#ff0000" or "ff0000"
|
2036 |
-
// "#ff000000" or "ff000000"
|
2037 |
-
// "rgb 255 0 0" or "rgb (255, 0, 0)"
|
2038 |
-
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
2039 |
-
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
2040 |
-
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
2041 |
-
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
2042 |
-
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
2043 |
-
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
2044 |
-
//
|
2045 |
-
function inputToRGB(color) {
|
2046 |
-
|
2047 |
-
var rgb = { r: 0, g: 0, b: 0 };
|
2048 |
-
var a = 1;
|
2049 |
-
var s = null;
|
2050 |
-
var v = null;
|
2051 |
-
var l = null;
|
2052 |
-
var ok = false;
|
2053 |
-
var format = false;
|
2054 |
-
|
2055 |
-
if (typeof color == "string") {
|
2056 |
-
color = stringInputToObject(color);
|
2057 |
-
}
|
2058 |
-
|
2059 |
-
if (typeof color == "object") {
|
2060 |
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
2061 |
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
2062 |
-
ok = true;
|
2063 |
-
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
2064 |
-
}
|
2065 |
-
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
2066 |
-
s = convertToPercentage(color.s);
|
2067 |
-
v = convertToPercentage(color.v);
|
2068 |
-
rgb = hsvToRgb(color.h, s, v);
|
2069 |
-
ok = true;
|
2070 |
-
format = "hsv";
|
2071 |
-
}
|
2072 |
-
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
2073 |
-
s = convertToPercentage(color.s);
|
2074 |
-
l = convertToPercentage(color.l);
|
2075 |
-
rgb = hslToRgb(color.h, s, l);
|
2076 |
-
ok = true;
|
2077 |
-
format = "hsl";
|
2078 |
-
}
|
2079 |
-
|
2080 |
-
if (color.hasOwnProperty("a")) {
|
2081 |
-
a = color.a;
|
2082 |
-
}
|
2083 |
-
}
|
2084 |
-
|
2085 |
-
a = boundAlpha(a);
|
2086 |
-
|
2087 |
-
return {
|
2088 |
-
ok: ok,
|
2089 |
-
format: color.format || format,
|
2090 |
-
r: mathMin(255, mathMax(rgb.r, 0)),
|
2091 |
-
g: mathMin(255, mathMax(rgb.g, 0)),
|
2092 |
-
b: mathMin(255, mathMax(rgb.b, 0)),
|
2093 |
-
a: a
|
2094 |
-
};
|
2095 |
-
}
|
2096 |
-
|
2097 |
-
|
2098 |
-
// Conversion Functions
|
2099 |
-
// --------------------
|
2100 |
-
|
2101 |
-
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
2102 |
-
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
2103 |
-
|
2104 |
-
// `rgbToRgb`
|
2105 |
-
// Handle bounds / percentage checking to conform to CSS color spec
|
2106 |
-
// <http://www.w3.org/TR/css3-color/>
|
2107 |
-
// *Assumes:* r, g, b in [0, 255] or [0, 1]
|
2108 |
-
// *Returns:* { r, g, b } in [0, 255]
|
2109 |
-
function rgbToRgb(r, g, b){
|
2110 |
-
return {
|
2111 |
-
r: bound01(r, 255) * 255,
|
2112 |
-
g: bound01(g, 255) * 255,
|
2113 |
-
b: bound01(b, 255) * 255
|
2114 |
-
};
|
2115 |
-
}
|
2116 |
-
|
2117 |
-
// `rgbToHsl`
|
2118 |
-
// Converts an RGB color value to HSL.
|
2119 |
-
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
|
2120 |
-
// *Returns:* { h, s, l } in [0,1]
|
2121 |
-
function rgbToHsl(r, g, b) {
|
2122 |
-
|
2123 |
-
r = bound01(r, 255);
|
2124 |
-
g = bound01(g, 255);
|
2125 |
-
b = bound01(b, 255);
|
2126 |
-
|
2127 |
-
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
2128 |
-
var h, s, l = (max + min) / 2;
|
2129 |
-
|
2130 |
-
if(max == min) {
|
2131 |
-
h = s = 0; // achromatic
|
2132 |
-
}
|
2133 |
-
else {
|
2134 |
-
var d = max - min;
|
2135 |
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
2136 |
-
switch(max) {
|
2137 |
-
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
2138 |
-
case g: h = (b - r) / d + 2; break;
|
2139 |
-
case b: h = (r - g) / d + 4; break;
|
2140 |
-
}
|
2141 |
-
|
2142 |
-
h /= 6;
|
2143 |
-
}
|
2144 |
-
|
2145 |
-
return { h: h, s: s, l: l };
|
2146 |
-
}
|
2147 |
-
|
2148 |
-
// `hslToRgb`
|
2149 |
-
// Converts an HSL color value to RGB.
|
2150 |
-
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
2151 |
-
// *Returns:* { r, g, b } in the set [0, 255]
|
2152 |
-
function hslToRgb(h, s, l) {
|
2153 |
-
var r, g, b;
|
2154 |
-
|
2155 |
-
h = bound01(h, 360);
|
2156 |
-
s = bound01(s, 100);
|
2157 |
-
l = bound01(l, 100);
|
2158 |
-
|
2159 |
-
function hue2rgb(p, q, t) {
|
2160 |
-
if(t < 0) t += 1;
|
2161 |
-
if(t > 1) t -= 1;
|
2162 |
-
if(t < 1/6) return p + (q - p) * 6 * t;
|
2163 |
-
if(t < 1/2) return q;
|
2164 |
-
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
2165 |
-
return p;
|
2166 |
-
}
|
2167 |
-
|
2168 |
-
if(s === 0) {
|
2169 |
-
r = g = b = l; // achromatic
|
2170 |
-
}
|
2171 |
-
else {
|
2172 |
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
2173 |
-
var p = 2 * l - q;
|
2174 |
-
r = hue2rgb(p, q, h + 1/3);
|
2175 |
-
g = hue2rgb(p, q, h);
|
2176 |
-
b = hue2rgb(p, q, h - 1/3);
|
2177 |
-
}
|
2178 |
-
|
2179 |
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
2180 |
-
}
|
2181 |
-
|
2182 |
-
// `rgbToHsv`
|
2183 |
-
// Converts an RGB color value to HSV
|
2184 |
-
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
2185 |
-
// *Returns:* { h, s, v } in [0,1]
|
2186 |
-
function rgbToHsv(r, g, b) {
|
2187 |
-
|
2188 |
-
r = bound01(r, 255);
|
2189 |
-
g = bound01(g, 255);
|
2190 |
-
b = bound01(b, 255);
|
2191 |
-
|
2192 |
-
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
2193 |
-
var h, s, v = max;
|
2194 |
-
|
2195 |
-
var d = max - min;
|
2196 |
-
s = max === 0 ? 0 : d / max;
|
2197 |
-
|
2198 |
-
if(max == min) {
|
2199 |
-
h = 0; // achromatic
|
2200 |
-
}
|
2201 |
-
else {
|
2202 |
-
switch(max) {
|
2203 |
-
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
2204 |
-
case g: h = (b - r) / d + 2; break;
|
2205 |
-
case b: h = (r - g) / d + 4; break;
|
2206 |
-
}
|
2207 |
-
h /= 6;
|
2208 |
-
}
|
2209 |
-
return { h: h, s: s, v: v };
|
2210 |
-
}
|
2211 |
-
|
2212 |
-
// `hsvToRgb`
|
2213 |
-
// Converts an HSV color value to RGB.
|
2214 |
-
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
2215 |
-
// *Returns:* { r, g, b } in the set [0, 255]
|
2216 |
-
function hsvToRgb(h, s, v) {
|
2217 |
-
|
2218 |
-
h = bound01(h, 360) * 6;
|
2219 |
-
s = bound01(s, 100);
|
2220 |
-
v = bound01(v, 100);
|
2221 |
-
|
2222 |
-
var i = Math.floor(h),
|
2223 |
-
f = h - i,
|
2224 |
-
p = v * (1 - s),
|
2225 |
-
q = v * (1 - f * s),
|
2226 |
-
t = v * (1 - (1 - f) * s),
|
2227 |
-
mod = i % 6,
|
2228 |
-
r = [v, q, p, p, t, v][mod],
|
2229 |
-
g = [t, v, v, q, p, p][mod],
|
2230 |
-
b = [p, p, t, v, v, q][mod];
|
2231 |
-
|
2232 |
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
2233 |
-
}
|
2234 |
-
|
2235 |
-
// `rgbToHex`
|
2236 |
-
// Converts an RGB color to hex
|
2237 |
-
// Assumes r, g, and b are contained in the set [0, 255]
|
2238 |
-
// Returns a 3 or 6 character hex
|
2239 |
-
function rgbToHex(r, g, b, allow3Char) {
|
2240 |
-
|
2241 |
-
var hex = [
|
2242 |
-
pad2(mathRound(r).toString(16)),
|
2243 |
-
pad2(mathRound(g).toString(16)),
|
2244 |
-
pad2(mathRound(b).toString(16))
|
2245 |
-
];
|
2246 |
-
|
2247 |
-
// Return a 3 character hex if possible
|
2248 |
-
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
|
2249 |
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
2250 |
-
}
|
2251 |
-
|
2252 |
-
return hex.join("");
|
2253 |
-
}
|
2254 |
-
|
2255 |
-
// `rgbaToHex`
|
2256 |
-
// Converts an RGBA color plus alpha transparency to hex
|
2257 |
-
// Assumes r, g, b are contained in the set [0, 255] and
|
2258 |
-
// a in [0, 1]. Returns a 4 or 8 character rgba hex
|
2259 |
-
function rgbaToHex(r, g, b, a, allow4Char) {
|
2260 |
-
|
2261 |
-
var hex = [
|
2262 |
-
pad2(mathRound(r).toString(16)),
|
2263 |
-
pad2(mathRound(g).toString(16)),
|
2264 |
-
pad2(mathRound(b).toString(16)),
|
2265 |
-
pad2(convertDecimalToHex(a))
|
2266 |
-
];
|
2267 |
-
|
2268 |
-
// Return a 4 character hex if possible
|
2269 |
-
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
|
2270 |
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
2271 |
-
}
|
2272 |
-
|
2273 |
-
return hex.join("");
|
2274 |
-
}
|
2275 |
-
|
2276 |
-
// `rgbaToArgbHex`
|
2277 |
-
// Converts an RGBA color to an ARGB Hex8 string
|
2278 |
-
// Rarely used, but required for "toFilter()"
|
2279 |
-
function rgbaToArgbHex(r, g, b, a) {
|
2280 |
-
|
2281 |
-
var hex = [
|
2282 |
-
pad2(convertDecimalToHex(a)),
|
2283 |
-
pad2(mathRound(r).toString(16)),
|
2284 |
-
pad2(mathRound(g).toString(16)),
|
2285 |
-
pad2(mathRound(b).toString(16))
|
2286 |
-
];
|
2287 |
-
|
2288 |
-
return hex.join("");
|
2289 |
-
}
|
2290 |
-
|
2291 |
-
// `equals`
|
2292 |
-
// Can be called with any tinycolor input
|
2293 |
-
tinycolor.equals = function (color1, color2) {
|
2294 |
-
if (!color1 || !color2) { return false; }
|
2295 |
-
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
2296 |
-
};
|
2297 |
-
|
2298 |
-
tinycolor.random = function() {
|
2299 |
-
return tinycolor.fromRatio({
|
2300 |
-
r: mathRandom(),
|
2301 |
-
g: mathRandom(),
|
2302 |
-
b: mathRandom()
|
2303 |
-
});
|
2304 |
-
};
|
2305 |
-
|
2306 |
-
|
2307 |
-
// Modification Functions
|
2308 |
-
// ----------------------
|
2309 |
-
// Thanks to less.js for some of the basics here
|
2310 |
-
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
|
2311 |
-
|
2312 |
-
function desaturate(color, amount) {
|
2313 |
-
amount = (amount === 0) ? 0 : (amount || 10);
|
2314 |
-
var hsl = tinycolor(color).toHsl();
|
2315 |
-
hsl.s -= amount / 100;
|
2316 |
-
hsl.s = clamp01(hsl.s);
|
2317 |
-
return tinycolor(hsl);
|
2318 |
-
}
|
2319 |
-
|
2320 |
-
function saturate(color, amount) {
|
2321 |
-
amount = (amount === 0) ? 0 : (amount || 10);
|
2322 |
-
var hsl = tinycolor(color).toHsl();
|
2323 |
-
hsl.s += amount / 100;
|
2324 |
-
hsl.s = clamp01(hsl.s);
|
2325 |
-
return tinycolor(hsl);
|
2326 |
-
}
|
2327 |
-
|
2328 |
-
function greyscale(color) {
|
2329 |
-
return tinycolor(color).desaturate(100);
|
2330 |
-
}
|
2331 |
-
|
2332 |
-
function lighten (color, amount) {
|
2333 |
-
amount = (amount === 0) ? 0 : (amount || 10);
|
2334 |
-
var hsl = tinycolor(color).toHsl();
|
2335 |
-
hsl.l += amount / 100;
|
2336 |
-
hsl.l = clamp01(hsl.l);
|
2337 |
-
return tinycolor(hsl);
|
2338 |
-
}
|
2339 |
-
|
2340 |
-
function brighten(color, amount) {
|
2341 |
-
amount = (amount === 0) ? 0 : (amount || 10);
|
2342 |
-
var rgb = tinycolor(color).toRgb();
|
2343 |
-
rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
|
2344 |
-
rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
|
2345 |
-
rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
|
2346 |
-
return tinycolor(rgb);
|
2347 |
-
}
|
2348 |
-
|
2349 |
-
function darken (color, amount) {
|
2350 |
-
amount = (amount === 0) ? 0 : (amount || 10);
|
2351 |
-
var hsl = tinycolor(color).toHsl();
|
2352 |
-
hsl.l -= amount / 100;
|
2353 |
-
hsl.l = clamp01(hsl.l);
|
2354 |
-
return tinycolor(hsl);
|
2355 |
-
}
|
2356 |
-
|
2357 |
-
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
2358 |
-
// Values outside of this range will be wrapped into this range.
|
2359 |
-
function spin(color, amount) {
|
2360 |
-
var hsl = tinycolor(color).toHsl();
|
2361 |
-
var hue = (hsl.h + amount) % 360;
|
2362 |
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
2363 |
-
return tinycolor(hsl);
|
2364 |
-
}
|
2365 |
-
|
2366 |
-
// Combination Functions
|
2367 |
-
// ---------------------
|
2368 |
-
// Thanks to jQuery xColor for some of the ideas behind these
|
2369 |
-
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
2370 |
-
|
2371 |
-
function complement(color) {
|
2372 |
-
var hsl = tinycolor(color).toHsl();
|
2373 |
-
hsl.h = (hsl.h + 180) % 360;
|
2374 |
-
return tinycolor(hsl);
|
2375 |
-
}
|
2376 |
-
|
2377 |
-
function triad(color) {
|
2378 |
-
var hsl = tinycolor(color).toHsl();
|
2379 |
-
var h = hsl.h;
|
2380 |
-
return [
|
2381 |
-
tinycolor(color),
|
2382 |
-
tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
|
2383 |
-
tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
|
2384 |
-
];
|
2385 |
-
}
|
2386 |
-
|
2387 |
-
function tetrad(color) {
|
2388 |
-
var hsl = tinycolor(color).toHsl();
|
2389 |
-
var h = hsl.h;
|
2390 |
-
return [
|
2391 |
-
tinycolor(color),
|
2392 |
-
tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
|
2393 |
-
tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
|
2394 |
-
tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
|
2395 |
-
];
|
2396 |
-
}
|
2397 |
-
|
2398 |
-
function splitcomplement(color) {
|
2399 |
-
var hsl = tinycolor(color).toHsl();
|
2400 |
-
var h = hsl.h;
|
2401 |
-
return [
|
2402 |
-
tinycolor(color),
|
2403 |
-
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
|
2404 |
-
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
|
2405 |
-
];
|
2406 |
-
}
|
2407 |
-
|
2408 |
-
function analogous(color, results, slices) {
|
2409 |
-
results = results || 6;
|
2410 |
-
slices = slices || 30;
|
2411 |
-
|
2412 |
-
var hsl = tinycolor(color).toHsl();
|
2413 |
-
var part = 360 / slices;
|
2414 |
-
var ret = [tinycolor(color)];
|
2415 |
-
|
2416 |
-
for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
|
2417 |
-
hsl.h = (hsl.h + part) % 360;
|
2418 |
-
ret.push(tinycolor(hsl));
|
2419 |
-
}
|
2420 |
-
return ret;
|
2421 |
-
}
|
2422 |
-
|
2423 |
-
function monochromatic(color, results) {
|
2424 |
-
results = results || 6;
|
2425 |
-
var hsv = tinycolor(color).toHsv();
|
2426 |
-
var h = hsv.h, s = hsv.s, v = hsv.v;
|
2427 |
-
var ret = [];
|
2428 |
-
var modification = 1 / results;
|
2429 |
-
|
2430 |
-
while (results--) {
|
2431 |
-
ret.push(tinycolor({ h: h, s: s, v: v}));
|
2432 |
-
v = (v + modification) % 1;
|
2433 |
-
}
|
2434 |
-
|
2435 |
-
return ret;
|
2436 |
-
}
|
2437 |
-
|
2438 |
-
// Utility Functions
|
2439 |
-
// ---------------------
|
2440 |
-
|
2441 |
-
tinycolor.mix = function(color1, color2, amount) {
|
2442 |
-
amount = (amount === 0) ? 0 : (amount || 50);
|
2443 |
-
|
2444 |
-
var rgb1 = tinycolor(color1).toRgb();
|
2445 |
-
var rgb2 = tinycolor(color2).toRgb();
|
2446 |
-
|
2447 |
-
var p = amount / 100;
|
2448 |
-
|
2449 |
-
var rgba = {
|
2450 |
-
r: ((rgb2.r - rgb1.r) * p) + rgb1.r,
|
2451 |
-
g: ((rgb2.g - rgb1.g) * p) + rgb1.g,
|
2452 |
-
b: ((rgb2.b - rgb1.b) * p) + rgb1.b,
|
2453 |
-
a: ((rgb2.a - rgb1.a) * p) + rgb1.a
|
2454 |
-
};
|
2455 |
-
|
2456 |
-
return tinycolor(rgba);
|
2457 |
-
};
|
2458 |
-
|
2459 |
-
|
2460 |
-
// Readability Functions
|
2461 |
-
// ---------------------
|
2462 |
-
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
|
2463 |
-
|
2464 |
-
// `contrast`
|
2465 |
-
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
|
2466 |
-
tinycolor.readability = function(color1, color2) {
|
2467 |
-
var c1 = tinycolor(color1);
|
2468 |
-
var c2 = tinycolor(color2);
|
2469 |
-
return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05);
|
2470 |
-
};
|
2471 |
-
|
2472 |
-
// `isReadable`
|
2473 |
-
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
2474 |
-
// The third argument is an optional Object.
|
2475 |
-
// the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
|
2476 |
-
// the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
|
2477 |
-
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
|
2478 |
-
|
2479 |
-
// *Example*
|
2480 |
-
// tinycolor.isReadable("#000", "#111") => false
|
2481 |
-
// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
|
2482 |
-
tinycolor.isReadable = function(color1, color2, wcag2) {
|
2483 |
-
var readability = tinycolor.readability(color1, color2);
|
2484 |
-
var wcag2Parms, out;
|
2485 |
-
|
2486 |
-
out = false;
|
2487 |
-
|
2488 |
-
wcag2Parms = validateWCAG2Parms(wcag2);
|
2489 |
-
switch (wcag2Parms.level + wcag2Parms.size) {
|
2490 |
-
case "AAsmall":
|
2491 |
-
case "AAAlarge":
|
2492 |
-
out = readability >= 4.5;
|
2493 |
-
break;
|
2494 |
-
case "AAlarge":
|
2495 |
-
out = readability >= 3;
|
2496 |
-
break;
|
2497 |
-
case "AAAsmall":
|
2498 |
-
out = readability >= 7;
|
2499 |
-
break;
|
2500 |
-
}
|
2501 |
-
return out;
|
2502 |
-
|
2503 |
-
};
|
2504 |
-
|
2505 |
-
// `mostReadable`
|
2506 |
-
// Given a base color and a list of possible foreground or background
|
2507 |
-
// colors for that base, returns the most readable color.
|
2508 |
-
// Optionally returns Black or White if the most readable color is unreadable.
|
2509 |
-
// *Example*
|
2510 |
-
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
|
2511 |
-
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
|
2512 |
-
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
|
2513 |
-
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
|
2514 |
-
tinycolor.mostReadable = function(baseColor, colorList, args) {
|
2515 |
-
var bestColor = null;
|
2516 |
-
var bestScore = 0;
|
2517 |
-
var readability;
|
2518 |
-
var includeFallbackColors, level, size ;
|
2519 |
-
args = args || {};
|
2520 |
-
includeFallbackColors = args.includeFallbackColors ;
|
2521 |
-
level = args.level;
|
2522 |
-
size = args.size;
|
2523 |
-
|
2524 |
-
for (var i= 0; i < colorList.length ; i++) {
|
2525 |
-
readability = tinycolor.readability(baseColor, colorList[i]);
|
2526 |
-
if (readability > bestScore) {
|
2527 |
-
bestScore = readability;
|
2528 |
-
bestColor = tinycolor(colorList[i]);
|
2529 |
-
}
|
2530 |
-
}
|
2531 |
-
|
2532 |
-
if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) {
|
2533 |
-
return bestColor;
|
2534 |
-
}
|
2535 |
-
else {
|
2536 |
-
args.includeFallbackColors=false;
|
2537 |
-
return tinycolor.mostReadable(baseColor,["#fff", "#000"],args);
|
2538 |
-
}
|
2539 |
-
};
|
2540 |
-
|
2541 |
-
|
2542 |
-
// Big List of Colors
|
2543 |
-
// ------------------
|
2544 |
-
// <http://www.w3.org/TR/css3-color/#svg-color>
|
2545 |
-
var names = tinycolor.names = {
|
2546 |
-
aliceblue: "f0f8ff",
|
2547 |
-
antiquewhite: "faebd7",
|
2548 |
-
aqua: "0ff",
|
2549 |
-
aquamarine: "7fffd4",
|
2550 |
-
azure: "f0ffff",
|
2551 |
-
beige: "f5f5dc",
|
2552 |
-
bisque: "ffe4c4",
|
2553 |
-
black: "000",
|
2554 |
-
blanchedalmond: "ffebcd",
|
2555 |
-
blue: "00f",
|
2556 |
-
blueviolet: "8a2be2",
|
2557 |
-
brown: "a52a2a",
|
2558 |
-
burlywood: "deb887",
|
2559 |
-
burntsienna: "ea7e5d",
|
2560 |
-
cadetblue: "5f9ea0",
|
2561 |
-
chartreuse: "7fff00",
|
2562 |
-
chocolate: "d2691e",
|
2563 |
-
coral: "ff7f50",
|
2564 |
-
cornflowerblue: "6495ed",
|
2565 |
-
cornsilk: "fff8dc",
|
2566 |
-
crimson: "dc143c",
|
2567 |
-
cyan: "0ff",
|
2568 |
-
darkblue: "00008b",
|
2569 |
-
darkcyan: "008b8b",
|
2570 |
-
darkgoldenrod: "b8860b",
|
2571 |
-
darkgray: "a9a9a9",
|
2572 |
-
darkgreen: "006400",
|
2573 |
-
darkgrey: "a9a9a9",
|
2574 |
-
darkkhaki: "bdb76b",
|
2575 |
-
darkmagenta: "8b008b",
|
2576 |
-
darkolivegreen: "556b2f",
|
2577 |
-
darkorange: "ff8c00",
|
2578 |
-
darkorchid: "9932cc",
|
2579 |
-
darkred: "8b0000",
|
2580 |
-
darksalmon: "e9967a",
|
2581 |
-
darkseagreen: "8fbc8f",
|
2582 |
-
darkslateblue: "483d8b",
|
2583 |
-
darkslategray: "2f4f4f",
|
2584 |
-
darkslategrey: "2f4f4f",
|
2585 |
-
darkturquoise: "00ced1",
|
2586 |
-
darkviolet: "9400d3",
|
2587 |
-
deeppink: "ff1493",
|
2588 |
-
deepskyblue: "00bfff",
|
2589 |
-
dimgray: "696969",
|
2590 |
-
dimgrey: "696969",
|
2591 |
-
dodgerblue: "1e90ff",
|
2592 |
-
firebrick: "b22222",
|
2593 |
-
floralwhite: "fffaf0",
|
2594 |
-
forestgreen: "228b22",
|
2595 |
-
fuchsia: "f0f",
|
2596 |
-
gainsboro: "dcdcdc",
|
2597 |
-
ghostwhite: "f8f8ff",
|
2598 |
-
gold: "ffd700",
|
2599 |
-
goldenrod: "daa520",
|
2600 |
-
gray: "808080",
|
2601 |
-
green: "008000",
|
2602 |
-
greenyellow: "adff2f",
|
2603 |
-
grey: "808080",
|
2604 |
-
honeydew: "f0fff0",
|
2605 |
-
hotpink: "ff69b4",
|
2606 |
-
indianred: "cd5c5c",
|
2607 |
-
indigo: "4b0082",
|
2608 |
-
ivory: "fffff0",
|
2609 |
-
khaki: "f0e68c",
|
2610 |
-
lavender: "e6e6fa",
|
2611 |
-
lavenderblush: "fff0f5",
|
2612 |
-
lawngreen: "7cfc00",
|
2613 |
-
lemonchiffon: "fffacd",
|
2614 |
-
lightblue: "add8e6",
|
2615 |
-
lightcoral: "f08080",
|
2616 |
-
lightcyan: "e0ffff",
|
2617 |
-
lightgoldenrodyellow: "fafad2",
|
2618 |
-
lightgray: "d3d3d3",
|
2619 |
-
lightgreen: "90ee90",
|
2620 |
-
lightgrey: "d3d3d3",
|
2621 |
-
lightpink: "ffb6c1",
|
2622 |
-
lightsalmon: "ffa07a",
|
2623 |
-
lightseagreen: "20b2aa",
|
2624 |
-
lightskyblue: "87cefa",
|
2625 |
-
lightslategray: "789",
|
2626 |
-
lightslategrey: "789",
|
2627 |
-
lightsteelblue: "b0c4de",
|
2628 |
-
lightyellow: "ffffe0",
|
2629 |
-
lime: "0f0",
|
2630 |
-
limegreen: "32cd32",
|
2631 |
-
linen: "faf0e6",
|
2632 |
-
magenta: "f0f",
|
2633 |
-
maroon: "800000",
|
2634 |
-
mediumaquamarine: "66cdaa",
|
2635 |
-
mediumblue: "0000cd",
|
2636 |
-
mediumorchid: "ba55d3",
|
2637 |
-
mediumpurple: "9370db",
|
2638 |
-
mediumseagreen: "3cb371",
|
2639 |
-
mediumslateblue: "7b68ee",
|
2640 |
-
mediumspringgreen: "00fa9a",
|
2641 |
-
mediumturquoise: "48d1cc",
|
2642 |
-
mediumvioletred: "c71585",
|
2643 |
-
midnightblue: "191970",
|
2644 |
-
mintcream: "f5fffa",
|
2645 |
-
mistyrose: "ffe4e1",
|
2646 |
-
moccasin: "ffe4b5",
|
2647 |
-
navajowhite: "ffdead",
|
2648 |
-
navy: "000080",
|
2649 |
-
oldlace: "fdf5e6",
|
2650 |
-
olive: "808000",
|
2651 |
-
olivedrab: "6b8e23",
|
2652 |
-
orange: "ffa500",
|
2653 |
-
orangered: "ff4500",
|
2654 |
-
orchid: "da70d6",
|
2655 |
-
palegoldenrod: "eee8aa",
|
2656 |
-
palegreen: "98fb98",
|
2657 |
-
paleturquoise: "afeeee",
|
2658 |
-
palevioletred: "db7093",
|
2659 |
-
papayawhip: "ffefd5",
|
2660 |
-
peachpuff: "ffdab9",
|
2661 |
-
peru: "cd853f",
|
2662 |
-
pink: "ffc0cb",
|
2663 |
-
plum: "dda0dd",
|
2664 |
-
powderblue: "b0e0e6",
|
2665 |
-
purple: "800080",
|
2666 |
-
rebeccapurple: "663399",
|
2667 |
-
red: "f00",
|
2668 |
-
rosybrown: "bc8f8f",
|
2669 |
-
royalblue: "4169e1",
|
2670 |
-
saddlebrown: "8b4513",
|
2671 |
-
salmon: "fa8072",
|
2672 |
-
sandybrown: "f4a460",
|
2673 |
-
seagreen: "2e8b57",
|
2674 |
-
seashell: "fff5ee",
|
2675 |
-
sienna: "a0522d",
|
2676 |
-
silver: "c0c0c0",
|
2677 |
-
skyblue: "87ceeb",
|
2678 |
-
slateblue: "6a5acd",
|
2679 |
-
slategray: "708090",
|
2680 |
-
slategrey: "708090",
|
2681 |
-
snow: "fffafa",
|
2682 |
-
springgreen: "00ff7f",
|
2683 |
-
steelblue: "4682b4",
|
2684 |
-
tan: "d2b48c",
|
2685 |
-
teal: "008080",
|
2686 |
-
thistle: "d8bfd8",
|
2687 |
-
tomato: "ff6347",
|
2688 |
-
turquoise: "40e0d0",
|
2689 |
-
violet: "ee82ee",
|
2690 |
-
wheat: "f5deb3",
|
2691 |
-
white: "fff",
|
2692 |
-
whitesmoke: "f5f5f5",
|
2693 |
-
yellow: "ff0",
|
2694 |
-
yellowgreen: "9acd32"
|
2695 |
-
};
|
2696 |
-
|
2697 |
-
// Make it easy to access colors via `hexNames[hex]`
|
2698 |
-
var hexNames = tinycolor.hexNames = flip(names);
|
2699 |
-
|
2700 |
-
|
2701 |
-
// Utilities
|
2702 |
-
// ---------
|
2703 |
-
|
2704 |
-
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
|
2705 |
-
function flip(o) {
|
2706 |
-
var flipped = { };
|
2707 |
-
for (var i in o) {
|
2708 |
-
if (o.hasOwnProperty(i)) {
|
2709 |
-
flipped[o[i]] = i;
|
2710 |
-
}
|
2711 |
-
}
|
2712 |
-
return flipped;
|
2713 |
-
}
|
2714 |
-
|
2715 |
-
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
2716 |
-
function boundAlpha(a) {
|
2717 |
-
a = parseFloat(a);
|
2718 |
-
|
2719 |
-
if (isNaN(a) || a < 0 || a > 1) {
|
2720 |
-
a = 1;
|
2721 |
-
}
|
2722 |
-
|
2723 |
-
return a;
|
2724 |
-
}
|
2725 |
-
|
2726 |
-
// Take input from [0, n] and return it as [0, 1]
|
2727 |
-
function bound01(n, max) {
|
2728 |
-
if (isOnePointZero(n)) { n = "100%"; }
|
2729 |
-
|
2730 |
-
var processPercent = isPercentage(n);
|
2731 |
-
n = mathMin(max, mathMax(0, parseFloat(n)));
|
2732 |
-
|
2733 |
-
// Automatically convert percentage into number
|
2734 |
-
if (processPercent) {
|
2735 |
-
n = parseInt(n * max, 10) / 100;
|
2736 |
-
}
|
2737 |
-
|
2738 |
-
// Handle floating point rounding errors
|
2739 |
-
if ((Math.abs(n - max) < 0.000001)) {
|
2740 |
-
return 1;
|
2741 |
-
}
|
2742 |
-
|
2743 |
-
// Convert into [0, 1] range if it isn't already
|
2744 |
-
return (n % max) / parseFloat(max);
|
2745 |
-
}
|
2746 |
-
|
2747 |
-
// Force a number between 0 and 1
|
2748 |
-
function clamp01(val) {
|
2749 |
-
return mathMin(1, mathMax(0, val));
|
2750 |
-
}
|
2751 |
-
|
2752 |
-
// Parse a base-16 hex value into a base-10 integer
|
2753 |
-
function parseIntFromHex(val) {
|
2754 |
-
return parseInt(val, 16);
|
2755 |
-
}
|
2756 |
-
|
2757 |
-
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
2758 |
-
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
2759 |
-
function isOnePointZero(n) {
|
2760 |
-
return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
|
2761 |
-
}
|
2762 |
-
|
2763 |
-
// Check to see if string passed in is a percentage
|
2764 |
-
function isPercentage(n) {
|
2765 |
-
return typeof n === "string" && n.indexOf('%') != -1;
|
2766 |
-
}
|
2767 |
-
|
2768 |
-
// Force a hex value to have 2 characters
|
2769 |
-
function pad2(c) {
|
2770 |
-
return c.length == 1 ? '0' + c : '' + c;
|
2771 |
-
}
|
2772 |
-
|
2773 |
-
// Replace a decimal with it's percentage value
|
2774 |
-
function convertToPercentage(n) {
|
2775 |
-
if (n <= 1) {
|
2776 |
-
n = (n * 100) + "%";
|
2777 |
-
}
|
2778 |
-
|
2779 |
-
return n;
|
2780 |
-
}
|
2781 |
-
|
2782 |
-
// Converts a decimal to a hex value
|
2783 |
-
function convertDecimalToHex(d) {
|
2784 |
-
return Math.round(parseFloat(d) * 255).toString(16);
|
2785 |
-
}
|
2786 |
-
// Converts a hex value to a decimal
|
2787 |
-
function convertHexToDecimal(h) {
|
2788 |
-
return (parseIntFromHex(h) / 255);
|
2789 |
-
}
|
2790 |
-
|
2791 |
-
var matchers = (function() {
|
2792 |
-
|
2793 |
-
// <http://www.w3.org/TR/css3-values/#integers>
|
2794 |
-
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
2795 |
-
|
2796 |
-
// <http://www.w3.org/TR/css3-values/#number-value>
|
2797 |
-
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
2798 |
-
|
2799 |
-
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
2800 |
-
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
2801 |
-
|
2802 |
-
// Actual matching.
|
2803 |
-
// Parentheses and commas are optional, but not required.
|
2804 |
-
// Whitespace can take the place of commas or opening paren
|
2805 |
-
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
2806 |
-
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
2807 |
-
|
2808 |
-
return {
|
2809 |
-
CSS_UNIT: new RegExp(CSS_UNIT),
|
2810 |
-
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
2811 |
-
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
2812 |
-
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
2813 |
-
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
2814 |
-
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
2815 |
-
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
2816 |
-
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
2817 |
-
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
2818 |
-
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
2819 |
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
2820 |
-
};
|
2821 |
-
})();
|
2822 |
-
|
2823 |
-
// `isValidCSSUnit`
|
2824 |
-
// Take in a single string / number and check to see if it looks like a CSS unit
|
2825 |
-
// (see `matchers` above for definition).
|
2826 |
-
function isValidCSSUnit(color) {
|
2827 |
-
return !!matchers.CSS_UNIT.exec(color);
|
2828 |
-
}
|
2829 |
-
|
2830 |
-
// `stringInputToObject`
|
2831 |
-
// Permissive string parsing. Take in a number of formats, and output an object
|
2832 |
-
// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
2833 |
-
function stringInputToObject(color) {
|
2834 |
-
|
2835 |
-
color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
|
2836 |
-
var named = false;
|
2837 |
-
if (names[color]) {
|
2838 |
-
color = names[color];
|
2839 |
-
named = true;
|
2840 |
-
}
|
2841 |
-
else if (color == 'transparent') {
|
2842 |
-
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
2843 |
-
}
|
2844 |
-
|
2845 |
-
// Try to match string input using regular expressions.
|
2846 |
-
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
2847 |
-
// Just return an object and let the conversion functions handle that.
|
2848 |
-
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
2849 |
-
var match;
|
2850 |
-
if ((match = matchers.rgb.exec(color))) {
|
2851 |
-
return { r: match[1], g: match[2], b: match[3] };
|
2852 |
-
}
|
2853 |
-
if ((match = matchers.rgba.exec(color))) {
|
2854 |
-
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
2855 |
-
}
|
2856 |
-
if ((match = matchers.hsl.exec(color))) {
|
2857 |
-
return { h: match[1], s: match[2], l: match[3] };
|
2858 |
-
}
|
2859 |
-
if ((match = matchers.hsla.exec(color))) {
|
2860 |
-
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
2861 |
-
}
|
2862 |
-
if ((match = matchers.hsv.exec(color))) {
|
2863 |
-
return { h: match[1], s: match[2], v: match[3] };
|
2864 |
-
}
|
2865 |
-
if ((match = matchers.hsva.exec(color))) {
|
2866 |
-
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
2867 |
-
}
|
2868 |
-
if ((match = matchers.hex8.exec(color))) {
|
2869 |
-
return {
|
2870 |
-
r: parseIntFromHex(match[1]),
|
2871 |
-
g: parseIntFromHex(match[2]),
|
2872 |
-
b: parseIntFromHex(match[3]),
|
2873 |
-
a: convertHexToDecimal(match[4]),
|
2874 |
-
format: named ? "name" : "hex8"
|
2875 |
-
};
|
2876 |
-
}
|
2877 |
-
if ((match = matchers.hex6.exec(color))) {
|
2878 |
-
return {
|
2879 |
-
r: parseIntFromHex(match[1]),
|
2880 |
-
g: parseIntFromHex(match[2]),
|
2881 |
-
b: parseIntFromHex(match[3]),
|
2882 |
-
format: named ? "name" : "hex"
|
2883 |
-
};
|
2884 |
-
}
|
2885 |
-
if ((match = matchers.hex4.exec(color))) {
|
2886 |
-
return {
|
2887 |
-
r: parseIntFromHex(match[1] + '' + match[1]),
|
2888 |
-
g: parseIntFromHex(match[2] + '' + match[2]),
|
2889 |
-
b: parseIntFromHex(match[3] + '' + match[3]),
|
2890 |
-
a: convertHexToDecimal(match[4] + '' + match[4]),
|
2891 |
-
format: named ? "name" : "hex8"
|
2892 |
-
};
|
2893 |
-
}
|
2894 |
-
if ((match = matchers.hex3.exec(color))) {
|
2895 |
-
return {
|
2896 |
-
r: parseIntFromHex(match[1] + '' + match[1]),
|
2897 |
-
g: parseIntFromHex(match[2] + '' + match[2]),
|
2898 |
-
b: parseIntFromHex(match[3] + '' + match[3]),
|
2899 |
-
format: named ? "name" : "hex"
|
2900 |
-
};
|
2901 |
-
}
|
2902 |
-
|
2903 |
-
return false;
|
2904 |
-
}
|
2905 |
-
|
2906 |
-
function validateWCAG2Parms(parms) {
|
2907 |
-
// return valid WCAG2 parms for isReadable.
|
2908 |
-
// If input parms are invalid, return {"level":"AA", "size":"small"}
|
2909 |
-
var level, size;
|
2910 |
-
parms = parms || {"level":"AA", "size":"small"};
|
2911 |
-
level = (parms.level || "AA").toUpperCase();
|
2912 |
-
size = (parms.size || "small").toLowerCase();
|
2913 |
-
if (level !== "AA" && level !== "AAA") {
|
2914 |
-
level = "AA";
|
2915 |
-
}
|
2916 |
-
if (size !== "small" && size !== "large") {
|
2917 |
-
size = "small";
|
2918 |
-
}
|
2919 |
-
return {"level":level, "size":size};
|
2920 |
-
}
|
2921 |
-
|
2922 |
-
// Node: Export function
|
2923 |
-
if ( true && module.exports) {
|
2924 |
-
module.exports = tinycolor;
|
2925 |
-
}
|
2926 |
-
// AMD/requirejs: Define the module
|
2927 |
-
else if (true) {
|
2928 |
-
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {return tinycolor;}).call(exports, __webpack_require__, exports, module),
|
2929 |
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
2930 |
-
}
|
2931 |
-
// Browser: Expose to window
|
2932 |
-
else {}
|
2933 |
-
|
2934 |
-
})(Math);
|
2935 |
-
|
2936 |
-
|
2937 |
/***/ }),
|
2938 |
|
2939 |
/***/ 3692:
|
@@ -3469,6 +2268,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
3469 |
"getFontSizeObjectByValue": function() { return /* reexport */ getFontSizeObjectByValue; },
|
3470 |
"getGradientSlugByValue": function() { return /* reexport */ getGradientSlugByValue; },
|
3471 |
"getGradientValueBySlug": function() { return /* reexport */ getGradientValueBySlug; },
|
|
|
3472 |
"store": function() { return /* reexport */ store; },
|
3473 |
"storeConfig": function() { return /* reexport */ storeConfig; },
|
3474 |
"transformStyles": function() { return /* reexport */ transform_styles; },
|
@@ -3491,6 +2291,7 @@ __webpack_require__.d(selectors_namespaceObject, {
|
|
3491 |
"__experimentalGetAllowedBlocks": function() { return __experimentalGetAllowedBlocks; },
|
3492 |
"__experimentalGetAllowedPatterns": function() { return __experimentalGetAllowedPatterns; },
|
3493 |
"__experimentalGetBlockListSettingsForBlocks": function() { return __experimentalGetBlockListSettingsForBlocks; },
|
|
|
3494 |
"__experimentalGetLastBlockAttributeChanges": function() { return __experimentalGetLastBlockAttributeChanges; },
|
3495 |
"__experimentalGetParsedPattern": function() { return __experimentalGetParsedPattern; },
|
3496 |
"__experimentalGetParsedReusableBlock": function() { return __experimentalGetParsedReusableBlock; },
|
@@ -7536,6 +6337,35 @@ const __experimentalGetAllowedBlocks = rememo((state, rootClientId = null) => {
|
|
7536 |
|
7537 |
return (0,external_lodash_namespaceObject.filter)((0,external_wp_blocks_namespaceObject.getBlockTypes)(), blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId));
|
7538 |
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, (0,external_wp_blocks_namespaceObject.getBlockTypes)()]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7539 |
|
7540 |
const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
|
7541 |
if ((0,external_lodash_namespaceObject.isBoolean)(allowedBlockTypes)) {
|
@@ -9405,6 +8235,21 @@ BlockFormatControls.Slot = props => {
|
|
9405 |
|
9406 |
/* harmony default export */ var block_controls = (BlockControls);
|
9407 |
//# sourceMappingURL=index.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9408 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/position-left.js
|
9409 |
|
9410 |
|
@@ -9431,7 +8276,7 @@ const positionCenter = (0,external_wp_element_namespaceObject.createElement)(ext
|
|
9431 |
xmlns: "http://www.w3.org/2000/svg",
|
9432 |
viewBox: "0 0 24 24"
|
9433 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
9434 |
-
d: "
|
9435 |
}));
|
9436 |
/* harmony default export */ var position_center = (positionCenter);
|
9437 |
//# sourceMappingURL=position-center.js.map
|
@@ -9920,7 +8765,7 @@ function Icon({
|
|
9920 |
});
|
9921 |
}
|
9922 |
|
9923 |
-
/* harmony default export */ var
|
9924 |
//# sourceMappingURL=index.js.map
|
9925 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/layouts/flow.js
|
9926 |
|
@@ -9967,7 +8812,7 @@ function Icon({
|
|
9967 |
});
|
9968 |
},
|
9969 |
units: units
|
9970 |
-
}), (0,external_wp_element_namespaceObject.createElement)(
|
9971 |
icon: position_center
|
9972 |
})), (0,external_wp_element_namespaceObject.createElement)("div", {
|
9973 |
className: "block-editor-hooks__layout-controls-unit"
|
@@ -9983,7 +8828,7 @@ function Icon({
|
|
9983 |
});
|
9984 |
},
|
9985 |
units: units
|
9986 |
-
}), (0,external_wp_element_namespaceObject.createElement)(
|
9987 |
icon: stretch_wide
|
9988 |
}))), (0,external_wp_element_namespaceObject.createElement)("div", {
|
9989 |
className: "block-editor-hooks__layout-controls-reset"
|
@@ -10058,24 +8903,87 @@ function Icon({
|
|
10058 |
},
|
10059 |
|
10060 |
getAlignments(layout) {
|
|
|
|
|
10061 |
if (layout.alignments !== undefined) {
|
10062 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10063 |
}
|
10064 |
|
10065 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10066 |
|
10067 |
-
if (
|
10068 |
-
alignments.unshift(
|
|
|
|
|
10069 |
}
|
10070 |
|
10071 |
-
if (
|
10072 |
-
alignments.unshift(
|
|
|
|
|
|
|
10073 |
}
|
10074 |
|
|
|
|
|
|
|
|
|
10075 |
return alignments;
|
10076 |
}
|
10077 |
|
10078 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10079 |
//# sourceMappingURL=flow.js.map
|
10080 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/layouts/index.js
|
10081 |
/**
|
@@ -10160,9 +9068,14 @@ function LayoutStyle({
|
|
10160 |
|
10161 |
|
10162 |
|
10163 |
-
const DEFAULT_CONTROLS = ['left', 'center', 'right', 'wide', 'full'];
|
10164 |
const WIDE_CONTROLS = ['wide', 'full'];
|
10165 |
function useAvailableAlignments(controls = DEFAULT_CONTROLS) {
|
|
|
|
|
|
|
|
|
|
|
10166 |
const {
|
10167 |
wideControlsEnabled = false,
|
10168 |
themeSupportsLayout
|
@@ -10181,7 +9094,9 @@ function useAvailableAlignments(controls = DEFAULT_CONTROLS) {
|
|
10181 |
const layoutAlignments = layoutType.getAlignments(layout);
|
10182 |
|
10183 |
if (themeSupportsLayout) {
|
10184 |
-
return layoutAlignments.filter(
|
|
|
|
|
10185 |
} // Starting here, it's the fallback for themes not supporting the layout config.
|
10186 |
|
10187 |
|
@@ -10193,7 +9108,9 @@ function useAvailableAlignments(controls = DEFAULT_CONTROLS) {
|
|
10193 |
alignments: availableAlignments = DEFAULT_CONTROLS
|
10194 |
} = layout;
|
10195 |
const enabledControls = controls.filter(control => (layout.alignments || // Ignore the global wideAlignment check if the layout explicitely defines alignments.
|
10196 |
-
wideControlsEnabled || !WIDE_CONTROLS.includes(control)) && availableAlignments.includes(control))
|
|
|
|
|
10197 |
return enabledControls;
|
10198 |
}
|
10199 |
//# sourceMappingURL=use-available-alignments.js.map
|
@@ -10201,18 +9118,28 @@ function useAvailableAlignments(controls = DEFAULT_CONTROLS) {
|
|
10201 |
|
10202 |
|
10203 |
|
|
|
|
|
|
|
|
|
10204 |
/**
|
10205 |
* WordPress dependencies
|
10206 |
*/
|
10207 |
|
10208 |
|
10209 |
|
|
|
|
|
10210 |
/**
|
10211 |
* Internal dependencies
|
10212 |
*/
|
10213 |
|
10214 |
|
10215 |
const BLOCK_ALIGNMENTS_CONTROLS = {
|
|
|
|
|
|
|
|
|
10216 |
left: {
|
10217 |
icon: position_left,
|
10218 |
title: (0,external_wp_i18n_namespaceObject.__)('Align left')
|
@@ -10234,7 +9161,7 @@ const BLOCK_ALIGNMENTS_CONTROLS = {
|
|
10234 |
title: (0,external_wp_i18n_namespaceObject.__)('Full width')
|
10235 |
}
|
10236 |
};
|
10237 |
-
const DEFAULT_CONTROL = '
|
10238 |
const POPOVER_PROPS = {
|
10239 |
isAlternate: true
|
10240 |
};
|
@@ -10247,38 +9174,73 @@ function BlockAlignmentUI({
|
|
10247 |
isCollapsed = true
|
10248 |
}) {
|
10249 |
const enabledControls = useAvailableAlignments(controls);
|
|
|
10250 |
|
10251 |
-
if (
|
10252 |
return null;
|
10253 |
}
|
10254 |
|
10255 |
-
function
|
10256 |
-
|
10257 |
}
|
10258 |
|
10259 |
const activeAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[value];
|
10260 |
const defaultAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[DEFAULT_CONTROL];
|
10261 |
const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu;
|
10262 |
-
const
|
10263 |
-
isCollapsed
|
10264 |
-
} : {};
|
10265 |
-
const hasActive = enabledControls.some(control => control === value);
|
10266 |
-
return (0,external_wp_element_namespaceObject.createElement)(UIComponent, _extends({
|
10267 |
popoverProps: POPOVER_PROPS,
|
10268 |
icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon,
|
10269 |
label: (0,external_wp_i18n_namespaceObject.__)('Align'),
|
10270 |
toggleProps: {
|
10271 |
-
describedBy: (0,external_wp_i18n_namespaceObject.__)('Change alignment')
|
10272 |
-
|
10273 |
-
|
10274 |
-
|
10275 |
-
|
10276 |
-
|
|
|
|
|
|
|
|
|
10277 |
role: isCollapsed ? 'menuitemradio' : undefined,
|
10278 |
-
onClick:
|
10279 |
};
|
10280 |
})
|
10281 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10282 |
}
|
10283 |
|
10284 |
/* harmony default export */ var block_alignment_control_ui = (BlockAlignmentUI);
|
@@ -10472,7 +9434,7 @@ const withDataAlign = (0,external_wp_compose_namespaceObject.createHigherOrderCo
|
|
10472 |
|
10473 |
let wrapperProps = props.wrapperProps;
|
10474 |
|
10475 |
-
if (validAlignments.
|
10476 |
wrapperProps = { ...wrapperProps,
|
10477 |
'data-align': align
|
10478 |
};
|
@@ -10657,7 +9619,7 @@ function BlockSupportToolsPanel({
|
|
10657 |
clientId: selectedBlockClientId,
|
10658 |
attributes: getBlockAttributes(selectedBlockClientId)
|
10659 |
};
|
10660 |
-
});
|
10661 |
const {
|
10662 |
updateBlockAttributes
|
10663 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
@@ -11032,15 +9994,24 @@ function addGeneratedClassName(extraProps, blockType) {
|
|
11032 |
}
|
11033 |
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName);
|
11034 |
//# sourceMappingURL=generated-class-name.js.map
|
11035 |
-
|
11036 |
-
var
|
11037 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
11038 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors/utils.js
|
11039 |
/**
|
11040 |
* External dependencies
|
11041 |
*/
|
11042 |
|
11043 |
|
|
|
|
|
|
|
11044 |
/**
|
11045 |
* Provided an array of color objects as set by the theme or by the editor defaults,
|
11046 |
* and the values of the defined color or custom color returns a color object describing the color.
|
@@ -11111,7 +10082,10 @@ function getColorClassName(colorContextName, colorSlug) {
|
|
11111 |
*/
|
11112 |
|
11113 |
function getMostReadableColor(colors, colorValue) {
|
11114 |
-
|
|
|
|
|
|
|
11115 |
}
|
11116 |
//# sourceMappingURL=utils.js.map
|
11117 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/gradients/use-gradient.js
|
@@ -12439,6 +11413,8 @@ const PanelColorGradientSettings = props => {
|
|
12439 |
* External dependencies
|
12440 |
*/
|
12441 |
|
|
|
|
|
12442 |
/**
|
12443 |
* WordPress dependencies
|
12444 |
*/
|
@@ -12447,14 +11423,15 @@ const PanelColorGradientSettings = props => {
|
|
12447 |
|
12448 |
|
12449 |
|
|
|
12450 |
|
12451 |
function ContrastCheckerMessage({
|
12452 |
-
|
12453 |
-
|
12454 |
backgroundColor,
|
12455 |
textColor
|
12456 |
}) {
|
12457 |
-
const msg =
|
12458 |
// prop, but the contrast checker requires granular control over when the
|
12459 |
// announcements are made. Notably, the message will be re-announced if a
|
12460 |
// new color combination is selected and the contrast is still insufficient.
|
@@ -12484,11 +11461,11 @@ function ContrastChecker({
|
|
12484 |
return null;
|
12485 |
}
|
12486 |
|
12487 |
-
const
|
12488 |
-
const
|
12489 |
-
const hasTransparency =
|
12490 |
|
12491 |
-
if (hasTransparency ||
|
12492 |
level: 'AA',
|
12493 |
size: isLargeText || isLargeText !== false && fontSize >= 24 ? 'large' : 'small'
|
12494 |
})) {
|
@@ -12498,8 +11475,8 @@ function ContrastChecker({
|
|
12498 |
return (0,external_wp_element_namespaceObject.createElement)(ContrastCheckerMessage, {
|
12499 |
backgroundColor: backgroundColor,
|
12500 |
textColor: textColor,
|
12501 |
-
|
12502 |
-
|
12503 |
});
|
12504 |
}
|
12505 |
|
@@ -14668,7 +13645,8 @@ function GapEdit(props) {
|
|
14668 |
|
14669 |
return external_wp_element_namespaceObject.Platform.select({
|
14670 |
web: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
|
14671 |
-
label: (0,external_wp_i18n_namespaceObject.__)('Block
|
|
|
14672 |
min: 0,
|
14673 |
onChange: onChange,
|
14674 |
units: units,
|
@@ -15039,9 +14017,8 @@ function DimensionsPanel(props) {
|
|
15039 |
isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.margin,
|
15040 |
panelId: props.clientId
|
15041 |
}, (0,external_wp_element_namespaceObject.createElement)(MarginEdit, props)), !isGapDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
|
15042 |
-
className: "single-column",
|
15043 |
hasValue: () => hasGapValue(props),
|
15044 |
-
label: (0,external_wp_i18n_namespaceObject.__)('Block
|
15045 |
onDeselect: () => resetGap(props),
|
15046 |
resetAllFilter: createResetAllFilter('blockGap'),
|
15047 |
isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.blockGap,
|
@@ -15365,42 +14342,6 @@ const withElementsStyles = (0,external_wp_compose_namespaceObject.createHigherOr
|
|
15365 |
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/style/with-block-controls', withBlockControls);
|
15366 |
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/editor/with-elements-styles', withElementsStyles);
|
15367 |
//# sourceMappingURL=style.js.map
|
15368 |
-
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/duotone-control/duotone-picker-popover.js
|
15369 |
-
|
15370 |
-
|
15371 |
-
/**
|
15372 |
-
* WordPress dependencies
|
15373 |
-
*/
|
15374 |
-
|
15375 |
-
|
15376 |
-
|
15377 |
-
function DuotonePickerPopover({
|
15378 |
-
value,
|
15379 |
-
onChange,
|
15380 |
-
onToggle,
|
15381 |
-
duotonePalette,
|
15382 |
-
colorPalette,
|
15383 |
-
disableCustomColors,
|
15384 |
-
disableCustomDuotone
|
15385 |
-
}) {
|
15386 |
-
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
|
15387 |
-
className: "block-editor-duotone-control__popover",
|
15388 |
-
headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone'),
|
15389 |
-
onFocusOutside: onToggle
|
15390 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
|
15391 |
-
label: (0,external_wp_i18n_namespaceObject.__)('Duotone')
|
15392 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotonePicker, {
|
15393 |
-
colorPalette: colorPalette,
|
15394 |
-
duotonePalette: duotonePalette,
|
15395 |
-
disableCustomColors: disableCustomColors,
|
15396 |
-
disableCustomDuotone: disableCustomDuotone,
|
15397 |
-
value: value,
|
15398 |
-
onChange: onChange
|
15399 |
-
})));
|
15400 |
-
}
|
15401 |
-
|
15402 |
-
/* harmony default export */ var duotone_picker_popover = (DuotonePickerPopover);
|
15403 |
-
//# sourceMappingURL=duotone-picker-popover.js.map
|
15404 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/duotone-control/index.js
|
15405 |
|
15406 |
|
@@ -15411,12 +14352,6 @@ function DuotonePickerPopover({
|
|
15411 |
|
15412 |
|
15413 |
|
15414 |
-
/**
|
15415 |
-
* Internal dependencies
|
15416 |
-
*/
|
15417 |
-
|
15418 |
-
|
15419 |
-
|
15420 |
function DuotoneControl({
|
15421 |
colorPalette,
|
15422 |
duotonePalette,
|
@@ -15425,38 +14360,45 @@ function DuotoneControl({
|
|
15425 |
value,
|
15426 |
onChange
|
15427 |
}) {
|
15428 |
-
|
15429 |
-
|
15430 |
-
|
15431 |
-
|
15432 |
-
|
15433 |
-
|
15434 |
-
|
15435 |
-
|
15436 |
-
|
15437 |
-
|
15438 |
-
|
15439 |
-
|
|
|
|
|
|
|
15440 |
|
15441 |
-
|
15442 |
-
|
15443 |
-
|
15444 |
-
|
15445 |
-
|
15446 |
-
|
15447 |
-
|
15448 |
-
|
15449 |
-
|
15450 |
-
|
15451 |
-
|
15452 |
-
|
15453 |
-
|
15454 |
-
|
15455 |
-
|
15456 |
-
|
15457 |
-
|
15458 |
-
|
15459 |
-
|
|
|
|
|
|
|
|
|
15460 |
}
|
15461 |
|
15462 |
/* harmony default export */ var duotone_control = (DuotoneControl);
|
@@ -22159,6 +21101,12 @@ function use_multi_selection_useMultiSelection() {
|
|
22159 |
|
22160 |
if (length < 2) {
|
22161 |
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
22162 |
} // For some browsers, like Safari, it is important that focus happens
|
22163 |
// BEFORE selection.
|
22164 |
|
@@ -24465,6 +23413,8 @@ const transformStyles = (styles, wrapperClassName = '') => {
|
|
24465 |
* External dependencies
|
24466 |
*/
|
24467 |
|
|
|
|
|
24468 |
/**
|
24469 |
* WordPress dependencies
|
24470 |
*/
|
@@ -24476,6 +23426,7 @@ const transformStyles = (styles, wrapperClassName = '') => {
|
|
24476 |
|
24477 |
|
24478 |
const EDITOR_STYLES_SELECTOR = '.editor-styles-wrapper';
|
|
|
24479 |
|
24480 |
function useDarkThemeBodyClassName(styles) {
|
24481 |
return (0,external_wp_element_namespaceObject.useCallback)(node => {
|
@@ -24504,10 +23455,11 @@ function useDarkThemeBodyClassName(styles) {
|
|
24504 |
body.removeChild(tempCanvas);
|
24505 |
} else {
|
24506 |
backgroundColor = defaultView.getComputedStyle(canvas, null).getPropertyValue('background-color');
|
24507 |
-
}
|
24508 |
|
|
|
24509 |
|
24510 |
-
if (
|
24511 |
body.classList.remove('is-dark-theme');
|
24512 |
} else {
|
24513 |
body.classList.add('is-dark-theme');
|
@@ -24558,7 +23510,7 @@ function AutoBlockPreview({
|
|
24558 |
}] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
|
24559 |
const styles = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
24560 |
return select(store).getSettings().styles;
|
24561 |
-
}); // Initialize on render instead of module top level, to avoid circular dependency issues.
|
24562 |
|
24563 |
MemoizedBlockList = MemoizedBlockList || (0,external_wp_compose_namespaceObject.pure)(BlockList);
|
24564 |
const scale = containerWidth / viewportWidth;
|
@@ -25686,7 +24638,7 @@ var external_wp_url_namespaceObject = window["wp"]["url"];
|
|
25686 |
function InserterNoResults() {
|
25687 |
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
25688 |
className: "block-editor-inserter__no-results"
|
25689 |
-
}, (0,external_wp_element_namespaceObject.createElement)(
|
25690 |
className: "block-editor-inserter__no-results-icon",
|
25691 |
icon: block_default
|
25692 |
}), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found.')));
|
@@ -26606,6 +25558,7 @@ class Inserter extends external_wp_element_namespaceObject.Component {
|
|
26606 |
disabled,
|
26607 |
blockTitle,
|
26608 |
hasSingleBlockType,
|
|
|
26609 |
toggleProps,
|
26610 |
hasItems,
|
26611 |
renderToggle = defaultRenderToggle
|
@@ -26616,6 +25569,7 @@ class Inserter extends external_wp_element_namespaceObject.Component {
|
|
26616 |
disabled: disabled || !hasItems,
|
26617 |
blockTitle,
|
26618 |
hasSingleBlockType,
|
|
|
26619 |
toggleProps
|
26620 |
});
|
26621 |
}
|
@@ -26669,12 +25623,13 @@ class Inserter extends external_wp_element_namespaceObject.Component {
|
|
26669 |
const {
|
26670 |
position,
|
26671 |
hasSingleBlockType,
|
|
|
26672 |
insertOnlyAllowedBlock,
|
26673 |
__experimentalIsQuick: isQuick,
|
26674 |
onSelectOrClose
|
26675 |
} = this.props;
|
26676 |
|
26677 |
-
if (hasSingleBlockType) {
|
26678 |
return this.renderToggle({
|
26679 |
onToggle: insertOnlyAllowedBlock
|
26680 |
});
|
@@ -26704,7 +25659,8 @@ class Inserter extends external_wp_element_namespaceObject.Component {
|
|
26704 |
const {
|
26705 |
getBlockRootClientId,
|
26706 |
hasInserterItems,
|
26707 |
-
__experimentalGetAllowedBlocks
|
|
|
26708 |
} = select(store);
|
26709 |
const {
|
26710 |
getBlockVariations
|
@@ -26713,6 +25669,8 @@ class Inserter extends external_wp_element_namespaceObject.Component {
|
|
26713 |
|
26714 |
const allowedBlocks = __experimentalGetAllowedBlocks(rootClientId);
|
26715 |
|
|
|
|
|
26716 |
const hasSingleBlockType = (0,external_lodash_namespaceObject.size)(allowedBlocks) === 1 && (0,external_lodash_namespaceObject.size)(getBlockVariations(allowedBlocks[0].name, 'inserter')) === 0;
|
26717 |
let allowedBlockType = false;
|
26718 |
|
@@ -26725,6 +25683,7 @@ class Inserter extends external_wp_element_namespaceObject.Component {
|
|
26725 |
hasSingleBlockType,
|
26726 |
blockTitle: allowedBlockType ? allowedBlockType.title : '',
|
26727 |
allowedBlockType,
|
|
|
26728 |
rootClientId
|
26729 |
};
|
26730 |
}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, {
|
@@ -26738,10 +25697,11 @@ class Inserter extends external_wp_element_namespaceObject.Component {
|
|
26738 |
isAppender,
|
26739 |
hasSingleBlockType,
|
26740 |
allowedBlockType,
|
|
|
26741 |
onSelectOrClose
|
26742 |
} = ownProps;
|
26743 |
|
26744 |
-
if (!hasSingleBlockType) {
|
26745 |
return;
|
26746 |
}
|
26747 |
|
@@ -26771,7 +25731,7 @@ class Inserter extends external_wp_element_namespaceObject.Component {
|
|
26771 |
const {
|
26772 |
insertBlock
|
26773 |
} = dispatch(store);
|
26774 |
-
const blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(allowedBlockType.name);
|
26775 |
insertBlock(blockToInsert, getInsertionIndex(), rootClientId);
|
26776 |
|
26777 |
if (onSelectOrClose) {
|
@@ -26961,7 +25921,7 @@ function ButtonBlockAppender({
|
|
26961 |
label: label
|
26962 |
}, !hasSingleBlockType && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
|
26963 |
as: "span"
|
26964 |
-
}, label), (0,external_wp_element_namespaceObject.createElement)(
|
26965 |
icon: library_plus
|
26966 |
}));
|
26967 |
|
@@ -31424,20 +30384,23 @@ var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(exte
|
|
31424 |
* the block-editor store, then the store is updated with the new settings which
|
31425 |
* came from props.
|
31426 |
*
|
31427 |
-
* @param {string}
|
31428 |
-
* @param {string[]}
|
31429 |
-
*
|
31430 |
-
* @param {
|
31431 |
-
*
|
31432 |
-
*
|
31433 |
-
*
|
31434 |
-
*
|
31435 |
-
* @param {
|
31436 |
-
*
|
31437 |
-
*
|
|
|
|
|
|
|
31438 |
*/
|
31439 |
|
31440 |
-
function useNestedSettingsUpdate(clientId, allowedBlocks, templateLock, captureToolbars, orientation, layout) {
|
31441 |
const {
|
31442 |
updateBlockListSettings
|
31443 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
@@ -31475,10 +30438,18 @@ function useNestedSettingsUpdate(clientId, allowedBlocks, templateLock, captureT
|
|
31475 |
newSettings.orientation = layoutType.getOrientation(layout);
|
31476 |
}
|
31477 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31478 |
if (!external_wp_isShallowEqual_default()(blockListSettings, newSettings)) {
|
31479 |
updateBlockListSettings(clientId, newSettings);
|
31480 |
}
|
31481 |
-
}, [clientId, blockListSettings, _allowedBlocks, templateLock, parentLock, captureToolbars, orientation, updateBlockListSettings, layout]);
|
31482 |
}
|
31483 |
//# sourceMappingURL=use-nested-settings-update.js.map
|
31484 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inner-blocks/use-inner-block-template-sync.js
|
@@ -31655,7 +30626,8 @@ function onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getCli
|
|
31655 |
|
31656 |
if (dropType === 'inserter') {
|
31657 |
clearSelectedBlock();
|
31658 |
-
|
|
|
31659 |
} // If the user is moving a block
|
31660 |
|
31661 |
|
@@ -32034,6 +31006,8 @@ function UncontrolledInnerBlocks(props) {
|
|
32034 |
const {
|
32035 |
clientId,
|
32036 |
allowedBlocks,
|
|
|
|
|
32037 |
template,
|
32038 |
templateLock,
|
32039 |
wrapperRef,
|
@@ -32045,7 +31019,7 @@ function UncontrolledInnerBlocks(props) {
|
|
32045 |
placeholder,
|
32046 |
__experimentalLayout
|
32047 |
} = props;
|
32048 |
-
useNestedSettingsUpdate(clientId, allowedBlocks, templateLock, captureToolbars, orientation, __experimentalLayout);
|
32049 |
useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection);
|
32050 |
const context = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
32051 |
const block = select(store).getBlock(clientId);
|
@@ -32323,6 +31297,7 @@ function BlockListItems(props) {
|
|
32323 |
*/
|
32324 |
|
32325 |
|
|
|
32326 |
/**
|
32327 |
* WordPress dependencies
|
32328 |
*/
|
@@ -32339,6 +31314,7 @@ function BlockListItems(props) {
|
|
32339 |
|
32340 |
|
32341 |
const duotone_EMPTY_ARRAY = [];
|
|
|
32342 |
/**
|
32343 |
* Convert a list of colors to an object of R, G, and B values.
|
32344 |
*
|
@@ -32354,11 +31330,10 @@ function getValuesFromColors(colors = []) {
|
|
32354 |
b: []
|
32355 |
};
|
32356 |
colors.forEach(color => {
|
32357 |
-
|
32358 |
-
|
32359 |
-
values.
|
32360 |
-
values.
|
32361 |
-
values.b.push(tcolor._b / 255);
|
32362 |
});
|
32363 |
return values;
|
32364 |
}
|
@@ -32510,6 +31485,35 @@ const withDuotoneControls = (0,external_wp_compose_namespaceObject.createHigherO
|
|
32510 |
const hasDuotoneSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, 'color.__experimentalDuotone');
|
32511 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props), hasDuotoneSupport && (0,external_wp_element_namespaceObject.createElement)(DuotonePanel, props));
|
32512 |
}, 'withDuotoneControls');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32513 |
/**
|
32514 |
* Override the default block element to include duotone styles.
|
32515 |
*
|
@@ -32518,6 +31522,7 @@ const withDuotoneControls = (0,external_wp_compose_namespaceObject.createHigherO
|
|
32518 |
* @return {Function} Wrapped component.
|
32519 |
*/
|
32520 |
|
|
|
32521 |
const withDuotoneStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => {
|
32522 |
var _props$attributes, _props$attributes$sty, _props$attributes$sty2;
|
32523 |
|
@@ -32528,10 +31533,11 @@ const withDuotoneStyles = (0,external_wp_compose_namespaceObject.createHigherOrd
|
|
32528 |
return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, props);
|
32529 |
}
|
32530 |
|
32531 |
-
const id = `wp-duotone
|
32532 |
-
|
32533 |
-
|
32534 |
-
|
|
|
32535 |
const className = classnames_default()(props === null || props === void 0 ? void 0 : props.className, id);
|
32536 |
const element = (0,external_wp_element_namespaceObject.useContext)(BlockList.__unstableElementContext);
|
32537 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, element && (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)(DuotoneFilter, {
|
@@ -33601,7 +32607,7 @@ function useCompleters({
|
|
33601 |
return (0,external_wp_element_namespaceObject.useMemo)(() => {
|
33602 |
let filteredCompleters = completers;
|
33603 |
|
33604 |
-
if (name === (0,external_wp_blocks_namespaceObject.getDefaultBlockName)()) {
|
33605 |
filteredCompleters = filteredCompleters.concat([autocompleters_block]);
|
33606 |
}
|
33607 |
|
@@ -33835,7 +32841,7 @@ function BlockBreadcrumb({
|
|
33835 |
className: "block-editor-block-breadcrumb__button",
|
33836 |
variant: "tertiary",
|
33837 |
onClick: clearSelectedBlock
|
33838 |
-
}, rootLabel), !hasSelection && rootLabel, !!clientId && (0,external_wp_element_namespaceObject.createElement)(
|
33839 |
icon: chevron_right_small,
|
33840 |
className: "block-editor-block-breadcrumb__separator"
|
33841 |
})), parents.map(parentClientId => (0,external_wp_element_namespaceObject.createElement)("li", {
|
@@ -33846,7 +32852,7 @@ function BlockBreadcrumb({
|
|
33846 |
onClick: () => selectBlock(parentClientId)
|
33847 |
}, (0,external_wp_element_namespaceObject.createElement)(BlockTitle, {
|
33848 |
clientId: parentClientId
|
33849 |
-
})), (0,external_wp_element_namespaceObject.createElement)(
|
33850 |
icon: chevron_right_small,
|
33851 |
className: "block-editor-block-breadcrumb__separator"
|
33852 |
}))), !!clientId && (0,external_wp_element_namespaceObject.createElement)("li", {
|
@@ -34153,7 +33159,7 @@ function ListViewExpander({
|
|
34153 |
forceToggle: true
|
34154 |
}),
|
34155 |
"aria-hidden": "true"
|
34156 |
-
}, (0,external_wp_element_namespaceObject.createElement)(
|
34157 |
icon: chevron_right_small
|
34158 |
}))
|
34159 |
);
|
@@ -38060,6 +37066,8 @@ class URLInput extends external_wp_element_namespaceObject.Component {
|
|
38060 |
}
|
38061 |
|
38062 |
updateSuggestions(value = '') {
|
|
|
|
|
38063 |
const {
|
38064 |
__experimentalFetchLinkSuggestions: fetchLinkSuggestions,
|
38065 |
__experimentalHandleURLSuggestions: handleURLSuggestions
|
@@ -38067,9 +37075,14 @@ class URLInput extends external_wp_element_namespaceObject.Component {
|
|
38067 |
|
38068 |
if (!fetchLinkSuggestions) {
|
38069 |
return;
|
38070 |
-
}
|
|
|
|
|
38071 |
|
38072 |
-
const isInitialSuggestions = !(value &&
|
|
|
|
|
|
|
38073 |
// - there are at least 2 characters in the search input (except manual searches where
|
38074 |
// search input length is not required to trigger a fetch)
|
38075 |
// - this is a direct entry (eg: a URL)
|
@@ -38132,7 +37145,7 @@ class URLInput extends external_wp_element_namespaceObject.Component {
|
|
38132 |
this.props.onChange(inputValue);
|
38133 |
|
38134 |
if (!this.props.disableSuggestions) {
|
38135 |
-
this.updateSuggestions(inputValue
|
38136 |
}
|
38137 |
}
|
38138 |
|
@@ -38148,7 +37161,7 @@ class URLInput extends external_wp_element_namespaceObject.Component {
|
|
38148 |
|
38149 |
if (value && !disableSuggestions && !this.isUpdatingSuggestions && !(suggestions && suggestions.length)) {
|
38150 |
// Ensure the suggestions are updated with the current input value
|
38151 |
-
this.updateSuggestions(value
|
38152 |
}
|
38153 |
}
|
38154 |
|
@@ -38198,7 +37211,7 @@ class URLInput extends external_wp_element_namespaceObject.Component {
|
|
38198 |
case external_wp_keycodes_namespaceObject.ENTER:
|
38199 |
{
|
38200 |
if (this.props.onSubmit) {
|
38201 |
-
this.props.onSubmit();
|
38202 |
}
|
38203 |
|
38204 |
break;
|
@@ -38248,10 +37261,10 @@ class URLInput extends external_wp_element_namespaceObject.Component {
|
|
38248 |
this.selectLink(suggestion);
|
38249 |
|
38250 |
if (this.props.onSubmit) {
|
38251 |
-
this.props.onSubmit(suggestion);
|
38252 |
}
|
38253 |
} else if (this.props.onSubmit) {
|
38254 |
-
this.props.onSubmit();
|
38255 |
}
|
38256 |
|
38257 |
break;
|
@@ -38480,7 +37493,7 @@ const LinkControlSearchCreate = ({
|
|
38480 |
'is-selected': isSelected
|
38481 |
}),
|
38482 |
onClick: onClick
|
38483 |
-
}), (0,external_wp_element_namespaceObject.createElement)(
|
38484 |
className: "block-editor-link-control__search-item-icon",
|
38485 |
icon: library_plus
|
38486 |
}), (0,external_wp_element_namespaceObject.createElement)("span", {
|
@@ -38500,9 +37513,9 @@ const LinkControlSearchCreate = ({
|
|
38500 |
|
38501 |
const globe = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
38502 |
xmlns: "http://www.w3.org/2000/svg",
|
38503 |
-
viewBox: "
|
38504 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
38505 |
-
d: "
|
38506 |
}));
|
38507 |
/* harmony default export */ var library_globe = (globe);
|
38508 |
//# sourceMappingURL=globe.js.map
|
@@ -38538,7 +37551,7 @@ const LinkControlSearchItem = ({
|
|
38538 |
'is-url': isURL,
|
38539 |
'is-entity': !isURL
|
38540 |
})
|
38541 |
-
}), isURL && (0,external_wp_element_namespaceObject.createElement)(
|
38542 |
className: "block-editor-link-control__search-item-icon",
|
38543 |
icon: library_globe
|
38544 |
}), (0,external_wp_element_namespaceObject.createElement)("span", {
|
@@ -38924,16 +37937,40 @@ const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef
|
|
38924 |
__experimentalFetchLinkSuggestions: searchHandler,
|
38925 |
__experimentalHandleURLSuggestions: true,
|
38926 |
__experimentalShowInitialSuggestions: showInitialSuggestions,
|
38927 |
-
onSubmit: suggestion => {
|
38928 |
-
|
38929 |
-
|
38930 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38931 |
},
|
38932 |
ref: ref
|
38933 |
}), children);
|
38934 |
});
|
38935 |
/* harmony default export */ var search_input = (LinkControlSearchInput);
|
38936 |
//# sourceMappingURL=search-input.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38937 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/link-control/viewer-slot.js
|
38938 |
/**
|
38939 |
* WordPress dependencies
|
@@ -39068,6 +38105,25 @@ function LinkPreview({
|
|
39068 |
|
39069 |
const hasRichData = richData && Object.keys(richData).length;
|
39070 |
const displayURL = value && (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(value.url), 16) || '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39071 |
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
39072 |
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Currently selected'),
|
39073 |
"aria-selected": "true",
|
@@ -39075,7 +38131,8 @@ function LinkPreview({
|
|
39075 |
'is-current': true,
|
39076 |
'is-rich': hasRichData,
|
39077 |
'is-fetching': !!isFetching,
|
39078 |
-
'is-preview': true
|
|
|
39079 |
})
|
39080 |
}, (0,external_wp_element_namespaceObject.createElement)("div", {
|
39081 |
className: "block-editor-link-control__search-item-top"
|
@@ -39085,19 +38142,16 @@ function LinkPreview({
|
|
39085 |
className: classnames_default()('block-editor-link-control__search-item-icon', {
|
39086 |
'is-image': richData === null || richData === void 0 ? void 0 : richData.icon
|
39087 |
})
|
39088 |
-
},
|
39089 |
-
src: richData === null || richData === void 0 ? void 0 : richData.icon,
|
39090 |
-
alt: ""
|
39091 |
-
}) : (0,external_wp_element_namespaceObject.createElement)(icon, {
|
39092 |
-
icon: library_globe
|
39093 |
-
})), (0,external_wp_element_namespaceObject.createElement)("span", {
|
39094 |
className: "block-editor-link-control__search-item-details"
|
39095 |
-
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
|
39096 |
className: "block-editor-link-control__search-item-title",
|
39097 |
href: value.url
|
39098 |
}, (richData === null || richData === void 0 ? void 0 : richData.title) || (value === null || value === void 0 ? void 0 : value.title) || displayURL), (value === null || value === void 0 ? void 0 : value.url) && (0,external_wp_element_namespaceObject.createElement)("span", {
|
39099 |
className: "block-editor-link-control__search-item-info"
|
39100 |
-
}, displayURL))
|
|
|
|
|
39101 |
variant: "secondary",
|
39102 |
onClick: () => onEditClick(),
|
39103 |
className: "block-editor-link-control__search-item-action"
|
@@ -39330,6 +38384,8 @@ function LinkControl({
|
|
39330 |
createSuggestionButtonText,
|
39331 |
hasRichPreviews = false
|
39332 |
}) {
|
|
|
|
|
39333 |
if (withCreateSuggestion === undefined && createSuggestion) {
|
39334 |
withCreateSuggestion = true;
|
39335 |
}
|
@@ -39340,6 +38396,7 @@ function LinkControl({
|
|
39340 |
const currentInputValue = propInputValue || internalInputValue;
|
39341 |
const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(forceIsEditingLink !== undefined ? forceIsEditingLink : !value || !value.url);
|
39342 |
const isEndingEditWithFocus = (0,external_wp_element_namespaceObject.useRef)(false);
|
|
|
39343 |
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
39344 |
if (forceIsEditingLink !== undefined && forceIsEditingLink !== isEditingLink) {
|
39345 |
setIsEditingLink(forceIsEditingLink);
|
@@ -39424,14 +38481,17 @@ function LinkControl({
|
|
39424 |
keyCode
|
39425 |
} = event;
|
39426 |
|
39427 |
-
if (keyCode === external_wp_keycodes_namespaceObject.ENTER
|
39428 |
-
|
39429 |
-
|
39430 |
-
|
|
|
39431 |
},
|
39432 |
label: (0,external_wp_i18n_namespaceObject.__)('Submit'),
|
39433 |
icon: keyboard_return,
|
39434 |
-
className: "block-editor-link-control__search-submit"
|
|
|
|
|
39435 |
})))), errorMessage && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
|
39436 |
className: "block-editor-link-control__search-error",
|
39437 |
status: "error",
|
@@ -39835,6 +38895,26 @@ function splitValue({
|
|
39835 |
|
39836 |
|
39837 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39838 |
function usePasteHandler(props) {
|
39839 |
const propsRef = (0,external_wp_element_namespaceObject.useRef)(props);
|
39840 |
propsRef.current = props;
|
@@ -39920,12 +39000,14 @@ function usePasteHandler(props) {
|
|
39920 |
// pasted content and remove inline styles.
|
39921 |
|
39922 |
if (isInternal) {
|
39923 |
-
const
|
|
|
39924 |
html,
|
39925 |
-
multilineTag,
|
39926 |
-
multilineWrapperTags:
|
39927 |
preserveWhiteSpace
|
39928 |
});
|
|
|
39929 |
addActiveFormats(pastedValue, value.activeFormats);
|
39930 |
onChange((0,external_wp_richText_namespaceObject.insert)(value, pastedValue));
|
39931 |
return;
|
@@ -39991,14 +39073,11 @@ function usePasteHandler(props) {
|
|
39991 |
if (typeof content === 'string') {
|
39992 |
let valueToInsert = (0,external_wp_richText_namespaceObject.create)({
|
39993 |
html: content
|
39994 |
-
});
|
39995 |
-
addActiveFormats(valueToInsert, value.activeFormats); // If the content should be multiline, we should process text
|
39996 |
// separated by a line break as separate lines.
|
39997 |
|
39998 |
-
|
39999 |
-
|
40000 |
-
}
|
40001 |
-
|
40002 |
onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert));
|
40003 |
} else if (content.length > 0) {
|
40004 |
if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) {
|
@@ -42118,7 +41197,7 @@ function ToolSelector(props, ref) {
|
|
42118 |
onSelect: onSwitchMode,
|
42119 |
choices: [{
|
42120 |
value: 'edit',
|
42121 |
-
label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(
|
42122 |
icon: library_edit
|
42123 |
}), (0,external_wp_i18n_namespaceObject.__)('Edit'))
|
42124 |
}, {
|
@@ -42296,7 +41375,7 @@ const LINK_DESTINATION_CUSTOM = 'custom';
|
|
42296 |
const LINK_DESTINATION_MEDIA = 'media';
|
42297 |
const LINK_DESTINATION_ATTACHMENT = 'attachment';
|
42298 |
const NEW_TAB_REL = ['noreferrer', 'noopener'];
|
42299 |
-
const
|
42300 |
viewBox: "0 0 24 24",
|
42301 |
xmlns: "http://www.w3.org/2000/svg"
|
42302 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
|
@@ -42429,7 +41508,7 @@ const ImageURLInputUI = ({
|
|
42429 |
linkDestination: LINK_DESTINATION_MEDIA,
|
42430 |
title: (0,external_wp_i18n_namespaceObject.__)('Media File'),
|
42431 |
url: mediaType === 'image' ? mediaUrl : undefined,
|
42432 |
-
icon
|
42433 |
}];
|
42434 |
|
42435 |
if (mediaType === 'image' && mediaLink) {
|
@@ -43329,7 +42408,7 @@ function isKeyDownEligibleForStartTyping(event) {
|
|
43329 |
|
43330 |
|
43331 |
function useMouseMoveTypingReset() {
|
43332 |
-
const isTyping = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isTyping());
|
43333 |
const {
|
43334 |
stopTyping
|
43335 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
@@ -43546,7 +42625,7 @@ const isIE = window.navigator.userAgent.indexOf('Trident') !== -1;
|
|
43546 |
const arrowKeyCodes = new Set([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT]);
|
43547 |
const initialTriggerPercentage = 0.75;
|
43548 |
function useTypewriter() {
|
43549 |
-
const hasSelectedBlock = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).hasSelectedBlock());
|
43550 |
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
|
43551 |
if (!hasSelectedBlock) {
|
43552 |
return;
|
@@ -44044,10 +43123,297 @@ function validateThemeGradients(gradients) {
|
|
44044 |
return gradients;
|
44045 |
}
|
44046 |
//# sourceMappingURL=theme.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44047 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/index.js
|
44048 |
|
44049 |
|
44050 |
|
|
|
44051 |
//# sourceMappingURL=index.js.map
|
44052 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/index.js
|
44053 |
/**
|
1733 |
exports.Z = TextareaAutosize_1.TextareaAutosize;
|
1734 |
|
1735 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1736 |
/***/ }),
|
1737 |
|
1738 |
/***/ 3692:
|
2268 |
"getFontSizeObjectByValue": function() { return /* reexport */ getFontSizeObjectByValue; },
|
2269 |
"getGradientSlugByValue": function() { return /* reexport */ getGradientSlugByValue; },
|
2270 |
"getGradientValueBySlug": function() { return /* reexport */ getGradientValueBySlug; },
|
2271 |
+
"getPxFromCssUnit": function() { return /* reexport */ parse_css_unit_to_px; },
|
2272 |
"store": function() { return /* reexport */ store; },
|
2273 |
"storeConfig": function() { return /* reexport */ storeConfig; },
|
2274 |
"transformStyles": function() { return /* reexport */ transform_styles; },
|
2291 |
"__experimentalGetAllowedBlocks": function() { return __experimentalGetAllowedBlocks; },
|
2292 |
"__experimentalGetAllowedPatterns": function() { return __experimentalGetAllowedPatterns; },
|
2293 |
"__experimentalGetBlockListSettingsForBlocks": function() { return __experimentalGetBlockListSettingsForBlocks; },
|
2294 |
+
"__experimentalGetDirectInsertBlock": function() { return __experimentalGetDirectInsertBlock; },
|
2295 |
"__experimentalGetLastBlockAttributeChanges": function() { return __experimentalGetLastBlockAttributeChanges; },
|
2296 |
"__experimentalGetParsedPattern": function() { return __experimentalGetParsedPattern; },
|
2297 |
"__experimentalGetParsedReusableBlock": function() { return __experimentalGetParsedReusableBlock; },
|
6337 |
|
6338 |
return (0,external_lodash_namespaceObject.filter)((0,external_wp_blocks_namespaceObject.getBlockTypes)(), blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId));
|
6339 |
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, (0,external_wp_blocks_namespaceObject.getBlockTypes)()]);
|
6340 |
+
/**
|
6341 |
+
* Returns the block to be directly inserted by the block appender.
|
6342 |
+
*
|
6343 |
+
* @param {Object} state Editor state.
|
6344 |
+
* @param {?string} rootClientId Optional root client ID of block list.
|
6345 |
+
*
|
6346 |
+
* @return {?Array} The block type to be directly inserted.
|
6347 |
+
*/
|
6348 |
+
|
6349 |
+
const __experimentalGetDirectInsertBlock = rememo((state, rootClientId = null) => {
|
6350 |
+
var _state$blockListSetti, _state$blockListSetti2;
|
6351 |
+
|
6352 |
+
if (!rootClientId) {
|
6353 |
+
return;
|
6354 |
+
}
|
6355 |
+
|
6356 |
+
const defaultBlock = (_state$blockListSetti = state.blockListSettings[rootClientId]) === null || _state$blockListSetti === void 0 ? void 0 : _state$blockListSetti.__experimentalDefaultBlock;
|
6357 |
+
const directInsert = (_state$blockListSetti2 = state.blockListSettings[rootClientId]) === null || _state$blockListSetti2 === void 0 ? void 0 : _state$blockListSetti2.__experimentalDirectInsert;
|
6358 |
+
|
6359 |
+
if (!defaultBlock || !directInsert) {
|
6360 |
+
return;
|
6361 |
+
}
|
6362 |
+
|
6363 |
+
if (typeof directInsert === 'function') {
|
6364 |
+
return directInsert(getBlock(state, rootClientId)) ? defaultBlock : null;
|
6365 |
+
}
|
6366 |
+
|
6367 |
+
return defaultBlock;
|
6368 |
+
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.tree[rootClientId]]);
|
6369 |
|
6370 |
const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
|
6371 |
if ((0,external_lodash_namespaceObject.isBoolean)(allowedBlockTypes)) {
|
8235 |
|
8236 |
/* harmony default export */ var block_controls = (BlockControls);
|
8237 |
//# sourceMappingURL=index.js.map
|
8238 |
+
;// CONCATENATED MODULE: ./packages/icons/build-module/library/align-none.js
|
8239 |
+
|
8240 |
+
|
8241 |
+
/**
|
8242 |
+
* WordPress dependencies
|
8243 |
+
*/
|
8244 |
+
|
8245 |
+
const alignNone = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
8246 |
+
xmlns: "http://www.w3.org/2000/svg",
|
8247 |
+
viewBox: "0 0 24 24"
|
8248 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
8249 |
+
d: "M5 15h14V9H5v6zm0 4.8h14v-1.5H5v1.5zM5 4.2v1.5h14V4.2H5z"
|
8250 |
+
}));
|
8251 |
+
/* harmony default export */ var align_none = (alignNone);
|
8252 |
+
//# sourceMappingURL=align-none.js.map
|
8253 |
;// CONCATENATED MODULE: ./packages/icons/build-module/library/position-left.js
|
8254 |
|
8255 |
|
8276 |
xmlns: "http://www.w3.org/2000/svg",
|
8277 |
viewBox: "0 0 24 24"
|
8278 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
8279 |
+
d: "M7 9v6h10V9H7zM5 19.8h14v-1.5H5v1.5zM5 4.3v1.5h14V4.3H5z"
|
8280 |
}));
|
8281 |
/* harmony default export */ var position_center = (positionCenter);
|
8282 |
//# sourceMappingURL=position-center.js.map
|
8765 |
});
|
8766 |
}
|
8767 |
|
8768 |
+
/* harmony default export */ var build_module_icon = (Icon);
|
8769 |
//# sourceMappingURL=index.js.map
|
8770 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/layouts/flow.js
|
8771 |
|
8812 |
});
|
8813 |
},
|
8814 |
units: units
|
8815 |
+
}), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
|
8816 |
icon: position_center
|
8817 |
})), (0,external_wp_element_namespaceObject.createElement)("div", {
|
8818 |
className: "block-editor-hooks__layout-controls-unit"
|
8828 |
});
|
8829 |
},
|
8830 |
units: units
|
8831 |
+
}), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
|
8832 |
icon: stretch_wide
|
8833 |
}))), (0,external_wp_element_namespaceObject.createElement)("div", {
|
8834 |
className: "block-editor-hooks__layout-controls-reset"
|
8903 |
},
|
8904 |
|
8905 |
getAlignments(layout) {
|
8906 |
+
const alignmentInfo = getAlignmentsInfo(layout);
|
8907 |
+
|
8908 |
if (layout.alignments !== undefined) {
|
8909 |
+
if (!layout.alignments.includes('none')) {
|
8910 |
+
layout.alignments.unshift('none');
|
8911 |
+
}
|
8912 |
+
|
8913 |
+
return layout.alignments.map(alignment => ({
|
8914 |
+
name: alignment,
|
8915 |
+
info: alignmentInfo[alignment]
|
8916 |
+
}));
|
8917 |
}
|
8918 |
|
8919 |
+
const {
|
8920 |
+
contentSize,
|
8921 |
+
wideSize
|
8922 |
+
} = layout;
|
8923 |
+
const alignments = [{
|
8924 |
+
name: 'left'
|
8925 |
+
}, {
|
8926 |
+
name: 'center'
|
8927 |
+
}, {
|
8928 |
+
name: 'right'
|
8929 |
+
}];
|
8930 |
|
8931 |
+
if (contentSize) {
|
8932 |
+
alignments.unshift({
|
8933 |
+
name: 'full'
|
8934 |
+
});
|
8935 |
}
|
8936 |
|
8937 |
+
if (wideSize) {
|
8938 |
+
alignments.unshift({
|
8939 |
+
name: 'wide',
|
8940 |
+
info: alignmentInfo.wide
|
8941 |
+
});
|
8942 |
}
|
8943 |
|
8944 |
+
alignments.unshift({
|
8945 |
+
name: 'none',
|
8946 |
+
info: alignmentInfo.none
|
8947 |
+
});
|
8948 |
return alignments;
|
8949 |
}
|
8950 |
|
8951 |
});
|
8952 |
+
/**
|
8953 |
+
* Helper method to assign contextual info to clarify
|
8954 |
+
* alignment settings.
|
8955 |
+
*
|
8956 |
+
* Besides checking if `contentSize` and `wideSize` have a
|
8957 |
+
* value, we now show this information only if their values
|
8958 |
+
* are not a `css var`. This needs to change when parsing
|
8959 |
+
* css variables land.
|
8960 |
+
*
|
8961 |
+
* @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752
|
8962 |
+
*
|
8963 |
+
* @param {Object} layout The layout object.
|
8964 |
+
* @return {Object} An object with contextual info per alignment.
|
8965 |
+
*/
|
8966 |
+
|
8967 |
+
function getAlignmentsInfo(layout) {
|
8968 |
+
const {
|
8969 |
+
contentSize,
|
8970 |
+
wideSize
|
8971 |
+
} = layout;
|
8972 |
+
const alignmentInfo = {};
|
8973 |
+
const sizeRegex = /^(?!0)\d+(px|em|rem|vw|vh|%)?$/i;
|
8974 |
+
|
8975 |
+
if (sizeRegex.test(contentSize)) {
|
8976 |
+
// translators: %s: container size (i.e. 600px etc)
|
8977 |
+
alignmentInfo.none = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Max %s wide'), contentSize);
|
8978 |
+
}
|
8979 |
+
|
8980 |
+
if (sizeRegex.test(wideSize)) {
|
8981 |
+
// translators: %s: container size (i.e. 600px etc)
|
8982 |
+
alignmentInfo.wide = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Max %s wide'), wideSize);
|
8983 |
+
}
|
8984 |
+
|
8985 |
+
return alignmentInfo;
|
8986 |
+
}
|
8987 |
//# sourceMappingURL=flow.js.map
|
8988 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/layouts/index.js
|
8989 |
/**
|
9068 |
|
9069 |
|
9070 |
|
9071 |
+
const DEFAULT_CONTROLS = ['none', 'left', 'center', 'right', 'wide', 'full'];
|
9072 |
const WIDE_CONTROLS = ['wide', 'full'];
|
9073 |
function useAvailableAlignments(controls = DEFAULT_CONTROLS) {
|
9074 |
+
// Always add the `none` option if not exists.
|
9075 |
+
if (!controls.includes('none')) {
|
9076 |
+
controls.unshift('none');
|
9077 |
+
}
|
9078 |
+
|
9079 |
const {
|
9080 |
wideControlsEnabled = false,
|
9081 |
themeSupportsLayout
|
9094 |
const layoutAlignments = layoutType.getAlignments(layout);
|
9095 |
|
9096 |
if (themeSupportsLayout) {
|
9097 |
+
return layoutAlignments.filter(({
|
9098 |
+
name: alignmentName
|
9099 |
+
}) => controls.includes(alignmentName));
|
9100 |
} // Starting here, it's the fallback for themes not supporting the layout config.
|
9101 |
|
9102 |
|
9108 |
alignments: availableAlignments = DEFAULT_CONTROLS
|
9109 |
} = layout;
|
9110 |
const enabledControls = controls.filter(control => (layout.alignments || // Ignore the global wideAlignment check if the layout explicitely defines alignments.
|
9111 |
+
wideControlsEnabled || !WIDE_CONTROLS.includes(control)) && availableAlignments.includes(control)).map(enabledControl => ({
|
9112 |
+
name: enabledControl
|
9113 |
+
}));
|
9114 |
return enabledControls;
|
9115 |
}
|
9116 |
//# sourceMappingURL=use-available-alignments.js.map
|
9118 |
|
9119 |
|
9120 |
|
9121 |
+
/**
|
9122 |
+
* External dependencies
|
9123 |
+
*/
|
9124 |
+
|
9125 |
/**
|
9126 |
* WordPress dependencies
|
9127 |
*/
|
9128 |
|
9129 |
|
9130 |
|
9131 |
+
|
9132 |
+
|
9133 |
/**
|
9134 |
* Internal dependencies
|
9135 |
*/
|
9136 |
|
9137 |
|
9138 |
const BLOCK_ALIGNMENTS_CONTROLS = {
|
9139 |
+
none: {
|
9140 |
+
icon: align_none,
|
9141 |
+
title: (0,external_wp_i18n_namespaceObject.__)('None')
|
9142 |
+
},
|
9143 |
left: {
|
9144 |
icon: position_left,
|
9145 |
title: (0,external_wp_i18n_namespaceObject.__)('Align left')
|
9161 |
title: (0,external_wp_i18n_namespaceObject.__)('Full width')
|
9162 |
}
|
9163 |
};
|
9164 |
+
const DEFAULT_CONTROL = 'none';
|
9165 |
const POPOVER_PROPS = {
|
9166 |
isAlternate: true
|
9167 |
};
|
9174 |
isCollapsed = true
|
9175 |
}) {
|
9176 |
const enabledControls = useAvailableAlignments(controls);
|
9177 |
+
const hasEnabledControls = !!enabledControls.length;
|
9178 |
|
9179 |
+
if (!hasEnabledControls) {
|
9180 |
return null;
|
9181 |
}
|
9182 |
|
9183 |
+
function onChangeAlignment(align) {
|
9184 |
+
onChange([value, 'none'].includes(align) ? undefined : align);
|
9185 |
}
|
9186 |
|
9187 |
const activeAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[value];
|
9188 |
const defaultAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[DEFAULT_CONTROL];
|
9189 |
const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu;
|
9190 |
+
const commonProps = {
|
|
|
|
|
|
|
|
|
9191 |
popoverProps: POPOVER_PROPS,
|
9192 |
icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon,
|
9193 |
label: (0,external_wp_i18n_namespaceObject.__)('Align'),
|
9194 |
toggleProps: {
|
9195 |
+
describedBy: (0,external_wp_i18n_namespaceObject.__)('Change alignment')
|
9196 |
+
}
|
9197 |
+
};
|
9198 |
+
const extraProps = isToolbar || external_wp_element_namespaceObject.Platform.isNative ? {
|
9199 |
+
isCollapsed: isToolbar ? isCollapsed : undefined,
|
9200 |
+
controls: enabledControls.map(({
|
9201 |
+
name: controlName
|
9202 |
+
}) => {
|
9203 |
+
return { ...BLOCK_ALIGNMENTS_CONTROLS[controlName],
|
9204 |
+
isActive: value === controlName || !value && controlName === 'none',
|
9205 |
role: isCollapsed ? 'menuitemradio' : undefined,
|
9206 |
+
onClick: () => onChangeAlignment(controlName)
|
9207 |
};
|
9208 |
})
|
9209 |
+
} : {
|
9210 |
+
children: ({
|
9211 |
+
onClose
|
9212 |
+
}) => {
|
9213 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
|
9214 |
+
className: "block-editor-block-alignment-control__menu-group"
|
9215 |
+
}, enabledControls.map(({
|
9216 |
+
name: controlName,
|
9217 |
+
info
|
9218 |
+
}) => {
|
9219 |
+
const {
|
9220 |
+
icon,
|
9221 |
+
title
|
9222 |
+
} = BLOCK_ALIGNMENTS_CONTROLS[controlName]; // If no value is provided, mark as selected the `none` option.
|
9223 |
+
|
9224 |
+
const isSelected = controlName === value || !value && controlName === 'none';
|
9225 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
|
9226 |
+
key: controlName,
|
9227 |
+
icon: icon,
|
9228 |
+
iconPosition: "left",
|
9229 |
+
className: classnames_default()('components-dropdown-menu__menu-item', {
|
9230 |
+
'is-active': isSelected
|
9231 |
+
}),
|
9232 |
+
isSelected: isSelected,
|
9233 |
+
onClick: () => {
|
9234 |
+
onChangeAlignment(controlName);
|
9235 |
+
onClose();
|
9236 |
+
},
|
9237 |
+
role: "menuitemradio",
|
9238 |
+
info: info
|
9239 |
+
}, title);
|
9240 |
+
})));
|
9241 |
+
}
|
9242 |
+
};
|
9243 |
+
return (0,external_wp_element_namespaceObject.createElement)(UIComponent, _extends({}, commonProps, extraProps));
|
9244 |
}
|
9245 |
|
9246 |
/* harmony default export */ var block_alignment_control_ui = (BlockAlignmentUI);
|
9434 |
|
9435 |
let wrapperProps = props.wrapperProps;
|
9436 |
|
9437 |
+
if (validAlignments.some(alignment => alignment.name === align)) {
|
9438 |
wrapperProps = { ...wrapperProps,
|
9439 |
'data-align': align
|
9440 |
};
|
9619 |
clientId: selectedBlockClientId,
|
9620 |
attributes: getBlockAttributes(selectedBlockClientId)
|
9621 |
};
|
9622 |
+
}, []);
|
9623 |
const {
|
9624 |
updateBlockAttributes
|
9625 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
9994 |
}
|
9995 |
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName);
|
9996 |
//# sourceMappingURL=generated-class-name.js.map
|
9997 |
+
;// CONCATENATED MODULE: ./packages/block-editor/node_modules/colord/index.mjs
|
9998 |
+
var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};
|
9999 |
+
|
10000 |
+
;// CONCATENATED MODULE: ./packages/block-editor/node_modules/colord/plugins/names.mjs
|
10001 |
+
/* harmony default export */ function names(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])}
|
10002 |
+
|
10003 |
+
;// CONCATENATED MODULE: ./packages/block-editor/node_modules/colord/plugins/a11y.mjs
|
10004 |
+
var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}}
|
10005 |
+
|
10006 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors/utils.js
|
10007 |
/**
|
10008 |
* External dependencies
|
10009 |
*/
|
10010 |
|
10011 |
|
10012 |
+
|
10013 |
+
|
10014 |
+
k([names, a11y]);
|
10015 |
/**
|
10016 |
* Provided an array of color objects as set by the theme or by the editor defaults,
|
10017 |
* and the values of the defined color or custom color returns a color object describing the color.
|
10082 |
*/
|
10083 |
|
10084 |
function getMostReadableColor(colors, colorValue) {
|
10085 |
+
const colordColor = w(colorValue);
|
10086 |
+
return (0,external_lodash_namespaceObject.maxBy)(colors, ({
|
10087 |
+
color
|
10088 |
+
}) => colordColor.contrast(color)).color;
|
10089 |
}
|
10090 |
//# sourceMappingURL=utils.js.map
|
10091 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/gradients/use-gradient.js
|
11413 |
* External dependencies
|
11414 |
*/
|
11415 |
|
11416 |
+
|
11417 |
+
|
11418 |
/**
|
11419 |
* WordPress dependencies
|
11420 |
*/
|
11423 |
|
11424 |
|
11425 |
|
11426 |
+
k([names, a11y]);
|
11427 |
|
11428 |
function ContrastCheckerMessage({
|
11429 |
+
colordBackgroundColor,
|
11430 |
+
colordTextColor,
|
11431 |
backgroundColor,
|
11432 |
textColor
|
11433 |
}) {
|
11434 |
+
const msg = colordBackgroundColor.brightness() < colordTextColor.brightness() ? (0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read. Try using a darker background color and/or a brighter text color.') : (0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read. Try using a brighter background color and/or a darker text color.'); // Note: The `Notice` component can speak messages via its `spokenMessage`
|
11435 |
// prop, but the contrast checker requires granular control over when the
|
11436 |
// announcements are made. Notably, the message will be re-announced if a
|
11437 |
// new color combination is selected and the contrast is still insufficient.
|
11461 |
return null;
|
11462 |
}
|
11463 |
|
11464 |
+
const colordBackgroundColor = w(backgroundColor || fallbackBackgroundColor);
|
11465 |
+
const colordTextColor = w(textColor || fallbackTextColor);
|
11466 |
+
const hasTransparency = colordBackgroundColor.alpha() !== 1 || colordTextColor.alpha() !== 1;
|
11467 |
|
11468 |
+
if (hasTransparency || colordTextColor.isReadable(colordBackgroundColor, {
|
11469 |
level: 'AA',
|
11470 |
size: isLargeText || isLargeText !== false && fontSize >= 24 ? 'large' : 'small'
|
11471 |
})) {
|
11475 |
return (0,external_wp_element_namespaceObject.createElement)(ContrastCheckerMessage, {
|
11476 |
backgroundColor: backgroundColor,
|
11477 |
textColor: textColor,
|
11478 |
+
colordBackgroundColor: colordBackgroundColor,
|
11479 |
+
colordTextColor: colordTextColor
|
11480 |
});
|
11481 |
}
|
11482 |
|
13645 |
|
13646 |
return external_wp_element_namespaceObject.Platform.select({
|
13647 |
web: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
|
13648 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
|
13649 |
+
__unstableInputWidth: "80px",
|
13650 |
min: 0,
|
13651 |
onChange: onChange,
|
13652 |
units: units,
|
14017 |
isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.margin,
|
14018 |
panelId: props.clientId
|
14019 |
}, (0,external_wp_element_namespaceObject.createElement)(MarginEdit, props)), !isGapDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
|
|
|
14020 |
hasValue: () => hasGapValue(props),
|
14021 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
|
14022 |
onDeselect: () => resetGap(props),
|
14023 |
resetAllFilter: createResetAllFilter('blockGap'),
|
14024 |
isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.blockGap,
|
14342 |
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/style/with-block-controls', withBlockControls);
|
14343 |
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/editor/with-elements-styles', withElementsStyles);
|
14344 |
//# sourceMappingURL=style.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14345 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/duotone-control/index.js
|
14346 |
|
14347 |
|
14352 |
|
14353 |
|
14354 |
|
|
|
|
|
|
|
|
|
|
|
|
|
14355 |
function DuotoneControl({
|
14356 |
colorPalette,
|
14357 |
duotonePalette,
|
14360 |
value,
|
14361 |
onChange
|
14362 |
}) {
|
14363 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
|
14364 |
+
popoverProps: {
|
14365 |
+
className: 'block-editor-duotone-control__popover',
|
14366 |
+
headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone')
|
14367 |
+
},
|
14368 |
+
renderToggle: ({
|
14369 |
+
isOpen,
|
14370 |
+
onToggle
|
14371 |
+
}) => {
|
14372 |
+
const openOnArrowDown = event => {
|
14373 |
+
if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
|
14374 |
+
event.preventDefault();
|
14375 |
+
onToggle();
|
14376 |
+
}
|
14377 |
+
};
|
14378 |
|
14379 |
+
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
|
14380 |
+
showTooltip: true,
|
14381 |
+
onClick: onToggle,
|
14382 |
+
"aria-haspopup": "true",
|
14383 |
+
"aria-expanded": isOpen,
|
14384 |
+
onKeyDown: openOnArrowDown,
|
14385 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Apply duotone filter'),
|
14386 |
+
icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotoneSwatch, {
|
14387 |
+
values: value
|
14388 |
+
})
|
14389 |
+
});
|
14390 |
+
},
|
14391 |
+
renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
|
14392 |
+
label: (0,external_wp_i18n_namespaceObject.__)('Duotone')
|
14393 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotonePicker, {
|
14394 |
+
colorPalette: colorPalette,
|
14395 |
+
duotonePalette: duotonePalette,
|
14396 |
+
disableCustomColors: disableCustomColors,
|
14397 |
+
disableCustomDuotone: disableCustomDuotone,
|
14398 |
+
value: value,
|
14399 |
+
onChange: onChange
|
14400 |
+
}))
|
14401 |
+
});
|
14402 |
}
|
14403 |
|
14404 |
/* harmony default export */ var duotone_control = (DuotoneControl);
|
21101 |
|
21102 |
if (length < 2) {
|
21103 |
return;
|
21104 |
+
} // The block refs might not be immediately available
|
21105 |
+
// when dragging blocks into another block.
|
21106 |
+
|
21107 |
+
|
21108 |
+
if (!startRef.current || !endRef.current) {
|
21109 |
+
return;
|
21110 |
} // For some browsers, like Safari, it is important that focus happens
|
21111 |
// BEFORE selection.
|
21112 |
|
23413 |
* External dependencies
|
23414 |
*/
|
23415 |
|
23416 |
+
|
23417 |
+
|
23418 |
/**
|
23419 |
* WordPress dependencies
|
23420 |
*/
|
23426 |
|
23427 |
|
23428 |
const EDITOR_STYLES_SELECTOR = '.editor-styles-wrapper';
|
23429 |
+
k([names, a11y]);
|
23430 |
|
23431 |
function useDarkThemeBodyClassName(styles) {
|
23432 |
return (0,external_wp_element_namespaceObject.useCallback)(node => {
|
23455 |
body.removeChild(tempCanvas);
|
23456 |
} else {
|
23457 |
backgroundColor = defaultView.getComputedStyle(canvas, null).getPropertyValue('background-color');
|
23458 |
+
}
|
23459 |
|
23460 |
+
const colordBackgroundColor = w(backgroundColor); // If background is transparent, it should be treated as light color.
|
23461 |
|
23462 |
+
if (colordBackgroundColor.luminance() > 0.5 || colordBackgroundColor.alpha() === 0) {
|
23463 |
body.classList.remove('is-dark-theme');
|
23464 |
} else {
|
23465 |
body.classList.add('is-dark-theme');
|
23510 |
}] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
|
23511 |
const styles = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
23512 |
return select(store).getSettings().styles;
|
23513 |
+
}, []); // Initialize on render instead of module top level, to avoid circular dependency issues.
|
23514 |
|
23515 |
MemoizedBlockList = MemoizedBlockList || (0,external_wp_compose_namespaceObject.pure)(BlockList);
|
23516 |
const scale = containerWidth / viewportWidth;
|
24638 |
function InserterNoResults() {
|
24639 |
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
24640 |
className: "block-editor-inserter__no-results"
|
24641 |
+
}, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
|
24642 |
className: "block-editor-inserter__no-results-icon",
|
24643 |
icon: block_default
|
24644 |
}), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found.')));
|
25558 |
disabled,
|
25559 |
blockTitle,
|
25560 |
hasSingleBlockType,
|
25561 |
+
directInsertBlock,
|
25562 |
toggleProps,
|
25563 |
hasItems,
|
25564 |
renderToggle = defaultRenderToggle
|
25569 |
disabled: disabled || !hasItems,
|
25570 |
blockTitle,
|
25571 |
hasSingleBlockType,
|
25572 |
+
directInsertBlock,
|
25573 |
toggleProps
|
25574 |
});
|
25575 |
}
|
25623 |
const {
|
25624 |
position,
|
25625 |
hasSingleBlockType,
|
25626 |
+
directInsertBlock,
|
25627 |
insertOnlyAllowedBlock,
|
25628 |
__experimentalIsQuick: isQuick,
|
25629 |
onSelectOrClose
|
25630 |
} = this.props;
|
25631 |
|
25632 |
+
if (hasSingleBlockType || directInsertBlock !== null && directInsertBlock !== void 0 && directInsertBlock.length) {
|
25633 |
return this.renderToggle({
|
25634 |
onToggle: insertOnlyAllowedBlock
|
25635 |
});
|
25659 |
const {
|
25660 |
getBlockRootClientId,
|
25661 |
hasInserterItems,
|
25662 |
+
__experimentalGetAllowedBlocks,
|
25663 |
+
__experimentalGetDirectInsertBlock
|
25664 |
} = select(store);
|
25665 |
const {
|
25666 |
getBlockVariations
|
25669 |
|
25670 |
const allowedBlocks = __experimentalGetAllowedBlocks(rootClientId);
|
25671 |
|
25672 |
+
const directInsertBlock = __experimentalGetDirectInsertBlock(rootClientId);
|
25673 |
+
|
25674 |
const hasSingleBlockType = (0,external_lodash_namespaceObject.size)(allowedBlocks) === 1 && (0,external_lodash_namespaceObject.size)(getBlockVariations(allowedBlocks[0].name, 'inserter')) === 0;
|
25675 |
let allowedBlockType = false;
|
25676 |
|
25683 |
hasSingleBlockType,
|
25684 |
blockTitle: allowedBlockType ? allowedBlockType.title : '',
|
25685 |
allowedBlockType,
|
25686 |
+
directInsertBlock,
|
25687 |
rootClientId
|
25688 |
};
|
25689 |
}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, {
|
25697 |
isAppender,
|
25698 |
hasSingleBlockType,
|
25699 |
allowedBlockType,
|
25700 |
+
directInsertBlock,
|
25701 |
onSelectOrClose
|
25702 |
} = ownProps;
|
25703 |
|
25704 |
+
if (!hasSingleBlockType && !(directInsertBlock !== null && directInsertBlock !== void 0 && directInsertBlock.length)) {
|
25705 |
return;
|
25706 |
}
|
25707 |
|
25731 |
const {
|
25732 |
insertBlock
|
25733 |
} = dispatch(store);
|
25734 |
+
const blockToInsert = directInsertBlock !== null && directInsertBlock !== void 0 && directInsertBlock.length ? (0,external_wp_blocks_namespaceObject.createBlock)(...directInsertBlock) : (0,external_wp_blocks_namespaceObject.createBlock)(allowedBlockType.name);
|
25735 |
insertBlock(blockToInsert, getInsertionIndex(), rootClientId);
|
25736 |
|
25737 |
if (onSelectOrClose) {
|
25921 |
label: label
|
25922 |
}, !hasSingleBlockType && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
|
25923 |
as: "span"
|
25924 |
+
}, label), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
|
25925 |
icon: library_plus
|
25926 |
}));
|
25927 |
|
30384 |
* the block-editor store, then the store is updated with the new settings which
|
30385 |
* came from props.
|
30386 |
*
|
30387 |
+
* @param {string} clientId The client ID of the block to update.
|
30388 |
+
* @param {string[]} allowedBlocks An array of block names which are permitted
|
30389 |
+
* in inner blocks.
|
30390 |
+
* @param {?Array} __experimentalDefaultBlock The default block to insert: [ blockName, { blockAttributes } ].
|
30391 |
+
* @param {?Function|boolean} __experimentalDirectInsert If a default block should be inserted directly by the
|
30392 |
+
* appender.
|
30393 |
+
* @param {string} [templateLock] The template lock specified for the inner
|
30394 |
+
* blocks component. (e.g. "all")
|
30395 |
+
* @param {boolean} captureToolbars Whether or children toolbars should be shown
|
30396 |
+
* in the inner blocks component rather than on
|
30397 |
+
* the child block.
|
30398 |
+
* @param {string} orientation The direction in which the block
|
30399 |
+
* should face.
|
30400 |
+
* @param {Object} layout The layout object for the block container.
|
30401 |
*/
|
30402 |
|
30403 |
+
function useNestedSettingsUpdate(clientId, allowedBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout) {
|
30404 |
const {
|
30405 |
updateBlockListSettings
|
30406 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
30438 |
newSettings.orientation = layoutType.getOrientation(layout);
|
30439 |
}
|
30440 |
|
30441 |
+
if (__experimentalDefaultBlock !== undefined) {
|
30442 |
+
newSettings.__experimentalDefaultBlock = __experimentalDefaultBlock;
|
30443 |
+
}
|
30444 |
+
|
30445 |
+
if (__experimentalDirectInsert !== undefined) {
|
30446 |
+
newSettings.__experimentalDirectInsert = __experimentalDirectInsert;
|
30447 |
+
}
|
30448 |
+
|
30449 |
if (!external_wp_isShallowEqual_default()(blockListSettings, newSettings)) {
|
30450 |
updateBlockListSettings(clientId, newSettings);
|
30451 |
}
|
30452 |
+
}, [clientId, blockListSettings, _allowedBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, parentLock, captureToolbars, orientation, updateBlockListSettings, layout]);
|
30453 |
}
|
30454 |
//# sourceMappingURL=use-nested-settings-update.js.map
|
30455 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inner-blocks/use-inner-block-template-sync.js
|
30626 |
|
30627 |
if (dropType === 'inserter') {
|
30628 |
clearSelectedBlock();
|
30629 |
+
const blocksToInsert = blocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block));
|
30630 |
+
insertBlocks(blocksToInsert, targetBlockIndex, targetRootClientId, true, null);
|
30631 |
} // If the user is moving a block
|
30632 |
|
30633 |
|
31006 |
const {
|
31007 |
clientId,
|
31008 |
allowedBlocks,
|
31009 |
+
__experimentalDefaultBlock,
|
31010 |
+
__experimentalDirectInsert,
|
31011 |
template,
|
31012 |
templateLock,
|
31013 |
wrapperRef,
|
31019 |
placeholder,
|
31020 |
__experimentalLayout
|
31021 |
} = props;
|
31022 |
+
useNestedSettingsUpdate(clientId, allowedBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, __experimentalLayout);
|
31023 |
useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection);
|
31024 |
const context = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
31025 |
const block = select(store).getBlock(clientId);
|
31297 |
*/
|
31298 |
|
31299 |
|
31300 |
+
|
31301 |
/**
|
31302 |
* WordPress dependencies
|
31303 |
*/
|
31314 |
|
31315 |
|
31316 |
const duotone_EMPTY_ARRAY = [];
|
31317 |
+
k([names]);
|
31318 |
/**
|
31319 |
* Convert a list of colors to an object of R, G, and B values.
|
31320 |
*
|
31330 |
b: []
|
31331 |
};
|
31332 |
colors.forEach(color => {
|
31333 |
+
const rgbColor = w(color).toRgb();
|
31334 |
+
values.r.push(rgbColor.r / 255);
|
31335 |
+
values.g.push(rgbColor.g / 255);
|
31336 |
+
values.b.push(rgbColor.b / 255);
|
|
|
31337 |
});
|
31338 |
return values;
|
31339 |
}
|
31485 |
const hasDuotoneSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, 'color.__experimentalDuotone');
|
31486 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props), hasDuotoneSupport && (0,external_wp_element_namespaceObject.createElement)(DuotonePanel, props));
|
31487 |
}, 'withDuotoneControls');
|
31488 |
+
/**
|
31489 |
+
* Function that scopes a selector with another one. This works a bit like
|
31490 |
+
* SCSS nesting except the `&` operator isn't supported.
|
31491 |
+
*
|
31492 |
+
* @example
|
31493 |
+
* ```js
|
31494 |
+
* const scope = '.a, .b .c';
|
31495 |
+
* const selector = '> .x, .y';
|
31496 |
+
* const merged = scopeSelector( scope, selector );
|
31497 |
+
* // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'
|
31498 |
+
* ```
|
31499 |
+
*
|
31500 |
+
* @param {string} scope Selector to scope to.
|
31501 |
+
* @param {string} selector Original selector.
|
31502 |
+
*
|
31503 |
+
* @return {string} Scoped selector.
|
31504 |
+
*/
|
31505 |
+
|
31506 |
+
function scopeSelector(scope, selector) {
|
31507 |
+
const scopes = scope.split(',');
|
31508 |
+
const selectors = selector.split(',');
|
31509 |
+
const selectorsScoped = [];
|
31510 |
+
scopes.forEach(outer => {
|
31511 |
+
selectors.forEach(inner => {
|
31512 |
+
selectorsScoped.push(`${outer.trim()} ${inner.trim()}`);
|
31513 |
+
});
|
31514 |
+
});
|
31515 |
+
return selectorsScoped.join(', ');
|
31516 |
+
}
|
31517 |
/**
|
31518 |
* Override the default block element to include duotone styles.
|
31519 |
*
|
31522 |
* @return {Function} Wrapped component.
|
31523 |
*/
|
31524 |
|
31525 |
+
|
31526 |
const withDuotoneStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => {
|
31527 |
var _props$attributes, _props$attributes$sty, _props$attributes$sty2;
|
31528 |
|
31533 |
return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, props);
|
31534 |
}
|
31535 |
|
31536 |
+
const id = `wp-duotone-${(0,external_wp_compose_namespaceObject.useInstanceId)(BlockListBlock)}`; // Extra .editor-styles-wrapper specificity is needed in the editor
|
31537 |
+
// since we're not using inline styles to apply the filter. We need to
|
31538 |
+
// override duotone applied by global styles and theme.json.
|
31539 |
+
|
31540 |
+
const selectorsGroup = scopeSelector(`.editor-styles-wrapper .${id}`, duotoneSupport);
|
31541 |
const className = classnames_default()(props === null || props === void 0 ? void 0 : props.className, id);
|
31542 |
const element = (0,external_wp_element_namespaceObject.useContext)(BlockList.__unstableElementContext);
|
31543 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, element && (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)(DuotoneFilter, {
|
32607 |
return (0,external_wp_element_namespaceObject.useMemo)(() => {
|
32608 |
let filteredCompleters = completers;
|
32609 |
|
32610 |
+
if (name === (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() || (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, '__experimentalSlashInserter', false)) {
|
32611 |
filteredCompleters = filteredCompleters.concat([autocompleters_block]);
|
32612 |
}
|
32613 |
|
32841 |
className: "block-editor-block-breadcrumb__button",
|
32842 |
variant: "tertiary",
|
32843 |
onClick: clearSelectedBlock
|
32844 |
+
}, rootLabel), !hasSelection && rootLabel, !!clientId && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
|
32845 |
icon: chevron_right_small,
|
32846 |
className: "block-editor-block-breadcrumb__separator"
|
32847 |
})), parents.map(parentClientId => (0,external_wp_element_namespaceObject.createElement)("li", {
|
32852 |
onClick: () => selectBlock(parentClientId)
|
32853 |
}, (0,external_wp_element_namespaceObject.createElement)(BlockTitle, {
|
32854 |
clientId: parentClientId
|
32855 |
+
})), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
|
32856 |
icon: chevron_right_small,
|
32857 |
className: "block-editor-block-breadcrumb__separator"
|
32858 |
}))), !!clientId && (0,external_wp_element_namespaceObject.createElement)("li", {
|
33159 |
forceToggle: true
|
33160 |
}),
|
33161 |
"aria-hidden": "true"
|
33162 |
+
}, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
|
33163 |
icon: chevron_right_small
|
33164 |
}))
|
33165 |
);
|
37066 |
}
|
37067 |
|
37068 |
updateSuggestions(value = '') {
|
37069 |
+
var _value;
|
37070 |
+
|
37071 |
const {
|
37072 |
__experimentalFetchLinkSuggestions: fetchLinkSuggestions,
|
37073 |
__experimentalHandleURLSuggestions: handleURLSuggestions
|
37075 |
|
37076 |
if (!fetchLinkSuggestions) {
|
37077 |
return;
|
37078 |
+
} // Initial suggestions may only show if there is no value
|
37079 |
+
// (note: this includes whitespace).
|
37080 |
+
|
37081 |
|
37082 |
+
const isInitialSuggestions = !((_value = value) !== null && _value !== void 0 && _value.length); // Trim only now we've determined whether or not it originally had a "length"
|
37083 |
+
// (even if that value was all whitespace).
|
37084 |
+
|
37085 |
+
value = value.trim(); // Allow a suggestions request if:
|
37086 |
// - there are at least 2 characters in the search input (except manual searches where
|
37087 |
// search input length is not required to trigger a fetch)
|
37088 |
// - this is a direct entry (eg: a URL)
|
37145 |
this.props.onChange(inputValue);
|
37146 |
|
37147 |
if (!this.props.disableSuggestions) {
|
37148 |
+
this.updateSuggestions(inputValue);
|
37149 |
}
|
37150 |
}
|
37151 |
|
37161 |
|
37162 |
if (value && !disableSuggestions && !this.isUpdatingSuggestions && !(suggestions && suggestions.length)) {
|
37163 |
// Ensure the suggestions are updated with the current input value
|
37164 |
+
this.updateSuggestions(value);
|
37165 |
}
|
37166 |
}
|
37167 |
|
37211 |
case external_wp_keycodes_namespaceObject.ENTER:
|
37212 |
{
|
37213 |
if (this.props.onSubmit) {
|
37214 |
+
this.props.onSubmit(null, event);
|
37215 |
}
|
37216 |
|
37217 |
break;
|
37261 |
this.selectLink(suggestion);
|
37262 |
|
37263 |
if (this.props.onSubmit) {
|
37264 |
+
this.props.onSubmit(suggestion, event);
|
37265 |
}
|
37266 |
} else if (this.props.onSubmit) {
|
37267 |
+
this.props.onSubmit(null, event);
|
37268 |
}
|
37269 |
|
37270 |
break;
|
37493 |
'is-selected': isSelected
|
37494 |
}),
|
37495 |
onClick: onClick
|
37496 |
+
}), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
|
37497 |
className: "block-editor-link-control__search-item-icon",
|
37498 |
icon: library_plus
|
37499 |
}), (0,external_wp_element_namespaceObject.createElement)("span", {
|
37513 |
|
37514 |
const globe = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
37515 |
xmlns: "http://www.w3.org/2000/svg",
|
37516 |
+
viewBox: "0 0 24 24"
|
37517 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
37518 |
+
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"
|
37519 |
}));
|
37520 |
/* harmony default export */ var library_globe = (globe);
|
37521 |
//# sourceMappingURL=globe.js.map
|
37551 |
'is-url': isURL,
|
37552 |
'is-entity': !isURL
|
37553 |
})
|
37554 |
+
}), isURL && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
|
37555 |
className: "block-editor-link-control__search-item-icon",
|
37556 |
icon: library_globe
|
37557 |
}), (0,external_wp_element_namespaceObject.createElement)("span", {
|
37937 |
__experimentalFetchLinkSuggestions: searchHandler,
|
37938 |
__experimentalHandleURLSuggestions: true,
|
37939 |
__experimentalShowInitialSuggestions: showInitialSuggestions,
|
37940 |
+
onSubmit: (suggestion, event) => {
|
37941 |
+
var _value$trim;
|
37942 |
+
|
37943 |
+
const hasSuggestion = suggestion || focusedSuggestion; // If there is no suggestion and the value (ie: any manually entered URL) is empty
|
37944 |
+
// then don't allow submission otherwise we get empty links.
|
37945 |
+
|
37946 |
+
if (!hasSuggestion && !(value !== null && value !== void 0 && (_value$trim = value.trim()) !== null && _value$trim !== void 0 && _value$trim.length)) {
|
37947 |
+
event.preventDefault();
|
37948 |
+
} else {
|
37949 |
+
onSuggestionSelected(hasSuggestion || {
|
37950 |
+
url: value
|
37951 |
+
});
|
37952 |
+
}
|
37953 |
},
|
37954 |
ref: ref
|
37955 |
}), children);
|
37956 |
});
|
37957 |
/* harmony default export */ var search_input = (LinkControlSearchInput);
|
37958 |
//# sourceMappingURL=search-input.js.map
|
37959 |
+
;// CONCATENATED MODULE: ./packages/icons/build-module/library/info.js
|
37960 |
+
|
37961 |
+
|
37962 |
+
/**
|
37963 |
+
* WordPress dependencies
|
37964 |
+
*/
|
37965 |
+
|
37966 |
+
const info = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
|
37967 |
+
xmlns: "http://www.w3.org/2000/svg",
|
37968 |
+
viewBox: "0 0 24 24"
|
37969 |
+
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
|
37970 |
+
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"
|
37971 |
+
}));
|
37972 |
+
/* harmony default export */ var library_info = (info);
|
37973 |
+
//# sourceMappingURL=info.js.map
|
37974 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/link-control/viewer-slot.js
|
37975 |
/**
|
37976 |
* WordPress dependencies
|
38105 |
|
38106 |
const hasRichData = richData && Object.keys(richData).length;
|
38107 |
const displayURL = value && (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(value.url), 16) || '';
|
38108 |
+
const isEmptyURL = !value.url.length;
|
38109 |
+
let icon;
|
38110 |
+
|
38111 |
+
if (richData !== null && richData !== void 0 && richData.icon) {
|
38112 |
+
icon = (0,external_wp_element_namespaceObject.createElement)("img", {
|
38113 |
+
src: richData === null || richData === void 0 ? void 0 : richData.icon,
|
38114 |
+
alt: ""
|
38115 |
+
});
|
38116 |
+
} else if (isEmptyURL) {
|
38117 |
+
icon = (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
|
38118 |
+
icon: library_info,
|
38119 |
+
size: 32
|
38120 |
+
});
|
38121 |
+
} else {
|
38122 |
+
icon = (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
|
38123 |
+
icon: library_globe
|
38124 |
+
});
|
38125 |
+
}
|
38126 |
+
|
38127 |
return (0,external_wp_element_namespaceObject.createElement)("div", {
|
38128 |
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Currently selected'),
|
38129 |
"aria-selected": "true",
|
38131 |
'is-current': true,
|
38132 |
'is-rich': hasRichData,
|
38133 |
'is-fetching': !!isFetching,
|
38134 |
+
'is-preview': true,
|
38135 |
+
'is-error': isEmptyURL
|
38136 |
})
|
38137 |
}, (0,external_wp_element_namespaceObject.createElement)("div", {
|
38138 |
className: "block-editor-link-control__search-item-top"
|
38142 |
className: classnames_default()('block-editor-link-control__search-item-icon', {
|
38143 |
'is-image': richData === null || richData === void 0 ? void 0 : richData.icon
|
38144 |
})
|
38145 |
+
}, icon), (0,external_wp_element_namespaceObject.createElement)("span", {
|
|
|
|
|
|
|
|
|
|
|
38146 |
className: "block-editor-link-control__search-item-details"
|
38147 |
+
}, !isEmptyURL ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
|
38148 |
className: "block-editor-link-control__search-item-title",
|
38149 |
href: value.url
|
38150 |
}, (richData === null || richData === void 0 ? void 0 : richData.title) || (value === null || value === void 0 ? void 0 : value.title) || displayURL), (value === null || value === void 0 ? void 0 : value.url) && (0,external_wp_element_namespaceObject.createElement)("span", {
|
38151 |
className: "block-editor-link-control__search-item-info"
|
38152 |
+
}, displayURL)) : (0,external_wp_element_namespaceObject.createElement)("span", {
|
38153 |
+
className: "block-editor-link-control__search-item-error-notice"
|
38154 |
+
}, "Link is empty"))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
|
38155 |
variant: "secondary",
|
38156 |
onClick: () => onEditClick(),
|
38157 |
className: "block-editor-link-control__search-item-action"
|
38384 |
createSuggestionButtonText,
|
38385 |
hasRichPreviews = false
|
38386 |
}) {
|
38387 |
+
var _currentInputValue$tr;
|
38388 |
+
|
38389 |
if (withCreateSuggestion === undefined && createSuggestion) {
|
38390 |
withCreateSuggestion = true;
|
38391 |
}
|
38396 |
const currentInputValue = propInputValue || internalInputValue;
|
38397 |
const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(forceIsEditingLink !== undefined ? forceIsEditingLink : !value || !value.url);
|
38398 |
const isEndingEditWithFocus = (0,external_wp_element_namespaceObject.useRef)(false);
|
38399 |
+
const currentInputIsEmpty = !(currentInputValue !== null && currentInputValue !== void 0 && (_currentInputValue$tr = currentInputValue.trim()) !== null && _currentInputValue$tr !== void 0 && _currentInputValue$tr.length);
|
38400 |
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
38401 |
if (forceIsEditingLink !== undefined && forceIsEditingLink !== isEditingLink) {
|
38402 |
setIsEditingLink(forceIsEditingLink);
|
38481 |
keyCode
|
38482 |
} = event;
|
38483 |
|
38484 |
+
if (keyCode === external_wp_keycodes_namespaceObject.ENTER && !currentInputIsEmpty // disallow submitting empty values.
|
38485 |
+
) {
|
38486 |
+
event.preventDefault();
|
38487 |
+
handleSubmitButton();
|
38488 |
+
}
|
38489 |
},
|
38490 |
label: (0,external_wp_i18n_namespaceObject.__)('Submit'),
|
38491 |
icon: keyboard_return,
|
38492 |
+
className: "block-editor-link-control__search-submit",
|
38493 |
+
disabled: currentInputIsEmpty // disallow submitting empty values.
|
38494 |
+
|
38495 |
})))), errorMessage && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
|
38496 |
className: "block-editor-link-control__search-error",
|
38497 |
status: "error",
|
38895 |
|
38896 |
|
38897 |
|
38898 |
+
/** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */
|
38899 |
+
|
38900 |
+
/**
|
38901 |
+
* Replaces line separators with line breaks if not multiline.
|
38902 |
+
* Replaces line breaks with line separators if multiline.
|
38903 |
+
*
|
38904 |
+
* @param {RichTextValue} value Value to adjust.
|
38905 |
+
* @param {boolean} isMultiline Whether to adjust to multiline or not.
|
38906 |
+
*
|
38907 |
+
* @return {RichTextValue} Adjusted value.
|
38908 |
+
*/
|
38909 |
+
|
38910 |
+
function adjustLines(value, isMultiline) {
|
38911 |
+
if (isMultiline) {
|
38912 |
+
return (0,external_wp_richText_namespaceObject.replace)(value, /\n+/g, external_wp_richText_namespaceObject.__UNSTABLE_LINE_SEPARATOR);
|
38913 |
+
}
|
38914 |
+
|
38915 |
+
return (0,external_wp_richText_namespaceObject.replace)(value, new RegExp(external_wp_richText_namespaceObject.__UNSTABLE_LINE_SEPARATOR, 'g'), '\n');
|
38916 |
+
}
|
38917 |
+
|
38918 |
function usePasteHandler(props) {
|
38919 |
const propsRef = (0,external_wp_element_namespaceObject.useRef)(props);
|
38920 |
propsRef.current = props;
|
39000 |
// pasted content and remove inline styles.
|
39001 |
|
39002 |
if (isInternal) {
|
39003 |
+
const pastedMultilineTag = clipboardData.getData('rich-text-multi-line-tag') || undefined;
|
39004 |
+
let pastedValue = (0,external_wp_richText_namespaceObject.create)({
|
39005 |
html,
|
39006 |
+
multilineTag: pastedMultilineTag,
|
39007 |
+
multilineWrapperTags: pastedMultilineTag === 'li' ? ['ul', 'ol'] : undefined,
|
39008 |
preserveWhiteSpace
|
39009 |
});
|
39010 |
+
pastedValue = adjustLines(pastedValue, !!multilineTag);
|
39011 |
addActiveFormats(pastedValue, value.activeFormats);
|
39012 |
onChange((0,external_wp_richText_namespaceObject.insert)(value, pastedValue));
|
39013 |
return;
|
39073 |
if (typeof content === 'string') {
|
39074 |
let valueToInsert = (0,external_wp_richText_namespaceObject.create)({
|
39075 |
html: content
|
39076 |
+
}); // If the content should be multiline, we should process text
|
|
|
39077 |
// separated by a line break as separate lines.
|
39078 |
|
39079 |
+
valueToInsert = adjustLines(valueToInsert, !!multilineTag);
|
39080 |
+
addActiveFormats(valueToInsert, value.activeFormats);
|
|
|
|
|
39081 |
onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert));
|
39082 |
} else if (content.length > 0) {
|
39083 |
if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) {
|
41197 |
onSelect: onSwitchMode,
|
41198 |
choices: [{
|
41199 |
value: 'edit',
|
41200 |
+
label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
|
41201 |
icon: library_edit
|
41202 |
}), (0,external_wp_i18n_namespaceObject.__)('Edit'))
|
41203 |
}, {
|
41375 |
const LINK_DESTINATION_MEDIA = 'media';
|
41376 |
const LINK_DESTINATION_ATTACHMENT = 'attachment';
|
41377 |
const NEW_TAB_REL = ['noreferrer', 'noopener'];
|
41378 |
+
const icon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
|
41379 |
viewBox: "0 0 24 24",
|
41380 |
xmlns: "http://www.w3.org/2000/svg"
|
41381 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
|
41508 |
linkDestination: LINK_DESTINATION_MEDIA,
|
41509 |
title: (0,external_wp_i18n_namespaceObject.__)('Media File'),
|
41510 |
url: mediaType === 'image' ? mediaUrl : undefined,
|
41511 |
+
icon
|
41512 |
}];
|
41513 |
|
41514 |
if (mediaType === 'image' && mediaLink) {
|
42408 |
|
42409 |
|
42410 |
function useMouseMoveTypingReset() {
|
42411 |
+
const isTyping = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isTyping(), []);
|
42412 |
const {
|
42413 |
stopTyping
|
42414 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
|
42625 |
const arrowKeyCodes = new Set([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT]);
|
42626 |
const initialTriggerPercentage = 0.75;
|
42627 |
function useTypewriter() {
|
42628 |
+
const hasSelectedBlock = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).hasSelectedBlock(), []);
|
42629 |
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
|
42630 |
if (!hasSelectedBlock) {
|
42631 |
return;
|
43123 |
return gradients;
|
43124 |
}
|
43125 |
//# sourceMappingURL=theme.js.map
|
43126 |
+
;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/parse-css-unit-to-px.js
|
43127 |
+
/**
|
43128 |
+
* Converts string to object { value, unit }.
|
43129 |
+
*
|
43130 |
+
* @param {string} cssUnit
|
43131 |
+
* @return {Object} parsedUnit
|
43132 |
+
*/
|
43133 |
+
function parseUnit(cssUnit) {
|
43134 |
+
const match = cssUnit === null || cssUnit === void 0 ? void 0 : cssUnit.trim().match(/^(0?[-.]?\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/);
|
43135 |
+
|
43136 |
+
if (!isNaN(cssUnit) && !isNaN(parseFloat(cssUnit))) {
|
43137 |
+
return {
|
43138 |
+
value: parseFloat(cssUnit),
|
43139 |
+
unit: 'px'
|
43140 |
+
};
|
43141 |
+
}
|
43142 |
+
|
43143 |
+
return match ? {
|
43144 |
+
value: parseFloat(match[1]) || match[1],
|
43145 |
+
unit: match[2]
|
43146 |
+
} : {
|
43147 |
+
value: cssUnit,
|
43148 |
+
unit: undefined
|
43149 |
+
};
|
43150 |
+
}
|
43151 |
+
/**
|
43152 |
+
* Evaluate a math expression.
|
43153 |
+
*
|
43154 |
+
* @param {string} expression
|
43155 |
+
* @return {number} evaluated expression.
|
43156 |
+
*/
|
43157 |
+
|
43158 |
+
|
43159 |
+
function calculate(expression) {
|
43160 |
+
return Function(`'use strict'; return (${expression})`)();
|
43161 |
+
}
|
43162 |
+
/**
|
43163 |
+
* Calculates the css function value for the supported css functions such as max, min, clamp and calc.
|
43164 |
+
*
|
43165 |
+
* @param {string} functionUnitValue string should be in a particular format (for example min(12px,12px) ) no nested loops.
|
43166 |
+
* @param {Object} options
|
43167 |
+
* @return {string} unit containing the unit in PX.
|
43168 |
+
*/
|
43169 |
+
|
43170 |
+
|
43171 |
+
function getFunctionUnitValue(functionUnitValue, options) {
|
43172 |
+
const functionUnit = functionUnitValue.split(/[(),]/g).filter(Boolean);
|
43173 |
+
const units = functionUnit.slice(1).map(unit => parseUnit(getPxFromCssUnit(unit, options)).value).filter(Boolean);
|
43174 |
+
|
43175 |
+
switch (functionUnit[0]) {
|
43176 |
+
case 'min':
|
43177 |
+
return Math.min(...units) + 'px';
|
43178 |
+
|
43179 |
+
case 'max':
|
43180 |
+
return Math.max(...units) + 'px';
|
43181 |
+
|
43182 |
+
case 'clamp':
|
43183 |
+
if (units.length !== 3) {
|
43184 |
+
return null;
|
43185 |
+
}
|
43186 |
+
|
43187 |
+
if (units[1] < units[0]) {
|
43188 |
+
return units[0] + 'px';
|
43189 |
+
}
|
43190 |
+
|
43191 |
+
if (units[1] > units[2]) {
|
43192 |
+
return units[2] + 'px';
|
43193 |
+
}
|
43194 |
+
|
43195 |
+
return units[1] + 'px';
|
43196 |
+
|
43197 |
+
case 'calc':
|
43198 |
+
return units[0] + 'px';
|
43199 |
+
}
|
43200 |
+
}
|
43201 |
+
/**
|
43202 |
+
* Take a css function such as min, max, calc, clamp and returns parsedUnit
|
43203 |
+
*
|
43204 |
+
* How this works for the nested function is that it first replaces the inner function call.
|
43205 |
+
* Then it tackles the outer onces.
|
43206 |
+
* So for example: min( max(25px, 35px), 40px )
|
43207 |
+
* in the first pass we would replace max(25px, 35px) with 35px.
|
43208 |
+
* then we would try to evaluate min( 35px, 40px )
|
43209 |
+
* and then finally return 35px.
|
43210 |
+
*
|
43211 |
+
* @param {string} cssUnit
|
43212 |
+
* @return {Object} parsedUnit object.
|
43213 |
+
*/
|
43214 |
+
|
43215 |
+
|
43216 |
+
function parseUnitFunction(cssUnit) {
|
43217 |
+
while (true) {
|
43218 |
+
const currentCssUnit = cssUnit;
|
43219 |
+
const regExp = /(max|min|calc|clamp)\(([^()]*)\)/g;
|
43220 |
+
const matches = regExp.exec(cssUnit) || [];
|
43221 |
+
|
43222 |
+
if (matches[0]) {
|
43223 |
+
const functionUnitValue = getFunctionUnitValue(matches[0]);
|
43224 |
+
cssUnit = cssUnit.replace(matches[0], functionUnitValue);
|
43225 |
+
} // if the unit hasn't been modified or we have a single value break free.
|
43226 |
+
|
43227 |
+
|
43228 |
+
if (cssUnit === currentCssUnit || parseFloat(cssUnit)) {
|
43229 |
+
break;
|
43230 |
+
}
|
43231 |
+
}
|
43232 |
+
|
43233 |
+
return parseUnit(cssUnit);
|
43234 |
+
}
|
43235 |
+
/**
|
43236 |
+
* Return true if we think this is a math expression.
|
43237 |
+
*
|
43238 |
+
* @param {string} cssUnit the cssUnit value being evaluted.
|
43239 |
+
* @return {boolean} Whether the cssUnit is a math expression.
|
43240 |
+
*/
|
43241 |
+
|
43242 |
+
|
43243 |
+
function isMathExpression(cssUnit) {
|
43244 |
+
for (let i = 0; i < cssUnit.length; i++) {
|
43245 |
+
if (['+', '-', '/', '*'].includes(cssUnit[i])) {
|
43246 |
+
return true;
|
43247 |
+
}
|
43248 |
+
}
|
43249 |
+
|
43250 |
+
return false;
|
43251 |
+
}
|
43252 |
+
/**
|
43253 |
+
* Evaluates the math expression and return a px value.
|
43254 |
+
*
|
43255 |
+
* @param {string} cssUnit the cssUnit value being evaluted.
|
43256 |
+
* @return {string} return a converfted value to px.
|
43257 |
+
*/
|
43258 |
+
|
43259 |
+
|
43260 |
+
function evalMathExpression(cssUnit) {
|
43261 |
+
let errorFound = false; // Convert every part of the expression to px values.
|
43262 |
+
|
43263 |
+
const cssUnitsBits = cssUnit.split(/[+-/*/]/g).filter(Boolean);
|
43264 |
+
|
43265 |
+
for (const unit of cssUnitsBits) {
|
43266 |
+
// Standardize the unit to px and extract the value.
|
43267 |
+
const parsedUnit = parseUnit(getPxFromCssUnit(unit));
|
43268 |
+
|
43269 |
+
if (!parseFloat(parsedUnit.value)) {
|
43270 |
+
errorFound = true; // end early since we are dealing with a null value.
|
43271 |
+
|
43272 |
+
break;
|
43273 |
+
}
|
43274 |
+
|
43275 |
+
cssUnit = cssUnit.replace(unit, parsedUnit.value);
|
43276 |
+
}
|
43277 |
+
|
43278 |
+
return errorFound ? null : calculate(cssUnit).toFixed(0) + 'px';
|
43279 |
+
}
|
43280 |
+
/**
|
43281 |
+
* Convert a parsedUnit object to px value.
|
43282 |
+
*
|
43283 |
+
* @param {Object} parsedUnit
|
43284 |
+
* @param {Object} options
|
43285 |
+
* @return {string} or {null} returns the converted with in a px value format.
|
43286 |
+
*/
|
43287 |
+
|
43288 |
+
|
43289 |
+
function convertParsedUnitToPx(parsedUnit, options) {
|
43290 |
+
const PIXELS_PER_INCH = 96;
|
43291 |
+
const ONE_PERCENT = 0.01;
|
43292 |
+
const defaultProperties = {
|
43293 |
+
fontSize: 16,
|
43294 |
+
lineHeight: 16,
|
43295 |
+
width: 375,
|
43296 |
+
height: 812,
|
43297 |
+
type: 'font'
|
43298 |
+
};
|
43299 |
+
const setOptions = Object.assign({}, defaultProperties, options);
|
43300 |
+
const relativeUnits = {
|
43301 |
+
em: setOptions.fontSize,
|
43302 |
+
rem: setOptions.fontSize,
|
43303 |
+
vh: setOptions.height * ONE_PERCENT,
|
43304 |
+
vw: setOptions.width * ONE_PERCENT,
|
43305 |
+
vmin: (setOptions.width < setOptions.height ? setOptions.width : setOptions.height) * ONE_PERCENT,
|
43306 |
+
vmax: (setOptions.width > setOptions.height ? setOptions.width : setOptions.height) * ONE_PERCENT,
|
43307 |
+
'%': (setOptions.type === 'font' ? setOptions.fontSize : setOptions.width) * ONE_PERCENT,
|
43308 |
+
ch: 8,
|
43309 |
+
// The advance measure (width) of the glyph "0" of the element's font. Approximate
|
43310 |
+
ex: 7.15625,
|
43311 |
+
// x-height of the element's font. Approximate
|
43312 |
+
lh: setOptions.lineHeight
|
43313 |
+
};
|
43314 |
+
const absoluteUnits = {
|
43315 |
+
in: PIXELS_PER_INCH,
|
43316 |
+
cm: PIXELS_PER_INCH / 2.54,
|
43317 |
+
mm: PIXELS_PER_INCH / 25.4,
|
43318 |
+
pt: PIXELS_PER_INCH / 72,
|
43319 |
+
pc: PIXELS_PER_INCH / 6,
|
43320 |
+
px: 1,
|
43321 |
+
Q: PIXELS_PER_INCH / 2.54 / 40
|
43322 |
+
};
|
43323 |
+
|
43324 |
+
if (relativeUnits[parsedUnit.unit]) {
|
43325 |
+
return (relativeUnits[parsedUnit.unit] * parsedUnit.value).toFixed(0) + 'px';
|
43326 |
+
}
|
43327 |
+
|
43328 |
+
if (absoluteUnits[parsedUnit.unit]) {
|
43329 |
+
return (absoluteUnits[parsedUnit.unit] * parsedUnit.value).toFixed(0) + 'px';
|
43330 |
+
}
|
43331 |
+
|
43332 |
+
return null;
|
43333 |
+
}
|
43334 |
+
/**
|
43335 |
+
* Returns the px value of a cssUnit.
|
43336 |
+
*
|
43337 |
+
* @param {string} cssUnit
|
43338 |
+
* @param {Object} options
|
43339 |
+
* @return {string} returns the cssUnit value in a simple px format.
|
43340 |
+
*/
|
43341 |
+
|
43342 |
+
|
43343 |
+
function getPxFromCssUnit(cssUnit, options = {}) {
|
43344 |
+
if (Number.isFinite(cssUnit)) {
|
43345 |
+
return cssUnit.toFixed(0) + 'px';
|
43346 |
+
}
|
43347 |
+
|
43348 |
+
if (cssUnit === undefined) {
|
43349 |
+
return null;
|
43350 |
+
}
|
43351 |
+
|
43352 |
+
let parsedUnit = parseUnit(cssUnit);
|
43353 |
+
|
43354 |
+
if (!parsedUnit.unit) {
|
43355 |
+
parsedUnit = parseUnitFunction(cssUnit, options);
|
43356 |
+
}
|
43357 |
+
|
43358 |
+
if (isMathExpression(cssUnit) && !parsedUnit.unit) {
|
43359 |
+
return evalMathExpression(cssUnit);
|
43360 |
+
}
|
43361 |
+
|
43362 |
+
return convertParsedUnitToPx(parsedUnit, options);
|
43363 |
+
} // Use simple cache.
|
43364 |
+
|
43365 |
+
const cache = {};
|
43366 |
+
/**
|
43367 |
+
* Returns the px value of a cssUnit. The memoized version of getPxFromCssUnit;
|
43368 |
+
*
|
43369 |
+
* @param {string} cssUnit
|
43370 |
+
* @param {Object} options
|
43371 |
+
* @return {string} returns the cssUnit value in a simple px format.
|
43372 |
+
*/
|
43373 |
+
|
43374 |
+
function memoizedGetPxFromCssUnit(cssUnit, options = {}) {
|
43375 |
+
const hash = cssUnit + hashOptions(options);
|
43376 |
+
|
43377 |
+
if (!cache[hash]) {
|
43378 |
+
cache[hash] = getPxFromCssUnit(cssUnit, options);
|
43379 |
+
}
|
43380 |
+
|
43381 |
+
return cache[hash];
|
43382 |
+
}
|
43383 |
+
|
43384 |
+
function hashOptions(options) {
|
43385 |
+
let hash = '';
|
43386 |
+
|
43387 |
+
if (options.hasOwnProperty('fontSize')) {
|
43388 |
+
hash = ':' + options.width;
|
43389 |
+
}
|
43390 |
+
|
43391 |
+
if (options.hasOwnProperty('lineHeight')) {
|
43392 |
+
hash = ':' + options.lineHeight;
|
43393 |
+
}
|
43394 |
+
|
43395 |
+
if (options.hasOwnProperty('width')) {
|
43396 |
+
hash = ':' + options.width;
|
43397 |
+
}
|
43398 |
+
|
43399 |
+
if (options.hasOwnProperty('height')) {
|
43400 |
+
hash = ':' + options.height;
|
43401 |
+
}
|
43402 |
+
|
43403 |
+
if (options.hasOwnProperty('type')) {
|
43404 |
+
hash = ':' + options.type;
|
43405 |
+
}
|
43406 |
+
|
43407 |
+
return hash;
|
43408 |
+
}
|
43409 |
+
|
43410 |
+
/* harmony default export */ var parse_css_unit_to_px = (memoizedGetPxFromCssUnit);
|
43411 |
+
//# sourceMappingURL=parse-css-unit-to-px.js.map
|
43412 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/index.js
|
43413 |
|
43414 |
|
43415 |
|
43416 |
+
|
43417 |
//# sourceMappingURL=index.js.map
|
43418 |
;// CONCATENATED MODULE: ./packages/block-editor/build-module/index.js
|
43419 |
/**
|
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' => 'cf2179be9f84b3928222c018ef71c696');
|
build/block-editor/index.min.js
CHANGED
@@ -1,84 +1,88 @@
|
|
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),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+g-(S.left+w)+d,top:f.top+h-(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+g-(b.left+k+(parseFloat(o.css(t,"borderRightWidth"))||0))+d,top:f.top+h-(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 h(e){return null!=e&&e==e.window}var g={};function b(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 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);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},7621:function(e,t,n){var o;!function(r){var l=/^\s+/,i=/\s+$/,s=0,a=r.round,c=r.min,u=r.max,d=r.random;function p(e,t){if(t=t||{},(e=e||"")instanceof p)return e;if(!(this instanceof p))return new p(e,t);var n=function(e){var t,n,o,s={r:0,g:0,b:0},a=1,d=null,p=null,m=null,f=!1,h=!1;return"string"==typeof e&&(e=function(e){e=e.replace(l,"").replace(i,"").toLowerCase();var t,n=!1;if(N[e])e=N[e],n=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};return(t=G.rgb.exec(e))?{r:t[1],g:t[2],b:t[3]}:(t=G.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=G.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=G.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=G.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=G.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=G.hex8.exec(e))?{r:A(t[1]),g:A(t[2]),b:A(t[3]),a:z(t[4]),format:n?"name":"hex8"}:(t=G.hex6.exec(e))?{r:A(t[1]),g:A(t[2]),b:A(t[3]),format:n?"name":"hex"}:(t=G.hex4.exec(e))?{r:A(t[1]+""+t[1]),g:A(t[2]+""+t[2]),b:A(t[3]+""+t[3]),a:z(t[4]+""+t[4]),format:n?"name":"hex8"}:!!(t=G.hex3.exec(e))&&{r:A(t[1]+""+t[1]),g:A(t[2]+""+t[2]),b:A(t[3]+""+t[3]),format:n?"name":"hex"}}(e)),"object"==typeof e&&(W(e.r)&&W(e.g)&&W(e.b)?(t=e.r,n=e.g,o=e.b,s={r:255*L(t,255),g:255*L(n,255),b:255*L(o,255)},f=!0,h="%"===String(e.r).substr(-1)?"prgb":"rgb"):W(e.h)&&W(e.s)&&W(e.v)?(d=O(e.s),p=O(e.v),s=function(e,t,n){e=6*L(e,360),t=L(t,100),n=L(n,100);var o=r.floor(e),l=e-o,i=n*(1-t),s=n*(1-l*t),a=n*(1-(1-l)*t),c=o%6;return{r:255*[n,s,i,i,a,n][c],g:255*[a,n,n,s,i,i][c],b:255*[i,i,a,n,n,s][c]}}(e.h,d,p),f=!0,h="hsv"):W(e.h)&&W(e.s)&&W(e.l)&&(d=O(e.s),m=O(e.l),s=function(e,t,n){var o,r,l;function i(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}if(e=L(e,360),t=L(t,100),n=L(n,100),0===t)o=r=l=n;else{var s=n<.5?n*(1+t):n+t-n*t,a=2*n-s;o=i(a,s,e+1/3),r=i(a,s,e),l=i(a,s,e-1/3)}return{r:255*o,g:255*r,b:255*l}}(e.h,d,m),f=!0,h="hsl"),e.hasOwnProperty("a")&&(a=e.a)),a=R(a),{ok:f,format:e.format||h,r:c(255,u(s.r,0)),g:c(255,u(s.g,0)),b:c(255,u(s.b,0)),a:a}}(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=a(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=a(this._r)),this._g<1&&(this._g=a(this._g)),this._b<1&&(this._b=a(this._b)),this._ok=n.ok,this._tc_id=s++}function m(e,t,n){e=L(e,255),t=L(t,255),n=L(n,255);var o,r,l=u(e,t,n),i=c(e,t,n),s=(l+i)/2;if(l==i)o=r=0;else{var a=l-i;switch(r=s>.5?a/(2-l-i):a/(l+i),l){case e:o=(t-n)/a+(t<n?6:0);break;case t:o=(n-e)/a+2;break;case n:o=(e-t)/a+4}o/=6}return{h:o,s:r,l:s}}function f(e,t,n){e=L(e,255),t=L(t,255),n=L(n,255);var o,r,l=u(e,t,n),i=c(e,t,n),s=l,a=l-i;if(r=0===l?0:a/l,l==i)o=0;else{switch(l){case e:o=(t-n)/a+(t<n?6:0);break;case t:o=(n-e)/a+2;break;case n:o=(e-t)/a+4}o/=6}return{h:o,s:r,v:s}}function h(e,t,n,o){var r=[D(a(e).toString(16)),D(a(t).toString(16)),D(a(n).toString(16))];return o&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function g(e,t,n,o){return[D(F(o)),D(a(e).toString(16)),D(a(t).toString(16)),D(a(n).toString(16))].join("")}function b(e,t){t=0===t?0:t||10;var n=p(e).toHsl();return n.s-=t/100,n.s=M(n.s),p(n)}function v(e,t){t=0===t?0:t||10;var n=p(e).toHsl();return n.s+=t/100,n.s=M(n.s),p(n)}function k(e){return p(e).desaturate(100)}function _(e,t){t=0===t?0:t||10;var n=p(e).toHsl();return n.l+=t/100,n.l=M(n.l),p(n)}function y(e,t){t=0===t?0:t||10;var n=p(e).toRgb();return n.r=u(0,c(255,n.r-a(-t/100*255))),n.g=u(0,c(255,n.g-a(-t/100*255))),n.b=u(0,c(255,n.b-a(-t/100*255))),p(n)}function E(e,t){t=0===t?0:t||10;var n=p(e).toHsl();return n.l-=t/100,n.l=M(n.l),p(n)}function C(e,t){var n=p(e).toHsl(),o=(n.h+t)%360;return n.h=o<0?360+o:o,p(n)}function S(e){var t=p(e).toHsl();return t.h=(t.h+180)%360,p(t)}function w(e){var t=p(e).toHsl(),n=t.h;return[p(e),p({h:(n+120)%360,s:t.s,l:t.l}),p({h:(n+240)%360,s:t.s,l:t.l})]}function B(e){var t=p(e).toHsl(),n=t.h;return[p(e),p({h:(n+90)%360,s:t.s,l:t.l}),p({h:(n+180)%360,s:t.s,l:t.l}),p({h:(n+270)%360,s:t.s,l:t.l})]}function I(e){var t=p(e).toHsl(),n=t.h;return[p(e),p({h:(n+72)%360,s:t.s,l:t.l}),p({h:(n+216)%360,s:t.s,l:t.l})]}function x(e,t,n){t=t||6,n=n||30;var o=p(e).toHsl(),r=360/n,l=[p(e)];for(o.h=(o.h-(r*t>>1)+720)%360;--t;)o.h=(o.h+r)%360,l.push(p(o));return l}function T(e,t){t=t||6;for(var n=p(e).toHsv(),o=n.h,r=n.s,l=n.v,i=[],s=1/t;t--;)i.push(p({h:o,s:r,v:l})),l=(l+s)%1;return i}p.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,n,o=this.toRgb();return e=o.r/255,t=o.g/255,n=o.b/255,.2126*(e<=.03928?e/12.92:r.pow((e+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:r.pow((t+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:r.pow((n+.055)/1.055,2.4))},setAlpha:function(e){return this._a=R(e),this._roundA=a(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=a(360*e.h),n=a(100*e.s),o=a(100*e.v);return 1==this._a?"hsv("+t+", "+n+"%, "+o+"%)":"hsva("+t+", "+n+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var e=m(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=m(this._r,this._g,this._b),t=a(360*e.h),n=a(100*e.s),o=a(100*e.l);return 1==this._a?"hsl("+t+", "+n+"%, "+o+"%)":"hsla("+t+", "+n+"%, "+o+"%, "+this._roundA+")"},toHex:function(e){return h(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,n,o,r){var l=[D(a(e).toString(16)),D(a(t).toString(16)),D(a(n).toString(16)),D(F(o))];return r&&l[0].charAt(0)==l[0].charAt(1)&&l[1].charAt(0)==l[1].charAt(1)&&l[2].charAt(0)==l[2].charAt(1)&&l[3].charAt(0)==l[3].charAt(1)?l[0].charAt(0)+l[1].charAt(0)+l[2].charAt(0)+l[3].charAt(0):l.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:a(this._r),g:a(this._g),b:a(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+a(this._r)+", "+a(this._g)+", "+a(this._b)+")":"rgba("+a(this._r)+", "+a(this._g)+", "+a(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:a(100*L(this._r,255))+"%",g:a(100*L(this._g,255))+"%",b:a(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+a(100*L(this._r,255))+"%, "+a(100*L(this._g,255))+"%, "+a(100*L(this._b,255))+"%)":"rgba("+a(100*L(this._r,255))+"%, "+a(100*L(this._g,255))+"%, "+a(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(P[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+g(this._r,this._g,this._b,this._a),n=t,o=this._gradientType?"GradientType = 1, ":"";if(e){var r=p(e);n="#"+g(r._r,r._g,r._b,r._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,o=this._a<1&&this._a>=0;return t||!o||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return p(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(_,arguments)},brighten:function(){return this._applyModification(y,arguments)},darken:function(){return this._applyModification(E,arguments)},desaturate:function(){return this._applyModification(b,arguments)},saturate:function(){return this._applyModification(v,arguments)},greyscale:function(){return this._applyModification(k,arguments)},spin:function(){return this._applyModification(C,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(x,arguments)},complement:function(){return this._applyCombination(S,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(I,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(B,arguments)}},p.fromRatio=function(e,t){if("object"==typeof e){var n={};for(var o in e)e.hasOwnProperty(o)&&(n[o]="a"===o?e[o]:O(e[o]));e=n}return p(e,t)},p.equals=function(e,t){return!(!e||!t)&&p(e).toRgbString()==p(t).toRgbString()},p.random=function(){return p.fromRatio({r:d(),g:d(),b:d()})},p.mix=function(e,t,n){n=0===n?0:n||50;var o=p(e).toRgb(),r=p(t).toRgb(),l=n/100;return p({r:(r.r-o.r)*l+o.r,g:(r.g-o.g)*l+o.g,b:(r.b-o.b)*l+o.b,a:(r.a-o.a)*l+o.a})},p.readability=function(e,t){var n=p(e),o=p(t);return(r.max(n.getLuminance(),o.getLuminance())+.05)/(r.min(n.getLuminance(),o.getLuminance())+.05)},p.isReadable=function(e,t,n){var o,r,l,i,s,a=p.readability(e,t);switch(r=!1,(l=n,"AA"!==(i=((l=l||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==i&&(i="AA"),"small"!==(s=(l.size||"small").toLowerCase())&&"large"!==s&&(s="small"),o={level:i,size:s}).level+o.size){case"AAsmall":case"AAAlarge":r=a>=4.5;break;case"AAlarge":r=a>=3;break;case"AAAsmall":r=a>=7}return r},p.mostReadable=function(e,t,n){var o,r,l,i,s=null,a=0;r=(n=n||{}).includeFallbackColors,l=n.level,i=n.size;for(var c=0;c<t.length;c++)(o=p.readability(e,t[c]))>a&&(a=o,s=p(t[c]));return p.isReadable(e,s,{level:l,size:i})||!r?s:(n.includeFallbackColors=!1,p.mostReadable(e,["#fff","#000"],n))};var N=p.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},P=p.hexNames=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}(N);function R(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function L(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var n=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=c(t,u(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),r.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function M(e){return c(1,u(0,e))}function A(e){return parseInt(e,16)}function D(e){return 1==e.length?"0"+e:""+e}function O(e){return e<=1&&(e=100*e+"%"),e}function F(e){return r.round(255*parseFloat(e)).toString(16)}function z(e){return A(e)/255}var V,H,U,G=(H="[\\s|\\(]+("+(V="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+V+")[,|\\s]+("+V+")\\s*\\)?",U="[\\s|\\(]+("+V+")[,|\\s]+("+V+")[,|\\s]+("+V+")[,|\\s]+("+V+")\\s*\\)?",{CSS_UNIT:new RegExp(V),rgb:new RegExp("rgb"+H),rgba:new RegExp("rgba"+U),hsl:new RegExp("hsl"+H),hsla:new RegExp("hsla"+U),hsv:new RegExp("hsv"+H),hsva:new RegExp("hsva"+U),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function W(e){return!!G.CSS_UNIT.exec(e)}e.exports?e.exports=p:void 0===(o=function(){return p}.call(t,n,t,e))||(e.exports=o)}(Math)},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 b=t.call(h,h.node);return void 0!==b&&h.update&&h.update(b),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 Th},AlignmentToolbar:function(){return Nh},Autocomplete:function(){return Mh},BlockAlignmentControl:function(){return Mo},BlockAlignmentToolbar:function(){return Ao},BlockBreadcrumb:function(){return zh},BlockColorsStyleSelector:function(){return Wh},BlockContextProvider:function(){return ji},BlockControls:function(){return Jn},BlockEdit:function(){return Yi},BlockEditorKeyboardShortcuts:function(){return rk},BlockEditorProvider:function(){return Sd},BlockFormatControls:function(){return Qn},BlockIcon:function(){return yd},BlockInspector:function(){return ek},BlockList:function(){return Zf},BlockMover:function(){return Fm},BlockNavigationDropdown:function(){return fg},BlockPreview:function(){return up},BlockSelectionClearer:function(){return Id},BlockSettingsMenu:function(){return wf},BlockSettingsMenuControls:function(){return yf},BlockTitle:function(){return Sm},BlockToolbar:function(){return Bf},BlockTools:function(){return tk},BlockVerticalAlignmentControl:function(){return Ag},BlockVerticalAlignmentToolbar:function(){return Dg},ButtonBlockAppender:function(){return fm},ButtonBlockerAppender:function(){return mm},ColorPalette:function(){return Fg},ColorPaletteControl:function(){return zg},ContrastChecker:function(){return el},CopyHandler:function(){return uf},DefaultBlockAppender:function(){return dm},FontSizePicker:function(){return ni},InnerBlocks:function(){return $f},Inserter:function(){return um},InspectorAdvancedControls:function(){return Ko},InspectorControls:function(){return qo},JustifyContentControl:function(){return ho},JustifyToolbar:function(){return go},LineHeightControl:function(){return Ml},MediaPlaceholder:function(){return Ev},MediaReplaceFlow:function(){return gv},MediaUpload:function(){return fv},MediaUploadCheck:function(){return hv},MultiSelectScrollIntoView:function(){return lk},NavigableToolbar:function(){return xm},ObserveTyping:function(){return ck},PanelColorSettings:function(){return Cv},PlainText:function(){return Bv},PreserveScrollInReorder:function(){return uk},RichText:function(){return uv},RichTextShortcut:function(){return Tv},RichTextToolbarButton:function(){return Nv},SETTINGS_DEFAULTS:function(){return b},SkipToSelectedBlock:function(){return qv},ToolSelector:function(){return Lv},Typewriter:function(){return fk},URLInput:function(){return Sb},URLInputButton:function(){return Ov},URLPopover:function(){return _v},Warning:function(){return Xi},WritingFlow:function(){return Od},__experimentalBlockAlignmentMatrixControl:function(){return Oh},__experimentalBlockContentOverlay:function(){return Vh},__experimentalBlockFullHeightAligmentControl:function(){return Dh},__experimentalBlockPatternSetup:function(){return Bg},__experimentalBlockVariationPicker:function(){return gg},__experimentalBlockVariationTransforms:function(){return xg},__experimentalBorderRadiusControl:function(){return Rr},__experimentalBorderStyleControl:function(){return Fr},__experimentalColorGradientControl:function(){return hr},__experimentalDuotoneControl:function(){return Ui},__experimentalFontAppearanceControl:function(){return Vl},__experimentalFontFamilyControl:function(){return Kl},__experimentalGetBorderClassesAndStyles:function(){return dh},__experimentalGetColorClassesAndStyles:function(){return fh},__experimentalGetGradientClass:function(){return rr},__experimentalGetGradientObjectByGradientValue:function(){return ir},__experimentalGetMatchingVariation:function(){return Ig},__experimentalGetSpacingClassesAndStyles:function(){return gh},__experimentalImageEditingProvider:function(){return sb},__experimentalImageEditor:function(){return vb},__experimentalImageSizeControl:function(){return _b},__experimentalImageURLInputUI:function(){return jv},__experimentalLayoutStyle:function(){return Io},__experimentalLetterSpacingControl:function(){return ai},__experimentalLibrary:function(){return nk},__experimentalLinkControl:function(){return Ub},__experimentalLinkControlSearchInput:function(){return Db},__experimentalLinkControlSearchItem:function(){return Ib},__experimentalLinkControlSearchResults:function(){return Nb},__experimentalListView:function(){return pg},__experimentalListViewBlockFill:function(){return ng},__experimentalListViewEditor:function(){return dv},__experimentalPanelColorGradientSettings:function(){return Qr},__experimentalPreviewOptions:function(){return $v},__experimentalResponsiveBlockControl:function(){return xv},__experimentalUnitControl:function(){return Mv},__experimentalUseBorderProps:function(){return ph},__experimentalUseColorProps:function(){return hh},__experimentalUseCustomSides:function(){return Ti},__experimentalUseGradient:function(){return ar},__experimentalUseInnerBlocksProps:function(){return jf},__experimentalUseNoRecursiveRenders:function(){return vk},__experimentalUseResizeCanvas:function(){return Kv},__unstableBlockSettingsMenuFirstItem:function(){return gf},__unstableEditorStyles:function(){return sp},__unstableIframe:function(){return Vd},__unstableInserterMenuExtension:function(){return Hp},__unstableRichTextInputEvent:function(){return Pv},__unstableUseBlockSelectionClearer:function(){return Bd},__unstableUseCanvasClickRedirect:function(){return gk},__unstableUseClipboardHandler:function(){return cf},__unstableUseMouseMoveTypingReset:function(){return sk},__unstableUseTypewriter:function(){return mk},__unstableUseTypingObserver:function(){return ak},createCustomColorsHOC:function(){return kh},getColorClassName:function(){return nr},getColorObjectByAttributeValues:function(){return er},getColorObjectByColorValue:function(){return tr},getFontSize:function(){return Jl},getFontSizeClass:function(){return ti},getFontSizeObjectByValue:function(){return ei},getGradientSlugByValue:function(){return sr},getGradientValueBySlug:function(){return lr},store:function(){return Gn},storeConfig:function(){return Un},transformStyles:function(){return rp},useBlockDisplayInformation:function(){return Cm},useBlockEditContext:function(){return Kn},useBlockProps:function(){return ud},useSetting:function(){return po},validateThemeColors:function(){return kk},validateThemeGradients:function(){return _k},withColorContext:function(){return Og},withColors:function(){return _h},withFontSizes:function(){return Eh}});var e={};n.r(e),n.d(e,{__experimentalGetActiveBlockIdByBlockNames:function(){return Tt},__experimentalGetAllowedBlocks:function(){return ct},__experimentalGetAllowedPatterns:function(){return pt},__experimentalGetBlockListSettingsForBlocks:function(){return vt},__experimentalGetLastBlockAttributeChanges:function(){return Et},__experimentalGetParsedPattern:function(){return ut},__experimentalGetParsedReusableBlock:function(){return kt},__experimentalGetPatternTransformItems:function(){return ft},__experimentalGetPatternsByBlockTypes:function(){return mt},__experimentalGetReusableBlockTitle:function(){return _t},__unstableGetBlockWithoutInnerBlocks:function(){return j},__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 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 $},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 he},getPreviousBlockClientId:function(){return fe},getSelectedBlock:function(){return se},getSelectedBlockClientId:function(){return ie},getSelectedBlockClientIds:function(){return be},getSelectedBlockCount:function(){return re},getSelectedBlocksInitialCaretPosition:function(){return ge},getSelectionEnd:function(){return te},getSelectionStart:function(){return ee},getSettings:function(){return gt},getTemplate:function(){return je},getTemplateLock:function(){return $e},hasBlockMovingClientId:function(){return wt},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 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 Le},isNavigationMode:function(){return St},isSelectionEnabled:function(){return Me},isTyping:function(){return De},isValidTemplate:function(){return We},wasBlockJustInserted:function(){return Nt}});var t={};n.r(t),n.d(t,{__unstableMarkAutomaticChange:function(){return Rn},__unstableMarkAutomaticChangeFinal:function(){return Ln},__unstableMarkLastChangeAsPersistent:function(){return Nn},__unstableMarkNextChangeAsNotPersistent:function(){return Pn},__unstableSaveReusableBlock:function(){return Tn},clearSelectedBlock:function(){return Zt},duplicateBlocks:function(){return Dn},enterFormattedText:function(){return Cn},exitFormattedText:function(){return Sn},flashBlock:function(){return Vn},hideInsertionPoint:function(){return un},insertAfterBlock:function(){return Fn},insertBeforeBlock:function(){return On},insertBlock:function(){return sn},insertBlocks:function(){return an},insertDefaultBlock:function(){return Bn},mergeBlocks:function(){return mn},moveBlockToPosition:function(){return ln},moveBlocksDown:function(){return nn},moveBlocksToPosition:function(){return rn},moveBlocksUp:function(){return on},multiSelect:function(){return Yt},receiveBlocks:function(){return Ht},removeBlock:function(){return hn},removeBlocks:function(){return fn},replaceBlock:function(){return en},replaceBlocks:function(){return Jt},replaceInnerBlocks:function(){return gn},resetBlocks:function(){return Ft},resetSelection:function(){return Vt},selectBlock:function(){return Wt},selectNextBlock:function(){return $t},selectPreviousBlock:function(){return jt},selectionChange:function(){return wn},setBlockMovingClientId:function(){return An},setHasControlledInnerBlocks:function(){return Hn},setNavigationMode:function(){return Mn},setTemplateValidity:function(){return dn},showInsertionPoint:function(){return cn},startDraggingBlocks:function(){return yn},startMultiSelect:function(){return Kt},startTyping:function(){return vn},stopDraggingBlocks:function(){return En},stopMultiSelect:function(){return qt},stopTyping:function(){return kn},synchronizeTemplate:function(){return pn},toggleBlockHighlight:function(){return zn},toggleBlockMode:function(){return bn},toggleSelection:function(){return Xt},updateBlock:function(){return Gt},updateBlockAttributes:function(){return Ut},updateBlockListSettings:function(){return In},updateSettings:function(){return xn},validateBlocksToTemplate:function(){return zt}});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:{}},b={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 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)&&(n=e.attributes,o=t.attributes,(0,u.isEqual)((0,u.keys)(n),(0,u.keys)(o)));var n,o}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)));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,L=(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=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 M(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=M),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 j=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 $(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 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 he(e,t){return me(e,t,1)}function ge(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 Le(e){return e.isMultiSelecting}function Me(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 je(e){return e.settings.template}function $e(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}=gt(e);if(!Ke(l,t,!0))return!1;if($e(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=!!$e(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"===$e(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=n.variations.filter((({scope:e})=>!e||e.includes("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)?Ct(e).map((t=>{const n=`core/block/${t.id}`,o=kt(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,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)=>{const n=e.settings.__experimentalBlockPatterns.find((({name:e})=>e===t));return n?{...n,blocks:(0,r.parse)(n.content)}:null}),(e=>[e.settings.__experimentalBlockPatterns])),dt=O((e=>{const t=e.settings.__experimentalBlockPatterns,{allowedBlockTypes:n}=gt(e);return t.map((({name:t})=>ut(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])),pt=O(((e,t=null)=>{const n=dt(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]])),mt=O(((e,t,n=null)=>{if(!t)return V;const o=pt(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)=>[...pt.getDependants(e,t)])),ft=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 mt(e,o,n)}),((e,t)=>[...mt.getDependants(e,t)]));function ht(e,t){return e.blockListSettings[t]}function gt(e){return e.settings}function bt(e){return e.blocks.isPersistentChange}const vt=O(((e,t=[])=>t.reduce(((t,n)=>e.blockListSettings[n]?{...t,[n]:e.blockListSettings[n]}:t),{})),(e=>[e.blockListSettings])),kt=O(((e,t)=>{const n=(0,u.find)(Ct(e),(e=>e.id===t));return n?(0,r.parse)("string"==typeof n.content.raw?n.content.raw:n.content):null}),(e=>[Ct(e)])),_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 St(e){return e.isNavigationMode}function wt(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=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 Nt(e,t,n){const{lastBlockInserted:o}=e;return o.clientId===t&&o.source===n}var Pt=window.wp.a11y,Rt=window.wp.richText,Lt=window.wp.deprecated,Mt=n.n(Lt),At={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(Gn).__unstableMarkAutomaticChangeFinal()))}))};const Dt="core/block-editor";function*Ot(){if(0===(yield m.controls.select(Dt,"getBlockCount"))){const{__unstableHasCustomAppender:e}=yield m.controls.select(Dt,"getSettings");if(e)return;return yield Bn()}}function*Ft(e){return yield{type:"RESET_BLOCKS",blocks:e},yield*zt(e)}function*zt(e){const t=yield m.controls.select(Dt,"getTemplate"),n=yield m.controls.select(Dt,"getTemplateLock"),o=!t||"all"!==n||(0,r.doBlocksMatchTemplate)(e,t);if(o!==(yield m.controls.select(Dt,"isValidTemplate")))return yield dn(o),o}function Vt(e,t,n){return{type:"RESET_SELECTION",selectionStart:e,selectionEnd:t,initialPosition:n}}function Ht(e){return Mt()('wp.data.dispatch( "core/block-editor" ).receiveBlocks',{since:"5.9",alternative:"resetBlocks or insertBlocks"}),{type:"RECEIVE_BLOCKS",blocks:e}}function Ut(e,t,n=!1){return{type:"UPDATE_BLOCK_ATTRIBUTES",clientIds:(0,u.castArray)(e),attributes:t,uniqueByBlock:n}}function Gt(e,t){return{type:"UPDATE_BLOCK",clientId:e,updates:t}}function Wt(e,t=0){return{type:"SELECT_BLOCK",initialPosition:t,clientId:e}}function*jt(e){const t=yield m.controls.select(Dt,"getPreviousBlockClientId",e);if(t)return yield Wt(t,-1),[t]}function*$t(e){const t=yield m.controls.select(Dt,"getNextBlockClientId",e);if(t)return yield Wt(t),[t]}function Kt(){return{type:"START_MULTI_SELECT"}}function qt(){return{type:"STOP_MULTI_SELECT"}}function*Yt(e,t){if((yield m.controls.select(Dt,"getBlockRootClientId",e))!==(yield m.controls.select(Dt,"getBlockRootClientId",t)))return;yield{type:"MULTI_SELECT",start:e,end:t};const n=yield m.controls.select(Dt,"getSelectedBlockCount");(0,Pt.speak)((0,h.sprintf)(
|
2 |
/* translators: %s: number of selected blocks */
|
3 |
-
(0,h._n)("%s block selected.","%s blocks selected.",n),n),"assertive")}function Zt(){return{type:"CLEAR_SELECTED_BLOCK"}}function Xt(e=!0){return{type:"TOGGLE_SELECTION",isSelectionEnabled:e}}function Qt(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*Jt(e,t,n,o=0,r){e=(0,u.castArray)(e),t=Qt((0,u.castArray)(t),yield m.controls.select(Dt,"getSettings"));const l=yield m.controls.select(Dt,"getBlockRootClientId",(0,u.first)(e));for(let e=0;e<t.length;e++){const n=t[e];if(!(yield m.controls.select(Dt,"canInsertBlockType",n.name,l)))return}yield{type:"REPLACE_BLOCKS",clientIds:e,blocks:t,time:Date.now(),indexToSelect:n,initialPosition:o,meta:r},yield*Ot()}function en(e,t){return Jt(e,t)}function tn(e){return function*(t,n){(yield m.controls.select(Dt,"canMoveBlocks",t,n))&&(yield{clientIds:(0,u.castArray)(t),type:e,rootClientId:n})}}const nn=tn("MOVE_BLOCKS_DOWN"),on=tn("MOVE_BLOCKS_UP");function*rn(e,t="",n="",o){const r=yield m.controls.select(Dt,"canMoveBlocks",e,t),l=yield m.controls.select(Dt,"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(Dt,"canInsertBlocks",e,n))&&(yield i):yield i}function*ln(e,t="",n="",o){yield rn([e],t,n,o)}function sn(e,t,n,o=!0,r){return an([e],t,n,o,0,r)}function*an(e,t,n,o=!0,r=0,l){(0,u.isObject)(r)&&(l=r,r=0,Mt()("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=Qt((0,u.castArray)(e),yield m.controls.select(Dt,"getSettings"));const i=[];for(const t of e)(yield m.controls.select(Dt,"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 cn(e,t,n={}){const{__unstableWithInserter:o}=n;return{type:"SHOW_INSERTION_POINT",rootClientId:e,index:t,__unstableWithInserter:o}}function un(){return{type:"HIDE_INSERTION_POINT"}}function dn(e){return{type:"SET_TEMPLATE_VALIDITY",isValid:e}}function*pn(){yield{type:"SYNCHRONIZE_TEMPLATE"};const e=yield m.controls.select(Dt,"getBlocks"),t=yield m.controls.select(Dt,"getTemplate"),n=(0,r.synchronizeBlocksWithTemplate)(e,t);return yield Ft(n)}function*mn(e,t){const n=[e,t];yield{type:"MERGE_BLOCKS",blocks:n};const[o,l]=n,i=yield m.controls.select(Dt,"getBlock",o),s=(0,r.getBlockType)(i.name);if(s&&!s.merge)return void(yield Wt(i.clientId));const a=yield m.controls.select(Dt,"getBlock",l),c=(0,r.getBlockType)(a.name),{clientId:d,attributeKey:p,offset:f}=yield m.controls.select(Dt,"getSelectionStart"),h=(d===o?s:c).attributes[p],g=(d===o||d===l)&&void 0!==p&&void 0!==f&&!!h;h||("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(g){const e=d===o?b:v,t=e.attributes[p],{multiline:n,__unstableMultilineWrapperTags:r,__unstablePreserveWhiteSpace:l}=h,i=(0,Rt.insert)((0,Rt.create)({html:t,multilineTag:n,multilineWrapperTags:r,preserveWhiteSpace:l}),"",f,f);e.attributes[p]=(0,Rt.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(g){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,Rt.create)({html:t,multilineTag:n,multilineWrapperTags:o,preserveWhiteSpace:r}),a=l.text.indexOf(""),c=(0,Rt.remove)(l,a,a+1),d=(0,Rt.toHTMLString)({value:c,multilineTag:n,preserveWhiteSpace:r});_[e]=d,yield wn(i.clientId,e,a,a)}yield*Jt([i.clientId,a.clientId],[{...i,attributes:{...i.attributes,..._}},...k.slice(1)],0)}function*fn(e,t=!0){if(!e||!e.length)return;e=(0,u.castArray)(e);const n=yield m.controls.select(Dt,"getBlockRootClientId",e[0]);if(!(yield m.controls.select(Dt,"canRemoveBlocks",e,n)))return;let o;o=t?yield jt(e[0]):yield m.controls.select(Dt,"getPreviousBlockClientId",e[0]),yield{type:"REMOVE_BLOCKS",clientIds:e};const r=yield*Ot();return[o||r]}function hn(e,t){return fn([e],t)}function gn(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 bn(e){return{type:"TOGGLE_BLOCK_MODE",clientId:e}}function vn(){return{type:"START_TYPING"}}function kn(){return{type:"STOP_TYPING"}}function yn(e=[]){return{type:"START_DRAGGING_BLOCKS",clientIds:e}}function En(){return{type:"STOP_DRAGGING_BLOCKS"}}function Cn(){return{type:"ENTER_FORMATTED_TEXT"}}function Sn(){return{type:"EXIT_FORMATTED_TEXT"}}function wn(e,t,n,o){return{type:"SELECTION_CHANGE",clientId:e,attributeKey:t,startOffset:n,endOffset:o}}function Bn(e,t,n){const o=(0,r.getDefaultBlockName)();if(o)return sn((0,r.createBlock)(o,e),n,t)}function In(e,t){return{type:"UPDATE_BLOCK_LIST_SETTINGS",clientId:e,settings:t}}function xn(e){return{type:"UPDATE_SETTINGS",settings:e}}function Tn(e,t){return{type:"SAVE_REUSABLE_BLOCK_SUCCESS",id:e,updatedId:t}}function Nn(){return{type:"MARK_LAST_CHANGE_AS_PERSISTENT"}}function Pn(){return{type:"MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"}}function*Rn(){yield{type:"MARK_AUTOMATIC_CHANGE"},yield{type:"MARK_AUTOMATIC_CHANGE_FINAL_CONTROL"}}function Ln(){return{type:"MARK_AUTOMATIC_CHANGE_FINAL"}}function*Mn(e=!0){yield{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."))}function*An(e=null){yield{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."))}function*Dn(e,t=!0){if(!e&&!e.length)return;const n=yield m.controls.select(Dt,"getBlocksByClientId",e),o=yield m.controls.select(Dt,"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(Dt,"getBlockIndex",(0,u.last)((0,u.castArray)(e)),o),s=n.map((e=>(0,r.__experimentalCloneSanitizedBlock)(e)));return yield an(s,i+1,o,t),s.length>1&&t&&(yield Yt((0,u.first)(s).clientId,(0,u.last)(s).clientId)),s.map((e=>e.clientId))}function*On(e){if(!e)return;const t=yield m.controls.select(Dt,"getBlockRootClientId",e);if(yield m.controls.select(Dt,"getTemplateLock",t))return;const n=yield m.controls.select(Dt,"getBlockIndex",e,t);return yield Bn({},t,n)}function*Fn(e){if(!e)return;const t=yield m.controls.select(Dt,"getBlockRootClientId",e);if(yield m.controls.select(Dt,"getTemplateLock",t))return;const n=yield m.controls.select(Dt,"getBlockIndex",e,t);return yield Bn({},t,n+1)}function zn(e,t){return{type:"TOGGLE_BLOCK_HIGHLIGHT",clientId:e,isHighlighted:t}}function*Vn(e){yield zn(e,!0),yield{type:"SLEEP",duration:150},yield zn(e,!1)}function Hn(e,t){return{type:"SET_HAS_CONTROLLED_INNER_BLOCKS",hasControlledInnerBlocks:t,clientId:e}}const Un={reducer:L,selectors:e,actions:t,controls:At},Gn=(0,m.createReduxStore)(Dt,{...Un,persist:["preferences"]});(0,m.registerStore)(Dt,{...Un,persist:["preferences"]});const Wn={name:"",isSelected:!1},jn=(0,s.createContext)(Wn),{Provider:$n}=jn;function Kn(){return(0,s.useContext)(jn)}function qn(){const{isSelected:e,clientId:t,name:n}=Kn();return(0,m.useSelect)((o=>{if(e)return!0;const{getBlockName:r,isFirstMultiSelectedBlock:l,getMultiSelectedBlockClientIds:i}=o(Gn);return!!l(t)&&i().every((e=>r(e)===n))}),[t,e,n])}function Yn({group:e="default",controls:t,children:n,__experimentalShareWithChildBlocks:o=!1}){const l=function(e,t){const n=qn(),{clientId:o}=Kn(),l=(0,m.useSelect)((e=>{const{getBlockName:n,hasSelectedInnerBlock:l}=e(Gn),{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 Zn({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 Xn=Yn;Xn.Slot=Zn;const Qn=e=>(0,s.createElement)(Yn,i({group:"inline"},e));Qn.Slot=e=>(0,s.createElement)(Zn,i({group:"inline"},e));var Jn=Xn,eo=(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"})),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:"M6 15h14V9H6v6zm6-10.8v1.5h8V4.2h-8zm0 15.6h8v-1.5h-8v1.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:"M5 9v6h14V9H5zm11-4.8H8v1.5h8V4.2zM8 19.8h8v-1.5H8v1.5z"})),ro=(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"})),lo=(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"})),io=(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"})),so=(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"})),ao=(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 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.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 po(e){const{name:t}=Kn();return(0,m.useSelect)((n=>{var o;const l=n(Gn).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=uo[e]?uo[e](l):void 0;return void 0!==p?p:"typography.dropCap"===e||void 0}),[t,e])}const mo={left:lo,center:io,right:so,"space-between":ao};var fo=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?mo[o]:mo.left,u=[{name:"left",icon:lo,title:(0,h.__)("Justify items left"),isActive:"left"===o,onClick:()=>a("left")},{name:"center",icon:io,title:(0,h.__)("Justify items center"),isActive:"center"===o,onClick:()=>a("center")},{name:"right",icon:so,title:(0,h.__)("Justify items right"),isActive:"right"===o,onClick:()=>a("right")},{name:"space-between",icon:ao,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 ho(e){return(0,s.createElement)(fo,i({},e,{isToolbar:!1}))}function go(e){return(0,s.createElement)(fo,i({},e,{isToolbar:!0}))}const bo={left:"flex-start",right:"flex-end",center:"center","space-between":"space-between"};var vo={name:"flex",label:(0,h.__)("Flex"),inspectorControls:function({layout:e={},onChange:t}){return(0,s.createElement)(_o,{layout:e,onChange:t})},toolBarControls:function({layout:e={},onChange:t,layoutBlockSupport:n}){return null!=n&&n.allowSwitching?null:(0,s.createElement)(Jn,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(_o,{layout:e,onChange:t,isToolbar:!0}))},save:function({selector:e,layout:t}){const n=null!==po("spacing.blockGap"),o=bo[t.justifyContent]||"flex-start";return(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: ${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${co(e,"> *")} {\n\t\t\t\t\tmargin: 0;\n\t\t\t\t}\n\t\t\t`)},getOrientation:()=>"horizontal",getAlignments:()=>[]};const ko=[{value:"left",icon:lo,label:(0,h.__)("Justify items left")},{value:"center",icon:io,label:(0,h.__)("Justify items center")},{value:"right",icon:so,label:(0,h.__)("Justify items right")},{value:"space-between",icon:ao,label:(0,h.__)("Space between items")}];function _o({layout:e,onChange:t,isToolbar:n=!1}){const{justifyContent:o="left"}=e,r=n=>{t({...e,justifyContent:n})};return n?(0,s.createElement)(ho,{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,h.__)("Justification")),(0,s.createElement)("div",null,ko.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 yo=function({icon:e,size:t=24,...n}){return(0,s.cloneElement)(e,{width:t,height:t,...n})};const Eo=[{name:"default",label:(0,h.__)("Flow"),inspectorControls:function({layout:e,onChange:t}){const{wideSize:n,contentSize:o}=e,r=(0,p.__experimentalUseCustomUnits)({availableUnits:po("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)(yo,{icon:to})),(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)(yo,{icon:oo}))),(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!==po("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: var( --wp--style--block-gap );\n\t\t\t\t\tmargin-bottom: 0;\n\t\t\t\t}\n\t\t\t`),(0,s.createElement)("style",null,l)},getOrientation:()=>"vertical",getAlignments(e){if(void 0!==e.alignments)return e.alignments;const t=["left","center","right"];return e.contentSize&&t.unshift("full"),e.wideSize&&t.unshift("wide"),t}},vo];function Co(e="default"){return Eo.find((t=>t.name===e))}const So={type:"default"},wo=(0,s.createContext)(So),Bo=wo.Provider;function Io({layout:e={},...t}){const n=Co(e.type);return n?(0,s.createElement)(n.save,i({layout:e},t)):null}const xo=["left","center","right","wide","full"],To=["wide","full"];function No(e=xo){const{wideControlsEnabled:t=!1,themeSupportsLayout:n}=(0,m.useSelect)((e=>{const{getSettings:t}=e(Gn),n=t();return{wideControlsEnabled:n.alignWide,themeSupportsLayout:n.supportsLayout}}),[]),o=(0,s.useContext)(wo),r=Co(null==o?void 0:o.type),l=r.getAlignments(o);if(n)return l.filter((t=>e.includes(t)));if("default"!==r.name)return[];const{alignments:i=xo}=o;return e.filter((e=>(o.alignments||t||!To.includes(e))&&i.includes(e)))}const Po={left:{icon:eo,title:(0,h.__)("Align left")},center:{icon:to,title:(0,h.__)("Align center")},right:{icon:no,title:(0,h.__)("Align right")},wide:{icon:oo,title:(0,h.__)("Wide width")},full:{icon:ro,title:(0,h.__)("Full width")}},Ro={isAlternate:!0};var Lo=function({value:e,onChange:t,controls:n,isToolbar:o,isCollapsed:r=!0}){const l=No(n);if(0===l.length)return null;const a=Po[e],c=Po.center,u=o?p.ToolbarGroup:p.ToolbarDropdownMenu,d=o?{isCollapsed:r}:{},m=l.some((t=>t===e));return(0,s.createElement)(u,i({popoverProps:Ro,icon:a?a.icon:c.icon,label:(0,h.__)("Align"),toggleProps:{describedBy:(0,h.__)("Change alignment"),className:m?"is-pressed":void 0},controls:l.map((n=>{return{...Po[n],isActive:e===n,role:r?"menuitemradio":void 0,onClick:(o=n,()=>t(e===o?void 0:o))};var o}))},d))};function Mo(e){return(0,s.createElement)(Lo,i({},e,{isToolbar:!1}))}function Ao(e){return(0,s.createElement)(Lo,i({},e,{isToolbar:!0}))}const Do=["left","center","right","wide","full"],Oo=["wide","full"];function Fo(e,t=!0,n=!0){let o;return o=Array.isArray(e)?Do.filter((t=>e.includes(t))):!0===e?Do:[],!n||!0===e&&!t?(0,u.without)(o,...Oo):o}const zo=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n}=t,o=Fo((0,r.getBlockSupport)(n,"align"),(0,r.hasBlockSupport)(n,"alignWide",!0));return(0,s.createElement)(s.Fragment,null,o.length>0&&(0,s.createElement)(Jn,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(Mo,{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"),Vo=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n,attributes:o}=t,{align:l}=o,a=No(Fo((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.includes(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:[...Do,""]}}),e})),(0,l.addFilter)("editor.BlockListBlock","core/editor/align/with-data-align",Vo),(0,l.addFilter)("editor.BlockEdit","core/editor/align/with-toolbar-controls",zo),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/align/addAssignedAlign",(function(e,t,n){const{align:o}=n;return Fo((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 Ho={default:(0,p.createSlotFill)("InspectorControls"),advanced:(0,p.createSlotFill)("InspectorAdvancedControls"),dimensions:(0,p.createSlotFill)("InspectorControlsDimensions")};function Uo({__experimentalGroup:e="default",children:t}){var n;const o=qn(),r=null===(n=Ho[e])||void 0===n?void 0:n.Fill;return r?o?(0,s.createElement)(p.__experimentalStyleProvider,{document:document},(0,s.createElement)(r,null,t)):null:("undefined"!=typeof process&&process.env,null)}const Go=e=>{if(!(0,u.isObject)(e)||Array.isArray(e))return e;const t=(0,u.pickBy)((0,u.mapValues)(e,Go),u.identity);return(0,u.isEmpty)(t)?void 0:t};function Wo({children:e,label:t,header:n}){const{clientId:o,attributes:r}=(0,m.useSelect)((e=>{const{getBlockAttributes:t,getSelectedBlockClientId:n}=e(Gn),o=n();return{clientId:o,attributes:t(o)}})),{updateBlockAttributes:l}=(0,m.useDispatch)(Gn);return(0,s.createElement)(p.__experimentalToolsPanel,{label:t,header:n,resetAll:(e=[])=>{const{style:t}=r;let n={style:t};e.forEach((e=>{n={...n,...e(n)}})),n={...n,style:Go(n.style)},l(o,n)},key:o,panelId:o},e)}function jo({__experimentalGroup:e="default",bubblesVirtually:t=!0,label:n,...o}){var r;const l=null===(r=Ho[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)(Wo,{group:e,label:n},(0,s.createElement)(l,i({},o,{bubblesVirtually:t}))):(0,s.createElement)(l,i({},o,{bubblesVirtually:t})):null:("undefined"!=typeof process&&process.env,null)}const $o=Uo;$o.Slot=jo;const Ko=e=>(0,s.createElement)(Uo,i({},e,{__experimentalGroup:"advanced"}));Ko.Slot=e=>(0,s.createElement)(jo,i({},e,{__experimentalGroup:"advanced"})),Ko.slotName="InspectorAdvancedControls";var qo=$o;const Yo=/[\s#]/g,Zo=(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:"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(Yo,"-"),t.setAttributes({anchor:e})},autoCapitalize:"none",autoComplete:"off"});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(e,t),n&&(0,s.createElement)(qo,{__experimentalGroup:"advanced"},o),!n&&"core/heading"===t.name&&(0,s.createElement)(qo,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",Zo),(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 Xo=(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)(qo,{__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",Xo),(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 Qo=n(7621),Jo=n.n(Qo);const er=(e,t,n)=>{if(t){const n=(0,u.find)(e,{slug:t});if(n)return n}return{color:n}},tr=(e,t)=>(0,u.find)(e,{color:t});function nr(e,t){if(e&&t)return`has-${(0,u.kebabCase)(t)}-${e}`}const or=[];function rr(e){if(e)return`has-${e}-gradient-background`}function lr(e,t){const n=(0,u.find)(e,["slug",t]);return n&&n.gradient}function ir(e,t){return(0,u.find)(e,["gradient",t])}function sr(e,t){const n=ir(e,t);return n&&n.slug}function ar({gradientAttribute:e="gradient",customGradientAttribute:t="customGradient"}={}){const{clientId:n}=Kn(),o=po("color.gradients")||or,{gradient:r,customGradient:l}=(0,m.useSelect)((o=>{const{getBlockAttributes:r}=o(Gn),l=r(n)||{};return{customGradient:l[t],gradient:l[e]}}),[n,e,t]),{updateBlockAttributes:i}=(0,m.useDispatch)(Gn),a=(0,s.useCallback)((r=>{const l=sr(o,r);i(n,l?{[e]:l,[t]:void 0}:{[e]:void 0,[t]:r})}),[o,n,i]),c=rr(r);let u;return u=r?lr(o,r):l,{gradientClass:c,gradientValue:u,setGradient:a}}
|
|
|
|
|
|
|
|
|
4 |
// translators: first %s: the color name or value (e.g. red or #ff0000)
|
5 |
-
const
|
6 |
-
function pr({colors:e,gradients:t,label:n,currentTab:o,colorValue:r,gradientValue:l}){let i,a;if("color"===o){if(r){i=r;const t=tr(e,i),n=t&&t.name;a=(0,h.sprintf)(cr,n||i)}}else if("gradient"===o&&l){i=l;const e=ir(t,i),n=e&&e.name;a=(0,h.sprintf)(ur,n||i)}return(0,s.createElement)(s.Fragment,null,n,!!i&&(0,s.createElement)(p.ColorIndicator,{colorValue:i,"aria-label":a}))}function mr({colors:e,gradients:t,disableCustomColors:n,disableCustomGradients:o,className:r,label:l,onColorChange:i,onGradientChange:a,colorValue:d,gradientValue:m,clearable:f}){const g=i&&(!(0,u.isEmpty)(e)||!n),b=a&&(!(0,u.isEmpty)(t)||!o),[v,k]=(0,s.useState)(m?"gradient":!!g&&"color");return g||b?(0,s.createElement)(p.BaseControl,{className:c()("block-editor-color-gradient-control",r)},(0,s.createElement)("fieldset",null,(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)(pr,{currentTab:v,label:l,colorValue:d,gradientValue:m})))),g&&b&&(0,s.createElement)(p.ButtonGroup,{className:"block-editor-color-gradient-control__button-tabs"},(0,s.createElement)(p.Button,{isSmall:!0,isPressed:"color"===v,onClick:()=>k("color")},(0,h.__)("Solid")),(0,s.createElement)(p.Button,{isSmall:!0,isPressed:"gradient"===v,onClick:()=>k("gradient")},(0,h.__)("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||!g)&&(0,s.createElement)(p.GradientPicker,{value:m,onChange:g?e=>{a(e),i()}:a,gradients:t,disableCustomGradients:o,clearable:f}))):null}function fr(e){const t={};return t.colors=po("color.palette"),t.gradients=po("color.gradients"),t.disableCustomColors=!po("color.custom"),t.disableCustomGradients=!po("color.customGradient"),(0,s.createElement)(mr,i({},t,e))}var hr=function(e){return(0,u.every)(dr,(t=>e.hasOwnProperty(t)))?(0,s.createElement)(mr,e):(0,s.createElement)(fr,e)};const gr=[];function br(e){const{attributes:{borderColor:t,style:n},setAttributes:o}=e,r=po("color.palette")||gr,l=!po("color.custom"),i=!po("color.customGradient"),[a,c]=(0,s.useState)((()=>{var e,o;return null===(e=er(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)(hr,{label:(0,h.__)("Color"),colorValue:a,colors:r,gradients:void 0,disableCustomColors:l,disableCustomGradients:i,onColorChange:e=>{c(e);const t=tr(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:Go(l),borderColor:i})}})}function vr(e,t,n){var o;if(!Gr(t,"color")||Wr(t))return e;const{borderColor:r,style:l}=n,i=nr("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 kr=(0,d.createHigherOrderComponent)((e=>t=>{var n,o;const{name:r,attributes:l}=t,{borderColor:a}=l,c=po("color.palette")||gr;if(!Gr(r,"color")||Wr(r))return(0,s.createElement)(e,t);const u={borderColor:a?null===(n=er(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 _r(e){return e.sort(((t,n)=>e.filter((e=>e===t)).length-e.filter((e=>e===n)).length)).pop()}function yr(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=_r(o);return 0===r||r?`${r}${l}`:null}function Er(e={}){const t=yr(e);return isNaN(parseFloat(t))}function Cr(e){return!!e&&("string"==typeof e||!!Object.values(e).filter((e=>!!e||0===e)).length)}function Sr({onChange:e,values:t,...n}){const o=yr(t),r=Cr(t)&&Er(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 Gr(e,"color")?e.attributes.borderColor?e:{...e,attributes:{...e.attributes,borderColor:{type:"string"}}}:e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/border/addSaveProps",vr),(0,l.addFilter)("blocks.registerBlockType","core/border/addEditProps",(function(e){if(!Gr(e,"color")||Wr(e))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),vr(o,e,n)},e})),(0,l.addFilter)("editor.BlockListBlock","core/border/with-border-color-palette-styles",kr);const wr={topLeft:(0,h.__)("Top left"),topRight:(0,h.__)("Top right"),bottomLeft:(0,h.__)("Bottom left"),bottomRight:(0,h.__)("Bottom right")};function Br({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(wr).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 Ir=(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"})),xr=(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 Tr({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?Ir:xr,iconSize:16,"aria-label":n})))}const Nr={topLeft:null,topRight:null,bottomLeft:null,bottomRight:null},Pr={px:100,em:20,rem:20};function Rr({onChange:e,values:t}){const[n,o]=(0,s.useState)(!Cr(t)||!Er(t)),r=(0,p.__experimentalUseCustomUnits)({availableUnits:po("spacing.units")||["px","em","rem"]}),l=function(e={}){if("string"==typeof e){const[,t]=(0,p.__experimentalParseUnit)(e);return t||"px"}return _r(Object.values(e).map((e=>{const[,t]=(0,p.__experimentalParseUnit)(e);return t})))}(t),i=r&&r.find((e=>e.value===l)),a=(null==i?void 0:i.step)||1,[c]=(0,p.__experimentalParseUnit)(yr(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)(Sr,{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:Pr[l],initialPosition:0,withInputField:!1,onChange:t=>{e(void 0!==t?`${t}${l}`:void 0)},step:a})):(0,s.createElement)(Br,{min:0,onChange:e,values:t||Nr,units:r}),(0,s.createElement)(Tr,{onClick:()=>o(!n),isLinked:n})))}function Lr(e){var t;const{attributes:{style:n},setAttributes:o}=e;return(0,s.createElement)(Rr,{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=Go(t)),o({style:t})}})}var Mr=(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"})),Ar=(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"})),Dr=(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 Or=[{label:(0,h.__)("Solid"),icon:Mr,value:"solid"},{label:(0,h.__)("Dashed"),icon:Ar,value:"dashed"},{label:(0,h.__)("Dotted"),icon:Dr,value:"dotted"}];function Fr({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"},Or.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 zr=e=>{var t;const{attributes:{style:n},setAttributes:o}=e;return(0,s.createElement)(Fr,{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:Go(t)})}})},Vr=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:po("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=Go(r)),o({borderColor:l,style:r})},units:m})},Hr="__experimentalBorder";function Ur(e){const t=jr(e),n=Gr(e.name),o=po("border.customColor")&&Gr(e.name,"color"),r=po("border.customRadius")&&Gr(e.name,"radius"),l=po("border.customStyle")&&Gr(e.name,"style"),i=po("border.customWidth")&&Gr(e.name,"width");return t||!n?null:(0,s.createElement)(qo,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)(Vr,e),l&&(0,s.createElement)(zr,e)),o&&(0,s.createElement)(br,e),r&&(0,s.createElement)(Lr,e)))}function Gr(e,t="any"){if("web"!==s.Platform.OS)return!1;const n=(0,r.getBlockSupport)(e,Hr);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 Wr(e){const t=(0,r.getBlockSupport)(e,Hr);return null==t?void 0:t.__experimentalSkipSerialization}const jr=()=>[!po("border.customColor"),!po("border.customRadius"),!po("border.customStyle"),!po("border.customWidth")].every(Boolean),$r=(0,h.__)("(%s: color %s)"),Kr=(0,h.__)("(%s: gradient %s)"),qr=["colors","disableCustomColors","gradients","disableCustomGradients"],Yr=({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=tr(l||e,n);c=(0,h.sprintf)($r,r.toLowerCase(),t&&t.name||n)}else{const e=ir(i||t,n);c=(0,h.sprintf)(Kr,r.toLowerCase(),e&&e.name||o)}return(0,s.createElement)(p.ColorIndicator,{key:a,colorValue:n||o,"aria-label":c})})),Zr=({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 h=(0,s.createElement)("span",{className:"block-editor-panel-color-gradient-settings__panel-title"},d,(0,s.createElement)(Yr,{colors:t,gradients:n,settings:a}));return(0,s.createElement)(p.PanelBody,i({className:c()("block-editor-panel-color-gradient-settings",e),title:m?h:void 0},f),a.map(((e,l)=>(0,s.createElement)(hr,i({key:l,colors:t,gradients:n,disableCustomColors:o,disableCustomGradients:r},e)))),l)},Xr=e=>{const t={};return t.colors=po("color.palette"),t.gradients=po("color.gradients"),t.disableCustomColors=!po("color.custom"),t.disableCustomGradients=!po("color.customGradient"),(0,s.createElement)(Zr,i({},t,e))};var Qr=e=>(0,u.every)(qr,(t=>e.hasOwnProperty(t)))?(0,s.createElement)(Zr,e):(0,s.createElement)(Xr,e);function Jr({tinyBackgroundColor:e,tinyTextColor:t,backgroundColor:n,textColor:o}){const r=e.getBrightness()<t.getBrightness()?(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))}var el=function({backgroundColor:e,fallbackBackgroundColor:t,fallbackTextColor:n,fontSize:o,isLargeText:r,textColor:l}){if(!e&&!t||!l&&!n)return null;const i=Jo()(e||t),a=Jo()(l||n);return 1!==i.getAlpha()||1!==a.getAlpha()||Jo().isReadable(i,a,{level:"AA",size:r||!1!==r&&o>=24?"large":"small"})?null:(0,s.createElement)(Jr,{backgroundColor:e,textColor:l,tinyBackgroundColor:i,tinyTextColor:a})};const tl=(0,s.createContext)();function nl({children:e}){const t=(0,s.useMemo)((()=>({refs:new Map,callbacks:new Map})),[]);return(0,s.createElement)(tl.Provider,{value:t},e)}function ol(e){const{refs:t,callbacks:n}=(0,s.useContext)(tl),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 rl(e){const{refs:t}=(0,s.useContext)(tl),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 ll(e){const{callbacks:t}=(0,s.useContext)(tl),n=rl(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 il(e){return e.ownerDocument.defaultView.getComputedStyle(e)}function sl({settings:e,clientId:t,enableContrastChecking:n=!0,showTitle:o=!0}){const[r,l]=(0,s.useState)(),[i,a]=(0,s.useState)(),c=rl(t);return(0,s.useEffect)((()=>{if(!n)return;if(!c.current)return;a(il(c.current).color);let e=c.current,t=il(e).backgroundColor;for(;"rgba(0, 0, 0, 0)"===t&&e.parentNode&&e.parentNode.nodeType===e.parentNode.ELEMENT_NODE;)e=e.parentNode,t=il(e).backgroundColor;l(t)})),(0,s.createElement)(qo,null,(0,s.createElement)(Qr,{title:(0,h.__)("Color"),initialOpen:!1,settings:e,showTitle:o},n&&(0,s.createElement)(el,{backgroundColor:r,textColor:i})))}const al="color",cl=[],ul=e=>{const t=(0,r.getBlockSupport)(e,al);return t&&(!0===t.link||!0===t.gradient||!1!==t.background||!1!==t.text)},dl=e=>{const t=(0,r.getBlockSupport)(e,al);return null==t?void 0:t.__experimentalSkipSerialization},pl=e=>{const t=(0,r.getBlockSupport)(e,al);return(0,u.isObject)(t)&&!!t.gradients};function ml(e,t,n){var o,r,l,i,s,a;if(!ul(t)||dl(t))return e;const u=pl(t),{backgroundColor:d,textColor:p,gradient:m,style:f}=n,h=nr("background-color",d),g=rr(m),b=nr("color",p),v=c()(e.className,b,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=v||void 0,e}const fl=(e,t)=>{const n=/var:preset\|color\|(.+)/.exec(t);return n&&n[1]?er(e,n[1]).color:t};function hl(e){var t,n,o,l,i,a,c,d,p;const{name:m,attributes:f}=e,g=po("color.palette")||cl,b=po("color.gradients")||cl,v=po("color.custom"),k=po("color.customGradient"),_=po("color.link"),y=po("color.text"),E=po("color.background"),C=(0,s.useRef)(f);if((0,s.useEffect)((()=>{C.current=f}),[f]),!ul(m))return null;const S=(e=>{if("web"!==s.Platform.OS)return!1;const t=(0,r.getBlockSupport)(e,al);return(0,u.isObject)(t)&&!!t.link})(m)&&_&&(g.length>0||v),w=(e=>{const t=(0,r.getBlockSupport)(e,al);return t&&!1!==t.text})(m)&&y&&(g.length>0||v),B=(e=>{const t=(0,r.getBlockSupport)(e,al);return t&&!1!==t.background})(m)&&E&&(g.length>0||v),I=pl(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=lr(b,P);else if(I){var L;R=null==x||null===(L=x.color)||void 0===L?void 0:L.gradient}const M=t=>n=>{var o,r;const l=tr(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:Go(s),[i]:a};e.setAttributes(c),C.current={...C.current,...c}};return(0,s.createElement)(sl,{enableContrastChecking:!("web"!==s.Platform.OS||P||null!=x&&null!==(t=x.color)&&void 0!==t&&t.gradient),clientId:e.clientId,settings:[...w?[{label:(0,h.__)("Text color"),onColorChange:M("text"),colorValue:er(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?M("background"):void 0,colorValue:er(g,N,null==x||null===(o=x.color)||void 0===o?void 0:o.background).color,gradientValue:R,onGradientChange:I?t=>{const n=sr(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:Go(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:Go(e),gradient:void 0}}e.setAttributes(o),C.current={...C.current,...o}}:void 0}]:[],...S?[{label:(0,h.__)("Link Color"),onColorChange:t=>{const n=tr(g,t),o=null!=n&&n.slug?`var:preset|color|${n.slug}`:t,r=Go(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:fl(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 gl=(0,d.createHigherOrderComponent)((e=>t=>{var n,o,r;const{name:l,attributes:a}=t,{backgroundColor:c,textColor:u}=a,d=po("color.palette")||cl;if(!ul(l)||dl(l))return(0,s.createElement)(e,t);const p={color:u?null===(n=er(d,u))||void 0===n?void 0:n.color:void 0,backgroundColor:c?null===(o=er(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 ul(e)?(e.attributes.backgroundColor||Object.assign(e.attributes,{backgroundColor:{type:"string"}}),e.attributes.textColor||Object.assign(e.attributes,{textColor:{type:"string"}}),pl(e)&&!e.attributes.gradient&&Object.assign(e.attributes,{gradient:{type:"string"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/color/addSaveProps",ml),(0,l.addFilter)("blocks.registerBlockType","core/color/addEditProps",(function(e){if(!ul(e)||dl(e))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),ml(o,e,n)},e})),(0,l.addFilter)("editor.BlockListBlock","core/color/with-color-palette-styles",gl);var bl=(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"})),vl=(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 kl=[{name:(0,h.__)("Underline"),value:"underline",icon:bl},{name:(0,h.__)("Strikethrough"),value:"line-through",icon:vl}];function _l({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"},kl.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 yl="typography.__experimentalTextDecoration";function El(e){var t;const{attributes:{style:n},setAttributes:o}=e;return Cl(e)?null:(0,s.createElement)(_l,{value:null==n||null===(t=n.typography)||void 0===t?void 0:t.textDecoration,onChange:function(e){o({style:Go({...n,typography:{...null==n?void 0:n.typography,textDecoration:e}})})}})}function Cl({name:e}={}){const t=!(0,r.hasBlockSupport)(e,yl),n=po("typography.customTextDecorations");return t||!n}var Sl=(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"})),wl=(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"})),Bl=(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 Il=[{name:(0,h.__)("Uppercase"),value:"uppercase",icon:Sl},{name:(0,h.__)("Lowercase"),value:"lowercase",icon:wl},{name:(0,h.__)("Capitalize"),value:"capitalize",icon:Bl}];function xl({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"},Il.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 Tl="typography.__experimentalTextTransform";function Nl(e){var t;const{attributes:{style:n},setAttributes:o}=e;return Pl(e)?null:(0,s.createElement)(xl,{value:null==n||null===(t=n.typography)||void 0===t?void 0:t.textTransform,onChange:function(e){o({style:Go({...n,typography:{...null==n?void 0:n.typography,textTransform:e}})})}})}function Pl({name:e}={}){const t=!(0,r.hasBlockSupport)(e,Tl),n=po("typography.customTextTransforms");return t||!n}function Rl(e){const t=!Cl(e),n=!Pl(e);return t||n?(0,s.createElement)("div",{className:"block-editor-text-decoration-and-transform"},t&&(0,s.createElement)(El,e),n&&(0,s.createElement)(Nl,e)):null}var Ll=window.wp.keycodes;function Ml({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!==Ll.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 Al="typography.lineHeight";function Dl(e){var t;const{attributes:{style:n}}=e;return Ol(e)?null:(0,s.createElement)(Ml,{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:Go(o)})}})}function Ol({name:e}={}){const t=!po("typography.customLineHeight");return!(0,r.hasBlockSupport)(e,Al)||t}const Fl=[{name:(0,h.__)("Regular"),value:"normal"},{name:(0,h.__)("Italic"),value:"italic"}],zl=[{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"}];function Vl(e){const{onChange:t,hasFontStyles:n=!0,hasFontWeights:o=!0,value:{fontStyle:r,fontWeight:l}}=e,i=n||o,a={key:"default",name:(0,h.__)("Default"),style:{fontStyle:void 0,fontWeight:void 0}},c=(0,s.useMemo)((()=>n&&o?(()=>{const e=[a];return Fl.forEach((({name:t,value:n})=>{zl.forEach((({name:o,value:r})=>{const l="normal"===n?o:(0,h.sprintf)(
|
7 |
/* translators: 1: Font weight name. 2: Font style name. */
|
8 |
-
(0,
|
9 |
-
(0,
|
10 |
-
(0,
|
11 |
-
(0,h.__)("Currently selected font weight: %s"),u.name):(0,h.__)("No selected font appearance"),options:c,value:u,onChange:({selectedItem:e})=>t(e.style)}))}const Hl="typography.__experimentalFontStyle",Ul="typography.__experimentalFontWeight";function Gl(e){var t,n;const{attributes:{style:o},setAttributes:r}=e,l=!Wl(e),i=!jl(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)(Vl,{onChange:e=>{r({style:Go({...o,typography:{...null==o?void 0:o.typography,fontStyle:e.fontStyle,fontWeight:e.fontWeight}})})},hasFontStyles:l,hasFontWeights:i,value:{fontStyle:a,fontWeight:c}})}function Wl({name:e}={}){const t=(0,r.hasBlockSupport)(e,Hl),n=po("typography.customFontStyle");return!t||!n}function jl({name:e}={}){const t=(0,r.hasBlockSupport)(e,Ul),n=po("typography.customFontWeight");return!t||!n}function $l(e){const t=Wl(e),n=jl(e);return t&&n}function Kl({value:e="",onChange:t,fontFamilies:n,...o}){const r=po("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 ql="typography.__experimentalFontFamily";function Yl({name:e,setAttributes:t,attributes:{style:n={}}}){var o;const r=po("typography.fontFamilies");if(Zl({name:e}))return null;const l=((e,t)=>{const n=/var:preset\|font-family\|(.+)/.exec(t);if(n&&n[1]){const t=(0,u.find)(e,(({slug:e})=>e===n[1]));if(t)return t.fontFamily}return t})(r,null===(o=n.typography)||void 0===o?void 0:o.fontFamily);return(0,s.createElement)(Kl,{className:"block-editor-hooks-font-family-control",fontFamilies:r,value:l,onChange:function(e){const o=(0,u.find)(r,(({fontFamily:t})=>t===e));t({style:Go({...n,typography:{...n.typography||{},fontFamily:o?`var:preset|font-family|${o.slug}`:e||void 0}})})}})}function Zl({name:e}){const t=po("typography.fontFamilies");return!t||0===t.length||!(0,r.hasBlockSupport)(e,ql)}var Xl=window.wp.tokenList,Ql=n.n(Xl);const Jl=(e,t,n)=>{if(t){const n=(0,u.find)(e,{slug:t});if(n)return n}return{size:n}};function ei(e,t){return(0,u.find)(e,{size:t})||{size:t}}function ti(e){if(e)return`has-${(0,u.kebabCase)(e)}-font-size`}var ni=function(e){const t=po("typography.fontSizes"),n=!po("typography.customFontSize");return(0,s.createElement)(p.FontSizePicker,i({},e,{fontSizes:t,disableCustomFontSizes:n}))};const oi="typography.fontSize";function ri(e,t,n){if(!(0,r.hasBlockSupport)(t,oi))return e;if((0,r.hasBlockSupport)(t,"typography.__experimentalSkipSerialization"))return e;const o=new(Ql())(e.className);o.add(ti(n.fontSize));const l=o.value;return e.className=l||void 0,e}function li(e){var t,n;const{attributes:{fontSize:o,style:r},setAttributes:l}=e,i=ii(e),a=po("typography.fontSizes");if(i)return null;const c=Jl(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)(ni,{onChange:e=>{const t=ei(a,e).slug;l({style:Go({...r,typography:{...null==r?void 0:r.typography,fontSize:t?void 0:e}}),fontSize:t})},value:u})}function ii({name:e}={}){const t=po("typography.fontSizes"),n=!(null==t||!t.length);return!(0,r.hasBlockSupport)(e,oi)||!n}const si=(0,d.createHigherOrderComponent)((e=>t=>{var n,o;const l=po("typography.fontSizes"),{name:i,attributes:{fontSize:a,style:c},wrapperProps:u}=t;if(!(0,r.hasBlockSupport)(i,oi)||(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=Jl(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 ai({value:e,onChange:t}){const n=(0,p.__experimentalUseCustomUnits)({availableUnits:po("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:"60px",units:n,onChange:t})}(0,l.addFilter)("blocks.registerBlockType","core/font/addAttribute",(function(e){return(0,r.hasBlockSupport)(e,oi)?(e.attributes.fontSize||Object.assign(e.attributes,{fontSize:{type:"string"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/font/addSaveProps",ri),(0,l.addFilter)("blocks.registerBlockType","core/font/addEditProps",(function(e){if(!(0,r.hasBlockSupport)(e,oi))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),ri(o,e,n)},e})),(0,l.addFilter)("editor.BlockListBlock","core/font-size/with-font-size-inline-styles",si);const ci="typography.__experimentalLetterSpacing";function ui(e){var t;const{attributes:{style:n},setAttributes:o}=e;return di(e)?null:(0,s.createElement)(ai,{value:null==n||null===(t=n.typography)||void 0===t?void 0:t.letterSpacing,onChange:function(e){o({style:Go({...n,typography:{...null==n?void 0:n.typography,letterSpacing:e}})})}})}function di({name:e}={}){const t=!(0,r.hasBlockSupport)(e,ci),n=po("typography.customLetterSpacing");return t||!n}const pi=[Al,oi,Hl,Ul,ql,yl,Tl,ci];function mi(e){const t=function(e={}){const t=[$l(e),ii(e),Ol(e),Zl(e),Cl(e),Pl(e),di(e)];return t.filter(Boolean).length===t.length}(e),n=fi(e.name);return t||!n?null:(0,s.createElement)(qo,null,(0,s.createElement)(p.PanelBody,{title:(0,h.__)("Typography")},(0,s.createElement)(Yl,e),(0,s.createElement)(li,e),(0,s.createElement)(Gl,e),(0,s.createElement)(Dl,e),(0,s.createElement)(Rl,e),(0,s.createElement)(ui,e)))}const fi=e=>pi.some((t=>(0,r.hasBlockSupport)(e,t)));function hi(e){const t=(0,r.getBlockSupport)(e,Si);return!!(!0===t||null!=t&&t.blockGap)}function gi({name:e}={}){const t=!po("spacing.blockGap");return!hi(e)||t}function bi(e){var t;const{clientId:n,attributes:{style:o},setAttributes:r}=e,l=(0,p.__experimentalUseCustomUnits)({availableUnits:po("spacing.units")||["%","px","em","rem","vw"]}),i=rl(n);return gi(e)?null:s.Platform.select({web:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.__experimentalUnitControl,{label:(0,h.__)("Block gap"),min:0,onChange:e=>{var t;const n={...o,spacing:{...null==o?void 0:o.spacing,blockGap:e}};r({style:Go(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 vi(e){const t=(0,r.getBlockSupport)(e,Si);return!!(!0===t||null!=t&&t.margin)}function ki({name:e}={}){const t=!po("spacing.customMargin"),n=!Ni(e,"margin");return!vi(e)||t||n}function _i(e){var t;const{name:n,attributes:{style:o},setAttributes:r}=e,l=(0,p.__experimentalUseCustomUnits)({availableUnits:po("spacing.units")||["%","px","em","rem","vw"]}),i=Ti(n,"margin"),a=i&&i.some((e=>Bi.includes(e)));return ki(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:Go(t)})},onChangeShowVisualizer:e=>{const t={...o,visualizers:{margin:e}};r({style:Go(t)})},label:(0,h.__)("Margin"),sides:i,units:l,allowReset:!1,splitOnAxis:a})),native:null})}function yi(e){const t=(0,r.getBlockSupport)(e,Si);return!!(!0===t||null!=t&&t.padding)}function Ei({name:e}={}){const t=!po("spacing.customPadding"),n=!Ni(e,"padding");return!yi(e)||t||n}function Ci(e){var t;const{name:n,attributes:{style:o},setAttributes:r}=e,l=(0,p.__experimentalUseCustomUnits)({availableUnits:po("spacing.units")||["%","px","em","rem","vw"]}),i=Ti(n,"padding"),a=i&&i.some((e=>Bi.includes(e)));return Ei(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:Go(t)})},onChangeShowVisualizer:e=>{const t={...o,visualizers:{padding:e}};r({style:Go(t)})},label:(0,h.__)("Padding"),sides:i,units:l,allowReset:!1,splitOnAxis:a})),native:null})}const Si="spacing",wi=["top","right","bottom","left"],Bi=["vertical","horizontal"];function Ii(e){const t=gi(e),n=Ei(e),o=ki(e),l=xi(e),i=(a=e.name,"web"===s.Platform.OS&&(hi(a)||yi(a)||vi(a)));var a;if(l||!i)return null;const c=(0,r.getBlockSupport)(e.name,[Si,"__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)(qo,{__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:Go({...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)(Ci,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:Go({...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)(_i,e)),!t&&(0,s.createElement)(p.__experimentalToolsPanelItem,{className:"single-column",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 gap"),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)(bi,e)))}const xi=(e={})=>{const t=gi(e),n=Ei(e),o=ki(e);return t&&n&&o};function Ti(e,t){const n=(0,r.getBlockSupport)(e,Si);if(n&&"boolean"!=typeof n[t])return n[t]}function Ni(e,t){const n=Ti(e,t);return!(n&&n.some((e=>wi.includes(e)))&&n.some((e=>Bi.includes(e)))&&(console.warn(`The ${t} support for the "${e}" block can not be configured to support both axial and arbitrary sides.`),1))}const Pi=[...pi,Hr,al,Si],Ri=e=>Pi.some((t=>(0,r.hasBlockSupport)(e,t))),Li="var:";function Mi(e){return(0,u.startsWith)(e,Li)?`var(--wp--${e.slice(Li.length).split("|").join("--")})`:e}function Ai(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]=Mi(l))})):t[n]=Mi((0,u.get)(e,o))}})),t}const Di={"__experimentalBorder.__experimentalSkipSerialization":["border"],"color.__experimentalSkipSerialization":[al],"typography.__experimentalSkipSerialization":["typography"],[`${Si}.__experimentalSkipSerialization`]:["spacing"]},Oi={...Di,[`${Si}`]:["spacing.blockGap"]};function Fi(e,t,n,o=Oi){if(!Ri(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={...Ai(l),...e.style},e}const zi=(0,d.createHigherOrderComponent)((e=>t=>{const n=qn();return(0,s.createElement)(s.Fragment,null,n&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(mi,t),(0,s.createElement)(Ur,t),(0,s.createElement)(hl,t),(0,s.createElement)(Ii,t)),(0,s.createElement)(e,t))}),"withToolbarControls"),Vi=(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=Ai(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);return(0,s.createElement)(s.Fragment,null,l&&(0,s.createElement)("style",{dangerouslySetInnerHTML:{__html:p}}),(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 Ri(e)?(e.attributes.style||Object.assign(e.attributes,{style:{type:"object"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/style/addSaveProps",Fi),(0,l.addFilter)("blocks.registerBlockType","core/style/addEditProps",(function(e){if(!Ri(e))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),Fi(o,e,n,Di)},e})),(0,l.addFilter)("editor.BlockEdit","core/style/with-block-controls",zi),(0,l.addFilter)("editor.BlockListBlock","core/editor/with-elements-styles",Vi);var Hi=function({value:e,onChange:t,onToggle:n,duotonePalette:o,colorPalette:r,disableCustomColors:l,disableCustomDuotone:i}){return(0,s.createElement)(p.Popover,{className:"block-editor-duotone-control__popover",headerTitle:(0,h.__)("Duotone"),onFocusOutside:n},(0,s.createElement)(p.MenuGroup,{label:(0,h.__)("Duotone")},(0,s.createElement)(p.DuotonePicker,{colorPalette:r,duotonePalette:o,disableCustomColors:l,disableCustomDuotone:i,value:e,onChange:t})))},Ui=function({colorPalette:e,duotonePalette:t,disableCustomColors:n,disableCustomDuotone:o,value:r,onChange:l}){const[i,a]=(0,s.useState)(!1),c=()=>{a((e=>!e))};return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.ToolbarButton,{showTooltip:!0,onClick:c,"aria-haspopup":"true","aria-expanded":i,onKeyDown:e=>{i||e.keyCode!==Ll.DOWN||(e.preventDefault(),c())},label:(0,h.__)("Apply duotone filter"),icon:(0,s.createElement)(p.DuotoneSwatch,{values:r})}),i&&(0,s.createElement)(Hi,{value:r,onChange:l,onToggle:c,duotonePalette:t,colorPalette:e,disableCustomColors:n,disableCustomDuotone:o}))},Gi=window.wp.dom;const Wi=(0,s.createContext)({});function ji({value:e,children:t}){const n=(0,s.useContext)(Wi),o=(0,s.useMemo)((()=>({...n,...e})),[n,e]);return(0,s.createElement)(Wi.Provider,{value:o,children:t})}var $i=Wi;const Ki={};var qi=(0,p.withFilters)("editor.BlockEdit")((e=>{const{attributes:t={},name:n}=e,o=(0,r.getBlockType)(n),l=(0,s.useContext)($i),a=(0,s.useMemo)((()=>o&&o.usesContext?(0,u.pick)(l,o.usesContext):Ki),[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 Yi(e){const{name:t,isSelected:n,clientId:o}=e,r={name:t,isSelected:n,clientId:o};return(0,s.createElement)($n,{value:(0,s.useMemo)((()=>r),Object.values(r))},(0,s.createElement)(qi,e))}var Zi=(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"})),Xi=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:Zi,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)))))))))},Qi=n(7630);function Ji({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,Gi.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 es=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,Qi.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)(Ji,{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)(Ji,{title:(0,h.__)("After Conversion"),className:"block-editor-block-compare__converted",action:n,actionText:l,rawContent:d,renderedContent:i}))};const ts=e=>(0,r.rawHandler)({HTML:e.originalContent});var ns=(0,d.compose)([(0,m.withSelect)(((e,{clientId:t})=>({block:e(Gn).getBlock(t)}))),(0,m.withDispatch)(((e,{block:t})=>{const{replaceBlock:n}=e(Gn);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,ts(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)((()=>[{
|
12 |
// translators: Button to fix block content
|
13 |
-
title:(0,
|
14 |
-
(0,h.__)("Resolve Block"),onRequestClose:d,className:"block-editor-block-compare"},(0,s.createElement)(es,{block:l,onKeep:e,onConvert:t,convertor:ts,convertButtonText:(0,h.__)("Convert to Blocks")})))}));const os=(0,s.createElement)(Xi,{className:"block-editor-block-list__block-crash-warning"},(0,h.__)("This block has encountered an error and cannot be previewed."));var rs=()=>os;class ls 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 is=ls,ss=n(4042),as=function({clientId:e}){const[t,n]=(0,s.useState)(""),o=(0,m.useSelect)((t=>t(Gn).getBlock(e)),[e]),{updateBlock:l}=(0,m.useDispatch)(Gn);return(0,s.useEffect)((()=>{n((0,r.getBlockContent)(o))}),[o]),(0,s.createElement)(ss.Z,{className:"block-editor-block-list__block-html-textarea",value:t,onBlur:()=>{const i=(0,r.getBlockType)(o.name),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 cs=Ss();const us=e=>_s(e,cs);let ds=Ss();us.write=e=>_s(e,ds);let ps=Ss();us.onStart=e=>_s(e,ps);let ms=Ss();us.onFrame=e=>_s(e,ms);let fs=Ss();us.onFinish=e=>_s(e,fs);let hs=[];us.setTimeout=(e,t)=>{let n=us.now()+t,o=()=>{let e=hs.findIndex((e=>e.cancel==o));~e&&hs.splice(e,1),Bs.count-=~e?1:0},r={time:n,handler:e,cancel:o};return hs.splice(gs(n),0,r),Bs.count+=1,ys(),r};let gs=e=>~(~hs.findIndex((t=>t.time>e))||~hs.length);us.cancel=e=>{cs.delete(e),ds.delete(e)},us.sync=e=>{ks=!0,us.batchedUpdates(e),ks=!1},us.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function o(...e){t=e,us.onStart(n)}return o.handler=e,o.cancel=()=>{ps.delete(n),t=null},o};let bs="undefined"!=typeof window?window.requestAnimationFrame:()=>{};us.use=e=>bs=e,us.now="undefined"!=typeof performance?()=>performance.now():Date.now,us.batchedUpdates=e=>e(),us.catch=console.error,us.frameLoop="always",us.advance=()=>{"demand"!==us.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):Cs()};let vs=-1,ks=!1;function _s(e,t){ks?(t.delete(e),e(0)):(t.add(e),ys())}function ys(){vs<0&&(vs=0,"demand"!==us.frameLoop&&bs(Es))}function Es(){~vs&&(bs(Es),us.batchedUpdates(Cs))}function Cs(){let e=vs;vs=us.now();let t=gs(vs);t&&(ws(hs.splice(0,t),(e=>e.handler())),Bs.count-=t),ps.flush(),cs.flush(e?Math.min(64,vs-e):16.667),ms.flush(),ds.flush(),fs.flush()}function Ss(){let e=new Set,t=e;return{add(n){Bs.count+=t!=e||e.has(n)?0:1,e.add(n)},delete:n=>(Bs.count-=t==e&&e.has(n)?1:0,e.delete(n)),flush(n){t.size&&(e=new Set,Bs.count-=t.size,ws(t,(t=>t(n)&&e.add(t))),Bs.count+=e.size,t=e)}}}function ws(e,t){e.forEach((e=>{try{t(e)}catch(e){us.catch(e)}}))}const Bs={count:0,clear(){vs=-1,hs=[],ps=Ss(),cs=Ss(),ms=Ss(),ds=Ss(),fs=Ss(),Bs.count=0}};var Is=n(3804),xs=n.n(Is);function Ts(){}const Ns={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 Ps(e,t){if(Ns.arr(e)){if(!Ns.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 Rs=(e,t)=>e.forEach(t);function Ls(e,t,n){for(const o in e)e.hasOwnProperty(o)&&t.call(n,e[o],o)}const Ms=e=>Ns.und(e)?[]:Ns.arr(e)?e:[e];function As(e,t){if(e.size){const n=Array.from(e);e.clear(),Rs(n,t)}}const Ds=(e,...t)=>As(e,(e=>e(...t)));let Os,Fs,zs=null,Vs=!1,Hs=Ts;var Us=Object.freeze({__proto__:null,get createStringInterpolator(){return Os},get to(){return Fs},get colors(){return zs},get skipAnimation(){return Vs},get willAdvance(){return Hs},assign:e=>{e.to&&(Fs=e.to),e.now&&(us.now=e.now),void 0!==e.colors&&(zs=e.colors),null!=e.skipAnimation&&(Vs=e.skipAnimation),e.createStringInterpolator&&(Os=e.createStringInterpolator),e.requestAnimationFrame&&us.use(e.requestAnimationFrame),e.batchedUpdates&&(us.batchedUpdates=e.batchedUpdates),e.willAdvance&&(Hs=e.willAdvance),e.frameLoop&&(us.frameLoop=e.frameLoop)}});const Gs=new Set;let Ws=[],js=[],$s=0;const Ks={get idle(){return!Gs.size&&!Ws.length},start(e){$s>e.priority?(Gs.add(e),us.onStart(qs)):(Ys(e),us(Xs))},advance:Xs,sort(e){if($s)us.onFrame((()=>Ks.sort(e)));else{const t=Ws.indexOf(e);~t&&(Ws.splice(t,1),Zs(e))}},clear(){Ws=[],Gs.clear()}};function qs(){Gs.forEach(Ys),Gs.clear(),us(Xs)}function Ys(e){Ws.includes(e)||Zs(e)}function Zs(e){Ws.splice(function(t,n){const o=t.findIndex((t=>t.priority>e.priority));return o<0?t.length:o}(Ws),0,e)}function Xs(e){const t=js;for(let n=0;n<Ws.length;n++){const o=Ws[n];$s=o.priority,o.idle||(Hs(o),o.advance(e),o.idle||t.push(o))}return $s=0,js=Ws,js.length=0,Ws=t,Ws.length>0}const Qs="[-+]?\\d*\\.?\\d+",Js=Qs+"%";function ea(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}const ta=new RegExp("rgb"+ea(Qs,Qs,Qs)),na=new RegExp("rgba"+ea(Qs,Qs,Qs,Qs)),oa=new RegExp("hsl"+ea(Qs,Js,Js)),ra=new RegExp("hsla"+ea(Qs,Js,Js,Qs)),la=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ia=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,sa=/^#([0-9a-fA-F]{6})$/,aa=/^#([0-9a-fA-F]{8})$/;function ca(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 ua(e,t,n){const o=n<.5?n*(1+t):n+t-n*t,r=2*n-o,l=ca(r,o,e+1/3),i=ca(r,o,e),s=ca(r,o,e-1/3);return Math.round(255*l)<<24|Math.round(255*i)<<16|Math.round(255*s)<<8}function da(e){const t=parseInt(e,10);return t<0?0:t>255?255:t}function pa(e){return(parseFloat(e)%360+360)%360/360}function ma(e){const t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function fa(e){const t=parseFloat(e);return t<0?0:t>100?1:t/100}function ha(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=sa.exec(e))?parseInt(t[1]+"ff",16)>>>0:zs&&void 0!==zs[e]?zs[e]:(t=ta.exec(e))?(da(t[1])<<24|da(t[2])<<16|da(t[3])<<8|255)>>>0:(t=na.exec(e))?(da(t[1])<<24|da(t[2])<<16|da(t[3])<<8|ma(t[4]))>>>0:(t=la.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=aa.exec(e))?parseInt(t[1],16)>>>0:(t=ia.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=oa.exec(e))?(255|ua(pa(t[1]),fa(t[2]),fa(t[3])))>>>0:(t=ra.exec(e))?(ua(pa(t[1]),fa(t[2]),fa(t[3]))|ma(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 ga=(e,t,n)=>{if(Ns.fun(e))return e;if(Ns.arr(e))return ga({range:e,output:t,extrapolate:n});if(Ns.str(e.output[0]))return Os(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 ba(){return(ba=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 va=Symbol.for("FluidValue.get"),ka=Symbol.for("FluidValue.observers"),_a=e=>Boolean(e&&e[va]),ya=e=>e&&e[va]?e[va]():e,Ea=e=>e[ka]||null;function Ca(e,t){let n=e[ka];n&&n.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}class Sa{constructor(e){if(this[va]=void 0,this[ka]=void 0,!e&&!(e=this.get))throw Error("Unknown getter");wa(this,e)}}const wa=(e,t)=>xa(e,va,t);function Ba(e,t){if(e[va]){let n=e[ka];n||xa(e,ka,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function Ia(e,t){let n=e[ka];if(n&&n.has(t)){const o=n.size-1;o?n.delete(t):e[ka]=null,e.observerRemoved&&e.observerRemoved(o,t)}}const xa=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),Ta=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,Na=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi;let Pa;const Ra=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,La=(e,t,n,o,r)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(o)}, ${r})`,Ma=e=>{Pa||(Pa=zs?new RegExp(`(${Object.keys(zs).join("|")})(?!\\w)`,"g"):/^\b$/);const t=e.output.map((e=>ya(e).replace(Na,ha).replace(Pa,ha))),n=t.map((e=>e.match(Ta).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=>ga(ba({},e,{output:t}))));return e=>{let n=0;return t[0].replace(Ta,(()=>String(o[n++](e)))).replace(Ra,La)}},Aa="react-spring: ",Da=e=>{const t=e;let n=!1;if("function"!=typeof t)throw new TypeError(`${Aa}once requires a function parameter`);return(...e)=>{n||(t(...e),n=!0)}},Oa=Da(console.warn),Fa=Da(console.warn);function za(e){return Ns.str(e)&&("#"==e[0]||/\d/.test(e)||e in(zs||{}))}const Va=e=>(0,Is.useEffect)(e,Ha),Ha=[];function Ua(){const e=(0,Is.useState)()[1],t=(0,Is.useState)(Ga)[0];return Va(t.unmount),()=>{t.current&&e({})}}function Ga(){const e={current:!0,unmount:()=>()=>{e.current=!1}};return e}function Wa(e){const t=(0,Is.useRef)();return(0,Is.useEffect)((()=>{t.current=e})),t.current}const ja="undefined"!=typeof window&&window.document&&window.document.createElement?Is.useLayoutEffect:Is.useEffect,$a=Symbol.for("Animated:node"),Ka=e=>e&&e[$a],qa=(e,t)=>{return n=e,o=$a,r=t,Object.defineProperty(n,o,{value:r,writable:!0,configurable:!0});var n,o,r},Ya=e=>e&&e[$a]&&e[$a].getPayload();class Za{constructor(){this.payload=void 0,qa(this,this)}getPayload(){return this.payload||[]}}class Xa extends Za{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,Ns.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new Xa(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Ns.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,Ns.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}}class Qa extends Xa{constructor(e){super(0),this._string=null,this._toString=void 0,this._toString=ga({output:[e,e]})}static create(e){return new Qa(e)}getValue(){let e=this._string;return null==e?this._string=this._toString(this._value):e}setValue(e){if(Ns.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=ga({output:[this.getValue(),e]})),this._value=0,super.reset()}}const Ja={dependencies:null};class ec extends Za{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return Ls(this.source,((n,o)=>{var r;(r=n)&&r[$a]===r?t[o]=n.getValue(e):_a(n)?t[o]=ya(n):e||(t[o]=n)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&Rs(this.payload,(e=>e.reset()))}_makePayload(e){if(e){const t=new Set;return Ls(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Ja.dependencies&&_a(e)&&Ja.dependencies.add(e);const t=Ya(e);t&&Rs(t,(e=>this.add(e)))}}class tc extends ec{constructor(e){super(e)}static create(e){return new tc(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(nc)),!0)}}function nc(e){return(za(e)?Qa:Xa).create(e)}function oc(e){const t=Ka(e);return t?t.constructor:Ns.arr(e)?tc:za(e)?Qa:Xa}function rc(){return(rc=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 lc=(e,t)=>{const n=!Ns.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,Is.forwardRef)(((o,r)=>{const l=(0,Is.useRef)(null),i=n&&(0,Is.useCallback)((e=>{l.current=function(e,t){return e&&(Ns.fun(e)?e(t):e.current=t),t}(r,e)}),[r]),[s,a]=function(e,t){const n=new Set;return Ja.dependencies=n,e.style&&(e=rc({},e,{style:t.createAnimatedStyle(e.style)})),e=new ec(e),Ja.dependencies=null,[e,n]}(o,t),c=Ua(),u=()=>{const e=l.current;n&&!e||!1===(!!e&&t.applyAnimatedValues(e,s.getValue(!0)))&&c()},d=new ic(u,a),p=(0,Is.useRef)();ja((()=>{const e=p.current;p.current=d,Rs(a,(e=>Ba(e,d))),e&&(Rs(e.deps,(t=>Ia(t,e))),us.cancel(e.update))})),(0,Is.useEffect)(u,[]),Va((()=>()=>{const e=p.current;Rs(e.deps,(t=>Ia(t,e)))}));const m=t.getComponentProps(s.getValue());return Is.createElement(e,rc({},m,{ref:i}))}))};class ic{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&us.write(this.update)}}const sc=Symbol.for("AnimatedComponent"),ac=e=>Ns.str(e)?e:e&&Ns.str(e.displayName)?e.displayName:Ns.fun(e)&&e.name||null;function cc(){return(cc=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 uc(e,...t){return Ns.fun(e)?e(...t):e}const dc=(e,t)=>!0===e||!!(t&&e&&(Ns.fun(e)?e(t):Ms(e).includes(t))),pc=(e,t)=>Ns.obj(e)?t&&e[t]:e,mc=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,fc=e=>e,hc=(e,t=fc)=>{let n=gc;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);Ns.und(n)||(o[r]=n)}return o},gc=["config","onProps","onStart","onChange","onPause","onResume","onRest"],bc={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 vc(e){const t=function(e){const t={};let n=0;if(Ls(e,((e,o)=>{bc[o]||(t[o]=e,n++)})),n)return t}(e);if(t){const n={to:t};return Ls(e,((e,o)=>o in t||(n[o]=e))),n}return cc({},e)}function kc(e){return e=ya(e),Ns.arr(e)?e.map(kc):za(e)?Us.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function _c(e){for(const t in e)return!0;return!1}function yc(e){return Ns.fun(e)||Ns.arr(e)&&Ns.obj(e[0])}function Ec(e,t){var n;null==(n=e.ref)||n.delete(e),null==t||t.delete(e)}function Cc(e,t){var n;t&&e.ref!==t&&(null==(n=e.ref)||n.delete(e),t.add(e),e.ref=t)}const Sc=cc({},{tension:170,friction:26},{mass:1,damping:1,easing:e=>e,clamp:!1});class wc{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,Sc)}}function Bc(e,t){if(Ns.und(t.decay)){const n=!Ns.und(t.tension)||!Ns.und(t.friction);!n&&Ns.und(t.frequency)&&Ns.und(t.damping)&&Ns.und(t.mass)||(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}else e.duration=void 0}const Ic=[];class xc{constructor(){this.changed=!1,this.values=Ic,this.toValues=null,this.fromValues=Ic,this.to=void 0,this.from=void 0,this.config=new wc,this.immediate=!1}}function Tc(e,{key:t,props:n,defaultProps:o,state:r,actions:l}){return new Promise(((i,s)=>{var a;let c,u,d=dc(null!=(a=n.cancel)?a:null==o?void 0:o.cancel,t);if(d)f();else{Ns.und(n.pause)||(r.paused=dc(n.pause,t));let e=null==o?void 0:o.pause;!0!==e&&(e=r.paused||dc(e,t)),c=uc(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-us.now()}function m(){c>0?(u=us.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(cc({},n,{callId:e,cancel:d}),i)}catch(e){s(e)}}}))}const Nc=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?Lc(e.get()):t.every((e=>e.noop))?Pc(e.get()):Rc(e.get(),t.every((e=>e.finished))),Pc=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),Rc=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),Lc=e=>({value:e,cancelled:!0,finished:!1});function Mc(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=hc(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)&&Lc(o)||r!==n.asyncId&&Rc(o,!1);if(t)throw e.result=t,d(e),e},f=(e,t)=>{const l=new Dc,i=new Oc;return(async()=>{if(Us.skipAnimation)throw Ac(n),i.result=Rc(o,!1),d(i),i;m(l);const s=Ns.obj(e)?cc({},e):cc({},t,{to:e});s.parentId=r,Ls(c,((e,t)=>{Ns.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(Us.skipAnimation)return Ac(n),Rc(o,!1);try{let t;t=Ns.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=Rc(o.get(),!0,!1)}catch(e){if(e instanceof Dc)h=e.result;else{if(!(e instanceof Oc))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 Ns.fun(i)&&us.batchedUpdates((()=>{i(h,o,o.item)})),h})():a}function Ac(e,t){As(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}class Dc 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 Oc extends Error{constructor(){super("SkipAnimationSignal"),this.result=void 0}}const Fc=e=>e instanceof Vc;let zc=1;class Vc extends Sa{constructor(...e){super(...e),this.id=zc++,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=Ka(this);return e&&e.getValue()}to(...e){return Us.to(this,e)}interpolate(...e){return Oa(`${Aa}The "interpolate" function is deprecated in v9 (use "to" instead)`),Us.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){Ca(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||Ks.sort(this),Ca(this,{type:"priority",parent:this,priority:e})}}const Hc=Symbol.for("SpringPhase"),Uc=e=>(1&e[Hc])>0,Gc=e=>(2&e[Hc])>0,Wc=e=>(4&e[Hc])>0,jc=(e,t)=>t?e[Hc]|=3:e[Hc]&=-3,$c=(e,t)=>t?e[Hc]|=4:e[Hc]&=-5;class Kc extends Vc{constructor(e,t){if(super(),this.key=void 0,this.animation=new xc,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,!Ns.und(e)||!Ns.und(t)){const n=Ns.obj(e)?cc({},e):cc({},t,{from:e});Ns.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(Gc(this)||this._state.asyncTo)||Wc(this)}get goal(){return ya(this.animation.to)}get velocity(){const e=Ka(this);return e instanceof Xa?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return Uc(this)}get isAnimating(){return Gc(this)}get isPaused(){return Wc(this)}advance(e){let t=!0,n=!1;const o=this.animation;let{config:r,toValues:l}=o;const i=Ya(o.to);!i&&_a(o.to)&&(l=Ms(ya(o.to))),o.values.forEach(((s,a)=>{if(s.done)return;const c=s.constructor==Qa?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=Ns.arr(r.velocity)?r.velocity[a]:r.velocity;let i;if(Ns.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=!Ns.und(a),m=n==c?s.v0>0:n<c;let f,h=!1;const g=1,b=Math.ceil(e/g);for(let e=0;e<b&&(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=Ka(this),a=s.getValue();if(t){const e=ya(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 us.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(Gc(this)){const{to:e,config:t}=this.animation;us.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 Ns.und(e)?(n=this.queue||[],this.queue=[]):n=[Ns.obj(e)?e:cc({},t,{to:e})],Promise.all(n.map((e=>this._update(e)))).then((e=>Nc(this,e)))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),Ac(this._state,e&&this._lastCallId),us.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=Ns.obj(n)?n[t]:n,(null==n||yc(n))&&(n=void 0),o=Ns.obj(o)?o[t]:o,null==o&&(o=void 0);const r={to:n,from:o};return Uc(this)||(e.reverse&&([n,o]=[o,n]),o=ya(o),Ns.und(o)?Ka(this)||this._set(n):this._set(o)),r}_update(e,t){let n=cc({},e);const{key:o,defaultProps:r}=this;n.default&&Object.assign(r,hc(n,((e,t)=>/^on/.test(t)?pc(e,o):e))),eu(this,n,"onProps"),tu(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 Tc(++this._lastCallId,{key:o,props:n,defaultProps:r,state:i,actions:{pause:()=>{Wc(this)||($c(this,!0),Ds(i.pauseQueue),tu(this,"onPause",Rc(this,qc(this,this.animation.to)),this))},resume:()=>{Wc(this)&&($c(this,!1),Gc(this)&&this._resume(),Ds(i.resumeQueue),tu(this,"onResume",Rc(this,qc(this,this.animation.to)),this))},start:this._merge.bind(this,l)}}).then((e=>{if(n.loop&&e.finished&&(!t||!e.noop)){const e=Yc(n);if(e)return this._update(e,!0)}return e}))}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(Lc(this));const o=!Ns.und(e.to),r=!Ns.und(e.from);if(o||r){if(!(t.callId>this._lastToId))return n(Lc(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&&!Ns.und(u)||(u=d),t.reverse&&([u,d]=[d,u]);const p=!Ps(d,c);p&&(s.from=d),d=ya(d);const m=!Ps(u,a);m&&this._focus(u);const f=yc(t.to),{config:h}=s,{decay:g,velocity:b}=h;(o||r)&&(h.velocity=0),t.config&&!f&&function(e,t,n){n&&(Bc(n=cc({},n),t),t=cc({},n,t)),Bc(e,t),Object.assign(e,t);for(const t in Sc)null==e[t]&&(e[t]=Sc[t]);let{mass:o,frequency:r,damping:l}=e;Ns.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,uc(t.config,l),t.config!==i.config?uc(i.config,l):void 0);let v=Ka(this);if(!v||Ns.und(u))return n(Rc(this,!0));const k=Ns.und(t.reset)?r&&!t.default:!Ns.und(d)&&dc(t.reset,l),_=k?d:this.get(),y=kc(u),E=Ns.num(y)||Ns.arr(y)||za(y),C=!f&&(!E||dc(i.immediate||t.immediate,l));if(m){const e=oc(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=_a(u),B=!1;if(!w){const e=k||!Uc(this)&&p;(m||e)&&(B=Ps(kc(_),y),w=!B),(Ps(s.immediate,C)||C)&&Ps(h.decay,g)&&Ps(h.velocity,b)||(w=!0)}if(B&&Gc(this)&&(s.changed&&!k?w=!0:w||this._stop(a)),!f&&((w||_a(a))&&(s.values=v.getPayload(),s.toValues=_a(u)?null:S==Qa?[1]:Ms(y)),s.immediate!=C&&(s.immediate=C,C||k||this._set(a)),w)){const{onRest:e}=s;Rs(Jc,(e=>eu(this,t,e)));const o=Rc(this,qc(this,a));Ds(this._pendingCalls,o),this._pendingCalls.add(n),s.changed&&us.batchedUpdates((()=>{s.changed=!k,null==e||e(o,this),k?uc(i.onRest,o):null==s.onStart||s.onStart(o,this)}))}k&&this._set(_),f?n(Mc(t.to,t,this._state,this)):w?this._start():Gc(this)&&!m?this._pendingCalls.add(n):n(Pc(_))}_focus(e){const t=this.animation;e!==t.to&&(Ea(this)&&this._detach(),t.to=e,Ea(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;_a(t)&&(Ba(t,this),Fc(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;_a(e)&&Ia(e,this)}_set(e,t=!0){const n=ya(e);if(!Ns.und(n)){const e=Ka(this);if(!e||!Ps(n,e.getValue())){const o=oc(n);e&&e.constructor==o?e.setValue(n):qa(this,o.create(n)),e&&us.batchedUpdates((()=>{this._onChange(n,t)}))}}return Ka(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,tu(this,"onStart",Rc(this,qc(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),uc(this.animation.onChange,e,this)),uc(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;Ka(this).reset(ya(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),Gc(this)||(jc(this,!0),Wc(this)||this._resume())}_resume(){Us.skipAnimation?this.finish():Ks.start(this)}_stop(e,t){if(Gc(this)){jc(this,!1);const n=this.animation;Rs(n.values,(e=>{e.done=!0})),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Ca(this,{type:"idle",parent:this});const o=t?Lc(this.get()):Rc(this.get(),qc(this,null!=e?e:n.to));Ds(this._pendingCalls,o),n.changed&&(n.changed=!1,tu(this,"onRest",o,this))}}}function qc(e,t){const n=kc(t);return Ps(kc(e.get()),n)}function Yc(e,t=e.loop,n=e.to){let o=uc(t);if(o){const r=!0!==o&&vc(o),l=(r||e).reverse,i=!r||r.reset;return Zc(cc({},e,{loop:t,default:!1,pause:void 0,to:!l||yc(n)?n:void 0,from:i?e.from:void 0,reset:i},r))}}function Zc(e){const{to:t,from:n}=e=vc(e),o=new Set;return Ns.obj(t)&&Qc(t,o),Ns.obj(n)&&Qc(n,o),e.keys=o.size?Array.from(o):null,e}function Xc(e){const t=Zc(e);return Ns.und(t.default)&&(t.default=hc(t)),t}function Qc(e,t){Ls(e,((e,n)=>null!=e&&t.add(n)))}const Jc=["onStart","onRest","onChange","onPause","onResume"];function eu(e,t,n){e.animation[n]=t[n]!==mc(t,n)?pc(t[n],e.key):void 0}function tu(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 nu=["onStart","onChange","onRest"];let ou=1;class ru{constructor(e,t){this.id=ou++,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(cc({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];Ns.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(Zc(e)),this}start(e){let{queue:t}=this;return e?t=Ms(e).map(Zc):this.queue=[],this._flush?this._flush(this,t):(du(this,t),lu(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;Rs(Ms(t),(t=>n[t].stop(!!e)))}else Ac(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(Ns.und(e))this.start({pause:!0});else{const t=this.springs;Rs(Ms(e),(e=>t[e].pause()))}return this}resume(e){if(Ns.und(e))this.start({pause:!1});else{const t=this.springs;Rs(Ms(e),(e=>t[e].resume()))}return this}each(e){Ls(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,As(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&&As(t,(([e,t])=>{t.value=i,e(t,this,this._item)})),l&&(this._started=!1,As(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)}us.onFrame(this._onFrame)}}function lu(e,t){return Promise.all(t.map((t=>iu(e,t)))).then((t=>Nc(e,t)))}async function iu(e,t,n){const{keys:o,to:r,from:l,loop:i,onRest:s,onResolve:a}=t,c=Ns.obj(t.default)&&t.default;i&&(t.loop=!1),!1===r&&(t.to=null),!1===l&&(t.from=null);const u=Ns.arr(r)||Ns.fun(r)?r:void 0;u?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):Rs(nu,(n=>{const o=t[n];if(Ns.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,Ds(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===mc(t,"cancel");(u||m&&d.asyncId)&&p.push(Tc(++e._lastAsyncId,{props:t,state:d,actions:{pause:Ts,resume:Ts,start(t,n){m?(Ac(d,e._lastAsyncId),n(Lc(e))):(t.onRest=s,n(Mc(u,t,d,e)))}}})),d.paused&&await new Promise((e=>{d.resumeQueue.add(e)}));const f=Nc(e,await Promise.all(p));if(i&&f.finished&&(!n||!f.noop)){const n=Yc(t,i,r);if(n)return du(e,[n]),iu(e,n,!0)}return a&&us.batchedUpdates((()=>a(f,e,e.item))),f}function su(e,t){const n=cc({},e.springs);return t&&Rs(Ms(t),(e=>{Ns.und(e.keys)&&(e=Zc(e)),Ns.obj(e.to)||(e=cc({},e,{to:void 0})),uu(n,e,(e=>cu(e)))})),au(e,n),n}function au(e,t){Ls(t,((t,n)=>{e.springs[n]||(e.springs[n]=t,Ba(t,e))}))}function cu(e,t){const n=new Kc;return n.key=e,t&&Ba(n,t),n}function uu(e,t,n){t.keys&&Rs(t.keys,(o=>{(e[o]||(e[o]=n(o)))._prepareNode(t)}))}function du(e,t){Rs(t,(t=>{uu(e.springs,t,(t=>cu(t,e)))}))}const pu=["children"],mu=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,pu);const o=(0,Is.useContext)(fu),r=n.pause||!!o.pause,l=n.immediate||!!o.immediate;n=function(e,t){const[n]=(0,Is.useState)((()=>({inputs:t,result:e()}))),o=(0,Is.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,Is.useEffect)((()=>{o.current=l,r==n&&(n.inputs=n.result=void 0)}),[l]),l.result}((()=>({pause:r,immediate:l})),[r,l]);const{Provider:i}=fu;return Is.createElement(i,{value:n},t)},fu=(hu=mu,gu={},Object.assign(hu,Is.createContext(gu)),hu.Provider._context=hu,hu.Consumer._context=hu,hu);var hu,gu;mu.Provider=fu.Provider,mu.Consumer=fu.Consumer;const bu=()=>{const e=[],t=function(t){Fa(`${Aa}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 Rs(e,((e,r)=>{if(Ns.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 Rs(e,(e=>e.pause(...arguments))),this},t.resume=function(){return Rs(e,(e=>e.resume(...arguments))),this},t.set=function(t){Rs(e,(e=>e.set(t)))},t.start=function(t){const n=[];return Rs(e,((e,o)=>{if(Ns.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 Rs(e,(e=>e.stop(...arguments))),this},t.update=function(t){return Rs(e,((e,n)=>e.update(this._getProps(t,e,n)))),this};const n=function(e,t,n){return Ns.fun(e)?e(n,t):e};return t._getProps=n,t};function vu(e,t,n){const o=Ns.fun(t)&&t;o&&!n&&(n=[]);const r=(0,Is.useMemo)((()=>o||3==arguments.length?bu():void 0),[]),l=(0,Is.useRef)(0),i=Ua(),s=(0,Is.useMemo)((()=>({ctrls:[],queue:[],flush(e,t){const n=su(e,t);return l.current>0&&!s.queue.length&&!Object.keys(n).some((t=>!e.springs[t]))?lu(e,t):new Promise((o=>{au(e,n),s.queue.push((()=>{o(lu(e,t))})),i()}))}})),[]),a=(0,Is.useRef)([...s.ctrls]),c=[],u=Wa(e)||0;function d(e,n){for(let r=e;r<n;r++){const e=a.current[r]||(a.current[r]=new ru(null,s.flush)),n=o?o(r,e):t[r];n&&(c[r]=Xc(n))}}(0,Is.useMemo)((()=>{Rs(a.current.slice(e,u),(e=>{Ec(e,r),e.stop(!0)})),a.current.length=e,d(u,e)}),[e]),(0,Is.useMemo)((()=>{d(0,Math.min(u,e))}),n);const p=a.current.map(((e,t)=>su(e,c[t]))),m=(0,Is.useContext)(mu),f=Wa(m),h=m!==f&&_c(m);ja((()=>{l.current++,s.ctrls=a.current;const{queue:e}=s;e.length&&(s.queue=[],Rs(e,(e=>e()))),Rs(a.current,((e,t)=>{null==r||r.add(e),h&&e.start({default:m});const n=c[t];n&&(Cc(e,n.ref),e.ref?e.queue.push(n):e.start(n))}))})),Va((()=>()=>{Rs(s.ctrls,(e=>e.stop(!0)))}));const g=p.map((e=>cc({},e)));return r?[g,r]:g}let ku;!function(e){e.MOUNT="mount",e.ENTER="enter",e.UPDATE="update",e.LEAVE="leave"}(ku||(ku={}));class _u extends Vc{constructor(e,t){super(),this.key=void 0,this.idle=!0,this.calc=void 0,this._active=new Set,this.source=e,this.calc=ga(...t);const n=this._get(),o=oc(n);qa(this,o.create(n))}advance(e){const t=this._get();Ps(t,this.get())||(Ka(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&Eu(this._active)&&Cu(this)}_get(){const e=Ns.arr(this.source)?this.source.map(ya):Ms(ya(this.source));return this.calc(...e)}_start(){this.idle&&!Eu(this._active)&&(this.idle=!1,Rs(Ya(this),(e=>{e.done=!1})),Us.skipAnimation?(us.batchedUpdates((()=>this.advance())),Cu(this)):Ks.start(this))}_attach(){let e=1;Rs(Ms(this.source),(t=>{_a(t)&&Ba(t,this),Fc(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){Rs(Ms(this.source),(e=>{_a(e)&&Ia(e,this)})),this._active.clear(),Cu(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=Ms(this.source).reduce(((e,t)=>Math.max(e,(Fc(t)?t.priority:0)+1)),0))}}function yu(e){return!1!==e.idle}function Eu(e){return!e.size||Array.from(e).every(yu)}function Cu(e){e.idle||(e.idle=!0,Rs(Ya(e),(e=>{e.done=!0})),Ca(e,{type:"idle",parent:e}))}Us.assign({createStringInterpolator:Ma,to:(e,t)=>new _u(e,t)}),Ks.advance;var Su=window.ReactDOM;function wu(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 Bu=["style","children","scrollTop","scrollLeft"],Iu=/^--/;function xu(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||Iu.test(e)||Nu.hasOwnProperty(e)&&Nu[e]?(""+t).trim():t+"px"}const Tu={};let Nu={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 Pu=["Webkit","Ms","Moz","O"];Nu=Object.keys(Nu).reduce(((e,t)=>(Pu.forEach((n=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(n,t)]=e[t])),e)),Nu);const Ru=["x","y","z"],Lu=/^(matrix|translate|scale|rotate|skew)/,Mu=/^(translate)/,Au=/^(rotate|skew)/,Du=(e,t)=>Ns.num(e)&&0!==e?e+t:e,Ou=(e,t)=>Ns.arr(e)?e.every((e=>Ou(e,t))):Ns.num(e)?e===t:parseFloat(e)===t;class Fu extends ec{constructor(e){let{x:t,y:n,z:o}=e,r=wu(e,Ru);const l=[],i=[];(t||n||o)&&(l.push([t||0,n||0,o||0]),i.push((e=>[`translate3d(${e.map((e=>Du(e,"px"))).join(",")})`,Ou(e,0)]))),Ls(r,((e,t)=>{if("transform"===t)l.push([e||""]),i.push((e=>[e,""===e]));else if(Lu.test(t)){if(delete r[t],Ns.und(e))return;const n=Mu.test(t)?"px":Au.test(t)?"deg":"";l.push(Ms(e)),i.push("rotate3d"===t?([e,t,o,r])=>[`rotate3d(${e},${t},${o},${Du(r,n)})`,Ou(r,0)]:e=>[`${t}(${e.map((e=>Du(e,n))).join(",")})`,Ou(e,t.startsWith("scale")?1:0)])}})),l.length&&(r.transform=new zu(l,i)),super(r)}}class zu extends Sa{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 Rs(this.inputs,((n,o)=>{const r=ya(n[0]),[l,i]=this.transforms[o](Ns.arr(r)?r:n.map(ya));e+=" "+l,t=t&&i})),t?"none":e}observerAdded(e){1==e&&Rs(this.inputs,(e=>Rs(e,(e=>_a(e)&&Ba(e,this)))))}observerRemoved(e){0==e&&Rs(this.inputs,(e=>Rs(e,(e=>_a(e)&&Ia(e,this)))))}eventObserved(e){"change"==e.type&&(this._value=null),Ca(this,e)}}const Vu=["scrollTop","scrollLeft"];Us.assign({batchedUpdates:Su.unstable_batchedUpdates,createStringInterpolator:Ma,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 Hu=((e,{applyAnimatedValues:t=(()=>!1),createAnimatedStyle:n=(e=>new ec(e)),getComponentProps:o=(e=>e)}={})=>{const r={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:o},l=e=>{const t=ac(e)||"Anonymous";return(e=Ns.str(e)?l[e]||(l[e]=lc(e,r)):e[sc]||(e[sc]=lc(e,r))).displayName=`Animated(${t})`,e};return Ls(e,((t,n)=>{Ns.arr(e)&&(n=ac(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=wu(o,Bu),c=Object.values(a),u=Object.keys(a).map((t=>n||e.hasAttribute(t)?t:Tu[t]||(Tu[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=xu(t,r[t]);Iu.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 Fu(e),getComponentProps:e=>wu(e,Vu)}).animated,Uu=e=>e+1,Gu=e=>({top:e.offsetTop,left:e.offsetLeft});var Wu=function({isSelected:e,adjustScrolling:t,enableAnimation:n,triggerAnimationOnChange:o}){const r=(0,s.useRef)(),l=(0,d.useReducedMotion)()||!n,[i,a]=(0,s.useReducer)(Uu,0),[c,u]=(0,s.useReducer)(Uu,0),[p,m]=(0,s.useState)({x:0,y:0}),f=(0,s.useMemo)((()=>r.current?Gu(r.current):null),[o]),h=(0,s.useMemo)((()=>{if(!t||!r.current)return()=>{};const e=(0,Gi.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=Gu(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=Ns.fun(e),[[o],r]=vu(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 ju=".block-editor-block-list__block",$u=".block-list-appender";function Ku(e,t){return t.closest([ju,$u].join(","))===e}function qu(e){const t=(0,s.useRef)(),n=function(e){return(0,m.useSelect)((t=>{const{getSelectedBlocksInitialCaretPosition:n,isMultiSelecting:o,isNavigationMode:r,isBlockSelected:l}=t(Gn);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=Gi.focus.tabbable.find(t.current).filter((e=>(0,Gi.isTextField)(e))),r=-1===n,l=(r?u.last:u.first)(o)||t.current;Ku(t.current,l)?(0,Gi.placeCaretAtHorizontalEdge)(l,r):t.current.focus()}),[n]),t}function Yu(e){if(e.defaultPrevented)return;const t="mouseover"===e.type?"add":"remove";e.preventDefault(),e.currentTarget.classList[t]("is-hovered")}function Zu(){const e=(0,m.useSelect)((e=>{const{isNavigationMode:t,getSettings:n}=e(Gn);return t()||n().outlineMode}),[]);return(0,d.useRefEffect)((t=>{if(e)return t.addEventListener("mouseout",Yu),t.addEventListener("mouseover",Yu),()=>{t.removeEventListener("mouseout",Yu),t.removeEventListener("mouseover",Yu),t.classList.remove("is-hovered")}}),[e])}function Xu(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(Gn),{__experimentalSpotlightEntityBlocks:m,outlineMode:f}=a(),h=n(e),g=l(e),b=s(e),v=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)(b)),"is-dragging":h,"has-child-selected":v,"has-active-entity":k,"is-active-entity":k===e,"remove-outline":g&&f&&d()})}),[e])}function Qu(e){return(0,m.useSelect)((t=>{const n=t(Gn).getBlockName(e),o=(0,r.getBlockType)(n);if((null==o?void 0:o.apiVersion)>1)return(0,r.getBlockDefaultClassName)(n)}),[e])}function Ju(e){return(0,m.useSelect)((t=>{const{getBlockName:n,getBlockAttributes:o}=t(Gn),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 ed(e){return(0,m.useSelect)((t=>{const{hasBlockMovingClientId:n,canInsertBlockType:o,getBlockName:r,getBlockRootClientId:l,isBlockSelected:i}=t(Gn);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 td(e){const{isBlockSelected:t}=(0,m.useSelect)(Gn),{selectBlock:n,selectionChange:o}=(0,m.useDispatch)(Gn);return(0,d.useRefEffect)((r=>{function l(l){t(e)?l.target.isContentEditable||o(e):Ku(r,l.target)&&n(e)}return r.addEventListener("focusin",l),()=>{r.removeEventListener("focusin",l)}}),[t,n])}function nd(e){const t=(0,m.useSelect)((t=>t(Gn).isBlockSelected(e)),[e]),{getBlockRootClientId:n,getBlockIndex:o}=(0,m.useSelect)(Gn),{insertDefaultBlock:r,removeBlock:l}=(0,m.useDispatch)(Gn);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!==Ll.ENTER&&s!==Ll.BACKSPACE&&s!==Ll.DELETE||a!==i||(0,Gi.isTextField)(a)||(t.preventDefault(),s===Ll.ENTER?r({},n(e),o(e)+1):l(e))}function a(e){e.preventDefault()}}),[e,t,n,o,r,l])}function od(e){const{isNavigationMode:t,isBlockSelected:n}=(0,m.useSelect)(Gn),{setNavigationMode:o,selectBlock:r}=(0,m.useDispatch)(Gn);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 rd=n(4979),ld=n.n(rd);function id(e){const t=(0,s.useRef)(),n=(0,m.useSelect)((t=>{const{isBlockSelected:n,getBlockSelectionEnd:o}=t(Gn);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,Gi.getScrollContainer)(e)||e.ownerDocument.defaultView;o&&ld()(e,o,{onlyScrollIfNeeded:!0})}),[n]),t}function sd(e,t){Array.from(e.closest(".is-root-container").querySelectorAll(".rich-text")).forEach((e=>{t?e.setAttribute("contenteditable",!0):e.removeAttribute("contenteditable")}))}function ad(e){const{startMultiSelect:t,stopMultiSelect:n,multiSelect:o,selectBlock:r}=(0,m.useDispatch)(Gn),{isSelectionEnabled:l,isBlockSelected:i,getBlockParents:s,getBlockSelectionStart:a,hasMultiSelection:c}=(0,m.useSelect)(Gn);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 sd(u,!0);const l=function(e){for(;e&&e.nodeType!==e.ELEMENT_NODE;)e=e.parentNode;if(!e)return;const t=e.closest(ju);return t?t.id.slice("block-".length):void 0}(n.focusNode);if(e===l){if(r(e),t&&(sd(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 b({buttons:n}){1===n&&l()&&i(e)&&(m=d.activeElement,t(),d.addEventListener("selectionchange",h),p.addEventListener("mouseup",g),sd(u,!1))}function v(t){if(l()&&0===t.button)if(t.shiftKey){const n=a();n&&n!==e&&(sd(u,!1),o(n,e),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",h),p.removeEventListener("mouseup",g),p.cancelAnimationFrame(f)}}),[e,t,n,o,r,l,i,s])}function cd(){const e=(0,s.useContext)(qf);return(0,d.useRefEffect)((t=>{if(e)return e.observe(t),()=>{e.unobserve(t)}}),[e])}function ud(e={},{__unstableIsHtml:t}={}){const{clientId:n,className:o,wrapperProps:l={},isAligned:i}=(0,s.useContext)(dd),{index:a,mode:u,name:p,blockApiVersion:f,blockTitle:g,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(Gn),m=c(n),f=u(n)||d(n),h=i(n),g=t(n),b=(0,r.getBlockType)(h);return{index:o(n,g),mode:l(n),name:h,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,h.sprintf)((0,h.__)("Block: %s"),g),y="html"!==u||t?"":"-visual",E=(0,d.useMergeRefs)([e.ref,qu(n),id(n),ol(n),td(n),ad(n),nd(n),od(n),Zu(),cd(),Wu({isSelected:b,adjustScrolling:v,enableAnimation:k,triggerAnimationOnChange:a})]),C=Kn();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,Xu(n),Qu(n),Ju(n),ed(n)),style:{...l.style,...e.style}}}ud.save=r.__unstableGetBlockProps;const dd=(0,s.createContext)();function pd({children:e,isHtml:t,...n}){return(0,s.createElement)("div",ud(n,{__unstableIsHtml:t}),e)}const md=(0,m.withSelect)(((e,{clientId:t,rootClientId:n})=>{const{isBlockSelected:o,getBlockMode:r,isSelectionEnabled:l,getTemplateLock:i,__unstableGetBlockWithoutInnerBlocks:s,canRemoveBlock:a,canMoveBlock:c}=e(Gn),u=s(t),d=o(t),p=i(n),m=a(t,n),f=c(t,n),{name:h,attributes:g,isValid:b}=u||{};return{mode:r(t),isSelectionEnabled:l(),isLocked:!!p,canRemove:m,canMove:f,block:u,name:h,attributes:g,isValid:b,isSelected:d}})),fd=(0,m.withDispatch)(((e,t,{select:n})=>{const{updateBlockAttributes:o,insertBlocks:l,mergeBlocks:i,replaceBlocks:s,toggleSelection:a,__unstableMarkLastChangeAsPersistent:c}=e(Gn);return{setAttributes(e){const{getMultiSelectedBlockClientIds:r}=n(Gn),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(Gn),s=i(o,r);l(e,s+1,r)},onMerge(e){const{clientId:o}=t,{getPreviousBlockClientId:r,getNextBlockClientId:l}=n(Gn);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 hd=(0,d.compose)(d.pure,md,fd,(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:b,onInsertBlocksAfter:v,onMerge:k,toggleSelection:_}){const{removeBlock:y}=(0,m.useDispatch)(Gn),E=(0,s.useCallback)((()=>y(o)),[o]);let C=(0,s.createElement)(Yi,{name:d,isSelected:l,attributes:f,setAttributes:g,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&&(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,S.getEditWrapperProps(f)));const w=h&&!!h["data-align"];let B;if(w&&(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)(pd,{isHtml:!0},(0,s.createElement)(as,{clientId:o}))):(null==S?void 0:S.apiVersion)>1?C:(0,s.createElement)(pd,h,C);else{const e=(0,r.getSaveContent)(S,f);B=(0,s.createElement)(pd,{className:"has-warning"},(0,s.createElement)(ns,{clientId:o}),(0,s.createElement)(s.RawHTML,null,(0,Gi.safeHTML)(e)))}const I={clientId:o,className:a,wrapperProps:(0,u.omit)(h,["data-align"]),isAligned:w},x=(0,s.useMemo)((()=>I),Object.values(I));return(0,s.createElement)(dd.Provider,{value:x},(0,s.createElement)(is,{fallback:(0,s.createElement)(pd,{className:"has-warning"},(0,s.createElement)(rs,null))},B))})),gd=window.wp.htmlEntities,bd=(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 vd=[(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 kd=function(){const[e]=(0,s.useState)(Math.floor(Math.random()*vd.length));return(0,s.createElement)(p.Tip,null,vd[e])},_d=(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 yd({icon:e,showColors:t=!1,className:n}){var o;"block-default"===(null===(o=e)||void 0===o?void 0:o.src)&&(e={src:_d});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 Ed=function({title:e,icon:t,description:n,blockType:o}){return o&&(Mt()("`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)(yd,{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 Cd({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(Gn),{getBlockName:h,getBlocks:g}=i.select(Gn),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=[]):g(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(Gn);let s=g(e),a=r(),c=!1;v.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&&(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 Sd=(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(Dt,Un),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)(Gn);return(0,s.useEffect)((()=>{o(n)}),[n]),Cd(e),(0,s.createElement)(nl,null,t)}));function wd({onClick:e}){return(0,s.createElement)("div",{tabIndex:0,role:"button",onClick:e,onKeyPress:e},(0,s.createElement)(p.Disabled,null,(0,s.createElement)(Zf,null)))}function Bd(){const{hasSelectedBlock:e,hasMultiSelection:t}=(0,m.useSelect)(Gn),{clearSelectedBlock:n}=(0,m.useDispatch)(Gn);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 Id(e){return(0,s.createElement)("div",i({ref:Bd()},e))}function xd(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 Td(e){const{isMultiSelecting:t,getMultiSelectedBlockClientIds:n,hasMultiSelection:o,getSelectedBlockClientId:r}=e(Gn);return{isMultiSelecting:t(),multiSelectedBlockClientIds:n(),hasMultiSelection:o(),selectedBlockClientId:r()}}function Nd(){const{isMultiSelecting:e,multiSelectedBlockClientIds:t,hasMultiSelection:n,selectedBlockClientId:o}=(0,m.useSelect)(Td,[]),r=rl(o),l=rl((0,u.first)(t)),i=rl((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;s.focus();const d=c.getSelection(),p=a.createRange(),m=xd(l.current,"start"),f=xd(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 Pd(e){const{tagName:t}=e;return"INPUT"===t||"BUTTON"===t||"SELECT"===t||"TEXTAREA"===t}function Rd(e,t,n,o){let r,l=Gi.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(!Gi.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 Ld(){const{getSelectedBlockClientId:e,getMultiSelectedBlocksStartClientId:t,getMultiSelectedBlocksEndClientId:n,getPreviousBlockClientId:o,getNextBlockClientId:r,getFirstMultiSelectedBlockClientId:l,getLastMultiSelectedBlockClientId:i,getSettings:s,hasMultiSelection:a}=(0,m.useSelect)(Gn),{multiSelect:c,selectBlock:u}=(0,m.useDispatch)(Gn);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===Ll.UP,u=l===Ll.DOWN,m=l===Ll.LEFT,g=l===Ll.RIGHT,b=c||m,v=m||g,k=c||u,_=v||k,y=t.shiftKey,E=y||t.ctrlKey||t.altKey||t.metaKey,C=k?Gi.isVerticalEdge:Gi.isHorizontalEdge,{ownerDocument:S}=d,{defaultView:w}=S;if(a())return void(_&&((y?f:h)(b),t.preventDefault()));if(k?p||(p=(0,Gi.computeCaretRect)(w)):p=null,t.defaultPrevented)return;if(!_)return;if(!function(e,t,n){if((t===Ll.UP||t===Ll.DOWN)&&!n)return!0;const{tagName:o}=e;return"INPUT"!==o&&"TEXTAREA"!==o}(i,l,E))return;const B=(0,Gi.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=Rd(e,t,d);return!(n&&(o=e,r=n,o.closest(ju)===r.closest(ju)));var o,r}(i,b)&&C(i,b)&&(f(b),t.preventDefault())}else if(k&&(0,Gi.isVerticalEdge)(i,b)&&!I){const e=Rd(i,b,d,!0);e&&((0,Gi.placeCaretAtVerticalEdge)(e,b,p),t.preventDefault())}else if(v&&w.getSelection().isCollapsed&&(0,Gi.isHorizontalEdge)(i,B)&&!I){const e=Rd(i,B,d);(0,Gi.placeCaretAtHorizontalEdge)(e,b),t.preventDefault()}}return d.addEventListener("mousedown",m),d.addEventListener("keydown",g),()=>{d.removeEventListener("mousedown",m),d.removeEventListener("keydown",g)}}),[])}var Md=window.wp.keyboardShortcuts;function Ad(){const{getBlockOrder:e,getSelectedBlockClientIds:t,getBlockRootClientId:n}=(0,m.useSelect)(Gn),{multiSelect:o}=(0,m.useDispatch)(Gn),r=(0,Md.__unstableUseShortcutEventMatch)();return(0,d.useRefEffect)((l=>{function i(l){if(!r("core/block-editor/select-all",l))return;if(!(0,Gi.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 Dd(){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)(Gn),{setNavigationMode:a}=(0,m.useDispatch)(Gn),c=(0,m.useSelect)((e=>e(Gn).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";Gi.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===Ll.ESCAPE&&!r())return e.preventDefault(),void a(!0);if(e.keyCode!==Ll.TAB)return;const o=e.shiftKey,i=o?"findPrevious":"findNext";if(!r()&&!l())return void(e.target===s&&a(!0));if(Pd(e.target)&&Pd(Gi.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!==Ll.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=Gi.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(Gn).hasMultiSelection()),[]);return[e,(0,d.useMergeRefs)([t,Nd(),Ad(),Ld(),(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 Od=(0,s.forwardRef)((function({children:e,...t},n){const[o,r,l]=Dd();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 Fd="editor-styles-wrapper";function zd(e){return(0,s.useMemo)((()=>{const t=document.implementation.createHTMLDocument("");return t.body.innerHTML=e,Array.from(t.body.children)}),[e])}var Vd=(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)(),[b,v]=(0,s.useState)([]),k=zd(null===(a=window.__editorAssets)||void 0===a?void 0:a.styles),_=zd(null===(u=window.__editorAssets)||void 0===u?void 0:u.scripts),y=Bd(),[E,C,S]=Dd(),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),g(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(`.${Fd}`)||e.includes(".wp-block"))))&&!e.getElementById(n.id)){console.error(`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,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()(Fd,...b)},(0,s.createElement)(p.__experimentalStyleProvider,{document:f},t))),f.documentElement)),o>=0&&S)})),Hd=n(3692),Ud=n.n(Hd);const Gd=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function Wd(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=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 jd(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=jd(t[0]),!p(/^:\s*/))return a("property missing ':'");const n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),o=e({type:"declaration",property:t.replace(Gd,""),value:n?jd(n[0]).replace(Gd,""):""});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=jd(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:jd(t[1]),media:jd(t[2])})}()||function(){const e=l(),t=p(/^@supports *([^{]+)/);if(!t)return;const n=jd(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=jd(t[1]),o=jd(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=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=g();return t?(f(),e({type:"rule",selectors:t,declarations:v()})):a("selector missing")}return $d(function(){const e=d();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:s}}}())}function jd(e){return e?e.replace(/^\s+|\s+$/g,""):""}function $d(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){$d(e,o)})):n&&"object"==typeof n&&$d(n,o)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var Kd=n(5717),qd=n.n(Kd),Yd=Zd;function Zd(e){this.options=e||{}}Zd.prototype.emit=function(e){return e},Zd.prototype.visit=function(e){return this[e.type](e)},Zd.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 Xd=Qd;function Qd(e){Yd.call(this,e)}qd()(Qd,Yd),Qd.prototype.compile=function(e){return e.stylesheet.rules.map(this.visit,this).join("")},Qd.prototype.comment=function(e){return this.emit("",e.position)},Qd.prototype.import=function(e){return this.emit("@import "+e.import+";",e.position)},Qd.prototype.media=function(e){return this.emit("@media "+e.media,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},Qd.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("}")},Qd.prototype.charset=function(e){return this.emit("@charset "+e.charset+";",e.position)},Qd.prototype.namespace=function(e){return this.emit("@namespace "+e.namespace+";",e.position)},Qd.prototype.supports=function(e){return this.emit("@supports "+e.supports,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},Qd.prototype.keyframes=function(e){return this.emit("@"+(e.vendor||"")+"keyframes "+e.name,e.position)+this.emit("{")+this.mapVisit(e.keyframes)+this.emit("}")},Qd.prototype.keyframe=function(e){const t=e.declarations;return this.emit(e.values.join(","),e.position)+this.emit("{")+this.mapVisit(t)+this.emit("}")},Qd.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("}")},Qd.prototype["font-face"]=function(e){return this.emit("@font-face",e.position)+this.emit("{")+this.mapVisit(e.declarations)+this.emit("}")},Qd.prototype.host=function(e){return this.emit("@host",e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},Qd.prototype["custom-media"]=function(e){return this.emit("@custom-media "+e.name+" "+e.media+";",e.position)},Qd.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("}"):""},Qd.prototype.declaration=function(e){return this.emit(e.property+":"+e.value,e.position)+this.emit(";")};var Jd=ep;function ep(e){e=e||{},Yd.call(this,e),this.indentation=e.indent}qd()(ep,Yd),ep.prototype.compile=function(e){return this.stylesheet(e)},ep.prototype.stylesheet=function(e){return this.mapVisit(e.stylesheet.rules,"\n\n")},ep.prototype.comment=function(e){return this.emit(this.indent()+"/*"+e.comment+"*/",e.position)},ep.prototype.import=function(e){return this.emit("@import "+e.import+";",e.position)},ep.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}")},ep.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}")},ep.prototype.charset=function(e){return this.emit("@charset "+e.charset+";",e.position)},ep.prototype.namespace=function(e){return this.emit("@namespace "+e.namespace+";",e.position)},ep.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}")},ep.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)+"}")},ep.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")},ep.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}")},ep.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}")},ep.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}")},ep.prototype["custom-media"]=function(e){return this.emit("@custom-media "+e.name+" "+e.media+";",e.position)},ep.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()+"}"):""},ep.prototype.declaration=function(e){return this.emit(this.indent())+this.emit(e.property+": "+e.value,e.position)+this.emit(";")},ep.prototype.indent=function(e){return this.level=this.level||1,null!==e?(this.level+=e,""):Array(this.level).join(this.indentation||" ")};function tp(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 np(e,t){return new URL(e,t).toString()}const op=/^(body|html|:root).*$/;var rp=(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(op)?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]};tp(e)&&o.push(e)}return o}(e.value).map((o=l,e=>({...e,newUrl:"url("+e.before+e.quote+np(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=Wd(e);return n=Ud().map(r,(function(e){if(!e)return e;const n=t(e);return this.update(n)})),((o=o||{}).compress?new Xd(o):new Jd(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 lp=".editor-styles-wrapper";function ip(e){return(0,s.useCallback)((e=>{if(!e)return;const{ownerDocument:t}=e,{defaultView:n,body:o}=t,r=t.querySelector(lp);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)}Jo()(l).getLuminance()>.5||0===Jo()(l).getAlpha()?o.classList.remove("is-dark-theme"):o.classList.add("is-dark-theme")}),[e])}function sp({styles:e}){const t=(0,s.useMemo)((()=>rp(e,lp)),[e]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("style",{ref:ip(e)}),t.map(((e,t)=>(0,s.createElement)("style",{key:t},e))))}let ap;var cp=function({viewportWidth:e,__experimentalPadding:t}){const[n,{width:o}]=(0,d.useResizeObserver)(),[r,{height:l}]=(0,d.useResizeObserver)(),i=(0,m.useSelect)((e=>e(Gn).getSettings().styles));ap=ap||(0,d.pure)(Zf);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)(Vd,{head:(0,s.createElement)(sp,{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)(ap,{renderAppender:!1}))))},up=(0,s.memo)((function({blocks:e,__experimentalPadding:t=0,viewportWidth:n=1200,__experimentalLive:o=!1,__experimentalOnClick:r}){const l=(0,m.useSelect)((e=>e(Gn).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)(Sd,{value:a,settings:i},o?(0,s.createElement)(wd,{onClick:r}):(0,s.createElement)(cp,{viewportWidth:n,__experimentalPadding:t})):null})),dp=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||u.example?(0,s.createElement)("div",{className:"block-editor-inserter__preview-content"},(0,s.createElement)(up,{__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)(Ed,{title:l,icon:i,description:a}))},pp=(0,s.createContext)(),mp=(0,s.forwardRef)((function({isFirst:e,as:t,children:n,...o},r){const l=(0,s.useContext)(pp);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)}))})),fp=(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 hp({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)(yd,{icon:t}):(0,h.sprintf)(
|
15 |
/* translators: %d: Number of blocks. */
|
16 |
-
(0,
|
17 |
/* translators: %s: block pattern title. */
|
18 |
-
(0,
|
19 |
-
(0,
|
20 |
/* translators: %d: number of results. */
|
21 |
-
(0,
|
22 |
/* translators: Blocks tab title in the block inserter. */
|
23 |
-
title:(0,
|
24 |
/* translators: Patterns tab title in the block inserter. */
|
25 |
-
title:(0,
|
26 |
/* translators: Reusable blocks tab title in the block inserter. */
|
27 |
-
title:(0,
|
28 |
-
(0,
|
29 |
-
(0,
|
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)(yo,{icon:bd}));return(m||u)&&(f=(0,s.createElement)(p.Tooltip,{text:d},f)),f},isAppender:!0})}const mm=(0,s.forwardRef)(((e,t)=>(Mt()("wp.blockEditor.ButtonBlockerAppender",{alternative:"wp.blockEditor.ButtonBlockAppender"}),pm(e,t))));var fm=(0,s.forwardRef)(pm),hm=(0,m.withSelect)(((e,{rootClientId:t})=>{const{getBlockOrder:n,canInsertBlockType:o,getTemplateLock:l,getSelectedBlockClientId:i}=e(Gn);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)(dm,{rootClientId:t,lastBlockClientId:(0,u.last)(e)}):(0,s.createElement)(fm,{rootClientId:t,className:"block-list-appender__toggle"})}return(0,s.createElement)(a,{tabIndex:-1,className:c()("block-list-appender wp-block",l)},d)}));function gm(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 bm=(0,s.createContext)();function vm({__unstablePopoverSlot:e,__unstableContentRef:t}){const{selectBlock:n}=(0,m.useDispatch)(Gn),o=(0,s.useContext)(bm),r=(0,s.useRef)(),{orientation:l,previousClientId:i,nextClientId:a,rootClientId:u,isInserterShown:d}=(0,m.useSelect)((e=>{var t;const{getBlockOrder:n,getBlockListSettings:o,getBlockInsertionPoint:r,isBlockBeingDragged:l,getPreviousBlockClientId:i,getNextBlockClientId:s}=e(Gn),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}}),[]),f=ll(i),g=ll(a),b=(0,s.useMemo)((()=>{if(!f&&!g)return{};const e=f?f.getBoundingClientRect():null,t=g?g.getBoundingClientRect():null;if("vertical"===l)return{width:f?f.offsetWidth:g.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:f?f.offsetHeight:g.offsetHeight}}),[f,g]),v=(0,s.useCallback)((()=>{if(!f&&!g)return{};const{ownerDocument:e}=f||g,t=f?f.getBoundingClientRect():null,n=g?g.getBoundingClientRect():null;return"vertical"===l?(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}}),[f,g]),k=gm(t),_=c()("block-editor-block-list__insertion-point","is-"+l),y=f&&g&&d;return(0,s.createElement)(p.Popover,{ref:k,noArrow:!0,animate:!1,getAnchorRect:v,focusOnMount:!1,className:"block-editor-block-list__insertion-point-popover",__unstableSlotName:e||null},(0,s.createElement)("div",{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()(_,{"is-with-inserter":y}),style:b},(0,s.createElement)("div",{className:"block-editor-block-list__insertion-point-indicator"}),y&&(0,s.createElement)("div",{className:c()("block-editor-block-list__insertion-point-inserter")},(0,s.createElement)(um,{position:"bottom center",clientId:a,rootClientId:u,__experimentalIsQuick:!0,onToggle:e=>{o.current=e},onSelectOrClose:()=>{o.current=!1}}))))}function km({children:e,__unstablePopoverSlot:t,__unstableContentRef:n}){const o=(0,m.useSelect)((e=>e(Gn).isBlockInsertionPointVisible()),[]);return(0,s.createElement)(bm.Provider,{value:(0,s.useRef)(!1)},o&&(0,s.createElement)(vm,{__unstablePopoverSlot:t,__unstableContentRef:n}),e)}function _m(){const e=(0,s.useContext)(bm),t=(0,m.useSelect)((e=>e(Gn).getSettings().hasReducedUI),[]),{getBlockListSettings:n,getBlockRootClientId:o,getBlockIndex:r,isBlockInsertionPointVisible:l,isMultiSelecting:i,getSelectedBlockClientIds:a,getTemplateLock:c}=(0,m.useSelect)(Gn),{showInsertionPoint:u,hideInsertionPoint:p}=(0,m.useDispatch)(Gn);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 b=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(!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 ym="undefined"==typeof window?e=>{setTimeout((()=>e(Date.now())),0)}:window.requestIdleCallback||window.requestAnimationFrame,Em="undefined"==typeof window?clearTimeout:window.cancelIdleCallback||window.cancelAnimationFrame;function Cm(e){return(0,m.useSelect)((t=>{if(!e)return null;const{getBlockName:n,getBlockAttributes:o}=t(Gn),{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 Sm({clientId:e}){const{attributes:t,name:n,reusableBlockTitle:o}=(0,m.useSelect)((t=>{if(!e)return{};const{getBlockName:n,getBlockAttributes:o,__experimentalGetReusableBlockTitle:l}=t(Gn),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=Cm(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 wm=({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(Gn),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,Gi.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:b}=(0,m.useDispatch)(Gn);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=>{g(t),u.current=!0,d(e),o&&o()},onDragOver:f,onDragEnd:()=>{b(),u.current=!1,h(),l&&l()},__experimentalDragComponent:(0,s.createElement)(hp,{count:t.length,icon:c})},(({onDraggableStart:t,onDraggableEnd:n})=>e({draggable:!0,onDragStart:t,onDragEnd:n})))},Bm=function({clientId:e,rootClientId:t,blockElement:n}){const o=Cm(e),l=(0,m.useSelect)((n=>{var o;const{getBlock:r,getBlockIndex:l,hasBlockMovingClientId:i,getBlockListSettings:s}=n(Gn),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:b,removeBlock:v}=(0,m.useDispatch)(Gn),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:S,getClientIdsOfDescendants:w,getSelectedBlockClientId:B,getMultiSelectedBlocksEndClientId:I,getPreviousBlockClientId:x,getNextBlockClientId:T}=(0,m.useSelect)(Gn),{selectBlock:N,clearSelectedBlock:P,setBlockMovingClientId:R,moveBlockToPosition:L}=(0,m.useDispatch)(Gn),M=c()("block-editor-block-list__block-selection-button",{"is-block-moving-mode":!!f}),A=(0,h.__)("Drag");return(0,s.createElement)("div",{className:M},(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)(yd,{icon:null==o?void 0:o.icon,showColors:!0})),(0,s.createElement)(p.FlexItem,null,(0,s.createElement)(wm,{clientIds:[e]},(e=>(0,s.createElement)(p.Button,i({icon:fp,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===Ll.UP,l=o===Ll.DOWN,i=o===Ll.LEFT,s=o===Ll.RIGHT,a=o===Ll.TAB,c=o===Ll.ESCAPE,u=o===Ll.ENTER,d=o===Ll.SPACE,p=t.shiftKey;if(o===Ll.BACKSPACE||o===Ll.DELETE)return v(e),void t.preventDefault();const m=B(),f=I(),h=x(f||m),g=T(f||m),b=a&&p||r,k=a&&!p||l,_=i,y=s;let M;if(b)M=h;else if(k)M=g;else if(_){var A;M=null!==(A=S(m))&&void 0!==A?A:m}else if(y){var D;M=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),L(O,e,t,o),N(O),R(null)}if(k||b||_||y)if(M)t.preventDefault(),N(M);else if(a&&m){let e;k?(e=Gi.focus.tabbable.findNext(n),e||(e=n.ownerDocument.defaultView.frameElement,e=Gi.focus.tabbable.findNext(e))):e=Gi.focus.tabbable.findPrevious(n),e&&(t.preventDefault(),e.focus(),P())}},label:y,className:"block-selection-button_select-button"},(0,s.createElement)(Sm,{clientId:e})))))};function Im(e){return Array.from(e.querySelectorAll("[data-toolbar-item]"))}var xm=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=!Gi.focus.tabbable.find(e.current).some((e=>!("toolbarItem"in e.dataset)));t||Mt()("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]=Gi.focus.tabbable.find(e);t&&t.focus()}(e.current)}),[]);(0,Md.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=Im(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=Im(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)},Tm=(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"})),Nm=(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"})),Pm=(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"})),Rm=(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 Lm=(e,t)=>"up"===e?"horizontal"===t?(0,h.isRTL)()?Tm:Nm:Pm:"down"===e?"horizontal"===t?(0,h.isRTL)()?Nm:Tm:Rm:null,Mm=(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,Am=(0,s.forwardRef)((({clientIds:e,direction:t,orientation:n,...o},l)=>{const a=(0,d.useInstanceId)(Am),f=(0,u.castArray)(e).length,{blockType:g,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(Gn),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),b=a(p),v=0===f,k=h===g.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)(Gn),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:Lm(t,E),label:Mm(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,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,
|
32 |
-
(0,
|
33 |
-
(0,
|
34 |
-
(0,
|
35 |
-
(0,
|
36 |
-
(0,
|
37 |
-
(0,
|
38 |
-
(0,
|
39 |
-
(0,
|
40 |
-
(0,
|
41 |
-
(0,
|
42 |
-
(0,
|
43 |
-
(0,
|
44 |
-
(0,
|
45 |
-
(0,
|
46 |
/* translators: %s: Name of the block's parent. */
|
47 |
-
(0,
|
48 |
/* translators: %s: block title. */
|
49 |
-
(0,
|
50 |
/* translators: %d: number of blocks. */
|
51 |
-
(0,
|
52 |
-
(0,
|
53 |
-
(0,
|
54 |
-
(0,
|
55 |
-
(0,h._n)("Moved %d block to clipboard.","Moved %d blocks to clipboard.",r.length),r.length);n(l,{type:"snackbar"})}),[])}function cf(){const{getBlocksByClientId:e,getSelectedBlockClientIds:t,hasMultiSelection:n,getSettings:o}=(0,m.useSelect)(Gn),{flashBlock:l,removeBlocks:i,replaceBlocks:s}=(0,m.useDispatch)(Gn),a=af();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,Gi.documentHasUncollapsedSelection)(t):(0,Gi.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,Gi.getFilesFromDataTransfer)(e).filter((({type:e})=>/^image\/(?:jpe?g|png|gif)$/.test(e)));return o.length&&!n&&(n=o.map((e=>`<img src="${(0,sf.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 uf=function({children:e}){return(0,s.createElement)("div",{ref:cf()},e)};function df({clientIds:e,children:t,__experimentalUpdateSelection:n}){const{canInsertBlockType:o,getBlockRootClientId:l,getBlocksByClientId:i,canRemoveBlocks:s,getTemplateLock:a}=(0,m.useSelect)((e=>e(Gn)),[]),{getDefaultBlockName:c,getGroupingBlockName:d}=(0,m.useSelect)((e=>e(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),b=s(e,f),{removeBlocks:v,replaceBlocks:k,duplicateBlocks:_,insertAfterBlock:y,insertBeforeBlock:E,flashBlock:C,setBlockMovingClientId:S,setNavigationMode:w,selectBlock:B}=(0,m.useDispatch)(Gn),I=af();return t({canDuplicate:h,canInsertDefaultBlock:g,canRemove:b,isLocked:!!a(f),rootClientId:f,blocks:p,onDuplicate:()=>_(e,n),onRemove:()=>v(e,n),onInsertBefore(){E((0,u.first)((0,u.castArray)(e)))},onInsertAfter(){y((0,u.last)((0,u.castArray)(e)))},onMoveTo(){w(!0),B(e[0]),S(e[0])},onGroup(){if(!p.length)return;const t=d(),n=(0,r.switchToBlockType)(p,t);n&&k(e,n)},onUngroup(){if(!p.length)return;const t=p[0].innerBlocks;t.length&&k(e,t)},onCopy(){const e=p.map((({clientId:e})=>e));1===p.length&&C(e[0]),I("copy",e)}})}var pf=(0,d.compose)([(0,m.withSelect)(((e,{clientId:t})=>{const{getBlock:n,getBlockMode:o,getSettings:l}=e(Gn),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(Gn).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)})),mf=(0,d.compose)((0,m.withSelect)(((e,{clientId:t})=>{const n=e(Gn).getBlock(t);return{block:n,shouldRender:n&&"core/html"===n.name}})),(0,m.withDispatch)(((e,{block:t})=>({onClick:()=>e(Gn).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:ff,Slot:hf}=(0,p.createSlotFill)("__unstableBlockSettingsMenuFirstItem");ff.Slot=hf;var gf=ff;function bf({clientIds:e,isGroupable:t,isUngroupable:n,blocksSelection:o,groupingBlockName:l,onClose:i=(()=>{})}){const{replaceBlocks:a}=(0,m.useDispatch)(Gn);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:vf,Slot:kf}=(0,p.createSlotFill)("BlockSettingsMenuControls");function _f({...e}){return(0,s.createElement)(p.__experimentalStyleProvider,{document:document},(0,s.createElement)(vf,e))}_f.Slot=({fillProps:e,clientIds:t=null})=>{const n=(0,m.useSelect)((e=>{const{getBlocksByClientId:n,getSelectedBlockClientIds:o}=e(Gn),r=null!==t?t:o();return(0,u.map)((0,u.compact)(n(r)),(e=>e.name))}),[t]),o=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(Gn),{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:l,isUngroupable:a}=o,c=l||a;return(0,s.createElement)(kf,{fillProps:{...e,selectedBlocks:n}},(t=>{if((null==t?void 0:t.length)>0||c)return(0,s.createElement)(p.MenuGroup,null,t,(0,s.createElement)(bf,i({},o,{onClose:null==e?void 0:e.onClose})))}))};var yf=_f;const Ef={className:"block-editor-block-settings-menu__popover",position:"bottom right",isAlternate:!0};function Cf({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 Sf=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(Gn).getBlockCount()),[]),d=(0,m.useSelect)((e=>{const{getShortcutRepresentation:t}=e(Md.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]),g=1===l?(0,h.__)("Remove block"):(0,h.__)("Remove blocks");return(0,s.createElement)(df,{clientIds:e,__experimentalUpdateSelection:!t},(({canDuplicate:t,canInsertDefaultBlock:r,canRemove:m,onDuplicate:b,onInsertAfter:v,onInsertBefore:k,isLocked:_,onRemove:y,onCopy:E,onMoveTo:C,blocks:S})=>(0,s.createElement)(p.DropdownMenu,i({icon:lf,label:(0,h.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:Ef,noIcons:!0},o),(({onClose:o})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.MenuGroup,null,(0,s.createElement)(gf.Slot,{fillProps:{onClose:o}}),1===l&&(0,s.createElement)(mf,{clientId:a}),(0,s.createElement)(Cf,{blocks:S,onCopy:E}),t&&(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,b,f),shortcut:d.duplicate},(0,h.__)("Duplicate")),r&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,k),shortcut:d.insertBefore},(0,h.__)("Insert before")),(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,v),shortcut:d.insertAfter},(0,h.__)("Insert after"))),!_&&!c&&(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,C)},(0,h.__)("Move to")),1===l&&(0,s.createElement)(pf,{clientId:a,onToggle:o})),(0,s.createElement)(yf.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,f),shortcut:d.remove},g)))))))},wf=function({clientIds:e,...t}){return(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(p.ToolbarItem,null,(n=>(0,s.createElement)(Sf,i({clientIds:e,toggleProps:n},t)))))};function Bf({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(Gn),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)(Gn),g=(0,s.useRef)(),{showMovers:b,gestures:v}=Um({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||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)(Gm,{clientIds:t}),(0,s.createElement)("div",i({ref:g},v),(y||E)&&(0,s.createElement)(p.ToolbarGroup,{className:"block-editor-block-toolbar__block-controls"},(0,s.createElement)(rf,{clientIds:t}),(0,s.createElement)(Fm,{clientIds:t,hideDragHandle:e||a}))),y&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Jn.Slot,{group:"parent",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(Jn.Slot,{group:"block",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(Jn.Slot,{className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(Jn.Slot,{group:"inline",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(Jn.Slot,{group:"other",className:"block-editor-block-toolbar__slot"})),(0,s.createElement)(wf,{clientIds:t}))}var If=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(Gn),{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)(xm,i({focusOnMount:e,className:u
|
56 |
-
/* translators: accessibility text for the block toolbar */,"aria-label":(0,h.__)("Block tools")},n),(0,s.createElement)(Bf,{hideDragHandle:t}))};function xf(e){const{isNavigationMode:t,isMultiSelecting:n,hasMultiSelection:o,isTyping:r,isCaretWithinFormattedText:l,getSettings:i,getLastMultiSelectedBlockClientId:s}=e(Gn);return{isNavigationMode:t(),isMultiSelecting:n(),isTyping:r(),isCaretWithinFormattedText:l(),hasMultiSelection:o(),hasFixedToolbar:i().hasFixedToolbar,lastClientId:s()}}function Tf({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:b,lastClientId:v}=(0,m.useSelect)(xf,[]),k=(0,m.useSelect)((t=>{const{isBlockInsertionPointVisible:n,getBlockInsertionPoint:o,getBlockOrder:r}=t(Gn);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)(Gn),B=!f&&!a&&o&&n,I=a,x=!a&&!b&&_&&!B&&!u&&(!f||h),T=!(a||x||b||o);(0,Md.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=ll(e),R=ll(v),L=ll(r),M=gm(i);if(!(I||x||y||B))return null;let A=P;if(!A)return null;r&&(A=L);let D=A;if(g){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,Gi.getScrollContainer)(A)||F.body;return(0,s.createElement)(p.Popover,{ref:M,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)(um,{clientId:e,rootClientId:t,__experimentalIsQuick:!0})),(x||y)&&(0,s.createElement)(If,{focusOnMount:y,__experimentalInitialIndex:N.current,__experimentalOnIndexChange:e=>{N.current=e},key:e}),I&&(0,s.createElement)(Bm,{clientId:e,rootClientId:t,blockElement:A}),B&&(0,s.createElement)("div",{className:"block-editor-block-list__empty-block-inserter"},(0,s.createElement)(um,{position:"bottom right",rootClientId:t,clientId:e,__experimentalIsQuick:!0})))}function Nf(e){const{getSelectedBlockClientId:t,getFirstMultiSelectedBlockClientId:n,getBlockRootClientId:o,getBlock:l,getBlockParents:i,__experimentalGetBlockListSettingsForBlocks:s}=e(Gn),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 Pf({__unstablePopoverSlot:e,__unstableContentRef:t}){const n=(0,m.useSelect)(Nf,[]);if(!n)return null;const{clientId:o,rootClientId:r,name:l,isValid:i,isEmptyDefaultBlock:a,capturingClientId:c}=n;return l?(0,s.createElement)(Tf,{clientId:o,rootClientId:r,isValid:i,isEmptyDefaultBlock:a,capturingClientId:c,__unstablePopoverSlot:e,__unstableContentRef:t}):null}function Rf({children:e}){const t=(0,s.useContext)(bm),n=(0,s.useContext)(p.Disabled.Context);return t||n?e:(Mt()('wp.components.Popover.Slot name="block-toolbar"',{alternative:"wp.blockEditor.BlockTools"}),(0,s.createElement)(km,{__unstablePopoverSlot:"block-toolbar"},(0,s.createElement)(Pf,{__unstablePopoverSlot:"block-toolbar"}),e))}var Lf=(0,d.createHigherOrderComponent)((e=>t=>{const{clientId:n}=Kn();return(0,s.createElement)(e,i({},t,{clientId:n}))}),"withClientId"),Mf=Lf((({clientId:e,showSeparator:t,isFloating:n,onAddBlock:o,isToggle:r})=>(0,s.createElement)(fm,{className:c()({"block-list-appender__toggle":r}),rootClientId:e,showSeparator:t,isFloating:n,onAddBlock:o}))),Af=(0,d.compose)([Lf,(0,m.withSelect)(((e,{clientId:t})=>{const{getBlockOrder:n}=e(Gn),o=n(t);return{lastBlockClientId:(0,u.last)(o)}}))])((({clientId:e,lastBlockClientId:t})=>(0,s.createElement)(dm,{rootClientId:e,lastBlockClientId:t}))),Df=window.wp.isShallowEqual,Of=n.n(Df);const Ff=new WeakMap;function zf(e,t){const n=(0,m.useSelect)((e=>e(Gn).getSettings().mediaUpload),[]),{canInsertBlockType:o,getBlockIndex:l,getClientIdsOfDescendants:i}=(0,m.useSelect)(Gn),{insertBlocks:s,moveBlocksToPosition:a,updateBlockAttributes:c,clearSelectedBlock:u}=(0,m.useDispatch)(Gn),d=function(e,t,n,o,r,l,i){return s=>{const{srcRootClientId:a,srcClientIds:c,type:u,blocks:d}=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}(s);if("inserter"===u&&(i(),l(d,t,e,!0,null)),"block"===u){const l=n(c[0],a);if(a===e&&l===t)return;if(c.includes(e)||o(c).some((t=>t===e)))return;const i=a===e,s=c.length;r(c,a,e,i&&l<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,Gi.getFilesFromDataTransfer)(e.dataTransfer),n=e.dataTransfer.getData("text/html");t.length?p(t):n?f(n):d(e)}}function Vf(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 Hf({rootClientId:e=""}={}){const[t,n]=(0,s.useState)(null),o=(0,m.useSelect)((t=>{const{getTemplateLock:n}=t(Gn);return"all"===n(e)}),[e]),{getBlockListSettings:r}=(0,m.useSelect)(Gn),{showInsertionPoint:l,hideInsertionPoint:i}=(0,m.useDispatch)(Gn),a=zf(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]=Vf(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 Uf(e){const{clientId:t,allowedBlocks:n,template:o,templateLock:l,wrapperRef:i,templateInsertUpdatesSelection:a,__experimentalCaptureToolbars:c,__experimentalAppenderTagName:d,renderAppender:p,orientation:f,placeholder:h,__experimentalLayout:g}=e;!function(e,t,n,o,r,l){const{updateBlockListSettings:i}=(0,m.useDispatch)(Gn),{blockListSettings:a,parentLock:c}=(0,m.useSelect)((t=>{const n=t(Gn).getBlockRootClientId(e);return{blockListSettings:t(Gn).getBlockListSettings(e),parentLock:t(Gn).getTemplateLock(n)}}),[e]),u=(0,s.useMemo)((()=>t),t);(0,s.useLayoutEffect)((()=>{const t={allowedBlocks:u,templateLock:void 0===n?c:n};if(void 0!==o&&(t.__experimentalCaptureToolbars=o),void 0!==r)t.orientation=r;else{const e=Co(null==l?void 0:l.type);t.orientation=e.getOrientation(l)}Of()(a,t)||i(e,t)}),[e,a,u,n,c,o,r,i,l])}(t,n,l,c,f,g),function(e,t,n,o){const{getSelectedBlocksInitialCaretPosition:l}=(0,m.useSelect)(Gn),{replaceInnerBlocks:i}=(0,m.useDispatch)(Gn),a=(0,m.useSelect)((t=>t(Gn).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,o,l,a);const b=(0,m.useSelect)((e=>{const n=e(Gn).getBlock(t),o=(0,r.getBlockType)(n.name);if(o&&o.providesContext)return function(e,t){Ff.has(t)||Ff.set(t,new WeakMap);const n=Ff.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)(ji,{value:b},(0,s.createElement)(Qf,{rootClientId:t,renderAppender:p,__experimentalAppenderTagName:d,__experimentalLayout:g,wrapperRef:i,placeholder:h}))}function Gf(e){return Cd(e),(0,s.createElement)(Uf,e)}const Wf=(0,s.forwardRef)(((e,t)=>{const n=jf({ref:t},e);return(0,s.createElement)("div",{className:"block-editor-inner-blocks"},(0,s.createElement)("div",n))}));function jf(e={},t={}){const{clientId:n}=Kn(),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(Gn),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,Hf({rootClientId:n})]),p={__experimentalCaptureToolbars:l,...t},f=p.value&&p.onChange?Gf:Uf;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)(Qf,t)}}Wf.DefaultBlockAppender=Af,Wf.ButtonBlockAppender=Mf,Wf.Content=(0,r.withBlockContentContext)((({BlockContent:e})=>(0,s.createElement)(e,null)));var $f=Wf;const Kf=(0,s.createContext)(),qf=(0,s.createContext)();function Yf({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(Gn),{outlineMode:o,focusMode:r}=t();return{isOutlineMode:o,isFocusMode:r,isNavigationMode:n()}}),[]),u=jf({ref:(0,d.useMergeRefs)([Bd(),_m(),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)(Kf.Provider,{value:n},(0,s.createElement)("div",u))}function Zf(e){return function(){const e=(0,m.useSelect)((e=>e(Gn).getSettings().__experimentalBlockPatterns),[]);(0,s.useEffect)((()=>{if(null==e||!e.length)return;let t,n=-1;const o=()=>{n++,n>=e.length||((0,m.select)(Gn).__experimentalGetParsedPattern(e[n].name),t=ym(o))};return t=ym(o),()=>Em(t)}),[e])}(),(0,s.createElement)(Rf,null,(0,s.createElement)($n,{value:Wn},(0,s.createElement)(Yf,e)))}function Xf({placeholder:e,rootClientId:t,renderAppender:n,__experimentalAppenderTagName:o,__experimentalLayout:r=So}){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(Gn);return{order:n(t),selectedBlocks:o()}}),[t]);return(0,s.createElement)(Bo,{value:r},(0,s.createElement)(qf.Provider,{value:a},c.map((e=>(0,s.createElement)(m.AsyncModeProvider,{key:e,value:!l.has(e)&&!u.includes(e)},(0,s.createElement)(hd,{rootClientId:t,clientId:e}))))),c.length<1&&e,(0,s.createElement)(hm,{tagName:o,rootClientId:t,renderAppender:n}))}function Qf(e){return(0,s.createElement)(m.AsyncModeProvider,{value:!1},(0,s.createElement)(Xf,e))}Zf.__unstableElementContext=Kf;const Jf=[];function eh(e=[]){const t={r:[],g:[],b:[]};return e.forEach((e=>{const n=Jo()(e);t.r.push(n._r/255),t.g.push(n._g/255),t.b.push(n._b/255)})),t}function th({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 nh({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=po("color.duotone")||Jf,i=po("color.palette")||Jf,a=!po("color.custom"),c=!po("color.customDuotone")||0===(null==i?void 0:i.length)&&a;return 0===(null==l?void 0:l.length)&&c?null:(0,s.createElement)(Jn,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(Ui,{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})}}))}const oh=(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)(nh,t))}),"withDuotoneControls"),rh=(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-filter-${(0,d.useInstanceId)(e)}`,m=a.split(",").map((e=>`.${p} ${e.trim()}`)).join(", "),f=c()(null==t?void 0:t.className,p),h=(0,s.useContext)(Zf.__unstableElementContext);return(0,s.createElement)(s.Fragment,null,h&&(0,s.createPortal)((0,s.createElement)(th,{selector:m,id:p,values:eh(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",oh),(0,l.addFilter)("editor.BlockListBlock","core/editor/duotone/with-styles",rh);const lh="__experimentalLayout";function ih({setAttributes:e,attributes:t,name:n}){const{layout:o}=t,l=po("layout"),i=(0,m.useSelect)((e=>{const{getSettings:t}=e(Gn);return t().supportsLayout}),[]),a=(0,r.getBlockSupport)(n,lh,{}),{allowSwitching:c,allowEditing:u=!0,allowInheriting:d=!0,default:f}=a;if(!u)return null;const g=o||f||{},{inherit:b=!1,type:v="default"}=g;if("default"===v&&!i)return null;const k=Co(v),_=t=>e({layout:t});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(qo,null,(0,s.createElement)(p.PanelBody,{title:(0,h.__)("Layout")},d&&!!l&&(0,s.createElement)(p.ToggleControl,{label:(0,h.__)("Inherit default layout"),checked:!!b,onChange:()=>e({layout:{inherit:!b}})}),!b&&c&&(0,s.createElement)(sh,{type:v,onChange:t=>e({layout:{type:t}})}),!b&&k&&(0,s.createElement)(k.inspectorControls,{layout:g,onChange:_,layoutBlockSupport:a}))),!b&&k&&(0,s.createElement)(k.toolBarControls,{layout:g,onChange:_,layoutBlockSupport:a}))}function sh({type:e,onChange:t}){return(0,s.createElement)(p.ButtonGroup,null,Eo.map((({name:n,label:o})=>(0,s.createElement)(p.Button,{key:n,isPressed:e===n,onClick:()=>t(n)},o))))}const ah=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n}=t;return[(0,r.hasBlockSupport)(n,lh)&&(0,s.createElement)(ih,i({key:"layout"},t)),(0,s.createElement)(e,i({key:"edit"},t))]}),"withInspectorControls"),ch=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n,attributes:o}=t,l=(0,r.hasBlockSupport)(n,lh),a=(0,d.useInstanceId)(e),u=po("layout")||{},p=(0,s.useContext)(Zf.__unstableElementContext),{layout:m}=o,{default:f}=(0,r.getBlockSupport)(n,lh)||{},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)(Io,{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,lh)&&(e.attributes={...e.attributes,layout:{type:"object"}}),e})),(0,l.addFilter)("editor.BlockListBlock","core/editor/layout/with-layout-styles",ch),(0,l.addFilter)("editor.BlockEdit","core/editor/layout/with-inspector-controls",ah);const uh=[];function dh({borderColor:e,style:t}){var n;const o=(null==t?void 0:t.border)||{},r=nr("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:Ai({border:o})}}function ph(e){const t=po("color.palette")||uh,n=dh(e);if(e.borderColor){const o=er(t,e.borderColor);n.style.borderColor=o.color}return n}const mh=[];function fh(e){var t,n,o,r,l,i;const{backgroundColor:s,textColor:a,gradient:u,style:d}=e,p=nr("background-color",s),m=nr("color",a),f=rr(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:Ai({color:(null==d?void 0:d.color)||{}})}}function hh(e){const{backgroundColor:t,textColor:n,gradient:o}=e,r=po("color.palette")||mh,l=po("color.gradients")||mh,i=fh(e);if(t){const e=er(r,t);i.style.backgroundColor=e.color}if(o&&(i.style.background=lr(l,o)),n){const e=er(r,n);i.style.color=e.color}return i}function gh(e){const{style:t}=e;return{style:Ai({spacing:(null==t?void 0:t.spacing)||{}})}}const bh=[];function vh(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){return Jo().mostReadable(t,(0,u.map)(e,"color")).toHexString()}(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=tr(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=er(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:nr(r,i.slug)},n}),{})}render(){return(0,s.createElement)(e,i({},this.props,{colors:void 0},this.state,this.setters,{colorUtils:this.colorUtils}))}}])}function kh(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)(vh(t,n),"withCustomColors")}}function _h(...e){const t=(0,d.createHigherOrderComponent)((e=>t=>{const n=po("color.palette")||bh;return(0,s.createElement)(e,i({},t,{colors:n}))}),"withEditorColorPalette");return(0,d.createHigherOrderComponent)(vh(e,t),"withColors")}const yh=[];var Eh=(...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=po("typography.fontSizes")||yh;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=Jl(n,l,e[o]);return t[r]={...i,class:ti(l)},t}),{});return{...o,...l}}render(){return(0,s.createElement)(e,i({},this.props,{fontSizes:void 0},this.state,this.setters))}}]),"withFontSizes")},Ch=(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"})),Sh=(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"})),wh=(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 Bh=[{icon:Ch,title:(0,h.__)("Align text left"),align:"left"},{icon:Sh,title:(0,h.__)("Align text center"),align:"center"},{icon:wh,title:(0,h.__)("Align text right"),align:"right"}],Ih={position:"bottom right",isAlternate:!0};var xh=function({value:e,onChange:t,alignmentControls:n=Bh,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)()?wh:Ch,label:o,toggleProps:{describedBy:r,className:d?"is-pressed":void 0},popoverProps:Ih,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 Th(e){return(0,s.createElement)(xh,i({},e,{isToolbar:!1}))}function Nh(e){return(0,s.createElement)(xh,i({},e,{isToolbar:!0}))}var Ph={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(Gn),r=t();return{selectedBlockName:r?n(r):null,rootClientId:o().rootClientId}}),[]),[o,r,l]=Cp(t,u.noop),i=(0,s.useMemo)((()=>(e.trim()?Xp(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)(yd,{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 Rh=[];function Lh({completers:e=Rh}){const{name:t}=Kn();return(0,s.useMemo)((()=>{let n=e;return t===(0,r.getDefaultBlockName)()&&(n=n.concat([Ph])),(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 Mh=function(e){return(0,s.createElement)(p.Autocomplete,i({},e,{completers:Lh(e)}))},Ah=(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"})),Dh=function({isActive:e,label:t=(0,h.__)("Toggle full height"),onToggle:n,isDisabled:o}){return(0,s.createElement)(p.ToolbarButton,{isActive:e,icon:Ah,label:t,onClick:()=>n(!e),disabled:o})},Oh=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!==Ll.DOWN||(t.preventDefault(),e())},label:t,icon:l,showTooltip:!0,disabled:r}),renderContent:()=>(0,s.createElement)(p.__experimentalAlignmentMatrixControl,{hasFocusBorder:!1,onChange:n,value:o})})},Fh=(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"})),zh=function({rootLabelText:e}){const{selectBlock:t,clearSelectedBlock:n}=(0,m.useDispatch)(Gn),{clientId:o,parents:r,hasSelection:l}=(0,m.useSelect)((e=>{const{getSelectionStart:t,getSelectedBlockClientId:n,getBlockParents:o}=e(Gn),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)(yo,{icon:Fh,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)(Sm,{clientId:e})),(0,s.createElement)(yo,{icon:Fh,className:"block-editor-block-breadcrumb__separator"})))),!!o&&(0,s.createElement)("li",{className:"block-editor-block-breadcrumb__current","aria-current":"true"},(0,s.createElement)(Sm,{clientId:o})))};function Vh({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(Gn);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 Hh=()=>(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"})),Uh=({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)(Hh,null))),Gh=({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!==Ll.DOWN||(e.preventDefault(),n())},icon:(0,s.createElement)(t,null,(0,s.createElement)(e,null,(0,s.createElement)(Uh,null)))}));var Wh=({children:e,...t})=>(0,s.createElement)(p.Dropdown,{position:"bottom right",className:"block-library-colors-selector",contentClassName:"block-library-colors-selector__popover",renderToggle:Gh(t),renderContent:()=>e}),jh=(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 $h=Hu(p.__experimentalTreeGridRow);function Kh({isSelected:e,position:t,level:n,rowCount:o,children:r,className:l,path:a,...u}){const d=Wu({isSelected:e,adjustScrolling:!1,enableAnimation:!0,triggerAnimationOnChange:a.join("_")});return(0,s.createElement)($h,i({ref:d,className:c()("block-editor-list-view-leaf",l),level:n,positionInSet:t,setSize:o},u),r)}const qh=(0,s.createContext)({__experimentalFeatures:!1,__experimentalPersistentListViewFeatures:!1}),Yh=()=>(0,s.useContext)(qh),Zh=(e,t,n)=>(0,h.sprintf)(
|
57 |
/* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */
|
58 |
-
(0,
|
59 |
/* translators: 1: The numerical position of the block that will be inserted. 2: The level of nesting for the block that will be inserted. */
|
60 |
-
(0,
|
61 |
-
/* 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 fg=(0,s.forwardRef)((function({isDisabled:e,__experimentalFeatures:t,...n},o){const r=(0,m.useSelect)((e=>!!e(Gn).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)(mg,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)(pg,{showNestedBlocks:!0,showOnlyCurrentHierarchy:!0,__experimentalFeatures:t}))})})),hg=(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"})),gg=function({icon:e=hg,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"))))},bg=(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 vg="carousel",kg="grid",_g=({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"))),yg=({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:Nm,label:(0,h.__)("Previous pattern"),onClick:e,disabled:0===n}),(0,s.createElement)(p.Button,{icon:Tm,label:(0,h.__)("Next pattern"),onClick:t,disabled:n===o-1}));var Eg=({viewMode:e,setViewMode:t,handlePrevious:n,handleNext:o,activeSlide:r,totalSlides:l,onBlockPatternSelect:i,onStartBlank:a})=>{const c=e===vg,u=(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__display-controls"},(0,s.createElement)(p.Button,{icon:ro,label:(0,h.__)("Carousel view"),onClick:()=>t(vg),isPressed:c}),(0,s.createElement)(p.Button,{icon:bg,label:(0,h.__)("Grid view"),onClick:()=>t(kg),isPressed:e===kg}));return(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__toolbar"},c&&(0,s.createElement)(yg,{handlePrevious:n,handleNext:o,activeSlide:r,totalSlides:l}),u,c&&(0,s.createElement)(_g,{onBlockPatternSelect:i,onStartBlank:a}))};const Cg=({viewMode:e,activeSlide:t,patterns:n,onBlockPatternSelect:o})=>{const r=(0,p.__unstableUseCompositeState)(),l="block-editor-block-pattern-setup__container";if(e===vg){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)(wg,{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)(Sg,{key:e.name,pattern:e,onSelect:o,composite:r}))))};function Sg({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)(Sg,`${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)(up,{blocks:r,viewportWidth:c}),(0,s.createElement)("div",{className:`${o}__item-title`},l)),!!a&&(0,s.createElement)(p.VisuallyHidden,{id:u},a))}function wg({className:e,pattern:t}){const{blocks:n,title:o,description:r}=t,l=(0,d.useInstanceId)(wg,"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)(up,{blocks:n,__experimentalLive:!0}),!!r&&(0,s.createElement)(p.VisuallyHidden,{id:l},r))}var Bg=({clientId:e,blockName:t,filterPatternsFn:n,startBlankComponent:o,onBlockPatternSelect:l})=>{const[i,a]=(0,s.useState)(vg),[c,u]=(0,s.useState)(0),[d,p]=(0,s.useState)(!1),{replaceBlock:f}=(0,m.useDispatch)(Gn),h=function(e,t,n){return(0,m.useSelect)((o=>{const{getBlockRootClientId:r,__experimentalGetPatternsByBlockTypes:l,__experimentalGetAllowedPatterns:i}=o(Gn),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)(Eg,{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)(Cg,{viewMode:i,activeSlide:c,patterns:h,onBlockPatternSelect:g}))};const Ig=(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 xg=function({blockClientId:e}){const[t,n]=(0,s.useState)(),{updateBlockAttributes:o}=(0,m.useDispatch)(Gn),{variations:l,blockAttributes:i}=(0,m.useSelect)((t=>{const{getBlockVariations:n}=t(r.store),{getBlockName:o,getBlockAttributes:l}=t(Gn),i=e&&o(e);return{variations:i&&n(i,"transform"),blockAttributes:l(e)}}),[e]);if((0,s.useEffect)((()=>{var e;n(null===(e=Ig(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:Rm,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 Tg=(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"})),Ng=(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"})),Pg={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:Ng,title:(0,h._x)("Align middle","Block vertical alignment setting")},bottom:{icon:Tg,title:(0,h._x)("Align bottom","Block vertical alignment setting")}},Rg=["top","center","bottom"],Lg={isAlternate:!0};var Mg=function({value:e,onChange:t,controls:n=Rg,isCollapsed:o=!0,isToolbar:r}){const l=Pg[e],a=Pg.top,c=r?p.ToolbarGroup:p.ToolbarDropdownMenu,u=r?{isCollapsed:o}:{};return(0,s.createElement)(c,i({popoverProps:Lg,icon:l?l.icon:a.icon,label:(0,h._x)("Change vertical alignment","Block vertical alignment setting label"),controls:n.map((n=>{return{...Pg[n],isActive:e===n,role:o?"menuitemradio":void 0,onClick:(r=n,()=>t(e===r?void 0:r))};var r}))},u))};function Ag(e){return(0,s.createElement)(Mg,i({},e,{isToolbar:!1}))}function Dg(e){return(0,s.createElement)(Mg,i({},e,{isToolbar:!0}))}var Og=(0,d.createHigherOrderComponent)((e=>t=>{const n=po("color.palette"),o=!po("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"),Fg=Og(p.ColorPalette);function zg({onChange:e,value:t,...n}){return(0,s.createElement)(hr,i({},n,{onColorChange:e,colorValue:t,gradients:[],disableCustomGradients:!0}))}var Vg=function(e,t){return(Vg=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)},Hg=function(){return(Hg=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 Ug(e,t,n,o){void 0===o&&(o=0);var r=Jg(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 Gg(e,t,n,o,r){void 0===r&&(r=0);var l=Jg(t.width,t.height,r),i=l.width,s=l.height;return{x:Wg(e.x,i,n.width,o),y:Wg(e.y,s,n.height,o)}}function Wg(e,t,n,o){var r=t*o/2-n/2;return Math.min(r,Math.max(e,-r))}function jg(e,t){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function $g(e,t){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI}function Kg(e,t,n,o,r,l,i){void 0===l&&(l=0),void 0===i&&(i=!0);var s=i&&0===l?qg:Yg,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:Hg(Hg({},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 qg(e,t){return Math.min(e,Math.max(0,t))}function Yg(e,t){return t}function Zg(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 Xg(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function Qg(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 Jg(e,t,n){var o=e/2,r=t/2,l=[Qg(0,0,o,r,n),Qg(e,0,o,r,n),Qg(e,t,o,r,n),Qg(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 eb(){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 tb=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=Zg(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:Ug(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=Hg({},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?Gg(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?Gg(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=Kg(n.props.restrictPosition?Gg(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?Gg(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}Vg(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=jg(n,o),this.lastPinchRotation=$g(n,o),this.onDragStart(Xg(n,o))},t.prototype.onPinchMove=function(e){var n=this,o=t.getTouchPoint(e.touches[0]),r=t.getTouchPoint(e.touches[1]),l=Xg(o,r);this.onDrag(l),this.rafPinchTimeout&&window.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=window.requestAnimationFrame((function(){var e=jg(o,r),t=n.props.zoom*(e/n.lastPinchDistance);n.setNewZoom(t,l),n.lastPinchDistance=e;var i=$g(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,b=g.containerClassName,v=g.cropAreaClassName,k=g.mediaClassName;return xs().createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(t){return e.containerRef=t},"data-testid":"container",style:m,className:eb("reactEasyCrop_Container",b)},n?xs().createElement("img",Hg({alt:"",className:eb("reactEasyCrop_Image",k)},r,{src:n,ref:function(t){return e.imageRef=t},style:Hg(Hg({},h),{transform:"translate("+i+"px, "+s+"px) rotate("+a+"deg) scale("+c+")"}),onLoad:this.onMediaLoad})):o&&xs().createElement("video",Hg({autoPlay:!0,loop:!0,muted:!0,className:eb("reactEasyCrop_Video",k)},r,{src:o,ref:function(t){return e.videoRef=t},onLoadedMetadata:this.onMediaLoad,style:Hg(Hg({},h),{transform:"translate("+i+"px, "+s+"px) rotate("+a+"deg) scale("+c+")"}),controls:!1})),this.state.cropSize&&xs().createElement("div",{style:Hg(Hg({},f),{width:this.state.cropSize.width,height:this.state.cropSize.height}),"data-testid":"cropper",className:eb("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}(xs().Component);const nb={position:"bottom right",isAlternate:!0};var ob=window.wp.apiFetch,rb=n.n(ob);const lb=(0,s.createContext)({}),ib=()=>(0,s.useContext)(lb);function sb({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)(),[b,v]=(0,s.useState)(),k=(0,s.useCallback)((()=>{u({x:0,y:0}),p(100),f(0),g(t/n),v(t/n)}),[t,n,u,p,f,g,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),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:b,initializeTransformValues:k})),[o,r,i,a,c,u,d,p,m,f,_,h,g,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)(xp.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,rb()({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)(
|
62 |
/* translators: 1. Error message */
|
63 |
-
(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)(lb.Provider,{value:p},c)}function ab({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:b}=ib();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)(tb,{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 cb=(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 ub(){const{isInProgress:e,zoom:t,setZoom:n}=ib();return(0,s.createElement)(p.Dropdown,{contentClassName:"wp-block-image__zoom",popoverProps:nb,renderToggle:({isOpen:t,onToggle:n})=>(0,s.createElement)(p.ToolbarButton,{icon:cb,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 db=(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"})),pb=(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 mb({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?db:void 0},e))))}function fb({toggleProps:e}){const{isInProgress:t,aspect:n,setAspect:o,defaultAspect:r}=ib();return(0,s.createElement)(p.DropdownMenu,{icon:pb,label:(0,h.__)("Aspect Ratio"),popoverProps:nb,toggleProps:e,className:"wp-block-image__aspect-ratio"},(({onClose:e})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(mb,{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)(mb,{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)(mb,{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 hb=(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 gb(){const{isInProgress:e,rotateClockwise:t}=ib();return(0,s.createElement)(p.ToolbarButton,{icon:hb,label:(0,h.__)("Rotate"),onClick:t,disabled:e})}function bb(){const{isInProgress:e,apply:t,cancel:n}=ib();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 vb({url:e,width:t,height:n,clientWidth:o,naturalHeight:r,naturalWidth:l}){return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(ab,{url:e,width:t,height:n,clientWidth:o,naturalHeight:r,naturalWidth:l}),(0,s.createElement)(Jn,null,(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(ub,null),(0,s.createElement)(p.ToolbarItem,null,(e=>(0,s.createElement)(fb,{toggleProps:e}))),(0,s.createElement)(gb,null)),(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(bb,null))))}const kb=[25,50,75,100];function _b({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")},kb.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 yb=(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"})),Eb=({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}=this.props;t&&null!==n&&this.suggestionNodes[n]&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,ld()(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=""){const{__experimentalFetchLinkSuggestions:t,__experimentalHandleURLSuggestions:n}=this.props;if(!t)return;const o=!(e&&e.length);if(!o&&(e.length<2||!n&&(0,Ap.isURL)(e)))return void this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});this.isUpdatingSuggestions=!0,this.setState({selectedSuggestion:null,loading:!0});const r=t(e,{isInitialSuggestions:o});r.then((e=>{this.suggestionsRequest===r&&(this.setState({suggestions:e,loading:!1,showSuggestions:!!e.length}),e.length?this.props.debouncedSpeak((0,h.sprintf)(
|
64 |
/* translators: %s: number of results. */
|
65 |
-
(0,
|
66 |
/* translators: %s: search term. */
|
67 |
-
(0,
|
68 |
/* translators: %s: search term. */
|
69 |
-
(0,h.__)('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)=>_&&xb===e.type?(0,s.createElement)(wb,{searchTerm:n,buttonText:f,onClick:()=>o(e),key:e.type,itemProps:l(e,t),isSelected:t===u}):xb===e.type?null:(0,s.createElement)(Ib,{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 Pb(e){const t=(0,u.startsWith)(e,"#");return(0,Ap.isURL)(e)||e&&e.includes("www.")||t}const Rb=()=>Promise.resolve([]),Lb=e=>{let t="URL";const n=(0,Ap.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,Ap.prependHTTP)(e):e,type:t}])};const Mb=()=>Promise.resolve([]),Ab=(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)(Nb,e)),fetchSuggestions:g=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(Gn);return{fetchSearchSuggestions:t().__experimentalFetchLinkSuggestions}}),[]),l=t?Lb:Rb;return(0,s.useCallback)(((t,{isInitialSuggestions:i})=>Pb(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||Pb(e)||!r?s:s.concat({title:e,url:e,type:xb})})(t,{...e,isInitialSuggestions:i},r,l,n,o)),[l,r,n])}(k,b,l,_),S=p?g||C:Mb,w=(0,d.useInstanceId)(Ab),[B,I]=(0,s.useState)(),x=async e=>{let t=e;if(xb!==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)(Sb,{className:o,value:e,onChange:(e,t)=>{a(e),I(t)},placeholder:null!=r?r:(0,h.__)("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=>{x(t||B||{url:e})},ref:E}),t)}));var Db=Ab;const{Slot:Ob,Fill:Fb}=(0,p.createSlotFill)("BlockEditorLinkControlViewer");function zb(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 Vb({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)(zb,{richData:null,isFetching:!1}),{fetchRichUrlData:o}=(0,m.useSelect)((e=>{const{getSettings:t}=e(Gn);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,Ap.filterURLForDisplay)((0,Ap.safeDecodeURI)(e.url),16)||"";return(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":i,"is-fetching":!!l,"is-preview":!0})},(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})},null!=r&&r.icon?(0,s.createElement)("img",{src:null==r?void 0:r.icon,alt:""}):(0,s.createElement)(yo,{icon:Bb})),(0,s.createElement)("span",{className:"block-editor-link-control__search-item-details"},(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,h.__)("Edit")),(0,s.createElement)(Ob,{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 Hb({searchInputPlaceholder:e,value:t,settings:n=Tb,onChange:o=u.noop,onRemove:r,noDirectEntry:l=!1,showSuggestions:i=!0,showInitialSuggestions:a,forceIsEditingLink:c,createSuggestion:d,withCreateSuggestion:m,inputValue:f="",suggestionsQuery:g={},noURLSuggestion:b=!1,createSuggestionButtonText:v,hasRichPreviews:k=!1}){void 0===m&&d&&(m=!0);const _=(0,s.useRef)(!0),y=(0,s.useRef)(),[E,C]=(0,s.useState)(t&&t.url||""),S=f||E,[w,B]=(0,s.useState)(void 0!==c?c:!t||!t.url),I=(0,s.useRef)(!1);function x(){var e;I.current=!(null===(e=y.current)||void 0===e||!e.contains(y.current.ownerDocument.activeElement)),B(!1)}(0,s.useEffect)((()=>{void 0!==c&&c!==w&&B(c)}),[c]),(0,s.useEffect)((()=>{_.current?_.current=!1:((Gi.focus.focusable.find(y.current)[0]||y.current).focus(),I.current=!1)}),[w]);const{createPage:T,isCreatingPage:N,errorMessage:P}=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,h.__)("An unknown error occurred during creation. Please try again.")),e}finally{o(!1)}},isCreatingPage:n,errorMessage:r}}(d),R=()=>{S!==(null==t?void 0:t.url)&&o({url:S}),x()},L=r&&t&&!w&&!N,M=!(null==n||!n.length);return(0,s.createElement)("div",{tabIndex:-1,ref:y,className:"block-editor-link-control"},N&&(0,s.createElement)("div",{className:"block-editor-link-control__loading"},(0,s.createElement)(p.Spinner,null)," ",(0,h.__)("Creating"),"…"),(w||!t)&&!N&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"block-editor-link-control__search-input-wrapper"},(0,s.createElement)(Db,{currentLink:t,className:"block-editor-link-control__search-input",placeholder:e,value:S,withCreateSuggestion:m,onCreateSuggestion:T,onChange:C,onSelect:e=>{o(e),x()},showInitialSuggestions:a,allowDirectEntry:!l,showSuggestions:i,suggestionsQuery:g,withURLSuggestion:!b,createSuggestionButtonText:v},(0,s.createElement)("div",{className:"block-editor-link-control__search-actions"},(0,s.createElement)(p.Button,{onClick:()=>R(),onKeyDown:e=>{const{keyCode:t}=e;t===Ll.ENTER&&(e.preventDefault(),R())},label:(0,h.__)("Submit"),icon:yb,className:"block-editor-link-control__search-submit"})))),P&&(0,s.createElement)(p.Notice,{className:"block-editor-link-control__search-error",status:"error",isDismissible:!1},P)),t&&!w&&!N&&(0,s.createElement)(Vb,{key:null==t?void 0:t.url,value:t,onEditClick:()=>B(!0),hasRichPreviews:k}),(M||L)&&(0,s.createElement)("div",{className:"block-editor-link-control__tools"},(0,s.createElement)(Eb,{value:t,settings:n,onChange:o}),L&&(0,s.createElement)(p.Button,{className:"block-editor-link-control__unlink",isDestructive:!0,variant:"link",onClick:r},(0,h.__)("Unlink"))))}Hb.ViewerFill=Fb;var Ub=Hb;const Gb={position:"bottom right",isAlternate:!0};var Wb=()=>(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:Rm
|
70 |
-
/* translators: button label text should, if possible, be under 16 characters. */,label:(0,h.__)("More"),toggleProps:{...n,className:c()(n.className,{"is-pressed":t})},controls:(0,u.orderBy)(e.map((([{props:e}])=>e)),"title"),popoverProps:Gb})))}))),jb=({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)(Wb,null)))):(0,s.createElement)(Jn,{group:"inline"},(0,s.createElement)(Wb,null));function $b(){const{didAutomaticChange:e,getSettings:t}=(0,m.useSelect)(Gn);return(0,d.useRefEffect)((n=>{function o(n){const{keyCode:o}=n;n.defaultPrevented||o!==Ll.DELETE&&o!==Ll.BACKSPACE&&o!==Ll.ESCAPE||e()&&(n.preventDefault(),t().__experimentalUndo())}return n.addEventListener("keydown",o),()=>{n.removeEventListener("keydown",o)}}),[])}function Kb(e){return e.filter((({type:e})=>/^image\/(?:jpe?g|png|gif)$/.test(e))).map((e=>`<img src="${(0,sf.createBlobURL)(e)}">`)).join("")}var qb=window.wp.shortcode;function Yb(e,t){if(null!=t&&t.length){let n=e.formats.length;for(;n--;)e.formats[n]=[...t,...e.formats[n]||[]]}}function Zb(e){if(!0===e||"p"===e||"li"===e)return!0===e?"p":e}function Xb({allowedFormats:e,formattingControls:t,disableFormats:n}){return n?Xb.EMPTY_ARRAY:e||t?e||(Mt()("wp.blockEditor.RichText formattingControls prop",{since:"5.4",alternative:"allowedFormats"}),t.map((e=>`core/${e}`))):void 0}function Qb({value:e,pastedBlocks:t=[],onReplace:n,onSplit:o,onSplitMiddle:r,multilineTag:l}){if(!n||!o)return;const i=[],[s,a]=(0,Rt.split)(e),c=t.length>0;let u=-1;const d=(0,Rt.isEmpty)(s)&&!(0,Rt.isEmpty)(a);c&&(0,Rt.isEmpty)(s)||(i.push(o((0,Rt.toHTMLString)({value:s,multilineTag:l}),!d)),u+=1),c?(i.push(...t),u+=t.length):r&&i.push(r()),(c||r)&&(0,Rt.isEmpty)(a)||i.push(o((0,Rt.toHTMLString)({value:a,multilineTag:l}),d)),n(i,c?u:1,c?-1:0)}function Jb(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:h}=t.current;if(!n)return void e.preventDefault();const{clipboardData:g}=e;let b="",v="";try{b=g.getData("text/plain"),v=g.getData("text/html")}catch(e){try{v=g.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,Rt.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,Gi.getFilesFromDataTransfer)(g)];if("true"===g.getData("rich-text")){const e=(0,Rt.create)({html:v,multilineTag:m,multilineWrapperTags:"li"===m?["ul","ol"]:void 0,preserveWhiteSpace:f});return Yb(e,i.activeFormats),void l((0,Rt.insert)(i,e))}if(h)return void l((0,Rt.insert)(i,(0,Rt.create)({text:b})));if(_&&_.length&&!v){const e=(0,r.pasteHandler)({HTML:Kb(_),mode:"BLOCKS",tagName:a,preserveWhiteSpace:f});return window.console.log("Received items:\n\n",_),void(c&&(0,Rt.isEmpty)(i)?c(e):Qb({value:i,pastedBlocks:e,onReplace:c,onSplit:u,onSplitMiddle:d,multilineTag:m}))}let y=c&&u?"AUTO":"INLINE";var E;"AUTO"===y&&(0,Rt.isEmpty)(i)&&(E=b,(0,qb.regexp)(".*").test(E))&&(y="BLOCKS"),p&&(0,Rt.isEmpty)(i)&&(0,Ap.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,Rt.create)({html:C});Yb(e,i.activeFormats),m&&(e=(0,Rt.replace)(e,/\n+/g,Rt.__UNSTABLE_LINE_SEPARATOR)),l((0,Rt.insert)(i,e))}else C.length>0&&(c&&(0,Rt.isEmpty)(i)?c(C,C.length-1,-1):Qb({value:i,pastedBlocks:C,onReplace:c,onSplit:u,onSplitMiddle:d,multilineTag:m}))}return e.addEventListener("paste",n),()=>{e.removeEventListener("paste",n)}}),[])}function ev(e){const{__unstableMarkLastChangeAsPersistent:t,__unstableMarkAutomaticChange:n}=(0,m.useDispatch)(Gn),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,Rt.toHTMLString)({value:(0,Rt.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 tv(e){const{__unstableMarkAutomaticChange:t}=(0,m.useDispatch)(Gn),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!==Ll.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,Rt.insert)(m,"\n")):f&&(0,Rt.__unstableIsEmptyLine)(m)?Qb({value:m,onReplace:i,onSplit:s,onSplitMiddle:a,multilineTag:c}):u((0,Rt.__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,Rt.insert)(m,"\n")):!f&&r?p():f&&Qb({value:m,onReplace:i,onSplit:s,onSplitMiddle:a,multilineTag:c})}}return e.addEventListener("keydown",o),()=>{e.removeEventListener("keydown",o)}}),[])}function nv(e){return e(Rt.store).getFormatTypes()}Xb.EMPTY_ARRAY=[];const ov=new Set(["a","audio","button","details","embed","iframe","input","label","select","textarea","video"]);function rv(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 lv(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 iv({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,Rt.getActiveFormat)(o,l),c=void 0!==a,u=(0,Rt.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 sv=(0,s.createContext)(),av=(0,s.createContext)(),cv=(0,s.forwardRef)((function e({children:t,tagName:n="div",value:o="",onChange:l,isSelected:a,multiline:f,inlineToolbar:h,wrapperClassName:g,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:L,unstableOnFocus:M,__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}=Kn(),{selectionStart:H,selectionEnd:U,isSelected:G,disabled:W}=(0,m.useSelect)((e=>{const{getSelectionStart:t,getSelectionEnd:n,isMultiSelecting:o,hasMultiSelection:r}=e(Gn),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:j}=(0,m.useDispatch)(Gn),$=Zb(f),K=Xb({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,Rt.__unstableCreateElement)(document,e).childNodes)));const X=(0,s.useCallback)(((e,t)=>{j(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)(nv,[]),l=(0,s.useMemo)((()=>r.filter((({name:e,tagName:t})=>!(o&&!o.includes(e)||n&&ov.has(t))))),[r,o,ov]),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,Rt.removeFormat)(e,t.name,0,e.text.length))})),e.formats}const{value:re,onChange:le,ref:ie}=(0,Rt.__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:$,__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:Lh(e)})}({onReplace:v,completers:b,record:re,onChange:le});!function({value:e}){const t=e.activeFormats&&!!e.activeFormats.length,{isCaretWithinFormattedText:n}=(0,m.useSelect)(Gn),{enterFormattedText:o,exitFormattedText:r}=(0,m.useDispatch)(Gn);(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)(Gn);(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)(sv.Provider,{value:ae},(0,s.createElement)(av.Provider,{value:ce},t&&t({value:re,onChange:le,onFocus:ue}),(0,s.createElement)(iv,{value:re,onChange:le,onFocus:ue,formatTypes:Q,forwardedRef:z}))),G&&q&&(0,s.createElement)(jb,{inline:h,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,ev({value:re,onChange:le,__unstableAllowPrefixTransformations:A,formatTypes:Q,onReplace:v}),(0,d.useRefEffect)((e=>{function t(e){(Ll.isKeyboardEvent.primary(e,"z")||Ll.isKeyboardEvent.primary(e,"y")||Ll.isKeyboardEvent.primaryShift(e,"z"))&&e.preventDefault()}return e.addEventListener("keydown",t),()=>{e.addEventListener("keydown",t)}}),[]),rv(ae),lv(ce),$b(),Jb({isSelected:G,disableFormats:R,onChange:le,value:re,formatTypes:Q,tagName:n,onReplace:v,onSplit:w,onSplitMiddle:I,__unstableEmbedURLOnPaste:P,multilineTag:$,preserveWhiteSpace:T,pastePlainText:N}),tv({removeEditorOnlyFormats:oe,value:re,onReplace:v,onSplit:w,onSplitMiddle:I,multilineTag:$,onChange:le,disableLineBreaks:L,onSplitAtEnd:B}),z,O]),contentEditable:!W||void 0,suppressContentEditableWarning:!W,className:c()("block-editor-rich-text__editable",D.className,"rich-text"),onFocus:M,onKeyDown:function(e){const{keyCode:t}=e;if(!e.defaultPrevented&&(t===Ll.DELETE||t===Ll.BACKSPACE)){const{start:n,end:o,text:r}=re,l=t===Ll.BACKSPACE,i=re.activeFormats&&!!re.activeFormats.length;if(!(0,Rt.isCollapsed)(re)||i||l&&0!==n||!l&&o!==r.length)return;S&&S(!l),C&&(0,Rt.isEmpty)(re)&&l&&C(!l),e.preventDefault()}}})));if(!g)return pe;Mt()("wp.blockEditor.RichText wrapperClassName prop",{since:"5.4",alternative:"className prop or create your own wrapper div"});const me=c()("block-editor-rich-text",g);return(0,s.createElement)("div",{className:me},pe)}));cv.Content=({value:e,tagName:t,multiline:n,...o})=>{Array.isArray(e)&&(e=r.children.toHTML(e));const l=Zb(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},cv.isEmpty=e=>!e||0===e.length;var uv=cv;function dv({value:e,onChange:t}){return(0,s.createElement)(ng,null,(0,s.createElement)(uv,{value:e,onChange:t,placeholder:(0,h.__)("Navigation item"),withoutInteractiveFormatting:!0,allowedFormats:["core/bold","core/italic","core/image","core/strikethrough"]}))}var pv=(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"})),mv=(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"})),fv=(0,p.withFilters)("editor.MediaUpload")((()=>null)),hv=function({fallback:e=null,children:t}){return(0,m.useSelect)((e=>{const{getSettings:t}=e(Gn);return!!t().mediaUpload}),[])?t:e},gv=(0,d.compose)([(0,m.withDispatch)((e=>{const{createNotice:t,removeNotice:n}=e(xp.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,h.__)("Replace"),createNotice:c,removeNotice:d})=>{const[f,g]=(0,s.useState)(e),b=(0,m.useSelect)((e=>e(Gn).getSettings().mediaUpload),[]),v=(0,s.createRef)(),k=(0,u.uniqueId)("block-editor/media-replace-flow/error-notice/"),_=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:k,isDismissible:!0})}),1e3)},y=e=>{g(e.url),r(e),(0,Pt.speak)((0,h.__)("The media file has been replaced")),d(k)},E=e=>{e.keyCode===Ll.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:v,"aria-expanded":e,"aria-haspopup":"true",onClick:t,onKeyDown:E},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)(fv,{value:t,onSelect:e=>y(e),allowedTypes:n,render:({open:e})=>(0,s.createElement)(p.MenuItem,{icon:pv,onClick:e},(0,h.__)("Open Media Library"))}),(0,s.createElement)(hv,null,(0,s.createElement)(p.FormFileUpload,{onChange:e=>{(e=>{const t=e.target.files;i(t),b({allowedTypes:n,filesList:t,onFileChange:([e])=>{y(e)},onError:_})})(e)},accept:o,render:({openFileDialog:e})=>(0,s.createElement)(p.MenuItem,{icon:mv,onClick:()=>{e()}},(0,h.__)("Upload"))}))),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,h.__)("Current media URL:")),(0,s.createElement)(Ub,{value:{url:f},settings:[],showSuggestions:!1,onChange:({url:e})=>{g(e),l(e),v.current.focus()}})))})})),bv=(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 vv({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,Ap.filterURLForDisplay)((0,Ap.safeDecodeURI)(e))):(0,s.createElement)("span",{className:o})}function kv({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:Rm,label:(0,h.__)("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))}kv.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)(Sb,{value:o,onChange:n,autocompleteRef:e}),(0,s.createElement)(p.Button,{icon:yb,label:(0,h.__)("Apply"),type:"submit"}))},kv.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)(vv,{url:o,urlLabel:r,className:t}),n&&(0,s.createElement)(p.Button,{icon:bv,label:(0,h.__)("Edit"),onClick:n}))};var _v=kv;const yv=({src:e,onChange:t,onSubmit:n,onClose:o})=>(0,s.createElement)(_v,{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,h.__)("URL"),placeholder:(0,h.__)("Paste or type URL"),onChange:t,value:e}),(0,s.createElement)(p.Button,{className:"block-editor-media-placeholder__url-input-submit-button",icon:yb,label:(0,h.__)("Apply"),type:"submit"})));var Ev=(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:g=!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}){const T=(0,m.useSelect)((e=>{const{getSettings:t}=e(Gn);return t().mediaUpload}),[]),[N,P]=(0,s.useState)(""),[R,L]=(0,s.useState)(!1);(0,s.useEffect)((()=>{var t;P(null!==(t=null==e?void 0:e.src)&&void 0!==t?t:"")}),[null==e?void 0:e.src]);const M=e=>{P(e.target.value)},A=()=>{L(!0)},D=()=>{L(!1)},O=e=>{e.preventDefault(),N&&S&&(S(N),D())},F=n=>{if(!b)return E(n);let o;if(B(n),g)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);T({allowedTypes:t,filesList:n,onFileChange:o,onError:y})},z=e=>{F(e.target.files)},V=e=>{let{instructions:u,title:d}=r;if(T||S||(u=(0,h.__)("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&&T&&(u=(0,h.__)("Upload a media file or pick one from your media library."),r?u=(0,h.__)("Upload an audio file, pick one from your media library, or add one with a URL."):l?u=(0,h.__)("Upload an image file, pick one from your media library, or add one with a URL."):i&&(u=(0,h.__)("Upload a video file, pick one from your media library, or add one with a URL."))),void 0===d&&(d=(0,h.__)("Media"),r?d=(0,h.__)("Audio"):l?d=(0,h.__)("Image"):i&&(d=(0,h.__)("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},e,x)},H=()=>k?null:(0,s.createElement)(p.DropZone,{onFilesDrop:F,onHTMLDrop:I}),U=()=>C&&(0,s.createElement)(p.Button,{className:"block-editor-media-placeholder__cancel-button",title:(0,h.__)("Cancel"),variant:"link",onClick:C},(0,h.__)("Cancel")),G=()=>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:A,isPressed:R,variant:"tertiary"},(0,h.__)("Insert from URL")),R&&(0,s.createElement)(yv,{src:N,onChange:M,onSubmit:O,onClose:D}));return v||_?(v&&Mt()("wp.blockEditor.MediaPlaceholder dropZoneUIOnly prop",{since:"5.4",alternative:"disableMediaButtons"}),(0,s.createElement)(hv,null,H())):(0,s.createElement)(hv,{fallback:V(G())},(()=>{const n=(0,s.createElement)(fv,{addToGallery:f,gallery:g&&!(!t||0===t.length)&&t.every((e=>"image"===e||e.startsWith("image/"))),multiple:g,onSelect:E,allowedTypes:t,value:Array.isArray(e)?e.map((({id:e})=>e)):e.id,render:({open:e})=>(0,s.createElement)(p.Button,{variant:"tertiary",onClick:()=>{e()}},(0,h.__)("Media Library"))});if(T&&a)return(0,s.createElement)(s.Fragment,null,H(),(0,s.createElement)(p.FormFileUpload,{onChange:z,accept:d,multiple:g,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,h.__)("Upload")),n,G(),U());return V(t)}}));if(T){const e=(0,s.createElement)(s.Fragment,null,H(),(0,s.createElement)(p.FormFileUpload,{variant:"primary",className:c()("block-editor-media-placeholder__button","block-editor-media-placeholder__upload-button"),onChange:z,accept:d,multiple:g},(0,h.__)("Upload")),n,G(),U());return V(e)}return V(n)})())})),Cv=({colorSettings:e,...t})=>{const n=e.map((({value:e,onChange:t,...n})=>({...n,colorValue:e,onColorChange:t})));return(0,s.createElement)(Qr,i({settings:n,gradients:[],disableCustomGradients:!0},t))};const Sv=(0,s.forwardRef)(((e,t)=>(0,s.createElement)(uv,i({ref:t},e,{__unstableDisableFormats:!0,preserveWhiteSpace:!0}))));Sv.Content=({value:e="",tagName:t="div",...n})=>(0,s.createElement)(t,n,e);var wv=Sv,Bv=(0,s.forwardRef)((({__experimentalVersion:e,...t},n)=>{if(2===e)return(0,s.createElement)(wv,i({ref:n},t));const{className:o,onChange:r,...l}=t;return(0,s.createElement)(ss.Z,i({ref:n,className:c()("block-editor-plain-text",o),onChange:e=>r(e.target.value)},l))}));function Iv({property:e,viewport:t,desc:n}){const o=(0,d.useInstanceId)(Iv),r=n||(0,h.sprintf)(
|
71 |
/* translators: 1: property name. 2: viewport name. */
|
72 |
-
(0,
|
73 |
/* translators: 'Label. Used to signify a layout property (eg: margin, padding) will apply uniformly to all screensizes.' */
|
74 |
-
label:(0,
|
75 |
/* translators: 'Toggle control label. Should the property be the same across all screen sizes or unique per screen size.'. %s property value for the control (eg: margin, padding...etc) */
|
76 |
-
(0,
|
77 |
-
/* translators: 'Help text for the responsive mode toggle control.' */return(0,s.createElement)("fieldset",{className:"block-editor-responsive-block-control"},(0,s.createElement)("legend",{className:"block-editor-responsive-block-control__title"},t),(0,s.createElement)("div",{className:"block-editor-responsive-block-control__inner"},(0,s.createElement)(p.ToggleControl,{className:"block-editor-responsive-block-control__toggle",label:m,checked:!a,onChange:r,help:f}),(0,s.createElement)("div",{className:c()("block-editor-responsive-block-control__group",{"is-responsive":a})},!a&&
|
78 |
-
/* translators: button label text should, if possible, be under 16 characters. */,label:(0,
|
79 |
/* translators: button label text should, if possible, be under 16 characters. */
|
80 |
-
children:(0,
|
81 |
/* translators: %d: number of blocks */
|
82 |
-
(0,
|
83 |
/* translators: %d: number of words */
|
84 |
-
(0,h._n)("%d word","%d words",t),t))))}));function Xv({blockName:e}){const{preferredStyle:t,onUpdatePreferredStyleVariations:n,styles:o}=(0,m.useSelect)((t=>{var n,o;const l=t(Gn).getSettings().__experimentalPreferredStyleVariations;return{preferredStyle:null==l||null===(n=l.value)||void 0===n?void 0:n[e],onUpdatePreferredStyleVariations:null!==(o=null==l?void 0:l.onChange)&&void 0!==o?o:null,styles:t(r.store).getBlockStyles(e)}}),[e]),l=(0,s.useMemo)((()=>[{label:(0,h.__)("Not set"),value:""},...o.map((({label:e,name:t})=>({label:e,value:t})))]),[o]),i=(0,s.useCallback)((t=>{n(e,t)}),[e,n]);return n&&(0,s.createElement)(p.SelectControl,{options:l,value:t||"",label:(0,h.__)("Default Style"),onChange:i})}const Qv=({clientId:e,blockName:t,hasBlockStyles:n,bubblesVirtually:o})=>{const l=Cm(e);return(0,s.createElement)("div",{className:"block-editor-block-inspector"},(0,s.createElement)(Ed,l),(0,s.createElement)(xg,{blockClientId:e}),n&&(0,s.createElement)("div",null,(0,s.createElement)(p.PanelBody,{title:(0,h.__)("Styles")},(0,s.createElement)(Ym,{clientId:e}),(0,r.hasBlockSupport)(t,"defaultStylePicker",!0)&&(0,s.createElement)(Xv,{blockName:t}))),(0,s.createElement)(qo.Slot,{bubblesVirtually:o}),(0,s.createElement)(qo.Slot,{__experimentalGroup:"dimensions",bubblesVirtually:!1,label:(0,h.__)("Dimensions")}),(0,s.createElement)("div",null,(0,s.createElement)(Jv,{bubblesVirtually:o})),(0,s.createElement)(qv,{key:"back"}))},Jv=({bubblesVirtually:e})=>{const t=(0,p.__experimentalUseSlot)(Ko.slotName);return Boolean(t.fills&&t.fills.length)?(0,s.createElement)(p.PanelBody,{className:"block-editor-block-inspector__advanced",title:(0,h.__)("Advanced"),initialOpen:!1},(0,s.createElement)(qo.Slot,{__experimentalGroup:"advanced",bubblesVirtually:e})):null};var ek=({showNoBlockSelectedMessage:e=!0,bubblesVirtually:t=!0})=>{const{count:n,hasBlockStyles:o,selectedBlockName:l,selectedBlockClientId:i,blockType:a}=(0,m.useSelect)((e=>{const{getSelectedBlockClientId:t,getSelectedBlockCount:n,getBlockName:o}=e(Gn),{getBlockStyles:l}=e(r.store),i=t(),s=i&&o(i),a=s&&(0,r.getBlockType)(s),c=s&&l(s);return{count:n(),selectedBlockClientId:i,selectedBlockName:s,blockType:a,hasBlockStyles:c&&c.length>0}}),[]);if(n>1)return(0,s.createElement)("div",{className:"block-editor-block-inspector"},(0,s.createElement)(Zv,null),(0,s.createElement)(qo.Slot,{bubblesVirtually:t}));const c=l===(0,r.getUnregisteredTypeHandlerName)();return a&&i&&!c?(0,s.createElement)(Qv,{clientId:i,blockName:a.name,hasBlockStyles:o,bubblesVirtually:t}):e?(0,s.createElement)("span",{className:"block-editor-block-inspector__no-blocks"},(0,h.__)("No block selected.")):null};function tk({children:e,__unstableContentRef:t,...n}){const o=(0,d.useViewportMatch)("medium"),r=(0,m.useSelect)((e=>e(Gn).getSettings().hasFixedToolbar),[]),l=(0,Md.__unstableUseShortcutEventMatch)(),{getSelectedBlockClientIds:a,getBlockRootClientId:c}=(0,m.useSelect)(Gn),{duplicateBlocks:f,removeBlocks:h,insertAfterBlock:g,insertBeforeBlock:b,clearSelectedBlock:v,moveBlocksUp:k,moveBlocksDown:_}=(0,m.useDispatch)(Gn);return(0,s.createElement)("div",i({},n,{onKeyDown:function(e){if(l("core/block-editor/move-up",e)){const t=a();if(t.length){e.preventDefault();const n=c((0,u.first)(t));k(t,n)}}else if(l("core/block-editor/move-down",e)){const t=a();if(t.length){e.preventDefault();const n=c((0,u.first)(t));_(t,n)}}else if(l("core/block-editor/duplicate",e)){const t=a();t.length&&(e.preventDefault(),f(t))}else if(l("core/block-editor/remove",e)){const t=a();t.length&&(e.preventDefault(),h(t))}else if(l("core/block-editor/insert-after",e)){const t=a();t.length&&(e.preventDefault(),g((0,u.last)(t)))}else if(l("core/block-editor/insert-before",e)){const t=a();t.length&&(e.preventDefault(),b((0,u.first)(t)))}else if(l("core/block-editor/delete-multi-selection",e)){const t=a();t.length>1&&(e.preventDefault(),h(t))}else l("core/block-editor/unselect",e)&&a().length>1&&(e.preventDefault(),v(),e.target.ownerDocument.defaultView.getSelection().removeAllRanges())}}),(0,s.createElement)(km,{__unstableContentRef:t},(r||!o)&&(0,s.createElement)(If,{isFixed:!0}),(0,s.createElement)(Pf,{__unstableContentRef:t}),(0,s.createElement)(p.Popover.Slot,{name:"block-toolbar",ref:gm(t)}),e))}var nk=function({rootClientId:e,clientId:t,isAppender:n,showInserterHelpPanel:o,showMostUsedBlocks:r=!1,__experimentalInsertionIndex:l,__experimentalFilterValue:i,onSelect:a=u.noop,shouldFocusBlock:c=!1}){const d=(0,m.useSelect)((n=>{const{getBlockRootClientId:o}=n(Gn);return e||o(t)||void 0}),[t,e]);return(0,s.createElement)(im,{onSelect:a,rootClientId:d,clientId:t,isAppender:n,showInserterHelpPanel:o,showMostUsedBlocks:r,__experimentalInsertionIndex:l,__experimentalFilterValue:i,shouldFocusBlock:c})};function ok(){return null}ok.Register=function(){const{registerShortcut:e}=(0,m.useDispatch)(Md.store);return(0,s.useEffect)((()=>{e({name:"core/block-editor/duplicate",category:"block",description:(0,h.__)("Duplicate the selected block(s)."),keyCombination:{modifier:"primaryShift",character:"d"}}),e({name:"core/block-editor/remove",category:"block",description:(0,h.__)("Remove the selected block(s)."),keyCombination:{modifier:"access",character:"z"}}),e({name:"core/block-editor/insert-before",category:"block",description:(0,h.__)("Insert a new block before the selected block(s)."),keyCombination:{modifier:"primaryAlt",character:"t"}}),e({name:"core/block-editor/insert-after",category:"block",description:(0,h.__)("Insert a new block after the selected block(s)."),keyCombination:{modifier:"primaryAlt",character:"y"}}),e({name:"core/block-editor/delete-multi-selection",category:"block",description:(0,h.__)("Remove multiple selected blocks."),keyCombination:{character:"del"},aliases:[{character:"backspace"}]}),e({name:"core/block-editor/select-all",category:"selection",description:(0,h.__)("Select all text when typing. Press again to select all blocks."),keyCombination:{modifier:"primary",character:"a"}}),e({name:"core/block-editor/unselect",category:"selection",description:(0,h.__)("Clear selection."),keyCombination:{character:"escape"}}),e({name:"core/block-editor/focus-toolbar",category:"global",description:(0,h.__)("Navigate to the nearest toolbar."),keyCombination:{modifier:"alt",character:"F10"}}),e({name:"core/block-editor/move-up",category:"block",description:(0,h.__)("Move the selected block(s) up."),keyCombination:{modifier:"secondary",character:"t"}}),e({name:"core/block-editor/move-down",category:"block",description:(0,h.__)("Move the selected block(s) down."),keyCombination:{modifier:"secondary",character:"y"}})}),[e]),null};var rk=ok;function lk(){return Mt()("wp.blockEditor.MultiSelectScrollIntoView",{hint:"This behaviour is now built-in."}),null}const ik=new Set([Ll.UP,Ll.RIGHT,Ll.DOWN,Ll.LEFT,Ll.ENTER,Ll.BACKSPACE]);function sk(){const e=(0,m.useSelect)((e=>e(Gn).isTyping())),{stopTyping:t}=(0,m.useDispatch)(Gn);return(0,d.useRefEffect)((n=>{if(!e)return;const{ownerDocument:o}=n;let r,l;function i(e){const{clientX:n,clientY:o}=e;r&&l&&(r!==n||l!==o)&&t(),r=n,l=o}return o.addEventListener("mousemove",i),()=>{o.removeEventListener("mousemove",i)}}),[e,t])}function ak(){const e=(0,m.useSelect)((e=>e(Gn).isTyping())),{startTyping:t,stopTyping:n}=(0,m.useDispatch)(Gn),o=sk(),r=(0,d.useRefEffect)((o=>{const{ownerDocument:r}=o,{defaultView:l}=r;if(e){let e;function t(t){const{target:o}=t;e=l.setTimeout((()=>{(0,Gi.isTextField)(o)||n()}))}function i(e){const{keyCode:t}=e;t!==Ll.ESCAPE&&t!==Ll.TAB||n()}function s(){const e=l.getSelection();e.rangeCount>0&&e.getRangeAt(0).collapsed||n()}return o.addEventListener("focus",t),o.addEventListener("keydown",i),r.addEventListener("selectionchange",s),()=>{l.clearTimeout(e),o.removeEventListener("focus",t),o.removeEventListener("keydown",i),r.removeEventListener("selectionchange",s)}}function i(e){const{type:n,target:r}=e;(0,Gi.isTextField)(r)&&o.contains(r)&&("keydown"!==n||function(e){const{keyCode:t,shiftKey:n}=e;return!n&&ik.has(t)}(e))&&t()}return o.addEventListener("keypress",i),o.addEventListener("keydown",i),()=>{o.removeEventListener("keypress",i),o.removeEventListener("keydown",i)}}),[e,t,n]);return(0,d.useMergeRefs)([o,r])}var ck=function({children:e}){return(0,s.createElement)("div",{ref:ak()},e)};function uk(){return Mt()("PreserveScrollInReorder component",{since:"5.4",hint:"This behavior is now built-in the block list"}),null}const dk=-1!==window.navigator.userAgent.indexOf("Trident"),pk=new Set([Ll.UP,Ll.DOWN,Ll.LEFT,Ll.RIGHT]);function mk(){const e=(0,m.useSelect)((e=>e(Gn).hasSelectedBlock()));return(0,d.useRefEffect)((t=>{if(!e)return;const{ownerDocument:n}=t,{defaultView:o}=n;let r,l,i;function s(){r||(r=o.requestAnimationFrame((()=>{p(),r=null})))}function a(e){l&&o.cancelAnimationFrame(l),l=o.requestAnimationFrame((()=>{c(e),l=null}))}function c({keyCode:e}){if(!m())return;const r=(0,Gi.computeCaretRect)(o);if(!r)return;if(!i)return void(i=r);if(pk.has(e))return void(i=r);const l=r.top-i.top;if(0===l)return;const s=(0,Gi.getScrollContainer)(t);if(!s)return;const a=s===n.body,c=a?o.scrollY:s.scrollTop,u=a?0:s.getBoundingClientRect().top,d=a?i.top/o.innerHeight:(i.top-u)/(o.innerHeight-u);if(0===c&&d<.75&&function(){const e=t.querySelectorAll('[contenteditable="true"]');return e[e.length-1]===n.activeElement}())return void(i=r);const p=a?o.innerHeight:s.clientHeight;i.top+i.height>u+p||i.top<u?i=r:a?o.scrollBy(0,l):s.scrollTop+=l}function u(){n.addEventListener("selectionchange",d)}function d(){n.removeEventListener("selectionchange",d),p()}function p(){m()&&(i=(0,Gi.computeCaretRect)(o))}function m(){return t.contains(n.activeElement)&&n.activeElement.isContentEditable}return o.addEventListener("scroll",s,!0),o.addEventListener("resize",s,!0),t.addEventListener("keydown",a),t.addEventListener("keyup",c),t.addEventListener("mousedown",u),t.addEventListener("touchstart",u),()=>{o.removeEventListener("scroll",s,!0),o.removeEventListener("resize",s,!0),t.removeEventListener("keydown",a),t.removeEventListener("keyup",c),t.removeEventListener("mousedown",u),t.removeEventListener("touchstart",u),n.removeEventListener("selectionchange",d),o.cancelAnimationFrame(r),o.cancelAnimationFrame(l)}}),[e])}var fk=dk?e=>e.children:function({children:e}){return(0,s.createElement)("div",{ref:mk(),className:"block-editor__typewriter"},e)};const hk=(0,u.overEvery)([Gi.isTextField,Gi.focus.tabbable.isTabbableIndex]);function gk(){return(0,d.useRefEffect)((e=>{function t(t){if(t.target!==e)return;const n=Gi.focus.focusable.find(e),o=(0,u.findLast)(n,hk);if(!o)return;const{bottom:r}=o.getBoundingClientRect();t.clientY<r||((0,Gi.placeCaretAtHorizontalEdge)(o,!0),t.preventDefault())}return e.addEventListener("mousedown",t),()=>{e.addEventListener("mousedown",t)}}),[])}const bk=(0,s.createContext)({});function vk(e,t=""){var n;const o=(0,s.useContext)(bk),{name:r}=Kn();t=t||r;const l=Boolean(null===(n=o[t])||void 0===n?void 0:n.has(e)),i=(0,s.useMemo)((()=>function(e,t,n){const o={...e,[t]:e[t]?new Set(e[t]):new Set};return o[t].add(n),o}(o,t,e)),[o,t,e]);return[l,(0,s.useCallback)((({children:e})=>(0,s.createElement)(bk.Provider,{value:i},e)),[i])]}function kk(e){if(void 0===e)e=b.colors;else{const t=e.filter((e=>e.color));0===t.length?e=b.colors:t.length<e.length&&(e=t)}return e}function _k(e){if(void 0===e)e=b.gradients;else{const t=e.filter((e=>e.gradient));0===t.length?e=b.gradients:t.length<e.length&&(e=t)}return e}}(),(window.wp=window.wp||{}).blockEditor=o}();
|
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),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+h-(w.left+S)+d,top:f.top+g-(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+h-(v.left+k+(parseFloat(o.css(t,"borderRightWidth"))||0))+d,top:f.top+g-(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 g(e){return null!=e&&e==e.window}var h={};function v(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 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);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 v=t.call(g,g.node);return void 0!==v&&g.update&&g.update(v),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 ih},AlignmentToolbar:function(){return sh},Autocomplete:function(){return dh},BlockAlignmentControl:function(){return Do},BlockAlignmentToolbar:function(){return Oo},BlockBreadcrumb:function(){return hh},BlockColorsStyleSelector:function(){return yh},BlockContextProvider:function(){return Es},BlockControls:function(){return eo},BlockEdit:function(){return Bs},BlockEditorKeyboardShortcuts:function(){return Ok},BlockEditorProvider:function(){return tp},BlockFormatControls:function(){return Jn},BlockIcon:function(){return Qd},BlockInspector:function(){return Mk},BlockList:function(){return Ig},BlockMover:function(){return hf},BlockNavigationDropdown:function(){return $h},BlockPreview:function(){return Hp},BlockSelectionClearer:function(){return rp},BlockSettingsMenu:function(){return ng},BlockSettingsMenuControls:function(){return Qf},BlockTitle:function(){return tf},BlockToolbar:function(){return og},BlockTools:function(){return Lk},BlockVerticalAlignmentControl:function(){return pv},BlockVerticalAlignmentToolbar:function(){return mv},ButtonBlockAppender:function(){return $m},ButtonBlockerAppender:function(){return Wm},ColorPalette:function(){return gv},ColorPaletteControl:function(){return hv},ContrastChecker:function(){return Rl},CopyHandler:function(){return Hf},DefaultBlockAppender:function(){return Um},FontSizePicker:function(){return Li},InnerBlocks:function(){return Cg},Inserter:function(){return Hm},InspectorAdvancedControls:function(){return Yo},InspectorControls:function(){return Zo},JustifyContentControl:function(){return vo},JustifyToolbar:function(){return bo},LineHeightControl:function(){return pi},MediaPlaceholder:function(){return tk},MediaReplaceFlow:function(){return Yb},MediaUpload:function(){return Kb},MediaUploadCheck:function(){return qb},MultiSelectScrollIntoView:function(){return Fk},NavigableToolbar:function(){return lf},ObserveTyping:function(){return Uk},PanelColorSettings:function(){return nk},PlainText:function(){return lk},PreserveScrollInReorder:function(){return Gk},RichText:function(){return Gb},RichTextShortcut:function(){return ak},RichTextToolbarButton:function(){return ck},SETTINGS_DEFAULTS:function(){return v},SkipToSelectedBlock:function(){return Ik},ToolSelector:function(){return pk},Typewriter:function(){return Kk},URLInput:function(){return tb},URLInputButton:function(){return hk},URLPopover:function(){return Jb},Warning:function(){return xs},WritingFlow:function(){return fp},__experimentalBlockAlignmentMatrixControl:function(){return fh},__experimentalBlockContentOverlay:function(){return vh},__experimentalBlockFullHeightAligmentControl:function(){return mh},__experimentalBlockPatternSetup:function(){return ov},__experimentalBlockVariationPicker:function(){return Kh},__experimentalBlockVariationTransforms:function(){return lv},__experimentalBorderRadiusControl:function(){return ul},__experimentalBorderStyleControl:function(){return hl},__experimentalColorGradientControl:function(){return Kr},__experimentalDuotoneControl:function(){return ks},__experimentalFontAppearanceControl:function(){return bi},__experimentalFontFamilyControl:function(){return Si},__experimentalGetBorderClassesAndStyles:function(){return Ug},__experimentalGetColorClassesAndStyles:function(){return $g},__experimentalGetGradientClass:function(){return Dr},__experimentalGetGradientObjectByGradientValue:function(){return Fr},__experimentalGetMatchingVariation:function(){return rv},__experimentalGetSpacingClassesAndStyles:function(){return Kg},__experimentalImageEditingProvider:function(){return Fv},__experimentalImageEditor:function(){return Yv},__experimentalImageSizeControl:function(){return Xv},__experimentalImageURLInputUI:function(){return wk},__experimentalLayoutStyle:function(){return To},__experimentalLetterSpacingControl:function(){return Vi},__experimentalLibrary:function(){return Ak},__experimentalLinkControl:function(){return _b},__experimentalLinkControlSearchInput:function(){return mb},__experimentalLinkControlSearchItem:function(){return rb},__experimentalLinkControlSearchResults:function(){return sb},__experimentalListView:function(){return Gh},__experimentalListViewBlockFill:function(){return Mh},__experimentalListViewEditor:function(){return Wb},__experimentalPanelColorGradientSettings:function(){return Nl},__experimentalPreviewOptions:function(){return Sk},__experimentalResponsiveBlockControl:function(){return sk},__experimentalUnitControl:function(){return mk},__experimentalUseBorderProps:function(){return Gg},__experimentalUseColorProps:function(){return jg},__experimentalUseCustomSides:function(){return ss},__experimentalUseGradient:function(){return Vr},__experimentalUseInnerBlocksProps:function(){return Eg},__experimentalUseNoRecursiveRenders:function(){return Xk},__experimentalUseResizeCanvas:function(){return Bk},__unstableBlockSettingsMenuFirstItem:function(){return Kf},__unstableEditorStyles:function(){return Fp},__unstableIframe:function(){return vp},__unstableInserterMenuExtension:function(){return bm},__unstableRichTextInputEvent:function(){return uk},__unstableUseBlockSelectionClearer:function(){return op},__unstableUseCanvasClickRedirect:function(){return Yk},__unstableUseClipboardHandler:function(){return Vf},__unstableUseMouseMoveTypingReset:function(){return Vk},__unstableUseTypewriter:function(){return jk},__unstableUseTypingObserver:function(){return Hk},createCustomColorsHOC:function(){return Zg},getColorClassName:function(){return Lr},getColorObjectByAttributeValues:function(){return Rr},getColorObjectByColorValue:function(){return Mr},getFontSize:function(){return Pi},getFontSizeClass:function(){return Mi},getFontSizeObjectByValue:function(){return Ri},getGradientSlugByValue:function(){return zr},getGradientValueBySlug:function(){return Or},getPxFromCssUnit:function(){return r_},store:function(){return Wn},storeConfig:function(){return Gn},transformStyles:function(){return Ap},useBlockDisplayInformation:function(){return ef},useBlockEditContext:function(){return qn},useBlockProps:function(){return Hd},useSetting:function(){return fo},validateThemeColors:function(){return Qk},validateThemeGradients:function(){return Jk},withColorContext:function(){return fv},withColors:function(){return Xg},withFontSizes:function(){return Jg}});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 be},getMultiSelectedBlocks:function(){return ke},getMultiSelectedBlocksEndClientId:function(){return Be},getMultiSelectedBlocksStartClientId:function(){return Se},getNextBlockClientId:function(){return ge},getPreviousBlockClientId:function(){return fe},getSelectedBlock:function(){return se},getSelectedBlockClientId:function(){return ie},getSelectedBlockClientIds:function(){return ve},getSelectedBlockCount:function(){return re},getSelectedBlocksInitialCaretPosition:function(){return he},getSelectionEnd:function(){return te},getSelectionStart:function(){return ee},getSettings:function(){return vt},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 we},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 bt},isMultiSelecting:function(){return Me},isNavigationMode:function(){return St},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 wn},exitFormattedText:function(){return Sn},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 vn},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 bn},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:{}},v={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 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){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)));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=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,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=v,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 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 ge(e,t){return me(e,t,1)}function he(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 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}=vt(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=n.variations.filter((({scope:e})=>!e||e.includes("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)?wt(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,wt(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)&&wt(e).length>0),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId,e.settings.allowedBlockTypes,e.settings.templateLock,wt(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.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 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)=>{const n=(0,u.find)(wt(e),(e=>e.id===t));return n?(0,r.parse)("string"==typeof n.content.raw?n.content.raw:n.content):null}),(e=>[wt(e)])),yt=O(((e,t)=>{var n;const o=(0,u.find)(wt(e),(e=>e.id===t));return o?null===(n=o.title)||void 0===n?void 0:n.raw:null}),(e=>[wt(e)]));function Et(e){return e.blocks.isIgnoredChange}function Ct(e){return e.lastBlockAttributesChange}function wt(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 St(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=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 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 v=(0,r.cloneBlock)(i),b=(0,r.cloneBlock)(a);if(h){const e=d===o?v:b,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?[b]:(0,r.switchToBlockType)(b,i.name);if(!k||!k.length)return;const _=s.merge(v.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 vn(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 bn(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 wn(){return{type:"ENTER_FORMATTED_TEXT"}}function Sn(){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 vo(e){return(0,s.createElement)(ho,i({},e,{isToolbar:!1}))}function bo(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)(vo,{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 wo=[{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: var( --wp--style--block-gap );\n\t\t\t\t\tmargin-bottom: 0;\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,g.sprintf)((0,g.__)("Max %s wide"),t)),r.test(n)&&(
|
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 So(e="default"){return wo.find((t=>t.name===e))}const Bo={type:"default"},Io=(0,s.createContext)(Bo),xo=Io.Provider;function To({layout:e={},...t}){const n=So(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.unshift("none");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=So(null==o?void 0:o.type),l=r.getAlignments(o);if(n)return l.filter((({name:t})=>e.includes(t)));if("default"!==r.name)return[];const{alignments:i=No}=o;return e.filter((e=>(o.alignments||t||!Po.includes(e))&&i.includes(e))).map((e=>({name:e})))}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=Vo((0,r.getBlockSupport)(n,"align"),(0,r.hasBlockSupport)(n,"alignWide",!0));return(0,s.createElement)(s.Fragment,null,o.length>0&&(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,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,label:t,header: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,{label:t,header: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},e)}function Ko({__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)(l,i({},o,{bubblesVirtually:t}))):(0,s.createElement)(l,i({},o,{bubblesVirtually:t})):null:("undefined"!=typeof process&&process.env,null)}const qo=Wo;qo.Slot=Ko;const Yo=e=>(0,s.createElement)(Wo,i({},e,{__experimentalGroup:"advanced"}));Yo.Slot=e=>(0,s.createElement)(Ko,i({},e,{__experimentalGroup:"advanced"})),Yo.slotName="InspectorAdvancedControls";var Zo=qo;const Xo=/[\s#]/g,Qo=(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:"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(Xo,"-"),t.setAttributes({anchor:e})},autoCapitalize:"none",autoComplete:"off"});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(e,t),n&&(0,s.createElement)(Zo,{__experimentalGroup:"advanced"},o),!n&&"core/heading"===t.name&&(0,s.createElement)(Zo,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",Qo),(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 Jo=(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)(Zo,{__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",Jo),(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 er={grad:.9,turn:360,rad:360/(2*Math.PI)},tr=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},nr=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},or=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},rr=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},lr=function(e){return{r:or(e.r,0,255),g:or(e.g,0,255),b:or(e.b,0,255),a:or(e.a)}},ir=function(e){return{r:nr(e.r),g:nr(e.g),b:nr(e.b),a:nr(e.a,3)}},sr=/^#([0-9a-f]{3,8})$/i,ar=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},cr=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}},ur=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}},dr=function(e){return{h:rr(e.h),s:or(e.s,0,100),l:or(e.l,0,100),a:or(e.a)}},pr=function(e){return{h:nr(e.h),s:nr(e.s),l:nr(e.l),a:nr(e.a,3)}},mr=function(e){return ur((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},fr=function(e){return{h:(t=cr(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},gr=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hr=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vr=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,br=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,kr={string:[[function(e){var t=sr.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?nr(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?nr(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=vr.exec(e)||br.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:lr({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=gr.exec(e)||hr.exec(e);if(!t)return null;var n,o,r=dr({h:(n=t[1],o=t[2],void 0===o&&(o="deg"),Number(n)*(er[o]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return mr(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 tr(t)&&tr(n)&&tr(o)?lr({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(!tr(t)||!tr(n)||!tr(o))return null;var i=dr({h:Number(t),s:Number(n),l:Number(o),a:Number(l)});return mr(i)},"hsl"],[function(e){var t=e.h,n=e.s,o=e.v,r=e.a,l=void 0===r?1:r;if(!tr(t)||!tr(n)||!tr(o))return null;var i=function(e){return{h:rr(e.h),s:or(e.s,0,100),v:or(e.v,0,100),a:or(e.a)}}({h:Number(t),s:Number(n),v:Number(o),a:Number(l)});return ur(i)},"hsv"]]},_r=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]},yr=function(e,t){var n=fr(e);return{h:n.h,s:or(n.s+100*t,0,100),l:n.l,a:n.a}},Er=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Cr=function(e,t){var n=fr(e);return{h:n.h,s:n.s,l:or(n.l+100*t,0,100),a:n.a}},wr=function(){function e(e){this.parsed=function(e){return"string"==typeof e?_r(e.trim(),kr.string):"object"==typeof e&&null!==e?_r(e,kr.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 nr(Er(this.rgba),2)},e.prototype.isDark=function(){return Er(this.rgba)<.5},e.prototype.isLight=function(){return Er(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=ir(this.rgba)).r,n=e.g,o=e.b,l=(r=e.a)<1?ar(nr(255*r)):"","#"+ar(t)+ar(n)+ar(o)+l;var e,t,n,o,r,l},e.prototype.toRgb=function(){return ir(this.rgba)},e.prototype.toRgbString=function(){return t=(e=ir(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 pr(fr(this.rgba))},e.prototype.toHslString=function(){return t=(e=pr(fr(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=cr(this.rgba),{h:nr(e.h),s:nr(e.s),v:nr(e.v),a:nr(e.a,3)};var e},e.prototype.invert=function(){return Sr({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),Sr(yr(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Sr(yr(this.rgba,-e))},e.prototype.grayscale=function(){return Sr(yr(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Sr(Cr(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Sr(Cr(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?Sr({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):nr(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=fr(this.rgba);return"number"==typeof e?Sr({h:e,s:t.s,l:t.l,a:t.a}):nr(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Sr(e).toHex()},e}(),Sr=function(e){return e instanceof wr?e:new wr(e)},Br=[],Ir=function(e){e.forEach((function(e){Br.indexOf(e)<0&&(e(wr,kr),Br.push(e))}))};function xr(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 Tr=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},Nr=function(e){return.2126*Tr(e.r)+.7152*Tr(e.g)+.0722*Tr(e.b)};function Pr(e){e.prototype.luminance=function(){return e=Nr(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=Nr(l))>(a=Nr(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}}Ir([xr,Pr]);const Rr=(e,t,n)=>{if(t){const n=(0,u.find)(e,{slug:t});if(n)return n}return{color:n}},Mr=(e,t)=>(0,u.find)(e,{color:t});function Lr(e,t){if(e&&t)return`has-${(0,u.kebabCase)(t)}-${e}`}const Ar=[];function Dr(e){if(e)return`has-${e}-gradient-background`}function Or(e,t){const n=(0,u.find)(e,["slug",t]);return n&&n.gradient}function Fr(e,t){return(0,u.find)(e,["gradient",t])}function zr(e,t){const n=Fr(e,t);return n&&n.slug}function Vr({gradientAttribute:e="gradient",customGradientAttribute:t="customGradient"}={}){const{clientId:n}=qn(),o=fo("color.gradients")||Ar,{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=zr(o,r);i(n,l?{[e]:l,[t]:void 0}:{[e]:void 0,[t]:r})}),[o,n,i]),c=Dr(r);let u;return u=r?Or(o,r):l,{gradientClass:c,gradientValue:u,setGradient:a}}
|
8 |
// translators: first %s: the color name or value (e.g. red or #ff0000)
|
9 |
+
const Hr=(0,g.__)("(Color: %s)"),Ur=(0,g.__)("(Gradient: %s)"),Gr=["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%)
|
10 |
+
function Wr({colors:e,gradients:t,label:n,currentTab:o,colorValue:r,gradientValue:l}){let i,a;if("color"===o){if(r){i=r;const t=Mr(e,i),n=t&&t.name;a=(0,g.sprintf)(Hr,n||i)}}else if("gradient"===o&&l){i=l;const e=Fr(t,i),n=e&&e.name;a=(0,g.sprintf)(Ur,n||i)}return(0,s.createElement)(s.Fragment,null,n,!!i&&(0,s.createElement)(p.ColorIndicator,{colorValue:i,"aria-label":a}))}function $r({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),v=a&&(!(0,u.isEmpty)(t)||!o),[b,k]=(0,s.useState)(m?"gradient":!!h&&"color");return h||v?(0,s.createElement)(p.BaseControl,{className:c()("block-editor-color-gradient-control",r)},(0,s.createElement)("fieldset",null,(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)(Wr,{currentTab:b,label:l,colorValue:d,gradientValue:m})))),h&&v&&(0,s.createElement)(p.ButtonGroup,{className:"block-editor-color-gradient-control__button-tabs"},(0,s.createElement)(p.Button,{isSmall:!0,isPressed:"color"===b,onClick:()=>k("color")},(0,g.__)("Solid")),(0,s.createElement)(p.Button,{isSmall:!0,isPressed:"gradient"===b,onClick:()=>k("gradient")},(0,g.__)("Gradient"))),("color"===b||!v)&&(0,s.createElement)(p.ColorPalette,{value:d,onChange:v?e=>{i(e),a()}:i,colors:e,disableCustomColors:n,clearable:f}),("gradient"===b||!h)&&(0,s.createElement)(p.GradientPicker,{value:m,onChange:h?e=>{a(e),i()}:a,gradients:t,disableCustomGradients:o,clearable:f}))):null}function jr(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)($r,i({},t,e))}var Kr=function(e){return(0,u.every)(Gr,(t=>e.hasOwnProperty(t)))?(0,s.createElement)($r,e):(0,s.createElement)(jr,e)};const qr=[];function Yr(e){const{attributes:{borderColor:t,style:n},setAttributes:o}=e,r=fo("color.palette")||qr,l=!fo("color.custom"),i=!fo("color.customGradient"),[a,c]=(0,s.useState)((()=>{var e,o;return null===(e=Rr(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)(Kr,{label:(0,g.__)("Color"),colorValue:a,colors:r,gradients:void 0,disableCustomColors:l,disableCustomGradients:i,onColorChange:e=>{c(e);const t=Mr(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 Zr(e,t,n){var o;if(!yl(t,"color")||El(t))return e;const{borderColor:r,style:l}=n,i=Lr("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 Xr=(0,d.createHigherOrderComponent)((e=>t=>{var n,o;const{name:r,attributes:l}=t,{borderColor:a}=l,c=fo("color.palette")||qr;if(!yl(r,"color")||El(r))return(0,s.createElement)(e,t);const u={borderColor:a?null===(n=Rr(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 Qr(e){return e.sort(((t,n)=>e.filter((e=>e===t)).length-e.filter((e=>e===n)).length)).pop()}function Jr(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=Qr(o);return 0===r||r?`${r}${l}`:null}function el(e={}){const t=Jr(e);return isNaN(parseFloat(t))}function tl(e){return!!e&&("string"==typeof e||!!Object.values(e).filter((e=>!!e||0===e)).length)}function nl({onChange:e,values:t,...n}){const o=Jr(t),r=tl(t)&&el(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 yl(e,"color")?e.attributes.borderColor?e:{...e,attributes:{...e.attributes,borderColor:{type:"string"}}}:e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/border/addSaveProps",Zr),(0,l.addFilter)("blocks.registerBlockType","core/border/addEditProps",(function(e){if(!yl(e,"color")||El(e))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),Zr(o,e,n)},e})),(0,l.addFilter)("editor.BlockListBlock","core/border/with-border-color-palette-styles",Xr);const ol={topLeft:(0,g.__)("Top left"),topRight:(0,g.__)("Top right"),bottomLeft:(0,g.__)("Bottom left"),bottomRight:(0,g.__)("Bottom right")};function rl({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(ol).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 ll=(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"})),il=(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 sl({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?ll:il,iconSize:16,"aria-label":n})))}const al={topLeft:null,topRight:null,bottomLeft:null,bottomRight:null},cl={px:100,em:20,rem:20};function ul({onChange:e,values:t}){const[n,o]=(0,s.useState)(!tl(t)||!el(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 Qr(Object.values(e).map((e=>{const[,t]=(0,p.__experimentalParseUnit)(e);return t})))}(t),i=r&&r.find((e=>e.value===l)),a=(null==i?void 0:i.step)||1,[c]=(0,p.__experimentalParseUnit)(Jr(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)(nl,{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:cl[l],initialPosition:0,withInputField:!1,onChange:t=>{e(void 0!==t?`${t}${l}`:void 0)},step:a})):(0,s.createElement)(rl,{min:0,onChange:e,values:t||al,units:r}),(0,s.createElement)(sl,{onClick:()=>o(!n),isLinked:n})))}function dl(e){var t;const{attributes:{style:n},setAttributes:o}=e;return(0,s.createElement)(ul,{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 pl=(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"})),ml=(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"})),fl=(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 gl=[{label:(0,g.__)("Solid"),icon:pl,value:"solid"},{label:(0,g.__)("Dashed"),icon:ml,value:"dashed"},{label:(0,g.__)("Dotted"),icon:fl,value:"dotted"}];function hl({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"},gl.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 vl=e=>{var t;const{attributes:{style:n},setAttributes:o}=e;return(0,s.createElement)(hl,{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)})}})},bl=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})},kl="__experimentalBorder";function _l(e){const t=Cl(e),n=yl(e.name),o=fo("border.customColor")&&yl(e.name,"color"),r=fo("border.customRadius")&&yl(e.name,"radius"),l=fo("border.customStyle")&&yl(e.name,"style"),i=fo("border.customWidth")&&yl(e.name,"width");return t||!n?null:(0,s.createElement)(Zo,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)(bl,e),l&&(0,s.createElement)(vl,e)),o&&(0,s.createElement)(Yr,e),r&&(0,s.createElement)(dl,e)))}function yl(e,t="any"){if("web"!==s.Platform.OS)return!1;const n=(0,r.getBlockSupport)(e,kl);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 El(e){const t=(0,r.getBlockSupport)(e,kl);return null==t?void 0:t.__experimentalSkipSerialization}const Cl=()=>[!fo("border.customColor"),!fo("border.customRadius"),!fo("border.customStyle"),!fo("border.customWidth")].every(Boolean),wl=(0,g.__)("(%s: color %s)"),Sl=(0,g.__)("(%s: gradient %s)"),Bl=["colors","disableCustomColors","gradients","disableCustomGradients"],Il=({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=Mr(l||e,n);c=(0,g.sprintf)(wl,r.toLowerCase(),t&&t.name||n)}else{const e=Fr(i||t,n);c=(0,g.sprintf)(Sl,r.toLowerCase(),e&&e.name||o)}return(0,s.createElement)(p.ColorIndicator,{key:a,colorValue:n||o,"aria-label":c})})),xl=({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)(Il,{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)(Kr,i({key:l,colors:t,gradients:n,disableCustomColors:o,disableCustomGradients:r},e)))),l)},Tl=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)(xl,i({},t,e))};var Nl=e=>(0,u.every)(Bl,(t=>e.hasOwnProperty(t)))?(0,s.createElement)(xl,e):(0,s.createElement)(Tl,e);function Pl({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))}Ir([xr,Pr]);var Rl=function({backgroundColor:e,fallbackBackgroundColor:t,fallbackTextColor:n,fontSize:o,isLargeText:r,textColor:l}){if(!e&&!t||!l&&!n)return null;const i=Sr(e||t),a=Sr(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)(Pl,{backgroundColor:e,textColor:l,colordBackgroundColor:i,colordTextColor:a})};const Ml=(0,s.createContext)();function Ll({children:e}){const t=(0,s.useMemo)((()=>({refs:new Map,callbacks:new Map})),[]);return(0,s.createElement)(Ml.Provider,{value:t},e)}function Al(e){const{refs:t,callbacks:n}=(0,s.useContext)(Ml),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 Dl(e){const{refs:t}=(0,s.useContext)(Ml),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 Ol(e){const{callbacks:t}=(0,s.useContext)(Ml),n=Dl(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 Fl(e){return e.ownerDocument.defaultView.getComputedStyle(e)}function zl({settings:e,clientId:t,enableContrastChecking:n=!0,showTitle:o=!0}){const[r,l]=(0,s.useState)(),[i,a]=(0,s.useState)(),c=Dl(t);return(0,s.useEffect)((()=>{if(!n)return;if(!c.current)return;a(Fl(c.current).color);let e=c.current,t=Fl(e).backgroundColor;for(;"rgba(0, 0, 0, 0)"===t&&e.parentNode&&e.parentNode.nodeType===e.parentNode.ELEMENT_NODE;)e=e.parentNode,t=Fl(e).backgroundColor;l(t)})),(0,s.createElement)(Zo,null,(0,s.createElement)(Nl,{title:(0,g.__)("Color"),initialOpen:!1,settings:e,showTitle:o},n&&(0,s.createElement)(Rl,{backgroundColor:r,textColor:i})))}const Vl="color",Hl=[],Ul=e=>{const t=(0,r.getBlockSupport)(e,Vl);return t&&(!0===t.link||!0===t.gradient||!1!==t.background||!1!==t.text)},Gl=e=>{const t=(0,r.getBlockSupport)(e,Vl);return null==t?void 0:t.__experimentalSkipSerialization},Wl=e=>{const t=(0,r.getBlockSupport)(e,Vl);return(0,u.isObject)(t)&&!!t.gradients};function $l(e,t,n){var o,r,l,i,s,a;if(!Ul(t)||Gl(t))return e;const u=Wl(t),{backgroundColor:d,textColor:p,gradient:m,style:f}=n,g=Lr("background-color",d),h=Dr(m),v=Lr("color",p),b=c()(e.className,v,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=b||void 0,e}const jl=(e,t)=>{const n=/var:preset\|color\|(.+)/.exec(t);return n&&n[1]?Rr(e,n[1]).color:t};function Kl(e){var t,n,o,l,i,a,c,d,p;const{name:m,attributes:f}=e,h=fo("color.palette")||Hl,v=fo("color.gradients")||Hl,b=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]),!Ul(m))return null;const w=(e=>{if("web"!==s.Platform.OS)return!1;const t=(0,r.getBlockSupport)(e,Vl);return(0,u.isObject)(t)&&!!t.link})(m)&&_&&(h.length>0||b),S=(e=>{const t=(0,r.getBlockSupport)(e,Vl);return t&&!1!==t.text})(m)&&y&&(h.length>0||b),B=(e=>{const t=(0,r.getBlockSupport)(e,Vl);return t&&!1!==t.background})(m)&&E&&(h.length>0||b),I=Wl(m)&&(v.length>0||k);if(!(w||S||B||I))return null;const{style:x,textColor:T,backgroundColor:N,gradient:P}=f;let R;if(I&&P)R=Or(v,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=Mr(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)(zl,{enableContrastChecking:!("web"!==s.Platform.OS||P||null!=x&&null!==(t=x.color)&&void 0!==t&&t.gradient),clientId:e.clientId,settings:[...S?[{label:(0,g.__)("Text color"),onColorChange:L("text"),colorValue:Rr(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:Rr(h,N,null==x||null===(o=x.color)||void 0===o?void 0:o.background).color,gradientValue:R,onGradientChange:I?t=>{const n=zr(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:$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}]:[],...w?[{label:(0,g.__)("Link Color"),onColorChange:t=>{const n=Mr(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:jl(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 ql=(0,d.createHigherOrderComponent)((e=>t=>{var n,o,r;const{name:l,attributes:a}=t,{backgroundColor:c,textColor:u}=a,d=fo("color.palette")||Hl;if(!Ul(l)||Gl(l))return(0,s.createElement)(e,t);const p={color:u?null===(n=Rr(d,u))||void 0===n?void 0:n.color:void 0,backgroundColor:c?null===(o=Rr(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 Ul(e)?(e.attributes.backgroundColor||Object.assign(e.attributes,{backgroundColor:{type:"string"}}),e.attributes.textColor||Object.assign(e.attributes,{textColor:{type:"string"}}),Wl(e)&&!e.attributes.gradient&&Object.assign(e.attributes,{gradient:{type:"string"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/color/addSaveProps",$l),(0,l.addFilter)("blocks.registerBlockType","core/color/addEditProps",(function(e){if(!Ul(e)||Gl(e))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),$l(o,e,n)},e})),(0,l.addFilter)("editor.BlockListBlock","core/color/with-color-palette-styles",ql);var Yl=(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"})),Zl=(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 Xl=[{name:(0,g.__)("Underline"),value:"underline",icon:Yl},{name:(0,g.__)("Strikethrough"),value:"line-through",icon:Zl}];function Ql({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"},Xl.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 Jl="typography.__experimentalTextDecoration";function ei(e){var t;const{attributes:{style:n},setAttributes:o}=e;return ti(e)?null:(0,s.createElement)(Ql,{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 ti({name:e}={}){const t=!(0,r.hasBlockSupport)(e,Jl),n=fo("typography.customTextDecorations");return t||!n}var ni=(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"})),oi=(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"})),ri=(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 li=[{name:(0,g.__)("Uppercase"),value:"uppercase",icon:ni},{name:(0,g.__)("Lowercase"),value:"lowercase",icon:oi},{name:(0,g.__)("Capitalize"),value:"capitalize",icon:ri}];function ii({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"},li.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 si="typography.__experimentalTextTransform";function ai(e){var t;const{attributes:{style:n},setAttributes:o}=e;return ci(e)?null:(0,s.createElement)(ii,{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 ci({name:e}={}){const t=!(0,r.hasBlockSupport)(e,si),n=fo("typography.customTextTransforms");return t||!n}function ui(e){const t=!ti(e),n=!ci(e);return t||n?(0,s.createElement)("div",{className:"block-editor-text-decoration-and-transform"},t&&(0,s.createElement)(ei,e),n&&(0,s.createElement)(ai,e)):null}var di=window.wp.keycodes;function pi({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!==di.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 mi="typography.lineHeight";function fi(e){var t;const{attributes:{style:n}}=e;return gi(e)?null:(0,s.createElement)(pi,{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 gi({name:e}={}){const t=!fo("typography.customLineHeight");return!(0,r.hasBlockSupport)(e,mi)||t}const hi=[{name:(0,g.__)("Regular"),value:"normal"},{name:(0,g.__)("Italic"),value:"italic"}],vi=[{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 bi(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 hi.forEach((({name:t,value:n})=>{vi.forEach((({name:o,value:r})=>{const l="normal"===n?o:(0,g.sprintf)(
|
11 |
/* translators: 1: Font weight name. 2: Font style name. */
|
12 |
+
(0,g.__)("%1$s %2$s"),o,t);e.push({key:`${n}-${r}`,name:l,style:{fontStyle:n,fontWeight:r}})}))})),e})():n?(()=>{const e=[a];return hi.forEach((({name:t,value:n})=>{e.push({key:n,name:t,style:{fontStyle:n,fontWeight:void 0}})})),e})():(()=>{const e=[a];return vi.forEach((({name:t,value:n})=>{e.push({key:n,name:t,style:{fontStyle:void 0,fontWeight:n}})})),e})()),[e.options]),u=c.find((e=>e.style.fontStyle===r&&e.style.fontWeight===l))||c[0];return(0,s.createElement)("fieldset",{className:"components-font-appearance-control"},i&&(0,s.createElement)(p.CustomSelectControl,{className:"components-font-appearance-control__select",label:n?o?(0,g.__)("Appearance"):(0,g.__)("Font style"):(0,g.__)("Font weight"),describedBy:u?n?o?(0,g.sprintf)(// translators: %s: Currently selected font appearance.
|
13 |
+
(0,g.__)("Currently selected font appearance: %s"),u.name):(0,g.sprintf)(// translators: %s: Currently selected font style.
|
14 |
+
(0,g.__)("Currently selected font style: %s"),u.name):(0,g.sprintf)(// translators: %s: Currently selected font weight.
|
15 |
+
(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 ki="typography.__experimentalFontStyle",_i="typography.__experimentalFontWeight";function yi(e){var t,n;const{attributes:{style:o},setAttributes:r}=e,l=!Ei(e),i=!Ci(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)(bi,{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 Ei({name:e}={}){const t=(0,r.hasBlockSupport)(e,ki),n=fo("typography.customFontStyle");return!t||!n}function Ci({name:e}={}){const t=(0,r.hasBlockSupport)(e,_i),n=fo("typography.customFontWeight");return!t||!n}function wi(e){const t=Ei(e),n=Ci(e);return t&&n}function Si({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 Bi="typography.__experimentalFontFamily";function Ii({name:e,setAttributes:t,attributes:{style:n={}}}){var o;const r=fo("typography.fontFamilies");if(xi({name:e}))return null;const l=((e,t)=>{const n=/var:preset\|font-family\|(.+)/.exec(t);if(n&&n[1]){const t=(0,u.find)(e,(({slug:e})=>e===n[1]));if(t)return t.fontFamily}return t})(r,null===(o=n.typography)||void 0===o?void 0:o.fontFamily);return(0,s.createElement)(Si,{className:"block-editor-hooks-font-family-control",fontFamilies:r,value:l,onChange:function(e){const o=(0,u.find)(r,(({fontFamily:t})=>t===e));t({style:$o({...n,typography:{...n.typography||{},fontFamily:o?`var:preset|font-family|${o.slug}`:e||void 0}})})}})}function xi({name:e}){const t=fo("typography.fontFamilies");return!t||0===t.length||!(0,r.hasBlockSupport)(e,Bi)}var Ti=window.wp.tokenList,Ni=n.n(Ti);const Pi=(e,t,n)=>{if(t){const n=(0,u.find)(e,{slug:t});if(n)return n}return{size:n}};function Ri(e,t){return(0,u.find)(e,{size:t})||{size:t}}function Mi(e){if(e)return`has-${(0,u.kebabCase)(e)}-font-size`}var Li=function(e){const t=fo("typography.fontSizes"),n=!fo("typography.customFontSize");return(0,s.createElement)(p.FontSizePicker,i({},e,{fontSizes:t,disableCustomFontSizes:n}))};const Ai="typography.fontSize";function Di(e,t,n){if(!(0,r.hasBlockSupport)(t,Ai))return e;if((0,r.hasBlockSupport)(t,"typography.__experimentalSkipSerialization"))return e;const o=new(Ni())(e.className);o.add(Mi(n.fontSize));const l=o.value;return e.className=l||void 0,e}function Oi(e){var t,n;const{attributes:{fontSize:o,style:r},setAttributes:l}=e,i=Fi(e),a=fo("typography.fontSizes");if(i)return null;const c=Pi(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)(Li,{onChange:e=>{const t=Ri(a,e).slug;l({style:$o({...r,typography:{...null==r?void 0:r.typography,fontSize:t?void 0:e}}),fontSize:t})},value:u})}function Fi({name:e}={}){const t=fo("typography.fontSizes"),n=!(null==t||!t.length);return!(0,r.hasBlockSupport)(e,Ai)||!n}const zi=(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,Ai)||(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=Pi(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 Vi({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,Ai)?(e.attributes.fontSize||Object.assign(e.attributes,{fontSize:{type:"string"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/font/addSaveProps",Di),(0,l.addFilter)("blocks.registerBlockType","core/font/addEditProps",(function(e){if(!(0,r.hasBlockSupport)(e,Ai))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),Di(o,e,n)},e})),(0,l.addFilter)("editor.BlockListBlock","core/font-size/with-font-size-inline-styles",zi);const Hi="typography.__experimentalLetterSpacing";function Ui(e){var t;const{attributes:{style:n},setAttributes:o}=e;return Gi(e)?null:(0,s.createElement)(Vi,{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 Gi({name:e}={}){const t=!(0,r.hasBlockSupport)(e,Hi),n=fo("typography.customLetterSpacing");return t||!n}const Wi=[mi,Ai,ki,_i,Bi,Jl,si,Hi];function $i(e){const t=function(e={}){const t=[wi(e),Fi(e),gi(e),xi(e),ti(e),ci(e),Gi(e)];return t.filter(Boolean).length===t.length}(e),n=ji(e.name);return t||!n?null:(0,s.createElement)(Zo,null,(0,s.createElement)(p.PanelBody,{title:(0,g.__)("Typography")},(0,s.createElement)(Ii,e),(0,s.createElement)(Oi,e),(0,s.createElement)(yi,e),(0,s.createElement)(fi,e),(0,s.createElement)(ui,e),(0,s.createElement)(Ui,e)))}const ji=e=>Wi.some((t=>(0,r.hasBlockSupport)(e,t)));function Ki(e){const t=(0,r.getBlockSupport)(e,ns);return!!(!0===t||null!=t&&t.blockGap)}function qi({name:e}={}){const t=!fo("spacing.blockGap");return!Ki(e)||t}function Yi(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=Dl(n);return qi(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 Zi(e){const t=(0,r.getBlockSupport)(e,ns);return!!(!0===t||null!=t&&t.margin)}function Xi({name:e}={}){const t=!fo("spacing.customMargin"),n=!as(e,"margin");return!Zi(e)||t||n}function Qi(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=ss(n,"margin"),a=i&&i.some((e=>rs.includes(e)));return Xi(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 Ji(e){const t=(0,r.getBlockSupport)(e,ns);return!!(!0===t||null!=t&&t.padding)}function es({name:e}={}){const t=!fo("spacing.customPadding"),n=!as(e,"padding");return!Ji(e)||t||n}function ts(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=ss(n,"padding"),a=i&&i.some((e=>rs.includes(e)));return es(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 ns="spacing",os=["top","right","bottom","left"],rs=["vertical","horizontal"];function ls(e){const t=qi(e),n=es(e),o=Xi(e),l=is(e),i=(a=e.name,"web"===s.Platform.OS&&(Ki(a)||Ji(a)||Zi(a)));var a;if(l||!i)return null;const c=(0,r.getBlockSupport)(e.name,[ns,"__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)(Zo,{__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)(ts,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)(Qi,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)(Yi,e)))}const is=(e={})=>{const t=qi(e),n=es(e),o=Xi(e);return t&&n&&o};function ss(e,t){const n=(0,r.getBlockSupport)(e,ns);if(n&&"boolean"!=typeof n[t])return n[t]}function as(e,t){const n=ss(e,t);return!(n&&n.some((e=>os.includes(e)))&&n.some((e=>rs.includes(e)))&&(console.warn(`The ${t} support for the "${e}" block can not be configured to support both axial and arbitrary sides.`),1))}const cs=[...Wi,kl,Vl,ns],us=e=>cs.some((t=>(0,r.hasBlockSupport)(e,t))),ds="var:";function ps(e){return(0,u.startsWith)(e,ds)?`var(--wp--${e.slice(ds.length).split("|").join("--")})`:e}function ms(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]=ps(l))})):t[n]=ps((0,u.get)(e,o))}})),t}const fs={"__experimentalBorder.__experimentalSkipSerialization":["border"],"color.__experimentalSkipSerialization":[Vl],"typography.__experimentalSkipSerialization":["typography"],[`${ns}.__experimentalSkipSerialization`]:["spacing"]},gs={...fs,[`${ns}`]:["spacing.blockGap"]};function hs(e,t,n,o=gs){if(!us(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={...ms(l),...e.style},e}const vs=(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)($i,t),(0,s.createElement)(_l,t),(0,s.createElement)(Kl,t),(0,s.createElement)(ls,t)),(0,s.createElement)(e,t))}),"withToolbarControls"),bs=(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=ms(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);return(0,s.createElement)(s.Fragment,null,l&&(0,s.createElement)("style",{dangerouslySetInnerHTML:{__html:p}}),(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 us(e)?(e.attributes.style||Object.assign(e.attributes,{style:{type:"object"}}),e):e})),(0,l.addFilter)("blocks.getSaveContent.extraProps","core/style/addSaveProps",hs),(0,l.addFilter)("blocks.registerBlockType","core/style/addEditProps",(function(e){if(!us(e))return e;const t=e.getEditWrapperProps;return e.getEditWrapperProps=n=>{let o={};return t&&(o=t(n)),hs(o,e,n,fs)},e})),(0,l.addFilter)("editor.BlockEdit","core/style/with-block-controls",vs),(0,l.addFilter)("editor.BlockListBlock","core/editor/with-elements-styles",bs);var ks=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!==di.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}))})},_s=window.wp.dom;const ys=(0,s.createContext)({});function Es({value:e,children:t}){const n=(0,s.useContext)(ys),o=(0,s.useMemo)((()=>({...n,...e})),[n,e]);return(0,s.createElement)(ys.Provider,{value:o,children:t})}var Cs=ys;const ws={};var Ss=(0,p.withFilters)("editor.BlockEdit")((e=>{const{attributes:t={},name:n}=e,o=(0,r.getBlockType)(n),l=(0,s.useContext)(Cs),a=(0,s.useMemo)((()=>o&&o.usesContext?(0,u.pick)(l,o.usesContext):ws),[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 Bs(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)(Ss,e))}var Is=(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"})),xs=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:Is,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)))))))))},Ts=n(7630);function Ns({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,_s.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 Ps=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,Ts.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)(Ns,{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)(Ns,{title:(0,g.__)("After Conversion"),className:"block-editor-block-compare__converted",action:n,actionText:l,rawContent:d,renderedContent:i}))};const Rs=e=>(0,r.rawHandler)({HTML:e.originalContent});var Ms=(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,Rs(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)((()=>[{
|
16 |
// translators: Button to fix block content
|
17 |
+
title:(0,g._x)("Resolve","imperative verb"),onClick:u},i&&{title:(0,g.__)("Convert to HTML"),onClick:e},{title:(0,g.__)("Convert to Classic Block"),onClick:n}].filter(Boolean)),[u,e,n]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(xs,{actions:[(0,s.createElement)(p.Button,{key:"recover",onClick:o,variant:"primary"},(0,g.__)("Attempt Block Recovery"))],secondaryActions:m},(0,g.__)("This block contains unexpected or invalid content.")),a&&(0,s.createElement)(p.Modal,{title:// translators: Dialog title to fix block content
|
18 |
+
(0,g.__)("Resolve Block"),onRequestClose:d,className:"block-editor-block-compare"},(0,s.createElement)(Ps,{block:l,onKeep:e,onConvert:t,convertor:Rs,convertButtonText:(0,g.__)("Convert to Blocks")})))}));const Ls=(0,s.createElement)(xs,{className:"block-editor-block-list__block-crash-warning"},(0,g.__)("This block has encountered an error and cannot be previewed."));var As=()=>Ls;class Ds 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 Os=Ds,Fs=n(4042),zs=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)(Fs.Z,{className:"block-editor-block-list__block-html-textarea",value:t,onBlur:()=>{const i=(0,r.getBlockType)(o.name),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 Vs=ta();const Hs=e=>Xs(e,Vs);let Us=ta();Hs.write=e=>Xs(e,Us);let Gs=ta();Hs.onStart=e=>Xs(e,Gs);let Ws=ta();Hs.onFrame=e=>Xs(e,Ws);let $s=ta();Hs.onFinish=e=>Xs(e,$s);let js=[];Hs.setTimeout=(e,t)=>{let n=Hs.now()+t,o=()=>{let e=js.findIndex((e=>e.cancel==o));~e&&js.splice(e,1),oa.count-=~e?1:0},r={time:n,handler:e,cancel:o};return js.splice(Ks(n),0,r),oa.count+=1,Qs(),r};let Ks=e=>~(~js.findIndex((t=>t.time>e))||~js.length);Hs.cancel=e=>{Vs.delete(e),Us.delete(e)},Hs.sync=e=>{Zs=!0,Hs.batchedUpdates(e),Zs=!1},Hs.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function o(...e){t=e,Hs.onStart(n)}return o.handler=e,o.cancel=()=>{Gs.delete(n),t=null},o};let qs="undefined"!=typeof window?window.requestAnimationFrame:()=>{};Hs.use=e=>qs=e,Hs.now="undefined"!=typeof performance?()=>performance.now():Date.now,Hs.batchedUpdates=e=>e(),Hs.catch=console.error,Hs.frameLoop="always",Hs.advance=()=>{"demand"!==Hs.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):ea()};let Ys=-1,Zs=!1;function Xs(e,t){Zs?(t.delete(e),e(0)):(t.add(e),Qs())}function Qs(){Ys<0&&(Ys=0,"demand"!==Hs.frameLoop&&qs(Js))}function Js(){~Ys&&(qs(Js),Hs.batchedUpdates(ea))}function ea(){let e=Ys;Ys=Hs.now();let t=Ks(Ys);t&&(na(js.splice(0,t),(e=>e.handler())),oa.count-=t),Gs.flush(),Vs.flush(e?Math.min(64,Ys-e):16.667),Ws.flush(),Us.flush(),$s.flush()}function ta(){let e=new Set,t=e;return{add(n){oa.count+=t!=e||e.has(n)?0:1,e.add(n)},delete:n=>(oa.count-=t==e&&e.has(n)?1:0,e.delete(n)),flush(n){t.size&&(e=new Set,oa.count-=t.size,na(t,(t=>t(n)&&e.add(t))),oa.count+=e.size,t=e)}}}function na(e,t){e.forEach((e=>{try{t(e)}catch(e){Hs.catch(e)}}))}const oa={count:0,clear(){Ys=-1,js=[],Gs=ta(),Vs=ta(),Ws=ta(),Us=ta(),$s=ta(),oa.count=0}};var ra=n(3804),la=n.n(ra);function ia(){}const sa={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 aa(e,t){if(sa.arr(e)){if(!sa.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 ca=(e,t)=>e.forEach(t);function ua(e,t,n){for(const o in e)e.hasOwnProperty(o)&&t.call(n,e[o],o)}const da=e=>sa.und(e)?[]:sa.arr(e)?e:[e];function pa(e,t){if(e.size){const n=Array.from(e);e.clear(),ca(n,t)}}const ma=(e,...t)=>pa(e,(e=>e(...t)));let fa,ga,ha=null,va=!1,ba=ia;var ka=Object.freeze({__proto__:null,get createStringInterpolator(){return fa},get to(){return ga},get colors(){return ha},get skipAnimation(){return va},get willAdvance(){return ba},assign:e=>{e.to&&(ga=e.to),e.now&&(Hs.now=e.now),void 0!==e.colors&&(ha=e.colors),null!=e.skipAnimation&&(va=e.skipAnimation),e.createStringInterpolator&&(fa=e.createStringInterpolator),e.requestAnimationFrame&&Hs.use(e.requestAnimationFrame),e.batchedUpdates&&(Hs.batchedUpdates=e.batchedUpdates),e.willAdvance&&(ba=e.willAdvance),e.frameLoop&&(Hs.frameLoop=e.frameLoop)}});const _a=new Set;let ya=[],Ea=[],Ca=0;const wa={get idle(){return!_a.size&&!ya.length},start(e){Ca>e.priority?(_a.add(e),Hs.onStart(Sa)):(Ba(e),Hs(xa))},advance:xa,sort(e){if(Ca)Hs.onFrame((()=>wa.sort(e)));else{const t=ya.indexOf(e);~t&&(ya.splice(t,1),Ia(e))}},clear(){ya=[],_a.clear()}};function Sa(){_a.forEach(Ba),_a.clear(),Hs(xa)}function Ba(e){ya.includes(e)||Ia(e)}function Ia(e){ya.splice(function(t,n){const o=t.findIndex((t=>t.priority>e.priority));return o<0?t.length:o}(ya),0,e)}function xa(e){const t=Ea;for(let n=0;n<ya.length;n++){const o=ya[n];Ca=o.priority,o.idle||(ba(o),o.advance(e),o.idle||t.push(o))}return Ca=0,Ea=ya,Ea.length=0,ya=t,ya.length>0}const Ta="[-+]?\\d*\\.?\\d+",Na=Ta+"%";function Pa(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}const Ra=new RegExp("rgb"+Pa(Ta,Ta,Ta)),Ma=new RegExp("rgba"+Pa(Ta,Ta,Ta,Ta)),La=new RegExp("hsl"+Pa(Ta,Na,Na)),Aa=new RegExp("hsla"+Pa(Ta,Na,Na,Ta)),Da=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,Oa=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,Fa=/^#([0-9a-fA-F]{6})$/,za=/^#([0-9a-fA-F]{8})$/;function Va(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 Ha(e,t,n){const o=n<.5?n*(1+t):n+t-n*t,r=2*n-o,l=Va(r,o,e+1/3),i=Va(r,o,e),s=Va(r,o,e-1/3);return Math.round(255*l)<<24|Math.round(255*i)<<16|Math.round(255*s)<<8}function Ua(e){const t=parseInt(e,10);return t<0?0:t>255?255:t}function Ga(e){return(parseFloat(e)%360+360)%360/360}function Wa(e){const t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function $a(e){const t=parseFloat(e);return t<0?0:t>100?1:t/100}function ja(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=Fa.exec(e))?parseInt(t[1]+"ff",16)>>>0:ha&&void 0!==ha[e]?ha[e]:(t=Ra.exec(e))?(Ua(t[1])<<24|Ua(t[2])<<16|Ua(t[3])<<8|255)>>>0:(t=Ma.exec(e))?(Ua(t[1])<<24|Ua(t[2])<<16|Ua(t[3])<<8|Wa(t[4]))>>>0:(t=Da.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=za.exec(e))?parseInt(t[1],16)>>>0:(t=Oa.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=La.exec(e))?(255|Ha(Ga(t[1]),$a(t[2]),$a(t[3])))>>>0:(t=Aa.exec(e))?(Ha(Ga(t[1]),$a(t[2]),$a(t[3]))|Wa(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 Ka=(e,t,n)=>{if(sa.fun(e))return e;if(sa.arr(e))return Ka({range:e,output:t,extrapolate:n});if(sa.str(e.output[0]))return fa(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 qa(){return(qa=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 Ya=Symbol.for("FluidValue.get"),Za=Symbol.for("FluidValue.observers"),Xa=e=>Boolean(e&&e[Ya]),Qa=e=>e&&e[Ya]?e[Ya]():e,Ja=e=>e[Za]||null;function ec(e,t){let n=e[Za];n&&n.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}class tc{constructor(e){if(this[Ya]=void 0,this[Za]=void 0,!e&&!(e=this.get))throw Error("Unknown getter");nc(this,e)}}const nc=(e,t)=>lc(e,Ya,t);function oc(e,t){if(e[Ya]){let n=e[Za];n||lc(e,Za,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function rc(e,t){let n=e[Za];if(n&&n.has(t)){const o=n.size-1;o?n.delete(t):e[Za]=null,e.observerRemoved&&e.observerRemoved(o,t)}}const lc=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),ic=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,sc=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi;let ac;const cc=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,uc=(e,t,n,o,r)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(o)}, ${r})`,dc=e=>{ac||(ac=ha?new RegExp(`(${Object.keys(ha).join("|")})(?!\\w)`,"g"):/^\b$/);const t=e.output.map((e=>Qa(e).replace(sc,ja).replace(ac,ja))),n=t.map((e=>e.match(ic).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=>Ka(qa({},e,{output:t}))));return e=>{let n=0;return t[0].replace(ic,(()=>String(o[n++](e)))).replace(cc,uc)}},pc="react-spring: ",mc=e=>{const t=e;let n=!1;if("function"!=typeof t)throw new TypeError(`${pc}once requires a function parameter`);return(...e)=>{n||(t(...e),n=!0)}},fc=mc(console.warn),gc=mc(console.warn);function hc(e){return sa.str(e)&&("#"==e[0]||/\d/.test(e)||e in(ha||{}))}const vc=e=>(0,ra.useEffect)(e,bc),bc=[];function kc(){const e=(0,ra.useState)()[1],t=(0,ra.useState)(_c)[0];return vc(t.unmount),()=>{t.current&&e({})}}function _c(){const e={current:!0,unmount:()=>()=>{e.current=!1}};return e}function yc(e){const t=(0,ra.useRef)();return(0,ra.useEffect)((()=>{t.current=e})),t.current}const Ec="undefined"!=typeof window&&window.document&&window.document.createElement?ra.useLayoutEffect:ra.useEffect,Cc=Symbol.for("Animated:node"),wc=e=>e&&e[Cc],Sc=(e,t)=>{return n=e,o=Cc,r=t,Object.defineProperty(n,o,{value:r,writable:!0,configurable:!0});var n,o,r},Bc=e=>e&&e[Cc]&&e[Cc].getPayload();class Ic{constructor(){this.payload=void 0,Sc(this,this)}getPayload(){return this.payload||[]}}class xc extends Ic{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,sa.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new xc(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return sa.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,sa.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}}class Tc extends xc{constructor(e){super(0),this._string=null,this._toString=void 0,this._toString=Ka({output:[e,e]})}static create(e){return new Tc(e)}getValue(){let e=this._string;return null==e?this._string=this._toString(this._value):e}setValue(e){if(sa.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=Ka({output:[this.getValue(),e]})),this._value=0,super.reset()}}const Nc={dependencies:null};class Pc extends Ic{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return ua(this.source,((n,o)=>{var r;(r=n)&&r[Cc]===r?t[o]=n.getValue(e):Xa(n)?t[o]=Qa(n):e||(t[o]=n)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&ca(this.payload,(e=>e.reset()))}_makePayload(e){if(e){const t=new Set;return ua(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Nc.dependencies&&Xa(e)&&Nc.dependencies.add(e);const t=Bc(e);t&&ca(t,(e=>this.add(e)))}}class Rc extends Pc{constructor(e){super(e)}static create(e){return new Rc(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(Mc)),!0)}}function Mc(e){return(hc(e)?Tc:xc).create(e)}function Lc(e){const t=wc(e);return t?t.constructor:sa.arr(e)?Rc:hc(e)?Tc:xc}function Ac(){return(Ac=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 Dc=(e,t)=>{const n=!sa.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,ra.forwardRef)(((o,r)=>{const l=(0,ra.useRef)(null),i=n&&(0,ra.useCallback)((e=>{l.current=function(e,t){return e&&(sa.fun(e)?e(t):e.current=t),t}(r,e)}),[r]),[s,a]=function(e,t){const n=new Set;return Nc.dependencies=n,e.style&&(e=Ac({},e,{style:t.createAnimatedStyle(e.style)})),e=new Pc(e),Nc.dependencies=null,[e,n]}(o,t),c=kc(),u=()=>{const e=l.current;n&&!e||!1===(!!e&&t.applyAnimatedValues(e,s.getValue(!0)))&&c()},d=new Oc(u,a),p=(0,ra.useRef)();Ec((()=>{const e=p.current;p.current=d,ca(a,(e=>oc(e,d))),e&&(ca(e.deps,(t=>rc(t,e))),Hs.cancel(e.update))})),(0,ra.useEffect)(u,[]),vc((()=>()=>{const e=p.current;ca(e.deps,(t=>rc(t,e)))}));const m=t.getComponentProps(s.getValue());return ra.createElement(e,Ac({},m,{ref:i}))}))};class Oc{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&Hs.write(this.update)}}const Fc=Symbol.for("AnimatedComponent"),zc=e=>sa.str(e)?e:e&&sa.str(e.displayName)?e.displayName:sa.fun(e)&&e.name||null;function Vc(){return(Vc=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 Hc(e,...t){return sa.fun(e)?e(...t):e}const Uc=(e,t)=>!0===e||!!(t&&e&&(sa.fun(e)?e(t):da(e).includes(t))),Gc=(e,t)=>sa.obj(e)?t&&e[t]:e,Wc=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,$c=e=>e,jc=(e,t=$c)=>{let n=Kc;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);sa.und(n)||(o[r]=n)}return o},Kc=["config","onProps","onStart","onChange","onPause","onResume","onRest"],qc={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 Yc(e){const t=function(e){const t={};let n=0;if(ua(e,((e,o)=>{qc[o]||(t[o]=e,n++)})),n)return t}(e);if(t){const n={to:t};return ua(e,((e,o)=>o in t||(n[o]=e))),n}return Vc({},e)}function Zc(e){return e=Qa(e),sa.arr(e)?e.map(Zc):hc(e)?ka.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function Xc(e){for(const t in e)return!0;return!1}function Qc(e){return sa.fun(e)||sa.arr(e)&&sa.obj(e[0])}function Jc(e,t){var n;null==(n=e.ref)||n.delete(e),null==t||t.delete(e)}function eu(e,t){var n;t&&e.ref!==t&&(null==(n=e.ref)||n.delete(e),t.add(e),e.ref=t)}const tu=Vc({},{tension:170,friction:26},{mass:1,damping:1,easing:e=>e,clamp:!1});class nu{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,tu)}}function ou(e,t){if(sa.und(t.decay)){const n=!sa.und(t.tension)||!sa.und(t.friction);!n&&sa.und(t.frequency)&&sa.und(t.damping)&&sa.und(t.mass)||(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}else e.duration=void 0}const ru=[];class lu{constructor(){this.changed=!1,this.values=ru,this.toValues=null,this.fromValues=ru,this.to=void 0,this.from=void 0,this.config=new nu,this.immediate=!1}}function iu(e,{key:t,props:n,defaultProps:o,state:r,actions:l}){return new Promise(((i,s)=>{var a;let c,u,d=Uc(null!=(a=n.cancel)?a:null==o?void 0:o.cancel,t);if(d)f();else{sa.und(n.pause)||(r.paused=Uc(n.pause,t));let e=null==o?void 0:o.pause;!0!==e&&(e=r.paused||Uc(e,t)),c=Hc(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-Hs.now()}function m(){c>0?(u=Hs.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(Vc({},n,{callId:e,cancel:d}),i)}catch(e){s(e)}}}))}const su=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?uu(e.get()):t.every((e=>e.noop))?au(e.get()):cu(e.get(),t.every((e=>e.finished))),au=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),cu=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),uu=e=>({value:e,cancelled:!0,finished:!1});function du(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=jc(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)&&uu(o)||r!==n.asyncId&&cu(o,!1);if(t)throw e.result=t,d(e),e},f=(e,t)=>{const l=new mu,i=new fu;return(async()=>{if(ka.skipAnimation)throw pu(n),i.result=cu(o,!1),d(i),i;m(l);const s=sa.obj(e)?Vc({},e):Vc({},t,{to:e});s.parentId=r,ua(c,((e,t)=>{sa.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(ka.skipAnimation)return pu(n),cu(o,!1);try{let t;t=sa.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=cu(o.get(),!0,!1)}catch(e){if(e instanceof mu)g=e.result;else{if(!(e instanceof fu))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 sa.fun(i)&&Hs.batchedUpdates((()=>{i(g,o,o.item)})),g})():a}function pu(e,t){pa(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}class mu 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 fu extends Error{constructor(){super("SkipAnimationSignal"),this.result=void 0}}const gu=e=>e instanceof vu;let hu=1;class vu extends tc{constructor(...e){super(...e),this.id=hu++,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=wc(this);return e&&e.getValue()}to(...e){return ka.to(this,e)}interpolate(...e){return fc(`${pc}The "interpolate" function is deprecated in v9 (use "to" instead)`),ka.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){ec(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||wa.sort(this),ec(this,{type:"priority",parent:this,priority:e})}}const bu=Symbol.for("SpringPhase"),ku=e=>(1&e[bu])>0,_u=e=>(2&e[bu])>0,yu=e=>(4&e[bu])>0,Eu=(e,t)=>t?e[bu]|=3:e[bu]&=-3,Cu=(e,t)=>t?e[bu]|=4:e[bu]&=-5;class wu extends vu{constructor(e,t){if(super(),this.key=void 0,this.animation=new lu,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,!sa.und(e)||!sa.und(t)){const n=sa.obj(e)?Vc({},e):Vc({},t,{from:e});sa.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(_u(this)||this._state.asyncTo)||yu(this)}get goal(){return Qa(this.animation.to)}get velocity(){const e=wc(this);return e instanceof xc?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return ku(this)}get isAnimating(){return _u(this)}get isPaused(){return yu(this)}advance(e){let t=!0,n=!1;const o=this.animation;let{config:r,toValues:l}=o;const i=Bc(o.to);!i&&Xa(o.to)&&(l=da(Qa(o.to))),o.values.forEach(((s,a)=>{if(s.done)return;const c=s.constructor==Tc?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=sa.arr(r.velocity)?r.velocity[a]:r.velocity;let i;if(sa.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=!sa.und(a),m=n==c?s.v0>0:n<c;let f,g=!1;const h=1,v=Math.ceil(e/h);for(let e=0;e<v&&(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=wc(this),a=s.getValue();if(t){const e=Qa(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 Hs.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(_u(this)){const{to:e,config:t}=this.animation;Hs.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 sa.und(e)?(n=this.queue||[],this.queue=[]):n=[sa.obj(e)?e:Vc({},t,{to:e})],Promise.all(n.map((e=>this._update(e)))).then((e=>su(this,e)))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),pu(this._state,e&&this._lastCallId),Hs.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=sa.obj(n)?n[t]:n,(null==n||Qc(n))&&(n=void 0),o=sa.obj(o)?o[t]:o,null==o&&(o=void 0);const r={to:n,from:o};return ku(this)||(e.reverse&&([n,o]=[o,n]),o=Qa(o),sa.und(o)?wc(this)||this._set(n):this._set(o)),r}_update(e,t){let n=Vc({},e);const{key:o,defaultProps:r}=this;n.default&&Object.assign(r,jc(n,((e,t)=>/^on/.test(t)?Gc(e,o):e))),Pu(this,n,"onProps"),Ru(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 iu(++this._lastCallId,{key:o,props:n,defaultProps:r,state:i,actions:{pause:()=>{yu(this)||(Cu(this,!0),ma(i.pauseQueue),Ru(this,"onPause",cu(this,Su(this,this.animation.to)),this))},resume:()=>{yu(this)&&(Cu(this,!1),_u(this)&&this._resume(),ma(i.resumeQueue),Ru(this,"onResume",cu(this,Su(this,this.animation.to)),this))},start:this._merge.bind(this,l)}}).then((e=>{if(n.loop&&e.finished&&(!t||!e.noop)){const e=Bu(n);if(e)return this._update(e,!0)}return e}))}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(uu(this));const o=!sa.und(e.to),r=!sa.und(e.from);if(o||r){if(!(t.callId>this._lastToId))return n(uu(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&&!sa.und(u)||(u=d),t.reverse&&([u,d]=[d,u]);const p=!aa(d,c);p&&(s.from=d),d=Qa(d);const m=!aa(u,a);m&&this._focus(u);const f=Qc(t.to),{config:g}=s,{decay:h,velocity:v}=g;(o||r)&&(g.velocity=0),t.config&&!f&&function(e,t,n){n&&(ou(n=Vc({},n),t),t=Vc({},n,t)),ou(e,t),Object.assign(e,t);for(const t in tu)null==e[t]&&(e[t]=tu[t]);let{mass:o,frequency:r,damping:l}=e;sa.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,Hc(t.config,l),t.config!==i.config?Hc(i.config,l):void 0);let b=wc(this);if(!b||sa.und(u))return n(cu(this,!0));const k=sa.und(t.reset)?r&&!t.default:!sa.und(d)&&Uc(t.reset,l),_=k?d:this.get(),y=Zc(u),E=sa.num(y)||sa.arr(y)||hc(y),C=!f&&(!E||Uc(i.immediate||t.immediate,l));if(m){const e=Lc(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=Xa(u),B=!1;if(!S){const e=k||!ku(this)&&p;(m||e)&&(B=aa(Zc(_),y),S=!B),(aa(s.immediate,C)||C)&&aa(g.decay,h)&&aa(g.velocity,v)||(S=!0)}if(B&&_u(this)&&(s.changed&&!k?S=!0:S||this._stop(a)),!f&&((S||Xa(a))&&(s.values=b.getPayload(),s.toValues=Xa(u)?null:w==Tc?[1]:da(y)),s.immediate!=C&&(s.immediate=C,C||k||this._set(a)),S)){const{onRest:e}=s;ca(Nu,(e=>Pu(this,t,e)));const o=cu(this,Su(this,a));ma(this._pendingCalls,o),this._pendingCalls.add(n),s.changed&&Hs.batchedUpdates((()=>{s.changed=!k,null==e||e(o,this),k?Hc(i.onRest,o):null==s.onStart||s.onStart(o,this)}))}k&&this._set(_),f?n(du(t.to,t,this._state,this)):S?this._start():_u(this)&&!m?this._pendingCalls.add(n):n(au(_))}_focus(e){const t=this.animation;e!==t.to&&(Ja(this)&&this._detach(),t.to=e,Ja(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;Xa(t)&&(oc(t,this),gu(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;Xa(e)&&rc(e,this)}_set(e,t=!0){const n=Qa(e);if(!sa.und(n)){const e=wc(this);if(!e||!aa(n,e.getValue())){const o=Lc(n);e&&e.constructor==o?e.setValue(n):Sc(this,o.create(n)),e&&Hs.batchedUpdates((()=>{this._onChange(n,t)}))}}return wc(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,Ru(this,"onStart",cu(this,Su(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Hc(this.animation.onChange,e,this)),Hc(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;wc(this).reset(Qa(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),_u(this)||(Eu(this,!0),yu(this)||this._resume())}_resume(){ka.skipAnimation?this.finish():wa.start(this)}_stop(e,t){if(_u(this)){Eu(this,!1);const n=this.animation;ca(n.values,(e=>{e.done=!0})),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),ec(this,{type:"idle",parent:this});const o=t?uu(this.get()):cu(this.get(),Su(this,null!=e?e:n.to));ma(this._pendingCalls,o),n.changed&&(n.changed=!1,Ru(this,"onRest",o,this))}}}function Su(e,t){const n=Zc(t);return aa(Zc(e.get()),n)}function Bu(e,t=e.loop,n=e.to){let o=Hc(t);if(o){const r=!0!==o&&Yc(o),l=(r||e).reverse,i=!r||r.reset;return Iu(Vc({},e,{loop:t,default:!1,pause:void 0,to:!l||Qc(n)?n:void 0,from:i?e.from:void 0,reset:i},r))}}function Iu(e){const{to:t,from:n}=e=Yc(e),o=new Set;return sa.obj(t)&&Tu(t,o),sa.obj(n)&&Tu(n,o),e.keys=o.size?Array.from(o):null,e}function xu(e){const t=Iu(e);return sa.und(t.default)&&(t.default=jc(t)),t}function Tu(e,t){ua(e,((e,n)=>null!=e&&t.add(n)))}const Nu=["onStart","onRest","onChange","onPause","onResume"];function Pu(e,t,n){e.animation[n]=t[n]!==Wc(t,n)?Gc(t[n],e.key):void 0}function Ru(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 Mu=["onStart","onChange","onRest"];let Lu=1;class Au{constructor(e,t){this.id=Lu++,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(Vc({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];sa.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(Iu(e)),this}start(e){let{queue:t}=this;return e?t=da(e).map(Iu):this.queue=[],this._flush?this._flush(this,t):(Uu(this,t),Du(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;ca(da(t),(t=>n[t].stop(!!e)))}else pu(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(sa.und(e))this.start({pause:!0});else{const t=this.springs;ca(da(e),(e=>t[e].pause()))}return this}resume(e){if(sa.und(e))this.start({pause:!1});else{const t=this.springs;ca(da(e),(e=>t[e].resume()))}return this}each(e){ua(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,pa(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&&pa(t,(([e,t])=>{t.value=i,e(t,this,this._item)})),l&&(this._started=!1,pa(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)}Hs.onFrame(this._onFrame)}}function Du(e,t){return Promise.all(t.map((t=>Ou(e,t)))).then((t=>su(e,t)))}async function Ou(e,t,n){const{keys:o,to:r,from:l,loop:i,onRest:s,onResolve:a}=t,c=sa.obj(t.default)&&t.default;i&&(t.loop=!1),!1===r&&(t.to=null),!1===l&&(t.from=null);const u=sa.arr(r)||sa.fun(r)?r:void 0;u?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):ca(Mu,(n=>{const o=t[n];if(sa.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,ma(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===Wc(t,"cancel");(u||m&&d.asyncId)&&p.push(iu(++e._lastAsyncId,{props:t,state:d,actions:{pause:ia,resume:ia,start(t,n){m?(pu(d,e._lastAsyncId),n(uu(e))):(t.onRest=s,n(du(u,t,d,e)))}}})),d.paused&&await new Promise((e=>{d.resumeQueue.add(e)}));const f=su(e,await Promise.all(p));if(i&&f.finished&&(!n||!f.noop)){const n=Bu(t,i,r);if(n)return Uu(e,[n]),Ou(e,n,!0)}return a&&Hs.batchedUpdates((()=>a(f,e,e.item))),f}function Fu(e,t){const n=Vc({},e.springs);return t&&ca(da(t),(e=>{sa.und(e.keys)&&(e=Iu(e)),sa.obj(e.to)||(e=Vc({},e,{to:void 0})),Hu(n,e,(e=>Vu(e)))})),zu(e,n),n}function zu(e,t){ua(t,((t,n)=>{e.springs[n]||(e.springs[n]=t,oc(t,e))}))}function Vu(e,t){const n=new wu;return n.key=e,t&&oc(n,t),n}function Hu(e,t,n){t.keys&&ca(t.keys,(o=>{(e[o]||(e[o]=n(o)))._prepareNode(t)}))}function Uu(e,t){ca(t,(t=>{Hu(e.springs,t,(t=>Vu(t,e)))}))}const Gu=["children"],Wu=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,Gu);const o=(0,ra.useContext)($u),r=n.pause||!!o.pause,l=n.immediate||!!o.immediate;n=function(e,t){const[n]=(0,ra.useState)((()=>({inputs:t,result:e()}))),o=(0,ra.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,ra.useEffect)((()=>{o.current=l,r==n&&(n.inputs=n.result=void 0)}),[l]),l.result}((()=>({pause:r,immediate:l})),[r,l]);const{Provider:i}=$u;return ra.createElement(i,{value:n},t)},$u=(ju=Wu,Ku={},Object.assign(ju,ra.createContext(Ku)),ju.Provider._context=ju,ju.Consumer._context=ju,ju);var ju,Ku;Wu.Provider=$u.Provider,Wu.Consumer=$u.Consumer;const qu=()=>{const e=[],t=function(t){gc(`${pc}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 ca(e,((e,r)=>{if(sa.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 ca(e,(e=>e.pause(...arguments))),this},t.resume=function(){return ca(e,(e=>e.resume(...arguments))),this},t.set=function(t){ca(e,(e=>e.set(t)))},t.start=function(t){const n=[];return ca(e,((e,o)=>{if(sa.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 ca(e,(e=>e.stop(...arguments))),this},t.update=function(t){return ca(e,((e,n)=>e.update(this._getProps(t,e,n)))),this};const n=function(e,t,n){return sa.fun(e)?e(n,t):e};return t._getProps=n,t};function Yu(e,t,n){const o=sa.fun(t)&&t;o&&!n&&(n=[]);const r=(0,ra.useMemo)((()=>o||3==arguments.length?qu():void 0),[]),l=(0,ra.useRef)(0),i=kc(),s=(0,ra.useMemo)((()=>({ctrls:[],queue:[],flush(e,t){const n=Fu(e,t);return l.current>0&&!s.queue.length&&!Object.keys(n).some((t=>!e.springs[t]))?Du(e,t):new Promise((o=>{zu(e,n),s.queue.push((()=>{o(Du(e,t))})),i()}))}})),[]),a=(0,ra.useRef)([...s.ctrls]),c=[],u=yc(e)||0;function d(e,n){for(let r=e;r<n;r++){const e=a.current[r]||(a.current[r]=new Au(null,s.flush)),n=o?o(r,e):t[r];n&&(c[r]=xu(n))}}(0,ra.useMemo)((()=>{ca(a.current.slice(e,u),(e=>{Jc(e,r),e.stop(!0)})),a.current.length=e,d(u,e)}),[e]),(0,ra.useMemo)((()=>{d(0,Math.min(u,e))}),n);const p=a.current.map(((e,t)=>Fu(e,c[t]))),m=(0,ra.useContext)(Wu),f=yc(m),g=m!==f&&Xc(m);Ec((()=>{l.current++,s.ctrls=a.current;const{queue:e}=s;e.length&&(s.queue=[],ca(e,(e=>e()))),ca(a.current,((e,t)=>{null==r||r.add(e),g&&e.start({default:m});const n=c[t];n&&(eu(e,n.ref),e.ref?e.queue.push(n):e.start(n))}))})),vc((()=>()=>{ca(s.ctrls,(e=>e.stop(!0)))}));const h=p.map((e=>Vc({},e)));return r?[h,r]:h}let Zu;!function(e){e.MOUNT="mount",e.ENTER="enter",e.UPDATE="update",e.LEAVE="leave"}(Zu||(Zu={}));class Xu extends vu{constructor(e,t){super(),this.key=void 0,this.idle=!0,this.calc=void 0,this._active=new Set,this.source=e,this.calc=Ka(...t);const n=this._get(),o=Lc(n);Sc(this,o.create(n))}advance(e){const t=this._get();aa(t,this.get())||(wc(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&Ju(this._active)&&ed(this)}_get(){const e=sa.arr(this.source)?this.source.map(Qa):da(Qa(this.source));return this.calc(...e)}_start(){this.idle&&!Ju(this._active)&&(this.idle=!1,ca(Bc(this),(e=>{e.done=!1})),ka.skipAnimation?(Hs.batchedUpdates((()=>this.advance())),ed(this)):wa.start(this))}_attach(){let e=1;ca(da(this.source),(t=>{Xa(t)&&oc(t,this),gu(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){ca(da(this.source),(e=>{Xa(e)&&rc(e,this)})),this._active.clear(),ed(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=da(this.source).reduce(((e,t)=>Math.max(e,(gu(t)?t.priority:0)+1)),0))}}function Qu(e){return!1!==e.idle}function Ju(e){return!e.size||Array.from(e).every(Qu)}function ed(e){e.idle||(e.idle=!0,ca(Bc(e),(e=>{e.done=!0})),ec(e,{type:"idle",parent:e}))}ka.assign({createStringInterpolator:dc,to:(e,t)=>new Xu(e,t)}),wa.advance;var td=window.ReactDOM;function nd(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 od=["style","children","scrollTop","scrollLeft"],rd=/^--/;function ld(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||rd.test(e)||sd.hasOwnProperty(e)&&sd[e]?(""+t).trim():t+"px"}const id={};let sd={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 ad=["Webkit","Ms","Moz","O"];sd=Object.keys(sd).reduce(((e,t)=>(ad.forEach((n=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(n,t)]=e[t])),e)),sd);const cd=["x","y","z"],ud=/^(matrix|translate|scale|rotate|skew)/,dd=/^(translate)/,pd=/^(rotate|skew)/,md=(e,t)=>sa.num(e)&&0!==e?e+t:e,fd=(e,t)=>sa.arr(e)?e.every((e=>fd(e,t))):sa.num(e)?e===t:parseFloat(e)===t;class gd extends Pc{constructor(e){let{x:t,y:n,z:o}=e,r=nd(e,cd);const l=[],i=[];(t||n||o)&&(l.push([t||0,n||0,o||0]),i.push((e=>[`translate3d(${e.map((e=>md(e,"px"))).join(",")})`,fd(e,0)]))),ua(r,((e,t)=>{if("transform"===t)l.push([e||""]),i.push((e=>[e,""===e]));else if(ud.test(t)){if(delete r[t],sa.und(e))return;const n=dd.test(t)?"px":pd.test(t)?"deg":"";l.push(da(e)),i.push("rotate3d"===t?([e,t,o,r])=>[`rotate3d(${e},${t},${o},${md(r,n)})`,fd(r,0)]:e=>[`${t}(${e.map((e=>md(e,n))).join(",")})`,fd(e,t.startsWith("scale")?1:0)])}})),l.length&&(r.transform=new hd(l,i)),super(r)}}class hd extends tc{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 ca(this.inputs,((n,o)=>{const r=Qa(n[0]),[l,i]=this.transforms[o](sa.arr(r)?r:n.map(Qa));e+=" "+l,t=t&&i})),t?"none":e}observerAdded(e){1==e&&ca(this.inputs,(e=>ca(e,(e=>Xa(e)&&oc(e,this)))))}observerRemoved(e){0==e&&ca(this.inputs,(e=>ca(e,(e=>Xa(e)&&rc(e,this)))))}eventObserved(e){"change"==e.type&&(this._value=null),ec(this,e)}}const vd=["scrollTop","scrollLeft"];ka.assign({batchedUpdates:td.unstable_batchedUpdates,createStringInterpolator:dc,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 bd=((e,{applyAnimatedValues:t=(()=>!1),createAnimatedStyle:n=(e=>new Pc(e)),getComponentProps:o=(e=>e)}={})=>{const r={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:o},l=e=>{const t=zc(e)||"Anonymous";return(e=sa.str(e)?l[e]||(l[e]=Dc(e,r)):e[Fc]||(e[Fc]=Dc(e,r))).displayName=`Animated(${t})`,e};return ua(e,((t,n)=>{sa.arr(e)&&(n=zc(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=nd(o,od),c=Object.values(a),u=Object.keys(a).map((t=>n||e.hasAttribute(t)?t:id[t]||(id[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=ld(t,r[t]);rd.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 gd(e),getComponentProps:e=>nd(e,vd)}).animated,kd=e=>e+1,_d=e=>({top:e.offsetTop,left:e.offsetLeft});var yd=function({isSelected:e,adjustScrolling:t,enableAnimation:n,triggerAnimationOnChange:o}){const r=(0,s.useRef)(),l=(0,d.useReducedMotion)()||!n,[i,a]=(0,s.useReducer)(kd,0),[c,u]=(0,s.useReducer)(kd,0),[p,m]=(0,s.useState)({x:0,y:0}),f=(0,s.useMemo)((()=>r.current?_d(r.current):null),[o]),g=(0,s.useMemo)((()=>{if(!t||!r.current)return()=>{};const e=(0,_s.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=_d(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=sa.fun(e),[[o],r]=Yu(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 Ed=".block-editor-block-list__block",Cd=".block-list-appender";function wd(e,t){return t.closest([Ed,Cd].join(","))===e}function Sd(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=_s.focus.tabbable.find(t.current).filter((e=>(0,_s.isTextField)(e))),r=-1===n,l=(r?u.last:u.first)(o)||t.current;wd(t.current,l)?(0,_s.placeCaretAtHorizontalEdge)(l,r):t.current.focus()}),[n]),t}function Bd(e){if(e.defaultPrevented)return;const t="mouseover"===e.type?"add":"remove";e.preventDefault(),e.currentTarget.classList[t]("is-hovered")}function Id(){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",Bd),t.addEventListener("mouseover",Bd),()=>{t.removeEventListener("mouseout",Bd),t.removeEventListener("mouseover",Bd),t.classList.remove("is-hovered")}}),[e])}function xd(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),v=s(e),b=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)(v)),"is-dragging":g,"has-child-selected":b,"has-active-entity":k,"is-active-entity":k===e,"remove-outline":h&&f&&d()})}),[e])}function Td(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 Nd(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 Pd(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 Rd(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):wd(r,l.target)&&n(e)}return r.addEventListener("focusin",l),()=>{r.removeEventListener("focusin",l)}}),[t,n])}function Md(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!==di.ENTER&&s!==di.BACKSPACE&&s!==di.DELETE||a!==i||(0,_s.isTextField)(a)||(t.preventDefault(),s===di.ENTER?r({},n(e),o(e)+1):l(e))}function a(e){e.preventDefault()}}),[e,t,n,o,r,l])}function Ld(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 Ad=n(4979),Dd=n.n(Ad);function Od(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,_s.getScrollContainer)(e)||e.ownerDocument.defaultView;o&&Dd()(e,o,{onlyScrollIfNeeded:!0})}),[n]),t}function Fd(e,t){Array.from(e.closest(".is-root-container").querySelectorAll(".rich-text")).forEach((e=>{t?e.setAttribute("contenteditable",!0):e.removeAttribute("contenteditable")}))}function zd(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 Fd(u,!0);const l=function(e){for(;e&&e.nodeType!==e.ELEMENT_NODE;)e=e.parentNode;if(!e)return;const t=e.closest(Ed);return t?t.id.slice("block-".length):void 0}(n.focusNode);if(e===l){if(r(e),t&&(Fd(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 v({buttons:n}){1===n&&l()&&i(e)&&(m=d.activeElement,t(),d.addEventListener("selectionchange",g),p.addEventListener("mouseup",h),Fd(u,!1))}function b(t){if(l()&&0===t.button)if(t.shiftKey){const n=a();n&&n!==e&&(Fd(u,!1),o(n,e),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",g),p.removeEventListener("mouseup",h),p.cancelAnimationFrame(f)}}),[e,t,n,o,r,l,i,s])}function Vd(){const e=(0,s.useContext)(Sg);return(0,d.useRefEffect)((t=>{if(e)return e.observe(t),()=>{e.unobserve(t)}}),[e])}function Hd(e={},{__unstableIsHtml:t}={}){const{clientId:n,className:o,wrapperProps:l={},isAligned:i}=(0,s.useContext)(Ud),{index:a,mode:u,name:p,blockApiVersion:f,blockTitle:h,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(Wn),m=c(n),f=u(n)||d(n),g=i(n),h=t(n),v=(0,r.getBlockType)(g);return{index:o(n,h),mode:l(n),name:g,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,g.sprintf)((0,g.__)("Block: %s"),h),y="html"!==u||t?"":"-visual",E=(0,d.useMergeRefs)([e.ref,Sd(n),Od(n),Al(n),Rd(n),zd(n),Md(n),Ld(n),Id(),Vd(),yd({isSelected:v,adjustScrolling:b,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,xd(n),Td(n),Nd(n),Pd(n)),style:{...l.style,...e.style}}}Hd.save=r.__unstableGetBlockProps;const Ud=(0,s.createContext)();function Gd({children:e,isHtml:t,...n}){return(0,s.createElement)("div",Hd(n,{__unstableIsHtml:t}),e)}const Wd=(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:v}=u||{};return{mode:r(t),isSelectionEnabled:l(),isLocked:!!p,canRemove:m,canMove:f,block:u,name:g,attributes:h,isValid:v,isSelected:d}})),$d=(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 jd=(0,d.compose)(d.pure,Wd,$d,(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:v,onInsertBlocksAfter:b,onMerge:k,toggleSelection:_}){const{removeBlock:y}=(0,m.useDispatch)(Wn),E=(0,s.useCallback)((()=>y(o)),[o]);let C=(0,s.createElement)(Bs,{name:d,isSelected:l,attributes:f,setAttributes:h,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&&(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,w.getEditWrapperProps(f)));const S=g&&!!g["data-align"];let B;if(S&&(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)(Gd,{isHtml:!0},(0,s.createElement)(zs,{clientId:o}))):(null==w?void 0:w.apiVersion)>1?C:(0,s.createElement)(Gd,g,C);else{const e=(0,r.getSaveContent)(w,f);B=(0,s.createElement)(Gd,{className:"has-warning"},(0,s.createElement)(Ms,{clientId:o}),(0,s.createElement)(s.RawHTML,null,(0,_s.safeHTML)(e)))}const I={clientId:o,className:a,wrapperProps:(0,u.omit)(g,["data-align"]),isAligned:S},x=(0,s.useMemo)((()=>I),Object.values(I));return(0,s.createElement)(Ud.Provider,{value:x},(0,s.createElement)(Os,{fallback:(0,s.createElement)(Gd,{className:"has-warning"},(0,s.createElement)(As,null))},B))})),Kd=window.wp.htmlEntities,qd=(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 Yd=[(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 Zd=function(){const[e]=(0,s.useState)(Math.floor(Math.random()*Yd.length));return(0,s.createElement)(p.Tip,null,Yd[e])},Xd=(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 Qd({icon:e,showColors:t=!1,className:n}){var o;"block-default"===(null===(o=e)||void 0===o?void 0:o.src)&&(e={src:Xd});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 Jd=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)(Qd,{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 ep({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),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=[]):h(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(Wn);let s=h(e),a=r(),c=!1;b.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&&(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 tp=(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]),ep(e),(0,s.createElement)(Ll,null,t)}));function np({onClick:e}){return(0,s.createElement)("div",{tabIndex:0,role:"button",onClick:e,onKeyPress:e},(0,s.createElement)(p.Disabled,null,(0,s.createElement)(Ig,null)))}function op(){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 rp(e){return(0,s.createElement)("div",i({ref:op()},e))}function lp(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 ip(e){const{isMultiSelecting:t,getMultiSelectedBlockClientIds:n,hasMultiSelection:o,getSelectedBlockClientId:r}=e(Wn);return{isMultiSelecting:t(),multiSelectedBlockClientIds:n(),hasMultiSelection:o(),selectedBlockClientId:r()}}function sp(){const{isMultiSelecting:e,multiSelectedBlockClientIds:t,hasMultiSelection:n,selectedBlockClientId:o}=(0,m.useSelect)(ip,[]),r=Dl(o),l=Dl((0,u.first)(t)),i=Dl((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=lp(l.current,"start"),f=lp(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 ap(e){const{tagName:t}=e;return"INPUT"===t||"BUTTON"===t||"SELECT"===t||"TEXTAREA"===t}function cp(e,t,n,o){let r,l=_s.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(!_s.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 up(){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===di.UP,u=l===di.DOWN,m=l===di.LEFT,h=l===di.RIGHT,v=c||m,b=m||h,k=c||u,_=b||k,y=t.shiftKey,E=y||t.ctrlKey||t.altKey||t.metaKey,C=k?_s.isVerticalEdge:_s.isHorizontalEdge,{ownerDocument:w}=d,{defaultView:S}=w;if(a())return void(_&&((y?f:g)(v),t.preventDefault()));if(k?p||(p=(0,_s.computeCaretRect)(S)):p=null,t.defaultPrevented)return;if(!_)return;if(!function(e,t,n){if((t===di.UP||t===di.DOWN)&&!n)return!0;const{tagName:o}=e;return"INPUT"!==o&&"TEXTAREA"!==o}(i,l,E))return;const B=(0,_s.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=cp(e,t,d);return!n||!function(e,t){return e.closest(Ed)===t.closest(Ed)}(e,n)}(i,v)&&C(i,v)&&(f(v),t.preventDefault())}else if(k&&(0,_s.isVerticalEdge)(i,v)&&!I){const e=cp(i,v,d,!0);e&&((0,_s.placeCaretAtVerticalEdge)(e,v,p),t.preventDefault())}else if(b&&S.getSelection().isCollapsed&&(0,_s.isHorizontalEdge)(i,B)&&!I){const e=cp(i,B,d);(0,_s.placeCaretAtHorizontalEdge)(e,v),t.preventDefault()}}return d.addEventListener("mousedown",m),d.addEventListener("keydown",h),()=>{d.removeEventListener("mousedown",m),d.removeEventListener("keydown",h)}}),[])}var dp=window.wp.keyboardShortcuts;function pp(){const{getBlockOrder:e,getSelectedBlockClientIds:t,getBlockRootClientId:n}=(0,m.useSelect)(Wn),{multiSelect:o}=(0,m.useDispatch)(Wn),r=(0,dp.__unstableUseShortcutEventMatch)();return(0,d.useRefEffect)((l=>{function i(l){if(!r("core/block-editor/select-all",l))return;if(!(0,_s.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 mp(){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";_s.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===di.ESCAPE&&!r())return e.preventDefault(),void a(!0);if(e.keyCode!==di.TAB)return;const o=e.shiftKey,i=o?"findPrevious":"findNext";if(!r()&&!l())return void(e.target===s&&a(!0));if(ap(e.target)&&ap(_s.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!==di.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=_s.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,sp(),pp(),up(),(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 fp=(0,s.forwardRef)((function({children:e,...t},n){const[o,r,l]=mp();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 gp="editor-styles-wrapper";function hp(e){return(0,s.useMemo)((()=>{const t=document.implementation.createHTMLDocument("");return t.body.innerHTML=e,Array.from(t.body.children)}),[e])}var vp=(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)(),[v,b]=(0,s.useState)([]),k=hp(null===(a=window.__editorAssets)||void 0===a?void 0:a.styles),_=hp(null===(u=window.__editorAssets)||void 0===u?void 0:u.scripts),y=op(),[E,C,w]=mp(),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),h(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(`.${gp}`)||e.includes(".wp-block"))))&&!e.getElementById(n.id)){console.error(`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,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()(gp,...v)},(0,s.createElement)(p.__experimentalStyleProvider,{document:f},t))),f.documentElement)),o>=0&&w)})),bp=n(3692),kp=n.n(bp);const _p=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function yp(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=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 Ep(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=Ep(t[0]),!p(/^:\s*/))return a("property missing ':'");const n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),o=e({type:"declaration",property:t.replace(_p,""),value:n?Ep(n[0]).replace(_p,""):""});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=Ep(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:Ep(t[1]),media:Ep(t[2])})}()||function(){const e=l(),t=p(/^@supports *([^{]+)/);if(!t)return;const n=Ep(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=Ep(t[1]),o=Ep(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=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=h();return t?(f(),e({type:"rule",selectors:t,declarations:b()})):a("selector missing")}return Cp(function(){const e=d();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:s}}}())}function Ep(e){return e?e.replace(/^\s+|\s+$/g,""):""}function Cp(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){Cp(e,o)})):n&&"object"==typeof n&&Cp(n,o)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var wp=n(5717),Sp=n.n(wp),Bp=Ip;function Ip(e){this.options=e||{}}Ip.prototype.emit=function(e){return e},Ip.prototype.visit=function(e){return this[e.type](e)},Ip.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 xp=Tp;function Tp(e){Bp.call(this,e)}Sp()(Tp,Bp),Tp.prototype.compile=function(e){return e.stylesheet.rules.map(this.visit,this).join("")},Tp.prototype.comment=function(e){return this.emit("",e.position)},Tp.prototype.import=function(e){return this.emit("@import "+e.import+";",e.position)},Tp.prototype.media=function(e){return this.emit("@media "+e.media,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},Tp.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("}")},Tp.prototype.charset=function(e){return this.emit("@charset "+e.charset+";",e.position)},Tp.prototype.namespace=function(e){return this.emit("@namespace "+e.namespace+";",e.position)},Tp.prototype.supports=function(e){return this.emit("@supports "+e.supports,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},Tp.prototype.keyframes=function(e){return this.emit("@"+(e.vendor||"")+"keyframes "+e.name,e.position)+this.emit("{")+this.mapVisit(e.keyframes)+this.emit("}")},Tp.prototype.keyframe=function(e){const t=e.declarations;return this.emit(e.values.join(","),e.position)+this.emit("{")+this.mapVisit(t)+this.emit("}")},Tp.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("}")},Tp.prototype["font-face"]=function(e){return this.emit("@font-face",e.position)+this.emit("{")+this.mapVisit(e.declarations)+this.emit("}")},Tp.prototype.host=function(e){return this.emit("@host",e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},Tp.prototype["custom-media"]=function(e){return this.emit("@custom-media "+e.name+" "+e.media+";",e.position)},Tp.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("}"):""},Tp.prototype.declaration=function(e){return this.emit(e.property+":"+e.value,e.position)+this.emit(";")};var Np=Pp;function Pp(e){e=e||{},Bp.call(this,e),this.indentation=e.indent}Sp()(Pp,Bp),Pp.prototype.compile=function(e){return this.stylesheet(e)},Pp.prototype.stylesheet=function(e){return this.mapVisit(e.stylesheet.rules,"\n\n")},Pp.prototype.comment=function(e){return this.emit(this.indent()+"/*"+e.comment+"*/",e.position)},Pp.prototype.import=function(e){return this.emit("@import "+e.import+";",e.position)},Pp.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}")},Pp.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}")},Pp.prototype.charset=function(e){return this.emit("@charset "+e.charset+";",e.position)},Pp.prototype.namespace=function(e){return this.emit("@namespace "+e.namespace+";",e.position)},Pp.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}")},Pp.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)+"}")},Pp.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")},Pp.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}")},Pp.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}")},Pp.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}")},Pp.prototype["custom-media"]=function(e){return this.emit("@custom-media "+e.name+" "+e.media+";",e.position)},Pp.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()+"}"):""},Pp.prototype.declaration=function(e){return this.emit(this.indent())+this.emit(e.property+": "+e.value,e.position)+this.emit(";")},Pp.prototype.indent=function(e){return this.level=this.level||1,null!==e?(this.level+=e,""):Array(this.level).join(this.indentation||" ")};function Rp(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 Mp(e,t){return new URL(e,t).toString()}const Lp=/^(body|html|:root).*$/;var Ap=(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(Lp)?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]};Rp(e)&&o.push(e)}return o}(e.value).map((o=l,e=>({...e,newUrl:"url("+e.before+e.quote+Mp(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=yp(e);return n=kp().map(r,(function(e){if(!e)return e;const n=t(e);return this.update(n)})),((o=o||{}).compress?new xp(o):new Np(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 Dp=".editor-styles-wrapper";function Op(e){return(0,s.useCallback)((e=>{if(!e)return;const{ownerDocument:t}=e,{defaultView:n,body:o}=t,r=t.querySelector(Dp);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=Sr(l);i.luminance()>.5||0===i.alpha()?o.classList.remove("is-dark-theme"):o.classList.add("is-dark-theme")}),[e])}function Fp({styles:e}){const t=(0,s.useMemo)((()=>Ap(e,Dp)),[e]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("style",{ref:Op(e)}),t.map(((e,t)=>(0,s.createElement)("style",{key:t},e))))}let zp;Ir([xr,Pr]);var Vp=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),[]);zp=zp||(0,d.pure)(Ig);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)(vp,{head:(0,s.createElement)(Fp,{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)(zp,{renderAppender:!1}))))},Hp=(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)(tp,{value:a,settings:i},o?(0,s.createElement)(np,{onClick:r}):(0,s.createElement)(Vp,{viewportWidth:n,__experimentalPadding:t})):null})),Up=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||u.example?(0,s.createElement)("div",{className:"block-editor-inserter__preview-content"},(0,s.createElement)(Hp,{__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)(Jd,{title:l,icon:i,description:a}))},Gp=(0,s.createContext)(),Wp=(0,s.forwardRef)((function({isFirst:e,as:t,children:n,...o},r){const l=(0,s.useContext)(Gp);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)}))})),$p=(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 jp({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)(Qd,{icon:t}):(0,g.sprintf)(
|
19 |
/* translators: %d: Number of blocks. */
|
20 |
+
(0,g._n)("%d block","%d blocks",e),e)),(0,s.createElement)(p.FlexItem,null,(0,s.createElement)(Qd,{icon:$p})))))}var Kp=({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)(jp,{count:t.length,icon:n})},(({onDraggableStart:t,onDraggableEnd:n})=>o({draggable:e,onDragStart:e?t:void 0,onDragEnd:e?n:void 0})))};function qp(e=window){const{platform:t}=e.navigator;return-1!==t.indexOf("Mac")||["iPad","iPhone"].includes(t)}var Yp=(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)(Kp,{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)(Wp,i({isFirst:t,className:c()("block-editor-block-types-list__item",e),disabled:n.isDisabled,onClick:e=>{e.preventDefault(),o(n,qp()?e.metaKey:e.ctrlKey),l(null)},onKeyDown:e=>{const{keyCode:t}=e;t===di.ENTER&&(e.preventDefault(),o(n,qp()?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)(Qd,{icon:n.icon,showColors:!0})),(0,s.createElement)("span",{className:"block-editor-block-types-list__item-title"},n.title)))))})),Zp=(0,s.forwardRef)((function(e,t){const[n,o]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{n&&(0,Rt.speak)((0,g.__)("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))})),Xp=(0,s.forwardRef)((function(e,t){const n=(0,s.useContext)(Gp);return(0,s.createElement)(p.__unstableCompositeGroup,i({state:n,role:"presentation",ref:t},e))})),Qp=function({items:e=[],onSelect:t,onHover:n=(()=>{}),children:o,label:l,isDraggable:i=!0}){return(0,s.createElement)(Zp,{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)(Xp,{key:o},e.map(((e,l)=>(0,s.createElement)(Yp,{key:e.id,item:e,className:(0,r.getBlockMenuDefaultClassName)(e.id),onSelect:t,onHover:n,isDraggable:i,isFirst:0===o&&0===l})))))),o)},Jp=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))},em=(e,t)=>{const{categories:n,collections:o,items:l}=(0,m.useSelect)((t=>{const{getInserterItems:n}=t(Wn),{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])]},tm=function({children:e}){const t=(0,p.__unstableUseCompositeState)({shift:!0,wrap:"horizontal"});return(0,s.createElement)(Gp.Provider,{value:t},e)};const nm=[];var om=function({rootClientId:e,onInsert:t,onHover:n,showMostUsedBlocks:o}){const[r,l,i,a]=em(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 h=(0,d.useAsyncList)(l),v=l.length===h.length,b=(0,s.useMemo)((()=>Object.entries(i)),[i]),k=(0,d.useAsyncList)(v?b:nm);return(0,s.createElement)(tm,null,(0,s.createElement)("div",null,o&&!!c.length&&(0,s.createElement)(Jp,{title:(0,g._x)("Most used","blocks")},(0,s.createElement)(Qp,{items:c,onSelect:a,onHover:n,label:(0,g._x)("Most used","blocks")})),(0,u.map)(h,(e=>{const t=m[e.slug];return t&&t.length?(0,s.createElement)(Jp,{key:e.slug,title:e.title,icon:e.icon},(0,s.createElement)(Qp,{items:t,onSelect:a,onHover:n,label:e.title})):null})),v&&p.length>0&&(0,s.createElement)(Jp,{className:"block-editor-inserter__uncategorized-blocks-panel",title:(0,g.__)("Uncategorized")},(0,s.createElement)(Qp,{items:p,onSelect:a,onHover:n,label:(0,g.__)("Uncategorized")})),(0,u.map)(k,(([e,t])=>{const o=f[e];return o&&o.length?(0,s.createElement)(Jp,{key:e,title:t.title,icon:t.icon},(0,s.createElement)(Qp,{items:o,onSelect:a,onHover:n,label:t.title})):null}))))},rm=function({selectedCategory:e,patternCategories:t,onClickCategory:n,children:o}){return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:c()("block-editor-inserter__panel-header","block-editor-inserter__panel-header-patterns")},(0,s.createElement)(p.SelectControl,{className:"block-editor-inserter__panel-dropdown",label:(0,g.__)("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})()})),(0,s.createElement)("div",{className:"block-editor-inserter__panel-content"},o))},lm=window.wp.notices,im=(e,t)=>{const{patternCategories:n,patterns:o}=(0,m.useSelect)((e=>{const{__experimentalGetAllowedPatterns:n,getSettings:o}=e(Wn);return{patterns:n(t),patternCategories:o().__experimentalBlockPatternCategories}}),[t]),{createSuccessNotice:l}=(0,m.useDispatch)(lm.store);return[o,n,(0,s.useCallback)(((t,n)=>{e((0,u.map)(n,(e=>(0,r.cloneBlock)(e))),t.name),l((0,g.sprintf)(
|
21 |
/* translators: %s: block pattern title. */
|
22 |
+
(0,g.__)('Block pattern "%s" inserted.'),t.title),{type:"snackbar"})}),[])]};function sm({isDraggable:e,pattern:t,onClick:n,composite:o}){const{name:r,viewportWidth:l}=t,{blocks:a}=(0,m.useSelect)((e=>e(Wn).__experimentalGetParsedPattern(r)),[r]),c=`block-editor-block-patterns-list__item-description-${(0,d.useInstanceId)(sm)}`;return(0,s.createElement)(Kp,{isEnabled:e,blocks:a},(({draggable:e,onDragStart:r,onDragEnd:u})=>(0,s.createElement)("div",{className:"block-editor-block-patterns-list__list-item","aria-label":t.title,"aria-describedby":t.description?c:void 0,draggable:e,onDragStart:r,onDragEnd:u},(0,s.createElement)(p.__unstableCompositeItem,i({role:"option",as:"div"},o,{className:"block-editor-block-patterns-list__item",onClick:()=>n(t,a)}),(0,s.createElement)(Hp,{blocks:a,viewportWidth:l}),(0,s.createElement)("div",{className:"block-editor-block-patterns-list__item-title"},t.title),!!t.description&&(0,s.createElement)(p.VisuallyHidden,{id:c},t.description)))))}function am(){return(0,s.createElement)("div",{className:"block-editor-block-patterns-list__item is-placeholder"})}var cm=function({isDraggable:e,blockPatterns:t,shownPatterns:n,onClickPattern:o,orientation:r,label:l=(0,g.__)("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)(sm,{key:t.name,pattern:t,onClick:o,isDraggable:e,composite:a}):(0,s.createElement)(am,{key:t.name}))))};function um({rootClientId:e,onInsert:t,selectedCategory:n,onClickCategory:o}){const[r,l,i]=im(t,e),a=(0,s.useMemo)((()=>l.filter((e=>r.some((t=>{var n;return null===(n=t.categories)||void 0===n?void 0:n.includes(e.name)}))))),[r,l]),c=n||a[0];(0,s.useEffect)((()=>{r.some((e=>p(e)===1/0))&&!a.find((e=>"uncategorized"===e.name))&&a.push({name:"uncategorized",label:(0,g._x)("Uncategorized")})}),[a,r]);const p=(0,s.useCallback)((e=>{if(!e.categories||!e.categories.length)return 1/0;const t=(0,u.fromPairs)(a.map((({name:e},t)=>[e,t])));return Math.min(...e.categories.map((e=>void 0!==t[e]?t[e]:1/0)))}),[a]),m=(0,s.useMemo)((()=>r.filter((e=>"uncategorized"===c.name?p(e)===1/0:e.categories&&e.categories.includes(c.name)))),[r,c]),f=(0,s.useMemo)((()=>m.sort(((e,t)=>p(e)-p(t)))),[m,p]),h=(0,d.useAsyncList)(f);return(0,s.createElement)(s.Fragment,null,!!m.length&&(0,s.createElement)(rm,{selectedCategory:c,patternCategories:a,onClickCategory:o},(0,s.createElement)(cm,{shownPatterns:h,blockPatterns:m,onClickPattern:i,label:c.label,orientation:"vertical",isDraggable:!0})))}var dm=function({rootClientId:e,onInsert:t,onClickCategory:n,selectedCategory:o}){return(0,s.createElement)(um,{rootClientId:e,selectedCategory:o,onInsert:t,onClickCategory:n})},pm=window.wp.url,mm=function(){return(0,s.createElement)("div",{className:"block-editor-inserter__no-results"},(0,s.createElement)(Co,{className:"block-editor-inserter__no-results-icon",icon:Xd}),(0,s.createElement)("p",null,(0,g.__)("No results found.")))};function fm({onHover:e,onInsert:t,rootClientId:n}){const[o,,,r]=em(n,t),l=(0,s.useMemo)((()=>o.filter((({category:e})=>"reusable"===e))),[o]);return 0===l.length?(0,s.createElement)(mm,null):(0,s.createElement)(Jp,{title:(0,g.__)("Reusable blocks")},(0,s.createElement)(Qp,{items:l,onSelect:r,onHover:e,label:(0,g.__)("Reusable blocks")}))}var gm=function({rootClientId:e,onInsert:t,onHover:n}){return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(fm,{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,pm.addQueryArgs)("edit.php",{post_type:"wp_block"})},(0,g.__)("Manage Reusable blocks"))))};const{Fill:hm,Slot:vm}=(0,p.createSlotFill)("__unstableInserterMenuExtension");hm.Slot=vm;var bm=hm,km=function({rootClientId:e="",insertionIndex:t,clientId:n,isAppender:o,onSelect:l,shouldFocusBlock:i=!0}){const{getSelectedBlock:a}=(0,m.useSelect)(Wn),{destinationRootClientId:c,destinationIndex:d}=(0,m.useSelect)((r=>{const{getSelectedBlockClientId:l,getBlockRootClientId:i,getBlockIndex:s,getBlockOrder:a}=r(Wn),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:h,hideInsertionPoint:v}=(0,m.useDispatch)(Wn),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,g.sprintf)(// translators: %d: the name of the block that has been added
|
23 |
+
(0,g._n)("%d block added.","%d blocks added.",(0,u.castArray)(e).length),(0,u.castArray)(e).length);(0,Rt.speak)(m),l&&l()}),[o,a,p,f,c,d,l,i]),k=(0,s.useCallback)((e=>{e?h(c,d):v()}),[h,v,c,d]);return[c,b,k]};const _m=e=>e.name||"",ym=e=>e.title,Em=e=>e.description||"",Cm=e=>e.keywords||[],wm=e=>e.category,Sm=()=>null;function Bm(e=""){return(e=(e=(0,u.deburr)(e)).replace(/^\//,"")).toLowerCase()}const Im=(e="")=>(0,u.words)(Bm(e)),xm=(e,t,n,o)=>0===Im(o).length?e:Tm(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}}),Tm=(e=[],t="",n={})=>{if(0===Im(t).length)return e;const o=e.map((e=>[e,Nm(e,t,n)])).filter((([,e])=>e>0));return o.sort((([,e],[,t])=>t-e)),o.map((([e])=>e))};function Nm(e,t,n={}){const{getName:o=_m,getTitle:r=ym,getDescription:l=Em,getKeywords:i=Cm,getCategory:s=wm,getCollection:a=Sm}=n,c=o(e),d=r(e),p=l(e),m=i(e),f=s(e),g=a(e),h=Bm(t),v=Bm(d);let b=0;if(h===v)b+=30;else if(v.startsWith(h))b+=20;else{const e=[c,d,p,...m,f,g].join(" ");0===(k=(0,u.words)(h),_=e,(0,u.differenceWith)(k,Im(_),((e,t)=>t.includes(e)))).length&&(b+=10)}var k,_;return 0!==b&&c.startsWith("core/")&&b++,b}const Pm=[];var Rm=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:h=!0}){const v=(0,d.useDebounce)(Rt.speak,500),[b,k]=km({onSelect:t,rootClientId:o,clientId:r,isAppender:l,insertionIndex:i,shouldFocusBlock:h}),[_,y,E,C]=em(b,k),[w,,S]=im(k,b),B=(0,s.useMemo)((()=>{const t=xm((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=Tm(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,g.sprintf)(
|
24 |
/* translators: %d: number of results. */
|
25 |
+
(0,g._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:Pm),N=!(0,u.isEmpty)(B)||!(0,u.isEmpty)(I);return(0,s.createElement)(tm,null,!m&&!N&&(0,s.createElement)(mm,null),!!B.length&&(0,s.createElement)(Jp,{title:(0,s.createElement)(p.VisuallyHidden,null,(0,g.__)("Blocks"))},(0,s.createElement)(Qp,{items:x,onSelect:C,onHover:n,label:(0,g.__)("Blocks"),isDraggable:f})),!!B.length&&!!I.length&&(0,s.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"}),!!I.length&&(0,s.createElement)(Jp,{title:(0,s.createElement)(p.VisuallyHidden,null,(0,g.__)("Block Patterns"))},(0,s.createElement)("div",{className:"block-editor-inserter__quick-inserter-patterns"},(0,s.createElement)(cm,{shownPatterns:T,blockPatterns:I,onClickPattern:S,isDraggable:f}))),m&&(0,s.createElement)(bm.Slot,{fillProps:{onSelect:C,onHover:n,filterValue:e,hasItems:N,rootClientId:b}},(e=>e.length?e:N?null:(0,s.createElement)(mm,null))))};const Mm={name:"blocks",
|
26 |
/* translators: Blocks tab title in the block inserter. */
|
27 |
+
title:(0,g.__)("Blocks")},Lm={name:"patterns",
|
28 |
/* translators: Patterns tab title in the block inserter. */
|
29 |
+
title:(0,g.__)("Patterns")},Am={name:"reusable",
|
30 |
/* translators: Reusable blocks tab title in the block inserter. */
|
31 |
+
title:(0,g.__)("Reusable")};var Dm=function({children:e,showPatterns:t=!1,showReusableBlocks:n=!1,onSelect:o}){const r=(0,s.useMemo)((()=>{const e=[Mm];return t&&e.push(Lm),n&&e.push(Am),e}),[Mm,t,Lm,n,Am]);return(0,s.createElement)(p.TabPanel,{className:"block-editor-inserter__tabs",tabs:r,onSelect:o},e)},Om=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,h]=(0,s.useState)(null),[v,b]=(0,s.useState)(null),[k,_,y]=km({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(Wn);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),h(e)}),[y,h]),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)(om,{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,g.__)("A tip for using the block editor")),(0,s.createElement)(Zd,null)))),[k,w,B,u,i,l]),T=(0,s.useMemo)((()=>(0,s.createElement)(dm,{rootClientId:k,onInsert:S,onClickCategory:I,selectedCategory:v})),[k,S,I,v]),N=(0,s.useMemo)((()=>(0,s.createElement)(gm,{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&&h(null),d(e)},value:u,label:(0,g.__)("Search for blocks and patterns"),placeholder:(0,g.__)("Search")}),!!u&&(0,s.createElement)(Rm,{filterValue:u,onSelect:r,onHover:B,rootClientId:e,clientId:t,isAppender:n,__experimentalInsertionIndex:o,showBlockDirectory:!0,shouldFocusBlock:c}),!u&&(E||C)&&(0,s.createElement)(Dm,{showPatterns:E,showReusableBlocks:C},P),!u&&!E&&!C&&x)),l&&f&&(0,s.createElement)(Up,{item:f}))};function Fm({onSelect:e,rootClientId:t,clientId:n,isAppender:o}){const[r,l]=(0,s.useState)(""),[i,a]=km({onSelect:e,rootClientId:t,clientId:n,isAppender:o}),[u]=em(i,a),[d]=im(a,i),f=d.length&&!!r,h=f&&d.length>6||u.length>6,{setInserterIsOpened:v,insertionIndex:b}=(0,m.useSelect)((e=>{const{getSettings:o,getBlockIndex:r,getBlockCount:l}=e(Wn),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":h,"has-expand":v})},h&&(0,s.createElement)(p.SearchControl,{className:"block-editor-inserter__search",value:r,onChange:e=>{l(e)},label:(0,g.__)("Search for blocks and patterns"),placeholder:(0,g.__)("Search")}),(0,s.createElement)("div",{className:"block-editor-inserter__quick-inserter-results"},(0,s.createElement)(Rm,{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,g.__)("Browse all. This will open the main inserter panel in the editor toolbar.")},(0,g.__)("Browse all")))}const zm=({onToggle:e,disabled:t,isOpen:n,blockTitle:o,hasSingleBlockType:r,toggleProps:l={}})=>{let a;a=r?(0,g.sprintf)(// translators: %s: the name of the block when there is only one
|
32 |
+
(0,g._x)("Add %s","directly add the only allowed block"),o):(0,g._x)("Add block","Generic label for block inserter button");const{onClick:c,...u}=l;return(0,s.createElement)(p.Button,i({icon:qd,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 Vm 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=zm}=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)(Fm,{onSelect:()=>{e()},rootClientId:t,clientId:n,isAppender:o}):(0,s.createElement)(Om,{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,g.__)("Add a block"),renderToggle:this.renderToggle,renderContent:this.renderContent,onClose:l})}}var Hm=(0,d.compose)([(0,m.withSelect)(((e,{clientId:t,rootClientId:n})=>{const{getBlockRootClientId:o,hasInserterItems:l,__experimentalGetAllowedBlocks:i,__experimentalGetDirectInsertBlock:s}=e(Wn),{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(Wn);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(Wn);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,g.sprintf)(// translators: %s: the name of the block that has been added
|
33 |
+
(0,g.__)("%s block added"),a.title);(0,Rt.speak)(p)}}))),(0,d.ifCondition)((({hasItems:e,isAppender:t,rootClientId:n,clientId:o})=>e||!t&&!n&&!o))])(Vm),Um=(0,d.compose)((0,m.withSelect)(((e,t)=>{const{getBlockCount:n,getBlockName:o,isBlockValid:l,getSettings:i,getTemplateLock:s}=e(Wn),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(Wn);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,Kd.decodeEntities)(r)||(0,g.__)("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,g.__)("Add block"),className:"wp-block block-editor-default-block-appender__content",onFocus:n},o?i:"\ufeff"),(0,s.createElement)(Hm,{rootClientId:l,position:"bottom right",isAppender:!0,__experimentalIsQuick:!0}))}));function Gm({rootClientId:e,className:t,onFocus:n,tabIndex:o},r){return(0,s.createElement)(Hm,{position:"bottom center",rootClientId:e,__experimentalIsQuick:!0,renderToggle:({onToggle:e,disabled:l,isOpen:i,blockTitle:a,hasSingleBlockType:u})=>{let d;d=u?(0,g.sprintf)(// translators: %s: the name of the block when there is only one
|
34 |
+
(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:qd}));return(m||u)&&(f=(0,s.createElement)(p.Tooltip,{text:d},f)),f},isAppender:!0})}const Wm=(0,s.forwardRef)(((e,t)=>(At()("wp.blockEditor.ButtonBlockerAppender",{alternative:"wp.blockEditor.ButtonBlockAppender"}),Gm(e,t))));var $m=(0,s.forwardRef)(Gm),jm=(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)(Um,{rootClientId:t,lastBlockClientId:(0,u.last)(e)}):(0,s.createElement)($m,{rootClientId:t,className:"block-list-appender__toggle"})}return(0,s.createElement)(a,{tabIndex:-1,className:c()("block-list-appender wp-block",l)},d)}));function Km(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 qm=(0,s.createContext)();function Ym({__unstablePopoverSlot:e,__unstableContentRef:t}){const{selectBlock:n}=(0,m.useDispatch)(Wn),o=(0,s.useContext)(qm),r=(0,s.useRef)(),{orientation:l,previousClientId:i,nextClientId:a,rootClientId:u,isInserterShown:d}=(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}}),[]),f=Ol(i),h=Ol(a),v=(0,s.useMemo)((()=>{if(!f&&!h)return{};const e=f?f.getBoundingClientRect():null,t=h?h.getBoundingClientRect():null;if("vertical"===l)return{width:f?f.offsetWidth:h.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:f?f.offsetHeight:h.offsetHeight}}),[f,h]),b=(0,s.useCallback)((()=>{if(!f&&!h)return{};const{ownerDocument:e}=f||h,t=f?f.getBoundingClientRect():null,n=h?h.getBoundingClientRect():null;return"vertical"===l?(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}}),[f,h]),k=Km(t),_=c()("block-editor-block-list__insertion-point","is-"+l),y=f&&h&&d;return(0,s.createElement)(p.Popover,{ref:k,noArrow:!0,animate:!1,getAnchorRect:b,focusOnMount:!1,className:"block-editor-block-list__insertion-point-popover",__unstableSlotName:e||null},(0,s.createElement)("div",{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()(_,{"is-with-inserter":y}),style:v},(0,s.createElement)("div",{className:"block-editor-block-list__insertion-point-indicator"}),y&&(0,s.createElement)("div",{className:c()("block-editor-block-list__insertion-point-inserter")},(0,s.createElement)(Hm,{position:"bottom center",clientId:a,rootClientId:u,__experimentalIsQuick:!0,onToggle:e=>{o.current=e},onSelectOrClose:()=>{o.current=!1}}))))}function Zm({children:e,__unstablePopoverSlot:t,__unstableContentRef:n}){const o=(0,m.useSelect)((e=>e(Wn).isBlockInsertionPointVisible()),[]);return(0,s.createElement)(qm.Provider,{value:(0,s.useRef)(!1)},o&&(0,s.createElement)(Ym,{__unstablePopoverSlot:t,__unstableContentRef:n}),e)}function Xm(){const e=(0,s.useContext)(qm),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 v=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(!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 Qm="undefined"==typeof window?e=>{setTimeout((()=>e(Date.now())),0)}:window.requestIdleCallback||window.requestAnimationFrame,Jm="undefined"==typeof window?clearTimeout:window.cancelIdleCallback||window.cancelAnimationFrame;function ef(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 tf({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=ef(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 nf=({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,_s.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:v}=(0,m.useDispatch)(Wn);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=>{h(t),u.current=!0,d(e),o&&o()},onDragOver:f,onDragEnd:()=>{v(),u.current=!1,g(),l&&l()},__experimentalDragComponent:(0,s.createElement)(jp,{count:t.length,icon:c})},(({onDraggableStart:t,onDraggableEnd:n})=>e({draggable:!0,onDragStart:t,onDragEnd:n})))},of=function({clientId:e,rootClientId:t,blockElement:n}){const o=ef(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:v,removeBlock:b}=(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:w,getClientIdsOfDescendants:S,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)(Qd,{icon:null==o?void 0:o.icon,showColors:!0})),(0,s.createElement)(p.FlexItem,null,(0,s.createElement)(nf,{clientIds:[e]},(e=>(0,s.createElement)(p.Button,i({icon:$p,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===di.UP,l=o===di.DOWN,i=o===di.LEFT,s=o===di.RIGHT,a=o===di.TAB,c=o===di.ESCAPE,u=o===di.ENTER,d=o===di.SPACE,p=t.shiftKey;if(o===di.BACKSPACE||o===di.DELETE)return b(e),void t.preventDefault();const m=B(),f=I(),g=x(f||m),h=T(f||m),v=a&&p||r,k=a&&!p||l,_=i,y=s;let L;if(v)L=g;else if(k)L=h;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&&(R(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),M(O,e,t,o),N(O),R(null)}if(k||v||_||y)if(L)t.preventDefault(),N(L);else if(a&&m){let e;k?(e=_s.focus.tabbable.findNext(n),e||(e=n.ownerDocument.defaultView.frameElement,e=_s.focus.tabbable.findNext(e))):e=_s.focus.tabbable.findPrevious(n),e&&(t.preventDefault(),e.focus(),P())}},label:y,className:"block-selection-button_select-button"},(0,s.createElement)(tf,{clientId:e})))))};function rf(e){return Array.from(e.querySelectorAll("[data-toolbar-item]"))}var lf=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=!_s.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]=_s.focus.tabbable.find(e);t&&t.focus()}(e.current)}),[]);(0,dp.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=rf(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=rf(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)},sf=(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"})),af=(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"})),cf=(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"})),uf=(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 df=(e,t)=>"up"===e?"horizontal"===t?(0,g.isRTL)()?sf:af:cf:"down"===e?"horizontal"===t?(0,g.isRTL)()?af:sf:uf:null,pf=(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,mf=(0,s.forwardRef)((({clientIds:e,direction:t,orientation:n,...o},l)=>{const a=(0,d.useInstanceId)(mf),f=(0,u.castArray)(e).length,{blockType:h,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(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),v=a(p),b=0===f,k=g===h.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)(Wn),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:df(t,E),label:pf(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,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
|
35 |
+
(0,g._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,g.sprintf)(// translators: 1: Number of selected blocks, 2: Position of selected blocks
|
36 |
+
(0,g._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,g.sprintf)(// translators: %s: Type of block (i.e. Text, Image etc)
|
37 |
+
(0,g.__)("Block %s is the only block, and cannot be moved"),t);if(l>0&&!r){const e=a("down");if("down"===e)return(0,g.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
|
38 |
+
(0,g.__)("Move %1$s block from position %2$d down to position %3$d"),t,s,s+1);if("left"===e)return(0,g.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
|
39 |
+
(0,g.__)("Move %1$s block from position %2$d left to position %3$d"),t,s,s+1);if("right"===e)return(0,g.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
|
40 |
+
(0,g.__)("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,g.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc)
|
41 |
+
(0,g.__)("Block %1$s is at the end of the content and can’t be moved down"),t);if("left"===e)return(0,g.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc)
|
42 |
+
(0,g.__)("Block %1$s is at the end of the content and can’t be moved left"),t);if("right"===e)return(0,g.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc)
|
43 |
+
(0,g.__)("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,g.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
|
44 |
+
(0,g.__)("Move %1$s block from position %2$d up to position %3$d"),t,s,s-1);if("left"===e)return(0,g.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
|
45 |
+
(0,g.__)("Move %1$s block from position %2$d left to position %3$d"),t,s,s-1);if("right"===e)return(0,g.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
|
46 |
+
(0,g.__)("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,g.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc)
|
47 |
+
(0,g.__)("Block %1$s is at the beginning of the content and can’t be moved up"),t);if("left"===e)return(0,g.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc)
|
48 |
+
(0,g.__)("Block %1$s is at the beginning of the content and can’t be moved left"),t);if("right"===e)return(0,g.sprintf)(// translators: 1: Type of block (i.e. Text, Image etc)
|
49 |
+
(0,g.__)("Block %1$s is at the beginning of the content and can’t be moved right"),t)}}(f,h&&h.title,y,k,_,"up"===t?-1:1,E)))})),ff=(0,s.forwardRef)(((e,t)=>(0,s.createElement)(mf,i({direction:"up",ref:t},e)))),gf=(0,s.forwardRef)(((e,t)=>(0,s.createElement)(mf,i({direction:"down",ref:t},e))));var hf=(0,m.withSelect)(((e,{clientIds:t})=>{var n;const{getBlock:o,getBlockIndex:l,getBlockListSettings:i,canMoveBlocks:s,getBlockOrder:a,getBlockRootClientId:c}=e(Wn),d=(0,u.castArray)(t),p=(0,u.first)(d),m=o(p),f=c((0,u.first)(d)),g=l(p,f),h=0===g,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:g,isFirst:h,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),h=()=>m(!1);if(!o||e&&t&&!l)return null;const v=(0,g.__)("Drag");return(0,s.createElement)("div",{className:c()("block-editor-block-mover",{"is-visible":d||!r,"is-horizontal":"horizontal"===a})},!u&&(0,s.createElement)(nf,{clientIds:n,cloneClassname:"block-editor-block-mover__drag-clone"},(e=>(0,s.createElement)(p.Button,i({icon:$p,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:h},(e=>(0,s.createElement)(ff,i({clientIds:n},e)))),(0,s.createElement)(p.ToolbarItem,{onFocus:f,onBlur:h},(e=>(0,s.createElement)(gf,i({clientIds:n},e))))))}));const{clearTimeout:vf,setTimeout:bf}=window;function kf({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&&vf&&vf(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=bf((()=>{(()=>{const n=(null==e?void 0:e.current)&&e.current.matches(":hover");return!t&&!n})()&&a(!1)}),n)}}}function _f({ref:e,debounceTimeout:t=200,onChange:n=u.noop}){const[o,r]=(0,s.useState)(!1),{showMovers:l,debouncedShowMovers:i,debouncedHideMovers:a}=kf({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 yf(){const{selectBlock:e,toggleBlockHighlight:t}=(0,m.useDispatch)(Wn),{firstParentClientId:n,shouldHide:o,hasReducedUI:l}=(0,m.useSelect)((e=>{const{getBlockName:t,getBlockParents:n,getSelectedBlockClientId:o,getSettings:l}=e(Wn),{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=ef(n),c=(0,s.useRef)(),{gestures:u}=_f({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,g.sprintf)(
|
50 |
/* translators: %s: Name of the block's parent. */
|
51 |
+
(0,g.__)("Select %s"),a.title),showTooltip:!0,icon:(0,s.createElement)(Qd,{icon:a.icon})}))}var Ef=(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 Cf({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,g.__)("Preview")),(0,s.createElement)(Hp,{viewportWidth:500,blocks:e})))))}var wf=({className:e,possibleBlockTransformations:t,onSelect:n,blocks:o})=>{const[l,i]=(0,s.useState)();return(0,s.createElement)(p.MenuGroup,{label:(0,g.__)("Transform to"),className:e},l&&(0,s.createElement)(Cf,{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)(Qd,{icon:o,showColors:!0}),l)})))};const Sf={};function Bf({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=>{di.ENTER!==e.keyCode&&di.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)(Hp,{viewportWidth:t,blocks:d})),(0,s.createElement)("div",{className:"block-editor-block-styles__item-label"},n.label||n.name))}var If=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(Wn),o=n(e);if(!o)return Sf;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)(Wn),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,g._x)("Default","block style"),isDefault:!0},...l],h=function(e,t){for(const n of new(Ni())(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(Ni())(e);return t&&o.remove("is-style-"+t.name),o.add("is-style-"+n.name),o.value}(c,h,r);return(0,s.createElement)(Bf,{genericPreviewBlock:p,viewportWidth:null!==(l=null===(i=a.example)||void 0===i?void 0:i.viewportWidth)&&void 0!==l?l:500,className:c,isActive:h===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 xf({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,g.__)("Styles"),className:"block-editor-block-switcher__styles__menugroup"},l&&(0,s.createElement)(Cf,{blocks: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)(If,{clientId:o,onSwitch:t,onHoverClassName:i,itemRole:"menuitem"}))}const Tf=(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=Tf(e,t,n);if(o)return o}}},Nf=(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 Pf({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,g.__)("Preview")),(0,s.createElement)(Rf,{patterns:e,onSelect:t})))))}function Rf({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,g.__)("Patterns list")}),e.map((e=>(0,s.createElement)(Mf,{key:e.name,pattern:e,onSelect:t,composite:n}))))}function Mf({pattern:e,onSelect:t,composite:n}){const o="block-editor-block-switcher__preview-patterns-container",r=(0,d.useInstanceId)(Mf,`${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)(Hp,{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 Lf=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=Tf(r,t.name,o);if(n){e=!0,o.add(n.clientId),Nf(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)(Pf,{patterns:i,onSelect:n}),(0,s.createElement)(p.MenuItem,{onClick:e=>{e.preventDefault(),l(!o)},icon:sf},(0,g.__)("Patterns"))):null};const Af=({clientIds:e,blocks:t})=>{const{replaceBlocks:n}=(0,m.useDispatch)(Wn),o=ef(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(Wn),{getBlockStyles:c,getBlockType:d}=n(r.store),{canRemoveBlocks:p}=n(Wn),m=i((0,u.castArray)(e)[0]),[{name:f}]=t,g=1===t.length,h=g&&c(f);let v;var b;g?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:Ef;return{possibleBlockTransformations:s(t,m),canRemove:p(e,m),hasBlockStyles:!(null==h||!h.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]),h=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)(Qd,{icon:c,showColors:!0})}));const _=d,y=1===t.length?(0,g.sprintf)(
|
52 |
/* translators: %s: block title. */
|
53 |
+
(0,g.__)("%s: Change block type or style"),d):(0,g.sprintf)(
|
54 |
/* translators: %d: number of blocks. */
|
55 |
+
(0,g._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)(Qd,{icon:c,className:"block-editor-block-switcher__toggle",showColors:!0}),(h||v)&&(0,s.createElement)("span",{className:"block-editor-block-switcher__toggle-text"},(0,s.createElement)(tf,{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)(Lf,{blocks:t,patterns:f,onSelect:t=>{(t=>{n(e,t)})(t),o()}}),b&&(0,s.createElement)(wf,{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)(xf,{hoveredBlock:t[0],onSwitch:o})))))))};var Df=({clientIds:e})=>{const t=(0,m.useSelect)((t=>t(Wn).getBlocksByClientId(e)),[e]);return!t.length||t.some((e=>!e))?null:(0,s.createElement)(Af,{clientIds:e,blocks:t})},Of=(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"})),Ff=window.wp.blob;function zf(){const{getBlockName:e}=(0,m.useSelect)(Wn),{getBlockType:t}=(0,m.useSelect)(r.store),{createSuccessNotice:n}=(0,m.useDispatch)(lm.store);return(0,s.useCallback)(((o,r)=>{let l="";if(1===r.length){const n=r[0],{title:i}=t(e(n));l="copy"===o?(0,g.sprintf)(// Translators: Name of the block being copied, e.g. "Paragraph".
|
56 |
+
(0,g.__)('Copied "%s" to clipboard.'),i):(0,g.sprintf)(// Translators: Name of the block being cut, e.g. "Paragraph".
|
57 |
+
(0,g.__)('Moved "%s" to clipboard.'),i)}else l="copy"===o?(0,g.sprintf)(// Translators: %d: Number of blocks being copied.
|
58 |
+
(0,g._n)("Copied %d block to clipboard.","Copied %d blocks to clipboard.",r.length),r.length):(0,g.sprintf)(// Translators: %d: Number of blocks being cut.
|
59 |
+
(0,g._n)("Moved %d block to clipboard.","Moved %d blocks to clipboard.",r.length),r.length);n(l,{type:"snackbar"})}),[])}function Vf(){const{getBlocksByClientId:e,getSelectedBlockClientIds:t,hasMultiSelection:n,getSettings:o}=(0,m.useSelect)(Wn),{flashBlock:l,removeBlocks:i,replaceBlocks:s}=(0,m.useDispatch)(Wn),a=zf();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,_s.documentHasUncollapsedSelection)(t):(0,_s.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,_s.getFilesFromDataTransfer)(e).filter((({type:e})=>/^image\/(?:jpe?g|png|gif)$/.test(e)));return o.length&&!n&&(n=o.map((e=>`<img src="${(0,Ff.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 Hf=function({children:e}){return(0,s.createElement)("div",{ref:Vf()},e)};function Uf({clientIds:e,children:t,__experimentalUpdateSelection:n}){const{canInsertBlockType:o,getBlockRootClientId:l,getBlocksByClientId:i,canRemoveBlocks:s,getTemplateLock:a}=(0,m.useSelect)((e=>e(Wn)),[]),{getDefaultBlockName:c,getGroupingBlockName:d}=(0,m.useSelect)((e=>e(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),v=s(e,f),{removeBlocks:b,replaceBlocks:k,duplicateBlocks:_,insertAfterBlock:y,insertBeforeBlock:E,flashBlock:C,setBlockMovingClientId:w,setNavigationMode:S,selectBlock:B}=(0,m.useDispatch)(Wn),I=zf();return t({canDuplicate:g,canInsertDefaultBlock:h,canRemove:v,isLocked:!!a(f),rootClientId:f,blocks:p,onDuplicate:()=>_(e,n),onRemove:()=>b(e,n),onInsertBefore(){E((0,u.first)((0,u.castArray)(e)))},onInsertAfter(){y((0,u.last)((0,u.castArray)(e)))},onMoveTo(){S(!0),B(e[0]),w(e[0])},onGroup(){if(!p.length)return;const t=d(),n=(0,r.switchToBlockType)(p,t);n&&k(e,n)},onUngroup(){if(!p.length)return;const t=p[0].innerBlocks;t.length&&k(e,t)},onCopy(){const e=p.map((({clientId:e})=>e));1===p.length&&C(e[0]),I("copy",e)}})}var Gf=(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)})),Wf=(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:$f,Slot:jf}=(0,p.createSlotFill)("__unstableBlockSettingsMenuFirstItem");$f.Slot=jf;var Kf=$f;function qf({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:Yf,Slot:Zf}=(0,p.createSlotFill)("BlockSettingsMenuControls");function Xf({...e}){return(0,s.createElement)(p.__experimentalStyleProvider,{document:document},(0,s.createElement)(Yf,e))}Xf.Slot=({fillProps:e,clientIds:t=null})=>{const n=(0,m.useSelect)((e=>{const{getBlocksByClientId:n,getSelectedBlockClientIds:o}=e(Wn),r=null!==t?t:o();return(0,u.map)((0,u.compact)(n(r)),(e=>e.name))}),[t]),o=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:l,isUngroupable:a}=o,c=l||a;return(0,s.createElement)(Zf,{fillProps:{...e,selectedBlocks:n}},(t=>{if((null==t?void 0:t.length)>0||c)return(0,s.createElement)(p.MenuGroup,null,t,(0,s.createElement)(qf,i({},o,{onClose:null==e?void 0:e.onClose})))}))};var Qf=Xf;const Jf={className:"block-editor-block-settings-menu__popover",position:"bottom right",isAlternate:!0};function eg({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 tg=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(dp.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)(Uf,{clientIds:e,__experimentalUpdateSelection:!t},(({canDuplicate:t,canInsertDefaultBlock:r,canRemove:m,onDuplicate:v,onInsertAfter:b,onInsertBefore:k,isLocked:_,onRemove:y,onCopy:E,onMoveTo:C,blocks:w})=>(0,s.createElement)(p.DropdownMenu,i({icon:Of,label:(0,g.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:Jf,noIcons:!0},o),(({onClose:o})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.MenuGroup,null,(0,s.createElement)(Kf.Slot,{fillProps:{onClose:o}}),1===l&&(0,s.createElement)(Wf,{clientId:a}),(0,s.createElement)(eg,{blocks:w,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,k),shortcut:d.insertBefore},(0,g.__)("Insert before")),(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,b),shortcut:d.insertAfter},(0,g.__)("Insert after"))),!_&&!c&&(0,s.createElement)(p.MenuItem,{onClick:(0,u.flow)(o,C)},(0,g.__)("Move to")),1===l&&(0,s.createElement)(Gf,{clientId:a,onToggle:o})),(0,s.createElement)(Qf.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,f),shortcut:d.remove},h)))))))},ng=function({clientIds:e,...t}){return(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(p.ToolbarItem,null,(n=>(0,s.createElement)(tg,i({clientIds:e,toggleProps:n},t)))))};function og({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:v,gestures:b}=_f({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||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)(yf,{clientIds:t}),(0,s.createElement)("div",i({ref:h},b),(y||E)&&(0,s.createElement)(p.ToolbarGroup,{className:"block-editor-block-toolbar__block-controls"},(0,s.createElement)(Df,{clientIds:t}),(0,s.createElement)(hf,{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)(ng,{clientIds:t}))}var rg=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)(lf,i({focusOnMount:e,className:u
|
60 |
+
/* translators: accessibility text for the block toolbar */,"aria-label":(0,g.__)("Block tools")},n),(0,s.createElement)(og,{hideDragHandle:t}))};function lg(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 ig({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:v,lastClientId:b}=(0,m.useSelect)(lg,[]),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,w]=(0,s.useState)(!1),{stopTyping:S}=(0,m.useDispatch)(Wn),B=!f&&!a&&o&&n,I=a,x=!a&&!v&&_&&!B&&!u&&(!f||g),T=!(a||x||v||o);(0,dp.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=Ol(e),R=Ol(b),M=Ol(r),L=Km(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,_s.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)(Hm,{clientId:e,rootClientId:t,__experimentalIsQuick:!0})),(x||y)&&(0,s.createElement)(rg,{focusOnMount:y,__experimentalInitialIndex:N.current,__experimentalOnIndexChange:e=>{N.current=e},key:e}),I&&(0,s.createElement)(of,{clientId:e,rootClientId:t,blockElement:A}),B&&(0,s.createElement)("div",{className:"block-editor-block-list__empty-block-inserter"},(0,s.createElement)(Hm,{position:"bottom right",rootClientId:t,clientId:e,__experimentalIsQuick:!0})))}function sg(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 ag({__unstablePopoverSlot:e,__unstableContentRef:t}){const n=(0,m.useSelect)(sg,[]);if(!n)return null;const{clientId:o,rootClientId:r,name:l,isValid:i,isEmptyDefaultBlock:a,capturingClientId:c}=n;return l?(0,s.createElement)(ig,{clientId:o,rootClientId:r,isValid:i,isEmptyDefaultBlock:a,capturingClientId:c,__unstablePopoverSlot:e,__unstableContentRef:t}):null}function cg({children:e}){const t=(0,s.useContext)(qm),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)(Zm,{__unstablePopoverSlot:"block-toolbar"},(0,s.createElement)(ag,{__unstablePopoverSlot:"block-toolbar"}),e))}var ug=(0,d.createHigherOrderComponent)((e=>t=>{const{clientId:n}=qn();return(0,s.createElement)(e,i({},t,{clientId:n}))}),"withClientId"),dg=ug((({clientId:e,showSeparator:t,isFloating:n,onAddBlock:o,isToggle:r})=>(0,s.createElement)($m,{className:c()({"block-list-appender__toggle":r}),rootClientId:e,showSeparator:t,isFloating:n,onAddBlock:o}))),pg=(0,d.compose)([ug,(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)(Um,{rootClientId:e,lastBlockClientId:t}))),mg=window.wp.isShallowEqual,fg=n.n(mg);const gg=new WeakMap;function hg(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,_s.getFilesFromDataTransfer)(e.dataTransfer),n=e.dataTransfer.getData("text/html");t.length?p(t):n?f(n):d(e)}}function vg(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 bg({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=hg(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]=vg(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 kg(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:v,__experimentalLayout:b}=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=So(null==a?void 0:a.type);t.orientation=e.getOrientation(a)}void 0!==n&&(t.__experimentalDefaultBlock=n),void 0!==o&&(t.__experimentalDirectInsert=o),fg()(u,t)||c(e,t)}),[e,u,p,n,o,r,d,l,i,c,a])}(t,n,o,l,a,p,h,b),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){gg.has(t)||gg.set(t,new WeakMap);const n=gg.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)(Es,{value:k},(0,s.createElement)(Tg,{rootClientId:t,renderAppender:g,__experimentalAppenderTagName:f,__experimentalLayout:b,wrapperRef:c,placeholder:v}))}function _g(e){return ep(e),(0,s.createElement)(kg,e)}const yg=(0,s.forwardRef)(((e,t)=>{const n=Eg({ref:t},e);return(0,s.createElement)("div",{className:"block-editor-inner-blocks"},(0,s.createElement)("div",n))}));function Eg(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,bg({rootClientId:n})]),p={__experimentalCaptureToolbars:l,...t},f=p.value&&p.onChange?_g:kg;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)(Tg,t)}}yg.DefaultBlockAppender=pg,yg.ButtonBlockAppender=dg,yg.Content=(0,r.withBlockContentContext)((({BlockContent:e})=>(0,s.createElement)(e,null)));var Cg=yg;const wg=(0,s.createContext)(),Sg=(0,s.createContext)();function Bg({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=Eg({ref:(0,d.useMergeRefs)([op(),Xm(),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)(wg.Provider,{value:n},(0,s.createElement)("div",u))}function Ig(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=Qm(o))};return t=Qm(o),()=>Jm(t)}),[e])}(),(0,s.createElement)(cg,null,(0,s.createElement)(Kn,{value:$n},(0,s.createElement)(Bg,e)))}function xg({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)(Sg.Provider,{value:a},c.map((e=>(0,s.createElement)(m.AsyncModeProvider,{key:e,value:!l.has(e)&&!u.includes(e)},(0,s.createElement)(jd,{rootClientId:t,clientId:e}))))),c.length<1&&e,(0,s.createElement)(jm,{tagName:o,rootClientId:t,renderAppender:n}))}function Tg(e){return(0,s.createElement)(m.AsyncModeProvider,{value:!1},(0,s.createElement)(xg,e))}Ig.__unstableElementContext=wg;const Ng=[];function Pg(e=[]){const t={r:[],g:[],b:[]};return e.forEach((e=>{const n=Sr(e).toRgb();t.r.push(n.r/255),t.g.push(n.g/255),t.b.push(n.b/255)})),t}function Rg({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 Mg({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")||Ng,i=fo("color.palette")||Ng,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)(ks,{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})}}))}Ir([xr]);const Lg=(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)(Mg,t))}),"withDuotoneControls"),Ag=(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)(Ig.__unstableElementContext);return(0,s.createElement)(s.Fragment,null,g&&(0,s.createPortal)((0,s.createElement)(Rg,{selector:m,id:p,values:Pg(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",Lg),(0,l.addFilter)("editor.BlockListBlock","core/editor/duotone/with-styles",Ag);const Dg="__experimentalLayout";function Og({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,Dg,{}),{allowSwitching:c,allowEditing:u=!0,allowInheriting:d=!0,default:f}=a;if(!u)return null;const h=o||f||{},{inherit:v=!1,type:b="default"}=h;if("default"===b&&!i)return null;const k=So(b),_=t=>e({layout:t});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Zo,null,(0,s.createElement)(p.PanelBody,{title:(0,g.__)("Layout")},d&&!!l&&(0,s.createElement)(p.ToggleControl,{label:(0,g.__)("Inherit default layout"),checked:!!v,onChange:()=>e({layout:{inherit:!v}})}),!v&&c&&(0,s.createElement)(Fg,{type:b,onChange:t=>e({layout:{type:t}})}),!v&&k&&(0,s.createElement)(k.inspectorControls,{layout:h,onChange:_,layoutBlockSupport:a}))),!v&&k&&(0,s.createElement)(k.toolBarControls,{layout:h,onChange:_,layoutBlockSupport:a}))}function Fg({type:e,onChange:t}){return(0,s.createElement)(p.ButtonGroup,null,wo.map((({name:n,label:o})=>(0,s.createElement)(p.Button,{key:n,isPressed:e===n,onClick:()=>t(n)},o))))}const zg=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n}=t;return[(0,r.hasBlockSupport)(n,Dg)&&(0,s.createElement)(Og,i({key:"layout"},t)),(0,s.createElement)(e,i({key:"edit"},t))]}),"withInspectorControls"),Vg=(0,d.createHigherOrderComponent)((e=>t=>{const{name:n,attributes:o}=t,l=(0,r.hasBlockSupport)(n,Dg),a=(0,d.useInstanceId)(e),u=fo("layout")||{},p=(0,s.useContext)(Ig.__unstableElementContext),{layout:m}=o,{default:f}=(0,r.getBlockSupport)(n,Dg)||{},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,Dg)&&(e.attributes={...e.attributes,layout:{type:"object"}}),e})),(0,l.addFilter)("editor.BlockListBlock","core/editor/layout/with-layout-styles",Vg),(0,l.addFilter)("editor.BlockEdit","core/editor/layout/with-inspector-controls",zg);const Hg=[];function Ug({borderColor:e,style:t}){var n;const o=(null==t?void 0:t.border)||{},r=Lr("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:ms({border:o})}}function Gg(e){const t=fo("color.palette")||Hg,n=Ug(e);if(e.borderColor){const o=Rr(t,e.borderColor);n.style.borderColor=o.color}return n}const Wg=[];function $g(e){var t,n,o,r,l,i;const{backgroundColor:s,textColor:a,gradient:u,style:d}=e,p=Lr("background-color",s),m=Lr("color",a),f=Dr(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:ms({color:(null==d?void 0:d.color)||{}})}}function jg(e){const{backgroundColor:t,textColor:n,gradient:o}=e,r=fo("color.palette")||Wg,l=fo("color.gradients")||Wg,i=$g(e);if(t){const e=Rr(r,t);i.style.backgroundColor=e.color}if(o&&(i.style.background=Or(l,o)),n){const e=Rr(r,n);i.style.color=e.color}return i}function Kg(e){const{style:t}=e;return{style:ms({spacing:(null==t?void 0:t.spacing)||{}})}}const qg=[];function Yg(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=Sr(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=Mr(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=Rr(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:Lr(r,i.slug)},n}),{})}render(){return(0,s.createElement)(e,i({},this.props,{colors:void 0},this.state,this.setters,{colorUtils:this.colorUtils}))}}])}function Zg(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)(Yg(t,n),"withCustomColors")}}function Xg(...e){const t=(0,d.createHigherOrderComponent)((e=>t=>{const n=fo("color.palette")||qg;return(0,s.createElement)(e,i({},t,{colors:n}))}),"withEditorColorPalette");return(0,d.createHigherOrderComponent)(Yg(e,t),"withColors")}const Qg=[];var Jg=(...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")||Qg;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=Pi(n,l,e[o]);return t[r]={...i,class:Mi(l)},t}),{});return{...o,...l}}render(){return(0,s.createElement)(e,i({},this.props,{fontSizes:void 0},this.state,this.setters))}}]),"withFontSizes")},eh=(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"})),th=(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"})),nh=(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 oh=[{icon:eh,title:(0,g.__)("Align text left"),align:"left"},{icon:th,title:(0,g.__)("Align text center"),align:"center"},{icon:nh,title:(0,g.__)("Align text right"),align:"right"}],rh={position:"bottom right",isAlternate:!0};var lh=function({value:e,onChange:t,alignmentControls:n=oh,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)()?nh:eh,label:o,toggleProps:{describedBy:r,className:d?"is-pressed":void 0},popoverProps:rh,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 ih(e){return(0,s.createElement)(lh,i({},e,{isToolbar:!1}))}function sh(e){return(0,s.createElement)(lh,i({},e,{isToolbar:!0}))}var ah={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]=em(t,u.noop),i=(0,s.useMemo)((()=>(e.trim()?xm(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)(Qd,{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 ch=[];function uh({completers:e=ch}){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([ah])),(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 dh=function(e){return(0,s.createElement)(p.Autocomplete,i({},e,{completers:uh(e)}))},ph=(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"})),mh=function({isActive:e,label:t=(0,g.__)("Toggle full height"),onToggle:n,isDisabled:o}){return(0,s.createElement)(p.ToolbarButton,{isActive:e,icon:ph,label:t,onClick:()=>n(!e),disabled:o})},fh=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!==di.DOWN||(t.preventDefault(),e())},label:t,icon:l,showTooltip:!0,disabled:r}),renderContent:()=>(0,s.createElement)(p.__experimentalAlignmentMatrixControl,{hasFocusBorder:!1,onChange:n,value:o})})},gh=(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"})),hh=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:gh,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)(tf,{clientId:e})),(0,s.createElement)(Co,{icon:gh,className:"block-editor-block-breadcrumb__separator"})))),!!o&&(0,s.createElement)("li",{className:"block-editor-block-breadcrumb__current","aria-current":"true"},(0,s.createElement)(tf,{clientId:o})))};function vh({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 bh=()=>(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"})),kh=({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)(bh,null))),_h=({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!==di.DOWN||(e.preventDefault(),n())},icon:(0,s.createElement)(t,null,(0,s.createElement)(e,null,(0,s.createElement)(kh,null)))}));var yh=({children:e,...t})=>(0,s.createElement)(p.Dropdown,{position:"bottom right",className:"block-library-colors-selector",contentClassName:"block-library-colors-selector__popover",renderToggle:_h(t),renderContent:()=>e}),Eh=(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 Ch=bd(p.__experimentalTreeGridRow);function wh({isSelected:e,position:t,level:n,rowCount:o,children:r,className:l,path:a,...u}){const d=yd({isSelected:e,adjustScrolling:!1,enableAnimation:!0,triggerAnimationOnChange:a.join("_")});return(0,s.createElement)(Ch,i({ref:d,className:c()("block-editor-list-view-leaf",l),level:n,positionInSet:t,setSize:o},u),r)}const Sh=(0,s.createContext)({__experimentalFeatures:!1,__experimentalPersistentListViewFeatures:!1}),Bh=()=>(0,s.useContext)(Sh),Ih=(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),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:gh}))}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:v,draggable:b},k){const _=ef(n),y=`list-view-block-select-button__${(0,d.useInstanceId)(e)}`,E=Ih(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:v,draggable:b},(0,s.createElement)(Th,{onClick:l}),(0,s.createElement)(Qd,{icon:null==_?void 0:_.icon,showColors:!0}),(0,s.createElement)(tf,{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))}));const Ph=e=>`ListViewBlock-${e}`;var Rh=(0,s.forwardRef)((function e(t,n){const{clientId:o}=t.block,{name:l}=(0,m.useSelect)((e=>e(Wn).getBlockName(o)),[o]),a=(0,d.useInstanceId)(e);return(0,s.createElement)(p.Slot,{name:Ph(o)},(e=>{if(!e.length)return(0,s.createElement)(Nh,i({ref:n},t));const{className:o,isSelected:u,position:d,siblingBlockCount:m,level:f,tabIndex:h,onFocus:v,onToggleExpanded:b}=t,k=(0,r.getBlockType)(l),_=`list-view-block-slot__${a}`,y=Ih(d,m,f),E={tabIndex:h,onFocus:v,ref:n,"aria-describedby":_};return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:c()("block-editor-list-view-block-slot",o)},(0,s.createElement)(Th,{onClick:b}),(0,s.createElement)(Qd,{icon:k.icon,showColors:!0}),s.Children.map(e,(e=>(0,s.cloneElement)(e,{...e.props,...E}))),u&&(0,s.createElement)(p.VisuallyHidden,null,(0,g.__)("(selected block)")),(0,s.createElement)("div",{className:"block-editor-list-view-block-slot__description",id:_},y)))}))}));const Mh=e=>{const{clientId:t}=(0,s.useContext)(Ud);return(0,s.createElement)(p.Fill,i({},e,{name:Ph(t)}))};var Lh=(0,s.forwardRef)((({onClick:e,onToggleExpanded:t,block:n,isSelected:o,position:r,siblingBlockCount:l,level:a,...u},d)=>{const{__experimentalFeatures:p}=Bh(),{clientId:f}=n,{blockMovingClientId:g,selectedBlockInBlockEditor:h}=(0,m.useSelect)((e=>{const{getBlockRootClientId:t,hasBlockMovingClientId:n,getSelectedBlockClientId:o}=e(Wn);return{rootClientId:t(f)||"",blockMovingClientId:n(),selectedBlockInBlockEditor:o()}}),[f]),v=g&&h===f,b=c()("block-editor-list-view-block-contents",{"is-dropping-before":v});return(0,s.createElement)(nf,{clientIds:[n.clientId]},(({draggable:c,onDragStart:m,onDragEnd:f})=>p?(0,s.createElement)(Rh,i({ref:d,className:b,block:n,onToggleExpanded:t,isSelected:o,position:r,siblingBlockCount:l,level:a,draggable:c&&p,onDragStart:m,onDragEnd:f},u)):(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:m,onDragEnd:f},u))))}));function Ah({block:e,isSelected:t,isDragged:n,isBranchSelected:o,isLastOfSelectedBranch:r,onClick:l,onToggleExpanded:i,position:a,level:u,rowCount:d,siblingBlockCount:f,showBlockMovers:h,path:v,isExpanded:b}){const k=(0,s.useRef)(null),[_,y]=(0,s.useState)(!1),{clientId:E}=e,C=(0,m.useSelect)((e=>e(Wn).getBlockParents(E)),[E]),{selectBlock:w,toggleBlockHighlight:S}=(0,m.useDispatch)(Wn),B=h&&f>0,I=c()("block-editor-list-view-block__mover-cell",{"is-visible":_}),{__experimentalFeatures:x,__experimentalPersistentListViewFeatures:T,isTreeGridMounted:N}=Bh(),P=c()("block-editor-list-view-block__menu-cell",{"is-visible":_});(0,s.useEffect)((()=>{T&&!N&&t&&k.current.focus()}),[]),(0,s.useEffect)((()=>{x&&t&&k.current.focus()}),[x,t]);const R=T?S:()=>{},M=()=>{y(!0),R(E,!0)},L=()=>{y(!1),R(E,!1)},A=c()({"is-selected":t,"is-branch-selected":T&&o,"is-last-of-selected-branch":T&&r,"is-dragging":n});return(0,s.createElement)(wh,{className:A,onMouseEnter:M,onMouseLeave:L,onFocus:M,onBlur:L,level:u,position:a,rowCount:d,path:v,id:`list-view-block-${E}`,"data-block":E,isExpanded:b},(0,s.createElement)(p.__experimentalTreeGridCell,{className:"block-editor-list-view-block__contents-cell",colSpan:B?void 0:2,ref:k},(({ref:n,tabIndex:o,onFocus:r})=>(0,s.createElement)("div",{className:"block-editor-list-view-block__contents-container"},(0,s.createElement)(Lh,{block:e,onClick:l,onToggleExpanded:i,isSelected:t,position:a,siblingBlockCount:f,level:u,ref:n,tabIndex:o,onFocus:r})))),B&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.__experimentalTreeGridCell,{className:I,withoutGridItem:!0},(0,s.createElement)(p.__experimentalTreeGridItem,null,(({ref:e,tabIndex:t,onFocus:n})=>(0,s.createElement)(ff,{orientation:"vertical",clientIds:[E],ref:e,tabIndex:t,onFocus:n}))),(0,s.createElement)(p.__experimentalTreeGridItem,null,(({ref:e,tabIndex:t,onFocus:n})=>(0,s.createElement)(gf,{orientation:"vertical",clientIds:[E],ref:e,tabIndex:t,onFocus:n}))))),x&&(0,s.createElement)(p.__experimentalTreeGridCell,{className:P},(({ref:e,tabIndex:t,onFocus:n})=>(0,s.createElement)(tg,{clientIds:[E],icon:Of,toggleProps:{ref:e,tabIndex:t,onFocus:n},disableOpenOnArrowDown:!0,__experimentalSelectBlock:l},(({onClose:e})=>(0,s.createElement)(p.MenuGroup,null,(0,s.createElement)(p.MenuItem,{onClick:async()=>{if(C.length)for(const e of C)await w(e);else await w(null);await w(E),e()}},(0,g.__)("Go to block"))))))))}function Dh({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)(Dh)}`,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)(wh,{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)(Hm,{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 Oh(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:v,draggedClientIds:b,selectedClientIds:k}=Bh(),_=!i,y=(0,u.compact)(t),E=e=>o&&!_&&xh(e,k),C=E(i),w=y.length,S=C?w+1:w,B=S;return(0,s.createElement)(s.Fragment,null,(0,u.map)(y,((e,t)=>{var i;const{clientId:u,innerBlocks:_}=e,y=t+1,C=S===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===w-1,M=N||f&&R,L=f&&!T&&R,A=T?null===(i=g[u])||void 0===i||i:void 0,D=!(null==b||!b.includes(u));return(0,s.createElement)(m.AsyncModeProvider,{key:u,value:!N},(0,s.createElement)(Ah,{block:e,onClick:e=>{e.stopPropagation(),n(u)},onToggleExpanded:e=>{e.stopPropagation(),!0===A?v(u):!1===A&&h(u)},isDragged:D,isSelected:N,isBranchSelected:P,isLastOfSelectedBranch:L,level:a,position:y,rowCount:S,siblingBlockCount:w,showBlockMovers:r,terminatedLevels:c,path:B,isExpanded:A}),T&&A&&!D&&(0,s.createElement)(Oh,{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)(Dh,{parentBlockClientId:i,position:S,rowCount:B,level:a,terminatedLevels:c,path:[...d,B]}))}function Fh({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 zh(e,t){return t.left<=e.x&&t.right>=e.x&&t.top<=e.y&&t.bottom>=e.y}Oh.defaultProps={selectBlock:()=>{}};const Vh=["top","bottom"];const Hh=()=>{},Uh=(e,t)=>{switch(t.type){case"expand":return{...e,[t.clientId]:!0};case"collapse":return{...e,[t.clientId]:!1};default:return e}};var Gh=(0,s.forwardRef)((function({blocks:e,showOnlyCurrentHierarchy:t,onSelect:n=Hh,__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),v=(0,s.useCallback)((e=>{h(e),n(e)}),[h,n]),[b,k]=(0,s.useReducer)(Uh,{}),{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=hg(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]=vg(t,s,Vh),u=zh(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]),w=(0,s.useRef)(!1);(0,s.useEffect)((()=>{w.current=!0}),[]);const S=(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:w.current,draggedClientIds:f,selectedClientIds:u,expandedState:b,expand:S,collapse:B})),[o,r,w.current,f,u,b,S,B]);return(0,s.createElement)(m.AsyncModeProvider,{value:!0},(0,s.createElement)(Fh,{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;S(null==e||null===(t=e.dataset)||void 0===t?void 0:t.block)}},(0,s.createElement)(Sh.Provider,{value:I},(0,s.createElement)(Oh,i({blocks:c,selectBlock:v},l)))))}));function Wh({isEnabled:e,onToggle:t,isOpen:n,innerRef:o,...r}){return(0,s.createElement)(p.Button,i({},r,{ref:o,icon:Eh,"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 $h=(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)(Wh,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)(Gh,{showNestedBlocks:!0,showOnlyCurrentHierarchy:!0,__experimentalFeatures:t}))})})),jh=(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"})),Kh=function({icon:e=jh,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"))))},qh=(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 Yh="carousel",Zh="grid",Xh=({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"))),Qh=({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:af,label:(0,g.__)("Previous pattern"),onClick:e,disabled:0===n}),(0,s.createElement)(p.Button,{icon:sf,label:(0,g.__)("Next pattern"),onClick:t,disabled:n===o-1}));var Jh=({viewMode:e,setViewMode:t,handlePrevious:n,handleNext:o,activeSlide:r,totalSlides:l,onBlockPatternSelect:i,onStartBlank:a})=>{const c=e===Yh,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(Yh),isPressed:c}),(0,s.createElement)(p.Button,{icon:qh,label:(0,g.__)("Grid view"),onClick:()=>t(Zh),isPressed:e===Zh}));return(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__toolbar"},c&&(0,s.createElement)(Qh,{handlePrevious:n,handleNext:o,activeSlide:r,totalSlides:l}),u,c&&(0,s.createElement)(Xh,{onBlockPatternSelect:i,onStartBlank:a}))};const ev=({viewMode:e,activeSlide:t,patterns:n,onBlockPatternSelect:o})=>{const r=(0,p.__unstableUseCompositeState)(),l="block-editor-block-pattern-setup__container";if(e===Yh){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)(nv,{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)(tv,{key:e.name,pattern:e,onSelect:o,composite:r}))))};function tv({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)(tv,`${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)(Hp,{blocks:r,viewportWidth:c}),(0,s.createElement)("div",{className:`${o}__item-title`},l)),!!a&&(0,s.createElement)(p.VisuallyHidden,{id:u},a))}function nv({className:e,pattern:t}){const{blocks:n,title:o,description:r}=t,l=(0,d.useInstanceId)(nv,"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)(Hp,{blocks:n,__experimentalLive:!0}),!!r&&(0,s.createElement)(p.VisuallyHidden,{id:l},r))}var ov=({clientId:e,blockName:t,filterPatternsFn:n,startBlankComponent:o,onBlockPatternSelect:l})=>{const[i,a]=(0,s.useState)(Yh),[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)(Jh,{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)(ev,{viewMode:i,activeSlide:c,patterns:g,onBlockPatternSelect:h}))};const rv=(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 lv=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=rv(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:uf,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 iv=(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"})),sv=(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"})),av={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:sv,title:(0,g._x)("Align middle","Block vertical alignment setting")},bottom:{icon:iv,title:(0,g._x)("Align bottom","Block vertical alignment setting")}},cv=["top","center","bottom"],uv={isAlternate:!0};var dv=function({value:e,onChange:t,controls:n=cv,isCollapsed:o=!0,isToolbar:r}){const l=av[e],a=av.top,c=r?p.ToolbarGroup:p.ToolbarDropdownMenu,u=r?{isCollapsed:o}:{};return(0,s.createElement)(c,i({popoverProps:uv,icon:l?l.icon:a.icon,label:(0,g._x)("Change vertical alignment","Block vertical alignment setting label"),controls:n.map((n=>{return{...av[n],isActive:e===n,role:o?"menuitemradio":void 0,onClick:(r=n,()=>t(e===r?void 0:r))};var r}))},u))};function pv(e){return(0,s.createElement)(dv,i({},e,{isToolbar:!1}))}function mv(e){return(0,s.createElement)(dv,i({},e,{isToolbar:!0}))}var fv=(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"),gv=fv(p.ColorPalette);function hv({onChange:e,value:t,...n}){return(0,s.createElement)(Kr,i({},n,{onColorChange:e,colorValue:t,gradients:[],disableCustomGradients:!0}))}var vv=function(e,t){return(vv=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)},bv=function(){return(bv=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 kv(e,t,n,o){void 0===o&&(o=0);var r=Nv(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 _v(e,t,n,o,r){void 0===r&&(r=0);var l=Nv(t.width,t.height,r),i=l.width,s=l.height;return{x:yv(e.x,i,n.width,o),y:yv(e.y,s,n.height,o)}}function yv(e,t,n,o){var r=t*o/2-n/2;return Math.min(r,Math.max(e,-r))}function Ev(e,t){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function Cv(e,t){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI}function wv(e,t,n,o,r,l,i){void 0===l&&(l=0),void 0===i&&(i=!0);var s=i&&0===l?Sv:Bv,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:bv(bv({},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 Sv(e,t){return Math.min(e,Math.max(0,t))}function Bv(e,t){return t}function Iv(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 xv(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function Tv(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 Nv(e,t,n){var o=e/2,r=t/2,l=[Tv(0,0,o,r,n),Tv(e,0,o,r,n),Tv(e,t,o,r,n),Tv(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 Pv(){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 Rv=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=Iv(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:kv(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=bv({},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?_v(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?_v(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=wv(n.props.restrictPosition?_v(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?_v(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}vv(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=Ev(n,o),this.lastPinchRotation=Cv(n,o),this.onDragStart(xv(n,o))},t.prototype.onPinchMove=function(e){var n=this,o=t.getTouchPoint(e.touches[0]),r=t.getTouchPoint(e.touches[1]),l=xv(o,r);this.onDrag(l),this.rafPinchTimeout&&window.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=window.requestAnimationFrame((function(){var e=Ev(o,r),t=n.props.zoom*(e/n.lastPinchDistance);n.setNewZoom(t,l),n.lastPinchDistance=e;var i=Cv(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,v=h.containerClassName,b=h.cropAreaClassName,k=h.mediaClassName;return la().createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(t){return e.containerRef=t},"data-testid":"container",style:m,className:Pv("reactEasyCrop_Container",v)},n?la().createElement("img",bv({alt:"",className:Pv("reactEasyCrop_Image",k)},r,{src:n,ref:function(t){return e.imageRef=t},style:bv(bv({},g),{transform:"translate("+i+"px, "+s+"px) rotate("+a+"deg) scale("+c+")"}),onLoad:this.onMediaLoad})):o&&la().createElement("video",bv({autoPlay:!0,loop:!0,muted:!0,className:Pv("reactEasyCrop_Video",k)},r,{src:o,ref:function(t){return e.videoRef=t},onLoadedMetadata:this.onMediaLoad,style:bv(bv({},g),{transform:"translate("+i+"px, "+s+"px) rotate("+a+"deg) scale("+c+")"}),controls:!1})),this.state.cropSize&&la().createElement("div",{style:bv(bv({},f),{width:this.state.cropSize.width,height:this.state.cropSize.height}),"data-testid":"cropper",className:Pv("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}(la().Component);const Mv={position:"bottom right",isAlternate:!0};var Lv=window.wp.apiFetch,Av=n.n(Lv);const Dv=(0,s.createContext)({}),Ov=()=>(0,s.useContext)(Dv);function Fv({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)(),[v,b]=(0,s.useState)(),k=(0,s.useCallback)((()=>{u({x:0,y:0}),p(100),f(0),h(t/n),b(t/n)}),[t,n,u,p,f,h,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),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:v,initializeTransformValues:k})),[o,r,i,a,c,u,d,p,m,f,_,g,h,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)(lm.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,Av()({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)(Dv.Provider,{value:p},c)}function zv({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:v}=Ov();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)(Rv,{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 Vv=(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 Hv(){const{isInProgress:e,zoom:t,setZoom:n}=Ov();return(0,s.createElement)(p.Dropdown,{contentClassName:"wp-block-image__zoom",popoverProps:Mv,renderToggle:({isOpen:t,onToggle:n})=>(0,s.createElement)(p.ToolbarButton,{icon:Vv,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 Uv=(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"})),Gv=(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 Wv({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?Uv:void 0},e))))}function $v({toggleProps:e}){const{isInProgress:t,aspect:n,setAspect:o,defaultAspect:r}=Ov();return(0,s.createElement)(p.DropdownMenu,{icon:Gv,label:(0,g.__)("Aspect Ratio"),popoverProps:Mv,toggleProps:e,className:"wp-block-image__aspect-ratio"},(({onClose:e})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Wv,{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)(Wv,{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)(Wv,{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 jv=(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 Kv(){const{isInProgress:e,rotateClockwise:t}=Ov();return(0,s.createElement)(p.ToolbarButton,{icon:jv,label:(0,g.__)("Rotate"),onClick:t,disabled:e})}function qv(){const{isInProgress:e,apply:t,cancel:n}=Ov();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 Yv({url:e,width:t,height:n,clientWidth:o,naturalHeight:r,naturalWidth:l}){return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(zv,{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)(Hv,null),(0,s.createElement)(p.ToolbarItem,null,(e=>(0,s.createElement)($v,{toggleProps:e}))),(0,s.createElement)(Kv,null)),(0,s.createElement)(p.ToolbarGroup,null,(0,s.createElement)(qv,null))))}const Zv=[25,50,75,100];function Xv({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")},Zv.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 Qv=(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"})),Jv=({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 eb 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,Dd()(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,pm.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,g._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,g.__)("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 di.UP:0!==e.target.selectionStart&&(e.preventDefault(),e.target.setSelectionRange(0,0));break;case di.DOWN:this.props.value.length!==e.target.selectionStart&&(e.preventDefault(),e.target.setSelectionRange(this.props.value.length,this.props.value.length));break;case di.ENTER:this.props.onSubmit&&this.props.onSubmit(null,e)}return}const l=this.state.suggestions[this.state.selectedSuggestion];switch(e.keyCode){case di.UP:{e.preventDefault();const t=n?n-1:o.length-1;this.setState({selectedSuggestion:t});break}case di.DOWN:{e.preventDefault();const t=null===n||n===o.length-1?0:n+1;this.setState({selectedSuggestion:t});break}case di.TAB:null!==this.state.selectedSuggestion&&(this.selectLink(l),this.props.speak((0,g.__)("Link selected.")));break;case di.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,g.__)("Paste URL or type to search"),__experimentalRenderControl:l,value:i=""}=this.props,{loading:a,showSuggestions:u,selectedSuggestion:d,suggestionsListboxId:m,suggestionOptionIdPrefix:f}=this.state,h={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,g.__)("URL"),"aria-expanded":u,"aria-autocomplete":"list","aria-owns":m,"aria-activedescendant":null!==d?`${f}-${d}`:void 0,ref:this.inputRef};return l?l(h,v,a):(0,s.createElement)(p.BaseControl,h,(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,g={id:d,ref:this.autocompleteRef,role:"listbox"},h=(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:g,buildSuggestionItemProps:h,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({},g,{className:c()("block-editor-url-input__suggestions",`${e}__suggestions`)}),l.map(((e,t)=>(0,s.createElement)(p.Button,i({},h(0,t),{key:e.id,className:c()("block-editor-url-input__suggestion",{"is-selected":t===a}),onClick:()=>this.handleOnClick(e)}),e.title))))):null}}var tb=(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(Wn);return{__experimentalFetchLinkSuggestions:n().__experimentalFetchLinkSuggestions}})))(eb),nb=({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,g.sprintf)(
|
70 |
/* translators: %s: search term. */
|
71 |
+
(0,g.__)("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)(Co,{className:"block-editor-link-control__search-item-icon",icon:qd}),(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)))},ob=(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"})),rb=({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)(Co,{className:"block-editor-link-control__search-item-icon",icon:ob}),(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,pm.filterURLForDisplay)((0,pm.safeDecodeURI)(t.url))||""),r&&(0,g.__)("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 lb="__CREATE__",ib=[{id:"opensInNewTab",title:(0,g.__)("Open in new tab")}];function sb({instanceId:e,withCreateSuggestion:t,currentInputValue:n,handleSuggestionClick:o,suggestionsListProps:r,buildSuggestionItemProps:l,suggestions:a,selectedSuggestion:u,isLoading:d,isInitialSuggestions:m,createSuggestionButtonText:f,suggestionsQuery:h}){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!=h&&h.type),E=`block-editor-link-control-search-results-label-${e}`,C=m?(0,g.__)("Recently updated"):(0,g.sprintf)(
|
72 |
/* translators: %s: search term. */
|
73 |
+
(0,g.__)('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)=>_&&lb===e.type?(0,s.createElement)(nb,{searchTerm:n,buttonText:f,onClick:()=>o(e),key:e.type,itemProps:l(e,t),isSelected:t===u}):lb===e.type?null:(0,s.createElement)(rb,{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 ab(e){const t=(0,u.startsWith)(e,"#");return(0,pm.isURL)(e)||e&&e.includes("www.")||t}const cb=()=>Promise.resolve([]),ub=e=>{let t="URL";const n=(0,pm.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,pm.prependHTTP)(e):e,type:t}])};const db=()=>Promise.resolve([]),pb=(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)(sb,e)),fetchSuggestions:h=null,allowDirectEntry:v=!0,showInitialSuggestions:b=!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?ub:cb;return(0,s.useCallback)(((t,{isInitialSuggestions:i})=>ab(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||ab(e)||!r?s:s.concat({title:e,url:e,type:lb})})(t,{...e,isInitialSuggestions:i},r,l,n,o)),[l,r,n])}(k,v,l,_),w=p?h||C:db,S=(0,d.useInstanceId)(pb),[B,I]=(0,s.useState)(),x=async e=>{let t=e;if(lb!==e.type)(v||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)(tb,{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:S,withCreateSuggestion:l,currentInputValue:e,createSuggestionButtonText:y,suggestionsQuery:k,handleSuggestionClick:e=>{t.handleSuggestionClick&&t.handleSuggestionClick(e),x(e)}}):null,__experimentalFetchLinkSuggestions:w,__experimentalHandleURLSuggestions:!0,__experimentalShowInitialSuggestions:b,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 mb=pb,fb=(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:gb,Fill:hb}=(0,p.createSlotFill)("BlockEditorLinkControlViewer");function vb(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 bb({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)(vb,{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,pm.filterURLForDisplay)((0,pm.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:fb,size:32}):(0,s.createElement)(Co,{icon:ob}),(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)(gb,{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 kb({searchInputPlaceholder:e,value:t,settings:n=ib,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:v=!1,createSuggestionButtonText:b,hasRichPreviews:k=!1}){var _;void 0===m&&d&&(m=!0);const y=(0,s.useRef)(!0),E=(0,s.useRef)(),[C,w]=(0,s.useState)(t&&t.url||""),S=f||C,[B,I]=(0,s.useState)(void 0!==c?c:!t||!t.url),x=(0,s.useRef)(!1),T=!(null!=S&&null!==(_=S.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:((_s.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=()=>{S!==(null==t?void 0:t.url)&&o({url:S}),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)(mb,{currentLink:t,className:"block-editor-link-control__search-input",placeholder:e,value:S,withCreateSuggestion:m,onCreateSuggestion:P,onChange:w,onSelect:e=>{o(e),N()},showInitialSuggestions:a,allowDirectEntry:!l,showSuggestions:i,suggestionsQuery:h,withURLSuggestion:!v,createSuggestionButtonText:b},(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!==di.ENTER||T||(e.preventDefault(),L())},label:(0,g.__)("Submit"),icon:Qv,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)(bb,{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)(Jv,{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"))))}kb.ViewerFill=hb;var _b=kb;const yb={position:"bottom right",isAlternate:!0};var Eb=()=>(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:uf
|
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:yb})))}))),Cb=({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)(Eb,null)))):(0,s.createElement)(eo,{group:"inline"},(0,s.createElement)(Eb,null));function wb(){const{didAutomaticChange:e,getSettings:t}=(0,m.useSelect)(Wn);return(0,d.useRefEffect)((n=>{function o(n){const{keyCode:o}=n;n.defaultPrevented||o!==di.DELETE&&o!==di.BACKSPACE&&o!==di.ESCAPE||e()&&(n.preventDefault(),t().__experimentalUndo())}return n.addEventListener("keydown",o),()=>{n.removeEventListener("keydown",o)}}),[])}function Sb(e){return e.filter((({type:e})=>/^image\/(?:jpe?g|png|gif)$/.test(e))).map((e=>`<img src="${(0,Ff.createBlobURL)(e)}">`)).join("")}var Bb=window.wp.shortcode;function Ib(e,t){if(null!=t&&t.length){let n=e.formats.length;for(;n--;)e.formats[n]=[...t,...e.formats[n]||[]]}}function xb(e){if(!0===e||"p"===e||"li"===e)return!0===e?"p":e}function Tb({allowedFormats:e,formattingControls:t,disableFormats:n}){return n?Tb.EMPTY_ARRAY:e||t?e||(At()("wp.blockEditor.RichText formattingControls prop",{since:"5.4",alternative:"allowedFormats"}),t.map((e=>`core/${e}`))):void 0}function Nb({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 Pb(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 Rb(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 v="",b="";try{v=h.getData("text/plain"),b=h.getData("text/html")}catch(e){try{b=h.getData("Text")}catch(e){return}}if(b=function(e){return e.replace(/.*<!--StartFragment-->/s,"").replace(/<!--EndFragment-->.*/s,"")}(b),e.preventDefault(),window.console.log("Received HTML:\n\n",b),window.console.log("Received plain text:\n\n",v),o)return void l((0,Mt.insert)(i,v));const k=s.reduce(((e,{__unstablePasteRule:t})=>(t&&e===i&&(e=t(i,{html:b,plainText:v})),e)),i);if(k!==i)return void l(k);const _=[...(0,_s.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:b,multilineTag:e,multilineWrapperTags:"li"===e?["ul","ol"]:void 0,preserveWhiteSpace:f});return t=Pb(t,!!m),Ib(t,i.activeFormats),void l((0,Mt.insert)(i,t))}if(g)return void l((0,Mt.insert)(i,(0,Mt.create)({text:v})));if(_&&_.length&&!b){const e=(0,r.pasteHandler)({HTML:Sb(_),mode:"BLOCKS",tagName:a,preserveWhiteSpace:f});return window.console.log("Received items:\n\n",_),void(c&&(0,Mt.isEmpty)(i)?c(e):Nb({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=v,(0,Bb.regexp)(".*").test(E))&&(y="BLOCKS"),p&&(0,Mt.isEmpty)(i)&&(0,pm.isURL)(v.trim())&&(y="BLOCKS");const C=(0,r.pasteHandler)({HTML:b,plainText:v,mode:y,tagName:a,preserveWhiteSpace:f});if("string"==typeof C){let e=(0,Mt.create)({html:C});e=Pb(e,!!m),Ib(e,i.activeFormats),l((0,Mt.insert)(i,e))}else C.length>0&&(c&&(0,Mt.isEmpty)(i)?c(C,C.length-1,-1):Nb({value:i,pastedBlocks:C,onReplace:c,onSplit:u,onSplitMiddle:d,multilineTag:m}))}return e.addEventListener("paste",n),()=>{e.removeEventListener("paste",n)}}),[])}function Mb(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 Lb(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!==di.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)?Nb({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&&Nb({value:m,onReplace:i,onSplit:s,onSplitMiddle:a,multilineTag:c})}}return e.addEventListener("keydown",o),()=>{e.removeEventListener("keydown",o)}}),[])}function Ab(e){return e(Mt.store).getFormatTypes()}Tb.EMPTY_ARRAY=[];const Db=new Set(["a","audio","button","details","embed","iframe","input","label","select","textarea","video"]);function Ob(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 Fb(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 zb({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 Vb=(0,s.createContext)(),Hb=(0,s.createContext)(),Ub=(0,s.forwardRef)((function e({children:t,tagName:n="div",value:o="",onChange:l,isSelected:a,multiline:f,inlineToolbar:g,wrapperClassName:h,autocompleters:v,onReplace:b,placeholder:k,allowedFormats:_,formattingControls:y,withoutInteractiveFormatting:E,onRemove:C,onMerge:w,onSplit:S,__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=xb(f),K=Tb({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)(Ab,[]),l=(0,s.useMemo)((()=>r.filter((({name:e,tagName:t})=>!(o&&!o.includes(e)||n&&Db.has(t))))),[r,o,Db]),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:uh(e)})}({onReplace:b,completers:v,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)(Vb.Provider,{value:ae},(0,s.createElement)(Hb.Provider,{value:ce},t&&t({value:re,onChange:le,onFocus:ue}),(0,s.createElement)(zb,{value:re,onChange:le,onFocus:ue,formatTypes:Q,forwardedRef:z}))),G&&q&&(0,s.createElement)(Cb,{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,Mb({value:re,onChange:le,__unstableAllowPrefixTransformations:A,formatTypes:Q,onReplace:b}),(0,d.useRefEffect)((e=>{function t(e){(di.isKeyboardEvent.primary(e,"z")||di.isKeyboardEvent.primary(e,"y")||di.isKeyboardEvent.primaryShift(e,"z"))&&e.preventDefault()}return e.addEventListener("keydown",t),()=>{e.addEventListener("keydown",t)}}),[]),Ob(ae),Fb(ce),wb(),Rb({isSelected:G,disableFormats:R,onChange:le,value:re,formatTypes:Q,tagName:n,onReplace:b,onSplit:S,onSplitMiddle:I,__unstableEmbedURLOnPaste:P,multilineTag:j,preserveWhiteSpace:T,pastePlainText:N}),Lb({removeEditorOnlyFormats:oe,value:re,onReplace:b,onSplit:S,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===di.DELETE||t===di.BACKSPACE)){const{start:n,end:o,text:r}=re,l=t===di.BACKSPACE,i=re.activeFormats&&!!re.activeFormats.length;if(!(0,Mt.isCollapsed)(re)||i||l&&0!==n||!l&&o!==r.length)return;w&&w(!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)}));Ub.Content=({value:e,tagName:t,multiline:n,...o})=>{Array.isArray(e)&&(e=r.children.toHTML(e));const l=xb(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},Ub.isEmpty=e=>!e||0===e.length;var Gb=Ub;function Wb({value:e,onChange:t}){return(0,s.createElement)(Mh,null,(0,s.createElement)(Gb,{value:e,onChange:t,placeholder:(0,g.__)("Navigation item"),withoutInteractiveFormatting:!0,allowedFormats:["core/bold","core/italic","core/image","core/strikethrough"]}))}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:"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"})),jb=(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"})),Kb=(0,p.withFilters)("editor.MediaUpload")((()=>null)),qb=function({fallback:e=null,children:t}){return(0,m.useSelect)((e=>{const{getSettings:t}=e(Wn);return!!t().mediaUpload}),[])?t:e},Yb=(0,d.compose)([(0,m.withDispatch)((e=>{const{createNotice:t,removeNotice:n}=e(lm.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})=>{const[f,h]=(0,s.useState)(e),v=(0,m.useSelect)((e=>e(Wn).getSettings().mediaUpload),[]),b=(0,s.createRef)(),k=(0,u.uniqueId)("block-editor/media-replace-flow/error-notice/"),_=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:k,isDismissible:!0})}),1e3)},y=e=>{h(e.url),r(e),(0,Rt.speak)((0,g.__)("The media file has been replaced")),d(k)},E=e=>{e.keyCode===di.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:b,"aria-expanded":e,"aria-haspopup":"true",onClick:t,onKeyDown:E},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)(Kb,{value:t,onSelect:e=>y(e),allowedTypes:n,render:({open:e})=>(0,s.createElement)(p.MenuItem,{icon:$b,onClick:e},(0,g.__)("Open Media Library"))}),(0,s.createElement)(qb,null,(0,s.createElement)(p.FormFileUpload,{onChange:e=>{(e=>{const t=e.target.files;i(t),v({allowedTypes:n,filesList:t,onFileChange:([e])=>{y(e)},onError:_})})(e)},accept:o,render:({openFileDialog:e})=>(0,s.createElement)(p.MenuItem,{icon:jb,onClick:()=>{e()}},(0,g.__)("Upload"))}))),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)(_b,{value:{url:f},settings:[],showSuggestions:!1,onChange:({url:e})=>{h(e),l(e),b.current.focus()}})))})})),Zb=(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 Xb({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,pm.filterURLForDisplay)((0,pm.safeDecodeURI)(e))):(0,s.createElement)("span",{className:o})}function Qb({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:uf,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))}Qb.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)(tb,{value:o,onChange:n,autocompleteRef:e}),(0,s.createElement)(p.Button,{icon:Qv,label:(0,g.__)("Apply"),type:"submit"}))},Qb.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)(Xb,{url:o,urlLabel:r,className:t}),n&&(0,s.createElement)(p.Button,{icon:Zb,label:(0,g.__)("Edit"),onClick:n}))};var Jb=Qb;const ek=({src:e,onChange:t,onSubmit:n,onClose:o})=>(0,s.createElement)(Jb,{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:Qv,label:(0,g.__)("Apply"),type:"submit"})));var tk=(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:v=!0,dropZoneUIOnly:b,disableDropZone:k,disableMediaButtons:_,onError:y,onSelect:E,onCancel:C,onSelectURL:w,onDoubleClick:S,onFilesPreUpload:B=u.noop,onHTMLDrop:I=u.noop,children:x}){const T=(0,m.useSelect)((e=>{const{getSettings:t}=e(Wn);return t().mediaUpload}),[]),[N,P]=(0,s.useState)(""),[R,M]=(0,s.useState)(!1);(0,s.useEffect)((()=>{var t;P(null!==(t=null==e?void 0:e.src)&&void 0!==t?t:"")}),[null==e?void 0:e.src]);const L=e=>{P(e.target.value)},A=()=>{M(!0)},D=()=>{M(!1)},O=e=>{e.preventDefault(),N&&w&&(w(N),D())},F=n=>{if(!v)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);T({allowedTypes:t,filesList:n,onFileChange:o,onError:y})},z=e=>{F(e.target.files)},V=e=>{let{instructions:u,title:d}=r;if(T||w||(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&&T&&(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:S,preview:l},e,x)},H=()=>k?null:(0,s.createElement)(p.DropZone,{onFilesDrop:F,onHTMLDrop:I}),U=()=>C&&(0,s.createElement)(p.Button,{className:"block-editor-media-placeholder__cancel-button",title:(0,g.__)("Cancel"),variant:"link",onClick:C},(0,g.__)("Cancel")),G=()=>w&&(0,s.createElement)("div",{className:"block-editor-media-placeholder__url-input-container"},(0,s.createElement)(p.Button,{className:"block-editor-media-placeholder__button",onClick:A,isPressed:R,variant:"tertiary"},(0,g.__)("Insert from URL")),R&&(0,s.createElement)(ek,{src:N,onChange:L,onSubmit:O,onClose:D}));return b||_?(b&&At()("wp.blockEditor.MediaPlaceholder dropZoneUIOnly prop",{since:"5.4",alternative:"disableMediaButtons"}),(0,s.createElement)(qb,null,H())):(0,s.createElement)(qb,{fallback:V(G())},(()=>{const n=(0,s.createElement)(Kb,{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:({open:e})=>(0,s.createElement)(p.Button,{variant:"tertiary",onClick:()=>{e()}},(0,g.__)("Media Library"))});if(T&&a)return(0,s.createElement)(s.Fragment,null,H(),(0,s.createElement)(p.FormFileUpload,{onChange:z,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")),n,G(),U());return V(t)}}));if(T){const e=(0,s.createElement)(s.Fragment,null,H(),(0,s.createElement)(p.FormFileUpload,{variant:"primary",className:c()("block-editor-media-placeholder__button","block-editor-media-placeholder__upload-button"),onChange:z,accept:d,multiple:h},(0,g.__)("Upload")),n,G(),U());return V(e)}return V(n)})())})),nk=({colorSettings:e,...t})=>{const n=e.map((({value:e,onChange:t,...n})=>({...n,colorValue:e,onColorChange:t})));return(0,s.createElement)(Nl,i({settings:n,gradients:[],disableCustomGradients:!0},t))};const ok=(0,s.forwardRef)(((e,t)=>(0,s.createElement)(Gb,i({ref:t},e,{__unstableDisableFormats:!0,preserveWhiteSpace:!0}))));ok.Content=({value:e="",tagName:t="div",...n})=>(0,s.createElement)(t,n,e);var rk=ok,lk=(0,s.forwardRef)((({__experimentalVersion:e,...t},n)=>{if(2===e)return(0,s.createElement)(rk,i({ref:n},t));const{className:o,onChange:r,...l}=t;return(0,s.createElement)(Fs.Z,i({ref:n,className:c()("block-editor-plain-text",o),onChange:e=>r(e.target.value)},l))}));function ik({property:e,viewport:t,desc:n}){const o=(0,d.useInstanceId)(ik),r=n||(0,g.sprintf)(
|
75 |
/* translators: 1: property name. 2: viewport name. */
|
76 |
+
(0,g._x)("Controls the %1$s property for %2$s viewports.","Text labelling a interface as controlling a given layout property (eg: margin) for a given screen size."),e,t.label);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("span",{"aria-describedby":`rbc-desc-${o}`},t.label),(0,s.createElement)(p.VisuallyHidden,{as:"span",id:`rbc-desc-${o}`},r))}var sk=function(e){const{title:t,property:n,toggleLabel:o,onIsResponsiveChange:r,renderDefaultControl:l,renderResponsiveControls:i,isResponsive:a=!1,defaultLabel:u={id:"all",
|
77 |
/* translators: 'Label. Used to signify a layout property (eg: margin, padding) will apply uniformly to all screensizes.' */
|
78 |
+
label:(0,g.__)("All")},viewports:d=[{id:"small",label:(0,g.__)("Small screens")},{id:"medium",label:(0,g.__)("Medium screens")},{id:"large",label:(0,g.__)("Large screens")}]}=e;if(!t||!n||!l)return null;const m=o||(0,g.sprintf)(
|
79 |
/* translators: 'Toggle control label. Should the property be the same across all screen sizes or unique per screen size.'. %s property value for the control (eg: margin, padding...etc) */
|
80 |
+
(0,g.__)("Use the same %s on all screensizes."),n),f=(0,g.__)("Toggle between using the same value for all screen sizes or using a unique value per screen size."),h=l((0,s.createElement)(ik,{property:n,viewport:u}),u);
|
81 |
+
/* translators: 'Help text for the responsive mode toggle control.' */return(0,s.createElement)("fieldset",{className:"block-editor-responsive-block-control"},(0,s.createElement)("legend",{className:"block-editor-responsive-block-control__title"},t),(0,s.createElement)("div",{className:"block-editor-responsive-block-control__inner"},(0,s.createElement)(p.ToggleControl,{className:"block-editor-responsive-block-control__toggle",label:m,checked:!a,onChange:r,help:f}),(0,s.createElement)("div",{className:c()("block-editor-responsive-block-control__group",{"is-responsive":a})},!a&&h,a&&(i?i(d):d.map((e=>(0,s.createElement)(s.Fragment,{key:e.id},l((0,s.createElement)(ik,{property:n,viewport:e}),e))))))))};function ak({character:e,type:t,onUse:n}){const o=(0,s.useContext)(Vb),r=(0,s.useRef)();return r.current=n,(0,s.useEffect)((()=>{function n(n){di.isKeyboardEvent[t](n,e)&&(r.current(),n.preventDefault())}return o.current.add(n),()=>{o.current.delete(n)}}),[e,t]),null}function ck({name:e,shortcutType:t,shortcutCharacter:n,...o}){let r,l="RichText.ToolbarControls";return e&&(l+=`.${e}`),t&&n&&(r=di.displayShortcut[t](n)),(0,s.createElement)(p.Fill,{name:l},(0,s.createElement)(p.ToolbarButton,i({},o,{shortcut:r})))}function uk({inputType:e,onInput:t}){const n=(0,s.useContext)(Hb),o=(0,s.useRef)();return o.current=t,(0,s.useEffect)((()=>{function t(t){t.inputType===e&&(o.current(),t.preventDefault())}return n.current.add(t),()=>{n.current.delete(t)}}),[e]),null}const dk=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M9.4 20.5L5.2 3.8l14.6 9-2 .3c-.2 0-.4.1-.7.1-.9.2-1.6.3-2.2.5-.8.3-1.4.5-1.8.8-.4.3-.8.8-1.3 1.5-.4.5-.8 1.2-1.2 2l-.3.6-.9 1.9zM7.6 7.1l2.4 9.3c.2-.4.5-.8.7-1.1.6-.8 1.1-1.4 1.6-1.8.5-.4 1.3-.8 2.2-1.1l1.2-.3-8.1-5z"}));var pk=(0,s.forwardRef)((function(e,t){const n=(0,m.useSelect)((e=>e(Wn).isNavigationMode()),[]),{setNavigationMode:o}=(0,m.useDispatch)(Wn),r=e=>{o("edit"!==e)};return(0,s.createElement)(p.Dropdown,{renderToggle:({isOpen:o,onToggle:r})=>(0,s.createElement)(p.Button,i({},e,{ref:t,icon:n?dk:Zb,"aria-expanded":o,"aria-haspopup":"true",onClick:r
|
82 |
+
/* translators: button label text should, if possible, be under 16 characters. */,label:(0,g.__)("Tools")})),position:"bottom right",renderContent:()=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.NavigableMenu,{role:"menu","aria-label":(0,g.__)("Tools")},(0,s.createElement)(p.MenuItemsChoice,{value:n?"select":"edit",onSelect:r,choices:[{value:"edit",label:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Co,{icon:Zb}),(0,g.__)("Edit"))},{value:"select",label:(0,s.createElement)(s.Fragment,null,dk,(0,g.__)("Select"))}]})),(0,s.createElement)("div",{className:"block-editor-tool-selector__help"},(0,g.__)("Tools provide different interactions for selecting, navigating, and editing blocks. Toggle between select and edit by pressing Escape and Enter.")))})}));function mk({units:e,...t}){const n=(0,p.__experimentalUseCustomUnits)({availableUnits:fo("spacing.units")||["%","px","em","rem","vw"],units:e});return(0,s.createElement)(p.__experimentalUnitControl,i({units:n},t))}var fk=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z"}));class gk extends s.Component{constructor(){super(...arguments),this.toggle=this.toggle.bind(this),this.submitLink=this.submitLink.bind(this),this.state={expanded:!1}}toggle(){this.setState({expanded:!this.state.expanded})}submitLink(e){e.preventDefault(),this.toggle()}render(){const{url:e,onChange:t}=this.props,{expanded:n}=this.state,o=e?(0,g.__)("Edit link"):(0,g.__)("Insert link");return(0,s.createElement)("div",{className:"block-editor-url-input__button"},(0,s.createElement)(p.Button,{icon:ll,label:o,onClick:this.toggle,className:"components-toolbar__control",isPressed:!!e}),n&&(0,s.createElement)("form",{className:"block-editor-url-input__button-modal",onSubmit:this.submitLink},(0,s.createElement)("div",{className:"block-editor-url-input__button-modal-line"},(0,s.createElement)(p.Button,{className:"block-editor-url-input__back",icon:fk,label:(0,g.__)("Close"),onClick:this.toggle}),(0,s.createElement)(tb,{value:e||"",onChange:t}),(0,s.createElement)(p.Button,{icon:Qv,label:(0,g.__)("Submit"),type:"submit"}))))}}var hk=gk,vk=(0,s.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(F.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));const bk="none",kk="custom",_k="media",yk="attachment",Ek=["noreferrer","noopener"],Ck=(0,s.createElement)(p.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(p.Path,{d:"M0,0h24v24H0V0z",fill:"none"}),(0,s.createElement)(p.Path,{d:"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z"}),(0,s.createElement)(p.Path,{d:"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z"})),wk=({linkDestination:e,onChangeUrl:t,url:n,mediaType:o="image",mediaUrl:r,mediaLink:l,linkTarget:i,linkClass:a,rel:c})=>{const[d,m]=(0,s.useState)(!1),f=(0,s.useCallback)((()=>{m(!0)})),[h,v]=(0,s.useState)(!1),[b,k]=(0,s.useState)(null),_=(0,s.useRef)(null),y=(0,s.useCallback)((()=>{e!==_k&&e!==yk||k(""),v(!0)})),E=(0,s.useCallback)((()=>{v(!1)})),C=(0,s.useCallback)((()=>{k(null),E(),m(!1)})),w=e=>{let t=e;return void 0===e||(0,u.isEmpty)(t)||(0,u.isEmpty)(t)||((0,u.each)(Ek,(e=>{const n=new RegExp("\\b"+e+"\\b","gi");t=t.replace(n,"")})),t!==e&&(t=t.trim()),(0,u.isEmpty)(t)&&(t=void 0)),t},S=(0,s.useCallback)((()=>e=>{const t=_.current;t&&t.contains(e.target)||(m(!1),k(null),E())})),B=(0,s.useCallback)((()=>e=>{if(b){var n;const e=(null===(n=x().find((e=>e.url===b)))||void 0===n?void 0:n.linkDestination)||kk;t({href:b,linkDestination:e})}E(),k(null),e.preventDefault()})),I=(0,s.useCallback)((()=>{t({linkDestination:bk,href:""})})),x=()=>{const e=[{linkDestination:_k,title:(0,g.__)("Media File"),url:"image"===o?r:void 0,icon:Ck}];return"image"===o&&l&&e.push({linkDestination:yk,title:(0,g.__)("Attachment Page"),url:"image"===o?l:void 0,icon:(0,s.createElement)(p.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(p.Path,{d:"M0 0h24v24H0V0z",fill:"none"}),(0,s.createElement)(p.Path,{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"}))}),e},T=(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.ToggleControl,{label:(0,g.__)("Open in new tab"),onChange:e=>{const n=(e=>{const t=e?"_blank":void 0;let n;return n=t||c?w(c):void 0,{linkTarget:t,rel:n}})(e);t(n)},checked:"_blank"===i}),(0,s.createElement)(p.TextControl,{label:(0,g.__)("Link Rel"),value:w(c)||"",onChange:e=>{t({rel:e})}}),(0,s.createElement)(p.TextControl,{label:(0,g.__)("Link CSS Class"),value:a||"",onChange:e=>{t({linkClass:e})}})),N=null!==b?b:n,P=((0,u.find)(x(),["linkDestination",e])||{}).title;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.ToolbarButton,{icon:ll,className:"components-toolbar__control",label:n?(0,g.__)("Edit link"):(0,g.__)("Insert link"),"aria-expanded":d,onClick:f}),d&&(0,s.createElement)(Jb,{onFocusOutside:S(),onClose:C,renderSettings:()=>T,additionalControls:!N&&(0,s.createElement)(p.NavigableMenu,null,(0,u.map)(x(),(e=>(0,s.createElement)(p.MenuItem,{key:e.linkDestination,icon:e.icon,onClick:()=>{k(null),(e=>{const n=x();let o;o=e?((0,u.find)(n,(t=>t.url===e))||{linkDestination:kk}).linkDestination:bk,t({linkDestination:o,href:e})})(e.url),E()}},e.title))))},(!n||h)&&(0,s.createElement)(Jb.LinkEditor,{className:"block-editor-format-toolbar__link-container-content",value:N,onChangeInputValue:k,onSubmit:B(),autocompleteRef:_}),n&&!h&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Jb.LinkViewer,{className:"block-editor-format-toolbar__link-container-content",url:n,onEditLinkClick:y,urlLabel:P}),(0,s.createElement)(p.Button,{icon:vk,label:(0,g.__)("Remove link"),onClick:I}))))};function Sk({children:e,className:t,isEnabled:n=!0,deviceType:o,setDeviceType:r}){if((0,d.useViewportMatch)("small","<"))return null;const l={className:c()(t,"block-editor-post-preview__dropdown-content"),position:"bottom left"},i={variant:"tertiary",className:"block-editor-post-preview__button-toggle",disabled:!n,
|
83 |
/* translators: button label text should, if possible, be under 16 characters. */
|
84 |
+
children:(0,g.__)("Preview")};return(0,s.createElement)(p.DropdownMenu,{className:"block-editor-post-preview__dropdown",popoverProps:l,toggleProps:i,icon:null},(()=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(p.MenuGroup,null,(0,s.createElement)(p.MenuItem,{className:"block-editor-post-preview__button-resize",onClick:()=>r("Desktop"),icon:"Desktop"===o&&Uv},(0,g.__)("Desktop")),(0,s.createElement)(p.MenuItem,{className:"block-editor-post-preview__button-resize",onClick:()=>r("Tablet"),icon:"Tablet"===o&&Uv},(0,g.__)("Tablet")),(0,s.createElement)(p.MenuItem,{className:"block-editor-post-preview__button-resize",onClick:()=>r("Mobile"),icon:"Mobile"===o&&Uv},(0,g.__)("Mobile"))),e)))}function Bk(e){const[t,n]=(0,s.useState)(window.innerWidth);(0,s.useEffect)((()=>{if("Desktop"===e)return;const t=()=>n(window.innerWidth);return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}}),[e]);const o=e=>{let n;switch(e){case"Tablet":n=780;break;case"Mobile":n=360;break;default:return null}return n<t?n:t};return(e=>{const t="Mobile"===e?"768px":"1024px";switch(e){case"Tablet":case"Mobile":return{width:o(e),margin:(window.innerHeight<800?36:72)+"px auto",height:t,borderRadius:"2px 2px 2px 2px",border:"1px solid #ddd",overflowY:"auto"};default:return null}})(e)}var Ik=(0,m.withSelect)((e=>({selectedBlockClientId:e(Wn).getBlockSelectionStart()})))((({selectedBlockClientId:e})=>{const t=Dl(e);return e?(0,s.createElement)(p.Button,{variant:"secondary",className:"block-editor-skip-to-selected-block",onClick:()=>{t.current.focus()}},(0,g.__)("Skip to the selected block")):null})),xk=window.wp.wordcount,Tk=(0,m.withSelect)((e=>{const{getMultiSelectedBlocks:t}=e(Wn);return{blocks:t()}}))((function({blocks:e}){const t=(0,xk.count)((0,r.serialize)(e),"words");return(0,s.createElement)("div",{className:"block-editor-multi-selection-inspector__card"},(0,s.createElement)(Qd,{icon:Ef,showColors:!0}),(0,s.createElement)("div",{className:"block-editor-multi-selection-inspector__card-content"},(0,s.createElement)("div",{className:"block-editor-multi-selection-inspector__card-title"},(0,g.sprintf)(
|
85 |
/* translators: %d: number of blocks */
|
86 |
+
(0,g._n)("%d block","%d blocks",e.length),e.length)),(0,s.createElement)("div",{className:"block-editor-multi-selection-inspector__card-description"},(0,g.sprintf)(
|
87 |
/* translators: %d: number of words */
|
88 |
+
(0,g._n)("%d word","%d words",t),t))))}));function Nk({blockName:e}){const{preferredStyle:t,onUpdatePreferredStyleVariations:n,styles:o}=(0,m.useSelect)((t=>{var n,o;const l=t(Wn).getSettings().__experimentalPreferredStyleVariations;return{preferredStyle:null==l||null===(n=l.value)||void 0===n?void 0:n[e],onUpdatePreferredStyleVariations:null!==(o=null==l?void 0:l.onChange)&&void 0!==o?o:null,styles:t(r.store).getBlockStyles(e)}}),[e]),l=(0,s.useMemo)((()=>[{label:(0,g.__)("Not set"),value:""},...o.map((({label:e,name:t})=>({label:e,value:t})))]),[o]),i=(0,s.useCallback)((t=>{n(e,t)}),[e,n]);return n&&(0,s.createElement)(p.SelectControl,{options:l,value:t||"",label:(0,g.__)("Default Style"),onChange:i})}const Pk=({clientId:e,blockName:t,hasBlockStyles:n,bubblesVirtually:o})=>{const l=ef(e);return(0,s.createElement)("div",{className:"block-editor-block-inspector"},(0,s.createElement)(Jd,l),(0,s.createElement)(lv,{blockClientId:e}),n&&(0,s.createElement)("div",null,(0,s.createElement)(p.PanelBody,{title:(0,g.__)("Styles")},(0,s.createElement)(If,{clientId:e}),(0,r.hasBlockSupport)(t,"defaultStylePicker",!0)&&(0,s.createElement)(Nk,{blockName:t}))),(0,s.createElement)(Zo.Slot,{bubblesVirtually:o}),(0,s.createElement)(Zo.Slot,{__experimentalGroup:"dimensions",bubblesVirtually:!1,label:(0,g.__)("Dimensions")}),(0,s.createElement)("div",null,(0,s.createElement)(Rk,{bubblesVirtually:o})),(0,s.createElement)(Ik,{key:"back"}))},Rk=({bubblesVirtually:e})=>{const t=(0,p.__experimentalUseSlot)(Yo.slotName);return Boolean(t.fills&&t.fills.length)?(0,s.createElement)(p.PanelBody,{className:"block-editor-block-inspector__advanced",title:(0,g.__)("Advanced"),initialOpen:!1},(0,s.createElement)(Zo.Slot,{__experimentalGroup:"advanced",bubblesVirtually:e})):null};var Mk=({showNoBlockSelectedMessage:e=!0,bubblesVirtually:t=!0})=>{const{count:n,hasBlockStyles:o,selectedBlockName:l,selectedBlockClientId:i,blockType:a}=(0,m.useSelect)((e=>{const{getSelectedBlockClientId:t,getSelectedBlockCount:n,getBlockName:o}=e(Wn),{getBlockStyles:l}=e(r.store),i=t(),s=i&&o(i),a=s&&(0,r.getBlockType)(s),c=s&&l(s);return{count:n(),selectedBlockClientId:i,selectedBlockName:s,blockType:a,hasBlockStyles:c&&c.length>0}}),[]);if(n>1)return(0,s.createElement)("div",{className:"block-editor-block-inspector"},(0,s.createElement)(Tk,null),(0,s.createElement)(Zo.Slot,{bubblesVirtually:t}));const c=l===(0,r.getUnregisteredTypeHandlerName)();return a&&i&&!c?(0,s.createElement)(Pk,{clientId:i,blockName:a.name,hasBlockStyles:o,bubblesVirtually:t}):e?(0,s.createElement)("span",{className:"block-editor-block-inspector__no-blocks"},(0,g.__)("No block selected.")):null};function Lk({children:e,__unstableContentRef:t,...n}){const o=(0,d.useViewportMatch)("medium"),r=(0,m.useSelect)((e=>e(Wn).getSettings().hasFixedToolbar),[]),l=(0,dp.__unstableUseShortcutEventMatch)(),{getSelectedBlockClientIds:a,getBlockRootClientId:c}=(0,m.useSelect)(Wn),{duplicateBlocks:f,removeBlocks:g,insertAfterBlock:h,insertBeforeBlock:v,clearSelectedBlock:b,moveBlocksUp:k,moveBlocksDown:_}=(0,m.useDispatch)(Wn);return(0,s.createElement)("div",i({},n,{onKeyDown:function(e){if(l("core/block-editor/move-up",e)){const t=a();if(t.length){e.preventDefault();const n=c((0,u.first)(t));k(t,n)}}else if(l("core/block-editor/move-down",e)){const t=a();if(t.length){e.preventDefault();const n=c((0,u.first)(t));_(t,n)}}else if(l("core/block-editor/duplicate",e)){const t=a();t.length&&(e.preventDefault(),f(t))}else if(l("core/block-editor/remove",e)){const t=a();t.length&&(e.preventDefault(),g(t))}else if(l("core/block-editor/insert-after",e)){const t=a();t.length&&(e.preventDefault(),h((0,u.last)(t)))}else if(l("core/block-editor/insert-before",e)){const t=a();t.length&&(e.preventDefault(),v((0,u.first)(t)))}else if(l("core/block-editor/delete-multi-selection",e)){const t=a();t.length>1&&(e.preventDefault(),g(t))}else l("core/block-editor/unselect",e)&&a().length>1&&(e.preventDefault(),b(),e.target.ownerDocument.defaultView.getSelection().removeAllRanges())}}),(0,s.createElement)(Zm,{__unstableContentRef:t},(r||!o)&&(0,s.createElement)(rg,{isFixed:!0}),(0,s.createElement)(ag,{__unstableContentRef:t}),(0,s.createElement)(p.Popover.Slot,{name:"block-toolbar",ref:Km(t)}),e))}var Ak=function({rootClientId:e,clientId:t,isAppender:n,showInserterHelpPanel:o,showMostUsedBlocks:r=!1,__experimentalInsertionIndex:l,__experimentalFilterValue:i,onSelect:a=u.noop,shouldFocusBlock:c=!1}){const d=(0,m.useSelect)((n=>{const{getBlockRootClientId:o}=n(Wn);return e||o(t)||void 0}),[t,e]);return(0,s.createElement)(Om,{onSelect:a,rootClientId:d,clientId:t,isAppender:n,showInserterHelpPanel:o,showMostUsedBlocks:r,__experimentalInsertionIndex:l,__experimentalFilterValue:i,shouldFocusBlock:c})};function Dk(){return null}Dk.Register=function(){const{registerShortcut:e}=(0,m.useDispatch)(dp.store);return(0,s.useEffect)((()=>{e({name:"core/block-editor/duplicate",category:"block",description:(0,g.__)("Duplicate the selected block(s)."),keyCombination:{modifier:"primaryShift",character:"d"}}),e({name:"core/block-editor/remove",category:"block",description:(0,g.__)("Remove the selected block(s)."),keyCombination:{modifier:"access",character:"z"}}),e({name:"core/block-editor/insert-before",category:"block",description:(0,g.__)("Insert a new block before the selected block(s)."),keyCombination:{modifier:"primaryAlt",character:"t"}}),e({name:"core/block-editor/insert-after",category:"block",description:(0,g.__)("Insert a new block after the selected block(s)."),keyCombination:{modifier:"primaryAlt",character:"y"}}),e({name:"core/block-editor/delete-multi-selection",category:"block",description:(0,g.__)("Remove multiple selected blocks."),keyCombination:{character:"del"},aliases:[{character:"backspace"}]}),e({name:"core/block-editor/select-all",category:"selection",description:(0,g.__)("Select all text when typing. Press again to select all blocks."),keyCombination:{modifier:"primary",character:"a"}}),e({name:"core/block-editor/unselect",category:"selection",description:(0,g.__)("Clear selection."),keyCombination:{character:"escape"}}),e({name:"core/block-editor/focus-toolbar",category:"global",description:(0,g.__)("Navigate to the nearest toolbar."),keyCombination:{modifier:"alt",character:"F10"}}),e({name:"core/block-editor/move-up",category:"block",description:(0,g.__)("Move the selected block(s) up."),keyCombination:{modifier:"secondary",character:"t"}}),e({name:"core/block-editor/move-down",category:"block",description:(0,g.__)("Move the selected block(s) down."),keyCombination:{modifier:"secondary",character:"y"}})}),[e]),null};var Ok=Dk;function Fk(){return At()("wp.blockEditor.MultiSelectScrollIntoView",{hint:"This behaviour is now built-in."}),null}const zk=new Set([di.UP,di.RIGHT,di.DOWN,di.LEFT,di.ENTER,di.BACKSPACE]);function Vk(){const e=(0,m.useSelect)((e=>e(Wn).isTyping()),[]),{stopTyping:t}=(0,m.useDispatch)(Wn);return(0,d.useRefEffect)((n=>{if(!e)return;const{ownerDocument:o}=n;let r,l;function i(e){const{clientX:n,clientY:o}=e;r&&l&&(r!==n||l!==o)&&t(),r=n,l=o}return o.addEventListener("mousemove",i),()=>{o.removeEventListener("mousemove",i)}}),[e,t])}function Hk(){const e=(0,m.useSelect)((e=>e(Wn).isTyping())),{startTyping:t,stopTyping:n}=(0,m.useDispatch)(Wn),o=Vk(),r=(0,d.useRefEffect)((o=>{const{ownerDocument:r}=o,{defaultView:l}=r;if(e){let e;function t(t){const{target:o}=t;e=l.setTimeout((()=>{(0,_s.isTextField)(o)||n()}))}function i(e){const{keyCode:t}=e;t!==di.ESCAPE&&t!==di.TAB||n()}function s(){const e=l.getSelection();e.rangeCount>0&&e.getRangeAt(0).collapsed||n()}return o.addEventListener("focus",t),o.addEventListener("keydown",i),r.addEventListener("selectionchange",s),()=>{l.clearTimeout(e),o.removeEventListener("focus",t),o.removeEventListener("keydown",i),r.removeEventListener("selectionchange",s)}}function i(e){const{type:n,target:r}=e;(0,_s.isTextField)(r)&&o.contains(r)&&("keydown"!==n||function(e){const{keyCode:t,shiftKey:n}=e;return!n&&zk.has(t)}(e))&&t()}return o.addEventListener("keypress",i),o.addEventListener("keydown",i),()=>{o.removeEventListener("keypress",i),o.removeEventListener("keydown",i)}}),[e,t,n]);return(0,d.useMergeRefs)([o,r])}var Uk=function({children:e}){return(0,s.createElement)("div",{ref:Hk()},e)};function Gk(){return At()("PreserveScrollInReorder component",{since:"5.4",hint:"This behavior is now built-in the block list"}),null}const Wk=-1!==window.navigator.userAgent.indexOf("Trident"),$k=new Set([di.UP,di.DOWN,di.LEFT,di.RIGHT]);function jk(){const e=(0,m.useSelect)((e=>e(Wn).hasSelectedBlock()),[]);return(0,d.useRefEffect)((t=>{if(!e)return;const{ownerDocument:n}=t,{defaultView:o}=n;let r,l,i;function s(){r||(r=o.requestAnimationFrame((()=>{p(),r=null})))}function a(e){l&&o.cancelAnimationFrame(l),l=o.requestAnimationFrame((()=>{c(e),l=null}))}function c({keyCode:e}){if(!m())return;const r=(0,_s.computeCaretRect)(o);if(!r)return;if(!i)return void(i=r);if($k.has(e))return void(i=r);const l=r.top-i.top;if(0===l)return;const s=(0,_s.getScrollContainer)(t);if(!s)return;const a=s===n.body,c=a?o.scrollY:s.scrollTop,u=a?0:s.getBoundingClientRect().top,d=a?i.top/o.innerHeight:(i.top-u)/(o.innerHeight-u);if(0===c&&d<.75&&function(){const e=t.querySelectorAll('[contenteditable="true"]');return e[e.length-1]===n.activeElement}())return void(i=r);const p=a?o.innerHeight:s.clientHeight;i.top+i.height>u+p||i.top<u?i=r:a?o.scrollBy(0,l):s.scrollTop+=l}function u(){n.addEventListener("selectionchange",d)}function d(){n.removeEventListener("selectionchange",d),p()}function p(){m()&&(i=(0,_s.computeCaretRect)(o))}function m(){return t.contains(n.activeElement)&&n.activeElement.isContentEditable}return o.addEventListener("scroll",s,!0),o.addEventListener("resize",s,!0),t.addEventListener("keydown",a),t.addEventListener("keyup",c),t.addEventListener("mousedown",u),t.addEventListener("touchstart",u),()=>{o.removeEventListener("scroll",s,!0),o.r
|