WordPress/wp-includes/js/dist/format-library.min.js
noisysocks 3e094c27d0 Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Force remount LinkControl when moving between links within same richtext block
- Site Editor: Change ToolsMoreMenuGroup slot-fill name
- Respect fields param for global styles REST API requests.
- Try ensuring the item after post content clears floats
- Fix submenus not opening on click
- Apply i18n functions to Nav block menu drops when selecting existing Menu
- Gallery: Make sure the mobile warning notice only runs when images are added to a new block
- Prepare navigation php code for core patch
- Address deprecation issues from Buttons flex layout PR.
- Block Library: Fix incorrect attributes definitions
- Fix Navigation accessibility issues

See #54337.

Built from https://develop.svn.wordpress.org/trunk@52103


git-svn-id: http://core.svn.wordpress.org/trunk@51695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-10 06:01:30 +00:00

2 lines
21 KiB
JavaScript

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.formatLibrary=function(e){var t={};function n(c){if(t[c])return t[c].exports;var r=t[c]={i:c,l:!1,exports:{}};return e[c].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,c){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(n.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(c,r,function(t){return e[t]}.bind(null,r));return c},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="t1DA")}({"1Yn1":function(e,t,n){"use strict";var c=n("GRId"),r=n("Tqx9");const o=Object(c.createElement)(r.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(c.createElement)(r.Path,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"}));t.a=o},"1ZqX":function(e,t){e.exports=window.wp.data},Bpkj:function(e,t,n){"use strict";var c=n("GRId"),r=n("Tqx9");const o=Object(c.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(r.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"}));t.a=o},Crq9:function(e,t,n){"use strict";var c=n("GRId"),r=n("Tqx9");const o=Object(c.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(r.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"}));t.a=o},GRId:function(e,t){e.exports=window.wp.element},Mmq9:function(e,t){e.exports=window.wp.url},Mp0b:function(e,t,n){"use strict";var c=n("GRId"),r=n("Tqx9");const o=Object(c.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(r.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"}));t.a=o},Tqx9:function(e,t){e.exports=window.wp.primitives},YLtl:function(e,t){e.exports=window.lodash},axFQ:function(e,t){e.exports=window.wp.blockEditor},btIw:function(e,t,n){"use strict";var c=n("GRId"),r=n("Tqx9");const o=Object(c.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(c.createElement)(r.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"}));t.a=o},gdqT:function(e,t){e.exports=window.wp.a11y},iClF:function(e,t,n){"use strict";var c=n("GRId");t.a=function({icon:e,size:t=24,...n}){return Object(c.cloneElement)(e,{width:t,height:t,...n})}},l3Sj:function(e,t){e.exports=window.wp.i18n},oMoS:function(e,t,n){"use strict";var c=n("GRId"),r=n("Tqx9");const o=Object(c.createElement)(r.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(c.createElement)(r.Path,{d:"M19 6.5H5c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v7zM8 12.8h8v-1.5H8v1.5z"}));t.a=o},qRz9:function(e,t){e.exports=window.wp.richText},rmEH:function(e,t){e.exports=window.wp.htmlEntities},t1DA:function(e,t,n){"use strict";n.r(t);var c=n("qRz9"),r=n("GRId"),o=n("l3Sj"),a=n("axFQ"),i=n("Tqx9");var l=Object(r.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(i.Path,{d:"M14.7 11.3c1-.6 1.5-1.6 1.5-3 0-2.3-1.3-3.4-4-3.4H7v14h5.8c1.4 0 2.5-.3 3.3-1 .8-.7 1.2-1.7 1.2-2.9.1-1.9-.8-3.1-2.6-3.7zm-5.1-4h2.3c.6 0 1.1.1 1.4.4.3.3.5.7.5 1.2s-.2 1-.5 1.2c-.3.3-.8.4-1.4.4H9.6V7.3zm4.6 9c-.4.3-1 .4-1.7.4H9.6v-3.9h2.9c.7 0 1.3.2 1.7.5.4.3.6.8.6 1.5s-.2 1.2-.6 1.5z"}));const s=Object(o.__)("Bold"),u={name:"core/bold",title:s,tagName:"strong",className:null,edit({isActive:e,value:t,onChange:n,onFocus:o}){function i(){n(Object(c.toggleFormat)(t,{type:"core/bold",title:s}))}return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RichTextShortcut,{type:"primary",character:"b",onUse:i}),Object(r.createElement)(a.RichTextToolbarButton,{name:"bold",icon:l,title:s,onClick:function(){n(Object(c.toggleFormat)(t,{type:"core/bold"})),o()},isActive:e,shortcutType:"primary",shortcutCharacter:"b"}),Object(r.createElement)(a.__unstableRichTextInputEvent,{inputType:"formatBold",onInput:i}))}};var b=n("1Yn1");const m=Object(o.__)("Inline code"),p={name:"core/code",title:m,tagName:"code",className:null,__unstableInputRule(e){const{start:t,text:n}=e;if("`"!==n.slice(t-1,t))return e;const r=n.slice(0,t-1).lastIndexOf("`");if(-1===r)return e;const o=r,a=t-2;return o===a?e:(e=Object(c.remove)(e,o,o+1),e=Object(c.remove)(e,a,a+1),e=Object(c.applyFormat)(e,{type:"core/code"},o,a))},edit:({value:e,onChange:t,onFocus:n,isActive:o})=>Object(r.createElement)(a.RichTextToolbarButton,{icon:b.a,title:m,onClick:function(){t(Object(c.toggleFormat)(e,{type:"core/code",title:m})),n()},isActive:o,role:"menuitemcheckbox"})};var h=n("tI+e"),j=n("btIw");const O=["image"],d=Object(o.__)("Inline image"),g={name:"core/image",title:d,keywords:[Object(o.__)("photo"),Object(o.__)("media")],object:!0,tagName:"img",className:null,attributes:{className:"class",style:"style",url:"src",alt:"alt"},edit:function({value:e,onChange:t,onFocus:n,isObjectActive:o,activeObjectAttributes:i,contentRef:l}){const[s,u]=Object(r.useState)(!1);function b(){u(!1)}return Object(r.createElement)(a.MediaUploadCheck,null,Object(r.createElement)(a.RichTextToolbarButton,{icon:Object(r.createElement)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(h.Path,{d:"M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z"})),title:d,onClick:function(){u(!0)},isActive:o}),s&&Object(r.createElement)(a.MediaUpload,{allowedTypes:O,onSelect:({id:r,url:o,alt:a,width:i})=>{b(),t(Object(c.insertObject)(e,{type:"core/image",attributes:{className:"wp-image-"+r,style:`width: ${Math.min(i,150)}px;`,url:o,alt:a}})),n()},onClose:b,render:({open:e})=>(e(),null)}),o&&Object(r.createElement)(v,{value:e,onChange:t,activeObjectAttributes:i,contentRef:l}))}};function v({value:e,onChange:t,activeObjectAttributes:n,contentRef:a}){const{style:i}=n,[l,s]=Object(r.useState)(null==i?void 0:i.replace(/\D/g,"")),u=Object(c.useAnchorRef)({ref:a,value:e,settings:g});return Object(r.createElement)(h.Popover,{position:"bottom center",focusOnMount:!1,anchorRef:u,className:"block-editor-format-toolbar__image-popover"},Object(r.createElement)("form",{className:"block-editor-format-toolbar__image-container-content",onSubmit:c=>{const r=e.replacements.slice();r[e.start]={type:"core/image",attributes:{...n,style:l?`width: ${l}px;`:""}},t({...e,replacements:r}),c.preventDefault()}},Object(r.createElement)(h.TextControl,{className:"block-editor-format-toolbar__image-container-value",type:"number",label:Object(o.__)("Width"),value:l,min:1,onChange:e=>s(e)}),Object(r.createElement)(h.Button,{icon:j.a,label:Object(o.__)("Apply"),type:"submit"})))}var f=Object(r.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(i.Path,{d:"M12.5 5L10 19h1.9l2.5-14z"}));const w=Object(o.__)("Italic"),y={name:"core/italic",title:w,tagName:"em",className:null,edit({isActive:e,value:t,onChange:n,onFocus:o}){function i(){n(Object(c.toggleFormat)(t,{type:"core/italic",title:w}))}return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RichTextShortcut,{type:"primary",character:"i",onUse:i}),Object(r.createElement)(a.RichTextToolbarButton,{name:"italic",icon:f,title:w,onClick:function(){n(Object(c.toggleFormat)(t,{type:"core/italic"})),o()},isActive:e,shortcutType:"primary",shortcutCharacter:"i"}),Object(r.createElement)(a.__unstableRichTextInputEvent,{inputType:"formatItalic",onInput:i}))}};var x=n("Mmq9"),k=n("rmEH"),E=n("Mp0b"),C=n("Bpkj"),_=n("gdqT"),T=n("1ZqX"),R=n("YLtl");function S(e){if(!e)return!1;const t=e.trim();if(!t)return!1;if(/^\S+:/.test(t)){const e=Object(x.getProtocol)(t);if(!Object(x.isValidProtocol)(e))return!1;if(Object(R.startsWith)(e,"http")&&!/^https?:\/\/[^\/\s]/i.test(t))return!1;const n=Object(x.getAuthority)(t);if(!Object(x.isValidAuthority)(n))return!1;const c=Object(x.getPath)(t);if(c&&!Object(x.isValidPath)(c))return!1;const r=Object(x.getQueryString)(t);if(r&&!Object(x.isValidQueryString)(r))return!1;const o=Object(x.getFragment)(t);if(o&&!Object(x.isValidFragment)(o))return!1}return!(Object(R.startsWith)(t,"#")&&!Object(x.isValidFragment)(t))}function F(e,t,n,c,r){let o=t;const a={forwards:1,backwards:-1}[r]||1,i=-1*a;for(;e[o]&&e[o][c]===n;)o+=a;return o+=i,o}const A=Object(R.partialRight)(F,"backwards"),M=Object(R.partialRight)(F,"forwards"),P=new WeakMap;let N=-1;function I(e){return"link-control-instance-"+e}var B=function(e){return P.has(e)?I(P.get(e)):(N+=1,P.set(e,N),I(N))};var V=Object(h.withSpokenMessages)((function({isActive:e,activeAttributes:t,addingLink:n,value:i,onChange:l,speak:s,stopAddingLink:u,contentRef:b}){const m=function(e,t){let n=e.start,r=e.end;if(t){const t=function(e,t,n=e.start,c=e.end){const r={start:null,end:null},{formats:o}=e;let a,i;if(null==o||!o.length)return r;const l=o.slice(),s=Object(R.find)(l[n],{type:t.type}),u=Object(R.find)(l[c],{type:t.type}),b=Object(R.find)(l[c-1],{type:t.type});if(s)a=s,i=n;else if(u)a=u,i=c;else{if(!b)return r;a=b,i=c-1}const m=l[i].indexOf(a),p=[l,i,a,m];return{start:n=(n=A(...p))<0?0:n,end:c=M(...p)}}(e,{type:"core/link"});n=t.start,r=t.end+1}return Object(c.slice)(e,n,r)}(i,e).text,[p,j]=Object(r.useState)(),{createPageEntity:O,userCanCreatePages:d}=Object(T.useSelect)(e=>{const{getSettings:t}=e(a.store),n=t();return{createPageEntity:n.__experimentalCreatePageEntity,userCanCreatePages:n.__experimentalUserCanCreatePages}},[]),g={url:t.url,type:t.type,id:t.id,opensInNewTab:"_blank"===t.target,title:m,...p},v=Object(c.useAnchorRef)({ref:b,value:i,settings:H}),f=B(v),w=Object(r.useRef)(!!n&&"firstElement");return Object(r.createElement)(h.Popover,{anchorRef:v,focusOnMount:w.current,onClose:u,position:"bottom center"},Object(r.createElement)(a.__experimentalLinkControl,{key:f,value:g,onChange:function(t){t={...p,...t};const n=g.opensInNewTab!==t.opensInNewTab&&g.url===t.url,r=n&&void 0===t.url;if(j(r?t:void 0),r)return;const a=Object(x.prependHTTP)(t.url),b=function({url:e,type:t,id:n,opensInNewWindow:c}){const r={type:"core/link",attributes:{url:e}};return t&&(r.attributes.type=t),n&&(r.attributes.id=n),c&&(r.attributes.target="_blank",r.attributes.rel="noreferrer noopener"),r}({url:a,type:t.type,id:void 0!==t.id&&null!==t.id?String(t.id):void 0,opensInNewWindow:t.opensInNewTab}),h=t.title||a;if(Object(c.isCollapsed)(i)&&!e){const e=Object(c.applyFormat)(Object(c.create)({text:h}),b,0,h.length);l(Object(c.insert)(i,e))}else{let e;h===m?e=Object(c.applyFormat)(i,b):(e=Object(c.create)({text:h}),e=Object(c.applyFormat)(e,b,0,h.length),e=Object(c.replace)(i,m,e)),e.start=e.end,e.activeFormats=[],l(e)}n||u(),S(a)?s(e?Object(o.__)("Link edited."):Object(o.__)("Link inserted."),"assertive"):s(Object(o.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive")},onRemove:function(){const e=Object(c.removeFormat)(i,"core/link");l(e),u(),s(Object(o.__)("Link removed."),"assertive")},forceIsEditingLink:n,hasRichPreviews:!0,createSuggestion:O&&async function(e){const t=await O({title:e,status:"draft"});return{id:t.id,type:t.type,title:t.title.rendered,url:t.link,kind:"post-type"}},withCreateSuggestion:d,createSuggestionButtonText:function(e){return Object(r.createInterpolateElement)(Object(o.sprintf)(Object(o.__)("Create Page: <mark>%s</mark>"),e),{mark:Object(r.createElement)("mark",null)})},hasTextControl:!0}))}));const z=Object(o.__)("Link");const H={name:"core/link",title:z,tagName:"a",className:null,attributes:{url:"href",type:"data-type",id:"data-id",target:"target"},__unstablePasteRule(e,{html:t,plainText:n}){if(Object(c.isCollapsed)(e))return e;const r=(t||n).replace(/<[^>]+>/g,"").trim();return Object(x.isURL)(r)?(window.console.log("Created link:\n\n",r),Object(c.applyFormat)(e,{type:"core/link",attributes:{url:Object(k.decodeEntities)(r)}})):e},edit:function({isActive:e,activeAttributes:t,value:n,onChange:i,onFocus:l,contentRef:s}){const[u,b]=Object(r.useState)(!1);function m(){const e=Object(c.getTextContent)(Object(c.slice)(n));e&&Object(x.isURL)(e)&&S(e)?i(Object(c.applyFormat)(n,{type:"core/link",attributes:{url:e}})):e&&Object(x.isEmail)(e)?i(Object(c.applyFormat)(n,{type:"core/link",attributes:{url:"mailto:"+e}})):b(!0)}function p(){i(Object(c.removeFormat)(n,"core/link")),Object(_.speak)(Object(o.__)("Link removed."),"assertive")}return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RichTextShortcut,{type:"primary",character:"k",onUse:m}),Object(r.createElement)(a.RichTextShortcut,{type:"primaryShift",character:"k",onUse:p}),e&&Object(r.createElement)(a.RichTextToolbarButton,{name:"link",icon:E.a,title:Object(o.__)("Unlink"),onClick:p,isActive:e,shortcutType:"primaryShift",shortcutCharacter:"k"}),!e&&Object(r.createElement)(a.RichTextToolbarButton,{name:"link",icon:C.a,title:z,onClick:m,isActive:e,shortcutType:"primary",shortcutCharacter:"k"}),(u||e)&&Object(r.createElement)(V,{addingLink:u,stopAddingLink:function(){b(!1),l()},isActive:e,activeAttributes:t,value:n,onChange:i,contentRef:s}))}};var L=n("Crq9");const G=Object(o.__)("Strikethrough"),q={name:"core/strikethrough",title:G,tagName:"s",className:null,edit:({isActive:e,value:t,onChange:n,onFocus:o})=>Object(r.createElement)(a.RichTextToolbarButton,{icon:L.a,title:G,onClick:function(){n(Object(c.toggleFormat)(t,{type:"core/strikethrough",title:G})),o()},isActive:e,role:"menuitemcheckbox"})},U=Object(o.__)("Underline"),W={name:"core/underline",title:U,tagName:"span",className:null,attributes:{style:"style"},edit({value:e,onChange:t}){const n=()=>{t(Object(c.toggleFormat)(e,{type:"core/underline",attributes:{style:"text-decoration: underline;"},title:U}))};return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RichTextShortcut,{type:"primary",character:"u",onUse:n}),Object(r.createElement)(a.__unstableRichTextInputEvent,{inputType:"formatUnderline",onInput:n}))}};var D=n("iClF");var Q=Object(r.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(i.Path,{d:"M12.9 6h-2l-4 11h1.9l1.1-3h4.2l1.1 3h1.9L12.9 6zm-2.5 6.5l1.5-4.9 1.7 4.9h-3.2z"}));function Y(e=""){return e.split(";").reduce((e,t)=>{if(t){const[n,c]=t.split(":");"color"===n&&(e.color=c),"background-color"===n&&(e.backgroundColor=c)}return e},{})}function $(e="",t){return e.split(" ").reduce((e,n)=>{if(n.match(/^has-([^-]+)-color$/)){const[,c]=n.match(/^has-([^-]+)-color$/),r=Object(a.getColorObjectByAttributeValues)(t,c);e.color=r.color}return e},{})}function X(e,t,n){const r=Object(c.getActiveFormat)(e,t);return r?{...Y(r.attributes.style),...$(r.attributes.class,n)}:{}}function Z({name:e,property:t,value:n,onChange:o}){const i=Object(T.useSelect)(e=>{const{getSettings:t}=e(a.store);return Object(R.get)(t(),["colors"],[])},[]),l=Object(r.useCallback)(r=>{o(function(e,t,n,r){const{color:o,backgroundColor:i}={...X(e,t,n),...r};if(!o&&!i)return Object(c.removeFormat)(e,t);const l=[],s=[],u={};if(i?l.push(["background-color",i].join(":")):l.push(["background-color","rgba(0, 0, 0, 0)"].join(":")),o){const e=Object(a.getColorObjectByColorValue)(n,o);e?s.push(Object(a.getColorClassName)("color",e.slug)):l.push(["color",o].join(":"))}return l.length&&(u.style=l.join(";")),s.length&&(u.class=s.join(" ")),Object(c.applyFormat)(e,{type:t,attributes:u})}(n,e,i,{[t]:r}))},[i,o,t]),s=Object(r.useMemo)(()=>X(n,e,i),[e,n,i]);return Object(r.createElement)(a.ColorPalette,{value:s[t],onChange:l})}function K({name:e,value:t,onChange:n,onClose:i,contentRef:l}){const s=Object(a.useCachedTruthy)(Object(c.useAnchorRef)({ref:l,value:t,settings:ne}));return Object(r.createElement)(h.Popover,{onClose:i,className:"components-inline-color-popover",anchorRef:s},Object(r.createElement)(h.TabPanel,{tabs:[{name:"color",title:Object(o.__)("Text")},{name:"backgroundColor",title:Object(o.__)("Background")}]},c=>Object(r.createElement)(Z,{name:e,property:c.name,value:t,onChange:n})))}const J=Object(o.__)("Highlight"),ee=[];function te(e,t){const{ownerDocument:n}=e,{defaultView:c}=n,r=c.getComputedStyle(e).getPropertyValue(t);return"background-color"===t&&"rgba(0, 0, 0, 0)"===r&&e.parentElement?te(e.parentElement,t):r}const ne={name:"core/text-color",title:J,tagName:"mark",className:"has-inline-color",attributes:{style:"style",class:"class"},__unstableFilterAttributeValue(e,t){if("style"!==e)return t;if(t&&t.includes("background-color"))return t;const n=["background-color","rgba(0, 0, 0, 0)"].join(":");return t?[n,t].join(";"):n},edit:function({value:e,onChange:t,isActive:n,activeAttributes:o,contentRef:i}){const l=Object(a.useSetting)("color.custom"),s=Object(a.useSetting)("color.palette")||ee,[u,b]=Object(r.useState)(!1),m=Object(r.useCallback)(()=>b(!0),[b]),p=Object(r.useCallback)(()=>b(!1),[b]),h=Object(r.useMemo)(()=>function(e,{color:t,backgroundColor:n}){if(t||n)return{color:t||te(e,"color"),backgroundColor:"rgba(0, 0, 0, 0)"===n?te(e,"background-color"):n}}(i.current,X(e,"core/text-color",s)),[e,s]),j=!Object(R.isEmpty)(s)||!l;return j||n?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RichTextToolbarButton,{className:"format-library-text-color-button",isActive:n,icon:Object(r.createElement)(D.a,{icon:Q,style:h}),title:J,onClick:j?m:()=>t(Object(c.removeFormat)(e,"core/text-color")),role:"menuitemcheckbox"}),u&&Object(r.createElement)(K,{name:"core/text-color",onClose:p,activeAttributes:o,value:e,onChange:t,contentRef:i})):null}};var ce=Object(r.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(i.Path,{d:"M16.9 18.3l.8-1.2c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.1-.3-.4-.5-.6-.7-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.2 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3L15 19.4h4.3v-1.2h-2.4zM14.1 7.2h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"}));const re=Object(o.__)("Subscript"),oe={name:"core/subscript",title:re,tagName:"sub",className:null,edit:({isActive:e,value:t,onChange:n,onFocus:o})=>Object(r.createElement)(a.RichTextToolbarButton,{icon:ce,title:re,onClick:function(){n(Object(c.toggleFormat)(t,{type:"core/subscript",title:re})),o()},isActive:e,role:"menuitemcheckbox"})};var ae=Object(r.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(i.Path,{d:"M16.9 10.3l.8-1.3c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.2-.2-.4-.4-.7-.6-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.1 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3l-1.8 2.8h4.3v-1.2h-2.2zm-2.8-3.1h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"}));const ie=Object(o.__)("Superscript"),le={name:"core/superscript",title:ie,tagName:"sup",className:null,edit:({isActive:e,value:t,onChange:n,onFocus:o})=>Object(r.createElement)(a.RichTextToolbarButton,{icon:ae,title:ie,onClick:function(){n(Object(c.toggleFormat)(t,{type:"core/superscript",title:ie})),o()},isActive:e,role:"menuitemcheckbox"})};var se=n("oMoS");const ue=Object(o.__)("Keyboard input");[u,p,g,y,H,q,W,ne,oe,le,{name:"core/keyboard",title:ue,tagName:"kbd",className:null,edit:({isActive:e,value:t,onChange:n,onFocus:o})=>Object(r.createElement)(a.RichTextToolbarButton,{icon:se.a,title:ue,onClick:function(){n(Object(c.toggleFormat)(t,{type:"core/keyboard",title:ue})),o()},isActive:e,role:"menuitemcheckbox"})}].forEach(({name:e,...t})=>Object(c.registerFormatType)(e,t))},"tI+e":function(e,t){e.exports=window.wp.components}});