WordPress/wp-includes/js/dist/rich-text.min.js
jorgefilipecosta 61ddc8d582 Block Editor: Update WordPress Packages WordPress 5.4 RC 4.
The following package versions were changed:
@wordpress/annotations: 1.12.1 -> 1.12.2
@wordpress/block-directory: 1.5.5 -> 1.5.6
@wordpress/block-editor: 3.7.5 -> 3.7.6
@wordpress/block-library: 2.14.5 -> 2.14.6
@wordpress/blocks: 6.12.1 -> 6.12.2
@wordpress/components: 9.2.4 -> 9.2.5
@wordpress/core-data: 2.12.1 -> 2.12.2
@wordpress/data: 4.14.1 -> 4.14.2
@wordpress/data-controls: 1.8.1 -> 1.8.2
@wordpress/edit-post: 3.13.6 -> 3.13.7
@wordpress/editor: 9.12.5 -> 9.12.6
@wordpress/format-library: 1.14.5 -> 1.14.6
@wordpress/keyboard-shortcuts: 1.1.1 -> 1.1.2
@wordpress/list-reusable-blocks: 1.13.4 -> 1.13.5
@wordpress/notices: 2.0.1 -> 2.0.2
@wordpress/nux: 3.12.4 -> 3.12.5
@wordpress/rich-text: 3.12.1 -> 3.12.2
@wordpress/server-side-render: 1.8.4 -> 1.8.5
@wordpress/viewport: 2.13.1 -> 2.13.2
Description of editor changes included in the RC available at https://github.com/WordPress/gutenberg/pull/21083.

Props itsjonq, mcsf, aduth.
Fixes: #49688.
Built from https://develop.svn.wordpress.org/trunk@47495


git-svn-id: http://core.svn.wordpress.org/trunk@47270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-23 23:40:19 +00:00

