mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-24 01:57:53 +01:00
3c44f9e15a
Updated packages: - @wordpress/annotations@1.2.3 - @wordpress/block-editor@2.0.2 - @wordpress/block-library@2.4.5 - @wordpress/blocks@6.2.5 - @wordpress/components@7.3.2 - @wordpress/dom@2.2.5 - @wordpress/e2e-tests@1.1.5 - @wordpress/edit-post@3.3.5 - @wordpress/editor@9.2.5 - @wordpress/format-library@1.4.5 - @wordpress/list-reusable-blocks@1.3.5 - @wordpress/nux@3.2.5 - @wordpress/rich-text@3.2.3 Props: youknowriad, gwwar, iseulde, tfrommen, gziolo. Fixes #47284. Built from https://develop.svn.wordpress.org/trunk@45319 git-svn-id: http://core.svn.wordpress.org/trunk@45130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
28 KiB
JavaScript
1 line
28 KiB
JavaScript
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=361)}({0:function(e,t){!function(){e.exports=this.wp.element}()},15: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})},17:function(e,t,r){"use strict";var n=r(34);function a(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||Object(n.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}r.d(t,"a",function(){return a})},19:function(e,t,r){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}r.d(t,"a",function(){return n})},2:function(e,t){!function(){e.exports=this.lodash}()},26:function(e,t){!function(){e.exports=this.wp.hooks}()},30:function(e,t,r){"use strict";var n,a;function i(e){return[e]}function o(){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 l(){r=a?new WeakMap:o()}function s(){var r,n,a,i,o,l=arguments.length;for(i=new Array(l),a=0;a<l;a++)i[a]=arguments[a];for(o=t.apply(null,i),(r=u(o)).isUniqueByDependants||(r.lastDependants&&!c(o,r.lastDependants,0)&&r.clear(),r.lastDependants=o),n=r.head;n;){if(c(n.args,i,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,i)},i[0]=null,n.args=i,r.head&&(r.head.prev=n,n.next=r.head),r.head=n,n.val}return t||(t=i),u=a?function(e){var t,a,i,c,u,l=r,s=!0;for(t=0;t<e.length;t++){if(a=e[t],!(u=a)||"object"!=typeof u){s=!1;break}l.has(a)?l=l.get(a):(i=new WeakMap,l.set(a,i),l=i)}return l.has(n)||((c=o()).isUniqueByDependants=s,l.set(n,c)),l.get(n)}:function(){return r},s.getDependants=t,s.clear=l,l(),s}},32: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)}function a(e){return(a="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)})(e)}r.d(t,"a",function(){return a})},34:function(e,t,r){"use strict";function n(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}r.d(t,"a",function(){return n})},361:function(e,t,r){"use strict";r.r(t);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 i=r(5),o=r(7),c=r(2);var u=Object(i.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 Object(o.a)({},e,Object(c.keyBy)(t.formatTypes,"name"));case"REMOVE_FORMAT_TYPES":return Object(c.omit)(e,t.names)}return e}}),l=r(30),s=Object(l.a)(function(e){return Object.values(e.formatTypes)},function(e){return[e.formatTypes]});function f(e,t){return e.formatTypes[t]}function d(e,t){return Object(c.find)(s(e),function(e){var r=e.tagName;return t===r})}function p(e,t){return Object(c.find)(s(e),function(e){var r=e.className;return null!==r&&" ".concat(t," ").indexOf(" ".concat(r," "))>=0})}function m(e){return{type:"ADD_FORMAT_TYPES",formatTypes:Object(c.castArray)(e)}}function v(e){return{type:"REMOVE_FORMAT_TYPES",names:Object(c.castArray)(e)}}Object(i.registerStore)("core/rich-text",{reducer:u,selectors:n,actions:a});var g=r(17);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),i=Object.keys(n);if(a.length!==i.length)return!1;for(var o=a.length,c=0;c<o;c++){var u=a[c];if(r[u]!==n[u])return!1}return!0}function b(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];h(e,r)&&(a[t]=r)}),t[r]=a}}),Object(o.a)({},e,{formats:t})}function y(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,i=e.activeFormats,u=a.slice();if(r===n){var l=Object(c.find)(u[r],{type:t.type});if(l){for(;Object(c.find)(u[r],l);)x(u,r,t),r--;for(n++;Object(c.find)(u[n],l);)x(u,n,t),n++}}else for(var s=r;s<n;s++)x(u,s,t);return b(Object(o.a)({},e,{formats:u,activeFormats:[].concat(Object(g.a)(Object(c.reject)(i,{type:t.type})),[t])}))}function x(e,t,r){if(e[t]){var n=e[t].filter(function(e){return e.type!==r.type});n.push(r),e[t]=n}else e[t]=[r]}function T(e,t){return e.text[t]}var O=r(32);function j(e,t){var r=e.implementation;return j.body||(j.body=r.createHTMLDocument("").body),j.body.innerHTML=t,j.body}var E="\u2028",w="",_=window.Node,F=_.TEXT_NODE,C=_.ELEMENT_NODE;function N(e,t){for(var r in e)if(e[r]===t)return r}function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.element,r=e.text,n=e.html,a=e.range,i=e.multilineTag,o=e.multilineWrapperTags,c=e.__unstableIsEditableTree;return"string"==typeof r&&r.length>0?{formats:Array(r.length),replacements:Array(r.length),text:r}:("string"==typeof n&&n.length>0&&(t=j(document,n)),"object"!==Object(O.a)(t)?{formats:[],replacements:[],text:""}:i?I({element:t,range:a,multilineTag:i,multilineWrapperTags:o,isEditableTree:c}):D({element:t,range:a,isEditableTree:c}))}function S(e,t,r,n){if(r){var a=t.parentNode,i=r.startContainer,o=r.startOffset,c=r.endContainer,u=r.endOffset,l=e.text.length;void 0!==n.start?e.start=l+n.start:t===i&&t.nodeType===F?e.start=l+o:a===i&&t===i.childNodes[o]?e.start=l:a===i&&t===i.childNodes[o-1]?e.start=l+n.text.length:t===i&&(e.start=l),void 0!==n.end?e.end=l+n.end:t===c&&t.nodeType===F?e.end=l+u:a===c&&t===c.childNodes[u-1]?e.end=l+n.text.length:a===c&&t===c.childNodes[u]?e.end=l:t===c&&(e.end=l+u)}}function P(e){return e.replace(/[\n\r\t]+/g," ")}function D(e){var t=e.element,r=e.range,n=e.multilineTag,a=e.multilineWrapperTags,c=e.currentWrapperTags,u=void 0===c?[]:c,l=e.isEditableTree,s={formats:[],replacements:[],text:""};if(!t)return s;if(!t.hasChildNodes())return S(s,t,r,{formats:[],replacements:[],text:""}),s;for(var f=t.childNodes.length,d=function(e){var c=t.childNodes[e],f=c.nodeName.toLowerCase();if(c.nodeType===F){var d=P(c.nodeValue);return r=function(e,t,r){if(t){var n=t.startContainer,a=t.endContainer,i=t.startOffset,o=t.endOffset;return e===n&&(i=r(e.nodeValue.slice(0,i)).length),e===a&&(o=r(e.nodeValue.slice(0,o)).length),{startContainer:n,startOffset:i,endContainer:a,endOffset:o}}}(c,r,P),S(s,c,r,{text:d}),s.formats.length+=d.length,s.replacements.length+=d.length,s.text+=d,"continue"}if(c.nodeType!==C)return"continue";if(c.getAttribute("data-rich-text-padding")||l&&"br"===f&&!c.getAttribute("data-rich-text-line-break"))return S(s,c,r,{formats:[],replacements:[],text:""}),"continue";if("br"===f)return S(s,c,r,{formats:[],replacements:[],text:""}),M(s,A({text:"\n"})),"continue";var p=s.formats[s.formats.length-1],m=p&&p[p.length-1],v=function(e){var t,r=e.type,n=e.attributes;if(n&&n.class&&(t=Object(i.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(i.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={},o={};for(var c in n){var u=N(t.attributes,c);u?a[u]=n[c]:o[c]=n[c]}return{type:t.name,attributes:a,unregisteredAttributes:o}}({type:f,attributes:k({element:c})}),b=h(v,m)?m:v;if(a&&-1!==a.indexOf(f)){var y=I({element:c,range:r,multilineTag:n,multilineWrapperTags:a,currentWrapperTags:[].concat(Object(g.a)(u),[b]),isEditableTree:l});return S(s,c,r,y),M(s,y),"continue"}var x=D({element:c,range:r,multilineTag:n,multilineWrapperTags:a,isEditableTree:l});S(s,c,r,x),b?0===x.text.length?b.attributes&&M(s,{formats:[,],replacements:[b],text:w}):M(s,Object(o.a)({},x,{formats:Array.from(x.formats,function(e){return e?[b].concat(Object(g.a)(e)):[b]})})):M(s,x)},p=0;p<f;p++)d(p);return s}function I(e){var t=e.element,r=e.range,n=e.multilineTag,a=e.multilineWrapperTags,i=e.currentWrapperTags,o=void 0===i?[]:i,c=e.isEditableTree,u={formats:[],replacements:[],text:""};if(!t||!t.hasChildNodes())return u;for(var l=t.children.length,s=0;s<l;s++){var f=t.children[s];if(f.nodeName.toLowerCase()===n){var d=D({element:f,range:r,multilineTag:n,multilineWrapperTags:a,currentWrapperTags:o,isEditableTree:c});(0!==s||o.length>0)&&M(u,{formats:[,],replacements:o.length>0?[o]:[,],text:E}),S(u,f,r,d),M(u,d)}}return u}function k(e){var t=e.element;if(t.hasAttributes()){for(var r,n=t.attributes.length,a=0;a<n;a++){var i=t.attributes[a],o=i.name,c=i.value;0!==o.indexOf("data-rich-text-")&&((r=r||{})[o]=c)}return r}}function M(e,t){return e.formats=e.formats.concat(t.formats),e.replacements=e.replacements.concat(t.replacements),e.text+=t.text,e}function L(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return b(t.reduce(M,A()))}function V(e){var t=e.formats,r=e.start,n=e.end,a=e.activeFormats;if(void 0===r)return[];if(r===n){if(a)return a;var i=t[r-1]||[],o=t[r]||[];return i.length<o.length?i:o}return t[r]||[]}function R(e,t){return Object(c.find)(V(e),{type:t})}function W(e){var t=e.start,r=e.end,n=e.replacements,a=e.text;if(t+1===r&&a[t]===w)return n[t]}function z(e){return e.end}function B(e){return e.start}function H(e){return e.text}function G(e){var t=e.start,r=e.end;if(void 0!==t&&void 0!==r)return t===r}function Y(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)===E||(r===t.length&&t.slice(-1)===E||t.slice(r-1,n+1)==="".concat(E).concat(E))))}function U(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"string"==typeof t&&(t=A({text:t})),b(e.reduce(function(e,r){var n=r.formats,a=r.replacements,i=r.text;return{formats:e.formats.concat(t.formats,n),replacements:e.replacements.concat(t.replacements,a),text:e.text+t.text+i}}))}var $=r(15),X=r(19),Z=r(0),K=r(41),J=r.n(K),Q=r(26),ee=r(6),te=[];function re(e,t){if("string"==typeof(t=Object(o.a)({name:e},t)).name)if(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(t.name))if(Object(i.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(i.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(i.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){Object(i.dispatch)("core/rich-text").addFormatTypes(t);var a=J()(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:te,t=arguments.length>1?arguments[1]:void 0;return[].concat(Object(g.a)(e),[t])});return t.__experimentalCreatePrepareEditableTree&&Object(Q.addFilter)("experimentalRichText",e,function(r){var n=r;(t.__experimentalCreatePrepareEditableTree||t.__experimentalCreateFormatToValue||t.__experimentalCreateValueToFormat)&&(n=function(n){var i={};if(t.__experimentalCreatePrepareEditableTree&&(i.prepareEditableTree=a(n.prepareEditableTree,t.__experimentalCreatePrepareEditableTree(n["format_".concat(e)],{richTextIdentifier:n.identifier,blockClientId:n.clientId}))),t.__experimentalCreateOnChangeEditableValue){var c=Object.keys(n).reduce(function(t,r){var a=n[r],i="format_".concat(e,"_dispatch_");r.startsWith(i)&&(t[r.replace(i,"")]=a);return t},{});i.onChangeEditableValue=a(n.onChangeEditableValue,t.__experimentalCreateOnChangeEditableValue(Object(o.a)({},n["format_".concat(e)],c),{richTextIdentifier:n.identifier,blockClientId:n.clientId}))}return Object(Z.createElement)(r,Object(X.a)({},n,i))});var u=[];return t.__experimentalGetPropsForEditableTreePreparation&&u.push(Object(i.withSelect)(function(r,n){var a=n.clientId,i=n.identifier;return Object($.a)({},"format_".concat(e),t.__experimentalGetPropsForEditableTreePreparation(r,{richTextIdentifier:i,blockClientId:a}))})),t.__experimentalGetPropsForEditableTreeChangeHandler&&u.push(Object(i.withDispatch)(function(r,n){var a=n.clientId,i=n.identifier,o=t.__experimentalGetPropsForEditableTreeChangeHandler(r,{richTextIdentifier:i,blockClientId:a});return Object(c.mapKeys)(o,function(t,r){return"format_".concat(e,"_dispatch_").concat(r)})})),Object(ee.compose)(u)(n)}),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 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,i=e.activeFormats,u=a.slice();if(r===n){var l=Object(c.find)(u[r],{type:t});if(l){for(;Object(c.find)(u[r],l);)ae(u,r,t),r--;for(n++;Object(c.find)(u[n],l);)ae(u,n,t),n++}}else for(var s=r;s<n;s++)u[s]&&ae(u,s,t);return b(Object(o.a)({},e,{formats:u,activeFormats:Object(c.reject)(i,{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 ie(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,i=e.replacements,o=e.text;"string"==typeof t&&(t=A({text:t}));var c=r+t.text.length;return b({formats:a.slice(0,r).concat(t.formats,a.slice(n)),replacements:i.slice(0,r).concat(t.replacements,i.slice(n)),text:o.slice(0,r)+t.text+o.slice(n),start:c,end:c})}function oe(e,t,r){return ie(e,A(),t,r)}function ce(e,t,r){var n=e.formats,a=e.replacements,i=e.text,o=e.start,c=e.end;return i=i.replace(t,function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),u=1;u<t;u++)i[u-1]=arguments[u];var l,s,f=i[i.length-2],d=r;return"function"==typeof d&&(d=r.apply(void 0,[e].concat(i))),"object"===Object(O.a)(d)?(l=d.formats,s=d.replacements,d=d.text):(l=Array(d.length),s=Array(d.length),n[f]&&(l=l.fill(n[f]))),n=n.slice(0,f).concat(l,n.slice(f+e.length)),a=a.slice(0,f).concat(s,a.slice(f+e.length)),o&&(o=c=f+d.length),d}),b({formats:n,replacements:a,text:i,start:o,end:c})}function ue(e){return ie(e,"\n")}function le(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=H(e).slice(0,t).lastIndexOf(E),a=e.replacements[n],i=[,];return a&&(i=[a]),ie(e,{formats:[,],replacements:i,text:E},t,r)}var se="";function fe(e,t,r,n){return ie(e,{formats:[,],replacements:[t],text:se},r,n)}function de(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.start,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.end,n=e.formats,a=e.replacements,i=e.text;return void 0===t||void 0===r?Object(o.a)({},e):{formats:n.slice(t,r),replacements:a.slice(t,r),text:i.slice(t,r)}}function pe(e,t){var r=e.formats,n=e.replacements,a=e.text,i=e.start,o=e.end;if("string"!=typeof t)return function(e){var t=e.formats,r=e.replacements,n=e.text,a=e.start,i=e.end,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i,u={formats:t.slice(0,o),replacements:r.slice(0,o),text:n.slice(0,o)},l={formats:t.slice(c),replacements:r.slice(c),text:n.slice(c),start:0,end:0};return[ce(u,/\u2028+$/,""),ce(l,/^\u2028+/,"")]}.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!==i&&void 0!==o&&(i>=a&&i<c?u.start=i-a:i<a&&o>a&&(u.start=0),o>=a&&o<c?u.end=o-a:i<c&&o>c&&(u.end=e.length)),u})}function me(e){var t=e.type,r=e.attributes,n=e.unregisteredAttributes,a=e.object,c=e.boundaryClass,u=function(e){return Object(i.select)("core/rich-text").getFormatType(e)}(t),l={};if(c&&(l["data-rich-text-format-boundary"]="true"),!u)return r&&(l=Object(o.a)({},r,l)),{type:t,attributes:l,object:a};for(var s in l=Object(o.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}}var ve={type:"br",attributes:{"data-rich-text-padding":"true"},object:!0};function ge(e){var t,r,n,a=e.value,i=e.multilineTag,c=e.createEmpty,u=e.append,l=e.getLastChild,s=e.getParent,f=e.isText,d=e.getText,p=e.remove,m=e.appendText,v=e.onStartIndex,h=e.onEndIndex,b=e.isEditableTree,y=a.formats,x=a.replacements,T=a.text,O=a.start,j=a.end,_=y.length+1,F=c(),C={type:i},N=V(a),A=N[N.length-1];i?(u(u(F,{type:i}),""),r=t=[C]):u(F,"");for(var S=function(e){var a=T.charAt(e),c=b&&(!n||n===E||"\n"===n),_=y[e];i&&(_=a===E?t=(x[e]||[]).reduce(function(e,t){return e.push(t,C),e},[C]):[].concat(Object(g.a)(t),Object(g.a)(_||[])));var N=l(F);if(c&&a===E){for(var S=N;!f(S);)S=l(S);u(s(S),ve),u(s(S),"")}if(n===E){for(var P=N;!f(P);)P=l(P);v&&O===e&&v(F,P),h&&j===e&&h(F,P)}if(_&&_.forEach(function(e,t){if(!N||!r||e!==r[t]||a===E&&_.length-1===t){var n=e.type,i=e.attributes,o=e.unregisteredAttributes,c=b&&a!==E&&e===A,m=s(N),v=u(m,me({type:n,attributes:i,unregisteredAttributes:o,boundaryClass:c}));f(N)&&0===d(N).length&&p(N),N=u(v,"")}else N=l(N)}),a===E)return r=_,n=a,"continue";0===e&&(v&&0===O&&v(F,N),h&&0===j&&h(F,N)),a===w?(N=u(s(N),me(Object(o.a)({},x[e],{object:!0}))),N=u(s(N),"")):"\n"===a?(N=u(s(N),{type:"br",attributes:b?{"data-rich-text-line-break":"true"}:void 0,object:!0}),N=u(s(N),"")):f(N)?m(N,a):N=u(s(N),a),v&&O===e+1&&v(F,N),h&&j===e+1&&h(F,N),c&&e===T.length&&u(s(N),ve),r=_,n=a},P=0;P<_;P++)S(P);return F}var he=window.Node.TEXT_NODE;function be(e,t,r){for(var n=e.parentNode,a=0;e=e.previousSibling;)a++;return r=[a].concat(Object(g.a)(r)),n!==t&&(r=be(n,t,r)),r}function ye(e,t){for(t=Object(g.a)(t);e&&t.length>1;)e=e.childNodes[t.shift()];return{node:e,offset:t[0]}}var xe=function(){return j(document,"")};function Te(e,t){"string"==typeof t&&(t=e.ownerDocument.createTextNode(t));var r=t,n=r.type,a=r.attributes;if(n)for(var i in t=e.ownerDocument.createElement(n),a)t.setAttribute(i,a[i]);return e.appendChild(t)}function Oe(e,t){e.appendData(t)}function je(e){return e.lastChild}function Ee(e){return e.parentNode}function we(e){return e.nodeType===he}function _e(e){return e.nodeValue}function Fe(e){return e.parentNode.removeChild(e)}function Ce(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return e.reduce(function(e,r){return r(e,t.text)},t.formats)}function Ne(e){var t=e.value,r=e.multilineTag,n=e.prepareEditableTree,a=e.isEditableTree,i=void 0===a||a,c=[],u=[];return{body:ge({value:Object(o.a)({},t,{formats:Ce(n,t)}),multilineTag:r,createEmpty:xe,append:Te,getLastChild:je,getParent:Ee,isText:we,getText:_e,remove:Fe,appendText:Oe,onStartIndex:function(e,t){c=be(t,e,[t.nodeValue.length])},onEndIndex:function(e,t){u=be(t,e,[t.nodeValue.length])},isEditableTree:i}),selection:{startPath:c,endPath:u}}}function Ae(e){var t=e.value,r=e.current,n=e.multilineTag,a=e.prepareEditableTree,i=e.__unstableDomOnly,o=Ne({value:t,multilineTag:n,prepareEditableTree:a}),c=o.body,u=o.selection;!function e(t,r){var n=0;var a;for(;a=t.firstChild;){var i=r.childNodes[n];if(i)if(i.isEqualNode(a))t.removeChild(a);else if(i.nodeName!==a.nodeName||i.nodeType===he&&i.data!==a.data)r.replaceChild(a,i);else{var o=i.attributes,c=a.attributes;if(o)for(var u=0;u<o.length;u++){var l=o[u].name;a.getAttribute(l)||i.removeAttribute(l)}if(c)for(var s=0;s<c.length;s++){var f=c[s],l=f.name,d=f.value;i.getAttribute(l)!==d&&i.setAttribute(l,d)}e(a,i),t.removeChild(a)}else r.appendChild(a);n++}for(;r.childNodes[n];)r.removeChild(r.childNodes[n])}(c,r),void 0===t.start||i||function(e,t){var r=e.startPath,n=e.endPath,a=ye(t,r),i=a.node,o=a.offset,c=ye(t,n),u=c.node,l=c.offset,s=window.getSelection(),f=t.ownerDocument,d=f.createRange();if(d.setStart(i,o),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!==t&&t.focus());s.removeAllRanges()}var p,m;s.addRange(d)}(u,r)}var Se=r(69);function Pe(e){return ze(ge({value:e.value,multilineTag:e.multilineTag,createEmpty:De,append:ke,getLastChild:Ie,getParent:Le,isText:Ve,getText:Re,remove:We,appendText:Me}).children)}function De(){return{}}function Ie(e){var t=e.children;return t&&t[t.length-1]}function ke(e,t){return"string"==typeof t&&(t={text:t}),t.parent=e,e.children=e.children||[],e.children.push(t),t}function Me(e,t){e.text+=t}function Le(e){return e.parent}function Ve(e){return"string"==typeof e.text}function Re(e){return e.text}function We(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,a=e.children,i="";for(var o in r)Object(Se.isValidAttributeName)(o)&&(i+=" ".concat(o,'="').concat(Object(Se.escapeAttribute)(r[o]),'"'));return n?"<".concat(t).concat(i,">"):"<".concat(t).concat(i,">").concat(ze(a),"</").concat(t,">")}(e):Object(Se.escapeHTML)(e.text)}).join("")}function Be(e,t){return R(e,t.type)?ne(e,t.type):y(e,t)}function He(e){var t=Object(i.select)("core/rich-text").getFormatType(e);if(t)return t.__experimentalCreatePrepareEditableTree&&t.__experimentalGetPropsForEditableTreePreparation&&Object(Q.removeFilter)("experimentalRichText",e),Object(i.dispatch)("core/rich-text").removeFormatTypes(e),t;window.console.error("Format ".concat(e," is not registered."))}function Ge(e){for(var t=e.start,r=e.text,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;n--;)if(r[n]===E)return n}function Ye(e,t){var r=Ge(e);if(void 0===r)return e;var n=e.text,a=e.replacements,i=e.end,c=Ge(e,r),u=a[r]||[],l=a[c]||[];if(u.length>l.length)return e;for(var s=a.slice(),f=function(e,t){for(var r=e.text,n=e.replacements,a=n[t]||[],i=t;i-- >=0;)if(r[i]===E){var o=n[i]||[];if(o.length===a.length+1)return i;if(o.length<=a.length)return}}(e,r),d=r;d<i;d++)if(n[d]===E)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]||t;s[d]=m.concat([v],(s[d]||[]).slice(m.length))}return Object(o.a)({},e,{replacements:s})}function qe(e,t){for(var r=e.text,n=e.replacements,a=n[t]||[],i=t;i-- >=0;){if(r[i]===E)if((n[i]||[]).length===a.length-1)return i}}function Ue(e){var t=e.text,r=e.replacements,n=e.start,a=e.end,i=Ge(e,n);if(void 0===r[i])return e;for(var c=r.slice(0),u=r[qe(e,i)]||[],l=function(e,t){for(var r=e.text,n=e.replacements,a=n[t]||[],i=t,o=t||0;o<r.length;o++)if(r[o]===E){if(!((n[o]||[]).length>=a.length))return i;i=o}return i}(e,Ge(e,a)),s=i;s<=l;s++)if(t[s]===E){var f=c[s]||[];c[s]=u.concat(f.slice(u.length+1)),0===c[s].length&&delete c[s]}return Object(o.a)({},e,{replacements:c})}function $e(e,t){for(var r,n=e.text,a=e.replacements,i=e.start,c=e.end,u=Ge(e,i),l=a[u]||[],s=a[Ge(e,c)]||[],f=qe(e,u),d=a.slice(),p=l.length-1,m=s.length-1,v=f+1||0;v<n.length;v++)if(n[v]===E){if((d[v]||[]).length<=p)break;d[v]&&(r=!0,d[v]=d[v].map(function(e,r){return r<p||r>m?e:t}))}return r?Object(o.a)({},e,{replacements:d}):e}function Xe(e){var t=e.value,r=e.start,n=e.end,a=e.formats,i=t.formats[r-1]||[],o=t.formats[n]||[];for(t.activeFormats=a.map(function(e,t){if(i[t]){if(h(e,i[t]))return i[t]}else if(o[t]&&h(e,o[t]))return o[t];return e});--n>=r;)t.activeFormats.length>0?t.formats[n]=t.activeFormats:delete t.formats[n];return t}r.d(t,"applyFormat",function(){return y}),r.d(t,"charAt",function(){return T}),r.d(t,"concat",function(){return L}),r.d(t,"create",function(){return A}),r.d(t,"getActiveFormat",function(){return R}),r.d(t,"getActiveObject",function(){return W}),r.d(t,"getSelectionEnd",function(){return z}),r.d(t,"getSelectionStart",function(){return B}),r.d(t,"getTextContent",function(){return H}),r.d(t,"isCollapsed",function(){return G}),r.d(t,"isEmpty",function(){return Y}),r.d(t,"isEmptyLine",function(){return q}),r.d(t,"join",function(){return U}),r.d(t,"registerFormatType",function(){return re}),r.d(t,"removeFormat",function(){return ne}),r.d(t,"remove",function(){return oe}),r.d(t,"replace",function(){return ce}),r.d(t,"insert",function(){return ie}),r.d(t,"insertLineBreak",function(){return ue}),r.d(t,"insertLineSeparator",function(){return le}),r.d(t,"insertObject",function(){return fe}),r.d(t,"slice",function(){return de}),r.d(t,"split",function(){return pe}),r.d(t,"apply",function(){return Ae}),r.d(t,"unstableToDom",function(){return Ne}),r.d(t,"toHTMLString",function(){return Pe}),r.d(t,"toggleFormat",function(){return Be}),r.d(t,"LINE_SEPARATOR",function(){return E}),r.d(t,"unregisterFormatType",function(){return He}),r.d(t,"indentListItems",function(){return Ye}),r.d(t,"outdentListItems",function(){return Ue}),r.d(t,"changeListType",function(){return $e}),r.d(t,"__unstableUpdateFormats",function(){return Xe}),r.d(t,"__unstableGetActiveFormats",function(){return V})},41:function(e,t,r){e.exports=function(e,t){var r,n,a,i=0;function o(){var t,o,c=n,u=arguments.length;e:for(;c;){if(c.args.length===arguments.length){for(o=0;o<u;o++)if(c.args[o]!==arguments[o]){c=c.next;continue e}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(t=new Array(u),o=0;o<u;o++)t[o]=arguments[o];return c={args:t,val:e.apply(null,t)},n?(n.prev=c,c.next=n):a=c,i===r?(a=a.prev).next=null:i++,n=c,c.val}return t&&t.maxSize&&(r=t.maxSize),o.clear=function(){n=null,a=null,i=0},o}},5:function(e,t){!function(){e.exports=this.wp.data}()},6:function(e,t){!function(){e.exports=this.wp.compose}()},69:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},7:function(e,t,r){"use strict";r.d(t,"a",function(){return a});var n=r(15);function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),a.forEach(function(t){Object(n.a)(e,t,r[t])})}return e}}}); |