WordPress/wp-includes/js/dist/element.min.js

2 lines
11 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
!function(){"use strict";var e={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,{Children:function(){return n.Children},Component:function(){return n.Component},Fragment:function(){return n.Fragment},Platform:function(){return k},RawHTML:function(){return w},StrictMode:function(){return n.StrictMode},Suspense:function(){return n.Suspense},cloneElement:function(){return n.cloneElement},concatChildren:function(){return m},createContext:function(){return n.createContext},createElement:function(){return n.createElement},createInterpolateElement:function(){return p},createPortal:function(){return y.createPortal},createRef:function(){return n.createRef},findDOMNode:function(){return y.findDOMNode},forwardRef:function(){return n.forwardRef},isEmptyElement:function(){return b},isValidElement:function(){return n.isValidElement},lazy:function(){return n.lazy},memo:function(){return n.memo},render:function(){return y.render},renderToString:function(){return $},switchChildrenNodeName:function(){return g},unmountComponentAtNode:function(){return y.unmountComponentAtNode},useCallback:function(){return n.useCallback},useContext:function(){return n.useContext},useDebugValue:function(){return n.useDebugValue},useEffect:function(){return n.useEffect},useImperativeHandle:function(){return n.useImperativeHandle},useLayoutEffect:function(){return n.useLayoutEffect},useMemo:function(){return n.useMemo},useReducer:function(){return n.useReducer},useRef:function(){return n.useRef},useState:function(){return n.useState}});var n=window.React;let r,o,i,a;const s=/<(\/)?(\w+)\s*(\/)?>/g;function u(e,t,n,r,o){return{element:e,tokenStart:t,tokenLength:n,prevOffset:r,leadingTextStart:o,children:[]}}const l=e=>{const t="object"==typeof e,r=t&&Object.values(e);return t&&r.length&&r.every((e=>(0,n.isValidElement)(e)))};function c(e){const t=function(){const e=s.exec(r);if(null===e)return["no-more-tokens"];const t=e.index,[n,o,i,a]=e,u=n.length;if(a)return["self-closed",i,t,u];if(o)return["closer",i,t,u];return["opener",i,t,u]}(),[l,c,p,h]=t,m=a.length,g=p>o?o:null;if(!e[c])return f(),!1;switch(l){case"no-more-tokens":if(0!==m){const{leadingTextStart:e,tokenStart:t}=a.pop();i.push(r.substr(e,t))}return f(),!1;case"self-closed":return 0===m?(null!==g&&i.push(r.substr(g,p-g)),i.push(e[c]),o=p+h,!0):(d(u(e[c],p,h)),o=p+h,!0);case"opener":return a.push(u(e[c],p,h,p+h,g)),o=p+h,!0;case"closer":if(1===m)return function(e){const{element:t,leadingTextStart:o,prevOffset:s,tokenStart:u,children:l}=a.pop(),c=e?r.substr(s,e-s):r.substr(s);c&&l.push(c);null!==o&&i.push(r.substr(o,u-o));i.push((0,n.cloneElement)(t,null,...l))}(p),o=p+h,!0;const t=a.pop(),s=r.substr(t.prevOffset,p-t.prevOffset);t.children.push(s),t.prevOffset=p+h;const l=u(t.element,t.tokenStart,t.tokenLength,p+h);return l.children=t.children,d(l),o=p+h,!0;default:return f(),!1}}function f(){const e=r.length-o;0!==e&&i.push(r.substr(o,e))}function d(e){const{element:t,tokenStart:o,tokenLength:i,prevOffset:s,children:u}=e,l=a[a.length-1],c=r.substr(l.prevOffset,o-l.prevOffset);c&&l.children.push(c),l.children.push((0,n.cloneElement)(t,null,...u)),l.prevOffset=s||o+i}var p=(e,t)=>{if(r=e,o=0,i=[],a=[],s.lastIndex=0,!l(t))throw new TypeError("The conversionMap provided is not valid. It must be an object with values that are WPElements");do{}while(c(t));return(0,n.createElement)(n.Fragment,null,...i)},h=window.lodash;function m(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce(((e,t,r)=>(n.Children.forEach(t,((t,o)=>{t&&"string"!=typeof t&&(t=(0,n.cloneElement)(t,{key:[r,o].join()})),e.push(t)})),e)),[])}function g(e,t){return e&&n.Children.map(e,((e,r)=>{if((0,h.isString)(e))return(0,n.createElement)(t,{key:r},e);const{children:o,...i}=e.props;return(0,n.cr