mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-15 07:05:37 +01:00
cf023b82bd
This updates the 5.2 branch to support the latest LTS version of NodeJS (currently 14.x), allowing the same version to be used across all WordPress branches that receive security updates as a courtesy. In addition to backporting the package updates that happened after branching 5.2, dependencies that were removed in future releases have also been updated to their latest versions. Props desrosj, dd32, netweb, jorbin, whyisjake. Merges [45321,45765,45826,45875,46403-46404,46408-46409,47404,47867,47872-47873,48213,48705,49636,49933,49937,49939-49940,49983,49989,50017,50126,50176,50185] to the 5.2 branch. See #52341. Built from https://develop.svn.wordpress.org/branches/5.2@50191 git-svn-id: http://core.svn.wordpress.org/branches/5.2@49869 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";r.d(t,"a",(function(){return a}));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")}()}},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),r.d(t,"applyFormat",(function(){return y})),r.d(t,"charAt",(function(){return T})),r.d(t,"concat",(function(){return M})),r.d(t,"create",(function(){return N})),r.d(t,"getActiveFormat",(function(){return V})),r.d(t,"getActiveObject",(function(){return R})),r.d(t,"getSelectionEnd",(function(){return W})),r.d(t,"getSelectionStart",(function(){return z})),r.d(t,"getTextContent",(function(){return B})),r.d(t,"isCollapsed",(function(){return H})),r.d(t,"isEmpty",(function(){return G})),r.d(t,"isEmptyLine",(function(){return Y})),r.d(t,"join",(function(){return q})),r.d(t,"registerFormatType",(function(){return te})),r.d(t,"removeFormat",(function(){return re})),r.d(t,"remove",(function(){return ie})),r.d(t,"replace",(function(){return oe})),r.d(t,"insert",(function(){return ae})),r.d(t,"insertLineBreak",(function(){return ce})),r.d(t,"insertLineSeparator",(function(){return ue})),r.d(t,"insertObject",(function(){return le})),r.d(t,"slice",(function(){return se})),r.d(t,"split",(function(){return fe})),r.d(t,"apply",(function(){return Ne})),r.d(t,"unstableToDom",(function(){return Ce})),r.d(t,"toHTMLString",(function(){return Se})),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 L}));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,_=w.TEXT_NODE,F=w.ELEMENT_NODE;function C(e,t){for(var r in e)if(e[r]===t)return r}function N(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.element,r=e.text,n=e.html,a=e.range,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?D({element:t,range:a,multilineTag:i,multilineWrapperTags:o,isEditableTree:c}):P({element:t,range:a,isEditableTree:c}))}function A(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===_?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===_?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 S(e){return e.replace(/[\n\r\t]+/g," ")}function P(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 A(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===_){var d=S(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,S),A(s,c,r,{text:d}),s.formats.length+=d.length,s.replacements.length+=d.length,s.text+=d,"continue"}if(c.nodeType!==F)return"continue";if(c.getAttribute("data-rich-text-padding")||l&&"br"===f&&!c.getAttribute("data-rich-text-line-break"))return A(s,c,r,{formats:[],replacements:[],text:""}),"continue";if("br"===f)return A(s,c,r,{formats:[],replacements:[],text:""}),k(s,N({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=C(t.attributes,c);u?a[u]=n[c]:o[c]=n[c]}return{type:t.name,attributes:a,unregisteredAttributes:o}}({type:f,attributes:I({element:c})}),b=h(v,m)?m:v;if(a&&-1!==a.indexOf(f)){var y=D({element:c,range:r,multilineTag:n,multilineWrapperTags:a,currentWrapperTags:[].concat(Object(g.a)(u),[b]),isEditableTree:l});return A(s,c,r,y),k(s,y),"continue"}var x=P({element:c,range:r,multilineTag:n,multilineWrapperTags:a,isEditableTree:l});A(s,c,r,x),b?0===x.text.length?b.attributes&&k(s,{formats:[,],replacements:[b],text:""}):k(s,Object(o.a)({},x,{formats:Array.from(x.formats,(function(e){return e?[b].concat(Object(g.a)(e)):[b]}))})):k(s,x)},p=0;p<f;p++)d(p);return s}function D(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=P({element:f,range:r,multilineTag:n,multilineWrapperTags:a,currentWrapperTags:o,isEditableTree:c});(0!==s||o.length>0)&&k(u,{formats:[,],replacements:o.length>0?[o]:[,],text:E}),A(u,f,r,d),k(u,d)}}return u}function I(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 k(e,t){return e.formats=e.formats.concat(t.formats),e.replacements=e.replacements.concat(t.replacements),e.text+=t.text,e}function M(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return b(t.reduce(k,N()))}function L(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 V(e,t){return Object(c.find)(L(e),{type:t})}function R(e){var t=e.start,r=e.end,n=e.replacements,a=e.text;if(t+1===r&&""===a[t])return n[t]}function W(e){return e.end}function z(e){return e.start}function B(e){return e.text}function H(e){var t=e.start,r=e.end;if(void 0!==t&&void 0!==r)return t===r}function G(e){return 0===e.text.length}function Y(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 q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"string"==typeof t&&(t=N({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 U=r(15),$=r(19),X=r(0),Z=r(41),K=r.n(Z),J=r(26),Q=r(6),ee=[];function te(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=K()((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ee,t=arguments.length>1?arguments[1]:void 0;return[].concat(Object(g.a)(e),[t])}));return t.__experimentalCreatePrepareEditableTree&&Object(J.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(X.createElement)(r,Object($.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(U.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(Q.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 re(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);)ne(u,r,t),r--;for(n++;Object(c.find)(u[n],l);)ne(u,n,t),n++}}else for(var s=r;s<n;s++)u[s]&&ne(u,s,t);return b(Object(o.a)({},e,{formats:u,activeFormats:Object(c.reject)(i,{type:t})}))}function ne(e,t,r){var n=e[t].filter((function(e){return e.type!==r}));n.length?e[t]=n:delete e[t]}function ae(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=N({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 ie(e,t,r){return ae(e,N(),t,r)}function oe(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 ce(e){return ae(e,"\n")}function ue(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.start,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.end,n=B(e).slice(0,t),a=n.lastIndexOf(E),i=e.replacements[a],o=[,];i&&(o=[i]);var c={formats:[,],replacements:o,text:E};return ae(e,c,t,r)}function le(e,t,r,n){return ae(e,{formats:[,],replacements:[t],text:""},r,n)}function se(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 fe(e,t){var r=e.formats,n=e.replacements,a=e.text,i=e.start,o=e.end;if("string"!=typeof t)return de.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 de(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[oe(u,/\u2028+$/,""),oe(l,/^\u2028+/,"")]}function pe(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 me={type:"br",attributes:{"data-rich-text-padding":"true"},object:!0};function ve(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,w=y.length+1,_=c(),F={type:i},C=L(a),N=C[C.length-1];i?(u(u(_,{type:i}),""),r=t=[F]):u(_,"");for(var A=function(e){var a=T.charAt(e),c=b&&(!n||n===E||"\n"===n),w=y[e];i&&(w=a===E?t=(x[e]||[]).reduce((function(e,t){return e.push(t,F),e}),[F]):[].concat(Object(g.a)(t),Object(g.a)(w||[])));var C=l(_);if(c&&a===E){for(var A=C;!f(A);)A=l(A);u(s(A),me),u(s(A),"")}if(n===E){for(var S=C;!f(S);)S=l(S);v&&O===e&&v(_,S),h&&j===e&&h(_,S)}if(w&&w.forEach((function(e,t){if(!C||!r||e!==r[t]||a===E&&w.length-1===t){var n=e.type,i=e.attributes,o=e.unregisteredAttributes,c=b&&a!==E&&e===N,m=s(C),v=u(m,pe({type:n,attributes:i,unregisteredAttributes:o,boundaryClass:c}));f(C)&&0===d(C).length&&p(C),C=u(v,"")}else C=l(C)})),a===E)return r=w,n=a,"continue";0===e&&(v&&0===O&&v(_,C),h&&0===j&&h(_,C)),""===a?(C=u(s(C),pe(Object(o.a)({},x[e],{object:!0}))),C=u(s(C),"")):"\n"===a?(C=u(s(C),{type:"br",attributes:b?{"data-rich-text-line-break":"true"}:void 0,object:!0}),C=u(s(C),"")):f(C)?m(C,a):C=u(s(C),a),v&&O===e+1&&v(_,C),h&&j===e+1&&h(_,C),c&&e===T.length&&u(s(C),me),r=w,n=a},S=0;S<w;S++)A(S);return _}var ge=window.Node.TEXT_NODE;function he(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=he(n,t,r)),r}function be(e,t){for(t=Object(g.a)(t);e&&t.length>1;)e=e.childNodes[t.shift()];return{node:e,offset:t[0]}}var ye=function(){return j(document,"")};function xe(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 Te(e,t){e.appendData(t)}function Oe(e){return e.lastChild}function je(e){return e.parentNode}function Ee(e){return e.nodeType===ge}function we(e){return e.nodeValue}function _e(e){return e.parentNode.removeChild(e)}function Fe(){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 Ce(e){var t=e.value,r=e.multilineTag,n=e.prepareEditableTree,a=e.isEditableTree,i=void 0===a||a,c=[],u=[];return{body:ve({value:Object(o.a)({},t,{formats:Fe(n,t)}),multilineTag:r,createEmpty:ye,append:xe,getLastChild:Oe,getParent:je,isText:Ee,getText:we,remove:_e,appendText:Te,onStartIndex:function(e,t){c=he(t,e,[t.nodeValue.length])},onEndIndex:function(e,t){u=he(t,e,[t.nodeValue.length])},isEditableTree:i}),selection:{startPath:c,endPath:u}}}function Ne(e){var t=e.value,r=e.current,n=e.multilineTag,a=e.prepareEditableTree,i=e.__unstableDomOnly,o=Ce({value:t,multilineTag:n,prepareEditableTree:a}),c=o.body,u=o.selection;!function e(t,r){var n,a=0;for(;n=t.firstChild;){var i=r.childNodes[a];if(i)if(i.isEqualNode(n))t.removeChild(n);else if(i.nodeName!==n.nodeName||i.nodeType===ge&&i.data!==n.data)r.replaceChild(n,i);else{var o=i.attributes,c=n.attributes;if(o)for(var u=0;u<o.length;u++){var l=o[u].name;n.getAttribute(l)||i.removeAttribute(l)}if(c)for(var s=0;s<c.length;s++){var f=c[s],d=(l=f.name,f.value);i.getAttribute(l)!==d&&i.setAttribute(l,d)}e(n,i),t.removeChild(n)}else r.appendChild(n);a++}for(;r.childNodes[a];)r.removeChild(r.childNodes[a])}(c,r),void 0===t.start||i||function(e,t){var r=e.startPath,n=e.endPath,a=be(t,r),i=a.node,o=a.offset,c=be(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 Ae=r(69);function Se(e){return ze(ve({value:e.value,multilineTag:e.multilineTag,createEmpty:Pe,append:Ie,getLastChild:De,getParent:Me,isText:Le,getText:Ve,remove:Re,appendText:ke}).children)}function Pe(){return{}}function De(e){var t=e.children;return t&&t[t.length-1]}function Ie(e,t){return"string"==typeof t&&(t={text:t}),t.parent=e,e.children=e.children||[],e.children.push(t),t}function ke(e,t){e.text+=t}function Me(e){return e.parent}function Le(e){return"string"==typeof e.text}function Ve(e){return e.text}function Re(e){var t=e.parent.children.indexOf(e);return-1!==t&&e.parent.children.splice(t,1),e}function We(e){var t=e.type,r=e.attributes,n=e.object,a=e.children,i="";for(var o in r)Object(Ae.isValidAttributeName)(o)&&(i+=" ".concat(o,'="').concat(Object(Ae.escapeAttribute)(r[o]),'"'));return n?"<".concat(t).concat(i,">"):"<".concat(t).concat(i,">").concat(ze(a),"</").concat(t,">")}function ze(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map((function(e){return void 0===e.text?We(e):Object(Ae.escapeHTML)(e.text)})).join("")}function Be(e,t){return V(e,t.type)?re(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(J.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,a=n;a--;)if(r[a]===E)return a}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}},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}}}); |