/*! 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="yyEc")}({"1CF3":function(e,t){e.exports=window.wp.dom},"1ZqX":function(e,t){e.exports=window.wp.data},"25BE":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}))},BsWD:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r("a3WO");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}}},DSFK:function(e,t,r){"use strict";function n(e){if(Array.isArray(e))return e}r.d(t,"a",(function(){return n}))},GRId:function(e,t){e.exports=window.wp.element},KQm4:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r("a3WO");var a=r("25BE"),o=r("BsWD");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.")}()}},NMb1:function(e,t){e.exports=window.wp.deprecated},ODXe:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r("DSFK");var a=r("BsWD"),o=r("PYwp");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)()}},PYwp: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}))},RxS6:function(e,t){e.exports=window.wp.keycodes},U8pU: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}))},Vx3V:function(e,t){e.exports=window.wp.escapeHtml},YLtl:function(e,t){e.exports=window.lodash},a3WO: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);r0&&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("pPDe"),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)}}var O=Object(o.createReduxStore)("core/rich-text",{reducer:l,selectors:n,actions:a});Object(o.register)(O);var y=r("KQm4");function h(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;c2&&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]=P(i[r],s,t),r--;for(n++;i[n]&&i[n][s]===u;)i[n]=P(i[n],s,t),n++}}else{for(var l=1/0,f=r;f0&&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=S(document,n)),"object"!==Object(_.a)(t)?{formats:[],replacements:[],text:""}:o?M({element:t,range:a,multilineTag:o,multilineWrapperTags:i,isEditableTree:c,preserveWhiteSpace:u}):W({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 L(e){return e.replace(k,"")}function W(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=L;s||(p=function(e){return L(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:""}),V(l,R({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=N(t.attributes,c);u?a[u]=n[c]:i[c]=n[c]}return{type:t.name,attributes:a,unregisteredAttributes:i}}({type:f,attributes:H({element:i})}),g=h(v,m)?m:v;if(a&&-1!==a.indexOf(f)){var O=M({element:i,range:r,multilineTag:n,multilineWrapperTags:a,currentWrapperTags:[].concat(Object(y.a)(c),[g]),isEditableTree:u,preserveWhiteSpace:s});return I(l,i,r,O),V(l,O),"continue"}var j=W({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&&V(l,{formats:[,],replacements:[g],text:""});else{function w(e){if(w.formats===e)return w.newFormats;var t=e?[g].concat(Object(y.a)(e)):[g];return w.formats=e,w.newFormats=t,t}w.newFormats=[g],V(l,A(A({},j),{},{formats:Array.from(j.formats,w)}))}else V(l,j)},d=0;d0)&&V(s,{formats:[,],replacements:i.length>0?[i]:[,],text:F}),I(s,p,r,d),V(s,d)}}return s}function H(e){var t=e.element;if(t.hasAttributes()){for(var r,n=t.attributes.length,a=0;a1&&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.length1&&void 0!==arguments[1]?arguments[1]:t,a=n;a--;)if(r[a]===F)return a}function q(e){var t=e.replacements[Y(e,e.start)];return!t||t.length<1}function z(e,t,r){var n=e.replacements[Y(e,e.start)];return n&&0!==n.length?n[n.length-1].type===t:t===r}function Z(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 Q(e){var t=e.text,r=e.start,n=e.end;return r===n&&(0===t.length||(0===r&&t.slice(0,1)===F||(r===t.length&&t.slice(-1)===F||t.slice(r-1,n+1)==="".concat(F).concat(F))))}function J(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"string"==typeof t&&(t=R({text:t})),T(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 ee(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function te(e,t){if("string"==typeof(t=function(e){for(var t=1;t3)window.console.error('The format "'+t.name+'" can have a maximum of 3 keywords.');else{if("string"==typeof t.title)return Object(o.dispatch)(O).addFormatTypes(t),t;window.console.error("Format titles must be strings.")}else window.console.error('The format "'+t.name+'" must have a title.')}else window.console.error("A class name must begin with a letter, followed by any number of hyphens, letters, or numbers.");else window.console.error("Format class names must be a string, or null to handle bare elements.");else window.console.error("Format tag names must be a string.");else window.console.error("Format names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-format");else window.console.error("Format names must be strings.")}function re(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ne(e){for(var t=1;t2&&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);)oe(i,r,t),r--;for(n++;Object(c.find)(i[n],u);)oe(i,n,t),n++}}else for(var s=r;s2&&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=R({text:t}));var c=r+t.text.length;return T({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 ce(e,t,r){return ie(e,R(),t,r)}function ue(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;u1&&void 0!==arguments[1]?arguments[1]:e.start,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.end,n=G(e).slice(0,t),a=n.lastIndexOf(F),o=e.replacements[a],i=[,];o&&(i=[o]);var c={formats:[,],replacements:i,text:F};return ie(e,c,t,r)}function le(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 fe(e){for(var t=1;t1&&void 0!==arguments[1])||arguments[1],r=e.replacements,n=e.text,a=e.start,o=e.end,i=Z(e),c=a-1,u=i?a-1:a,s=o;if(t||(c=o,u=a,s=i?o+1:o),n[c]===F){var l;if(i&&r[c]&&r[c].length){var f=r.slice();f[c]=r[c].slice(0,-1),l=fe(fe({},e),{},{replacements:f})}else l=ce(e,u,s);return l}}function de(e,t,r,n){return ie(e,{formats:[,],replacements:[t],text:""},r,n)}function be(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 me(e){for(var t=1;t1&&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?me({},e):{formats:n.slice(t,r),replacements:a.slice(t,r),text:o.slice(t,r)}}function ge(e,t){var r=e.formats,n=e.replacements,a=e.text,o=e.start,i=e.end;if("string"!=typeof t)return Oe.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&&oa&&(u.start=0),i>=a&&ic&&(u.end=e.length)),u}))}function Oe(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[ue(u,/\u2028+$/,""),ue(s,/^\u2028+/,"")]}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 he(e){for(var t=1;t1;)e=e.childNodes[t.shift()];return{node:e,offset:t[0]}}function De(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 Se(e){return e.lastChild}function Fe(e){return e.parentNode}function Ce(e){return e.nodeType===e.TEXT_NODE}function Ae(e){return e.nodeValue}function Ne(e){return e.parentNode.removeChild(e)}function Re(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=xe(xe({},t),{},{formats:n(t)}));return{body:we({value:t,multilineTag:r,createEmpty:function(){return S(u,"")},append:De,getLastChild:Se,getParent:Fe,isText:Ce,getText:Ae,remove:Ne,appendText:_e,onStartIndex:function(e,t){s=Ee(t,e,[t.nodeValue.length])},onEndIndex:function(e,t){l=Ee(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=Re({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;l0){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("Vx3V");function Le(e){return Ye(we({value:e.value,multilineTag:e.multilineTag,preserveWhiteSpace:e.preserveWhiteSpace,createEmpty:We,append:He,getLastChild:Me,getParent:Be,isText:Ke,getText:Ue,remove:Xe,appendText:Ve}).children)}function We(){return{}}function Me(e){var t=e.children;return t&&t[t.length-1]}function He(e,t){return"string"==typeof t&&(t={text:t}),t.parent=e,e.children=e.children||[],e.children.push(t),t}function Ve(e,t){e.text+=t}function Be(e){return e.parent}function Ke(e){return"string"==typeof e.text}function Ue(e){return e.text}function Xe(e){var t=e.parent.children.indexOf(e);return-1!==t&&e.parent.children.splice(t,1),e}function Ge(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(Ye(a),"")}function Ye(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map((function(e){return void 0===e.text?Ge(e):Object(ke.escapeEditableHTML)(e.text)})).join("")}function qe(e,t){return U(e,t.type)?ae(e,t.type):D(e,t)}function ze(e){var t=Object(o.select)(O).getFormatType(e);if(t)return Object(o.dispatch)(O).removeFormatTypes(e),t;window.console.error("Format ".concat(e," is not registered."))}function Ze(e){var t=Y(e);if(void 0===t)return!1;var r=e.replacements,n=Y(e,t),a=r[t]||[],o=r[n]||[];return a.length<=o.length}function $e(e){return void 0!==e.replacements[Y(e,e.start)]}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 Je(e){for(var t=1;t=0;)if(r[o]===F){var i=n[o]||[];if(i.length===a.length+1)return o;if(i.length<=a.length)return}}(e,r),s=r;s=0;){if(r[o]===F)if((n[o]||[]).length===a.length-1)return o}}function rt(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 nt(e){for(var t=1;t=a.length))return o;o=i}return o}(e,Y(e,a)),s=o;s<=u;s++)if(t[s]===F){var l=i[s]||[];i[s]=c.concat(l.slice(c.length+1)),0===i[s].length&&delete i[s]}return nt(nt({},e),{},{replacements:i})}function ot(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 it(e){for(var t=1;td?e:t})))}return r?it(it({},e),{},{replacements:f}):e}var ut=r("GRId");function st(e){var t=e.ref,r=e.value,n=e.settings,a=void 0===n?{}:n,o=a.tagName,i=a.className,c=a.name,u=c?U(r,c):void 0;return Object(ut.useMemo)((function(){if(t.current){var e=t.current.ownerDocument.defaultView.getSelection();if(e.rangeCount){var r=e.getRangeAt(0);if(!u)return r;var n=r.startContainer;for(n=n.nextElementSibling||n;n.nodeType!==n.ELEMENT_NODE;)n=n.parentNode;return n.closest(o+(i?"."+i:""))}}}),[u,r.start,r.end,o,i])}var lt=r("ODXe"),ft=r("RxS6"),pt=r("NMb1"),dt=r.n(pt),bt=r("1CF3");function mt(e){var t=e.formatTypes,r=e.onChange,n=e.onFocus,a=e.value,o=e.forwardedRef;return t.map((function(e){var t=e.name,i=e.edit;if(!i)return null;var c=U(a,t),u=void 0!==c,s=X(a),l=void 0!==s&&s.type===t;return Object(ut.createElement)(i,{key:t,isActive:u,activeAttributes:u&&c.attributes||{},isObjectActive:l,activeObjectAttributes:l&&s.attributes||{},value:a,onChange:r,onFocus:n,contentRef:o})}))}function vt(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 gt(e){for(var t=1;t0?e.getRangeAt(0):null;return R({element:t.current,range:r,multilineTag:S,multilineWrapperTags:"li"===S?["ul","ol"]:void 0,__unstableIsEditableTree:!0,preserveWhiteSpace:b})}function ve(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.domOnly;Ie({value:e,current:t.current,multilineTag:S,multilineWrapperTags:"li"===S?["ul","ol"]:void 0,prepareEditableTree:Et(ee),__unstableDomOnly:n,placeholder:p})}var ge=Object(ut.useRef)(i);function Oe(){ge.current!==de.current&&(B(),ge.current=de.current)}var ye=Object(ut.useRef)(!1),he=Object(ut.useRef)();function je(e){var t;if(!ye.current)if(e&&(t=e.inputType),!t&&e&&e.nativeEvent&&(t=e.nativeEvent.inputType),!t||0!==t.indexOf("format")&&!wt.has(t)){var r=me(),n=be.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(h(e,o[t]))return o[t]}else if(i[t]&&h(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(xe(c,{withoutHistory:!0}),ue().clearTimeout(he.current),he.current=ue().setTimeout(Oe,1e3),"insertText"===t){L&&I&&I(c,fe);var u=J.reduce((function(e,t){var r=t.__unstableInputRule;return r&&(e=r(e)),e}),c);u!==c&&(Oe(),xe(jt(jt({},u),{},{activeFormats:i})),k())}}else ve(be.current)}var we=Object(ut.useRef)(!1);function Te(e){if(t.current&&t.current.ownerDocument.activeElement===t.current&&("selectionchange"===e.type||U)&&!d&&!ye.current){var r=me(),n=r.start,a=r.end,o=r.text,i=be.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,xt);c.activeFormats=u,!M&&u.length?H():M&&!u.length&&V(),be.current=c,ve(c,{domOnly:!0}),w(n,a),z(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()}}(ue());else je()}}function xe(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)),ve(e);var n=e.start,a=e.end,o=e.activeFormats,i=void 0===o?[]:o;Object.values(re).forEach((function(t){t(e.formats,e.text)})),de.current=fe(e),be.current=e,w(n,a),T(de.current),z(i),r||Oe()}function Ee(e){var r=e.target;if(r!==t.current&&!r.textContent){var n=r.parentNode,a=Array.from(n.childNodes).indexOf(r),o=oe().createRange(),i=ue().getSelection();o.setStart(r.parentNode,a),o.setEnd(r.parentNode,a+1),i.removeAllRanges(),i.addRange(o)}}var Pe=Object(ut.useRef)();function De(){de.current=i,be.current=se(i),be.current.start=c,be.current.end=u,ve(be.current)}function _e(){t.current.focus(),ve(be.current)}Object(ut.useEffect)((function(){we.current&&De()}),[n,p]),Object(ut.useEffect)((function(){we.current&&i!==de.current&&De()}),[i]),Object(ut.useEffect)((function(){we.current&&(!U||c===be.current.start&&u===be.current.end?be.current=jt(jt({},be.current),{},{start:c,end:u}):De())}),[c,u,U]),Object(ut.useEffect)((function(){we.current&&De()}),ne),Object(ut.useLayoutEffect)((function(){return ve(be.current,{domOnly:!0}),we.current=!0,function(){oe().removeEventListener("selectionchange",Te),ue().cancelAnimationFrame(Pe.current),ue().clearTimeout(he.current)}}),[]);var Se={role:"textbox","aria-multiline":!0,"aria-label":p,ref:t,style:Tt,className:"rich-text",onPaste:function(e){if(U){var t=e.clipboardData,r="",n="";try{r=t.getData("text/plain"),n=t.getData("text/html")}catch(e){try{n=t.getData("Text")}catch(e){return}}if(e.preventDefault(),window.console.log("Received HTML:\n\n",n),window.console.log("Received plain text:\n\n",r),A)xe(ie(be.current,r));else{var a=J.reduce((function(e,t){var a=t.__unstablePasteRule;return a&&e===be.current&&(e=a(be.current,{html:n,plainText:r})),e}),be.current);if(a===be.current){if(m){var o=Object(bt.getFilesFromDataTransfer)(t);m({value:le(be.current),onChange:xe,html:n,plainText:r,files:Object(y.a)(o),activeFormats:q})}}else xe(a)}}else e.preventDefault()},onInput:je,onCompositionStart:function(){ye.current=!0,oe().removeEventListener("selectionchange",Te)},onCompositionEnd:function(){ye.current=!1,je({inputType:"insertText"}),oe().addEventListener("selectionchange",Te)},onKeyDown:function(e){e.defaultPrevented||(function(e){var t=e.keyCode;if(t===ft.DELETE||t===ft.BACKSPACE||t===ft.ESCAPE){if(N)return e.preventDefault(),void W();if(t!==ft.ESCAPE){var r,n=me(),a=n.start,o=n.end,i=n.text,c=t===ft.BACKSPACE;if(0===a&&0!==o&&o===i.length)return xe(ce(n)),void e.preventDefault();if(S)if(r=c&&0===n.start&&0===n.end&&Q(n)?pe(n,!c):pe(n,c))return xe(r),void e.preventDefault();!O||!Z(n)||q.length||c&&0!==a||!c&&o!==i.length||(O({isReverse:c,value:n}),e.preventDefault())}}}(e),function(e){e.keyCode===ft.ENTER&&(e.preventDefault(),j&&j({value:le(me()),onChange:xe,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!==ft.SPACE||"li"!==S)){var i=me();if(Z(i)){var c=i.text[i.start-1];c&&c!==F||(xe(et(i,{type:C})),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!==ft.LEFT&&r!==ft.RIGHT)){var c=be.current,u=c.text,s=c.formats,l=c.start,f=c.end,p=c.activeFormats,d=void 0===p?[]:p,b=Z(be.current),m="rtl"===ue().getComputedStyle(t.current).direction?ft.RIGHT:ft.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]||xt,O=s[l]||xt,y=d.length,h=O;if(g.length>O.length&&(h=g),g.lengthg.length&&y--):g.length>O.length&&(!v&&d.length>O.length&&y--,v&&d.length