WordPress/wp-includes/js/dist/rich-text.min.js
jorgefilipecosta b667105f60 Editor: update packages; Port block supports to WordPress core.
The following package versions were changed:
@wordpress/a11y: 2.11.0 -> 2.13.0
@wordpress/annotations: 1.20.4 -> 1.22.0
@wordpress/api-fetch: 3.18.0 -> 3.20.0
@wordpress/autop: 2.9.0 -> 2.10.0
@wordpress/blob: 2.9.0 -> 2.10.0
@wordpress/block-directory: 1.13.7 -> 1.16.0
@wordpress/block-editor: 4.3.7 -> 5.0.0
@wordpress/block-library: 2.22.7 -> 2.25.0
@wordpress/block-serialization-default-parser: 3.7.0 -> 3.8.0
@wordpress/blocks: 6.20.3 -> 6.23.0
@wordpress/components: 10.0.6 -> 11.0.0
@wordpress/compose: 3.19.3 -> 3.21.0
@wordpress/core-data: 2.20.3 -> 2.23.0
@wordpress/data: 4.22.3 -> 4.24.0
@wordpress/data-controls: 1.16.3 -> 1.18.0
@wordpress/date: 3.10.0 -> 3.12.0
@wordpress/deprecated: 2.9.0 -> 2.10.0
@wordpress/dom: 2.13.1 -> 2.15.0
@wordpress/dom-ready: 2.10.0 -> 2.11.0
@wordpress/e2e-test-utils: 4.11.2 -> 4.14.0
@wordpress/edit-post: 3.21.7 -> 3.24.0
@wordpress/editor: 9.20.7 -> 9.23.0
@wordpress/element: 2.16.0 -> 2.18.0
@wordpress/escape-html: 1.9.0 -> 1.10.0
@wordpress/format-library: 1.22.7 -> 1.24.0
@wordpress/hooks: 2.9.0 -> 2.10.0
@wordpress/html-entities: 2.8.0 -> 2.9.0
@wordpress/i18n: 3.14.0 -> 3.16.0
@wordpress/icons: 2.4.0 -> 2.7.0
@wordpress/is-shallow-equal: 2.1.0 -> 2.3.0
@wordpress/keyboard-shortcuts: 1.9.3 -> 1.11.0
@wordpress/keycodes: 2.14.0 -> 2.16.0
@wordpress/library-export-default-webpack-plugin: 1.7.0 -> 1.9.0
@wordpress/list-reusable-blocks: 1.21.6 -> 1.23.0
@wordpress/media-utils: 1.15.0 -> 1.17.0
@wordpress/notices: 2.8.3 -> 2.10.0
@wordpress/nux: 3.20.6 -> 3.22.0
@wordpress/plugins: 2.20.3 -> 2.22.0
@wordpress/primitives: 1.7.0 -> 1.9.0
@wordpress/priority-queue: 1.7.0 -> 1.9.0
@wordpress/redux-routine: 3.10.0 -> 3.12.0
@wordpress/rich-text: 3.20.4 -> 3.22.0
@wordpress/scripts: 12.1.1 -> 12.3.0
@wordpress/server-side-render: 1.16.6 -> 1.18.0
@wordpress/shortcode: 2.9.0 -> 2.11.0
@wordpress/token-list: 1.11.0 -> 1.13.0
@wordpress/url: 2.17.0 -> 2.19.0
@wordpress/viewport: 2.21.3 -> 2.23.0
@wordpress/warning: 1.2.0 -> 1.3.0
@wordpress/wordcount: 2.10.0 -> 2.12.0

Props isabel_brison, youknowriad, mcsf.
Fixes #51461.
Built from https://develop.svn.wordpress.org/trunk@49135


git-svn-id: http://core.svn.wordpress.org/trunk@48897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-13 13:10:30 +00:00

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