7 lines
54 KiB
JavaScript
7 lines
54 KiB
JavaScript
/*! 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=424)}({0:function(e,t){!function(){e.exports=this.wp.element}()},11: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;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)&&n.length){var i=o.apply(null,n);i&&e.push(i)}else if("object"===a)for(var c in n)r.call(n,c)&&n[c]&&e.push(c)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},12: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}))},13:function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}r.d(t,"a",(function(){return o}))},14:function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.d(t,"a",(function(){return n}))},15:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(34),o=r(7);function a(e,t){return!t||"object"!==Object(n.a)(t)&&"function"!=typeof t?Object(o.a)(e):t}},16:function(e,t,r){"use strict";function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}r.d(t,"a",(function(){return n}))},17:function(e,t,r){"use strict";function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}r.d(t,"a",(function(){return o}))},18:function(e,t,r){"use strict";var n=r(25);var o=r(35),a=r(27);function i(e){return function(e){if(Array.isArray(e))return Object(n.a)(e)}(e)||Object(o.a)(e)||Object(a.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}r.d(t,"a",(function(){return i}))},2:function(e,t){!function(){e.exports=this.lodash}()},22:function(e,t){!function(){e.exports=this.wp.keycodes}()},25:function(e,t,r){"use strict";function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}r.d(t,"a",(function(){return n}))},27:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(25);function o(e,t){if(e){if("string"==typeof e)return Object(n.a)(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Object(n.a)(e,t):void 0}}},34:function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}r.d(t,"a",(function(){return n}))},35:function(e,t,r){"use strict";function n(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}r.d(t,"a",(function(){return n}))},37:function(e,t){!function(){e.exports=this.wp.deprecated}()},4:function(e,t){!function(){e.exports=this.wp.data}()},40:function(e,t,r){"use strict";var n,o;function a(e){return[e]}function i(){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={},o="undefined"!=typeof WeakMap,t.a=function(e,t){var r,s;function u(){r=o?new WeakMap:i()}function l(){var r,n,o,a,i,u=arguments.length;for(a=new Array(u),o=0;o<u;o++)a[o]=arguments[o];for(i=t.apply(null,a),(r=s(i)).isUniqueByDependants||(r.lastDependants&&!c(i,r.lastDependants,0)&&r.clear(),r.lastDependants=i),n=r.head;n;){if(c(n.args,a,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,a)},a[0]=null,n.args=a,r.head&&(r.head.prev=n,n.next=r.head),r.head=n,n.val}return t||(t=a),s=o?function(e){var t,o,a,c,s,u=r,l=!0;for(t=0;t<e.length;t++){if(o=e[t],!(s=o)||"object"!=typeof s){l=!1;break}u.has(o)?u=u.get(o):(a=new WeakMap,u.set(o,a),u=a)}return u.has(n)||((c=i()).isUniqueByDependants=l,u.set(n,c)),u.get(n)}:function(){return r},l.getDependants=t,l.clear=u,u(),l}},424:function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"getFormatTypes",(function(){return p})),r.d(n,"getFormatType",(function(){return d})),r.d(n,"getFormatTypeForBareElement",(function(){return h})),r.d(n,"getFormatTypeForClassName",(function(){return b}));var o={};r.r(o),r.d(o,"addFormatTypes",(function(){return m})),r.d(o,"removeFormatTypes",(function(){return v}));var a=r(4),i=r(5),c=r(2);function s(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 u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var l=Object(a.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 u({},e,{},Object(c.keyBy)(t.formatTypes,"name"));case"REMOVE_FORMAT_TYPES":return Object(c.omit)(e,t.names)}return e}}),f=r(40),p=Object(f.a)((function(e){return Object.values(e.formatTypes)}),(function(e){return[e.formatTypes]}));function d(e,t){return e.formatTypes[t]}function h(e,t){return Object(c.find)(p(e),(function(e){var r=e.className,n=e.tagName;return null===r&&t===n}))}function b(e,t){return Object(c.find)(p(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(a.registerStore)("core/rich-text",{reducer:l,selectors:n,actions:o});var g=r(18);function y(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;c<i;c++){var s=o[c];if(r[s]!==n[s])return!1}return!0}function O(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 j(e){var t=e.formats.slice();return t.forEach((function(e,r){var n=t[r-1];if(n){var o=e.slice();o.forEach((function(e,t){var r=n[t];y(e,r)&&(o[t]=r)})),t[r]=o}})),function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{formats:t})}function w(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 T(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function E(e,t,r){return(e=e.slice())[t]=r,e}function x(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,i=o.slice();if(r===n){var s=Object(c.find)(i[r],{type:t.type});if(s){for(var u=i[r].indexOf(s);i[r]&&i[r][u]===s;)i[r]=E(i[r],u,t),r--;for(n++;i[n]&&i[n][u]===s;)i[n]=E(i[n],u,t),n++}}else{for(var l=1/0,f=r;f<n;f++)if(i[f]){i[f]=i[f].filter((function(e){return e.type!==t.type}));var p=i[f].length;p<l&&(l=p)}else i[f]=[],l=0;for(var d=r;d<n;d++)i[d].splice(l,0,t)}return j(T({},e,{formats:i,activeFormats:[].concat(Object(g.a)(Object(c.reject)(a,{type:t.type})),[t])}))}var P=r(34);function _(e,t){var r=e.implementation;return _.body||(_.body=r.createHTMLDocument("").body),_.body.innerHTML=t,_.body}function S(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}var C=window.Node,D=C.TEXT_NODE,F=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,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=_(document,n)),"object"!==Object(P.a)(t)?{formats:[],replacements:[],text:""}:a?W({element:t,range:o,multilineTag:a,multilineWrapperTags:i,isEditableTree:c,preserveWhiteSpace:s}):L({element:t,range:o,isEditableTree:c,preserveWhiteSpace:s}))}function k(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===D?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===D?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 R=new RegExp("\ufeff","g");function I(e){return e.replace(R,"")}function L(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 k(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===D){var d=I;l||(d=function(e){return I(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),k(f,c,r,{text:h}),f.formats.length+=h.length,f.replacements.length+=h.length,f.text+=h,"continue"}if(c.nodeType!==F)return"continue";if(u&&(c.getAttribute("data-rich-text-placeholder")||"br"===p&&!c.getAttribute("data-rich-text-line-break")))return k(f,c,r,{formats:[],replacements:[],text:""}),"continue";if("br"===p)return k(f,c,r,{formats:[],replacements:[],text:""}),H(f,A({text:"\n"})),"continue";var b=f.formats[f.formats.length-1],m=b&&b[b.length-1],v=function(e){var t,r=e.type,n=e.attributes;if(n&&n.class&&(t=Object(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=N(t.attributes,c);s?o[s]=n[c]:i[c]=n[c]}return{type:t.name,attributes:o,unregisteredAttributes:i}}({type:p,attributes:M({element:c})}),O=y(v,m)?m:v;if(o&&-1!==o.indexOf(p)){var j=W({element:c,range:r,multilineTag:n,multilineWrapperTags:o,currentWrapperTags:[].concat(Object(g.a)(s),[O]),isEditableTree:u,preserveWhiteSpace:l});return k(f,c,r,j),H(f,j),"continue"}var w=L({element:c,range:r,multilineTag:n,multilineWrapperTags:o,isEditableTree:u,preserveWhiteSpace:l});if(k(f,c,r,w),O)if(0===w.text.length)O.attributes&&H(f,{formats:[,],replacements:[O],text:""});else{function T(e){if(T.formats===e)return T.newFormats;var t=e?[O].concat(Object(g.a)(e)):[O];return T.formats=e,T.newFormats=t,t}T.newFormats=[O],H(f,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},w,{formats:Array.from(w.formats,T)}))}else H(f,w)},h=0;h<p;h++)d(h);return f}function W(e){var t=e.element,r=e.range,n=e.multilineTag,o=e.multilineWrapperTags,a=e.currentWrapperTags,i=void 0===a?[]:a,c=e.isEditableTree,s=e.preserveWhiteSpace,u={formats:[],replacements:[],text:""};if(!t||!t.hasChildNodes())return u;for(var l=t.children.length,f=0;f<l;f++){var p=t.children[f];if(p.nodeName.toLowerCase()===n){var d=L({element:p,range:r,multilineTag:n,multilineWrapperTags:o,currentWrapperTags:i,isEditableTree:c,preserveWhiteSpace:s});(0!==f||i.length>0)&&H(u,{formats:[,],replacements:i.length>0?[i]:[,],text:"\u2028"}),k(u,p,r,d),H(u,d)}}return u}function M(e){var t=e.element;if(t.hasAttributes()){for(var r,n=t.attributes.length,o=0;o<n;o++){var a=t.attributes[o],i=a.name,c=a.value;0!==i.indexOf("data-rich-text-")&&((r=r||{})[i]=c)}return r}}function H(e,t){return e.formats=e.formats.concat(t.formats),e.replacements=e.replacements.concat(t.replacements),e.text+=t.text,e}function K(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return j(t.reduce(H,A()))}function V(e){var t=e.formats,r=e.start,n=e.end,o=e.activeFormats,a=arguments.length>1&&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.length<c.length?i:c}return t[r]||a}function B(e,t){return Object(c.find)(V(e),{type:t})}function U(e){var t=e.start,r=e.end,n=e.replacements,o=e.text;if(t+1===r&&""===o[t])return n[t]}function z(e){return e.text}function q(e){for(var t=e.start,r=e.text,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,o=n;o--;)if("\u2028"===r[o])return o}function G(e){var t=e.replacements[q(e,e.start)];return!t||t.length<1}function Y(e,t,r){var n=e.replacements[q(e,e.start)];return n&&0!==n.length?n[n.length-1].type===t:t===r}function $(e){var t=e.start,r=e.end;if(void 0!==t&&void 0!==r)return t===r}function X(e){return 0===e.text.length}function Z(e){var t=e.text,r=e.start,n=e.end;return r===n&&(0===t.length||(0===r&&"\u2028"===t.slice(0,1)||(r===t.length&&"\u2028"===t.slice(-1)||t.slice(r-1,n+1)==="".concat("\u2028").concat("\u2028"))))}function J(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"string"==typeof t&&(t=A({text:t})),j(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 Q(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 ee(e,t){if("string"==typeof(t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({name:e},t)).name)if(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(t.name))if(Object(a.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(a.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(a.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)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 te(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 re(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?te(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):te(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}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,i=o.slice();if(r===n){var s=Object(c.find)(i[r],{type:t});if(s){for(;Object(c.find)(i[r],s);)oe(i,r,t),r--;for(n++;Object(c.find)(i[n],s);)oe(i,n,t),n++}}else for(var u=r;u<n;u++)i[u]&&oe(i,u,t);return j(re({},e,{formats:i,activeFormats:Object(c.reject)(a,{type:t})}))}function oe(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,o=e.formats,a=e.replacements,i=e.text;"string"==typeof t&&(t=A({text:t}));var c=r+t.text.length;return j({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;s<t;s++)a[s-1]=arguments[s];var u,l,f=a[a.length-2],p=r;return"function"==typeof p&&(p=r.apply(void 0,[e].concat(a))),"object"===Object(P.a)(p)?(u=p.formats,l=p.replacements,p=p.text):(u=Array(p.length),l=Array(p.length),n[f]&&(u=u.fill(n[f]))),n=n.slice(0,f).concat(u,n.slice(f+e.length)),o=o.slice(0,f).concat(l,o.slice(f+e.length)),i&&(i=c=f+p.length),p})),j({formats:n,replacements:o,text:a,start:i,end:c})}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=z(e).slice(0,t),o=n.lastIndexOf("\u2028"),a=e.replacements[o],i=[,];a&&(i=[a]);var c={formats:[,],replacements:i,text:"\u2028"};return ae(e,c,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){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ue(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function fe(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.replacements,n=e.text,o=e.start,a=e.end,i=$(e),c=o-1,s=i?o-1:o,u=a;if(t||(c=a,s=o,u=i?a+1:a),"\u2028"===n[c]){var l;if(i&&r[c]&&r[c].length){var f=r.slice();f[c]=r[c].slice(0,-1),l=le({},e,{replacements:f})}else l=ie(e,s,u);return l}}function pe(e,t,r,n){return ae(e,{formats:[,],replacements:[t],text:""},r,n)}function de(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function he(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?de(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):de(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function be(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,o=e.replacements,a=e.text;return void 0===t||void 0===r?he({},e):{formats:n.slice(t,r),replacements:o.slice(t,r),text:a.slice(t,r)}}function me(e,t){var r=e.formats,n=e.replacements,o=e.text,a=e.start,i=e.end;if("string"!=typeof t)return ve.apply(void 0,arguments);var c=0;return o.split(t).map((function(e){var o=c,s={formats:r.slice(o,o+e.length),replacements:n.slice(o,o+e.length),text:e};return c+=t.length+e.length,void 0!==a&&void 0!==i&&(a>=o&&a<c?s.start=a-o:a<o&&i>o&&(s.start=0),i>=o&&i<c?s.end=i-o:a<c&&i>c&&(s.end=e.length)),s}))}function ve(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 ge(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 ye(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ge(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ge(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Oe(e){var t=e.type,r=e.attributes,n=e.unregisteredAttributes,o=e.object,i=e.boundaryClass,c=function(e){return Object(a.select)("core/rich-text").getFormatType(e)}(t),s={};if(i&&(s["data-rich-text-format-boundary"]="true"),!c)return r&&(s=ye({},r,{},s)),{type:t,attributes:s,object:o};for(var u in s=ye({},n,{},s),r){var l=!!c.attributes&&c.attributes[u];l?s[l]=r[u]:s[u]=r[u]}return c.className&&(s.class?s.class="".concat(c.className," ").concat(s.class):s.class=c.className),{type:c.tagName,object:c.object,attributes:s}}function je(e){var t,r,n,o=e.value,a=e.multilineTag,i=e.preserveWhiteSpace,c=e.createEmpty,s=e.append,u=e.getLastChild,l=e.getParent,f=e.isText,p=e.getText,d=e.remove,h=e.appendText,b=e.onStartIndex,m=e.onEndIndex,v=e.isEditableTree,y=e.placeholder,O=o.formats,j=o.replacements,w=o.text,T=o.start,E=o.end,x=O.length+1,P=c(),_={type:a},S=V(o),C=S[S.length-1];a?(s(s(P,{type:a}),""),r=t=[_]):s(P,"");for(var D=function(e){var o=w.charAt(e),c=v&&(!n||"\u2028"===n||"\n"===n),x=O[e];a&&(x="\u2028"===o?t=(j[e]||[]).reduce((function(e,t){return e.push(t,_),e}),[_]):[].concat(Object(g.a)(t),Object(g.a)(x||[])));var S=u(P);if(c&&"\u2028"===o){for(var D=S;!f(D);)D=u(D);s(l(D),"\ufeff")}if("\u2028"===n){for(var F=S;!f(F);)F=u(F);b&&T===e&&b(P,F),m&&E===e&&m(P,F)}if(x&&x.forEach((function(e,t){if(S&&r&&function(e,t,r){do{if(e[r]!==t[r])return!1}while(r--);return!0}(x,r,t)&&("\u2028"!==o||x.length-1!==t))S=u(S);else{var n=e.type,a=e.attributes,i=e.unregisteredAttributes,c=v&&"\u2028"!==o&&e===C,h=l(S),b=s(h,Oe({type:n,attributes:a,unregisteredAttributes:i,boundaryClass:c}));f(S)&&0===p(S).length&&d(S),S=s(b,"")}})),"\u2028"===o)return r=x,n=o,"continue";0===e&&(b&&0===T&&b(P,S),m&&0===E&&m(P,S)),""===o?(S=s(l(S),Oe(ye({},j[e],{object:!0}))),S=s(l(S),"")):i||"\n"!==o?f(S)?h(S,o):S=s(l(S),o):(S=s(l(S),{type:"br",attributes:v?{"data-rich-text-line-break":"true"}:void 0,object:!0}),S=s(l(S),"")),b&&T===e+1&&b(P,S),m&&E===e+1&&m(P,S),c&&e===w.length&&(s(l(S),"\ufeff"),y&&0===w.length&&s(l(S),{type:"span",attributes:{"data-rich-text-placeholder":y,contenteditable:"false"}})),r=x,n=o},F=0;F<x;F++)D(F);return P}function we(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}var Te=window.Node.TEXT_NODE;function Ee(e,t,r){for(var n=e.parentNode,o=0;e=e.previousSibling;)o++;return r=[o].concat(Object(g.a)(r)),n!==t&&(r=Ee(n,t,r)),r}function xe(e,t){for(t=Object(g.a)(t);e&&t.length>1;)e=e.childNodes[t.shift()];return{node:e,offset:t[0]}}var Pe=function(){return _(document,"")};function _e(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 Se(e,t){e.appendData(t)}function Ce(e){return e.lastChild}function De(e){return e.parentNode}function Fe(e){return e.nodeType===Te}function Ne(e){return e.nodeValue}function Ae(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;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?we(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):we(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{formats:n(t)})),{body:je({value:t,multilineTag:r,createEmpty:Pe,append:_e,getLastChild:Ce,getParent:De,isText:Fe,getText:Ne,remove:Ae,appendText:Se,onStartIndex:function(e,t){s=Ee(t,e,[t.nodeValue.length])},onEndIndex:function(e,t){u=Ee(t,e,[t.nodeValue.length])},isEditableTree:a,placeholder:c}),selection:{startPath:s,endPath:u}}}function Re(e){var t=e.value,r=e.current,n=e.multilineTag,o=e.prepareEditableTree,a=e.__unstableDomOnly,i=ke({value:t,multilineTag:n,prepareEditableTree:o,placeholder:e.placeholder}),c=i.body,s=i.selection;!function e(t,r){var n,o=0;for(;n=t.firstChild;){var a=r.childNodes[o];if(a)if(a.isEqualNode(n))t.removeChild(n);else if(a.nodeName!==n.nodeName||a.nodeType===Te&&a.data!==n.data)r.replaceChild(n,a);else{var i=a.attributes,c=n.attributes;if(i)for(var s=i.length;s--;){var u=i[s].name;n.getAttribute(u)||a.removeAttribute(u)}if(c)for(var l=0;l<c.length;l++){var f=c[l],p=f.name,d=f.value;a.getAttribute(p)!==d&&a.setAttribute(p,d)}e(n,a),t.removeChild(n)}else r.appendChild(n);o++}for(;r.childNodes[o];)r.removeChild(r.childNodes[o])}(c,r),void 0===t.start||a||function(e,t){var r=e.startPath,n=e.endPath,o=xe(t,r),a=o.node,i=o.offset,c=xe(t,n),s=c.node,u=c.offset,l=window.getSelection(),f=t.ownerDocument,p=f.createRange();p.setStart(a,i),p.setEnd(s,u);var d=f.activeElement;if(l.rangeCount>0){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!==document.activeElement&&d instanceof window.HTMLElement&&d.focus()}(s,r)}var Ie=r(68);function Le(e){return Ge(je({value:e.value,multilineTag:e.multilineTag,preserveWhiteSpace:e.preserveWhiteSpace,createEmpty:We,append:He,getLastChild:Me,getParent:Ve,isText:Be,getText:Ue,remove:ze,appendText:Ke}).children)}function We(){return{}}function Me(e){var t=e.children;return t&&t[t.length-1]}function He(e,t){return"string"==typeof t&&(t={text:t}),t.parent=e,e.children=e.children||[],e.children.push(t),t}function Ke(e,t){e.text+=t}function Ve(e){return e.parent}function Be(e){return"string"==typeof e.text}function Ue(e){return e.text}function ze(e){var t=e.parent.children.indexOf(e);return-1!==t&&e.parent.children.splice(t,1),e}function qe(e){var t=e.type,r=e.attributes,n=e.object,o=e.children,a="";for(var i in r)Object(Ie.isValidAttributeName)(i)&&(a+=" ".concat(i,'="').concat(Object(Ie.escapeAttribute)(r[i]),'"'));return n?"<".concat(t).concat(a,">"):"<".concat(t).concat(a,">").concat(Ge(o),"</").concat(t,">")}function Ge(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map((function(e){return void 0===e.text?qe(e):Object(Ie.escapeEditableHTML)(e.text)})).join("")}function Ye(e,t){return B(e,t.type)?ne(e,t.type):x(e,t)}function $e(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 Xe(e){var t=q(e);if(void 0===t)return!1;var r=e.replacements,n=q(e,t),o=r[t]||[],a=r[n]||[];return o.length<=a.length}function Ze(e){return void 0!==e.replacements[q(e,e.start)]}function Je(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 Qe(e,t){if(!Xe(e))return e;for(var r=q(e),n=q(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("\u2028"===r[a]){var i=n[a]||[];if(i.length===o.length+1)return a;if(i.length<=o.length)return}}(e,r),l=r;l<c;l++)if("\u2028"===o[l])if(u){var f=a[u]||[];s[l]=f.concat((s[l]||[]).slice(f.length-1))}else{var p=a[n]||[],d=p[p.length-1]||t;s[l]=p.concat([d],(s[l]||[]).slice(p.length))}return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Je(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Je(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{replacements:s})}function et(e,t){for(var r=e.text,n=e.replacements,o=n[t]||[],a=t;a-- >=0;){if("\u2028"===r[a])if((n[a]||[]).length===o.length-1)return a}}function tt(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 rt(e){if(!Ze(e))return e;for(var t=e.text,r=e.replacements,n=e.start,o=e.end,a=q(e,n),c=r.slice(0),s=r[et(e,a)]||[],u=function(e,t){for(var r=e.text,n=e.replacements,o=n[t]||[],a=t,i=t||0;i<r.length;i++)if("\u2028"===r[i]){if(!((n[i]||[]).length>=o.length))return a;a=i}return a}(e,q(e,o)),l=a;l<=u;l++)if("\u2028"===t[l]){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;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tt(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{replacements:c})}function nt(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 ot(e,t){for(var r,n=e.text,o=e.replacements,a=e.start,c=e.end,s=q(e,a),u=o[s]||[],l=o[q(e,c)]||[],f=et(e,s),p=o.slice(),d=u.length-1,h=l.length-1,b=f+1||0;b<n.length;b++)if("\u2028"===n[b]){if((p[b]||[]).length<=d)break;p[b]&&(r=!0,p[b]=p[b].map((function(e,r){return r<d||r>h?e:t})))}return r?function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nt(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e,{replacements:p}):e}var at=r(12),it=r(14),ct=r(13),st=r(15),ut=r(16),lt=r(7),ft=r(17),pt=r(0),dt=r(11),ht=r.n(dt),bt=r(22),mt=r(8),vt=r(51),gt=r.n(vt),yt=r(37),Ot=r.n(yt),jt=new Set(["a","audio","button","details","embed","iframe","input","label","select","textarea","video"]);function wt(e){var t=e.formatTypes,r=e.onChange,n=e.onFocus,o=e.value,a=e.allowedFormats,i=e.withoutInteractiveFormatting;return t.map((function(e){var t=e.name,c=e.edit,s=e.tagName;if(!c)return null;if(a&&-1===a.indexOf(t))return null;if(i&&jt.has(s))return null;var u=B(o,t),l=void 0!==u,f=U(o),p=void 0!==f&&f.type===t;return Object(pt.createElement)(c,{key:t,isActive:l,activeAttributes:l&&u.attributes||{},isObjectActive:p,activeObjectAttributes:p&&f.attributes||{},value:o,onChange:r,onFocus:n})}))}function Tt(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){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tt(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function xt(e){return e("core/rich-text").getFormatTypes()}var Pt=document.createElement("style");function _t(e){var t=e.activeFormats,r=e.forwardedRef;return Object(pt.useEffect)((function(){if(t&&t.length){var e=r.current.querySelector("*[data-rich-text-format-boundary]");if(e){var n=window.getComputedStyle(e).color.replace(")",", 0.2)").replace("rgb","rgba"),o=".rich-text:focus ".concat("*[data-rich-text-format-boundary]"),a="background-color: ".concat(n),i="".concat(o," {").concat(a,"}");Pt.innerHTML!==i&&(Pt.innerHTML=i)}}}),[t]),null}function St(e){e.forwardedRef;return Object(pt.useEffect)((function(){}),[]),null}function Ct(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 Dt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ct(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ct(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}document.head.appendChild(Pt);var Ft=window,Nt=Ft.getSelection,At=Ft.getComputedStyle,kt=new Set(["insertParagraph","insertOrderedList","insertUnorderedList","insertHorizontalRule","insertLink"]),Rt={whiteSpace:"pre-wrap"},It=[];function Lt(e,t){var r=Object.keys(e).reduce((function(r,n){return n.startsWith(t)&&r.push(e[n]),r}),[]);return function(e){return r.reduce((function(t,r){return r(t,e.text)}),e.formats)}}var Wt=function(e){function t(e){var r,n=e.value,o=e.selectionStart,a=e.selectionEnd;return Object(it.a)(this,t),(r=Object(st.a)(this,Object(ut.a)(t).apply(this,arguments))).onFocus=r.onFocus.bind(Object(lt.a)(r)),r.onBlur=r.onBlur.bind(Object(lt.a)(r)),r.onChange=r.onChange.bind(Object(lt.a)(r)),r.handleDelete=r.handleDelete.bind(Object(lt.a)(r)),r.handleEnter=r.handleEnter.bind(Object(lt.a)(r)),r.handleSpace=r.handleSpace.bind(Object(lt.a)(r)),r.handleHorizontalNavigation=r.handleHorizontalNavigation.bind(Object(lt.a)(r)),r.onPaste=r.onPaste.bind(Object(lt.a)(r)),r.onCreateUndoLevel=r.onCreateUndoLevel.bind(Object(lt.a)(r)),r.onInput=r.onInput.bind(Object(lt.a)(r)),r.onCompositionStart=r.onCompositionStart.bind(Object(lt.a)(r)),r.onCompositionEnd=r.onCompositionEnd.bind(Object(lt.a)(r)),r.onSelectionChange=r.onSelectionChange.bind(Object(lt.a)(r)),r.createRecord=r.createRecord.bind(Object(lt.a)(r)),r.applyRecord=r.applyRecord.bind(Object(lt.a)(r)),r.valueToFormat=r.valueToFormat.bind(Object(lt.a)(r)),r.onPointerDown=r.onPointerDown.bind(Object(lt.a)(r)),r.formatToValue=r.formatToValue.bind(Object(lt.a)(r)),r.Editable=r.Editable.bind(Object(lt.a)(r)),r.onKeyDown=function(e){e.defaultPrevented||(r.handleDelete(e),r.handleEnter(e),r.handleSpace(e),r.handleHorizontalNavigation(e))},r.state={},r.lastHistoryValue=n,r.value=n,r.record=r.formatToValue(n),r.record.start=o,r.record.end=a,r}return Object(ft.a)(t,e),Object(ct.a)(t,[{key:"componentWillUnmount",value:function(){document.removeEventListener("selectionchange",this.onSelectionChange),window.cancelAnimationFrame(this.rafId)}},{key:"componentDidMount",value:function(){this.applyRecord(this.record,{domOnly:!0})}},{key:"createRecord",value:function(){var e=this.props,t=e.__unstableMultilineTag,r=e.forwardedRef,n=e.preserveWhiteSpace,o=Nt(),a=o.rangeCount>0?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;Re({value:e,current:a.current,multilineTag:o,multilineWrapperTags:"li"===o?["ul","ol"]:void 0,prepareEditableTree:Lt(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:V(Dt({},this.record,{activeFormats:void 0}),It)});else{var t=It;this.record=Dt({},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&&(Ot()("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(y(e,a[t]))return a[t]}else if(i[t]&&y(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),"insertText"===t){f&&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(Dt({},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=Dt({},a,{start:r,end:n,activeFormats:void 0}),f=V(l,It);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===bt.DELETE||t===bt.BACKSPACE||t===bt.ESCAPE){if(this.props.__unstableDidAutomaticChange)return e.preventDefault(),void this.props.__unstableUndo();if(t!==bt.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===bt.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&&Z(s)?fe(s,!p):fe(s,p))return this.onChange(r),void e.preventDefault();!o||!$(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===bt.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!==bt.SPACE||"li"!==s)){var u=this.createRecord();if($(u)){var l=u.text[u.start-1];l&&"\u2028"!==l||(this.onChange(Qe(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!==bt.LEFT&&t!==bt.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=$(i),h="rtl"===At(this.props.forwardedRef.current).direction?bt.RIGHT:bt.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]||It,v=s[u]||It,g=p.length,y=v;if(m.length>v.length&&(y=m),m.length<v.length?(!b&&p.length<v.length&&g++,b&&p.length>m.length&&g--):m.length>v.length&&(!b&&p.length>v.length&&g--,b&&p.length<m.length&&g++),g!==p.length){var O=y.slice(0,g),j=Dt({},i,{activeFormats:O});return this.record=j,this.applyRecord(j),void this.setState({activeFormats:O})}var w=u+(b?-1:1),T=b?m:v,E=Dt({},i,{start:w,end:w,activeFormats:T});this.record=E,this.applyRecord(E),this.props.onSelectionChange(w,w),this.setState({activeFormats:T})}}}},{key:"onPointerDown",value:function(e){var t=e.target;if(t!==this.props.forwardedRef.current&&!t.textContent){var r=t.parentNode,n=Array.from(r.childNodes).indexOf(t),o=t.ownerDocument.createRange(),a=Nt();o.setStart(t.parentNode,n),o.setEnd(t.parentNode,n+1),a.removeAllRanges(),a.addRange(o)}}},{key:"componentDidUpdate",value:function(e){var t=this.props,r=t.tagName,n=t.value,o=t.selectionStart,a=t.selectionEnd,i=t.placeholder,s=t.__unstableIsSelected,u=r!==e.tagName;u=u||n!==e.value&&n!==this.value;var l=o!==e.selectionStart&&o!==this.record.start||a!==e.selectionEnd&&a!==this.record.end;u=u||s&&!e.isSelected&&l;var f=function(e,t){return t.startsWith("format_prepare_props_")},p=Object(c.pickBy)(this.props,f),d=Object(c.pickBy)(e,f);(u=(u=u||!gt()(p,d))||i!==e.placeholder)?(this.value=n,this.record=this.formatToValue(n),this.record.start=o,this.record.end=a,this.applyRecord(this.record)):l&&(this.record=Dt({},this.record,{start:o,end:a}))}},{key:"formatToValue",value:function(e){var t=this.props,r=t.format,n=t.__unstableMultilineTag,o=t.preserveWhiteSpace;if("string"!==r)return e;var a=Lt(this.props,"format_value_functions");return(e=A({html:e,multilineTag:n,multilineWrapperTags:"li"===n?["ul","ol"]:void 0,preserveWhiteSpace:o})).formats=a(e),e}},{key:"removeEditorOnlyFormats",value:function(e){return this.props.formatTypes.forEach((function(t){t.__experimentalCreatePrepareEditableTree&&(e=ne(e,t.name,0,e.text.length))})),e}},{key:"valueToFormat",value:function(e){var t=this.props,r=t.format,n=t.__unstableMultilineTag,o=t.preserveWhiteSpace;if(e=this.removeEditorOnlyFormats(e),"string"===r)return Le({value:e,multilineTag:n,preserveWhiteSpace:o})}},{key:"Editable",value:function(e){var t=this,r=this.props,n=r.tagName,o=void 0===n?"div":n,a=r.style,i=r.className,s=r.placeholder,u=r.forwardedRef,l=r.disabled,f=Object(c.pickBy)(this.props,(function(e,t){return Object(c.startsWith)(t,"aria-")}));return Object(pt.createElement)(o,Object(at.a)({role:"textbox","aria-multiline":!0,"aria-label":s},e,f,{ref:u,style:a?Dt({},a,{whiteSpace:"pre-wrap"}):Rt,className:ht()("rich-text",i),onPaste:this.onPaste,onInput:this.onInput,onCompositionStart:this.onCompositionStart,onCompositionEnd:this.onCompositionEnd,onKeyDown:e.onKeyDown?function(r){e.onKeyDown(r),t.onKeyDown(r)}:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,onMouseDown:this.onPointerDown,onTouchStart:this.onPointerDown,onKeyUp:this.onSelectionChange,onMouseUp:this.onSelectionChange,onTouchEnd:this.onSelectionChange,contentEditable:!l||void 0,suppressContentEditableWarning:!l}))}},{key:"render",value:function(){var e=this,t=this.props,r=t.__unstableIsSelected,n=t.children,o=t.allowedFormats,a=t.withoutInteractiveFormatting,i=t.formatTypes,c=t.forwardedRef,s=this.state.activeFormats,u=function(){c.current.focus(),e.applyRecord(e.record)};return Object(pt.createElement)(pt.Fragment,null,Object(pt.createElement)(_t,{activeFormats:s,forwardedRef:c}),Object(pt.createElement)(St,{forwardedRef:c}),r&&Object(pt.createElement)(wt,{allowedFormats:o,withoutInteractiveFormatting:a,value:this.record,onChange:this.onChange,onFocus:u,formatTypes:i}),n&&n({isSelected:r,value:this.record,onChange:this.onChange,onFocus:u,Editable:this.Editable}),!n&&Object(pt.createElement)(this.Editable,null))}}]),t}(pt.Component);Wt.defaultProps={format:"string",value:""};var Mt=Object(mt.compose)([mt.withSafeTimeout,function(e){return function(t){var r=t.clientId,n=t.identifier,o=Object(a.useSelect)(xt,[]),s=Object(a.useSelect)((function(e){return o.reduce((function(t,o){if(!o.__experimentalGetPropsForEditableTreePreparation)return t;var a="format_prepare_props_(".concat(o.name,")_");return Et({},t,{},Object(c.mapKeys)(o.__experimentalGetPropsForEditableTreePreparation(e,{richTextIdentifier:n,blockClientId:r}),(function(e,t){return a+t})))}),{})}),[o,r,n]),u=Object(a.__unstableUseDispatchWithMap)((function(e){return o.reduce((function(t,o){if(!o.__experimentalGetPropsForEditableTreeChangeHandler)return t;var a="format_on_change_props_(".concat(o.name,")_");return Et({},t,{},Object(c.mapKeys)(o.__experimentalGetPropsForEditableTreeChangeHandler(e,{richTextIdentifier:n,blockClientId:r}),(function(e,t){return a+t})))}),{})}),[o,r,n]),l=Object(pt.useMemo)((function(){return o.reduce((function(e,t){if(!t.__experimentalCreatePrepareEditableTree)return e;var o,a={richTextIdentifier:n,blockClientId:r},c=Et({},s,{},u),l=t.name,f="format_prepare_props_(".concat(l,")_"),p="format_on_change_props_(".concat(l,")_"),d=Object.keys(c).reduce((function(e,t){return t.startsWith(f)&&(e[t.slice(f.length)]=c[t]),t.startsWith(p)&&(e[t.slice(p.length)]=c[t]),e}),{});return t.__experimentalCreateOnChangeEditableValue?Et({},e,(o={},Object(i.a)(o,"format_value_functions_(".concat(l,")"),t.__experimentalCreatePrepareEditableTree(d,a)),Object(i.a)(o,"format_on_change_functions_(".concat(l,")"),t.__experimentalCreateOnChangeEditableValue(d,a)),o)):Et({},e,Object(i.a)({},"format_prepare_functions_(".concat(l,")"),t.__experimentalCreatePrepareEditableTree(d,a)))}),{})}),[o,r,n,s,u]);return Object(pt.createElement)(e,Object(at.a)({},t,s,l,{formatTypes:o}))}}])(Wt),Ht=Object(pt.forwardRef)((function(e,t){return Object(pt.createElement)(Mt,Object(at.a)({},e,{forwardedRef:t}))}));r.d(t,"applyFormat",(function(){return x})),r.d(t,"concat",(function(){return K})),r.d(t,"create",(function(){return A})),r.d(t,"getActiveFormat",(function(){return B})),r.d(t,"getActiveObject",(function(){return U})),r.d(t,"getTextContent",(function(){return z})),r.d(t,"__unstableIsListRootSelected",(function(){return G})),r.d(t,"__unstableIsActiveListType",(function(){return Y})),r.d(t,"isCollapsed",(function(){return $})),r.d(t,"isEmpty",(function(){return X})),r.d(t,"__unstableIsEmptyLine",(function(){return Z})),r.d(t,"join",(function(){return J})),r.d(t,"registerFormatType",(function(){return ee})),r.d(t,"removeFormat",(function(){return ne})),r.d(t,"remove",(function(){return ie})),r.d(t,"replace",(function(){return ce})),r.d(t,"insert",(function(){return ae})),r.d(t,"__unstableInsertLineSeparator",(function(){return se})),r.d(t,"__unstableRemoveLineSeparator",(function(){return fe})),r.d(t,"insertObject",(function(){return pe})),r.d(t,"slice",(function(){return be})),r.d(t,"split",(function(){return me})),r.d(t,"__unstableToDom",(function(){return ke})),r.d(t,"toHTMLString",(function(){return Le})),r.d(t,"toggleFormat",(function(){return Ye})),r.d(t,"__UNSTABLE_LINE_SEPARATOR",(function(){return"\u2028"})),r.d(t,"unregisterFormatType",(function(){return $e})),r.d(t,"__unstableCanIndentListItems",(function(){return Xe})),r.d(t,"__unstableCanOutdentListItems",(function(){return Ze})),r.d(t,"__unstableIndentListItems",(function(){return Qe})),r.d(t,"__unstableOutdentListItems",(function(){return rt})),r.d(t,"__unstableChangeListType",(function(){return ot})),r.d(t,"__unstableCreateElement",(function(){return _})),r.d(t,"__experimentalRichText",(function(){return Ht})),r.d(t,"__unstableFormatEdit",(function(){return wt}))},5: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}))},51:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},68:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},7:function(e,t,r){"use strict";function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}r.d(t,"a",(function(){return n}))},8:function(e,t){!function(){e.exports=this.wp.compose}()}}); |