7 lines
54 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.richText=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=424)}({0:function(e,t){!function(){e.exports=this.wp.element}()},11:function(e,t,r){var n;
/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)&&n.length){var i=o.apply(null,n);i&&e.push(i)}else if("object"===a)for(var c in n)r.call(n,c)&&n[c]&&e.push(c)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},12:function(e,t,r){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}r.d(t,"a",(function(){return n}))},13:function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}r.d(t,"a",(function(){return o}))},14:function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.d(t,"a",(function(){return n}))},15:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(34),o=r(7);function a(e,t){return!t||"object"!==Object(n.a)(t)&&"function"!=typeof t?Object(o.a)(e):t}},16:function(e,t,r){"use strict";function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}r.d(t,"a",(function(){return n}))},17:function(e,t,r){"use strict";function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}r.d(t,"a",(function(){return o}))},18:function(e,t,r){"use strict";var n=r(25);var o=r(35),a=r(27);function i(e){return function(e){if(Array.isArray(e))return Object(n.a)(e)}(e)||Object(o.a)(e)||Object(a.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}r.d(t,"a",(function(){return i}))},2:function(e,t){!function(){e.exports=this.lodash}()},22:function(e,t){!function(){e.exports=this.wp.keycodes}()},25:function(e,t,r){"use strict";function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}r.d(t,"a",(function(){return n}))},27:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(25);function o(e,t){if(e){if("string"==typeof e)return Object(n.a)(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Object(n.a)(e,t):void 0}}},34:function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}r.d(t,"a",(function(){return n}))},35:function(e,t,r){"use strict";function n(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}r.d(t,"a",(function(){return n}))},37:function(e,t){!function(){e.exports=this.wp.deprecated}()},4:function(e,t){!function(){e.exports=this.wp.data}()},40:function(e,t,r){"use strict";var n,o;function a(e){return[e]}function i(){var e={clear:function(){e.head=null}};return e}function c(e,t,r){var n;if(e.length!==t.length)return!1;for(n=r;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}n={},o="undefined"!=typeof WeakMap,t.a=function(e,t){var r,s;function u(){r=o?new WeakMap:i()}function l(){var r,n,o,a,i,u=arguments.length;for(a=new Array(u),o=0;o<u;o++)a[o]=arguments[o];for(i=t.apply(null,a),(r=s(i)).isUniqueByDependants||(r.lastDependants&&!c(i,r.lastDependants,0)&&r.clear(),r.lastDependants=i),n=r.head;n;){if(c(n.args,a,1))return n!==r.head&&(n.prev.next=n.next,n.next&&(n.next.prev=n.prev),n.next=r.head,n.prev=null,r.head.prev=n,r.head=n),n.val;n=n.next}return n={val:e.apply(null,a)},a[0]=null,n.args=a,r.head&&(r.head.prev=n,n.next=r.head),r.head=n,n.val}return t||(t=a),s=o?function(e){var t,o,a,c,s,u=r,l=!0;for(t=0;t<e.length;t++){if(o=e[t],!(s=o)||"object"!=typeof s){l=!1;break}u.has(o)?u=u.get(o):(a=new WeakMap,u.set(o,a),u=a)}return u.has(n)||((c=i()).isUniqueByDependants=l,u.set(n,c)),u.get(n)}:function(){return r},l.getDependants=t,l.clear=u,u(),l}},424:function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"getFormatTypes",(function(){return f})),r.d(n,"getFormatType",(function(){return p})),r.d(n,"getFormatTypeForBareElement",(function(){return d})),r.d(n,"getFormatTypeForClassName",(function(){return h}));var o={};r.r(o),r.d(o,"addFormatTypes",(function(){return b})),r.d(o,"removeFormatTypes",(function(){return m}));var a=r(4),i=r(5),c=r(2);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var u=Object(a.combineReducers)({formatTypes:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_FORMAT_TYPES":return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{},Object(c.keyBy)(t.formatTypes,"name"));case"REMOVE_FORMAT_TYPES":return Object(c.omit)(e,t.names)}return e}}),l=r(40),f=Object(l.a)((function(e){return Object.values(e.formatTypes)}),(function(e){return[e.formatTypes]}));function p(e,t){return e.formatTypes[t]}function d(e,t){return Object(c.find)(f(e),(function(e){var r=e.className,n=e.tagName;return null===r&&t===n}))}function h(e,t){return Object(c.find)(f(e),(function(e){var r=e.className;return null!==r&&" ".concat(t," ").indexOf(" ".concat(r," "))>=0}))}function b(e){return{type:"ADD_FORMAT_TYPES",formatTypes:Object(c.castArray)(e)}}function m(e){return{type:"REMOVE_FORMAT_TYPES",names:Object(c.castArray)(e)}}Object(a.registerStore)("core/rich-text",{reducer:u,selectors:n,actions:o});var v=r(18);function g(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.type!==t.type)return!1;var r=e.attributes,n=t.attributes;if(r===n)return!0;if(!r||!n)return!1;var o=Object.keys(r),a=Object.keys(n);if(o.length!==a.length)return!1;for(var i=o.length,c=0;c<i;c++){var s=o[c];if(r[s]!==n[s])return!1}return!0}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){var t=e.formats.slice();return t.forEach((function(e,r){var n=t[r-1];if(n){var o=e.slice();o.forEach((function(e,t){var r=n[t];g(e,r)&&(o[t]=r)})),t[r]=o}})),function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{formats:t})}function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e,t,r){return(e=e.slice())[t]=r,e}function T(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.start,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.end,o=e.formats,a=e.activeFormats,s=o.slice();if(r===n){var u=Object(c.find)(s[r],{type:t.type});if(u){for(var l=s[r].indexOf(u);s[r]&&s[r][l]===u;)s[r]=w(s[r],l,t),r--;for(n++;s[n]&&s[n][l]===u;)s[n]=w(s[n],l,t),n++}}else{for(var f=1/0,p=r;p<n;p++)if(s[p]){s[p]=s[p].filter((function(e){return e.type!==t.type}));var d=s[p].length;d<f&&(f=d)}else s[p]=[],f=0;for(var h=r;h<n;h++)s[h].splice(f,0,t)}return O(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{formats:s,activeFormats:[].concat(Object(v.a)(Object(c.reject)(a,{type:t.type})),[t])}))}var E=r(34);function x(e,t){var r=e.implementation;return x.body||(x.body=r.createHTMLDocument("").body),x.body.innerHTML=t,x.body}var P="\u2028",_="",S="\ufeff";function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var D=window.Node,F=D.TEXT_NODE,N=D.ELEMENT_NODE;function A(e,t){for(var r in e)if(e[r]===t)return r}function k(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.element,r=e.text,n=e.html,o=e.range,a=e.multilineTag,i=e.multilineWrapperTags,c=e.__unstableIsEditableTree,s=e.preserveWhiteSpace;return"string"==typeof r&&r.length>0?{formats:Array(r.length),replacements:Array(r.length),text:r}:("string"==typeof n&&n.length>0&&(t=x(document,n)),"object"!==Object(E.a)(t)?{formats:[],replacements:[],text:""}:a?M({element:t,range:o,multilineTag:a,multilineWrapperTags:i,isEditableTree:c,preserveWhiteSpace:s}):W({element:t,range:o,isEditableTree:c,preserveWhiteSpace:s}))}function R(e,t,r,n){if(r){var o=t.parentNode,a=r.startContainer,i=r.startOffset,c=r.endContainer,s=r.endOffset,u=e.text.length;void 0!==n.start?e.start=u+n.start:t===a&&t.nodeType===F?e.start=u+i:o===a&&t===a.childNodes[i]?e.start=u:o===a&&t===a.childNodes[i-1]?e.start=u+n.text.length:t===a&&(e.start=u),void 0!==n.end?e.end=u+n.end:t===c&&t.nodeType===F?e.end=u+s:o===c&&t===c.childNodes[s-1]?e.end=u+n.text.length:o===c&&t===c.childNodes[s]?e.end=u:t===c&&(e.end=u+s)}}var I=new RegExp(S,"g");function L(e){return e.replace(I,"")}function W(e){var t=e.element,r=e.range,n=e.multilineTag,o=e.multilineWrapperTags,c=e.currentWrapperTags,s=void 0===c?[]:c,u=e.isEditableTree,l=e.preserveWhiteSpace,f={formats:[],replacements:[],text:""};if(!t)return f;if(!t.hasChildNodes())return R(f,t,r,{formats:[],replacements:[],text:""}),f;for(var p=t.childNodes.length,d=function(e){var c=t.childNodes[e],p=c.nodeName.toLowerCase();if(c.nodeType===F){var d=L;l||(d=function(e){return L(function(e){return e.replace(/[\n\r\t]+/g," ")}(e))});var h=d(c.nodeValue);return r=function(e,t,r){if(t){var n=t.startContainer,o=t.endContainer,a=t.startOffset,i=t.endOffset;return e===n&&(a=r(e.nodeValue.slice(0,a)).length),e===o&&(i=r(e.nodeValue.slice(0,i)).length),{startContainer:n,startOffset:a,endContainer:o,endOffset:i}}}(c,r,d),R(f,c,r,{text:h}),f.formats.length+=h.length,f.replacements.length+=h.length,f.text+=h,"continue"}if(c.nodeType!==N)return"continue";if(u&&(c.getAttribute("data-rich-text-placeholder")||"br"===p&&!c.getAttribute("data-rich-text-line-break")))return R(f,c,r,{formats:[],replacements:[],text:""}),"continue";if("br"===p)return R(f,c,r,{formats:[],replacements:[],text:""}),K(f,k({text:"\n"})),"continue";var b=f.formats[f.formats.length-1],m=b&&b[b.length-1],y=function(e){var t,r=e.type,n=e.attributes;if(n&&n.class&&(t=Object(a.select)("core/rich-text").getFormatTypeForClassName(n.class))&&(n.class=" ".concat(n.class," ").replace(" ".concat(t.className," ")," ").trim(),n.class||delete n.class),t||(t=Object(a.select)("core/rich-text").getFormatTypeForBareElement(r)),!t)return n?{type:r,attributes:n}:{type:r};if(t.__experimentalCreatePrepareEditableTree&&!t.__experimentalCreateOnChangeEditableValue)return null;if(!n)return{type:t.name};var o={},i={};for(var c in n){var s=A(t.attributes,c);s?o[s]=n[c]:i[c]=n[c]}return{type:t.name,attributes:o,unregisteredAttributes:i}}({type:p,attributes:H({element:c})}),O=g(y,m)?m:y;if(o&&-1!==o.indexOf(p)){var j=M({element:c,range:r,multilineTag:n,multilineWrapperTags:o,currentWrapperTags:[].concat(Object(v.a)(s),[O]),isEditableTree:u,preserveWhiteSpace:l});return R(f,c,r,j),K(f,j),"continue"}var w=W({element:c,range:r,multilineTag:n,multilineWrapperTags:o,isEditableTree:u,preserveWhiteSpace:l});if(R(f,c,r,w),O)if(0===w.text.length)O.attributes&&K(f,{formats:[,],replacements:[O],text:_});else{function T(e){if(T.formats===e)return T.newFormats;var t=e?[O].concat(Object(v.a)(e)):[O];return T.formats=e,T.newFormats=t,t}T.newFormats=[O],K(f,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},w,{formats:Array.from(w.formats,T)}))}else K(f,w)},h=0;h<p;h++)d(h);return f}function M(e){var t=e.element,r=e.range,n=e.multilineTag,o=e.multilineWrapperTags,a=e.currentWrapperTags,i=void 0===a?[]:a,c=e.isEditableTree,s=e.preserveWhiteSpace,u={formats:[],replacements:[],text:""};if(!t||!t.hasChildNodes())return u;for(var l=t.children.length,f=0;f<l;f++){var p=t.children[f];if(p.nodeName.toLowerCase()===n){var d=W({element:p,range:r,multilineTag:n,multilineWrapperTags:o,currentWrapperTags:i,isEditableTree:c,preserveWhiteSpace:s});(0!==f||i.length>0)&&K(u,{formats:[,],replacements:i.length>0?[i]:[,],text:P}),R(u,p,r,d),K(u,d)}}return u}function H(e){var t=e.element;if(t.hasAttributes()){for(var r,n=t.attributes.length,o=0;o<n;o++){var a=t.attributes[o],i=a.name,c=a.value;0!==i.indexOf("data-rich-text-")&&((r=r||{})[i]=c)}return r}}function K(e,t){return e.formats=e.formats.concat(t.formats),e.replacements=e.replacements.concat(t.replacements),e.text+=t.text,e}function V(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return O(t.reduce(K,k()))}function B(e){var t=e.formats,r=e.start,n=e.end,o=e.activeFormats,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(void 0===r)return a;if(r===n){if(o)return o;var i=t[r-1]||a,c=t[r]||a;return i.length<c.length?i:c}return t[r]||a}function U(e,t){return Object(c.find)(B(e),{type:t})}function z(e){var t=e.start,r=e.end,n=e.replacements,o=e.text;if(t+1===r&&o[t]===_)return n[t]}function q(e){return e.text}function G(e){for(var t=e.start,r=e.text,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;n--;)if(r[n]===P)return n}function Y(e){var t=e.replacements[G(e,e.start)];return!t||t.length<1}function $(e,t,r){var n=e.replacements[G(e,e.start)];return n&&0!==n.length?n[n.length-1].type===t:t===r}function X(e){var t=e.start,r=e.end;if(void 0!==t&&void 0!==r)return t===r}function Z(e){return 0===e.text.length}function J(e){var t=e.text,r=e.start,n=e.end;return r===n&&(0===t.length||(0===r&&t.slice(0,1)===P||(r===t.length&&t.slice(-1)===P||t.slice(r-1,n+1)==="".concat(P).concat(P))))}function Q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"string"==typeof t&&(t=k({text:t})),O(e.reduce((function(e,r){var n=r.formats,o=r.replacements,a=r.text;return{formats:e.formats.concat(t.formats,n),replacements:e.replacements.concat(t.replacements,o),text:e.text+t.text+a}})))}function ee(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function te(e,t){if("string"==typeof(t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ee(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({name:e},t)).name)if(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(t.name))if(Object(a.select)("core/rich-text").getFormatType(t.name))window.console.error('Format "'+t.name+'" is already registered.');else if("string"==typeof t.tagName&&""!==t.tagName)if("string"==typeof t.className&&""!==t.className||null===t.className)if(/^[_a-zA-Z]+[a-zA-Z0-9-]*$/.test(t.className)){if(null===t.className){var r=Object(a.select)("core/rich-text").getFormatTypeForBareElement(t.tagName);if(r)return void window.console.error('Format "'.concat(r.name,'" is already registered to handle bare tag name "').concat(t.tagName,'".'))}else{var n=Object(a.select)("core/rich-text").getFormatTypeForClassName(t.className);if(n)return void window.console.error('Format "'.concat(n.name,'" is already registered to handle class name "').concat(t.className,'".'))}if("title"in t&&""!==t.title)if("keywords"in t&&t.keywords.length>3)window.console.error('The format "'+t.name+'" can have a maximum of 3 keywords.');else{if("string"==typeof t.title)return Object(a.dispatch)("core/rich-text").addFormatTypes(t),t;window.console.error("Format titles must be strings.")}else window.console.error('The format "'+t.name+'" must have a title.')}else window.console.error("A class name must begin with a letter, followed by any number of hyphens, letters, or numbers.");else window.console.error("Format class names must be a string, or null to handle bare elements.");else window.console.error("Format tag names must be a string.");else window.console.error("Format names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-format");else window.console.error("Format names must be strings.")}function re(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ne(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.start,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.end,o=e.formats,a=e.activeFormats,s=o.slice();if(r===n){var u=Object(c.find)(s[r],{type:t});if(u){for(;Object(c.find)(s[r],u);)oe(s,r,t),r--;for(n++;Object(c.find)(s[n],u);)oe(s,n,t),n++}}else for(var l=r;l<n;l++)s[l]&&oe(s,l,t);return O(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?re(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):re(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{formats:s,activeFormats:Object(c.reject)(a,{type:t})}))}function oe(e,t,r){var n=e[t].filter((function(e){return e.type!==r}));n.length?e[t]=n:delete e[t]}function ae(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.start,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.end,o=e.formats,a=e.replacements,i=e.text;"string"==typeof t&&(t=k({text:t}));var c=r+t.text.length;return O({formats:o.slice(0,r).concat(t.formats,o.slice(n)),replacements:a.slice(0,r).concat(t.replacements,a.slice(n)),text:i.slice(0,r)+t.text+i.slice(n),start:c,end:c})}function ie(e,t,r){return ae(e,k(),t,r)}function ce(e,t,r){var n=e.formats,o=e.replacements,a=e.text,i=e.start,c=e.end;return a=a.replace(t,(function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),s=1;s<t;s++)a[s-1]=arguments[s];var u,l,f=a[a.length-2],p=r;return"function"==typeof p&&(p=r.apply(void 0,[e].concat(a))),"object"===Object(E.a)(p)?(u=p.formats,l=p.replacements,p=p.text):(u=Array(p.length),l=Array(p.length),n[f]&&(u=u.fill(n[f]))),n=n.slice(0,f).concat(u,n.slice(f+e.length)),o=o.slice(0,f).concat(l,o.slice(f+e.length)),i&&(i=c=f+p.length),p})),O({formats:n,replacements:o,text:a,start:i,end:c})}function se(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.start,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.end,n=q(e).slice(0,t).lastIndexOf(P),o=e.replacements[n],a=[,];return o&&(a=[o]),ae(e,{formats:[,],replacements:a,text:P},t,r)}function ue(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function le(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.replacements,n=e.text,o=e.start,a=e.end,c=X(e),s=o-1,u=c?o-1:o,l=a;if(t||(s=a,u=o,l=c?a+1:a),n[s]===P){var f;if(c&&r[s]&&r[s].length){var p=r.slice();p[s]=r[s].slice(0,-1),f=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ue(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{replacements:p})}else f=ie(e,u,l);return f}}var fe="";function pe(e,t,r,n){return ae(e,{formats:[,],replacements:[t],text:fe},r,n)}function de(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function he(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.start,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.end,n=e.formats,o=e.replacements,a=e.text;return void 0===t||void 0===r?function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?de(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):de(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e):{formats:n.slice(t,r),replacements:o.slice(t,r),text:a.slice(t,r)}}function be(e,t){var r=e.formats,n=e.replacements,o=e.text,a=e.start,i=e.end;if("string"!=typeof t)return me.apply(void 0,arguments);var c=0;return o.split(t).map((function(e){var o=c,s={formats:r.slice(o,o+e.length),replacements:n.slice(o,o+e.length),text:e};return c+=t.length+e.length,void 0!==a&&void 0!==i&&(a>=o&&a<c?s.start=a-o:a<o&&i>o&&(s.start=0),i>=o&&i<c?s.end=i-o:a<c&&i>c&&(s.end=e.length)),s}))}function me(e){var t=e.formats,r=e.replacements,n=e.text,o=e.start,a=e.end,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a,s={formats:t.slice(0,i),replacements:r.slice(0,i),text:n.slice(0,i)},u={formats:t.slice(c),replacements:r.slice(c),text:n.slice(c),start:0,end:0};return[ce(s,/\u2028+$/,""),ce(u,/^\u2028+/,"")]}function ve(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ge(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ve(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ve(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ye(e){var t=e.type,r=e.attributes,n=e.unregisteredAttributes,o=e.object,i=e.boundaryClass,c=function(e){return Object(a.select)("core/rich-text").getFormatType(e)}(t),s={};if(i&&(s["data-rich-text-format-boundary"]="true"),!c)return r&&(s=ge({},r,{},s)),{type:t,attributes:s,object:o};for(var u in s=ge({},n,{},s),r){var l=!!c.attributes&&c.attributes[u];l?s[l]=r[u]:s[u]=r[u]}return c.className&&(s.class?s.class="".concat(c.className," ").concat(s.class):s.class=c.className),{type:c.tagName,object:c.object,attributes:s}}function Oe(e){var t,r,n,o=e.value,a=e.multilineTag,i=e.preserveWhiteSpace,c=e.createEmpty,s=e.append,u=e.getLastChild,l=e.getParent,f=e.isText,p=e.getText,d=e.remove,h=e.appendText,b=e.onStartIndex,m=e.onEndIndex,g=e.isEditableTree,y=e.placeholder,O=o.formats,j=o.replacements,w=o.text,T=o.start,E=o.end,x=O.length+1,C=c(),D={type:a},F=B(o),N=F[F.length-1];a?(s(s(C,{type:a}),""),r=t=[D]):s(C,"");for(var A=function(e){var o=w.charAt(e),c=g&&(!n||n===P||"\n"===n),x=O[e];a&&(x=o===P?t=(j[e]||[]).reduce((function(e,t){return e.push(t,D),e}),[D]):[].concat(Object(v.a)(t),Object(v.a)(x||[])));var F=u(C);if(c&&o===P){for(var A=F;!f(A);)A=u(A);s(l(A),S)}if(n===P){for(var k=F;!f(k);)k=u(k);b&&T===e&&b(C,k),m&&E===e&&m(C,k)}if(x&&x.forEach((function(e,t){if(F&&r&&function(e,t,r){do{if(e[r]!==t[r])return!1}while(r--);return!0}(x,r,t)&&(o!==P||x.length-1!==t))F=u(F);else{var n=e.type,a=e.attributes,i=e.unregisteredAttributes,c=g&&o!==P&&e===N,h=l(F),b=s(h,ye({type:n,attributes:a,unregisteredAttributes:i,boundaryClass:c}));f(F)&&0===p(F).length&&d(F),F=s(b,"")}})),o===P)return r=x,n=o,"continue";0===e&&(b&&0===T&&b(C,F),m&&0===E&&m(C,F)),o===_?(F=s(l(F),ye(ge({},j[e],{object:!0}))),F=s(l(F),"")):i||"\n"!==o?f(F)?h(F,o):F=s(l(F),o):(F=s(l(F),{type:"br",attributes:g?{"data-rich-text-line-break":"true"}:void 0,object:!0}),F=s(l(F),"")),b&&T===e+1&&b(C,F),m&&E===e+1&&m(C,F),c&&e===w.length&&(s(l(F),S),y&&0===w.length&&s(l(F),{type:"span",attributes:{"data-rich-text-placeholder":y,contenteditable:"false"}})),r=x,n=o},k=0;k<x;k++)A(k);return C}function je(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var we=window.Node.TEXT_NODE;function Te(e,t,r){for(var n=e.parentNode,o=0;e=e.previousSibling;)o++;return r=[o].concat(Object(v.a)(r)),n!==t&&(r=Te(n,t,r)),r}function Ee(e,t){for(t=Object(v.a)(t);e&&t.length>1;)e=e.childNodes[t.shift()];return{node:e,offset:t[0]}}var xe=function(){return x(document,"")};function Pe(e,t){"string"==typeof t&&(t=e.ownerDocument.createTextNode(t));var r=t,n=r.type,o=r.attributes;if(n)for(var a in t=e.ownerDocument.createElement(n),o)t.setAttribute(a,o[a]);return e.appendChild(t)}function _e(e,t){e.appendData(t)}function Se(e){return e.lastChild}function Ce(e){return e.parentNode}function De(e){return e.nodeType===we}function Fe(e){return e.nodeValue}function Ne(e){return e.parentNode.removeChild(e)}function Ae(e){var t=e.value,r=e.multilineTag,n=e.prepareEditableTree,o=e.isEditableTree,a=void 0===o||o,c=e.placeholder,s=[],u=[];return n&&(t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?je(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):je(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{formats:n(t)})),{body:Oe({value:t,multilineTag:r,createEmpty:xe,append:Pe,getLastChild:Se,getParent:Ce,isText:De,getText:Fe,remove:Ne,appendText:_e,onStartIndex:function(e,t){s=Te(t,e,[t.nodeValue.length])},onEndIndex:function(e,t){u=Te(t,e,[t.nodeValue.length])},isEditableTree:a,placeholder:c}),selection:{startPath:s,endPath:u}}}function ke(e){var t=e.value,r=e.current,n=e.multilineTag,o=e.prepareEditableTree,a=e.__unstableDomOnly,i=Ae({value:t,multilineTag:n,prepareEditableTree:o,placeholder:e.placeholder}),c=i.body,s=i.selection;!function e(t,r){var n=0;var o;for(;o=t.firstChild;){var a=r.childNodes[n];if(a)if(a.isEqualNode(o))t.removeChild(o);else if(a.nodeName!==o.nodeName||a.nodeType===we&&a.data!==o.data)r.replaceChild(o,a);else{var i=a.attributes,c=o.attributes;if(i)for(var s=i.length;s--;){var u=i[s].name;o.getAttribute(u)||a.removeAttribute(u)}if(c)for(var l=0;l<c.length;l++){var f=c[l],p=f.name,d=f.value;a.getAttribute(p)!==d&&a.setAttribute(p,d)}e(o,a),t.removeChild(o)}else r.appendChild(o);n++}for(;r.childNodes[n];)r.removeChild(r.childNodes[n])}(c,r),void 0===t.start||a||function(e,t){var r=e.startPath,n=e.endPath,o=Ee(t,r),a=o.node,i=o.offset,c=Ee(t,n),s=c.node,u=c.offset,l=window.getSelection(),f=t.ownerDocument,p=f.createRange();p.setStart(a,i),p.setEnd(s,u);var d=f.activeElement;if(l.rangeCount>0){if(h=p,b=l.getRangeAt(0),h.startContainer===b.startContainer&&h.startOffset===b.startOffset&&h.endContainer===b.endContainer&&h.endOffset===b.endOffset)return;l.removeAllRanges()}var h,b;l.addRange(p),d!==document.activeElement&&d instanceof window.HTMLElement&&d.focus()}(s,r)}var Re=r(68);function Ie(e){return ze(Oe({value:e.value,multilineTag:e.multilineTag,preserveWhiteSpace:e.preserveWhiteSpace,createEmpty:Le,append:Me,getLastChild:We,getParent:Ke,isText:Ve,getText:Be,remove:Ue,appendText:He}).children)}function Le(){return{}}function We(e){var t=e.children;return t&&t[t.length-1]}function Me(e,t){return"string"==typeof t&&(t={text:t}),t.parent=e,e.children=e.children||[],e.children.push(t),t}function He(e,t){e.text+=t}function Ke(e){return e.parent}function Ve(e){return"string"==typeof e.text}function Be(e){return e.text}function Ue(e){var t=e.parent.children.indexOf(e);return-1!==t&&e.parent.children.splice(t,1),e}function ze(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map((function(e){return void 0===e.text?function(e){var t=e.type,r=e.attributes,n=e.object,o=e.children,a="";for(var i in r)Object(Re.isValidAttributeName)(i)&&(a+=" ".concat(i,'="').concat(Object(Re.escapeAttribute)(r[i]),'"'));return n?"<".concat(t).concat(a,">"):"<".concat(t).concat(a,">").concat(ze(o),"</").concat(t,">")}(e):Object(Re.escapeEditableHTML)(e.text)})).join("")}function qe(e,t){return U(e,t.type)?ne(e,t.type):T(e,t)}function Ge(e){var t=Object(a.select)("core/rich-text").getFormatType(e);if(t)return Object(a.dispatch)("core/rich-text").removeFormatTypes(e),t;window.console.error("Format ".concat(e," is not registered."))}function Ye(e){var t=G(e);if(void 0===t)return!1;var r=e.replacements,n=G(e,t),o=r[t]||[],a=r[n]||[];return o.length<=a.length}function $e(e){return void 0!==e.replacements[G(e,e.start)]}function Xe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ze(e,t){if(!Ye(e))return e;for(var r=G(e),n=G(e,r),o=e.text,a=e.replacements,c=e.end,s=a.slice(),u=function(e,t){for(var r=e.text,n=e.replacements,o=n[t]||[],a=t;a-- >=0;)if(r[a]===P){var i=n[a]||[];if(i.length===o.length+1)return a;if(i.length<=o.length)return}}(e,r),l=r;l<c;l++)if(o[l]===P)if(u){var f=a[u]||[];s[l]=f.concat((s[l]||[]).slice(f.length-1))}else{var p=a[n]||[],d=p[p.length-1]||t;s[l]=p.concat([d],(s[l]||[]).slice(p.length))}return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xe(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{replacements:s})}function Je(e,t){for(var r=e.text,n=e.replacements,o=n[t]||[],a=t;a-- >=0;){if(r[a]===P)if((n[a]||[]).length===o.length-1)return a}}function Qe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function et(e){if(!$e(e))return e;for(var t=e.text,r=e.replacements,n=e.start,o=e.end,a=G(e,n),c=r.slice(0),s=r[Je(e,a)]||[],u=function(e,t){for(var r=e.text,n=e.replacements,o=n[t]||[],a=t,i=t||0;i<r.length;i++)if(r[i]===P){if(!((n[i]||[]).length>=o.length))return a;a=i}return a}(e,G(e,o)),l=a;l<=u;l++)if(t[l]===P){var f=c[l]||[];c[l]=s.concat(f.slice(s.length+1)),0===c[l].length&&delete c[l]}return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{replacements:c})}function tt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rt(e,t){for(var r,n=e.text,o=e.replacements,a=e.start,c=e.end,s=G(e,a),u=o[s]||[],l=o[G(e,c)]||[],f=Je(e,s),p=o.slice(),d=u.length-1,h=l.length-1,b=f+1||0;b<n.length;b++)if(n[b]===P){if((p[b]||[]).length<=d)break;p[b]&&(r=!0,p[b]=p[b].map((function(e,r){return r<d||r>h?e:t})))}return r?function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tt(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{replacements:p}):e}var nt=r(12),ot=r(14),at=r(13),it=r(15),ct=r(16),st=r(7),ut=r(17),lt=r(0),ft=r(11),pt=r.n(ft),dt=r(22),ht=r(8),bt=r(51),mt=r.n(bt),vt=r(37),gt=r.n(vt),yt=new Set(["a","audio","button","details","embed","iframe","input","label","select","textarea","video"]);function Ot(e){var t=e.formatTypes,r=e.onChange,n=e.onFocus,o=e.value,a=e.allowedFormats,i=e.withoutInteractiveFormatting;return t.map((function(e){var t=e.name,c=e.edit,s=e.tagName;if(!c)return null;if(a&&-1===a.indexOf(t))return null;if(i&&yt.has(s))return null;var u=U(o,t),l=void 0!==u,f=z(o),p=void 0!==f&&f.type===t;return Object(lt.createElement)(c,{key:t,isActive:l,activeAttributes:l&&u.attributes||{},isObjectActive:p,activeObjectAttributes:p&&f.attributes||{},value:o,onChange:r,onFocus:n})}))}function jt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jt(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Tt(e){return e("core/rich-text").getFormatTypes()}var Et=document.createElement("style"),xt="*[data-rich-text-format-boundary]";function Pt(e){var t=e.activeFormats,r=e.forwardedRef;return Object(lt.useEffect)((function(){if(t&&t.length){var e=r.current.querySelector(xt);if(e){var n=window.getComputedStyle(e).color.replace(")",", 0.2)").replace("rgb","rgba"),o=".rich-text:focus ".concat(xt),a="background-color: ".concat(n),i="".concat(o," {").concat(a,"}");Et.innerHTML!==i&&(Et.innerHTML=i)}}}),[t]),null}function _t(e){e.forwardedRef;return Object(lt.useEffect)((function(){}),[]),null}function St(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ct(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?St(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):St(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}document.head.appendChild(Et);var Dt=window,Ft=Dt.getSelection,Nt=Dt.getComputedStyle,At=new Set(["insertParagraph","insertOrderedList","insertUnorderedList","insertHorizontalRule","insertLink"]),kt={whiteSpace:"pre-wrap"},Rt=[];function It(e,t){var r=Object.keys(e).reduce((function(r,n){return n.startsWith(t)&&r.push(e[n]),r}),[]);return function(e){return r.reduce((function(t,r){return r(t,e.text)}),e.formats)}}var Lt=function(e){function t(e){var r,n=e.value,o=e.selectionStart,a=e.selectionEnd;return Object(ot.a)(this,t),(r=Object(it.a)(this,Object(ct.a)(t).apply(this,arguments))).onFocus=r.onFocus.bind(Object(st.a)(r)),r.onBlur=r.onBlur.bind(Object(st.a)(r)),r.onChange=r.onChange.bind(Object(st.a)(r)),r.handleDelete=r.handleDelete.bind(Object(st.a)(r)),r.handleEnter=r.handleEnter.bind(Object(st.a)(r)),r.handleSpace=r.handleSpace.bind(Object(st.a)(r)),r.handleHorizontalNavigation=r.handleHorizontalNavigation.bind(Object(st.a)(r)),r.onPaste=r.onPaste.bind(Object(st.a)(r)),r.onCreateUndoLevel=r.onCreateUndoLevel.bind(Object(st.a)(r)),r.onInput=r.onInput.bind(Object(st.a)(r)),r.onCompositionStart=r.onCompositionStart.bind(Object(st.a)(r)),r.onCompositionEnd=r.onCompositionEnd.bind(Object(st.a)(r)),r.onSelectionChange=r.onSelectionChange.bind(Object(st.a)(r)),r.createRecord=r.createRecord.bind(Object(st.a)(r)),r.applyRecord=r.applyRecord.bind(Object(st.a)(r)),r.valueToFormat=r.valueToFormat.bind(Object(st.a)(r)),r.onPointerDown=r.onPointerDown.bind(Object(st.a)(r)),r.formatToValue=r.formatToValue.bind(Object(st.a)(r)),r.Editable=r.Editable.bind(Object(st.a)(r)),r.onKeyDown=function(e){e.defaultPrevented||(r.handleDelete(e),r.handleEnter(e),r.handleSpace(e),r.handleHorizontalNavigation(e))},r.state={},r.lastHistoryValue=n,r.value=n,r.record=r.formatToValue(n),r.record.start=o,r.record.end=a,r}return Object(ut.a)(t,e),Object(at.a)(t,[{key:"componentWillUnmount",value:function(){document.removeEventListener("selectionchange",this.onSelectionChange),window.cancelAnimationFrame(this.rafId)}},{key:"componentDidMount",value:function(){this.applyRecord(this.record,{domOnly:!0})}},{key:"createRecord",value:function(){var e=this.props,t=e.__unstableMultilineTag,r=e.forwardedRef,n=e.preserveWhiteSpace,o=Ft(),a=o.rangeCount>0?o.getRangeAt(0):null;return k({element:r.current,range:a,multilineTag:t,multilineWrapperTags:"li"===t?["ul","ol"]:void 0,__unstableIsEditableTree:!0,preserveWhiteSpace:n})}},{key:"applyRecord",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.domOnly,n=this.props,o=n.__unstableMultilineTag,a=n.forwardedRef;ke({value:e,current:a.current,multilineTag:o,multilineWrapperTags:"li"===o?["ul","ol"]:void 0,prepareEditableTree:It(this.props,"format_prepare_functions"),__unstableDomOnly:r,placeholder:this.props.placeholder})}},{key:"onPaste",value:function(e){var t=this.props,r=t.formatTypes,n=t.onPaste,o=t.__unstableIsSelected,a=this.state.activeFormats,i=void 0===a?[]:a;if(o){var s=e.clipboardData,u=s.items,l=s.files;u=Object(c.isNil)(u)?[]:u,l=Object(c.isNil)(l)?[]:l;var f="",p="";try{f=s.getData("text/plain"),p=s.getData("text/html")}catch(e){try{p=s.getData("Text")}catch(e){return}}e.preventDefault(),window.console.log("Received HTML:\n\n",p),window.console.log("Received plain text:\n\n",f);var d=this.record,h=r.reduce((function(e,t){var r=t.__unstablePasteRule;return r&&e===d&&(e=r(d,{html:p,plainText:f})),e}),d);h===d?n&&(l=Array.from(l),Array.from(u).forEach((function(e){if(e.getAsFile){var t=e.getAsFile();if(t){var r=t.name,n=t.type,o=t.size;Object(c.find)(l,{name:r,type:n,size:o})||l.push(t)}}})),n({value:this.removeEditorOnlyFormats(d),onChange:this.onChange,html:p,plainText:f,files:l,activeFormats:i})):this.onChange(h)}else e.preventDefault()}},{key:"onFocus",value:function(){var e=this.props.unstableOnFocus;if(e&&e(),this.props.__unstableIsSelected)this.props.onSelectionChange(this.record.start,this.record.end),this.setState({activeFormats:B(Ct({},this.record,{activeFormats:void 0}),Rt)});else{var t=Rt;this.record=Ct({},this.record,{start:void 0,end:void 0,activeFormats:t}),this.props.onSelectionChange(void 0,void 0),this.setState({activeFormats:t})}this.rafId=window.requestAnimationFrame(this.onSelectionChange),document.addEventListener("selectionchange",this.onSelectionChange),this.props.setFocusedElement&&(gt()("wp.blockEditor.RichText setFocusedElement prop",{alternative:"selection state from the block editor store."}),this.props.setFocusedElement(this.props.instanceId))}},{key:"onBlur",value:function(){document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"onInput",value:function(e){var t;if(!this.isComposing)if(e&&(t=e.inputType),!t&&e&&e.nativeEvent&&(t=e.nativeEvent.inputType),!t||0!==t.indexOf("format")&&!At.has(t)){var r=this.createRecord(),n=this.record,o=n.start,a=n.activeFormats,i=void 0===a?[]:a,c=function(e){var t=e.value,r=e.start,n=e.end,o=e.formats,a=t.formats[r-1]||[],i=t.formats[n]||[];for(t.activeFormats=o.map((function(e,t){if(a[t]){if(g(e,a[t]))return a[t]}else if(i[t]&&g(e,i[t]))return i[t];return e}));--n>=r;)t.activeFormats.length>0?t.formats[n]=t.activeFormats:delete t.formats[n];return t}({value:r,start:o,end:r.start,formats:i});this.onChange(c,{withoutHistory:!0});var s=this.props,u=s.__unstableInputRule,l=s.__unstableMarkAutomaticChange,f=s.__unstableAllowPrefixTransformations,p=s.formatTypes,d=s.setTimeout;if((0,s.clearTimeout)(this.onInput.timeout),this.onInput.timeout=d(this.onCreateUndoLevel,1e3),"insertText"===t){f&&u&&u(c,this.valueToFormat);var h=p.reduce((function(e,t){var r=t.__unstableInputRule;return r&&(e=r(e)),e}),c);h!==c&&(this.onCreateUndoLevel(),this.onChange(Ct({},h,{activeFormats:i})),l())}}else this.applyRecord(this.record)}},{key:"onCompositionStart",value:function(){this.isComposing=!0,document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"onCompositionEnd",value:function(){this.isComposing=!1,this.onInput({inputType:"insertText"}),document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"onSelectionChange",value:function(e){if(("selectionchange"===e.type||this.props.__unstableIsSelected)&&!this.props.disabled&&!this.isComposing){var t=this.createRecord(),r=t.start,n=t.end,o=t.text,a=this.record;if(o===a.text)if(r!==a.start||n!==a.end){var i=this.props,c=i.__unstableIsCaretWithinFormattedText,s=i.__unstableOnEnterFormattedText,u=i.__unstableOnExitFormattedText,l=Ct({},a,{start:r,end:n,activeFormats:void 0}),f=B(l,Rt);l.activeFormats=f,!c&&f.length?s():c&&!f.length&&u(),this.record=l,this.applyRecord(l,{domOnly:!0}),this.props.onSelectionChange(r,n),this.setState({activeFormats:f})}else 0===a.text.length&&0===r&&function(){var e=window.getSelection(),t=e.anchorNode,r=e.anchorOffset;if(t.nodeType===t.ELEMENT_NODE){var n=t.childNodes[r];n&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute("data-rich-text-placeholder")&&e.collapseToStart()}}();else this.onInput()}}},{key:"onChange",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.withoutHistory;this.applyRecord(e);var n=e.start,o=e.end,a=e.activeFormats,i=void 0===a?[]:a,s=Object(c.pickBy)(this.props,(function(e,t){return t.startsWith("format_on_change_functions_")}));Object.values(s).forEach((function(t){t(e.formats,e.text)})),this.value=this.valueToFormat(e),this.record=e,this.props.onSelectionChange(n,o),this.props.onChange(this.value),this.setState({activeFormats:i}),r||this.onCreateUndoLevel()}},{key:"onCreateUndoLevel",value:function(){this.lastHistoryValue!==this.value&&(this.props.__unstableOnCreateUndoLevel(),this.lastHistoryValue=this.value)}},{key:"handleDelete",value:function(e){var t=e.keyCode;if(t===dt.DELETE||t===dt.BACKSPACE||t===dt.ESCAPE){if(this.props.__unstableDidAutomaticChange)return e.preventDefault(),void this.props.__unstableUndo();if(t!==dt.ESCAPE){var r,n=this.props,o=n.onDelete,a=n.__unstableMultilineTag,i=this.state.activeFormats,c=void 0===i?[]:i,s=this.createRecord(),u=s.start,l=s.end,f=s.text,p=t===dt.BACKSPACE;if(0===u&&0!==l&&l===f.length)return this.onChange(ie(s)),void e.preventDefault();if(a)if(r=p&&0===s.start&&0===s.end&&J(s)?le(s,!p):le(s,p))return this.onChange(r),void e.preventDefault();!o||!X(s)||c.length||p&&0!==u||!p&&l!==f.length||(o({isReverse:p,value:s}),e.preventDefault())}}}},{key:"handleEnter",value:function(e){if(e.keyCode===dt.ENTER){e.preventDefault();var t=this.props.onEnter;t&&t({value:this.removeEditorOnlyFormats(this.createRecord()),onChange:this.onChange,shiftKey:e.shiftKey})}}},{key:"handleSpace",value:function(e){var t=e.keyCode,r=e.shiftKey,n=e.altKey,o=e.metaKey,a=e.ctrlKey,i=this.props,c=i.tagName,s=i.__unstableMultilineTag;if(!(r||n||o||a||t!==dt.SPACE||"li"!==s)){var u=this.createRecord();if(X(u)){var l=u.text[u.start-1];l&&l!==P||(this.onChange(Ze(u,{type:c})),e.preventDefault())}}}},{key:"handleHorizontalNavigation",value:function(e){var t=e.keyCode,r=e.shiftKey,n=e.altKey,o=e.metaKey,a=e.ctrlKey;if(!(r||n||o||a||t!==dt.LEFT&&t!==dt.RIGHT)){var i=this.record,c=i.text,s=i.formats,u=i.start,l=i.end,f=i.activeFormats,p=void 0===f?[]:f,d=X(i),h="rtl"===Nt(this.props.forwardedRef.current).direction?dt.RIGHT:dt.LEFT,b=e.keyCode===h;if(d&&0===p.length){if(0===u&&b)return;if(l===c.length&&!b)return}if(d){e.preventDefault();var m=s[u-1]||Rt,v=s[u]||Rt,g=p.length,y=v;if(m.length>v.length&&(y=m),m.length<v.length?(!b&&p.length<v.length&&g++,b&&p.length>m.length&&g--):m.length>v.length&&(!b&&p.length>v.length&&g--,b&&p.length<m.length&&g++),g!==p.length){var O=y.slice(0,g),j=Ct({},i,{activeFormats:O});return this.record=j,this.applyRecord(j),void this.setState({activeFormats:O})}var w=u+(b?-1:1),T=b?m:v,E=Ct({},i,{start:w,end:w,activeFormats:T});this.record=E,this.applyRecord(E),this.props.onSelectionChange(w,w),this.setState({activeFormats:T})}}}},{key:"onPointerDown",value:function(e){var t=e.target;if(t!==this.props.forwardedRef.current&&!t.textContent){var r=t.parentNode,n=Array.from(r.childNodes).indexOf(t),o=t.ownerDocument.createRange(),a=Ft();o.setStart(t.parentNode,n),o.setEnd(t.parentNode,n+1),a.removeAllRanges(),a.addRange(o)}}},{key:"componentDidUpdate",value:function(e){var t=this.props,r=t.tagName,n=t.value,o=t.selectionStart,a=t.selectionEnd,i=t.placeholder,s=t.__unstableIsSelected,u=r!==e.tagName;u=u||n!==e.value&&n!==this.value;var l=o!==e.selectionStart&&o!==this.record.start||a!==e.selectionEnd&&a!==this.record.end;u=u||s&&!e.isSelected&&l;var f=function(e,t){return t.startsWith("format_prepare_props_")},p=Object(c.pickBy)(this.props,f),d=Object(c.pickBy)(e,f);(u=(u=u||!mt()(p,d))||i!==e.placeholder)?(this.value=n,this.record=this.formatToValue(n),this.record.start=o,this.record.end=a,this.applyRecord(this.record)):l&&(this.record=Ct({},this.record,{start:o,end:a}))}},{key:"formatToValue",value:function(e){var t=this.props,r=t.format,n=t.__unstableMultilineTag,o=t.preserveWhiteSpace;if("string"!==r)return e;var a=It(this.props,"format_value_functions");return(e=k({html:e,multilineTag:n,multilineWrapperTags:"li"===n?["ul","ol"]:void 0,preserveWhiteSpace:o})).formats=a(e),e}},{key:"removeEditorOnlyFormats",value:function(e){return this.props.formatTypes.forEach((function(t){t.__experimentalCreatePrepareEditableTree&&(e=ne(e,t.name,0,e.text.length))})),e}},{key:"valueToFormat",value:function(e){var t=this.props,r=t.format,n=t.__unstableMultilineTag,o=t.preserveWhiteSpace;if(e=this.removeEditorOnlyFormats(e),"string"===r)return Ie({value:e,multilineTag:n,preserveWhiteSpace:o})}},{key:"Editable",value:function(e){var t=this,r=this.props,n=r.tagName,o=void 0===n?"div":n,a=r.style,i=r.className,s=r.placeholder,u=r.forwardedRef,l=r.disabled,f=Object(c.pickBy)(this.props,(function(e,t){return Object(c.startsWith)(t,"aria-")}));return Object(lt.createElement)(o,Object(nt.a)({role:"textbox","aria-multiline":!0,"aria-label":s},e,f,{ref:u,style:a?Ct({},a,{whiteSpace:"pre-wrap"}):kt,className:pt()("rich-text",i),onPaste:this.onPaste,onInput:this.onInput,onCompositionStart:this.onCompositionStart,onCompositionEnd:this.onCompositionEnd,onKeyDown:e.onKeyDown?function(r){e.onKeyDown(r),t.onKeyDown(r)}:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,onMouseDown:this.onPointerDown,onTouchStart:this.onPointerDown,onKeyUp:this.onSelectionChange,onMouseUp:this.onSelectionChange,onTouchEnd:this.onSelectionChange,contentEditable:!l||void 0,suppressContentEditableWarning:!l}))}},{key:"render",value:function(){var e=this,t=this.props,r=t.__unstableIsSelected,n=t.children,o=t.allowedFormats,a=t.withoutInteractiveFormatting,i=t.formatTypes,c=t.forwardedRef,s=this.state.activeFormats,u=function(){c.current.focus(),e.applyRecord(e.record)};return Object(lt.createElement)(lt.Fragment,null,Object(lt.createElement)(Pt,{activeFormats:s,forwardedRef:c}),Object(lt.createElement)(_t,{forwardedRef:c}),r&&Object(lt.createElement)(Ot,{allowedFormats:o,withoutInteractiveFormatting:a,value:this.record,onChange:this.onChange,onFocus:u,formatTypes:i}),n&&n({isSelected:r,value:this.record,onChange:this.onChange,onFocus:u,Editable:this.Editable}),!n&&Object(lt.createElement)(this.Editable,null))}}]),t}(lt.Component);Lt.defaultProps={format:"string",value:""};var Wt=Object(ht.compose)([ht.withSafeTimeout,function(e){return function(t){var r=t.clientId,n=t.identifier,o=Object(a.useSelect)(Tt,[]),s=Object(a.useSelect)((function(e){return o.reduce((function(t,o){if(!o.__experimentalGetPropsForEditableTreePreparation)return t;var a="format_prepare_props_(".concat(o.name,")_");return wt({},t,{},Object(c.mapKeys)(o.__experimentalGetPropsForEditableTreePreparation(e,{richTextIdentifier:n,blockClientId:r}),(function(e,t){return a+t})))}),{})}),[o,r,n]),u=Object(a.__unstableUseDispatchWithMap)((function(e){return o.reduce((function(t,o){if(!o.__experimentalGetPropsForEditableTreeChangeHandler)return t;var a="format_on_change_props_(".concat(o.name,")_");return wt({},t,{},Object(c.mapKeys)(o.__experimentalGetPropsForEditableTreeChangeHandler(e,{richTextIdentifier:n,blockClientId:r}),(function(e,t){return a+t})))}),{})}),[o,r,n]),l=Object(lt.useMemo)((function(){return o.reduce((function(e,t){if(!t.__experimentalCreatePrepareEditableTree)return e;var o,a={richTextIdentifier:n,blockClientId:r},c=wt({},s,{},u),l=t.name,f="format_prepare_props_(".concat(l,")_"),p="format_on_change_props_(".concat(l,")_"),d=Object.keys(c).reduce((function(e,t){return t.startsWith(f)&&(e[t.slice(f.length)]=c[t]),t.startsWith(p)&&(e[t.slice(p.length)]=c[t]),e}),{});return t.__experimentalCreateOnChangeEditableValue?wt({},e,(o={},Object(i.a)(o,"format_value_functions_(".concat(l,")"),t.__experimentalCreatePrepareEditableTree(d,a)),Object(i.a)(o,"format_on_change_functions_(".concat(l,")"),t.__experimentalCreateOnChangeEditableValue(d,a)),o)):wt({},e,Object(i.a)({},"format_prepare_functions_(".concat(l,")"),t.__experimentalCreatePrepareEditableTree(d,a)))}),{})}),[o,r,n,s,u]);return Object(lt.createElement)(e,Object(nt.a)({},t,s,l,{formatTypes:o}))}}])(Lt),Mt=Object(lt.forwardRef)((function(e,t){return Object(lt.createElement)(Wt,Object(nt.a)({},e,{forwardedRef:t}))}));r.d(t,"applyFormat",(function(){return T})),r.d(t,"concat",(function(){return V})),r.d(t,"create",(function(){return k})),r.d(t,"getActiveFormat",(function(){return U})),r.d(t,"getActiveObject",(function(){return z})),r.d(t,"getTextContent",(function(){return q})),r.d(t,"__unstableIsListRootSelected",(function(){return Y})),r.d(t,"__unstableIsActiveListType",(function(){return $})),r.d(t,"isCollapsed",(function(){return X})),r.d(t,"isEmpty",(function(){return Z})),r.d(t,"__unstableIsEmptyLine",(function(){return J})),r.d(t,"join",(function(){return Q})),r.d(t,"registerFormatType",(function(){return te})),r.d(t,"removeFormat",(function(){return ne})),r.d(t,"remove",(function(){return ie})),r.d(t,"replace",(function(){return ce})),r.d(t,"insert",(function(){return ae})),r.d(t,"__unstableInsertLineSeparator",(function(){return se})),r.d(t,"__unstableRemoveLineSeparator",(function(){return le})),r.d(t,"insertObject",(function(){return pe})),r.d(t,"slice",(function(){return he})),r.d(t,"split",(function(){return be})),r.d(t,"__unstableToDom",(function(){return Ae})),r.d(t,"toHTMLString",(function(){return Ie})),r.d(t,"toggleFormat",(function(){return qe})),r.d(t,"__UNSTABLE_LINE_SEPARATOR",(function(){return P})),r.d(t,"unregisterFormatType",(function(){return Ge})),r.d(t,"__unstableCanIndentListItems",(function(){return Ye})),r.d(t,"__unstableCanOutdentListItems",(function(){return $e})),r.d(t,"__unstableIndentListItems",(function(){return Ze})),r.d(t,"__unstableOutdentListItems",(function(){return et})),r.d(t,"__unstableChangeListType",(function(){return rt})),r.d(t,"__unstableCreateElement",(function(){return x})),r.d(t,"__experimentalRichText",(function(){return Mt})),r.d(t,"__unstableFormatEdit",(function(){return Ot}))},5:function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,"a",(function(){return n}))},51:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},68:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},7:function(e,t,r){"use strict";function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}r.d(t,"a",(function(){return n}))},8:function(e,t){!function(){e.exports=this.wp.compose}()}});