WordPress/wp-includes/js/dist/rich-text.min.js
2020-08-04 13:43:40 +00:00

7 lines
51 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 a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.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 a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));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=441)}({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 a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)&&n.length){var c=a.apply(null,n);c&&e.push(c)}else if("object"===o)for(var i in n)r.call(n,i)&&n[i]&&e.push(i)}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()},14:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(38);var a=r(29),o=r(39);function c(e,t){return Object(n.a)(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,o=void 0;try{for(var c,i=e[Symbol.iterator]();!(n=(c=i.next()).done)&&(r.push(c.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==i.return||i.return()}finally{if(a)throw o}}return r}}(e,t)||Object(a.a)(e,t)||Object(o.a)()}},15:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(41);function a(e,t){if(null==e)return{};var r,a,o=Object(n.a)(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a<c.length;a++)r=c[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}},18:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(26);var a=r(35),o=r(29);function c(e){return function(e){if(Array.isArray(e))return Object(n.a)(e)}(e)||Object(a.a)(e)||Object(o.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.")}()}},2:function(e,t){!function(){e.exports=this.lodash}()},21:function(e,t){!function(){e.exports=this.wp.keycodes}()},26: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}))},29:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(26);function a(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(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Object(n.a)(e,t):void 0}}},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}()},38:function(e,t,r){"use strict";function n(e){if(Array.isArray(e))return e}r.d(t,"a",(function(){return n}))},39:function(e,t,r){"use strict";function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}r.d(t,"a",(function(){return n}))},4:function(e,t){!function(){e.exports=this.wp.data}()},40: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}))},41:function(e,t,r){"use strict";function n(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}r.d(t,"a",(function(){return n}))},42:function(e,t,r){"use strict";var n,a;function o(e){return[e]}function c(){var e={clear:function(){e.head=null}};return e}function i(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={},a="undefined"!=typeof WeakMap,t.a=function(e,t){var r,u;function s(){r=a?new WeakMap:c()}function l(){var r,n,a,o,c,s=arguments.length;for(o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];for(c=t.apply(null,o),(r=u(c)).isUniqueByDependants||(r.lastDependants&&!i(c,r.lastDependants,0)&&r.clear(),r.lastDependants=c),n=r.head;n;){if(i(n.args,o,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,o)},o[0]=null,n.args=o,r.head&&(r.head.prev=n,n.next=r.head),r.head=n,n.val}return t||(t=o),u=a?function(e){var t,a,o,i,u,s=r,l=!0;for(t=0;t<e.length;t++){if(a=e[t],!(u=a)||"object"!=typeof u){l=!1;break}s.has(a)?s=s.get(a):(o=new WeakMap,s.set(a,o),s=o)}return s.has(n)||((i=c()).isUniqueByDependants=l,s.set(n,i)),s.get(n)}:function(){return r},l.getDependants=t,l.clear=s,s(),l}},441:function(e,t,r){"use strict";r.r(t),r.d(t,"applyFormat",(function(){return _})),r.d(t,"concat",(function(){return M})),r.d(t,"create",(function(){return C})),r.d(t,"getActiveFormat",(function(){return K})),r.d(t,"getActiveObject",(function(){return V})),r.d(t,"getTextContent",(function(){return B})),r.d(t,"__unstableIsListRootSelected",(function(){return z})),r.d(t,"__unstableIsActiveListType",(function(){return G})),r.d(t,"isCollapsed",(function(){return q})),r.d(t,"isEmpty",(function(){return X})),r.d(t,"__unstableIsEmptyLine",(function(){return Y})),r.d(t,"join",(function(){return $})),r.d(t,"registerFormatType",(function(){return J})),r.d(t,"removeFormat",(function(){return te})),r.d(t,"remove",(function(){return ae})),r.d(t,"replace",(function(){return oe})),r.d(t,"insert",(function(){return ne})),r.d(t,"__unstableInsertLineSeparator",(function(){return ce})),r.d(t,"__unstableRemoveLineSeparator",(function(){return se})),r.d(t,"insertObject",(function(){return le})),r.d(t,"slice",(function(){return de})),r.d(t,"split",(function(){return be})),r.d(t,"__unstableToDom",(function(){return Fe})),r.d(t,"toHTMLString",(function(){return Ne})),r.d(t,"toggleFormat",(function(){return Ue})),r.d(t,"__UNSTABLE_LINE_SEPARATOR",(function(){return D})),r.d(t,"unregisterFormatType",(function(){return ze})),r.d(t,"__unstableCanIndentListItems",(function(){return Ge})),r.d(t,"__unstableCanOutdentListItems",(function(){return qe})),r.d(t,"__unstableIndentListItems",(function(){return Ye})),r.d(t,"__unstableOutdentListItems",(function(){return Je})),r.d(t,"__unstableChangeListType",(function(){return et})),r.d(t,"__unstableCreateElement",(function(){return P})),r.d(t,"__experimentalRichText",(function(){return xt})),r.d(t,"__unstableFormatEdit",(function(){return ft}));var n={};r.r(n),r.d(n,"getFormatTypes",(function(){return p})),r.d(n,"getFormatType",(function(){return d})),r.d(n,"getFormatTypeForBareElement",(function(){return b})),r.d(n,"getFormatTypeForClassName",(function(){return m}));var a={};r.r(a),r.d(a,"addFormatTypes",(function(){return v})),r.d(a,"removeFormatTypes",(function(){return g}));var o=r(4),c=r(5),i=r(2);function u(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 s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){Object(c.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var l=Object(o.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 s({},e,{},Object(i.keyBy)(t.formatTypes,"name"));case"REMOVE_FORMAT_TYPES":return Object(i.omit)(e,t.names)}return e}}),f=r(42),p=Object(f.a)((function(e){return Object.values(e.formatTypes)}),(function(e){return[e.formatTypes]}));function d(e,t){return e.formatTypes[t]}function b(e,t){return Object(i.find)(p(e),(function(e){var r=e.className,n=e.tagName;return null===r&&t===n}))}function m(e,t){return Object(i.find)(p(e),(function(e){var r=e.className;return null!==r&&" ".concat(t," ").indexOf(" ".concat(r," "))>=0}))}function v(e){return{type:"ADD_FORMAT_TYPES",formatTypes:Object(i.castArray)(e)}}function g(e){return{type:"REMOVE_FORMAT_TYPES",names:Object(i.castArray)(e)}}Object(o.registerStore)("core/rich-text",{reducer:l,selectors:n,actions:a});var h=r(18);function O(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 a=Object.keys(r),o=Object.keys(n);if(a.length!==o.length)return!1;for(var c=a.length,i=0;i<c;i++){var u=a[i];if(r[u]!==n[u])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 j(e){var t=e.formats.slice();return t.forEach((function(e,r){var n=t[r-1];if(n){var a=e.slice();a.forEach((function(e,t){var r=n[t];O(e,r)&&(a[t]=r)})),t[r]=a}})),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(c.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 w(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 x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w(Object(r),!0).forEach((function(t){Object(c.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t,r){return(e=e.slice())[t]=r,e}function _(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,a=e.formats,o=e.activeFormats,c=a.slice();if(r===n){var u=Object(i.find)(c[r],{type:t.type});if(u){for(var s=c[r].indexOf(u);c[r]&&c[r][s]===u;)c[r]=T(c[r],s,t),r--;for(n++;c[n]&&c[n][s]===u;)c[n]=T(c[n],s,t),n++}}else{for(var l=1/0,f=r;f<n;f++)if(c[f]){c[f]=c[f].filter((function(e){return e.type!==t.type}));var p=c[f].length;p<l&&(l=p)}else c[f]=[],l=0;for(var d=r;d<n;d++)c[d].splice(l,0,t)}return j(x({},e,{formats:c,activeFormats:[].concat(Object(h.a)(Object(i.reject)(o,{type:t.type})),[t])}))}var E=r(40);function P(e,t){var r=e.implementation;return P.body||(P.body=r.createHTMLDocument("").body),P.body.innerHTML=t,P.body}var D="\u2028";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}function F(e,t){for(var r in e)if(e[r]===t)return r}function C(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.element,r=e.text,n=e.html,a=e.range,o=e.multilineTag,c=e.multilineWrapperTags,i=e.__unstableIsEditableTree,u=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=P(document,n)),"object"!==Object(E.a)(t)?{formats:[],replacements:[],text:""}:o?R({element:t,range:a,multilineTag:o,multilineWrapperTags:c,isEditableTree:i,preserveWhiteSpace:u}):I({element:t,range:a,isEditableTree:i,preserveWhiteSpace:u}))}function A(e,t,r,n){if(r){var a=t.parentNode,o=r.startContainer,c=r.startOffset,i=r.endContainer,u=r.endOffset,s=e.text.length;void 0!==n.start?e.start=s+n.start:t===o&&t.nodeType===t.TEXT_NODE?e.start=s+c:a===o&&t===o.childNodes[c]?e.start=s:a===o&&t===o.childNodes[c-1]?e.start=s+n.text.length:t===o&&(e.start=s),void 0!==n.end?e.end=s+n.end:t===i&&t.nodeType===t.TEXT_NODE?e.end=s+u:a===i&&t===i.childNodes[u-1]?e.end=s+n.text.length:a===i&&t===i.childNodes[u]?e.end=s:t===i&&(e.end=s+u)}}var N=new RegExp("\ufeff","g");function k(e){return e.replace(N,"")}function I(e){var t=e.element,r=e.range,n=e.multilineTag,a=e.multilineWrapperTags,i=e.currentWrapperTags,u=void 0===i?[]:i,s=e.isEditableTree,l=e.preserveWhiteSpace,f={formats:[],replacements:[],text:""};if(!t)return f;if(!t.hasChildNodes())return A(f,t,r,{formats:[],replacements:[],text:""}),f;for(var p=t.childNodes.length,d=function(e){var i=t.childNodes[e],p=i.nodeName.toLowerCase();if(i.nodeType===i.TEXT_NODE){var d=k;l||(d=function(e){return k(function(e){return e.replace(/[\n\r\t]+/g," ")}(e))});var b=d(i.nodeValue);return r=function(e,t,r){if(t){var n=t.startContainer,a=t.endContainer,o=t.startOffset,c=t.endOffset;return e===n&&(o=r(e.nodeValue.slice(0,o)).length),e===a&&(c=r(e.nodeValue.slice(0,c)).length),{startContainer:n,startOffset:o,endContainer:a,endOffset:c}}}(i,r,d),A(f,i,r,{text:b}),f.formats.length+=b.length,f.replacements.length+=b.length,f.text+=b,"continue"}if(i.nodeType!==i.ELEMENT_NODE)return"continue";if(s&&(i.getAttribute("data-rich-text-placeholder")||"br"===p&&!i.getAttribute("data-rich-text-line-break")))return A(f,i,r,{formats:[],replacements:[],text:""}),"continue";if("br"===p)return A(f,i,r,{formats:[],replacements:[],text:""}),L(f,C({text:"\n"})),"continue";var m=f.formats[f.formats.length-1],v=m&&m[m.length-1],g=function(e){var t,r=e.type,n=e.attributes;if(n&&n.class&&(t=Object(o.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(o.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 a={},c={};for(var i in n){var u=F(t.attributes,i);u?a[u]=n[i]:c[i]=n[i]}return{type:t.name,attributes:a,unregisteredAttributes:c}}({type:p,attributes:W({element:i})}),y=O(g,v)?v:g;if(a&&-1!==a.indexOf(p)){var j=R({element:i,range:r,multilineTag:n,multilineWrapperTags:a,currentWrapperTags:[].concat(Object(h.a)(u),[y]),isEditableTree:s,preserveWhiteSpace:l});return A(f,i,r,j),L(f,j),"continue"}var w=I({element:i,range:r,multilineTag:n,multilineWrapperTags:a,isEditableTree:s,preserveWhiteSpace:l});if(A(f,i,r,w),y)if(0===w.text.length)y.attributes&&L(f,{formats:[,],replacements:[y],text:""});else{function x(e){if(x.formats===e)return x.newFormats;var t=e?[y].concat(Object(h.a)(e)):[y];return x.formats=e,x.newFormats=t,t}x.newFormats=[y],L(f,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(c.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}({},w,{formats:Array.from(w.formats,x)}))}else L(f,w)},b=0;b<p;b++)d(b);return f}function R(e){var t=e.element,r=e.range,n=e.multilineTag,a=e.multilineWrapperTags,o=e.currentWrapperTags,c=void 0===o?[]:o,i=e.isEditableTree,u=e.preserveWhiteSpace,s={formats:[],replacements:[],text:""};if(!t||!t.hasChildNodes())return s;for(var l=t.children.length,f=0;f<l;f++){var p=t.children[f];if(p.nodeName.toLowerCase()===n){var d=I({element:p,range:r,multilineTag:n,multilineWrapperTags:a,currentWrapperTags:c,isEditableTree:i,preserveWhiteSpace:u});(0!==f||c.length>0)&&L(s,{formats:[,],replacements:c.length>0?[c]:[,],text:D}),A(s,p,r,d),L(s,d)}}return s}function W(e){var t=e.element;if(t.hasAttributes()){for(var r,n=t.attributes.length,a=0;a<n;a++){var o=t.attributes[a],c=o.name,i=o.value;0!==c.indexOf("data-rich-text-")&&((r=r||{})[c]=i)}return r}}function L(e,t){return e.formats=e.formats.concat(t.formats),e.replacements=e.replacements.concat(t.replacements),e.text+=t.text,e}function M(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return j(t.reduce(L,C()))}function H(e){var t=e.formats,r=e.start,n=e.end,a=e.activeFormats,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(void 0===r)return o;if(r===n){if(a)return a;var c=t[r-1]||o,i=t[r]||o;return c.length<i.length?c:i}return t[r]||o}function K(e,t){return Object(i.find)(H(e),{type:t})}function V(e){var t=e.start,r=e.end,n=e.replacements,a=e.text;if(t+1===r&&""===a[t])return n[t]}function B(e){return e.text}function U(e){for(var t=e.start,r=e.text,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,a=n;a--;)if(r[a]===D)return a}function z(e){var t=e.replacements[U(e,e.start)];return!t||t.length<1}function G(e,t,r){var n=e.replacements[U(e,e.start)];return n&&0!==n.length?n[n.length-1].type===t:t===r}function q(e){var t=e.start,r=e.end;if(void 0!==t&&void 0!==r)return t===r}function X(e){return 0===e.text.length}function Y(e){var t=e.text,r=e.start,n=e.end;return r===n&&(0===t.length||(0===r&&t.slice(0,1)===D||(r===t.length&&t.slice(-1)===D||t.slice(r-1,n+1)==="".concat(D).concat(D))))}function $(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"string"==typeof t&&(t=C({text:t})),j(e.reduce((function(e,r){var n=r.formats,a=r.replacements,o=r.text;return{formats:e.formats.concat(t.formats,n),replacements:e.replacements.concat(t.replacements,a),text:e.text+t.text+o}})))}function Z(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 J(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?Z(Object(r),!0).forEach((function(t){Object(c.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Z(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(o.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(o.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(o.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(o.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 Q(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 ee(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(r),!0).forEach((function(t){Object(c.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function te(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,a=e.formats,o=e.activeFormats,c=a.slice();if(r===n){var u=Object(i.find)(c[r],{type:t});if(u){for(;Object(i.find)(c[r],u);)re(c,r,t),r--;for(n++;Object(i.find)(c[n],u);)re(c,n,t),n++}}else for(var s=r;s<n;s++)c[s]&&re(c,s,t);return j(ee({},e,{formats:c,activeFormats:Object(i.reject)(o,{type:t})}))}function re(e,t,r){var n=e[t].filter((function(e){return e.type!==r}));n.length?e[t]=n:delete e[t]}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,a=e.formats,o=e.replacements,c=e.text;"string"==typeof t&&(t=C({text:t}));var i=r+t.text.length;return j({formats:a.slice(0,r).concat(t.formats,a.slice(n)),replacements:o.slice(0,r).concat(t.replacements,o.slice(n)),text:c.slice(0,r)+t.text+c.slice(n),start:i,end:i})}function ae(e,t,r){return ne(e,C(),t,r)}function oe(e,t,r){var n=e.formats,a=e.replacements,o=e.text,c=e.start,i=e.end;return o=o.replace(t,(function(e){for(var t=arguments.length,o=new Array(t>1?t-1:0),u=1;u<t;u++)o[u-1]=arguments[u];var s,l,f=o[o.length-2],p=r;return"function"==typeof p&&(p=r.apply(void 0,[e].concat(o))),"object"===Object(E.a)(p)?(s=p.formats,l=p.replacements,p=p.text):(s=Array(p.length),l=Array(p.length),n[f]&&(s=s.fill(n[f]))),n=n.slice(0,f).concat(s,n.slice(f+e.length)),a=a.slice(0,f).concat(l,a.slice(f+e.length)),c&&(c=i=f+p.length),p})),j({formats:n,replacements:a,text:o,start:c,end:i})}function ce(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=B(e).slice(0,t),a=n.lastIndexOf(D),o=e.replacements[a],c=[,];o&&(c=[o]);var i={formats:[,],replacements:c,text:D};return ne(e,i,t,r)}function ie(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 ue(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ie(Object(r),!0).forEach((function(t){Object(c.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ie(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function se(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.replacements,n=e.text,a=e.start,o=e.end,c=q(e),i=a-1,u=c?a-1:a,s=o;if(t||(i=o,u=a,s=c?o+1:o),n[i]===D){var l;if(c&&r[i]&&r[i].length){var f=r.slice();f[i]=r[i].slice(0,-1),l=ue({},e,{replacements:f})}else l=ae(e,u,s);return l}}function le(e,t,r,n){return ne(e,{formats:[,],replacements:[t],text:""},r,n)}function fe(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 pe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fe(Object(r),!0).forEach((function(t){Object(c.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function de(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,a=e.replacements,o=e.text;return void 0===t||void 0===r?pe({},e):{formats:n.slice(t,r),replacements:a.slice(t,r),text:o.slice(t,r)}}function be(e,t){var r=e.formats,n=e.replacements,a=e.text,o=e.start,c=e.end;if("string"!=typeof t)return me.apply(void 0,arguments);var i=0;return a.split(t).map((function(e){var a=i,u={formats:r.slice(a,a+e.length),replacements:n.slice(a,a+e.length),text:e};return i+=t.length+e.length,void 0!==o&&void 0!==c&&(o>=a&&o<i?u.start=o-a:o<a&&c>a&&(u.start=0),c>=a&&c<i?u.end=c-a:o<i&&c>i&&(u.end=e.length)),u}))}function me(e){var t=e.formats,r=e.replacements,n=e.text,a=e.start,o=e.end,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o,u={formats:t.slice(0,c),replacements:r.slice(0,c),text:n.slice(0,c)},s={formats:t.slice(i),replacements:r.slice(i),text:n.slice(i),start:0,end:0};return[oe(u,/\u2028+$/,""),oe(s,/^\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(c.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 he(e){var t=e.type,r=e.attributes,n=e.unregisteredAttributes,a=e.object,c=e.boundaryClass,i=function(e){return Object(o.select)("core/rich-text").getFormatType(e)}(t),u={};if(c&&(u["data-rich-text-format-boundary"]="true"),!i)return r&&(u=ge({},r,{},u)),{type:t,attributes:u,object:a};for(var s in u=ge({},n,{},u),r){var l=!!i.attributes&&i.attributes[s];l?u[l]=r[s]:u[s]=r[s]}return i.className&&(u.class?u.class="".concat(i.className," ").concat(u.class):u.class=i.className),{type:i.tagName,object:i.object,attributes:u}}function Oe(e){var t,r,n,a=e.value,o=e.multilineTag,c=e.preserveWhiteSpace,i=e.createEmpty,u=e.append,s=e.getLastChild,l=e.getParent,f=e.isText,p=e.getText,d=e.remove,b=e.appendText,m=e.onStartIndex,v=e.onEndIndex,g=e.isEditableTree,O=e.placeholder,y=a.formats,j=a.replacements,w=a.text,x=a.start,T=a.end,_=y.length+1,E=i(),P={type:o},S=H(a),F=S[S.length-1];o?(u(u(E,{type:o}),""),r=t=[P]):u(E,"");for(var C=function(e){var a=w.charAt(e),i=g&&(!n||n===D||"\n"===n),_=y[e];o&&(_=a===D?t=(j[e]||[]).reduce((function(e,t){return e.push(t,P),e}),[P]):[].concat(Object(h.a)(t),Object(h.a)(_||[])));var S=s(E);if(i&&a===D){for(var C=S;!f(C);)C=s(C);u(l(C),"\ufeff")}if(n===D){for(var A=S;!f(A);)A=s(A);m&&x===e&&m(E,A),v&&T===e&&v(E,A)}if(_&&_.forEach((function(e,t){if(S&&r&&function(e,t,r){do{if(e[r]!==t[r])return!1}while(r--);return!0}(_,r,t)&&(a!==D||_.length-1!==t))S=s(S);else{var n=e.type,o=e.attributes,c=e.unregisteredAttributes,i=g&&a!==D&&e===F,b=l(S),m=u(b,he({type:n,attributes:o,unregisteredAttributes:c,boundaryClass:i}));f(S)&&0===p(S).length&&d(S),S=u(m,"")}})),a===D)return r=_,n=a,"continue";0===e&&(m&&0===x&&m(E,S),v&&0===T&&v(E,S)),""===a?(S=u(l(S),he(ge({},j[e],{object:!0}))),S=u(l(S),"")):c||"\n"!==a?f(S)?b(S,a):S=u(l(S),a):(S=u(l(S),{type:"br",attributes:g?{"data-rich-text-line-break":"true"}:void 0,object:!0}),S=u(l(S),"")),m&&x===e+1&&m(E,S),v&&T===e+1&&v(E,S),i&&e===w.length&&(u(l(S),"\ufeff"),O&&0===w.length&&u(l(S),{type:"span",attributes:{"data-rich-text-placeholder":O,contenteditable:"false"}})),r=_,n=a},A=0;A<_;A++)C(A);return E}function ye(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 je(e,t,r){for(var n=e.parentNode,a=0;e=e.previousSibling;)a++;return r=[a].concat(Object(h.a)(r)),n!==t&&(r=je(n,t,r)),r}function we(e,t){for(t=Object(h.a)(t);e&&t.length>1;)e=e.childNodes[t.shift()];return{node:e,offset:t[0]}}function xe(e,t){"string"==typeof t&&(t=e.ownerDocument.createTextNode(t));var r=t,n=r.type,a=r.attributes;if(n)for(var o in t=e.ownerDocument.createElement(n),a)t.setAttribute(o,a[o]);return e.appendChild(t)}function Te(e,t){e.appendData(t)}function _e(e){return e.lastChild}function Ee(e){return e.parentNode}function Pe(e){return e.nodeType===e.TEXT_NODE}function De(e){return e.nodeValue}function Se(e){return e.parentNode.removeChild(e)}function Fe(e){var t=e.value,r=e.multilineTag,n=e.prepareEditableTree,a=e.isEditableTree,o=void 0===a||a,i=e.placeholder,u=e.doc,s=void 0===u?document:u,l=[],f=[];n&&(t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(r),!0).forEach((function(t){Object(c.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ye(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{formats:n(t)}));return{body:Oe({value:t,multilineTag:r,createEmpty:function(){return P(s,"")},append:xe,getLastChild:_e,getParent:Ee,isText:Pe,getText:De,remove:Se,appendText:Te,onStartIndex:function(e,t){l=je(t,e,[t.nodeValue.length])},onEndIndex:function(e,t){f=je(t,e,[t.nodeValue.length])},isEditableTree:o,placeholder:i}),selection:{startPath:l,endPath:f}}}function Ce(e){var t=e.value,r=e.current,n=e.multilineTag,a=e.prepareEditableTree,o=e.__unstableDomOnly,c=Fe({value:t,multilineTag:n,prepareEditableTree:a,placeholder:e.placeholder,doc:r.ownerDocument}),i=c.body,u=c.selection;!function e(t,r){var n,a=0;for(;n=t.firstChild;){var o=r.childNodes[a];if(o)if(o.isEqualNode(n))t.removeChild(n);else if(o.nodeName!==n.nodeName||o.nodeType===o.TEXT_NODE&&o.data!==n.data)r.replaceChild(n,o);else{var c=o.attributes,i=n.attributes;if(c)for(var u=c.length;u--;){var s=c[u].name;n.getAttribute(s)||o.removeAttribute(s)}if(i)for(var l=0;l<i.length;l++){var f=i[l],p=f.name,d=f.value;o.getAttribute(p)!==d&&o.setAttribute(p,d)}e(n,o),t.removeChild(n)}else r.appendChild(n);a++}for(;r.childNodes[a];)r.removeChild(r.childNodes[a])}(i,r),void 0===t.start||o||function(e,t){var r=e.startPath,n=e.endPath,a=we(t,r),o=a.node,c=a.offset,i=we(t,n),u=i.node,s=i.offset,l=t.ownerDocument,f=l.defaultView,p=f.getSelection(),d=l.createRange();d.setStart(o,c),d.setEnd(u,s);var b=l.activeElement;if(p.rangeCount>0){if(m=d,v=p.getRangeAt(0),m.startContainer===v.startContainer&&m.startOffset===v.startOffset&&m.endContainer===v.endContainer&&m.endOffset===v.endOffset)return;p.removeAllRanges()}var m,v;p.addRange(d),b!==l.activeElement&&b instanceof f.HTMLElement&&b.focus()}(u,r)}var Ae=r(89);function Ne(e){return Be(Oe({value:e.value,multilineTag:e.multilineTag,preserveWhiteSpace:e.preserveWhiteSpace,createEmpty:ke,append:Re,getLastChild:Ie,getParent:Le,isText:Me,getText:He,remove:Ke,appendText:We}).children)}function ke(){return{}}function Ie(e){var t=e.children;return t&&t[t.length-1]}function Re(e,t){return"string"==typeof t&&(t={text:t}),t.parent=e,e.children=e.children||[],e.children.push(t),t}function We(e,t){e.text+=t}function Le(e){return e.parent}function Me(e){return"string"==typeof e.text}function He(e){return e.text}function Ke(e){var t=e.parent.children.indexOf(e);return-1!==t&&e.parent.children.splice(t,1),e}function Ve(e){var t=e.type,r=e.attributes,n=e.object,a=e.children,o="";for(var c in r)Object(Ae.isValidAttributeName)(c)&&(o+=" ".concat(c,'="').concat(Object(Ae.escapeAttribute)(r[c]),'"'));return n?"<".concat(t).concat(o,">"):"<".concat(t).concat(o,">").concat(Be(a),"</").concat(t,">")}function Be(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map((function(e){return void 0===e.text?Ve(e):Object(Ae.escapeEditableHTML)(e.text)})).join("")}function Ue(e,t){return K(e,t.type)?te(e,t.type):_(e,t)}function ze(e){var t=Object(o.select)("core/rich-text").getFormatType(e);if(t)return Object(o.dispatch)("core/rich-text").removeFormatTypes(e),t;window.console.error("Format ".concat(e," is not registered."))}function Ge(e){var t=U(e);if(void 0===t)return!1;var r=e.replacements,n=U(e,t),a=r[t]||[],o=r[n]||[];return a.length<=o.length}function qe(e){return void 0!==e.replacements[U(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 Ye(e,t){if(!Ge(e))return e;for(var r=U(e),n=U(e,r),a=e.text,o=e.replacements,i=e.end,u=o.slice(),s=function(e,t){for(var r=e.text,n=e.replacements,a=n[t]||[],o=t;o-- >=0;)if(r[o]===D){var c=n[o]||[];if(c.length===a.length+1)return o;if(c.length<=a.length)return}}(e,r),l=r;l<i;l++)if(a[l]===D)if(s){var f=o[s]||[];u[l]=f.concat((u[l]||[]).slice(f.length-1))}else{var p=o[n]||[],d=p[p.length-1]||t;u[l]=p.concat([d],(u[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(c.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:u})}function $e(e,t){for(var r=e.text,n=e.replacements,a=n[t]||[],o=t;o-- >=0;){if(r[o]===D)if((n[o]||[]).length===a.length-1)return o}}function Ze(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 Je(e){if(!qe(e))return e;for(var t=e.text,r=e.replacements,n=e.start,a=e.end,o=U(e,n),i=r.slice(0),u=r[$e(e,o)]||[],s=function(e,t){for(var r=e.text,n=e.replacements,a=n[t]||[],o=t,c=t||0;c<r.length;c++)if(r[c]===D){if(!((n[c]||[]).length>=a.length))return o;o=c}return o}(e,U(e,a)),l=o;l<=s;l++)if(t[l]===D){var f=i[l]||[];i[l]=u.concat(f.slice(u.length+1)),0===i[l].length&&delete i[l]}return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(r),!0).forEach((function(t){Object(c.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ze(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{replacements:i})}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,t){for(var r,n=e.text,a=e.replacements,o=e.start,i=e.end,u=U(e,o),s=a[u]||[],l=a[U(e,i)]||[],f=$e(e,u),p=a.slice(),d=s.length-1,b=l.length-1,m=f+1||0;m<n.length;m++)if(n[m]===D){if((p[m]||[]).length<=d)break;p[m]&&(r=!0,p[m]=p[m].map((function(e,r){return r<d||r>b?e:t})))}return r?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(c.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:p}):e}var tt=r(8),rt=r(14),nt=r(15),at=r(0),ot=r(11),ct=r.n(ot),it=r(21),ut=r(37),st=r.n(ut),lt=new Set(["a","audio","button","details","embed","iframe","input","label","select","textarea","video"]);function ft(e){var t=e.formatTypes,r=e.onChange,n=e.onFocus,a=e.value,o=e.allowedFormats,c=e.withoutInteractiveFormatting;return t.map((function(e){var t=e.name,i=e.edit,u=e.tagName;if(!i)return null;if(o&&-1===o.indexOf(t))return null;if(c&&lt.has(u))return null;var s=K(a,t),l=void 0!==s,f=V(a),p=void 0!==f&&f.type===t;return Object(at.createElement)(i,{key:t,isActive:l,activeAttributes:l&&s.attributes||{},isObjectActive:p,activeObjectAttributes:p&&f.attributes||{},value:a,onChange:r,onFocus:n})}))}function pt(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 dt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pt(Object(r),!0).forEach((function(t){Object(c.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function bt(e){return e("core/rich-text").getFormatTypes()}function mt(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 vt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mt(Object(r),!0).forEach((function(t){Object(c.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var gt=new Set(["insertParagraph","insertOrderedList","insertUnorderedList","insertHorizontalRule","insertLink"]),ht={whiteSpace:"pre-wrap"},Ot=[];function yt(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 jt,wt=(jt=function(e){var t=e.tagName,r=void 0===t?"div":t,n=e.value,a=void 0===n?"":n,o=e.selectionStart,c=e.selectionEnd,u=e.children,s=e.allowedFormats,l=e.withoutInteractiveFormatting,f=e.formatTypes,p=e.style,d=e.className,b=e.placeholder,m=e.disabled,v=e.preserveWhiteSpace,g=e.onPaste,h=e.format,y=void 0===h?"string":h,j=e.onDelete,w=e.onEnter,x=e.onSelectionChange,T=e.onChange,_=e.unstableOnFocus,E=e.setFocusedElement,P=e.instanceId,S=e.__unstableMultilineTag,F=e.__unstableMultilineRootTag,A=e.__unstableDisableFormats,N=e.__unstableDidAutomaticChange,k=e.__unstableInputRule,I=e.__unstableMarkAutomaticChange,R=e.__unstableAllowPrefixTransformations,W=e.__unstableUndo,L=e.__unstableIsCaretWithinFormattedText,M=e.__unstableOnEnterFormattedText,K=e.__unstableOnExitFormattedText,V=e.__unstableOnCreateUndoLevel,B=e.__unstableIsSelected,U=e.forwardedRef,z=Object(nt.a)(e,["tagName","value","selectionStart","selectionEnd","children","allowedFormats","withoutInteractiveFormatting","formatTypes","style","className","placeholder","disabled","preserveWhiteSpace","onPaste","format","onDelete","onEnter","onSelectionChange","onChange","unstableOnFocus","setFocusedElement","instanceId","__unstableMultilineTag","__unstableMultilineRootTag","__unstableDisableFormats","__unstableDidAutomaticChange","__unstableInputRule","__unstableMarkAutomaticChange","__unstableAllowPrefixTransformations","__unstableUndo","__unstableIsCaretWithinFormattedText","__unstableOnEnterFormattedText","__unstableOnExitFormattedText","__unstableOnCreateUndoLevel","__unstableIsSelected","forwardedRef"]),G=Object(at.useState)(),X=Object(rt.a)(G,2),$=X[0],Z=void 0===$?[]:$,J=X[1];function Q(){return U.current.ownerDocument}function ee(){return Q().defaultView}function re(e){if(A)return{text:e,formats:Array(e.length),replacements:Array(e.length)};if("string"!==y)return e;var t=yt(z,"format_value_functions"),r=C({html:e,multilineTag:S,multilineWrapperTags:"li"===S?["ul","ol"]:void 0,preserveWhiteSpace:v});return r.formats=t(r),r}function oe(e){return f.forEach((function(t){t.__experimentalCreatePrepareEditableTree&&(e=te(e,t.name,0,e.text.length))})),e}function ce(e){return A?e.text:(e=oe(e),"string"===y?Ne({value:e,multilineTag:S,preserveWhiteSpace:v}):void 0)}F||"string"!=typeof r||(F=r);var ie=Object(at.useRef)(a),ue=Object(at.useRef)(Object(at.useMemo)((function(){var e=re(a);return e.start=o,e.end=c,e}),[]));function le(){var e=ee().getSelection(),t=e.rangeCount>0?e.getRangeAt(0):null;return C({element:U.current,range:t,multilineTag:S,multilineWrapperTags:"li"===S?["ul","ol"]:void 0,__unstableIsEditableTree:!0,preserveWhiteSpace:v})}function fe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.domOnly;Ce({value:e,current:U.current,multilineTag:S,multilineWrapperTags:"li"===S?["ul","ol"]:void 0,prepareEditableTree:yt(z,"format_prepare_functions"),__unstableDomOnly:r,placeholder:b})}var pe=Object(at.useRef)(a);function de(){pe.current!==ie.current&&(V(),pe.current=ie.current)}var be=Object(at.useRef)(!1),me=Object(at.useRef)();function ve(e){var t;if(!be.current)if(e&&(t=e.inputType),!t&&e&&e.nativeEvent&&(t=e.nativeEvent.inputType),!t||0!==t.indexOf("format")&&!gt.has(t)){var r=le(),n=ue.current,a=n.start,o=n.activeFormats,c=void 0===o?[]:o,i=function(e){var t=e.value,r=e.start,n=e.end,a=e.formats,o=t.formats[r-1]||[],c=t.formats[n]||[];for(t.activeFormats=a.map((function(e,t){if(o[t]){if(O(e,o[t]))return o[t]}else if(c[t]&&O(e,c[t]))return c[t];return e}));--n>=r;)t.activeFormats.length>0?t.formats[n]=t.activeFormats:delete t.formats[n];return t}({value:r,start:a,end:r.start,formats:c});if(Oe(i,{withoutHistory:!0}),ee().clearTimeout(me.current),me.current=ee().setTimeout(de,1e3),"insertText"===t){R&&k&&k(i,ce);var u=f.reduce((function(e,t){var r=t.__unstableInputRule;return r&&(e=r(e)),e}),i);u!==i&&(de(),Oe(vt({},u,{activeFormats:c})),I())}}else fe(ue.current)}var ge=Object(at.useRef)(!1);function he(e){if(U.current&&document.activeElement===U.current&&("selectionchange"===e.type||B)&&!m&&!be.current){var t=le(),r=t.start,n=t.end,a=t.text,o=ue.current;if(a===o.text)if(r!==o.start||n!==o.end){var c=vt({},o,{start:r,end:n,activeFormats:void 0}),i=H(c,Ot);c.activeFormats=i,!L&&i.length?M():L&&!i.length&&K(),ue.current=c,fe(c,{domOnly:!0}),x(r,n),J(i)}else 0===o.text.length&&0===r&&function(e){var t=e.getSelection(),r=t.anchorNode,n=t.anchorOffset;if(r.nodeType===r.ELEMENT_NODE){var a=r.childNodes[n];a&&a.nodeType===a.ELEMENT_NODE&&a.getAttribute("data-rich-text-placeholder")&&t.collapseToStart()}}(ee());else ve()}}function Oe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.withoutHistory;A&&(e.formats=Array(e.text.length),e.replacements=Array(e.text.length)),fe(e);var n=e.start,a=e.end,o=e.activeFormats,c=void 0===o?[]:o,u=Object(i.pickBy)(z,(function(e,t){return t.startsWith("format_on_change_functions_")}));Object.values(u).forEach((function(t){t(e.formats,e.text)})),ie.current=ce(e),ue.current=e,x(n,a),T(ie.current),J(c),r||de()}function ye(e){var t=e.target;if(t!==U.current&&!t.textContent){var r=t.parentNode,n=Array.from(r.childNodes).indexOf(t),a=Q().createRange(),o=ee().getSelection();a.setStart(t.parentNode,n),a.setEnd(t.parentNode,n+1),o.removeAllRanges(),o.addRange(a)}}var je=Object(at.useRef)();function we(){ie.current=a,ue.current=re(a),ue.current.start=o,ue.current.end=c,fe(ue.current)}Object(at.useEffect)((function(){ge.current&&we()}),[r,b]),Object(at.useEffect)((function(){ge.current&&a!==ie.current&&we()}),[a]),Object(at.useEffect)((function(){ge.current&&(!B||o===ue.current.start&&c===ue.current.end?ue.current=vt({},ue.current,{start:o,end:c}):we())}),[o,c,B]);var xe=Object(i.pickBy)(z,(function(e,t){return t.startsWith("format_prepare_props_")}));function Te(){U.current.focus(),fe(ue.current)}Object(at.useEffect)((function(){ge.current&&we()}),Object.values(xe)),Object(at.useLayoutEffect)((function(){return fe(ue.current,{domOnly:!0}),ge.current=!0,function(){Q().removeEventListener("selectionchange",he),ee().cancelAnimationFrame(je.current),ee().clearTimeout(me.current)}}),[]);var _e=Object(i.pickBy)(z,(function(e,t){return Object(i.startsWith)(t,"aria-")})),Ee=vt({role:"textbox","aria-multiline":!0,"aria-label":b},_e,{ref:U,style:p?vt({},p,{whiteSpace:"pre-wrap"}):ht,className:ct()("rich-text",d),onPaste:function(e){if(B){var t=e.clipboardData,r=t.items,n=t.files;r=Object(i.isNil)(r)?[]:r,n=Object(i.isNil)(n)?[]:n;var a="",o="";try{a=t.getData("text/plain"),o=t.getData("text/html")}catch(e){try{o=t.getData("Text")}catch(e){return}}if(e.preventDefault(),window.console.log("Received HTML:\n\n",o),window.console.log("Received plain text:\n\n",a),A)Oe(ne(ue.current,a));else{var c=f.reduce((function(e,t){var r=t.__unstablePasteRule;return r&&e===ue.current&&(e=r(ue.current,{html:o,plainText:a})),e}),ue.current);c===ue.current?g&&(n=Array.from(n),Array.from(r).forEach((function(e){if(e.getAsFile){var t=e.getAsFile();if(t){var r=t.name,a=t.type,o=t.size;Object(i.find)(n,{name:r,type:a,size:o})||n.push(t)}}})),g({value:oe(ue.current),onChange:Oe,html:o,plainText:a,files:n,activeFormats:Z})):Oe(c)}}else e.preventDefault()},onInput:ve,onCompositionStart:function(){be.current=!0,Q().removeEventListener("selectionchange",he)},onCompositionEnd:function(){be.current=!1,ve({inputType:"insertText"}),Q().addEventListener("selectionchange",he)},onKeyDown:function(e){e.defaultPrevented||(function(e){var t=e.keyCode;if(t===it.DELETE||t===it.BACKSPACE||t===it.ESCAPE){if(N)return e.preventDefault(),void W();if(t!==it.ESCAPE){var r,n=le(),a=n.start,o=n.end,c=n.text,i=t===it.BACKSPACE;if(0===a&&0!==o&&o===c.length)return Oe(ae(n)),void e.preventDefault();if(S&&(r=i&&0===n.start&&0===n.end&&Y(n)?se(n,!i):se(n,i)))return Oe(r),void e.preventDefault();!j||!q(n)||Z.length||i&&0!==a||!i&&o!==c.length||(j({isReverse:i,value:n}),e.preventDefault())}}}(e),function(e){e.keyCode===it.ENTER&&(e.preventDefault(),w&&w({value:oe(le()),onChange:Oe,shiftKey:e.shiftKey}))}(e),function(e){var t=e.keyCode,r=e.shiftKey,n=e.altKey,a=e.metaKey,o=e.ctrlKey;if(!(r||n||a||o||t!==it.SPACE||"li"!==S)){var c=le();if(q(c)){var i=c.text[c.start-1];i&&i!==D||(Oe(Ye(c,{type:F})),e.preventDefault())}}}(e),function(e){var t=e.keyCode,r=e.shiftKey,n=e.altKey,a=e.metaKey,o=e.ctrlKey;if(!(r||n||a||o||t!==it.LEFT&&t!==it.RIGHT)){var c=ue.current,i=c.text,u=c.formats,s=c.start,l=c.end,f=c.activeFormats,p=void 0===f?[]:f,d=q(ue.current),b="rtl"===ee().getComputedStyle(U.current).direction?it.RIGHT:it.LEFT,m=e.keyCode===b;if(d&&0===p.length){if(0===s&&m)return;if(l===i.length&&!m)return}if(d){e.preventDefault();var v=u[s-1]||Ot,g=u[s]||Ot,h=p.length,O=g;if(v.length>g.length&&(O=v),v.length<g.length?(!m&&p.length<g.length&&h++,m&&p.length>v.length&&h--):v.length>g.length&&(!m&&p.length>g.length&&h--,m&&p.length<v.length&&h++),h!==p.length){var y=O.slice(0,h),j=vt({},ue.current,{activeFormats:y});return ue.current=j,fe(j),void J(y)}var w=s+(m?-1:1),T=m?v:g,_=vt({},ue.current,{start:w,end:w,activeFormats:T});ue.current=_,fe(_),x(w,w),J(T)}}}(e))},onFocus:function(){_&&_(),B?(x(ue.current.start,ue.current.end),J(H(vt({},ue.current,{activeFormats:void 0}),Ot))):(ue.current=vt({},ue.current,{start:void 0,end:void 0,activeFormats:Ot}),x(void 0,void 0),J(Ot)),je.current=ee().requestAnimationFrame(he),Q().addEventListener("selectionchange",he),E&&(st()("wp.blockEditor.RichText setFocusedElement prop",{alternative:"selection state from the block editor store."}),E(P))},onBlur:function(){Q().removeEventListener("selectionchange",he)},onMouseDown:ye,onTouchStart:ye,onKeyUp:he,onMouseUp:he,onTouchEnd:he,contentEditable:!m||void 0,suppressContentEditableWarning:!m});return function(e){var t=e.activeFormats,r=e.ref;Object(at.useEffect)((function(){if(t&&t.length){var e=r.current.querySelector("*[data-rich-text-format-boundary]");if(e){var n=e.ownerDocument,a=n.defaultView.getComputedStyle(e).color.replace(")",", 0.2)").replace("rgb","rgba"),o=".rich-text:focus ".concat("*[data-rich-text-format-boundary]"),c="background-color: ".concat(a),i="".concat(o," {").concat(c,"}"),u=n.getElementById("rich-text-boundary-style");u||((u=n.createElement("style")).id="rich-text-boundary-style",n.head.appendChild(u)),u.innerHTML!==i&&(u.innerHTML=i)}}}),[t])}({ref:U,activeFormats:Z}),function(e){e.ref,Object(at.useEffect)((function(){}),[])}({ref:U}),Object(at.createElement)(at.Fragment,null,B&&Object(at.createElement)(ft,{allowedFormats:s,withoutInteractiveFormatting:l,value:ue.current,onChange:Oe,onFocus:Te,formatTypes:f}),u&&u({isSelected:B,value:ue.current,onChange:Oe,onFocus:Te,editableProps:Ee,editableTagName:r}),!u&&Object(at.createElement)(r,Ee))},function(e){var t=e.clientId,r=e.identifier,n=Object(o.useSelect)(bt,[]),a=Object(o.useSelect)((function(e){return n.reduce((function(n,a){if(!a.__experimentalGetPropsForEditableTreePreparation)return n;var o="format_prepare_props_(".concat(a.name,")_");return dt({},n,{},Object(i.mapKeys)(a.__experimentalGetPropsForEditableTreePreparation(e,{richTextIdentifier:r,blockClientId:t}),(function(e,t){return o+t})))}),{})}),[n,t,r]),u=Object(o.__unstableUseDispatchWithMap)((function(e){return n.reduce((function(n,a){if(!a.__experimentalGetPropsForEditableTreeChangeHandler)return n;var o="format_on_change_props_(".concat(a.name,")_");return dt({},n,{},Object(i.mapKeys)(a.__experimentalGetPropsForEditableTreeChangeHandler(e,{richTextIdentifier:r,blockClientId:t}),(function(e,t){return o+t})))}),{})}),[n,t,r]),s=Object(at.useMemo)((function(){return n.reduce((function(e,n){if(!n.__experimentalCreatePrepareEditableTree)return e;var o,i={richTextIdentifier:r,blockClientId:t},s=dt({},a,{},u),l=n.name,f="format_prepare_props_(".concat(l,")_"),p="format_on_change_props_(".concat(l,")_"),d=Object.keys(s).reduce((function(e,t){return t.startsWith(f)&&(e[t.slice(f.length)]=s[t]),t.startsWith(p)&&(e[t.slice(p.length)]=s[t]),e}),{});return n.__experimentalCreateOnChangeEditableValue?dt({},e,(o={},Object(c.a)(o,"format_value_functions_(".concat(l,")"),n.__experimentalCreatePrepareEditableTree(d,i)),Object(c.a)(o,"format_on_change_functions_(".concat(l,")"),n.__experimentalCreateOnChangeEditableValue(d,i)),o)):dt({},e,Object(c.a)({},"format_prepare_functions_(".concat(l,")"),n.__experimentalCreatePrepareEditableTree(d,i)))}),{})}),[n,t,r,a,u]);return Object(at.createElement)(jt,Object(tt.a)({},e,a,s,{formatTypes:n}))}),xt=Object(at.forwardRef)((function(e,t){return Object(at.createElement)(wt,Object(tt.a)({},e,{forwardedRef:t}))}))},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}))},8: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}))},89:function(e,t){!function(){e.exports=this.wp.escapeHtml}()}});