diff options
Diffstat (limited to '')
-rw-r--r-- | wp-includes/js/dist/rich-text.min.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/wp-includes/js/dist/rich-text.min.js b/wp-includes/js/dist/rich-text.min.js index 40c8e1c..cd96502 100644 --- a/wp-includes/js/dist/rich-text.min.js +++ b/wp-includes/js/dist/rich-text.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -!function(){"use strict";var e={n:function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{__experimentalRichText:function(){return Ke},__unstableCreateElement:function(){return E},__unstableFormatEdit:function(){return Ye},__unstableToDom:function(){return le},__unstableUseRichText:function(){return qe},applyFormat:function(){return b},concat:function(){return D},create:function(){return N},getActiveFormat:function(){return k},getActiveFormats:function(){return O},getActiveObject:function(){return M},getTextContent:function(){return $},insert:function(){return B},insertObject:function(){return X},isCollapsed:function(){return j},isEmpty:function(){return V},join:function(){return P},registerFormatType:function(){return W},remove:function(){return z},removeFormat:function(){return H},replace:function(){return U},slice:function(){return q},split:function(){return K},store:function(){return h},toHTMLString:function(){return pe},toggleFormat:function(){return Fe},unregisterFormatType:function(){return _e},useAnchor:function(){return Oe},useAnchorRef:function(){return Se}});var n={};e.r(n),e.d(n,{getFormatType:function(){return l},getFormatTypeForBareElement:function(){return f},getFormatTypeForClassName:function(){return d},getFormatTypes:function(){return u}});var r={};e.r(r),e.d(r,{addFormatTypes:function(){return m},removeFormatTypes:function(){return p}});var o=window.wp.data;var a=(0,o.combineReducers)({formatTypes:function(e={},t){switch(t.type){case"ADD_FORMAT_TYPES":return{...e,...t.formatTypes.reduce(((e,t)=>({...e,[t.name]:t})),{})};case"REMOVE_FORMAT_TYPES":return Object.fromEntries(Object.entries(e).filter((([e])=>!t.names.includes(e))))}return e}}),s={};function i(e){return[e]}function c(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}const u=function(e,t){var n,r=t||i;function o(){n=new WeakMap}function a(){var t,o,a,i,u,l=arguments.length;for(i=new Array(l),a=0;a<l;a++)i[a]=arguments[a];for(t=function(e){var t,r,o,a,i,c=n,u=!0;for(t=0;t<e.length;t++){if(!(i=r=e[t])||"object"!=typeof i){u=!1;break}c.has(r)?c=c.get(r):(o=new WeakMap,c.set(r,o),c=o)}return c.has(s)||((a=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=u,c.set(s,a)),c.get(s)}(u=r.apply(null,i)),t.isUniqueByDependants||(t.lastDependants&&!c(u,t.lastDependants,0)&&t.clear(),t.lastDependants=u),o=t.head;o;){if(c(o.args,i,1))return o!==t.head&&(o.prev.next=o.next,o.next&&(o.next.prev=o.prev),o.next=t.head,o.prev=null,t.head.prev=o,t.head=o),o.val;o=o.next}return o={val:e.apply(null,i)},i[0]=null,o.args=i,t.head&&(t.head.prev=o,o.next=t.head),t.head=o,o.val}return a.getDependants=r,a.clear=o,o(),a}((e=>Object.values(e.formatTypes)),(e=>[e.formatTypes]));function l(e,t){return e.formatTypes[t]}function f(e,t){const n=u(e);return n.find((({className:e,tagName:n})=>null===e&&t===n))||n.find((({className:e,tagName:t})=>null===e&&"*"===t))}function d(e,t){return u(e).find((({className:e})=>null!==e&&` ${t} `.indexOf(` ${e} `)>=0))}function m(e){return{type:"ADD_FORMAT_TYPES",formatTypes:Array.isArray(e)?e:[e]}}function p(e){return{type:"REMOVE_FORMAT_TYPES",names:Array.isArray(e)?e:[e]}}const h=(0,o.createReduxStore)("core/rich-text",{reducer:a,selectors:n,actions:r});function g(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.type!==t.type)return!1;const n=e.attributes,r=t.attributes;if(n===r)return!0;if(!n||!r)return!1;const o=Object.keys(n),a=Object.keys(r);if(o.length!==a.length)return!1;const s=o.length;for(let e=0;e<s;e++){const t=o[e];if(n[t]!==r[t])return!1}return!0}function v(e){const t=e.formats.slice();return t.forEach(((e,n)=>{const r=t[n-1];if(r){const o=e.slice();o.forEach(((e,t)=>{const n=r[t];g(e,n)&&(o[t]=n)})),t[n]=o}})),{...e,formats:t}}function y(e,t,n){return(e=e.slice())[t]=n,e}function b(e,t,n=e.start,r=e.end){const{formats:o,activeFormats:a}=e,s=o.slice();if(n===r){const e=s[n]?.find((({type:e})=>e===t.type));if(e){const o=s[n].indexOf(e);for(;s[n]&&s[n][o]===e;)s[n]=y(s[n],o,t),n--;for(r++;s[r]&&s[r][o]===e;)s[r]=y(s[r],o,t),r++}}else{let e=1/0;for(let o=n;o<r;o++)if(s[o]){s[o]=s[o].filter((({type:e})=>e!==t.type));const n=s[o].length;n<e&&(e=n)}else s[o]=[],e=0;for(let o=n;o<r;o++)s[o].splice(e,0,t)}return v({...e,formats:s,activeFormats:[...a?.filter((({type:e})=>e!==t.type))||[],t]})}function E({implementation:e},t){return E.body||(E.body=e.createHTMLDocument("").body),E.body.innerHTML=t,E.body}(0,o.register)(h);const x="",T="\ufeff";function w({tagName:e,attributes:t}){let n;if(t&&t.class&&(n=(0,o.select)(h).getFormatTypeForClassName(t.class),n&&(t.class=` ${t.class} `.replace(` ${n.className} `," ").trim(),t.class||delete t.class)),n||(n=(0,o.select)(h).getFormatTypeForBareElement(e)),!n)return t?{type:e,attributes:t}:{type:e};if(n.__experimentalCreatePrepareEditableTree&&!n.__experimentalCreateOnChangeEditableValue)return null;if(!t)return{formatType:n,type:n.name,tagName:e};const r={},a={},s={...t};for(const e in n.attributes){const t=n.attributes[e];r[e]=s[t],n.__unstableFilterAttributeValue&&(r[e]=n.__unstableFilterAttributeValue(e,r[e])),delete s[t],void 0===r[e]&&delete r[e]}for(const e in s)a[e]=t[e];return!1===n.contentEditable&&delete a.contenteditable,{formatType:n,type:n.name,tagName:e,attributes:r,unregisteredAttributes:a}}function N({element:e,text:t,html:n,range:r,__unstableIsEditableTree:o,preserveWhiteSpace:a}={}){return"string"==typeof t&&t.length>0?{formats:Array(t.length),replacements:Array(t.length),text:t}:("string"==typeof n&&n.length>0&&(e=E(document,n)),"object"!=typeof e?{formats:[],replacements:[],text:""}:A({element:e,range:r,isEditableTree:o,preserveWhiteSpace:a}))}function C(e,t,n,r){if(!n)return;const{parentNode:o}=t,{startContainer:a,startOffset:s,endContainer:i,endOffset:c}=n,u=e.text.length;void 0!==r.start?e.start=u+r.start:t===a&&t.nodeType===t.TEXT_NODE?e.start=u+s:o===a&&t===a.childNodes[s]?e.start=u:o===a&&t===a.childNodes[s-1]?e.start=u+r.text.length:t===a&&(e.start=u),void 0!==r.end?e.end=u+r.end:t===i&&t.nodeType===t.TEXT_NODE?e.end=u+c:o===i&&t===i.childNodes[c-1]?e.end=u+r.text.length:o===i&&t===i.childNodes[c]?e.end=u:t===i&&(e.end=u+c)}function F(e,t,n){if(!t)return;const{startContainer:r,endContainer:o}=t;let{startOffset:a,endOffset:s}=t;return e===r&&(a=n(e.nodeValue.slice(0,a)).length),e===o&&(s=n(e.nodeValue.slice(0,s)).length),{startContainer:r,startOffset:a,endContainer:o,endOffset:s}}function _(e){return e.replace(/[\n\r\t]+/g," ")}function L(e){return e.replace(new RegExp(`[${T}${x}]`,"gu"),"")}function A({element:e,range:t,isEditableTree:n,preserveWhiteSpace:r}){const o={formats:[],replacements:[],text:""};if(!e)return o;if(!e.hasChildNodes())return C(o,e,t,{formats:[],replacements:[],text:""}),o;const a=e.childNodes.length;for(let s=0;s<a;s++){const i=e.childNodes[s],c=i.nodeName.toLowerCase();if(i.nodeType===i.TEXT_NODE){let f=L;r||(f=e=>L(_(e)));const d=f(i.nodeValue);C(o,i,t=F(i,t,f),{text:d}),o.formats.length+=d.length,o.replacements.length+=d.length,o.text+=d;continue}if(i.nodeType!==i.ELEMENT_NODE)continue;if(n&&(i.getAttribute("data-rich-text-placeholder")||"br"===c&&!i.getAttribute("data-rich-text-line-break"))){C(o,i,t,{formats:[],replacements:[],text:""});continue}if("script"===c){const m={formats:[,],replacements:[{type:c,attributes:{"data-rich-text-script":i.getAttribute("data-rich-text-script")||encodeURIComponent(i.innerHTML)}}],text:x};C(o,i,t,m),S(o,m);continue}if("br"===c){C(o,i,t,{formats:[],replacements:[],text:""}),S(o,N({text:"\n"}));continue}const u=w({tagName:c,attributes:R({element:i})});if(!1===u?.formatType?.contentEditable){delete u.formatType,C(o,i,t,{formats:[],replacements:[],text:""}),S(o,{formats:[,],replacements:[{...u,innerHTML:i.innerHTML}],text:x});continue}u&&delete u.formatType;const l=A({element:i,range:t,isEditableTree:n,preserveWhiteSpace:r});if(C(o,i,t,l),u)if(0===l.text.length)u.attributes&&S(o,{formats:[,],replacements:[u],text:x});else{function p(e){if(p.formats===e)return p.newFormats;const t=e?[u,...e]:[u];return p.formats=e,p.newFormats=t,t}p.newFormats=[u],S(o,{...l,formats:Array.from(l.formats,p)})}else S(o,l)}return o}function R({element:e}){if(!e.hasAttributes())return;const t=e.attributes.length;let n;for(let r=0;r<t;r++){const{name:t,value:o}=e.attributes[r];if(0===t.indexOf("data-rich-text-"))continue;n=n||{},n[/^on/i.test(t)?"data-disable-rich-text-"+t:t]=o}return n}function S(e,t){return e.formats=e.formats.concat(t.formats),e.replacements=e.replacements.concat(t.replacements),e.text+=t.text,e}function D(...e){return v(e.reduce(S,N()))}function O(e,t=[]){const{formats:n,start:r,end:o,activeFormats:a}=e;if(void 0===r)return t;if(r===o){if(a)return a;const e=n[r-1]||t,o=n[r]||t;return e.length<o.length?e:o}if(!n[r])return t;const s=n.slice(r,o),i=[...s[0]];let c=s.length;for(;c--;){const e=s[c];if(!e)return t;let n=i.length;for(;n--;){const t=i[n];e.find((e=>g(t,e)))||i.splice(n,1)}if(0===i.length)return t}return i||t}function k(e,t){return O(e).find((({type:e})=>e===t))}function M({start:e,end:t,replacements:n,text:r}){if(e+1===t&&r[e]===x)return n[e]}function $({text:e}){return e.replace(x,"")}function j({start:e,end:t}){if(void 0!==e&&void 0!==t)return e===t}function V({text:e}){return 0===e.length}function P(e,t=""){return"string"==typeof t&&(t=N({text:t})),v(e.reduce(((e,{formats:n,replacements:r,text:o})=>({formats:e.formats.concat(t.formats,n),replacements:e.replacements.concat(t.replacements,r),text:e.text+t.text+o}))))}function W(e,t){if("string"==typeof(t={name:e,...t}).name)if(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(t.name))if((0,o.select)(h).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){const e=(0,o.select)(h).getFormatTypeForBareElement(t.tagName);if(e&&"core/unknown"!==e.name)return void window.console.error(`Format "${e.name}" is already registered to handle bare tag name "${t.tagName}".`)}else{const e=(0,o.select)(h).getFormatTypeForClassName(t.className);if(e)return void window.console.error(`Format "${e.name}" is already registered to handle class name "${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(0,o.dispatch)(h).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 H(e,t,n=e.start,r=e.end){const{formats:o,activeFormats:a}=e,s=o.slice();if(n===r){const e=s[n]?.find((({type:e})=>e===t));if(e){for(;s[n]?.find((t=>t===e));)I(s,n,t),n--;for(r++;s[r]?.find((t=>t===e));)I(s,r,t),r++}}else for(let e=n;e<r;e++)s[e]&&I(s,e,t);return v({...e,formats:s,activeFormats:a?.filter((({type:e})=>e!==t))||[]})}function I(e,t,n){const r=e[t].filter((({type:e})=>e!==n));r.length?e[t]=r:delete e[t]}function B(e,t,n=e.start,r=e.end){const{formats:o,replacements:a,text:s}=e;"string"==typeof t&&(t=N({text:t}));const i=n+t.text.length;return v({formats:o.slice(0,n).concat(t.formats,o.slice(r)),replacements:a.slice(0,n).concat(t.replacements,a.slice(r)),text:s.slice(0,n)+t.text+s.slice(r),start:i,end:i})}function z(e,t,n){return B(e,N(),t,n)}function U({formats:e,replacements:t,text:n,start:r,end:o},a,s){return n=n.replace(a,((n,...a)=>{const i=a[a.length-2];let c,u,l=s;return"function"==typeof l&&(l=s(n,...a)),"object"==typeof l?(c=l.formats,u=l.replacements,l=l.text):(c=Array(l.length),u=Array(l.length),e[i]&&(c=c.fill(e[i]))),e=e.slice(0,i).concat(c,e.slice(i+n.length)),t=t.slice(0,i).concat(u,t.slice(i+n.length)),r&&(r=o=i+l.length),l})),v({formats:e,replacements:t,text:n,start:r,end:o})}function X(e,t,n,r){return B(e,{formats:[,],replacements:[t],text:x},n,r)}function q(e,t=e.start,n=e.end){const{formats:r,replacements:o,text:a}=e;return void 0===t||void 0===n?{...e}:{formats:r.slice(t,n),replacements:o.slice(t,n),text:a.slice(t,n)}}function K({formats:e,replacements:t,text:n,start:r,end:o},a){if("string"!=typeof a)return function({formats:e,replacements:t,text:n,start:r,end:o},a=r,s=o){if(void 0===r||void 0===o)return;const i={formats:e.slice(0,a),replacements:t.slice(0,a),text:n.slice(0,a)},c={formats:e.slice(s),replacements:t.slice(s),text:n.slice(s),start:0,end:0};return[i,c]}(...arguments);let s=0;return n.split(a).map((n=>{const i=s,c={formats:e.slice(i,i+n.length),replacements:t.slice(i,i+n.length),text:n};return s+=a.length+n.length,void 0!==r&&void 0!==o&&(r>=i&&r<s?c.start=r-i:r<i&&o>i&&(c.start=0),o>=i&&o<s?c.end=o-i:r<s&&o>s&&(c.end=n.length)),c}))}function Y(e){return(0,o.select)(h).getFormatType(e)}function G(e,t){if(t)return e;const n={};for(const t in e){let r=t;t.startsWith("data-disable-rich-text-")&&(r=t.slice(23)),n[r]=e[t]}return n}function Z({type:e,tagName:t,attributes:n,unregisteredAttributes:r,object:o,boundaryClass:a,isEditableTree:s}){const i=Y(e);let c={};if(a&&s&&(c["data-rich-text-format-boundary"]="true"),!i)return n&&(c={...n,...c}),{type:e,attributes:G(c,s),object:o};c={...r,...c};for(const e in n){const t=!!i.attributes&&i.attributes[e];t?c[t]=n[e]:c[e]=n[e]}return i.className&&(c.class?c.class=`${i.className} ${c.class}`:c.class=i.className),s&&!1===i.contentEditable&&(c.contenteditable="false"),{type:t||i.tagName,object:i.object,attributes:G(c,s)}}function J(e,t,n){do{if(e[n]!==t[n])return!1}while(n--);return!0}function Q({value:e,preserveWhiteSpace:t,createEmpty:n,append:r,getLastChild:o,getParent:a,isText:s,getText:i,remove:c,appendText:u,onStartIndex:l,onEndIndex:f,isEditableTree:d,placeholder:m}){const{formats:p,replacements:h,text:g,start:v,end:y}=e,b=p.length+1,E=n(),w=O(e),N=w[w.length-1];let C,F;r(E,"");for(let e=0;e<b;e++){const n=g.charAt(e),b=d&&(!F||"\n"===F),w=p[e];let _=o(E);if(w&&w.forEach(((e,t)=>{if(_&&C&&J(w,C,t))return void(_=o(_));const{type:n,tagName:u,attributes:l,unregisteredAttributes:f}=e,m=d&&e===N,p=a(_),h=r(p,Z({type:n,tagName:u,attributes:l,unregisteredAttributes:f,boundaryClass:m,isEditableTree:d}));s(_)&&0===i(_).length&&c(_),_=r(h,"")})),0===e&&(l&&0===v&&l(E,_),f&&0===y&&f(E,_)),n===x){const t=h[e];if(!t)continue;const{type:n,attributes:o,innerHTML:s}=t,i=Y(n);d||"script"!==n?!1===i?.contentEditable?(_=r(a(_),Z({...t,isEditableTree:d,boundaryClass:v===e&&y===e+1})),s&&r(_,{html:s})):_=r(a(_),Z({...t,object:!0,isEditableTree:d})):(_=r(a(_),Z({type:"script",isEditableTree:d})),r(_,{html:decodeURIComponent(o["data-rich-text-script"])})),_=r(a(_),"")}else t||"\n"!==n?s(_)?u(_,n):_=r(a(_),n):(_=r(a(_),{type:"br",attributes:d?{"data-rich-text-line-break":"true"}:void 0,object:!0}),_=r(a(_),""));l&&v===e+1&&l(E,_),f&&y===e+1&&f(E,_),b&&e===g.length&&(r(a(_),T),m&&0===g.length&&r(a(_),{type:"span",attributes:{"data-rich-text-placeholder":m,style:"pointer-events:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;"}})),C=w,F=n}return E}function ee(e,t){return e===t||e&&t&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}function te(e,t,n){const r=e.parentNode;let o=0;for(;e=e.previousSibling;)o++;return n=[o,...n],r!==t&&(n=te(r,t,n)),n}function ne(e,t){for(t=[...t];e&&t.length>1;)e=e.childNodes[t.shift()];return{node:e,offset:t[0]}}function re(e,t){if(void 0!==t.html)return e.innerHTML+=t.html;"string"==typeof t&&(t=e.ownerDocument.createTextNode(t));const{type:n,attributes:r}=t;if(n){t=e.ownerDocument.createElement(n);for(const e in r)t.setAttribute(e,r[e])}return e.appendChild(t)}function oe(e,t){e.appendData(t)}function ae({lastChild:e}){return e}function se({parentNode:e}){return e}function ie(e){return e.nodeType===e.TEXT_NODE}function ce({nodeValue:e}){return e}function ue(e){return e.parentNode.removeChild(e)}function le({value:e,prepareEditableTree:t,isEditableTree:n=!0,placeholder:r,doc:o=document}){let a=[],s=[];t&&(e={...e,formats:t(e)});return{body:Q({value:e,createEmpty:()=>E(o,""),append:re,getLastChild:ae,getParent:se,isText:ie,getText:ce,remove:ue,appendText:oe,onStartIndex(e,t){a=te(t,e,[t.nodeValue.length])},onEndIndex(e,t){s=te(t,e,[t.nodeValue.length])},isEditableTree:n,placeholder:r}),selection:{startPath:a,endPath:s}}}function fe({value:e,current:t,prepareEditableTree:n,__unstableDomOnly:r,placeholder:o}){const{body:a,selection:s}=le({value:e,prepareEditableTree:n,placeholder:o,doc:t.ownerDocument});de(a,t),void 0===e.start||r||function({startPath:e,endPath:t},n){const{node:r,offset:o}=ne(n,e),{node:a,offset:s}=ne(n,t),{ownerDocument:i}=n,{defaultView:c}=i,u=c.getSelection(),l=i.createRange();l.setStart(r,o),l.setEnd(a,s);const{activeElement:f}=i;if(u.rangeCount>0){if(ee(l,u.getRangeAt(0)))return;u.removeAllRanges()}u.addRange(l),f!==i.activeElement&&f instanceof c.HTMLElement&&f.focus()}(s,t)}function de(e,t){let n,r=0;for(;n=e.firstChild;){const o=t.childNodes[r];if(o)if(o.isEqualNode(n))e.removeChild(n);else if(o.nodeName!==n.nodeName||o.nodeType===o.TEXT_NODE&&o.data!==n.data)t.replaceChild(n,o);else{const t=o.attributes,r=n.attributes;if(t){let e=t.length;for(;e--;){const{name:r}=t[e];n.getAttribute(r)||o.removeAttribute(r)}}if(r)for(let e=0;e<r.length;e++){const{name:t,value:n}=r[e];o.getAttribute(t)!==n&&o.setAttribute(t,n)}de(n,o),e.removeChild(n)}else t.appendChild(n);r++}for(;t.childNodes[r];)t.removeChild(t.childNodes[r])}var me=window.wp.escapeHtml;function pe({value:e,preserveWhiteSpace:t}){return we(Q({value:e,preserveWhiteSpace:t,createEmpty:he,append:ve,getLastChild:ge,getParent:be,isText:Ee,getText:xe,remove:Te,appendText:ye}).children)}function he(){return{}}function ge({children:e}){return e&&e[e.length-1]}function ve(e,t){return"string"==typeof t&&(t={text:t}),t.parent=e,e.children=e.children||[],e.children.push(t),t}function ye(e,t){e.text+=t}function be({parent:e}){return e}function Ee({text:e}){return"string"==typeof e}function xe({text:e}){return e}function Te(e){const t=e.parent.children.indexOf(e);return-1!==t&&e.parent.children.splice(t,1),e}function we(e=[]){return e.map((e=>void 0!==e.html?e.html:void 0===e.text?function({type:e,attributes:t,object:n,children:r}){let o="";for(const e in t)(0,me.isValidAttributeName)(e)&&(o+=` ${e}="${(0,me.escapeAttribute)(t[e])}"`);return n?`<${e}${o}>`:`<${e}${o}>${we(r)}</${e}>`}(e):(0,me.escapeEditableHTML)(e.text))).join("")}var Ne=window.wp.a11y,Ce=window.wp.i18n;function Fe(e,t){return k(e,t.type)?(t.title&&(0,Ne.speak)((0,Ce.sprintf)((0,Ce.__)("%s removed."),t.title),"assertive"),H(e,t.type)):(t.title&&(0,Ne.speak)((0,Ce.sprintf)((0,Ce.__)("%s applied."),t.title),"assertive"),b(e,t))}function _e(e){const t=(0,o.select)(h).getFormatType(e);if(t)return(0,o.dispatch)(h).removeFormatTypes(e),t;window.console.error(`Format ${e} is not registered.`)}var Le=window.wp.element,Ae=window.wp.deprecated,Re=e.n(Ae);function Se({ref:e,value:t,settings:n={}}){Re()("`useAnchorRef` hook",{since:"6.1",alternative:"`useAnchor` hook"});const{tagName:r,className:o,name:a}=n,s=a?k(t,a):void 0;return(0,Le.useMemo)((()=>{if(!e.current)return;const{ownerDocument:{defaultView:t}}=e.current,n=t.getSelection();if(!n.rangeCount)return;const a=n.getRangeAt(0);if(!s)return a;let i=a.startContainer;for(i=i.nextElementSibling||i;i.nodeType!==i.ELEMENT_NODE;)i=i.parentNode;return i.closest(r+(o?"."+o:""))}),[s,t.start,t.end,r,o])}function De(e,t,n){if(!e)return;const{ownerDocument:r}=e,{defaultView:o}=r,a=o.getSelection();if(!a)return;if(!a.rangeCount)return;const s=a.getRangeAt(0);if(!s||!s.startContainer)return;const i=function(e,t,n,r){let o=e.startContainer;if(o.nodeType===o.TEXT_NODE&&e.startOffset===o.length&&o.nextSibling)for(o=o.nextSibling;o.firstChild;)o=o.firstChild;if(o.nodeType!==o.ELEMENT_NODE&&(o=o.parentElement),!o)return;if(o===t)return;if(!t.contains(o))return;const a=n+(r?"."+r:"");for(;o!==t;){if(o.matches(a))return o;o=o.parentElement}}(s,e,t,n);return i||function(e,t){return{contextElement:t,getBoundingClientRect(){return t.contains(e.startContainer)?e.getBoundingClientRect():t.getBoundingClientRect()}}}(s,e)}function Oe({editableContentElement:e,settings:t={}}){const{tagName:n,className:r}=t,[o,a]=(0,Le.useState)((()=>De(e,n,r)));return(0,Le.useLayoutEffect)((()=>{if(!e)return;const{ownerDocument:t}=e;function o(){a(De(e,n,r))}function s(){t.addEventListener("selectionchange",o)}function i(){t.removeEventListener("selectionchange",o)}return e===t.activeElement&&s(),e.addEventListener("focusin",s),e.addEventListener("focusout",i),i}),[e,n,r]),o}var ke=window.wp.compose;const Me="pre-wrap",$e="1px";function je({record:e}){const t=(0,Le.useRef)(),{activeFormats:n=[],replacements:r,start:o}=e.current,a=r[o];return(0,Le.useEffect)((()=>{if(!(n&&n.length||a))return;const e="*[data-rich-text-format-boundary]",r=t.current.querySelector(e);if(!r)return;const{ownerDocument:o}=r,{defaultView:s}=o,i=`${`.rich-text:focus ${e}`} {${`background-color: ${s.getComputedStyle(r).color.replace(")",", 0.2)").replace("rgb","rgba")}`}}`,c="rich-text-boundary-style";let u=o.getElementById(c);u||(u=o.createElement("style"),u.id=c,o.head.appendChild(u)),u.innerHTML!==i&&(u.innerHTML=i)}),[n,a]),t}function Ve(e){const t=(0,Le.useRef)(e);return t.current=e,(0,ke.useRefEffect)((e=>{function n(n){const{record:r,preserveWhiteSpace:o}=t.current,{ownerDocument:a}=e;if(j(r.current)||!e.contains(a.activeElement))return;const s=q(r.current),i=$(s),c=pe({value:s,preserveWhiteSpace:o});n.clipboardData.setData("text/plain",i),n.clipboardData.setData("text/html",c),n.clipboardData.setData("rich-text","true"),n.preventDefault(),"cut"===n.type&&a.execCommand("delete")}return e.addEventListener("copy",n),e.addEventListener("cut",n),()=>{e.removeEventListener("copy",n),e.removeEventListener("cut",n)}}),[])}var Pe=window.wp.keycodes;const We=[];function He(e){const[,t]=(0,Le.useReducer)((()=>({}))),n=(0,Le.useRef)(e);return n.current=e,(0,ke.useRefEffect)((e=>{function r(r){const{keyCode:o,shiftKey:a,altKey:s,metaKey:i,ctrlKey:c}=r;if(a||s||i||c||o!==Pe.LEFT&&o!==Pe.RIGHT)return;const{record:u,applyRecord:l}=n.current,{text:f,formats:d,start:m,end:p,activeFormats:h=[]}=u.current,g=j(u.current),{ownerDocument:v}=e,{defaultView:y}=v,{direction:b}=y.getComputedStyle(e),E="rtl"===b?Pe.RIGHT:Pe.LEFT,x=r.keyCode===E;if(g&&0===h.length){if(0===m&&x)return;if(p===f.length&&!x)return}if(!g)return;const T=d[m-1]||We,w=d[m]||We,N=x?T:w,C=h.every(((e,t)=>e===N[t]));let F=h.length;if(C?F<N.length&&F++:F--,F===h.length)return void(u.current._newActiveFormats=N);r.preventDefault();const _=(C?N:x?w:T).slice(0,F),L={...u.current,activeFormats:_};u.current=L,l(L),t()}return e.addEventListener("keydown",r),()=>{e.removeEventListener("keydown",r)}}),[])}const Ie=new Set(["insertParagraph","insertOrderedList","insertUnorderedList","insertHorizontalRule","insertLink"]),Be=[],ze="data-rich-text-placeholder";function Ue(e){const t=(0,Le.useRef)(e);return t.current=e,(0,ke.useRefEffect)((e=>{const{ownerDocument:n}=e,{defaultView:r}=n;let o=!1;function a(e){if(o)return;let n;e&&(n=e.inputType);const{record:r,applyRecord:a,createRecord:s,handleChange:i}=t.current;if(n&&(0===n.indexOf("format")||Ie.has(n)))return void a(r.current);const c=s(),{start:u,activeFormats:l=[]}=r.current,f=function({value:e,start:t,end:n,formats:r}){const o=Math.min(t,n),a=Math.max(t,n),s=e.formats[o-1]||[],i=e.formats[a]||[];for(e.activeFormats=r.map(((e,t)=>{if(s[t]){if(g(e,s[t]))return s[t]}else if(i[t]&&g(e,i[t]))return i[t];return e}));--n>=t;)e.activeFormats.length>0?e.formats[n]=e.activeFormats:delete e.formats[n];return e}({value:c,start:u,end:c.start,formats:l});i(f)}function s(){const{record:s,applyRecord:i,createRecord:c,onSelectionChange:u}=t.current;if("true"!==e.contentEditable)return;if(n.activeElement!==e){if("true"!==n.activeElement.contentEditable)return;if(!n.activeElement.contains(e))return;const t=r.getSelection(),{anchorNode:o,focusNode:a}=t;if(e.contains(o)&&e!==o&&e.contains(a)&&e!==a){const{start:e,end:t}=c();s.current.activeFormats=Be,u(e,t)}else if(e.contains(o)&&e!==o){const{start:e,end:t=e}=c();s.current.activeFormats=Be,u(t)}else if(e.contains(a)){const{start:e,end:t=e}=c();s.current.activeFormats=Be,u(void 0,t)}return}if(o)return;const{start:l,end:f,text:d}=c(),m=s.current;if(d!==m.text)return void a();if(l===m.start&&f===m.end)return void(0===m.text.length&&0===l&&function(e){const t=e.getSelection(),{anchorNode:n,anchorOffset:r}=t;if(n.nodeType!==n.ELEMENT_NODE)return;const o=n.childNodes[r];o&&o.nodeType===o.ELEMENT_NODE&&o.hasAttribute(ze)&&t.collapseToStart()}(r));const p={...m,start:l,end:f,activeFormats:m._newActiveFormats,_newActiveFormats:void 0},h=O(p,Be);p.activeFormats=h,s.current=p,i(p,{domOnly:!0}),u(l,f)}function i(){o=!0,n.removeEventListener("selectionchange",s),e.querySelector(`[${ze}]`)?.remove()}function c(){o=!1,a({inputType:"insertText"}),n.addEventListener("selectionchange",s)}function u(){const{record:n,isSelected:r,onSelectionChange:o,applyRecord:a}=t.current;if(!e.parentElement.closest('[contenteditable="true"]'))if(r)a(n.current),o(n.current.start,n.current.end);else{const e=void 0;n.current={...n.current,start:e,end:e,activeFormats:Be}}}return e.addEventListener("input",a),e.addEventListener("compositionstart",i),e.addEventListener("compositionend",c),e.addEventListener("focus",u),n.addEventListener("selectionchange",s),()=>{e.removeEventListener("input",a),e.removeEventListener("compositionstart",i),e.removeEventListener("compositionend",c),e.removeEventListener("focus",u),n.removeEventListener("selectionchange",s)}}),[])}function Xe(e){const t=(0,Le.useRef)(e);return t.current=e,(0,ke.useRefEffect)((e=>{function n(e){const{keyCode:n}=e,{createRecord:r,handleChange:o}=t.current;if(e.defaultPrevented)return;if(n!==Pe.DELETE&&n!==Pe.BACKSPACE)return;const a=r(),{start:s,end:i,text:c}=a;0===s&&0!==i&&i===c.length&&(o(z(a)),e.preventDefault())}return e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}}),[])}function qe({value:e="",selectionStart:t,selectionEnd:n,placeholder:r,preserveWhiteSpace:a,onSelectionChange:s,onChange:i,__unstableDisableFormats:c,__unstableIsSelected:u,__unstableDependencies:l=[],__unstableAfterParse:f,__unstableBeforeSerialize:d,__unstableAddInvisibleFormats:m}){const p=(0,o.useRegistry)(),[,h]=(0,Le.useReducer)((()=>({}))),g=(0,Le.useRef)();function v(){const{ownerDocument:{defaultView:e}}=g.current,t=e.getSelection(),n=t.rangeCount>0?t.getRangeAt(0):null;return N({element:g.current,range:n,__unstableIsEditableTree:!0,preserveWhiteSpace:a})}function y(e,{domOnly:t}={}){fe({value:e,current:g.current,prepareEditableTree:m,__unstableDomOnly:t,placeholder:r})}const b=(0,Le.useRef)(e),E=(0,Le.useRef)();function x(){b.current=e,E.current=N({html:e,preserveWhiteSpace:a}),c&&(E.current.formats=Array(e.length),E.current.replacements=Array(e.length)),f&&(E.current.formats=f(E.current)),E.current.start=t,E.current.end=n}const T=(0,Le.useRef)(!1);if(E.current)t===E.current.start&&n===E.current.end||(T.current=u,E.current={...E.current,start:t,end:n,activeFormats:void 0});else{T.current=u,x();"core/text-color"===E.current?.formats[0]?.[0]?.type&&function(e){E.current=e,b.current=pe({value:d?{...e,formats:d(e)}:e,preserveWhiteSpace:a});const{formats:t,text:n}=e;p.batch((()=>{i(b.current,{__unstableFormats:t,__unstableText:n})})),h()}(E.current)}function w(e){E.current=e,y(e),b.current=c?e.text:pe({value:d?{...e,formats:d(e)}:e,preserveWhiteSpace:a});const{start:t,end:n,formats:r,text:o}=e;p.batch((()=>{s(t,n),i(b.current,{__unstableFormats:r,__unstableText:o})})),h()}function C(){x(),y(E.current)}const F=(0,Le.useRef)(!1);(0,Le.useLayoutEffect)((()=>{F.current&&e!==b.current&&(C(),h())}),[e]),(0,Le.useLayoutEffect)((()=>{T.current&&(g.current.ownerDocument.activeElement!==g.current&&g.current.focus(),y(E.current),T.current=!1)}),[T.current]);const _=(0,ke.useMergeRefs)([g,(0,Le.useCallback)((e=>{e&&(e.style.whiteSpace=Me,e.style.minWidth=$e)}),[]),je({record:E}),Ve({record:E,preserveWhiteSpace:a}),(0,ke.useRefEffect)((e=>{function t(t){const{target:n}=t;if(n===e||n.textContent&&n.isContentEditable)return;const{ownerDocument:r}=n,{defaultView:o}=r,a=o.getSelection();if(a.containsNode(n))return;const s=r.createRange(),i=n.isContentEditable?n:n.closest("[contenteditable]");s.selectNode(i),a.removeAllRanges(),a.addRange(s),t.preventDefault()}function n(n){n.relatedTarget&&!e.contains(n.relatedTarget)&&"A"===n.relatedTarget.tagName&&t(n)}return e.addEventListener("click",t),e.addEventListener("focusin",n),()=>{e.removeEventListener("click",t),e.removeEventListener("focusin",n)}}),[]),He({record:E,applyRecord:y}),Xe({createRecord:v,handleChange:w}),Ue({record:E,applyRecord:y,createRecord:v,handleChange:w,isSelected:u,onSelectionChange:s}),(0,ke.useRefEffect)((e=>{const{ownerDocument:t}=e,{defaultView:n}=t,r=n?.getSelection();let o;function a(){return r.rangeCount?r.getRangeAt(0):null}function s(e){const n="keydown"===e.type?"keyup":"pointerup";function r(){t.removeEventListener(n,s),t.removeEventListener("selectionchange",r),t.removeEventListener("input",r)}function s(){r(),ee(o,a())||t.dispatchEvent(new Event("selectionchange"))}t.addEventListener(n,s),t.addEventListener("selectionchange",r),t.addEventListener("input",r),o=a()}return e.addEventListener("pointerdown",s),e.addEventListener("keydown",s),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("keydown",s)}}),[]),(0,ke.useRefEffect)((()=>{C(),F.current=!0}),[r,...l])]);return{value:E.current,getValue:()=>E.current,onChange:w,ref:_}}function Ke(){}function Ye({formatTypes:e,onChange:t,onFocus:n,value:r,forwardedRef:o}){return e.map((e=>{const{name:a,edit:s}=e;if(!s)return null;const i=k(r,a),c=void 0!==i,u=M(r),l=void 0!==u&&u.type===a;return(0,Le.createElement)(s,{key:a,isActive:c,activeAttributes:c&&i.attributes||{},isObjectActive:l,activeObjectAttributes:l&&u.attributes||{},value:r,onChange:t,onFocus:n,contentRef:o})}))}(window.wp=window.wp||{}).richText=t}();
\ No newline at end of file +(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{RichTextData:()=>I,__experimentalRichText:()=>Ge,__unstableCreateElement:()=>b,__unstableToDom:()=>we,__unstableUseRichText:()=>Ye,applyFormat:()=>E,concat:()=>J,create:()=>B,getActiveFormat:()=>Q,getActiveFormats:()=>N,getActiveObject:()=>ee,getTextContent:()=>V,insert:()=>ie,insertObject:()=>ue,isCollapsed:()=>te,isEmpty:()=>ne,join:()=>re,registerFormatType:()=>oe,remove:()=>ce,removeFormat:()=>ae,replace:()=>le,slice:()=>fe,split:()=>de,store:()=>g,toHTMLString:()=>O,toggleFormat:()=>Fe,unregisterFormatType:()=>Re,useAnchor:()=>$e,useAnchorRef:()=>De});var n={};e.r(n),e.d(n,{getFormatType:()=>u,getFormatTypeForBareElement:()=>f,getFormatTypeForClassName:()=>d,getFormatTypes:()=>l});var r={};e.r(r),e.d(r,{addFormatTypes:()=>m,removeFormatTypes:()=>p});const o=window.wp.data;const a=(0,o.combineReducers)({formatTypes:function(e={},t){switch(t.type){case"ADD_FORMAT_TYPES":return{...e,...t.formatTypes.reduce(((e,t)=>({...e,[t.name]:t})),{})};case"REMOVE_FORMAT_TYPES":return Object.fromEntries(Object.entries(e).filter((([e])=>!t.names.includes(e))))}return e}});var s={};function i(e){return[e]}function c(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}const l=function(e,t){var n,r=t||i;function o(){n=new WeakMap}function a(){var t,o,a,i,l,u=arguments.length;for(i=new Array(u),a=0;a<u;a++)i[a]=arguments[a];for(t=function(e){var t,r,o,a,i,c=n,l=!0;for(t=0;t<e.length;t++){if(!(i=r=e[t])||"object"!=typeof i){l=!1;break}c.has(r)?c=c.get(r):(o=new WeakMap,c.set(r,o),c=o)}return c.has(s)||((a=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=l,c.set(s,a)),c.get(s)}(l=r.apply(null,i)),t.isUniqueByDependants||(t.lastDependants&&!c(l,t.lastDependants,0)&&t.clear(),t.lastDependants=l),o=t.head;o;){if(c(o.args,i,1))return o!==t.head&&(o.prev.next=o.next,o.next&&(o.next.prev=o.prev),o.next=t.head,o.prev=null,t.head.prev=o,t.head=o),o.val;o=o.next}return o={val:e.apply(null,i)},i[0]=null,o.args=i,t.head&&(t.head.prev=o,o.next=t.head),t.head=o,o.val}return a.getDependants=r,a.clear=o,o(),a}((e=>Object.values(e.formatTypes)),(e=>[e.formatTypes]));function u(e,t){return e.formatTypes[t]}function f(e,t){const n=l(e);return n.find((({className:e,tagName:n})=>null===e&&t===n))||n.find((({className:e,tagName:t})=>null===e&&"*"===t))}function d(e,t){return l(e).find((({className:e})=>null!==e&&` ${t} `.indexOf(` ${e} `)>=0))}function m(e){return{type:"ADD_FORMAT_TYPES",formatTypes:Array.isArray(e)?e:[e]}}function p(e){return{type:"REMOVE_FORMAT_TYPES",names:Array.isArray(e)?e:[e]}}const g=(0,o.createReduxStore)("core/rich-text",{reducer:a,selectors:n,actions:r});function h(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.type!==t.type)return!1;const n=e.attributes,r=t.attributes;if(n===r)return!0;if(!n||!r)return!1;const o=Object.keys(n),a=Object.keys(r);if(o.length!==a.length)return!1;const s=o.length;for(let e=0;e<s;e++){const t=o[e];if(n[t]!==r[t])return!1}return!0}function v(e){const t=e.formats.slice();return t.forEach(((e,n)=>{const r=t[n-1];if(r){const o=e.slice();o.forEach(((e,t)=>{const n=r[t];h(e,n)&&(o[t]=n)})),t[n]=o}})),{...e,formats:t}}function y(e,t,n){return(e=e.slice())[t]=n,e}function E(e,t,n=e.start,r=e.end){const{formats:o,activeFormats:a}=e,s=o.slice();if(n===r){const e=s[n]?.find((({type:e})=>e===t.type));if(e){const o=s[n].indexOf(e);for(;s[n]&&s[n][o]===e;)s[n]=y(s[n],o,t),n--;for(r++;s[r]&&s[r][o]===e;)s[r]=y(s[r],o,t),r++}}else{let e=1/0;for(let o=n;o<r;o++)if(s[o]){s[o]=s[o].filter((({type:e})=>e!==t.type));const n=s[o].length;n<e&&(e=n)}else s[o]=[],e=0;for(let o=n;o<r;o++)s[o].splice(e,0,t)}return v({...e,formats:s,activeFormats:[...a?.filter((({type:e})=>e!==t.type))||[],t]})}function b({implementation:e},t){return b.body||(b.body=e.createHTMLDocument("").body),b.body.innerHTML=t,b.body}(0,o.register)(g);const T="",x="\ufeff",w=window.wp.escapeHtml;function N(e,t=[]){const{formats:n,start:r,end:o,activeFormats:a}=e;if(void 0===r)return t;if(r===o){if(a)return a;const e=n[r-1]||t,o=n[r]||t;return e.length<o.length?e:o}if(!n[r])return t;const s=n.slice(r,o),i=[...s[0]];let c=s.length;for(;c--;){const e=s[c];if(!e)return t;let n=i.length;for(;n--;){const t=i[n];e.find((e=>h(t,e)))||i.splice(n,1)}if(0===i.length)return t}return i||t}function L(e){return(0,o.select)(g).getFormatType(e)}function C(e,t){if(t)return e;const n={};for(const t in e){let r=t;t.startsWith("data-disable-rich-text-")&&(r=t.slice(23)),n[r]=e[t]}return n}function _({type:e,tagName:t,attributes:n,unregisteredAttributes:r,object:o,boundaryClass:a,isEditableTree:s}){const i=L(e);let c={};if(a&&s&&(c["data-rich-text-format-boundary"]="true"),!i)return n&&(c={...n,...c}),{type:e,attributes:C(c,s),object:o};c={...r,...c};for(const e in n){const t=!!i.attributes&&i.attributes[e];t?c[t]=n[e]:c[e]=n[e]}return i.className&&(c.class?c.class=`${i.className} ${c.class}`:c.class=i.className),s&&!1===i.contentEditable&&(c.contenteditable="false"),{type:t||i.tagName,object:i.object,attributes:C(c,s)}}function F(e,t,n){do{if(e[n]!==t[n])return!1}while(n--);return!0}function R({value:e,preserveWhiteSpace:t,createEmpty:n,append:r,getLastChild:o,getParent:a,isText:s,getText:i,remove:c,appendText:l,onStartIndex:u,onEndIndex:f,isEditableTree:d,placeholder:m}){const{formats:p,replacements:g,text:h,start:v,end:y}=e,E=p.length+1,b=n(),w=N(e),C=w[w.length-1];let R,O;r(b,"");for(let e=0;e<E;e++){const n=h.charAt(e),E=d&&(!O||"\n"===O),w=p[e];let N=o(b);if(w&&w.forEach(((e,t)=>{if(N&&R&&F(w,R,t))return void(N=o(N));const{type:n,tagName:l,attributes:u,unregisteredAttributes:f}=e,m=d&&e===C,p=a(N),g=r(p,_({type:n,tagName:l,attributes:u,unregisteredAttributes:f,boundaryClass:m,isEditableTree:d}));s(N)&&0===i(N).length&&c(N),N=r(g,"")})),0===e&&(u&&0===v&&u(b,N),f&&0===y&&f(b,N)),n===T){const t=g[e];if(!t)continue;const{type:n,attributes:o,innerHTML:s}=t,i=L(n);d||"script"!==n?!1===i?.contentEditable?(N=r(a(N),_({...t,isEditableTree:d,boundaryClass:v===e&&y===e+1})),s&&r(N,{html:s})):N=r(a(N),_({...t,object:!0,isEditableTree:d})):(N=r(a(N),_({type:"script",isEditableTree:d})),r(N,{html:decodeURIComponent(o["data-rich-text-script"])})),N=r(a(N),"")}else t||"\n"!==n?s(N)?l(N,n):N=r(a(N),n):(N=r(a(N),{type:"br",attributes:d?{"data-rich-text-line-break":"true"}:void 0,object:!0}),N=r(a(N),""));u&&v===e+1&&u(b,N),f&&y===e+1&&f(b,N),E&&e===h.length&&(r(a(N),x),m&&0===h.length&&r(a(N),{type:"span",attributes:{"data-rich-text-placeholder":m,style:"pointer-events:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;"}})),R=w,O=n}return b}function O({value:e,preserveWhiteSpace:t}){return j(R({value:e,preserveWhiteSpace:t,createEmpty:A,append:D,getLastChild:S,getParent:k,isText:$,getText:H,remove:P,appendText:M}).children)}function A(){return{}}function S({children:e}){return e&&e[e.length-1]}function D(e,t){return"string"==typeof t&&(t={text:t}),t.parent=e,e.children=e.children||[],e.children.push(t),t}function M(e,t){e.text+=t}function k({parent:e}){return e}function $({text:e}){return"string"==typeof e}function H({text:e}){return e}function P(e){const t=e.parent.children.indexOf(e);return-1!==t&&e.parent.children.splice(t,1),e}function j(e=[]){return e.map((e=>void 0!==e.html?e.html:void 0===e.text?function({type:e,attributes:t,object:n,children:r}){let o="";for(const e in t)(0,w.isValidAttributeName)(e)&&(o+=` ${e}="${(0,w.escapeAttribute)(t[e])}"`);return n?`<${e}${o}>`:`<${e}${o}>${j(r)}</${e}>`}(e):(0,w.escapeEditableHTML)(e.text))).join("")}function V({text:e}){return e.replace(T,"")}function W({tagName:e,attributes:t}){let n;if(t&&t.class&&(n=(0,o.select)(g).getFormatTypeForClassName(t.class),n&&(t.class=` ${t.class} `.replace(` ${n.className} `," ").trim(),t.class||delete t.class)),n||(n=(0,o.select)(g).getFormatTypeForBareElement(e)),!n)return t?{type:e,attributes:t}:{type:e};if(n.__experimentalCreatePrepareEditableTree&&!n.__experimentalCreateOnChangeEditableValue)return null;if(!t)return{formatType:n,type:n.name,tagName:e};const r={},a={},s={...t};for(const e in n.attributes){const t=n.attributes[e];r[e]=s[t],delete s[t],void 0===r[e]&&delete r[e]}for(const e in s)a[e]=t[e];return!1===n.contentEditable&&delete a.contenteditable,{formatType:n,type:n.name,tagName:e,attributes:r,unregisteredAttributes:a}}class I{#e;static empty(){return new I}static fromPlainText(e){return new I(B({text:e}))}static fromHTMLString(e){return new I(B({html:e}))}static fromHTMLElement(e,t={}){const{preserveWhiteSpace:n=!1}=t,r=n?e:U(e),o=new I(B({element:r}));return Object.defineProperty(o,"originalHTML",{value:e.innerHTML}),o}constructor(e={formats:[],replacements:[],text:""}){this.#e=e}toPlainText(){return V(this.#e)}toHTMLString({preserveWhiteSpace:e}={}){return this.originalHTML||O({value:this.#e,preserveWhiteSpace:e})}valueOf(){return this.toHTMLString()}toString(){return this.toHTMLString()}toJSON(){return this.toHTMLString()}get length(){return this.text.length}get formats(){return this.#e.formats}get replacements(){return this.#e.replacements}get text(){return this.#e.text}}for(const e of Object.getOwnPropertyNames(String.prototype))I.prototype.hasOwnProperty(e)||Object.defineProperty(I.prototype,e,{value(...t){return this.toHTMLString()[e](...t)}});function B({element:e,text:t,html:n,range:r,__unstableIsEditableTree:o}={}){return n instanceof I?{text:n.text,formats:n.formats,replacements:n.replacements}:"string"==typeof t&&t.length>0?{formats:Array(t.length),replacements:Array(t.length),text:t}:("string"==typeof n&&n.length>0&&(e=b(document,n)),"object"!=typeof e?{formats:[],replacements:[],text:""}:Y({element:e,range:r,isEditableTree:o}))}function z(e,t,n,r){if(!n)return;const{parentNode:o}=t,{startContainer:a,startOffset:s,endContainer:i,endOffset:c}=n,l=e.text.length;void 0!==r.start?e.start=l+r.start:t===a&&t.nodeType===t.TEXT_NODE?e.start=l+s:o===a&&t===a.childNodes[s]?e.start=l:o===a&&t===a.childNodes[s-1]?e.start=l+r.text.length:t===a&&(e.start=l),void 0!==r.end?e.end=l+r.end:t===i&&t.nodeType===t.TEXT_NODE?e.end=l+c:o===i&&t===i.childNodes[c-1]?e.end=l+r.text.length:o===i&&t===i.childNodes[c]?e.end=l:t===i&&(e.end=l+c)}function X(e,t,n){if(!t)return;const{startContainer:r,endContainer:o}=t;let{startOffset:a,endOffset:s}=t;return e===r&&(a=n(e.nodeValue.slice(0,a)).length),e===o&&(s=n(e.nodeValue.slice(0,s)).length),{startContainer:r,startOffset:a,endContainer:o,endOffset:s}}function U(e,t=!0){const n=e.cloneNode(!0);return n.normalize(),Array.from(n.childNodes).forEach(((e,n,r)=>{if(e.nodeType===e.TEXT_NODE){let o=e.nodeValue;/[\n\t\r\f]/.test(o)&&(o=o.replace(/[\n\t\r\f]+/g," ")),-1!==o.indexOf(" ")&&(o=o.replace(/ {2,}/g," ")),0===n&&o.startsWith(" ")?o=o.slice(1):t&&n===r.length-1&&o.endsWith(" ")&&(o=o.slice(0,-1)),e.nodeValue=o}else e.nodeType===e.ELEMENT_NODE&&U(e,!1)})),n}const q="\r";function K(e){return e.replace(new RegExp(`[${x}${T}${q}]`,"gu"),"")}function Y({element:e,range:t,isEditableTree:n}){const r={formats:[],replacements:[],text:""};if(!e)return r;if(!e.hasChildNodes())return z(r,e,t,{formats:[],replacements:[],text:""}),r;const o=e.childNodes.length;for(let a=0;a<o;a++){const s=e.childNodes[a],i=s.nodeName.toLowerCase();if(s.nodeType===s.TEXT_NODE){const u=K(s.nodeValue);z(r,s,t=X(s,t,K),{text:u}),r.formats.length+=u.length,r.replacements.length+=u.length,r.text+=u;continue}if(s.nodeType!==s.ELEMENT_NODE)continue;if(n&&"br"===i&&!s.getAttribute("data-rich-text-line-break")){z(r,s,t,{formats:[],replacements:[],text:""});continue}if("script"===i){const f={formats:[,],replacements:[{type:i,attributes:{"data-rich-text-script":s.getAttribute("data-rich-text-script")||encodeURIComponent(s.innerHTML)}}],text:T};z(r,s,t,f),Z(r,f);continue}if("br"===i){z(r,s,t,{formats:[],replacements:[],text:""}),Z(r,B({text:"\n"}));continue}const c=W({tagName:i,attributes:G({element:s})});if(!1===c?.formatType?.contentEditable){delete c.formatType,z(r,s,t,{formats:[],replacements:[],text:""}),Z(r,{formats:[,],replacements:[{...c,innerHTML:s.innerHTML}],text:T});continue}c&&delete c.formatType;const l=Y({element:s,range:t,isEditableTree:n});if(z(r,s,t,l),!c||s.getAttribute("data-rich-text-placeholder"))Z(r,l);else if(0===l.text.length)c.attributes&&Z(r,{formats:[,],replacements:[c],text:T});else{function d(e){if(d.formats===e)return d.newFormats;const t=e?[c,...e]:[c];return d.formats=e,d.newFormats=t,t}d.newFormats=[c],Z(r,{...l,formats:Array.from(l.formats,d)})}}return r}function G({element:e}){if(!e.hasAttributes())return;const t=e.attributes.length;let n;for(let r=0;r<t;r++){const{name:t,value:o}=e.attributes[r];if(0===t.indexOf("data-rich-text-"))continue;n=n||{},n[/^on/i.test(t)?"data-disable-rich-text-"+t:t]=o}return n}function Z(e,t){return e.formats=e.formats.concat(t.formats),e.replacements=e.replacements.concat(t.replacements),e.text+=t.text,e}function J(...e){return v(e.reduce(Z,B()))}function Q(e,t){return N(e).find((({type:e})=>e===t))}function ee({start:e,end:t,replacements:n,text:r}){if(e+1===t&&r[e]===T)return n[e]}function te({start:e,end:t}){if(void 0!==e&&void 0!==t)return e===t}function ne({text:e}){return 0===e.length}function re(e,t=""){return"string"==typeof t&&(t=B({text:t})),v(e.reduce(((e,{formats:n,replacements:r,text:o})=>({formats:e.formats.concat(t.formats,n),replacements:e.replacements.concat(t.replacements,r),text:e.text+t.text+o}))))}function oe(e,t){if("string"==typeof(t={name:e,...t}).name)if(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(t.name))if((0,o.select)(g).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){const e=(0,o.select)(g).getFormatTypeForBareElement(t.tagName);if(e&&"core/unknown"!==e.name)return void window.console.error(`Format "${e.name}" is already registered to handle bare tag name "${t.tagName}".`)}else{const e=(0,o.select)(g).getFormatTypeForClassName(t.className);if(e)return void window.console.error(`Format "${e.name}" is already registered to handle class name "${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(0,o.dispatch)(g).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, underscores, 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 ae(e,t,n=e.start,r=e.end){const{formats:o,activeFormats:a}=e,s=o.slice();if(n===r){const e=s[n]?.find((({type:e})=>e===t));if(e){for(;s[n]?.find((t=>t===e));)se(s,n,t),n--;for(r++;s[r]?.find((t=>t===e));)se(s,r,t),r++}}else for(let e=n;e<r;e++)s[e]&&se(s,e,t);return v({...e,formats:s,activeFormats:a?.filter((({type:e})=>e!==t))||[]})}function se(e,t,n){const r=e[t].filter((({type:e})=>e!==n));r.length?e[t]=r:delete e[t]}function ie(e,t,n=e.start,r=e.end){const{formats:o,replacements:a,text:s}=e;"string"==typeof t&&(t=B({text:t}));const i=n+t.text.length;return v({formats:o.slice(0,n).concat(t.formats,o.slice(r)),replacements:a.slice(0,n).concat(t.replacements,a.slice(r)),text:s.slice(0,n)+t.text+s.slice(r),start:i,end:i})}function ce(e,t,n){return ie(e,B(),t,n)}function le({formats:e,replacements:t,text:n,start:r,end:o},a,s){return n=n.replace(a,((n,...a)=>{const i=a[a.length-2];let c,l,u=s;return"function"==typeof u&&(u=s(n,...a)),"object"==typeof u?(c=u.formats,l=u.replacements,u=u.text):(c=Array(u.length),l=Array(u.length),e[i]&&(c=c.fill(e[i]))),e=e.slice(0,i).concat(c,e.slice(i+n.length)),t=t.slice(0,i).concat(l,t.slice(i+n.length)),r&&(r=o=i+u.length),u})),v({formats:e,replacements:t,text:n,start:r,end:o})}function ue(e,t,n,r){return ie(e,{formats:[,],replacements:[t],text:T},n,r)}function fe(e,t=e.start,n=e.end){const{formats:r,replacements:o,text:a}=e;return void 0===t||void 0===n?{...e}:{formats:r.slice(t,n),replacements:o.slice(t,n),text:a.slice(t,n)}}function de({formats:e,replacements:t,text:n,start:r,end:o},a){if("string"!=typeof a)return function({formats:e,replacements:t,text:n,start:r,end:o},a=r,s=o){if(void 0===r||void 0===o)return;const i={formats:e.slice(0,a),replacements:t.slice(0,a),text:n.slice(0,a)},c={formats:e.slice(s),replacements:t.slice(s),text:n.slice(s),start:0,end:0};return[i,c]}(...arguments);let s=0;return n.split(a).map((n=>{const i=s,c={formats:e.slice(i,i+n.length),replacements:t.slice(i,i+n.length),text:n};return s+=a.length+n.length,void 0!==r&&void 0!==o&&(r>=i&&r<s?c.start=r-i:r<i&&o>i&&(c.start=0),o>=i&&o<s?c.end=o-i:r<s&&o>s&&(c.end=n.length)),c}))}function me(e,t){return e===t||e&&t&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}function pe(e,t,n){const r=e.parentNode;let o=0;for(;e=e.previousSibling;)o++;return n=[o,...n],r!==t&&(n=pe(r,t,n)),n}function ge(e,t){for(t=[...t];e&&t.length>1;)e=e.childNodes[t.shift()];return{node:e,offset:t[0]}}function he(e,t){if(void 0!==t.html)return e.innerHTML+=t.html;"string"==typeof t&&(t=e.ownerDocument.createTextNode(t));const{type:n,attributes:r}=t;if(n){t=e.ownerDocument.createElement(n);for(const e in r)t.setAttribute(e,r[e])}return e.appendChild(t)}function ve(e,t){e.appendData(t)}function ye({lastChild:e}){return e}function Ee({parentNode:e}){return e}function be(e){return e.nodeType===e.TEXT_NODE}function Te({nodeValue:e}){return e}function xe(e){return e.parentNode.removeChild(e)}function we({value:e,prepareEditableTree:t,isEditableTree:n=!0,placeholder:r,doc:o=document}){let a=[],s=[];t&&(e={...e,formats:t(e)});return{body:R({value:e,createEmpty:()=>b(o,""),append:he,getLastChild:ye,getParent:Ee,isText:be,getText:Te,remove:xe,appendText:ve,onStartIndex(e,t){a=pe(t,e,[t.nodeValue.length])},onEndIndex(e,t){s=pe(t,e,[t.nodeValue.length])},isEditableTree:n,placeholder:r}),selection:{startPath:a,endPath:s}}}function Ne({value:e,current:t,prepareEditableTree:n,__unstableDomOnly:r,placeholder:o}){const{body:a,selection:s}=we({value:e,prepareEditableTree:n,placeholder:o,doc:t.ownerDocument});Le(a,t),void 0===e.start||r||function({startPath:e,endPath:t},n){const{node:r,offset:o}=ge(n,e),{node:a,offset:s}=ge(n,t),{ownerDocument:i}=n,{defaultView:c}=i,l=c.getSelection(),u=i.createRange();u.setStart(r,o),u.setEnd(a,s);const{activeElement:f}=i;if(l.rangeCount>0){if(me(u,l.getRangeAt(0)))return;l.removeAllRanges()}l.addRange(u),f!==i.activeElement&&f instanceof c.HTMLElement&&f.focus()}(s,t)}function Le(e,t){let n,r=0;for(;n=e.firstChild;){const o=t.childNodes[r];if(o)if(o.isEqualNode(n))e.removeChild(n);else if(o.nodeName!==n.nodeName||o.nodeType===o.TEXT_NODE&&o.data!==n.data)t.replaceChild(n,o);else{const t=o.attributes,r=n.attributes;if(t){let e=t.length;for(;e--;){const{name:r}=t[e];n.getAttribute(r)||o.removeAttribute(r)}}if(r)for(let e=0;e<r.length;e++){const{name:t,value:n}=r[e];o.getAttribute(t)!==n&&o.setAttribute(t,n)}Le(n,o),e.removeChild(n)}else t.appendChild(n);r++}for(;t.childNodes[r];)t.removeChild(t.childNodes[r])}const Ce=window.wp.a11y,_e=window.wp.i18n;function Fe(e,t){return Q(e,t.type)?(t.title&&(0,Ce.speak)((0,_e.sprintf)((0,_e.__)("%s removed."),t.title),"assertive"),ae(e,t.type)):(t.title&&(0,Ce.speak)((0,_e.sprintf)((0,_e.__)("%s applied."),t.title),"assertive"),E(e,t))}function Re(e){const t=(0,o.select)(g).getFormatType(e);if(t)return(0,o.dispatch)(g).removeFormatTypes(e),t;window.console.error(`Format ${e} is not registered.`)}const Oe=window.wp.element,Ae=window.wp.deprecated;var Se=e.n(Ae);function De({ref:e,value:t,settings:n={}}){Se()("`useAnchorRef` hook",{since:"6.1",alternative:"`useAnchor` hook"});const{tagName:r,className:o,name:a}=n,s=a?Q(t,a):void 0;return(0,Oe.useMemo)((()=>{if(!e.current)return;const{ownerDocument:{defaultView:t}}=e.current,n=t.getSelection();if(!n.rangeCount)return;const a=n.getRangeAt(0);if(!s)return a;let i=a.startContainer;for(i=i.nextElementSibling||i;i.nodeType!==i.ELEMENT_NODE;)i=i.parentNode;return i.closest(r+(o?"."+o:""))}),[s,t.start,t.end,r,o])}const Me=window.wp.compose;function ke(e,t,n){if(!e)return;const{ownerDocument:r}=e,{defaultView:o}=r,a=o.getSelection();if(!a)return;if(!a.rangeCount)return;const s=a.getRangeAt(0);if(!s||!s.startContainer)return;const i=function(e,t,n,r){let o=e.startContainer;if(o.nodeType===o.TEXT_NODE&&e.startOffset===o.length&&o.nextSibling)for(o=o.nextSibling;o.firstChild;)o=o.firstChild;if(o.nodeType!==o.ELEMENT_NODE&&(o=o.parentElement),!o)return;if(o===t)return;if(!t.contains(o))return;const a=n+(r?"."+r:"");for(;o!==t;){if(o.matches(a))return o;o=o.parentElement}}(s,e,t,n);return i||function(e,t){return{contextElement:t,getBoundingClientRect:()=>t.contains(e.startContainer)?e.getBoundingClientRect():t.getBoundingClientRect()}}(s,e)}function $e({editableContentElement:e,settings:t={}}){const{tagName:n,className:r,isActive:o}=t,[a,s]=(0,Oe.useState)((()=>ke(e,n,r))),i=(0,Me.usePrevious)(o);return(0,Oe.useLayoutEffect)((()=>{if(!e)return;function t(){s(ke(e,n,r))}function a(){l.addEventListener("selectionchange",t)}function c(){l.removeEventListener("selectionchange",t)}const{ownerDocument:l}=e;return(e===l.activeElement||!i&&o||i&&!o)&&(s(ke(e,n,r)),a()),e.addEventListener("focusin",a),e.addEventListener("focusout",c),()=>{c(),e.removeEventListener("focusin",a),e.removeEventListener("focusout",c)}}),[e,n,r,o,i]),a}const He="pre-wrap",Pe="1px";function je({record:e}){const t=(0,Oe.useRef)(),{activeFormats:n=[],replacements:r,start:o}=e.current,a=r[o];return(0,Oe.useEffect)((()=>{if(!(n&&n.length||a))return;const e="*[data-rich-text-format-boundary]",r=t.current.querySelector(e);if(!r)return;const{ownerDocument:o}=r,{defaultView:s}=o,i=`${`.rich-text:focus ${e}`} {${`background-color: ${s.getComputedStyle(r).color.replace(")",", 0.2)").replace("rgb","rgba")}`}}`,c="rich-text-boundary-style";let l=o.getElementById(c);l||(l=o.createElement("style"),l.id=c,o.head.appendChild(l)),l.innerHTML!==i&&(l.innerHTML=i)}),[n,a]),t}function Ve(e){const t=(0,Oe.useRef)(e);return t.current=e,(0,Me.useRefEffect)((e=>{function n(n){const{record:r}=t.current,{ownerDocument:o}=e;if(te(r.current)||!e.contains(o.activeElement))return;const a=fe(r.current),s=V(a),i=O({value:a});n.clipboardData.setData("text/plain",s),n.clipboardData.setData("text/html",i),n.clipboardData.setData("rich-text","true"),n.preventDefault(),"cut"===n.type&&o.execCommand("delete")}return e.addEventListener("copy",n),e.addEventListener("cut",n),()=>{e.removeEventListener("copy",n),e.removeEventListener("cut",n)}}),[])}const We=window.wp.keycodes,Ie=[];function Be(e){const[,t]=(0,Oe.useReducer)((()=>({}))),n=(0,Oe.useRef)(e);return n.current=e,(0,Me.useRefEffect)((e=>{function r(r){const{keyCode:o,shiftKey:a,altKey:s,metaKey:i,ctrlKey:c}=r;if(a||s||i||c||o!==We.LEFT&&o!==We.RIGHT)return;const{record:l,applyRecord:u}=n.current,{text:f,formats:d,start:m,end:p,activeFormats:g=[]}=l.current,h=te(l.current),{ownerDocument:v}=e,{defaultView:y}=v,{direction:E}=y.getComputedStyle(e),b="rtl"===E?We.RIGHT:We.LEFT,T=r.keyCode===b;if(h&&0===g.length){if(0===m&&T)return;if(p===f.length&&!T)return}if(!h)return;const x=d[m-1]||Ie,w=d[m]||Ie,N=T?x:w,L=g.every(((e,t)=>e===N[t]));let C=g.length;if(L?C<N.length&&C++:C--,C===g.length)return void(l.current._newActiveFormats=N);r.preventDefault();const _=(L?N:T?w:x).slice(0,C),F={...l.current,activeFormats:_};l.current=F,u(F),t()}return e.addEventListener("keydown",r),()=>{e.removeEventListener("keydown",r)}}),[])}const ze=new Set(["insertParagraph","insertOrderedList","insertUnorderedList","insertHorizontalRule","insertLink"]),Xe=[],Ue="data-rich-text-placeholder";function qe(e){const t=(0,Oe.useRef)(e);return t.current=e,(0,Me.useRefEffect)((e=>{const{ownerDocument:n}=e,{defaultView:r}=n;let o=!1;function a(e){if(o)return;let n;e&&(n=e.inputType);const{record:r,applyRecord:a,createRecord:s,handleChange:i}=t.current;if(n&&(0===n.indexOf("format")||ze.has(n)))return void a(r.current);const c=s(),{start:l,activeFormats:u=[]}=r.current,f=function({value:e,start:t,end:n,formats:r}){const o=Math.min(t,n),a=Math.max(t,n),s=e.formats[o-1]||[],i=e.formats[a]||[];for(e.activeFormats=r.map(((e,t)=>{if(s[t]){if(h(e,s[t]))return s[t]}else if(i[t]&&h(e,i[t]))return i[t];return e}));--n>=t;)e.activeFormats.length>0?e.formats[n]=e.activeFormats:delete e.formats[n];return e}({value:c,start:l,end:c.start,formats:u});i(f)}function s(){const{record:i,applyRecord:c,createRecord:l,onSelectionChange:u}=t.current;if("true"!==e.contentEditable)return;if(n.activeElement!==e)return void n.removeEventListener("selectionchange",s);if(o)return;const{start:f,end:d,text:m}=l(),p=i.current;if(m!==p.text)return void a();if(f===p.start&&d===p.end)return void(0===p.text.length&&0===f&&function(e){const t=e.getSelection(),{anchorNode:n,anchorOffset:r}=t;if(n.nodeType!==n.ELEMENT_NODE)return;const o=n.childNodes[r];o&&o.nodeType===o.ELEMENT_NODE&&o.hasAttribute(Ue)&&t.collapseToStart()}(r));const g={...p,start:f,end:d,activeFormats:p._newActiveFormats,_newActiveFormats:void 0},h=N(g,Xe);g.activeFormats=h,i.current=g,c(g,{domOnly:!0}),u(f,d)}function i(){o=!0,n.removeEventListener("selectionchange",s),e.querySelector(`[${Ue}]`)?.remove()}function c(){o=!1,a({inputType:"insertText"}),n.addEventListener("selectionchange",s)}function l(){const{record:r,isSelected:o,onSelectionChange:a,applyRecord:i}=t.current;if(!e.parentElement.closest('[contenteditable="true"]')){if(o)i(r.current,{domOnly:!0});else{const e=void 0;r.current={...r.current,start:e,end:e,activeFormats:Xe}}a(r.current.start,r.current.end),n.addEventListener("selectionchange",s)}}return e.addEventListener("input",a),e.addEventListener("compositionstart",i),e.addEventListener("compositionend",c),e.addEventListener("focus",l),()=>{e.removeEventListener("input",a),e.removeEventListener("compositionstart",i),e.removeEventListener("compositionend",c),e.removeEventListener("focus",l)}}),[])}function Ke(e){const t=(0,Oe.useRef)(e);return t.current=e,(0,Me.useRefEffect)((e=>{function n(e){const{keyCode:n}=e,{createRecord:r,handleChange:o}=t.current;if(e.defaultPrevented)return;if(n!==We.DELETE&&n!==We.BACKSPACE)return;const a=r(),{start:s,end:i,text:c}=a;0===s&&0!==i&&i===c.length&&(o(ce(a)),e.preventDefault())}return e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}}),[])}function Ye({value:e="",selectionStart:t,selectionEnd:n,placeholder:r,onSelectionChange:a,preserveWhiteSpace:s,onChange:i,__unstableDisableFormats:c,__unstableIsSelected:l,__unstableDependencies:u=[],__unstableAfterParse:f,__unstableBeforeSerialize:d,__unstableAddInvisibleFormats:m}){const p=(0,o.useRegistry)(),[,g]=(0,Oe.useReducer)((()=>({}))),h=(0,Oe.useRef)();function v(){const{ownerDocument:{defaultView:e}}=h.current,t=e.getSelection(),n=t.rangeCount>0?t.getRangeAt(0):null;return B({element:h.current,range:n,__unstableIsEditableTree:!0})}function y(e,{domOnly:t}={}){Ne({value:e,current:h.current,prepareEditableTree:m,__unstableDomOnly:t,placeholder:r})}const E=(0,Oe.useRef)(e),b=(0,Oe.useRef)();function T(){E.current=e,b.current=e,e instanceof I||(b.current=e?I.fromHTMLString(e,{preserveWhiteSpace:s}):I.empty()),b.current={text:b.current.text,formats:b.current.formats,replacements:b.current.replacements},c&&(b.current.formats=Array(e.length),b.current.replacements=Array(e.length)),f&&(b.current.formats=f(b.current)),b.current.start=t,b.current.end=n}const x=(0,Oe.useRef)(!1);function w(t){if(b.current=t,y(t),c)E.current=t.text;else{const n=d?d(t):t.formats;t={...t,formats:n},E.current="string"==typeof e?O({value:t,preserveWhiteSpace:s}):new I(t)}const{start:n,end:r,formats:o,text:l}=b.current;p.batch((()=>{a(n,r),i(E.current,{__unstableFormats:o,__unstableText:l})})),g()}function N(){T(),y(b.current)}b.current?t===b.current.start&&n===b.current.end||(x.current=l,b.current={...b.current,start:t,end:n,activeFormats:void 0}):(x.current=l,T());const L=(0,Oe.useRef)(!1);(0,Oe.useLayoutEffect)((()=>{L.current&&e!==E.current&&(N(),g())}),[e]),(0,Oe.useLayoutEffect)((()=>{x.current&&(h.current.ownerDocument.activeElement!==h.current&&h.current.focus(),y(b.current),x.current=!1)}),[x.current]);const C=(0,Me.useMergeRefs)([h,(0,Oe.useCallback)((e=>{e&&(e.style.whiteSpace=He,e.style.minWidth=Pe)}),[]),je({record:b}),Ve({record:b}),(0,Me.useRefEffect)((e=>{function t(t){const{target:n}=t;if(n===e||n.textContent&&n.isContentEditable)return;const{ownerDocument:r}=n,{defaultView:o}=r,a=o.getSelection();if(a.containsNode(n))return;const s=r.createRange(),i=n.isContentEditable?n:n.closest("[contenteditable]");s.selectNode(i),a.removeAllRanges(),a.addRange(s),t.preventDefault()}function n(n){n.relatedTarget&&!e.contains(n.relatedTarget)&&"A"===n.relatedTarget.tagName&&t(n)}return e.addEventListener("click",t),e.addEventListener("focusin",n),()=>{e.removeEventListener("click",t),e.removeEventListener("focusin",n)}}),[]),Be({record:b,applyRecord:y}),Ke({createRecord:v,handleChange:w}),qe({record:b,applyRecord:y,createRecord:v,handleChange:w,isSelected:l,onSelectionChange:a}),(0,Me.useRefEffect)((e=>{const{ownerDocument:t}=e,{defaultView:n}=t,r=n?.getSelection();let o;function a(){return r.rangeCount?r.getRangeAt(0):null}function s(e){const n="keydown"===e.type?"keyup":"pointerup";function r(){t.removeEventListener(n,s),t.removeEventListener("selectionchange",r),t.removeEventListener("input",r)}function s(){r(),me(o,a())||t.dispatchEvent(new Event("selectionchange"))}t.addEventListener(n,s),t.addEventListener("selectionchange",r),t.addEventListener("input",r),o=a()}return e.addEventListener("pointerdown",s),e.addEventListener("keydown",s),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("keydown",s)}}),[]),(0,Me.useRefEffect)((()=>{N(),L.current=!0}),[r,...u])]);return{value:b.current,getValue:()=>b.current,onChange:w,ref:C}}function Ge(){}(window.wp=window.wp||{}).richText=t})();
\ No newline at end of file |