WordPress/wp-includes/js/dist/rich-text.min.js

1 line
28 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.wp=this.wp||{},this.wp.richText=function(t){var e={};function r(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=308)}({0:function(t,e){!function(){t.exports=this.wp.element}()},15:function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.d(e,"a",function(){return n})},18:function(t,e,r){"use strict";var n=r(33);function a(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||Object(n.a)(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}r.d(e,"a",function(){return a})},19:function(t,e,r){"use strict";function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}r.d(e,"a",function(){return n})},2:function(t,e){!function(){t.exports=this.lodash}()},23:function(t,e){!function(){t.exports=this.wp.hooks}()},28:function(t,e,r){"use strict";var n,a;function o(t){return[t]}function i(){var t={clear:function(){t.head=null}};return t}function c(t,e,r){var n;if(t.length!==e.length)return!1;for(n=r;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}n={},a="undefined"!=typeof WeakMap,e.a=function(t,e){var r,u;function l(){r=a?new WeakMap:i()}function s(){var r,n,a,o,i,l=arguments.length;for(o=new Array(l),a=0;a<l;a++)o[a]=arguments[a];for(i=e.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:t.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 e||(e=o),u=a?function(t){var e,a,o,c,u,l=r,s=!0;for(e=0;e<t.length;e++){if(a=t[e],!(u=a)||"object"!=typeof u){s=!1;break}l.has(a)?l=l.get(a):(o=new WeakMap,l.set(a,o),l=o)}return l.has(n)||((c=i()).isUniqueByDependants=s,l.set(n,c)),l.get(n)}:function(){return r},s.getDependants=e,s.clear=l,l(),s}},29:function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t){return(a="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(t){return n(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)})(t)}r.d(e,"a",function(){return a})},308:function(t,e,r){"use strict";r.r(e);var n={};r.r(n),r.d(n,"getFormatTypes",function(){return s}),r.d(n,"getFormatType",function(){return f}),r.d(n,"getFormatTypeForBareElement",function(){return d}),r.d(n,"getFormatTypeForClassName",function(){return p});var a={};r.r(a),r.d(a,"addFormatTypes",function(){return m}),r.d(a,"removeFormatTypes",function(){return v});var o=r(5),i=r(8),c=r(2);var u=Object(o.combineReducers)({formatTypes:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;switch(e.type){case"ADD_FORMAT_TYPES":return Object(i.a)({},t,Object(c.keyBy)(e.formatTypes,"name"));case"REMOVE_FORMAT_TYPES":return Object(c.omit)(t,e.names)}return t}}),l=r(28),s=Object(l.a)(function(t){return Object.values(t.formatTypes)},function(t){return[t.formatTypes]});function f(t,e){return t.formatTypes[e]}function d(t,e){return Object(c.find)(s(t),function(t){var r=t.tagName;return e===r})}function p(t,e){return Object(c.find)(s(t),function(t){var r=t.className;return null!==r&&" ".concat(e," ").indexOf(" ".concat(r," "))>=0})}function m(t){return{type:"ADD_FORMAT_TYPES",formatTypes:Object(c.castArray)(t)}}function v(t){return{type:"REMOVE_FORMAT_TYPES",names:Object(c.castArray)(t)}}function g(t,e){if(t===e)return!0;if(!t||!e)return!1;if(t.type!==e.type)return!1;var r=t.attributes,n=e.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 h(t){var e=t.formats,r=t.text,n=t.start,a=t.end,o=[];return{formats:e.map(function(t){return t.map(function(t){var e=Object(c.find)(o,function(e){return g(e,t)});return e||(o.push(t),t)})}),text:r,start:n,end:a}}function b(t,e){var r=t.formats,n=t.text,a=t.start,o=t.end,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:o,l=r.slice(0);if(i===u){var s=Object(c.find)(l[i],{type:e.type});if(!s){var f=l[i-1]||[];return{formats:r,text:n,start:a,end:o,formatPlaceholder:Object(c.find)(f,{type:e.type})?void 0:e}}for(;Object(c.find)(l[i],s);)y(l,i,e),i--;for(u++;Object(c.find)(l[u],s);)y(l,u,e),u++}else for(var d=i;d<u;d++)y(l,d,e);return h({formats:l,text:n,start:a,end:o})}function y(t,e,r){if(t[e]){var n=t[e].filter(function(t){return t.type!==r.type});n.push(r),t[e]=n}else t[e]=[r]}function x(t,e){return t.text[e]}function T(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return h(e.reduce(function(t,e){var r=e.formats,n=e.text;return{text:t.text+n,formats:t.formats.concat(r)}}))}Object(o.registerStore)("core/rich-text",{reducer:u,selectors:n,actions:a});var O=r(18),j=r(29),w="\u2028",E="";function _(t){return 0===t.text.length}function C(t){var e=t.text,r=t.start,n=t.end;return r===n&&(0===e.length||(0===r&&e.slice(0,1)===w||(r===e.length&&e.slice(-1)===w||e.slice(r-1,n+1)==="".concat(w).concat(w))))}function N(t,e){var r=t.implementation;return N.body||(N.body=r.createHTMLDocument("").body),N.body.innerHTML=e,N.body}var F=window.Node,A=F.TEXT_NODE,S=F.ELEMENT_NODE;function P(t,e){for(var r in t)if(t[r]===e)return r}function W(t){var e,r=t.type,n=t.attributes;if(n&&n.class&&(e=Object(o.select)("core/rich-text").getFormatTypeForClassName(n.class))&&(n.class=" ".concat(n.class," ").replace(" ".concat(e.className," ")," ").trim(),n.class||delete n.class),e||(e=Object(o.select)("core/rich-text").getFormatTypeForBareElement(r)),!e)return n?{type:r,attributes:n}:{type:r};if(!n)return{type:e.name};var a={},i={};for(var c in n){var u=P(e.attributes,c);u?a[u]=n[c]:i[c]=n[c]}return{type:e.name,attributes:a,unregisteredAttributes:i}}function D(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.element,r=t.text,n=t.html,a=t.range,o=t.multilineTag,i=t.multilineWrapperTags;return"string"==typeof r&&r.length>0?{formats:Array(r.length),text:r}:("string"==typeof n&&n.length>0&&(e=N(document,n)),"object"!==Object(j.a)(e)?{formats:[],text:""}:o?V({element:e,range:a,multilineTag:o,multilineWrapperTags:i}):M({element:e,range:a}))}function I(t,e,r,n){if(r){var a=e.parentNode,o=r.startContainer,i=r.startOffset,c=r.endContainer,u=r.endOffset,l=t.text.length;void 0!==n.start?t.start=l+n.start:e===o&&e.nodeType===A?t.start=l+i:a===o&&e===o.childNodes[i]?t.start=l:a===o&&e===o.childNodes[i-1]?t.start=l+n.text.length:e===o&&(t.start=l),void 0!==n.end?t.end=l+n.end:e===c&&e.nodeType===A?t.end=l+u:a===c&&e===c.childNodes[u-1]?t.end=l+n.text.length:a===c&&e===c.childNodes[u]?t.end=l:e===c&&(t.end=l+u)}}function k(t,e,r){if(e){var n=e.startContainer,a=e.endContainer,o=e.startOffset,i=e.endOffset;return t===n&&(o=r(t.nodeValue.slice(0,o)).length),t===a&&(i=r(t.nodeValue.slice(0,i)).length),{startContainer:n,startOffset:o,endContainer:a,endOffset:i}}}function L(t){return t.replace(/[\n\r\t]+/g," ")}function M(t){var e=t.element,r=t.range,n=t.multilineTag,a=t.multilineWrapperTags,o=t.currentWrapperTags,i=void 0===o?[]:o,c={formats:[],text:""};if(!e)return c;if(!e.hasChildNodes())return I(c,e,r,{formats:[],text:""}),c;for(var u=e.childNodes.length,l=0;l<u;l++){var s=e.childNodes[l],f=s.nodeName.toLowerCase();if(s.nodeType!==A){if(s.nodeType===S)if(s.getAttribute("data-rich-text-padding"))I(c,s,r,{formats:[],text:""});else if("br"!==f){var d=c.formats[c.formats.length-1],p=d&&d[d.length-1],m=W({type:f,attributes:R({element:s})}),v=void 0;m&&(v=g(m,p)?p:m);var h=void 0;a&&-1!==a.indexOf(f)?(h=V({element:s,range:r,multilineTag:n,multilineWrapperTags:a,currentWrapperTags:[].concat(Object(O.a)(i),[v])}),v=void 0):h=M({element:s,range:r,multilineTag:n,multilineWrapperTags:a});var b=h.text,y=c.text.length;if(I(c,s,r,h),!_(h)||!v||v.attributes){var x=c.formats;if(v&&v.attributes&&0===b.length)v.object=!0,c.text+=E,x[y]?x[y].unshift(v):x[y]=[v];else{c.text+=b,c.formats.length+=b.length;for(var T=h.formats.length;T--;){var j,w=y+T;if(v&&(x[w]?x[w].push(v):x[w]=[v]),h.formats[T])if(x[w])(j=x[w]).push.apply(j,Object(O.a)(h.formats[T]));else x[w]=h.formats[T]}}}}else I(c,s,r,{formats:[],text:""}),c.text+="\n",c.formats.length+=1}else{var C=L(s.nodeValue);I(c,s,r=k(s,r,L),{text:C}),c.text+=C,c.formats.length+=C.length}}return c}function V(t){var e=t.element,r=t.range,n=t.multilineTag,a=t.multilineWrapperTags,o=t.currentWrapperTags,i=void 0===o?[]:o,c={formats:[],text:""};if(!e||!e.hasChildNodes())return c;for(var u=e.children.length,l=0;l<u;l++){var s=e.children[l];if(s.nodeName.toLowerCase()===n){var f=M({element:s,range:r,multilineTag:n,multilineWrapperTags:a,currentWrapperTags:i});if("\n"===f.text){var d=f.start,p=f.end;f={formats:[],text:""},void 0!==d&&(f.start=0),void 0!==p&&(f.end=0)}if(0!==l||i.length>0){var m=i.length>0?[i]:[,];c.formats=c.formats.concat(m),c.text+=w}I(c,s,r,f),c.formats=c.formats.concat(f.formats),c.text+=f.text}}return c}function R(t){var e=t.element;if(e.hasAttributes()){for(var r,n=e.attributes.length,a=0;a<n;a++){var o=e.attributes[a],i=o.name,c=o.value;"data-rich-text-format-boundary"!==i&&((r=r||{})[i]=c)}return r}}function z(t){var e=t.formats,r=t.start,n=t.selectedFormat;if(void 0===r)return[];var a=e[r-1]||[],o=e[r]||[],i=o;return a.length>o.length&&(i=a),i.slice(0,n)}function B(t,e){return Object(c.find)(z(t),{type:e})}function H(t){return t.end}function G(t){return t.start}function Y(t){return t.text}function q(t){var e=t.start,r=t.end;if(void 0!==e&&void 0!==r)return e===r}function $(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"string"==typeof e&&(e=D({text:e})),h(t.reduce(function(t,r){var n=r.formats,a=r.text;return{text:t.text+e.text+a,formats:t.formats.concat(e.formats,n)}}))}var U=r(15),X=r(19),Z=r(0),K=r(38),J=r.n(K),Q=r(23),tt=r(7),et=[];function rt(t,e){if("string"==typeof(e=Object(i.a)({name:t},e)).name)if(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(e.name))if(Object(o.select)("core/rich-text").getFormatType(e.name))window.console.error('Format "'+e.name+'" is already registered.');else if("string"==typeof e.tagName&&""!==e.tagName)if("string"==typeof e.className&&""!==e.className||null===e.className)if(/^[_a-zA-Z]+[a-zA-Z0-9-]*$/.test(e.className)){if(null===e.className){var r=Object(o.select)("core/rich-text").getFormatTypeForBareElement(e.tagName);if(r)return void window.console.error('Format "'.concat(r.name,'" is already registered to handle bare tag name "').concat(e.tagName,'".'))}else{var n=Object(o.select)("core/rich-text").getFormatTypeForClassName(e.className);if(n)return void window.console.error('Format "'.concat(n.name,'" is already registered to handle class name "').concat(e.className,'".'))}if("title"in e&&""!==e.title)if("keywords"in e&&e.keywords.length>3)window.console.error('The format "'+e.name+'" can have a maximum of 3 keywords.');else{if("string"==typeof e.title){Object(o.dispatch)("core/rich-text").addFormatTypes(e);var a=J()(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:et,e=arguments.length>1?arguments[1]:void 0;return[].concat(Object(O.a)(t),[e])});return e.__experimentalGetPropsForEditableTreePreparation&&Object(Q.addFilter)("experimentalRichText",t,function(r){var n=r;(e.__experimentalCreatePrepareEditableTree||e.__experimentalCreateFormatToValue||e.__experimentalCreateValueToFormat)&&(n=function(n){var o={};if(e.__experimentalCreatePrepareEditableTree&&(o.prepareEditableTree=a(n.prepareEditableTree,e.__experimentalCreatePrepareEditableTree(n["format_".concat(t)],{richTextIdentifier:n.identifier,blockClientId:n.clientId}))),e.__experimentalCreateOnChangeEditableValue){var c=Object.keys(n).reduce(function(e,r){var a=n[r],o="format_".concat(t,"_dispatch_");r.startsWith(o)&&(e[r.replace(o,"")]=a);return e},{});o.onChangeEditableValue=a(n.onChangeEditableValue,e.__experimentalCreateOnChangeEditableValue(Object(i.a)({},n["format_".concat(t)],c),{richTextIdentifier:n.identifier,blockClientId:n.clientId}))}return Object(Z.createElement)(r,Object(X.a)({},n,o))});var u=[Object(o.withSelect)(function(r,n){var a=n.clientId,o=n.identifier;return Object(U.a)({},"format_".concat(t),e.__experimentalGetPropsForEditableTreePreparation(r,{richTextIdentifier:o,blockClientId:a}))})];return e.__experimentalGetPropsForEditableTreeChangeHandler&&u.push(Object(o.withDispatch)(function(r,n){var a=n.clientId,o=n.identifier,i=e.__experimentalGetPropsForEditableTreeChangeHandler(r,{richTextIdentifier:o,blockClientId:a});return Object(c.mapKeys)(i,function(e,r){return"format_".concat(t,"_dispatch_").concat(r)})})),Object(tt.compose)(u)(n)}),e}window.console.error("Format titles must be strings.")}else window.console.error('The format "'+e.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 nt(t,e){var r=t.formats,n=t.text,a=t.start,o=t.end,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:o,l=r.slice(0);if(i===u){for(var s=Object(c.find)(l[i],{type:e});Object(c.find)(l[i],s);)at(l,i,e),i--;for(u++;Object(c.find)(l[u],s);)at(l,u,e),u++}else for(var f=i;f<u;f++)l[f]&&at(l,f,e);return h({formats:l,text:n,start:a,end:o})}function at(t,e,r){var n=t[e].filter(function(t){return t.type!==r});n.length?t[e]=n:delete t[e]}function ot(t,e){var r=t.formats,n=t.text,a=t.start,o=t.end,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:o;"string"==typeof e&&(e=D({text:e}));var u=i+e.text.length;return h({formats:r.slice(0,i).concat(e.formats,r.slice(c)),text:n.slice(0,i)+e.text+n.slice(c),start:u,end:u})}function it(t,e,r){return ot(t,D(),e,r)}function ct(t,e,r){var n=t.formats,a=t.text,o=t.start,i=t.end;return a=a.replace(e,function(t){for(var e=arguments.length,a=new Array(e>1?e-1:0),c=1;c<e;c++)a[c-1]=arguments[c];var u,l=a[a.length-2],s=r;return"function"==typeof s&&(s=r.apply(void 0,[t].concat(a))),"object"===Object(j.a)(s)?(u=s.formats,s=s.text):(u=Array(s.length),n[l]&&(u=u.fill(n[l]))),n=n.slice(0,l).concat(u,n.slice(l+t.length)),o&&(o=i=l+s.length),s}),h({formats:n,text:a,start:o,end:i})}function ut(t){var e=t.text,r=t.end,n=e.length,a="\n";return r!==n&&e[r]!==w||"\n"===e[r-1]&&0!==n||(a="\n\n"),ot(t,a)}function lt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.start,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.end,n=Y(t).slice(0,e).lastIndexOf(w),a=t.formats[n],o=[,];return a&&(o=[a]),ot(t,{formats:o,text:w},e,r)}var st="";function ft(t,e,r,n){return ot(t,{text:st,formats:[[Object(i.a)({},e,{object:!0})]]},r,n)}function dt(t){var e=t.formats,r=t.text,n=t.start,a=t.end,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a;return void 0===o||void 0===i?{formats:e,text:r}:{formats:e.slice(o,i),text:r.slice(o,i)}}function pt(t,e){var r=t.formats,n=t.text,a=t.start,o=t.end;if("string"!=typeof e)return function(t){var e=t.formats,r=t.text,n=t.start,a=t.end,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a,c={formats:e.slice(0,o),text:r.slice(0,o)},u={formats:e.slice(i),text:r.slice(i),start:0,end:0};return[ct(c,/\u2028+$/,""),ct(u,/^\u2028+/,"")]}.apply(void 0,arguments);var i=0;return n.split(e).map(function(t){var n=i,c={formats:r.slice(n,n+t.length),text:t};return i+=e.length+t.length,void 0!==a&&void 0!==o&&(a>=n&&a<i?c.start=a-n:a<n&&o>n&&(c.start=0),o>=n&&o<i?c.end=o-n:a<i&&o>i&&(c.end=t.length)),c})}function mt(t){var e=t.type,r=t.attributes,n=t.unregisteredAttributes,a=t.object,c=t.boundaryClass,u=function(t){return Object(o.select)("core/rich-text").getFormatType(t)}(e),l={};if(c&&(l["data-rich-text-format-boundary"]="true"),!u)return r&&(l=Object(i.a)({},r,l)),{type:e,attributes:l,object:a};for(var s in l=Object(i.a)({},n,l),r){var f=!!u.attributes&&u.attributes[s];f?l[f]=r[s]:l[s]=r[s]}return u.className&&(l.class?l.class="".concat(u.className," ").concat(l.class):l.class=u.className),{type:u.tagName,object:u.object,attributes:l}}function vt(t){var e,r,n,a=t.value,o=t.multilineTag,i=t.multilineWrapperTags,c=void 0===i?[]:i,u=t.createEmpty,l=t.append,s=t.getLastChild,f=t.getParent,d=t.isText,p=t.getText,m=t.remove,v=t.appendText,g=t.onStartIndex,h=t.onEndIndex,b=t.isEditableTree,y=a.formats,x=a.text,T=a.start,j=a.end,_=y.length+1,C=u(),N={type:o},F=function(t){var e=z(t),r=t.selectedFormat;return void 0===r?e[e.length-1]:e[r-1]}(a);o?(l(l(C,{type:o}),""),r=e=[N]):l(C,"");for(var A=function(t){var a=x.charAt(t),i=y[t];o&&(i=a===w?e=(i||[]).reduce(function(t,e){return a===w&&-1!==c.indexOf(e.type)&&(t.push(e),t.push(N)),t},[N]):[].concat(Object(O.a)(e),Object(O.a)(i||[])));var u=s(C);if(n===w){for(var _=u;!d(_);)_=s(_);g&&T===t&&g(C,_),h&&j===t&&h(C,_)}if(i&&i.forEach(function(t,e){if(!u||!r||t!==r[e]||a===w&&i.length-1===e){var n=t.type,o=t.attributes,c=t.unregisteredAttributes,v=t.object,g=b&&!v&&a!==w&&t===F,h=f(u),y=l(h,mt({type:n,attributes:o,unregisteredAttributes:c,object:v,boundaryClass:g}));d(u)&&0===p(u).length&&m(u),u=l(t.object?h:y,"")}else u=s(u)}),a===w)return r=i,n=a,"continue";0===t&&(g&&0===T&&g(C,u),h&&0===j&&h(C,u)),a!==E&&("\n"===a?(u=l(f(u),{type:"br",object:!0}),u=l(f(u),"")):d(u)?v(u,a):u=l(f(u),a)),g&&T===t+1&&g(C,u),h&&j===t+1&&h(C,u),r=i,n=a},S=0;S<_;S++)A(S);return C}var gt=window.Node.TEXT_NODE;function ht(t,e,r){for(var n=t.parentNode,a=0;t=t.previousSibling;)a++;return r=[a].concat(Object(O.a)(r)),n!==e&&(r=ht(n,e,r)),r}function bt(t,e){for(e=Object(O.a)(e);t&&e.length>1;)t=t.childNodes[e.shift()];return{node:t,offset:e[0]}}var yt=function(){return N(document,"")};function xt(t,e){"string"==typeof e&&(e=t.ownerDocument.createTextNode(e));var r=e,n=r.type,a=r.attributes;if(n)for(var o in e=t.ownerDocument.createElement(n),a)e.setAttribute(o,a[o]);return t.appendChild(e)}function Tt(t,e){t.appendData(e)}function Ot(t){return t.lastChild}function jt(t){return t.parentNode}function wt(t){return t.nodeType===gt}function Et(t){return t.nodeValue}function _t(t){return t.parentNode.removeChild(t)}function Ct(t){var e=t.createElement("br");return e.setAttribute("data-rich-text-padding","true"),e}function Nt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;return t.reduce(function(t,r){return r(t,e.text)},e.formats)}function Ft(t){var e=t.value,r=t.multilineTag,n=t.multilineWrapperTags,a=t.prepareEditableTree,o=t.isEditableTree,c=void 0===o||o,u=[],l=[],s=vt({value:Object(i.a)({},e,{formats:Nt(a,e)}),multilineTag:r,multilineWrapperTags:n,createEmpty:yt,append:xt,getLastChild:Ot,getParent:jt,isText:wt,getText:Et,remove:_t,appendText:Tt,onStartIndex:function(t,e){u=ht(e,t,[e.nodeValue.length])},onEndIndex:function(t,e){l=ht(e,t,[e.nodeValue.length])},isEditableTree:c});return c&&function t(e){for(var r=e.element,n=e.multilineWrapperTags,a=r.childNodes.length,o=r.ownerDocument,i=0;i<a;i++){var c=r.childNodes[i];c.nodeType===gt?1!==a||c.nodeValue||r.appendChild(Ct(o)):(n&&!c.previousSibling&&-1!==n.indexOf(c.nodeName.toLowerCase())&&r.insertBefore(Ct(o),c),t({element:c,multilineWrapperTags:n}))}}({element:s,multilineWrapperTags:n}),{body:s,selection:{startPath:u,endPath:l}}}function At(t){var e=t.value,r=t.current,n=t.multilineTag,a=t.multilineWrapperTags,o=t.prepareEditableTree,i=t.__unstableDomOnly,c=Ft({value:e,multilineTag:n,multilineWrapperTags:a,prepareEditableTree:o}),u=c.body,l=c.selection;!function t(e,r){var n=0;var a;for(;a=e.firstChild;){var o=r.childNodes[n];if(o)if(o.isEqualNode(a))e.removeChild(a);else if(o.nodeName!==a.nodeName||o.nodeType===gt&&o.data!==a.data)r.replaceChild(a,o);else{var i=o.attributes,c=a.attributes;if(i)for(var u=0;u<i.length;u++){var l=i[u].name;a.getAttribute(l)||o.removeAttribute(l)}if(c)for(var s=0;s<c.length;s++){var f=c[s],l=f.name,d=f.value;o.getAttribute(l)!==d&&o.setAttribute(l,d)}t(a,o),e.removeChild(a)}else r.appendChild(a);n++}for(;r.childNodes[n];)r.removeChild(r.childNodes[n])}(u,r),void 0===e.start||i||function(t,e){var r=t.startPath,n=t.endPath,a=bt(e,r),o=a.node,i=a.offset,c=bt(e,n),u=c.node,l=c.offset,s=window.getSelection(),f=e.ownerDocument,d=f.createRange();if(d.setStart(o,i),d.setEnd(u,l),s.rangeCount>0){if(p=d,m=s.getRangeAt(0),p.startContainer===m.startContainer&&p.startOffset===m.startOffset&&p.endContainer===m.endContainer&&p.endOffset===m.endOffset)return void(f.activeElement!==e&&e.focus());s.removeAllRanges()}var p,m;s.addRange(d)}(l,r)}var St=r(63);function Pt(t){return zt(vt({value:t.value,multilineTag:t.multilineTag,multilineWrapperTags:t.multilineWrapperTags,createEmpty:Wt,append:It,getLastChild:Dt,getParent:Lt,isText:Mt,getText:Vt,remove:Rt,appendText:kt}).children)}function Wt(){return{}}function Dt(t){var e=t.children;return e&&e[e.length-1]}function It(t,e){return"string"==typeof e&&(e={text:e}),e.parent=t,t.children=t.children||[],t.children.push(e),e}function kt(t,e){t.text+=e}function Lt(t){return t.parent}function Mt(t){return"string"==typeof t.text}function Vt(t){return t.text}function Rt(t){var e=t.parent.children.indexOf(t);return-1!==e&&t.parent.children.splice(e,1),t}function zt(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(function(t){return void 0===t.text?function(t){var e=t.type,r=t.attributes,n=t.object,a=t.children,o="";for(var i in r)Object(St.isValidAttributeName)(i)&&(o+=" ".concat(i,'="').concat(Object(St.escapeAttribute)(r[i]),'"'));return n?"<".concat(e).concat(o,">"):"<".concat(e).concat(o,">").concat(zt(a),"</").concat(e,">")}(t):Object(St.escapeHTML)(t.text)}).join("")}function Bt(t,e){return B(t,e.type)?nt(t,e.type):b(t,e)}function Ht(t){var e=Object(o.select)("core/rich-text").getFormatType(t);if(e)return e.__experimentalCreatePrepareEditableTree&&e.__experimentalGetPropsForEditableTreePreparation&&Object(Q.removeFilter)("experimentalRichText",t),Object(o.dispatch)("core/rich-text").removeFormatTypes(t),e;window.console.error("Format ".concat(t," is not registered."))}function Gt(t){for(var e=t.start,r=t.text,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;n--;)if(r[n]===w)return n}function Yt(t,e){var r=Gt(t);if(void 0===r)return t;var n=t.text,a=t.formats,o=t.start,i=t.end,c=Gt(t,r),u=a[r]||[],l=a[c]||[];if(u.length>l.length)return t;for(var s=a.slice(),f=function(t,e){for(var r=t.text,n=t.formats,a=n[e]||[],o=e;o-- >=0;)if(r[o]===w){var i=n[o]||[];if(i.length===a.length+1)return o;if(i.length<=a.length)return}}(t,r),d=r;d<i;d++)if(n[d]===w)if(f){var p=a[f]||[];s[d]=p.concat((s[d]||[]).slice(p.length-1))}else{var m=a[c]||[],v=m[m.length-1]||e;s[d]=m.concat([v],(s[d]||[]).slice(m.length))}return h({text:n,formats:s,start:o,end:i})}function qt(t,e){for(var r=t.text,n=t.formats,a=n[e]||[],o=e;o-- >=0;){if(r[o]===w)if((n[o]||[]).length===a.length-1)return o}}function $t(t){var e=t.text,r=t.formats,n=t.start,a=t.end,o=Gt(t,n);if(void 0===r[o])return t;for(var i=r.slice(0),c=r[qt(t,o)]||[],u=function(t,e){for(var r=t.text,n=t.formats,a=n[e]||[],o=e,i=e||0;i<r.length;i++)if(r[i]===w){if(!((n[i]||[]).length>=a.length))return o;o=i}return o}(t,Gt(t,a)),l=o;l<=u;l++)if(e[l]===w){var s=i[l]||[];i[l]=c.concat(s.slice(c.length+1)),0===i[l].length&&delete i[l]}return h({text:e,formats:i,start:n,end:a})}function Ut(t,e){for(var r,n=t.text,a=t.formats,o=t.start,i=t.end,c=Gt(t,o),u=a[c]||[],l=a[Gt(t,i)]||[],s=qt(t,c),f=a.slice(0),d=u.length-1,p=l.length-1,m=s+1||0;m<n.length;m++)if(n[m]===w){if((f[m]||[]).length<=d)break;f[m]&&(r=!0,f[m]=f[m].map(function(t,r){return r<d||r>p?t:e}))}return r?h({text:n,formats:f,start:o,end:i}):t}r.d(e,"applyFormat",function(){return b}),r.d(e,"charAt",function(){return x}),r.d(e,"concat",function(){return T}),r.d(e,"create",function(){return D}),r.d(e,"getActiveFormat",function(){return B}),r.d(e,"getSelectionEnd",function(){return H}),r.d(e,"getSelectionStart",function(){return G}),r.d(e,"getTextContent",function(){return Y}),r.d(e,"isCollapsed",function(){return q}),r.d(e,"isEmpty",function(){return _}),r.d(e,"isEmptyLine",function(){return C}),r.d(e,"join",function(){return $}),r.d(e,"registerFormatType",function(){return rt}),r.d(e,"removeFormat",function(){return nt}),r.d(e,"remove",function(){return it}),r.d(e,"replace",function(){return ct}),r.d(e,"insert",function(){return ot}),r.d(e,"insertLineBreak",function(){return ut}),r.d(e,"insertLineSeparator",function(){return lt}),r.d(e,"insertObject",function(){return ft}),r.d(e,"slice",function(){return dt}),r.d(e,"split",function(){return pt}),r.d(e,"apply",function(){return At}),r.d(e,"unstableToDom",function(){return Ft}),r.d(e,"toHTMLString",function(){return Pt}),r.d(e,"toggleFormat",function(){return Bt}),r.d(e,"LINE_SEPARATOR",function(){return w}),r.d(e,"unregisterFormatType",function(){return Ht}),r.d(e,"indentListItems",function(){return Yt}),r.d(e,"outdentListItems",function(){return $t}),r.d(e,"changeListType",function(){return Ut})},33:function(t,e,r){"use strict";function n(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}r.d(e,"a",function(){return n})},38:function(t,e,r){t.exports=function(t,e){var r,n,a,o=0;function i(){var e,i,c=n,u=arguments.length;t:for(;c;){if(c.args.length===arguments.length){for(i=0;i<u;i++)if(c.args[i]!==arguments[i]){c=c.next;continue t}return c!==n&&(c===a&&(a=c.prev),c.prev.next=c.next,c.next&&(c.next.prev=c.prev),c.next=n,c.prev=null,n.prev=c,n=c),c.val}c=c.next}for(e=new Array(u),i=0;i<u;i++)e[i]=arguments[i];return c={args:e,val:t.apply(null,e)},n?(n.prev=c,c.next=n):a=c,o===r?(a=a.prev).next=null:o++,n=c,c.val}return e&&e.maxSize&&(r=e.maxSize),i.clear=function(){n=null,a=null,o=0},i}},5:function(t,e){!function(){t.exports=this.wp.data}()},63:function(t,e){!function(){t.exports=this.wp.escapeHtml}()},7:function(t,e){!function(){t.exports=this.wp.compose}()},8:function(t,e,r){"use strict";r.d(e,"a",function(){return a});var n=r(15);function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),a.forEach(function(e){Object(n.a)(t,e,r[e])})}return t}}});