PluginProbe
Gutenberg / 13.5.1
Gutenberg v13.5.1
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
gutenberg / build / block-directory / index.min.js

index.min.js in Gutenberg 13.5.1, at build/block-directory/index.min.js

20 lines 20.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (()=>{"use strict";var e={n:t=>{var l=t&&t.__esModule?()=>t.default:()=>t;return e.d(l,{a:l}),l},d:(t,l)=>{for(var n in l)e.o(l,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:l[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:()=>$});var l={};e.r(l),e.d(l,{getDownloadableBlocks:()=>_,getErrorNoticeForBlock:()=>f,getErrorNotices:()=>h,getInstalledBlockTypes:()=>g,getNewBlockTypes:()=>w,getUnusedBlockTypes:()=>E,isInstalling:()=>y,isRequestingDownloadableBlocks:()=>b});var n={};e.r(n),e.d(n,{addInstalledBlockType:()=>R,clearErrorNotice:()=>F,fetchDownloadableBlocks:()=>C,installBlockType:()=>D,receiveDownloadableBlocks:()=>O,removeInstalledBlockType:()=>A,setErrorNotice:()=>x,setIsInstalling:()=>M,uninstallBlockType:()=>P});var o={};e.r(o),e.d(o,{getDownloadableBlocks:()=>V});const a=window.wp.element,r=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:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;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:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{installedBlockTypes:[],isInstalling:{}},t=arguments.length>1?arguments[1]:void 0;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:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.length)return!1;if(t.some((t=>{let{name:l}=t;return l===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 g(e){return e.blockManagement.installedBlockTypes}const w=(0,c.createRegistrySelector)((e=>t=>{const l=e(p.store).getBlocks();return g(t).filter((e=>k(e,l)))})),E=(0,c.createRegistrySelector)((e=>t=>{const l=e(p.store).getBlocks();return g(t).filter((e=>!k(e,l)))}));function y(e,t){return e.blockManagement.isInstalling[t]||!1}function h(e){return e.errorNotices}function f(e,t){return e.errorNotices[t]}const v=window.wp.i18n,B=window.wp.apiFetch;var N=e.n(B);const I=window.wp.notices,T=window.wp.url,L=e=>new Promise(((t,l)=>{const n=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach((t=>{e[t]&&(n[t]=e[t])})),e.innerHTML&&n.appendChild(document.createTextNode(e.innerHTML)),n.onload=()=>t(!0),n.onerror=()=>l(new Error("Error loading asset.")),document.body.appendChild(n),("link"===n.nodeName.toLowerCase()||"script"===n.nodeName.toLowerCase()&&!n.src)&&t()}));function S(e){if(!e)return!1;const t=e.links["wp:plugin"]||e.links.self;return!(!t||!t.length)&&t[0].href}function C(e){return{type:"FETCH_DOWNLOADABLE_BLOCKS",filterValue:e}}function O(e,t){return{type:"RECEIVE_DOWNLOADABLE_BLOCKS",downloadableBlocks:e,filterValue:t}}const D=e=>async t=>{let{registry:l,dispatch:n}=t;const{id:o,name:a}=e;let r=!1;n.clearErrorNotice(o);try{n.setIsInstalling(o,!0);const t=S(e);let s={};t?await N()({method:"PUT",url:t,data:{status:"active"}}):s=(await N()({method:"POST",path:"wp/v2/plugins",data:{slug:o,status:"active"}}))._links,n.addInstalledBlockType({...e,links:{...e.links,...s}});const c=["api_version","title","category","parent","icon","description","keywords","attributes","provides_context","uses_context","supports","styles","example","variations"];if(await N()({path:(0,T.addQueryArgs)(`/wp/v2/block-types/${a}`,{_fields:c})}).catch((()=>{})).then((e=>{e&&(0,i.unstable__bootstrapServerSideBlockDefinitions)({[a]:(0,u.pick)(e,c)})})),await async function(){const e=await N()({url:document.location.href,parse:!1}),t=await e.text(),l=(new window.DOMParser).parseFromString(t,"text/html"),n=Array.from(l.querySelectorAll('link[rel="stylesheet"],script')).filter((e=>e.id&&!document.getElementById(e.id)));for(const e of n)await L(e)}(),!l.select(i.store).getBlockTypes().some((e=>e.name===a)))throw new Error((0,v.__)("Error registering block. Try reloading the page."));l.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"}),r=!0}catch(e){let t=e.message||(0,v.__)("An error occurred."),a=e instanceof Error;const r={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.")};r[e.code]&&(a=!0,t=r[e.code]),n.setErrorNotice(o,t,a),l.dispatch(I.store).createErrorNotice(t,{speak:!0,isDismissible:!0})}return n.setIsInstalling(o,!1),r},P=e=>async t=>{let{registry:l,dispatch:n}=t;try{const t=S(e);await N()({method:"PUT",url:t,data:{status:"inactive"}}),await N()({method:"DELETE",url:t}),n.removeInstalledBlockType(e)}catch(e){l.dispatch(I.store).createErrorNotice(e.message||(0,v.__)("An error occurred."))}};function R(e){return{type:"ADD_INSTALLED_BLOCK_TYPE",item:e}}function A(e){return{type:"REMOVE_INSTALLED_BLOCK_TYPE",item:e}}function M(e,t){return{type:"SET_INSTALLING_BLOCK",blockId:e,isInstalling:t}}function x(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];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 t=>{let{dispatch:l}=t;if(e)try{l(C(e));l(O((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},$=(0,c.createReduxStore)("core/block-directory",H);function K(){const{uninstallBlockType:e}=(0,c.useDispatch)($),t=(0,c.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:l}=e(d.store);return l()&&!t()}),[]),l=(0,c.useSelect)((e=>e($).getUnusedBlockTypes()),[]);return(0,a.useEffect)((()=>{t&&l.length&&l.forEach((t=>{e(t),(0,i.unregisterBlockType)(t.name)}))}),[t]),null}(0,c.register)($);const z=window.wp.components,Y=window.wp.compose,j=window.wp.coreData;function q(){return(q=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)}const U=window.wp.htmlEntities,G=function(e){let{icon:t,size:l=24,...n}=e;return(0,a.cloneElement)(t,{width:l,height:l,...n})},W=window.wp.primitives,Q=(0,a.createElement)(W.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(W.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,a.createElement)(W.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(W.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"})),X=(0,a.createElement)(W.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(W.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"})),Z=function(e){let{rating:t}=e;const l=.5*Math.round(t/.5),n=Math.floor(t),o=Math.ceil(t-n),r=5-(n+o);return(0,a.createElement)("span",{"aria-label":(0,v.sprintf)(
3 /* translators: %s: number of stars. */
4 (0,v.__)("%s out of 5 stars"),l)},(0,u.times)(n,(e=>(0,a.createElement)(G,{key:`full_stars_${e}`,className:"block-directory-block-ratings__star-full",icon:Q,size:16}))),(0,u.times)(o,(e=>(0,a.createElement)(G,{key:`half_stars_${e}`,className:"block-directory-block-ratings__star-half-full",icon:J,size:16}))),(0,u.times)(r,(e=>(0,a.createElement)(G,{key:`empty_stars_${e}`,className:"block-directory-block-ratings__star-empty",icon:X,size:16}))))},ee=e=>{let{rating:t}=e;return(0,a.createElement)("span",{className:"block-directory-block-ratings"},(0,a.createElement)(Z,{rating:t}))},te=function(e){let{icon:t}=e;const l="block-directory-downloadable-block-icon";return null!==t.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/)?(0,a.createElement)("img",{className:l,src:t,alt:""}):(0,a.createElement)(p.BlockIcon,{className:l,icon:t,showColors:!0})},le=e=>{let{block:t}=e;const l=(0,c.useSelect)((e=>e($).getErrorNoticeForBlock(t.id)),[t]);return l?(0,a.createElement)("div",{className:"block-directory-downloadable-block-notice"},(0,a.createElement)("div",{className:"block-directory-downloadable-block-notice__content"},l.message,l.isFatal?" "+(0,v.__)("Try reloading the page."):null)):null};function ne(e,t){let{title:l,rating:n,ratingCount:o}=e,{hasNotice:a,isInstalled:r,isInstalling:s}=t;const i=.5*Math.round(n/.5);return!r&&a?(0,v.sprintf)("Retry installing %s.",(0,U.decodeEntities)(l)):r?(0,v.sprintf)("Add %s.",(0,U.decodeEntities)(l)):s?(0,v.sprintf)("Installing %s.",(0,U.decodeEntities)(l)):o<1?(0,v.sprintf)("Install %s.",(0,U.decodeEntities)(l)):(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.",o),(0,U.decodeEntities)(l),i,o)}const oe=function(e){let{composite:t,item:l,onClick:n}=e;const{author:o,description:r,icon:s,rating:d,title:u}=l,m=!!(0,i.getBlockType)(l.name),{hasNotice:p,isInstalling:k,isInstallable:b}=(0,c.useSelect)((e=>{const{getErrorNoticeForBlock:t,isInstalling:n}=e($),o=t(l.id),a=o&&o.isFatal;return{hasNotice:!!o,isInstalling:n(l.id),isInstallable:!a}}),[l]);let _="";return m?_=(0,v.__)("Installed!"):k&&(_=(0,v.__)("Installing…")),(0,a.createElement)(z.__unstableCompositeItem,q({__experimentalIsFocusable:!0,role:"option",as:z.Button},t,{className:"block-directory-downloadable-block-list-item",onClick:e=>{e.preventDefault(),n()},isBusy:k,disabled:k||!b,label:ne(l,{hasNotice:p,isInstalled:m,isInstalling:k}),showTooltip:!0,tooltipPosition:"top center"}),(0,a.createElement)("div",{className:"block-directory-downloadable-block-list-item__icon"},(0,a.createElement)(te,{icon:s,title:u}),k?(0,a.createElement)("span",{className:"block-directory-downloadable-block-list-item__spinner"},(0,a.createElement)(z.Spinner,null)):(0,a.createElement)(ee,{rating:d})),(0,a.createElement)("span",{className:"block-directory-downloadable-block-list-item__details"},(0,a.createElement)("span",{className:"block-directory-downloadable-block-list-item__title"},(0,a.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,U.decodeEntities)(u),o),{span:(0,a.createElement)("span",{className:"block-directory-downloadable-block-list-item__author"})})),p?(0,a.createElement)(le,{block:l}):(0,a.createElement)(a.Fragment,null,(0,a.createElement)("span",{className:"block-directory-downloadable-block-list-item__desc"},_||(0,U.decodeEntities)(r)),b&&!(m||k)&&(0,a.createElement)(z.VisuallyHidden,null,(0,v.__)("Install block")))))},ae=()=>{},re=function(e){let{items:t,onHover:l=ae,onSelect:n}=e;const o=(0,z.__unstableUseCompositeState)(),{installBlockType:r}=(0,c.useDispatch)($);return t.length?(0,a.createElement)(z.__unstableComposite,q({},o,{role:"listbox",className:"block-directory-downloadable-blocks-list","aria-label":(0,v.__)("Blocks available for install")}),t.map((e=>(0,a.createElement)(oe,{key:e.id,composite:o,onClick:()=>{(0,i.getBlockType)(e.name)?n(e):r(e).then((t=>{t&&n(e)})),l(null)},onHover:l,item:e})))):null},se=window.wp.a11y,ie=function(e){let{children:t,downloadableItems:l,hasLocalBlocks:n}=e;const o=l.length;return(0,a.useEffect)((()=>{(0,se.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.",o),o))}),[o]),(0,a.createElement)(a.Fragment,null,!n&&(0,a.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,a.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"}),(0,a.createElement)("div",{className:"block-directory-downloadable-blocks-panel"},(0,a.createElement)("div",{className:"block-directory-downloadable-blocks-panel__header"},(0,a.createElement)("h2",{className:"block-directory-downloadable-blocks-panel__title"},(0,v.__)("Available to install")),(0,a.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description"},(0,v.__)("Select a block to install and add it to your post."))),t))},ce=(0,a.createElement)(W.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(W.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"})),de=function(){return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"block-editor-inserter__no-results"},(0,a.createElement)(G,{className:"block-editor-inserter__no-results-icon",icon:ce}),(0,a.createElement)("p",null,(0,v.__)("No results found."))),(0,a.createElement)("div",{className:"block-editor-inserter__tips"},(0,a.createElement)(z.Tip,null,(0,a.createElement)("div",null,(0,a.createElement)("p",null,(0,v.__)("Interested in creating your own block?")),(0,a.createElement)(z.ExternalLink,{href:"https://developer.wordpress.org/block-editor/"},(0,v.__)("Get started here"),".")))))},ue=(0,Y.compose)([(0,c.withSelect)(((e,t)=>{let{filterValue:l,rootClientId:n=null}=t;const{getDownloadableBlocks:o,isRequestingDownloadableBlocks:a}=e($),{canInsertBlockType:r}=e(p.store),s=e(j.store).canUser("read","block-directory/search");return{downloadableItems:s?o(l).filter((e=>r(e,n,!0))):[],hasPermission:s,isLoading:a(l)}}))])((function(e){let{downloadableItems:t,onSelect:l,onHover:n,hasLocalBlocks:o,hasPermission:r,isLoading:s,isTyping:i}=e;return void 0===r||s||i?(0,a.createElement)(a.Fragment,null,r&&!o&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,a.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"})),(0,a.createElement)("div",{className:"block-directory-downloadable-blocks-panel has-blocks-loading"},(0,a.createElement)(z.Spinner,null))):!1===r?o?null:(0,a.createElement)(de,null):t.length?(0,a.createElement)(ie,{downloadableItems:t,hasLocalBlocks:o},(0,a.createElement)(re,{items:t,onSelect:l,onHover:n})):!o&&(0,a.createElement)(de,null)})),me=function(){const[e,t]=(0,a.useState)(""),l=(0,u.debounce)(t,400);return(0,a.createElement)(p.__unstableInserterMenuExtension,null,(t=>{let{onSelect:n,onHover:o,filterValue:r,hasItems:s,rootClientId:i}=t;return e!==r&&l(r),e?(0,a.createElement)(ue,{onSelect:n,onHover:o,rootClientId:i,filterValue:e,hasLocalBlocks:s,isTyping:r!==e}):null}))},pe=window.wp.editPost;function ke(e){let{items:t}=e;return t.length?(0,a.createElement)("ul",{className:"block-directory-compact-list"},t.map((e=>{let{icon:t,id:l,title:n,author:o}=e;return(0,a.createElement)("li",{key:l,className:"block-directory-compact-list__item"},(0,a.createElement)(te,{icon:t,title:n}),(0,a.createElement)("div",{className:"block-directory-compact-list__item-details"},(0,a.createElement)("div",{className:"block-directory-compact-list__item-title"},n),(0,a.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"),o))))}))):null}function be(){const e=(0,c.useSelect)((e=>e($).getNewBlockTypes()),[]);return e.length?(0,a.createElement)(pe.PluginPrePublishPanel,{icon:ce,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,a.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,a.createElement)(ke,{items:e})):null}function _e(e){let{attributes:t,block:l,clientId:n}=e;const o=(0,c.useSelect)((e=>e($).isInstalling(l.id)),[l.id]),{installBlockType:r}=(0,c.useDispatch)($),{replaceBlock:s}=(0,c.useDispatch)(p.store);return(0,a.createElement)(z.Button,{onClick:()=>r(l).then((e=>{if(e){const e=(0,i.getBlockType)(l.name),[o]=(0,i.parse)(t.originalContent);o&&e&&s(n,(0,i.createBlock)(e.name,o.attributes,o.innerBlocks))}})),disabled:o,isBusy:o,variant:"primary"},(0,v.sprintf)(
14 /* translators: %s: block name */
15 (0,v.__)("Install %s"),l.title))}const ge=e=>{let{originalBlock:t,...l}=e;const{originalName:n,originalUndelimitedContent:o}=l.attributes,{replaceBlock:r}=(0,c.useDispatch)(p.store),s=!!o,d=(0,i.getBlockType)("core/html");let u=(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."),t.title||n);const m=[(0,a.createElement)(_e,{key:"install",block:t,attributes:l.attributes,clientId:l.clientId})];return s&&d&&(u=(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."),t.title||n),m.push((0,a.createElement)(z.Button,{key:"convert",onClick:()=>{r(l.clientId,(0,i.createBlock)("core/html",{content:o}))},variant:"link"},(0,v.__)("Keep as HTML")))),(0,a.createElement)("div",(0,p.useBlockProps)(),(0,a.createElement)(p.Warning,{actions:m},u),(0,a.createElement)(a.RawHTML,null,o))};(0,r.registerPlugin)("block-directory",{render:()=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(K,null),(0,a.createElement)(me,null),(0,a.createElement)(be,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($),n=l("block:"+t).filter((e=>{let{name:l}=e;return t===l}));return{hasPermission:e(j.store).canUser("read","block-directory/search"),block:n.length&&n[0]}}),[t]);return o&&n?(0,a.createElement)(ge,q({},e,{originalBlock:n})):(0,a.createElement)(l,e)})),e;var l})),(window.wp=window.wp||{}).blockDirectory=t})();
20 //# sourceMappingURL=index.min.js.map