/*! This file is auto-generated */ this.wp=this.wp||{},this.wp.richText=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=414)}({0:function(e,t){!function(){e.exports=this.wp.element}()},10:function(e,t,r){var n; /*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_FORMAT_TYPES":return function(e){for(var t=1;t=0}))}function b(e){return{type:"ADD_FORMAT_TYPES",formatTypes:Object(c.castArray)(e)}}function m(e){return{type:"REMOVE_FORMAT_TYPES",names:Object(c.castArray)(e)}}Object(a.registerStore)("core/rich-text",{reducer:u,selectors:n,actions:o});var v=r(17);function g(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.type!==t.type)return!1;var r=e.attributes,n=t.attributes;if(r===n)return!0;if(!r||!n)return!1;var o=Object.keys(r),a=Object.keys(n);if(o.length!==a.length)return!1;for(var i=o.length,c=0;c2&&void 0!==arguments[2]?arguments[2]:e.start,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.end,o=e.formats,a=e.activeFormats,s=o.slice();if(r===n){var u=Object(c.find)(s[r],{type:t.type});if(u){for(var l=s[r].indexOf(u);s[r]&&s[r][l]===u;)s[r]=w(s[r],l,t),r--;for(n++;s[n]&&s[n][l]===u;)s[n]=w(s[n],l,t),n++}}else{for(var f=1/0,p=r;p0&&void 0!==arguments[0]?arguments[0]:{},t=e.element,r=e.text,n=e.html,o=e.range,a=e.multilineTag,i=e.multilineWrapperTags,c=e.__unstableIsEditableTree,s=e.preserveWhiteSpace;return"string"==typeof r&&r.length>0?{formats:Array(r.length),replacements:Array(r.length),text:r}:("string"==typeof n&&n.length>0&&(t=x(document,n)),"object"!==Object(E.a)(t)?{formats:[],replacements:[],text:""}:a?M({element:t,range:o,multilineTag:a,multilineWrapperTags:i,isEditableTree:c,preserveWhiteSpace:s}):W({element:t,range:o,isEditableTree:c,preserveWhiteSpace:s}))}function R(e,t,r,n){if(r){var o=t.parentNode,a=r.startContainer,i=r.startOffset,c=r.endContainer,s=r.endOffset,u=e.text.length;void 0!==n.start?e.start=u+n.start:t===a&&t.nodeType===F?e.start=u+i:o===a&&t===a.childNodes[i]?e.start=u:o===a&&t===a.childNodes[i-1]?e.start=u+n.text.length:t===a&&(e.start=u),void 0!==n.end?e.end=u+n.end:t===c&&t.nodeType===F?e.end=u+s:o===c&&t===c.childNodes[s-1]?e.end=u+n.text.length:o===c&&t===c.childNodes[s]?e.end=u:t===c&&(e.end=u+s)}}var I=new RegExp(S,"g");function L(e){return e.replace(I,"")}function W(e){var t=e.element,r=e.range,n=e.multilineTag,o=e.multilineWrapperTags,c=e.currentWrapperTags,s=void 0===c?[]:c,u=e.isEditableTree,l=e.preserveWhiteSpace,f={formats:[],replacements:[],text:""};if(!t)return f;if(!t.hasChildNodes())return R(f,t,r,{formats:[],replacements:[],text:""}),f;for(var p=t.childNodes.length,d=function(e){var c=t.childNodes[e],p=c.nodeName.toLowerCase();if(c.nodeType===F){var d=L;l||(d=function(e){return L(function(e){return e.replace(/[\n\r\t]+/g," ")}(e))});var h=d(c.nodeValue);return r=function(e,t,r){if(t){var n=t.startContainer,o=t.endContainer,a=t.startOffset,i=t.endOffset;return e===n&&(a=r(e.nodeValue.slice(0,a)).length),e===o&&(i=r(e.nodeValue.slice(0,i)).length),{startContainer:n,startOffset:a,endContainer:o,endOffset:i}}}(c,r,d),R(f,c,r,{text:h}),f.formats.length+=h.length,f.replacements.length+=h.length,f.text+=h,"continue"}if(c.nodeType!==N)return"continue";if(u&&(c.getAttribute("data-rich-text-placeholder")||"br"===p&&!c.getAttribute("data-rich-text-line-break")))return R(f,c,r,{formats:[],replacements:[],text:""}),"continue";if("br"===p)return R(f,c,r,{formats:[],replacements:[],text:""}),K(f,A({text:"\n"})),"continue";var b=f.formats[f.formats.length-1],m=b&&b[b.length-1],y=function(e){var t,r=e.type,n=e.attributes;if(n&&n.class&&(t=Object(a.select)("core/rich-text").getFormatTypeForClassName(n.class))&&(n.class=" ".concat(n.class," ").replace(" ".concat(t.className," ")," ").trim(),n.class||delete n.class),t||(t=Object(a.select)("core/rich-text").getFormatTypeForBareElement(r)),!t)return n?{type:r,attributes:n}:{type:r};if(t.__experimentalCreatePrepareEditableTree&&!t.__experimentalCreateOnChangeEditableValue)return null;if(!n)return{type:t.name};var o={},i={};for(var c in n){var s=k(t.attributes,c);s?o[s]=n[c]:i[c]=n[c]}return{type:t.name,attributes:o,unregisteredAttributes:i}}({type:p,attributes:H({element:c})}),O=g(y,m)?m:y;if(o&&-1!==o.indexOf(p)){var j=M({element:c,range:r,multilineTag:n,multilineWrapperTags:o,currentWrapperTags:[].concat(Object(v.a)(s),[O]),isEditableTree:u,preserveWhiteSpace:l});return R(f,c,r,j),K(f,j),"continue"}var w=W({element:c,range:r,multilineTag:n,multilineWrapperTags:o,isEditableTree:u,preserveWhiteSpace:l});if(R(f,c,r,w),O)if(0===w.text.length)O.attributes&&K(f,{formats:[,],replacements:[O],text:_});else{function T(e){if(T.formats===e)return T.newFormats;var t=e?[O].concat(Object(v.a)(e)):[O];return T.formats=e,T.newFormats=t,t}T.newFormats=[O],K(f,function(e){for(var t=1;t0)&&K(u,{formats:[,],replacements:i.length>0?[i]:[,],text:P}),R(u,p,r,d),K(u,d)}}return u}function H(e){var t=e.element;if(t.hasAttributes()){for(var r,n=t.attributes.length,o=0;o1&&void 0!==arguments[1]?arguments[1]:[];if(void 0===r)return a;if(r===n){if(o)return o;var i=t[r-1]||a,c=t[r]||a;return i.length1&&void 0!==arguments[1]?arguments[1]:t;n--;)if(r[n]===P)return n}function Y(e){var t=e.replacements[G(e,e.start)];return!t||t.length<1}function $(e,t,r){var n=e.replacements[G(e,e.start)];return n&&0!==n.length?n[n.length-1].type===t:t===r}function X(e){var t=e.start,r=e.end;if(void 0!==t&&void 0!==r)return t===r}function Z(e){return 0===e.text.length}function J(e){var t=e.text,r=e.start,n=e.end;return r===n&&(0===t.length||(0===r&&t.slice(0,1)===P||(r===t.length&&t.slice(-1)===P||t.slice(r-1,n+1)==="".concat(P).concat(P))))}function Q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"string"==typeof t&&(t=A({text:t})),O(e.reduce((function(e,r){var n=r.formats,o=r.replacements,a=r.text;return{formats:e.formats.concat(t.formats,n),replacements:e.replacements.concat(t.replacements,o),text:e.text+t.text+a}})))}function ee(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function te(e,t){if("string"==typeof(t=function(e){for(var t=1;t3)window.console.error('The format "'+t.name+'" can have a maximum of 3 keywords.');else{if("string"==typeof t.title)return Object(a.dispatch)("core/rich-text").addFormatTypes(t),t;window.console.error("Format titles must be strings.")}else window.console.error('The format "'+t.name+'" must have a title.')}else window.console.error("A class name must begin with a letter, followed by any number of hyphens, letters, or numbers.");else window.console.error("Format class names must be a string, or null to handle bare elements.");else window.console.error("Format tag names must be a string.");else window.console.error("Format names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-format");else window.console.error("Format names must be strings.")}function re(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ne(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.start,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.end,o=e.formats,a=e.activeFormats,s=o.slice();if(r===n){var u=Object(c.find)(s[r],{type:t});if(u){for(;Object(c.find)(s[r],u);)oe(s,r,t),r--;for(n++;Object(c.find)(s[n],u);)oe(s,n,t),n++}}else for(var l=r;l2&&void 0!==arguments[2]?arguments[2]:e.start,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.end,o=e.formats,a=e.replacements,i=e.text;"string"==typeof t&&(t=A({text:t}));var c=r+t.text.length;return O({formats:o.slice(0,r).concat(t.formats,o.slice(n)),replacements:a.slice(0,r).concat(t.replacements,a.slice(n)),text:i.slice(0,r)+t.text+i.slice(n),start:c,end:c})}function ie(e,t,r){return ae(e,A(),t,r)}function ce(e,t,r){var n=e.formats,o=e.replacements,a=e.text,i=e.start,c=e.end;return a=a.replace(t,(function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:e.start,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.end,n=q(e).slice(0,t).lastIndexOf(P),o=e.replacements[n],a=[,];return o&&(a=[o]),ae(e,{formats:[,],replacements:a,text:P},t,r)}function ue(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function le(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.replacements,n=e.text,o=e.start,a=e.end,c=X(e),s=o-1,u=c?o-1:o,l=a;if(t||(s=a,u=o,l=c?a+1:a),n[s]===P){var f;if(c&&r[s]&&r[s].length){var p=r.slice();p[s]=r[s].slice(0,-1),f=function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:e.start,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.end,n=e.formats,o=e.replacements,a=e.text;return void 0===t||void 0===r?function(e){for(var t=1;t=o&&ao&&(s.start=0),i>=o&&ic&&(s.end=e.length)),s}))}function me(e){var t=e.formats,r=e.replacements,n=e.text,o=e.start,a=e.end,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a,s={formats:t.slice(0,i),replacements:r.slice(0,i),text:n.slice(0,i)},u={formats:t.slice(c),replacements:r.slice(c),text:n.slice(c),start:0,end:0};return[ce(s,/\u2028+$/,""),ce(u,/^\u2028+/,"")]}function ve(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ge(e){for(var t=1;t1;)e=e.childNodes[t.shift()];return{node:e,offset:t[0]}}var xe=function(){return x(document,"")};function Pe(e,t){"string"==typeof t&&(t=e.ownerDocument.createTextNode(t));var r=t,n=r.type,o=r.attributes;if(n)for(var a in t=e.ownerDocument.createElement(n),o)t.setAttribute(a,o[a]);return e.appendChild(t)}function _e(e,t){e.appendData(t)}function Se(e){return e.lastChild}function Ce(e){return e.parentNode}function De(e){return e.nodeType===we}function Fe(e){return e.nodeValue}function Ne(e){return e.parentNode.removeChild(e)}function ke(e){var t=e.value,r=e.multilineTag,n=e.prepareEditableTree,o=e.isEditableTree,a=void 0===o||o,c=e.placeholder,s=[],u=[];return n&&(t=function(e){for(var t=1;t0){if(h=p,b=l.getRangeAt(0),h.startContainer===b.startContainer&&h.startOffset===b.startOffset&&h.endContainer===b.endContainer&&h.endOffset===b.endOffset)return;l.removeAllRanges()}var h,b;l.addRange(p),d.focus()}(s,r)}var Re=r(66);function Ie(e){return ze(Oe({value:e.value,multilineTag:e.multilineTag,preserveWhiteSpace:e.preserveWhiteSpace,createEmpty:Le,append:Me,getLastChild:We,getParent:Ke,isText:Ve,getText:Be,remove:Ue,appendText:He}).children)}function Le(){return{}}function We(e){var t=e.children;return t&&t[t.length-1]}function Me(e,t){return"string"==typeof t&&(t={text:t}),t.parent=e,e.children=e.children||[],e.children.push(t),t}function He(e,t){e.text+=t}function Ke(e){return e.parent}function Ve(e){return"string"==typeof e.text}function Be(e){return e.text}function Ue(e){var t=e.parent.children.indexOf(e);return-1!==t&&e.parent.children.splice(t,1),e}function ze(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map((function(e){return void 0===e.text?function(e){var t=e.type,r=e.attributes,n=e.object,o=e.children,a="";for(var i in r)Object(Re.isValidAttributeName)(i)&&(a+=" ".concat(i,'="').concat(Object(Re.escapeAttribute)(r[i]),'"'));return n?"<".concat(t).concat(a,">"):"<".concat(t).concat(a,">").concat(ze(o),"")}(e):Object(Re.escapeEditableHTML)(e.text)})).join("")}function qe(e,t){return U(e,t.type)?ne(e,t.type):T(e,t)}function Ge(e){var t=Object(a.select)("core/rich-text").getFormatType(e);if(t)return Object(a.dispatch)("core/rich-text").removeFormatTypes(e),t;window.console.error("Format ".concat(e," is not registered."))}function Ye(e){var t=G(e);if(void 0===t)return!1;var r=e.replacements,n=G(e,t),o=r[t]||[],a=r[n]||[];return o.length<=a.length}function $e(e){return void 0!==e.replacements[G(e,e.start)]}function Xe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ze(e,t){if(!Ye(e))return e;for(var r=G(e),n=G(e,r),o=e.text,a=e.replacements,c=e.end,s=a.slice(),u=function(e,t){for(var r=e.text,n=e.replacements,o=n[t]||[],a=t;a-- >=0;)if(r[a]===P){var i=n[a]||[];if(i.length===o.length+1)return a;if(i.length<=o.length)return}}(e,r),l=r;l=0;){if(r[a]===P)if((n[a]||[]).length===o.length-1)return a}}function Qe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function et(e){if(!$e(e))return e;for(var t=e.text,r=e.replacements,n=e.start,o=e.end,a=G(e,n),c=r.slice(0),s=r[Je(e,a)]||[],u=function(e,t){for(var r=e.text,n=e.replacements,o=n[t]||[],a=t,i=t||0;i=o.length))return a;a=i}return a}(e,G(e,o)),l=a;l<=u;l++)if(t[l]===P){var f=c[l]||[];c[l]=s.concat(f.slice(s.length+1)),0===c[l].length&&delete c[l]}return function(e){for(var t=1;th?e:t})))}return r?function(e){for(var t=1;t0?o.getRangeAt(0):null;return A({element:r.current,range:a,multilineTag:t,multilineWrapperTags:"li"===t?["ul","ol"]:void 0,__unstableIsEditableTree:!0,preserveWhiteSpace:n})}},{key:"applyRecord",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.domOnly,n=this.props,o=n.__unstableMultilineTag,a=n.forwardedRef;Ae({value:e,current:a.current,multilineTag:o,multilineWrapperTags:"li"===o?["ul","ol"]:void 0,prepareEditableTree:It(this.props,"format_prepare_functions"),__unstableDomOnly:r,placeholder:this.props.placeholder})}},{key:"onPaste",value:function(e){var t=this.props,r=t.formatTypes,n=t.onPaste,o=t.__unstableIsSelected,a=this.state.activeFormats,i=void 0===a?[]:a;if(o){var s=e.clipboardData,u=s.items,l=s.files;u=Object(c.isNil)(u)?[]:u,l=Object(c.isNil)(l)?[]:l;var f="",p="";try{f=s.getData("text/plain"),p=s.getData("text/html")}catch(e){try{p=s.getData("Text")}catch(e){return}}e.preventDefault(),window.console.log("Received HTML:\n\n",p),window.console.log("Received plain text:\n\n",f);var d=this.record,h=r.reduce((function(e,t){var r=t.__unstablePasteRule;return r&&e===d&&(e=r(d,{html:p,plainText:f})),e}),d);h===d?n&&(l=Array.from(l),Array.from(u).forEach((function(e){if(e.getAsFile){var t=e.getAsFile();if(t){var r=t.name,n=t.type,o=t.size;Object(c.find)(l,{name:r,type:n,size:o})||l.push(t)}}})),n({value:this.removeEditorOnlyFormats(d),onChange:this.onChange,html:p,plainText:f,files:l,activeFormats:i})):this.onChange(h)}else e.preventDefault()}},{key:"onFocus",value:function(){var e=this.props.unstableOnFocus;if(e&&e(),this.props.__unstableIsSelected)this.props.onSelectionChange(this.record.start,this.record.end),this.setState({activeFormats:B(Ct({},this.record,{activeFormats:void 0}),Rt)});else{var t=Rt;this.record=Ct({},this.record,{start:void 0,end:void 0,activeFormats:t}),this.props.onSelectionChange(void 0,void 0),this.setState({activeFormats:t})}this.rafId=window.requestAnimationFrame(this.onSelectionChange),document.addEventListener("selectionchange",this.onSelectionChange),this.props.setFocusedElement&&(gt()("wp.blockEditor.RichText setFocusedElement prop",{alternative:"selection state from the block editor store."}),this.props.setFocusedElement(this.props.instanceId))}},{key:"onBlur",value:function(){document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"onInput",value:function(e){var t;if(!this.isComposing)if(e&&(t=e.inputType),!t&&e&&e.nativeEvent&&(t=e.nativeEvent.inputType),!t||0!==t.indexOf("format")&&!kt.has(t)){var r=this.createRecord(),n=this.record,o=n.start,a=n.activeFormats,i=void 0===a?[]:a,c=function(e){var t=e.value,r=e.start,n=e.end,o=e.formats,a=t.formats[r-1]||[],i=t.formats[n]||[];for(t.activeFormats=o.map((function(e,t){if(a[t]){if(g(e,a[t]))return a[t]}else if(i[t]&&g(e,i[t]))return i[t];return e}));--n>=r;)t.activeFormats.length>0?t.formats[n]=t.activeFormats:delete t.formats[n];return t}({value:r,start:o,end:r.start,formats:i});this.onChange(c,{withoutHistory:!0});var s=this.props,u=s.__unstableInputRule,l=s.__unstableMarkAutomaticChange,f=s.__unstableAllowPrefixTransformations,p=s.formatTypes,d=s.setTimeout;if((0,s.clearTimeout)(this.onInput.timeout),this.onInput.timeout=d(this.onCreateUndoLevel,1e3),f&&"insertText"===t){u&&u(c,this.valueToFormat);var h=p.reduce((function(e,t){var r=t.__unstableInputRule;return r&&(e=r(e)),e}),c);h!==c&&(this.onCreateUndoLevel(),this.onChange(Ct({},h,{activeFormats:i})),l())}}else this.applyRecord(this.record)}},{key:"onCompositionStart",value:function(){this.isComposing=!0,document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"onCompositionEnd",value:function(){this.isComposing=!1,this.onInput({inputType:"insertText"}),document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"onSelectionChange",value:function(e){if(("selectionchange"===e.type||this.props.__unstableIsSelected)&&!this.props.disabled&&!this.isComposing){var t=this.createRecord(),r=t.start,n=t.end,o=t.text,a=this.record;if(o===a.text)if(r!==a.start||n!==a.end){var i=this.props,c=i.__unstableIsCaretWithinFormattedText,s=i.__unstableOnEnterFormattedText,u=i.__unstableOnExitFormattedText,l=Ct({},a,{start:r,end:n,activeFormats:void 0}),f=B(l,Rt);l.activeFormats=f,!c&&f.length?s():c&&!f.length&&u(),this.record=l,this.applyRecord(l,{domOnly:!0}),this.props.onSelectionChange(r,n),this.setState({activeFormats:f})}else 0===a.text.length&&0===r&&function(){var e=window.getSelection(),t=e.anchorNode,r=e.anchorOffset;if(t.nodeType===t.ELEMENT_NODE){var n=t.childNodes[r];n&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute("data-rich-text-placeholder")&&e.collapseToStart()}}();else this.onInput()}}},{key:"onChange",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.withoutHistory;this.applyRecord(e);var n=e.start,o=e.end,a=e.activeFormats,i=void 0===a?[]:a,s=Object(c.pickBy)(this.props,(function(e,t){return t.startsWith("format_on_change_functions_")}));Object.values(s).forEach((function(t){t(e.formats,e.text)})),this.value=this.valueToFormat(e),this.record=e,this.props.onSelectionChange(n,o),this.props.onChange(this.value),this.setState({activeFormats:i}),r||this.onCreateUndoLevel()}},{key:"onCreateUndoLevel",value:function(){this.lastHistoryValue!==this.value&&(this.props.__unstableOnCreateUndoLevel(),this.lastHistoryValue=this.value)}},{key:"handleDelete",value:function(e){var t=e.keyCode;if(t===dt.DELETE||t===dt.BACKSPACE||t===dt.ESCAPE){if(this.props.__unstableDidAutomaticChange)return e.preventDefault(),void this.props.__unstableUndo();if(t!==dt.ESCAPE){var r,n=this.props,o=n.onDelete,a=n.__unstableMultilineTag,i=this.state.activeFormats,c=void 0===i?[]:i,s=this.createRecord(),u=s.start,l=s.end,f=s.text,p=t===dt.BACKSPACE;if(0===u&&0!==l&&l===f.length)return this.onChange(ie(s)),void e.preventDefault();if(a)if(r=p&&0===s.start&&0===s.end&&J(s)?le(s,!p):le(s,p))return this.onChange(r),void e.preventDefault();!o||!X(s)||c.length||p&&0!==u||!p&&l!==f.length||(o({isReverse:p,value:s}),e.preventDefault())}}}},{key:"handleEnter",value:function(e){if(e.keyCode===dt.ENTER){e.preventDefault();var t=this.props.onEnter;t&&t({value:this.removeEditorOnlyFormats(this.createRecord()),onChange:this.onChange,shiftKey:e.shiftKey})}}},{key:"handleSpace",value:function(e){var t=e.keyCode,r=e.shiftKey,n=e.altKey,o=e.metaKey,a=e.ctrlKey,i=this.props,c=i.tagName,s=i.__unstableMultilineTag;if(!(r||n||o||a||t!==dt.SPACE||"li"!==s)){var u=this.createRecord();if(X(u)){var l=u.text[u.start-1];l&&l!==P||(this.onChange(Ze(u,{type:c})),e.preventDefault())}}}},{key:"handleHorizontalNavigation",value:function(e){var t=e.keyCode,r=e.shiftKey,n=e.altKey,o=e.metaKey,a=e.ctrlKey;if(!(r||n||o||a||t!==dt.LEFT&&t!==dt.RIGHT)){var i=this.record,c=i.text,s=i.formats,u=i.start,l=i.end,f=i.activeFormats,p=void 0===f?[]:f,d=X(i),h="rtl"===Nt(this.props.forwardedRef.current).direction?dt.RIGHT:dt.LEFT,b=e.keyCode===h;if(d&&0===p.length){if(0===u&&b)return;if(l===c.length&&!b)return}if(d){e.preventDefault();var m=s[u-1]||Rt,v=s[u]||Rt,g=p.length,y=v;if(m.length>v.length&&(y=m),m.lengthm.length&&g--):m.length>v.length&&(!b&&p.length>v.length&&g--,b&&p.length