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

2 lines
30 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
(()=>{"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:()=>B,__experimentalRichText:()=>Ge,__unstableCreateElement:()=>E,__unstableToDom:()=>we,__unstableUseRichText:()=>Ye,applyFormat:()=>b,concat:()=>J,create:()=>z,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:()=>Se});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 y(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 v(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]=v(s[n],o,t),n--;for(r++;s[r]&&s[r][o]===e;)s[r]=v(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 y({...e,fo