2022-04-11 08:04:30 -04:00
/******/ ( function ( ) { // webpackBootstrap
/******/ "use strict" ;
/******/ // The require scope
/******/ var _ _webpack _require _ _ = { } ;
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ ! function ( ) {
/******/ // define getter functions for harmony exports
/******/ _ _webpack _require _ _ . d = function ( exports , definition ) {
/******/ for ( var key in definition ) {
/******/ if ( _ _webpack _require _ _ . o ( definition , key ) && ! _ _webpack _require _ _ . o ( exports , key ) ) {
/******/ Object . defineProperty ( exports , key , { enumerable : true , get : definition [ key ] } ) ;
/******/ }
/******/ }
/******/ } ;
/******/ } ( ) ;
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ ! function ( ) {
/******/ _ _webpack _require _ _ . o = function ( obj , prop ) { return Object . prototype . hasOwnProperty . call ( obj , prop ) ; }
/******/ } ( ) ;
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ ! function ( ) {
/******/ // define __esModule on exports
/******/ _ _webpack _require _ _ . r = function ( exports ) {
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
2018-12-13 23:41:57 -05:00
/******/ } ;
2022-04-11 08:04:30 -04:00
/******/ } ( ) ;
/******/
2018-12-13 23:41:57 -05:00
/************************************************************************/
2022-04-11 08:04:30 -04:00
var _ _webpack _exports _ _ = { } ;
2020-06-29 07:50:29 -04:00
// ESM COMPAT FLAG
2018-12-13 23:41:57 -05:00
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2020-06-29 07:50:29 -04:00
// EXPORTS
2022-04-11 08:04:30 -04:00
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
"Children" : function ( ) { return /* reexport */ external _React _namespaceObject . Children ; } ,
"Component" : function ( ) { return /* reexport */ external _React _namespaceObject . Component ; } ,
"Fragment" : function ( ) { return /* reexport */ external _React _namespaceObject . Fragment ; } ,
"Platform" : function ( ) { return /* reexport */ platform ; } ,
"RawHTML" : function ( ) { return /* reexport */ RawHTML ; } ,
"StrictMode" : function ( ) { return /* reexport */ external _React _namespaceObject . StrictMode ; } ,
"Suspense" : function ( ) { return /* reexport */ external _React _namespaceObject . Suspense ; } ,
"cloneElement" : function ( ) { return /* reexport */ external _React _namespaceObject . cloneElement ; } ,
"concatChildren" : function ( ) { return /* reexport */ concatChildren ; } ,
"createContext" : function ( ) { return /* reexport */ external _React _namespaceObject . createContext ; } ,
"createElement" : function ( ) { return /* reexport */ external _React _namespaceObject . createElement ; } ,
"createInterpolateElement" : function ( ) { return /* reexport */ create _interpolate _element ; } ,
"createPortal" : function ( ) { return /* reexport */ external _ReactDOM _namespaceObject . createPortal ; } ,
"createRef" : function ( ) { return /* reexport */ external _React _namespaceObject . createRef ; } ,
"findDOMNode" : function ( ) { return /* reexport */ external _ReactDOM _namespaceObject . findDOMNode ; } ,
"forwardRef" : function ( ) { return /* reexport */ external _React _namespaceObject . forwardRef ; } ,
2022-09-20 11:43:29 -04:00
"hydrate" : function ( ) { return /* reexport */ external _ReactDOM _namespaceObject . hydrate ; } ,
2022-04-11 08:04:30 -04:00
"isEmptyElement" : function ( ) { return /* reexport */ isEmptyElement ; } ,
"isValidElement" : function ( ) { return /* reexport */ external _React _namespaceObject . isValidElement ; } ,
"lazy" : function ( ) { return /* reexport */ external _React _namespaceObject . lazy ; } ,
"memo" : function ( ) { return /* reexport */ external _React _namespaceObject . memo ; } ,
"render" : function ( ) { return /* reexport */ external _ReactDOM _namespaceObject . render ; } ,
"renderToString" : function ( ) { return /* reexport */ serialize ; } ,
"switchChildrenNodeName" : function ( ) { return /* reexport */ switchChildrenNodeName ; } ,
"unmountComponentAtNode" : function ( ) { return /* reexport */ external _ReactDOM _namespaceObject . unmountComponentAtNode ; } ,
"useCallback" : function ( ) { return /* reexport */ external _React _namespaceObject . useCallback ; } ,
"useContext" : function ( ) { return /* reexport */ external _React _namespaceObject . useContext ; } ,
"useDebugValue" : function ( ) { return /* reexport */ external _React _namespaceObject . useDebugValue ; } ,
"useEffect" : function ( ) { return /* reexport */ external _React _namespaceObject . useEffect ; } ,
"useImperativeHandle" : function ( ) { return /* reexport */ external _React _namespaceObject . useImperativeHandle ; } ,
"useLayoutEffect" : function ( ) { return /* reexport */ external _React _namespaceObject . useLayoutEffect ; } ,
"useMemo" : function ( ) { return /* reexport */ external _React _namespaceObject . useMemo ; } ,
"useReducer" : function ( ) { return /* reexport */ external _React _namespaceObject . useReducer ; } ,
"useRef" : function ( ) { return /* reexport */ external _React _namespaceObject . useRef ; } ,
"useState" : function ( ) { return /* reexport */ external _React _namespaceObject . useState ; }
} ) ;
; // CONCATENATED MODULE: external "React"
var external _React _namespaceObject = window [ "React" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/create-interpolate-element.js
2020-01-08 06:57:23 -05:00
/ * *
2021-02-02 00:17:13 -05:00
* Internal dependencies
2020-01-08 06:57:23 -05:00
* /
2020-06-26 09:33:47 -04:00
/** @typedef {import('./react').WPElement} WPElement */
2021-05-19 11:09:27 -04:00
let indoc , offset , output , stack ;
2020-01-08 06:57:23 -05:00
/ * *
* Matches tags in the localized string
*
* This is used for extracting the tag pattern groups for parsing the localized
* string and along with the map converting it to a react element .
*
* There are four references extracted using this tokenizer :
*
* match : Full match of the tag ( i . e . < strong > , < /strong>, <br/ > )
2022-09-20 11:43:29 -04:00
* isClosing : The closing slash , if it exists .
2020-01-08 06:57:23 -05:00
* name : The name portion of the tag ( strong , br ) ( if )
* isSelfClosed : The slash on a self closing tag , if it exists .
*
* @ type { RegExp }
* /
2021-05-19 11:09:27 -04:00
const tokenizer = /<(\/)?(\w+)\s*(\/)?>/g ;
2020-06-26 09:33:47 -04:00
/ * *
* The stack frame tracking parse progress .
*
* @ typedef Frame
*
2021-11-08 09:29:21 -05:00
* @ property { WPElement } element A parent element which may still have
* @ property { number } tokenStart Offset at which parent element first
* appears .
* @ property { number } tokenLength Length of string marking start of parent
* element .
* @ property { number } [ prevOffset ] Running offset at which parsing should
* continue .
* @ property { number } [ leadingTextStart ] Offset at which last closing element
* finished , used for finding text between
* elements .
* @ property { WPElement [ ] } children Children .
2020-06-26 09:33:47 -04:00
* /
2020-01-08 06:57:23 -05:00
/ * *
* Tracks recursive - descent parse state .
*
* This is a Stack frame holding parent elements until all children have been
* parsed .
*
* @ private
2020-06-26 09:33:47 -04:00
* @ param { WPElement } element A parent element which may still have
* nested children not yet parsed .
* @ param { number } tokenStart Offset at which parent element first
* appears .
* @ param { number } tokenLength Length of string marking start of parent
* element .
* @ param { number } [ prevOffset ] Running offset at which parsing should
* continue .
* @ param { number } [ leadingTextStart ] Offset at which last closing element
* finished , used for finding text between
* elements .
2020-01-08 06:57:23 -05:00
*
* @ return { Frame } The stack frame tracking parse progress .
* /
2020-06-26 09:33:47 -04:00
function createFrame ( element , tokenStart , tokenLength , prevOffset , leadingTextStart ) {
2020-01-08 06:57:23 -05:00
return {
2021-05-19 11:09:27 -04:00
element ,
tokenStart ,
tokenLength ,
prevOffset ,
leadingTextStart ,
2020-01-08 06:57:23 -05:00
children : [ ]
} ;
}
/ * *
* This function creates an interpolated element from a passed in string with
* specific tags matching how the string should be converted to an element via
* the conversion map value .
*
* @ example
* For example , for the given string :
*
* " This is a < span > string < / s p a n > w i t h < a > a l i n k < / a > a n d a s e l f - c l o s i n g
* < CustomComponentB / > tag "
*
* You would have something like this as the conversionMap value :
*
* ` ` ` js
* {
* span : < span / > ,
* a : < a href = { 'https://github.com' } / > ,
* CustomComponentB : < CustomComponent / > ,
* }
* ` ` `
*
2021-11-08 09:29:21 -05:00
* @ param { string } interpolatedString The interpolation string to be parsed .
* @ param { Object } conversionMap The map used to convert the string to
* a react element .
2020-01-08 06:57:23 -05:00
* @ throws { TypeError }
* @ return { WPElement } A wp element .
* /
2021-05-19 11:09:27 -04:00
const createInterpolateElement = ( interpolatedString , conversionMap ) => {
2020-01-08 06:57:23 -05:00
indoc = interpolatedString ;
offset = 0 ;
output = [ ] ;
stack = [ ] ;
tokenizer . lastIndex = 0 ;
2021-05-19 11:09:27 -04:00
if ( ! isValidConversionMap ( conversionMap ) ) {
2020-01-08 06:57:23 -05:00
throw new TypeError ( 'The conversionMap provided is not valid. It must be an object with values that are WPElements' ) ;
}
do { // twiddle our thumbs
} while ( proceed ( conversionMap ) ) ;
2022-04-11 08:04:30 -04:00
return ( 0 , external _React _namespaceObject . createElement ) ( external _React _namespaceObject . Fragment , null , ... output ) ;
2020-01-08 06:57:23 -05:00
} ;
/ * *
* Validate conversion map .
*
* A map is considered valid if it ' s an object and every value in the object
* is a WPElement
*
* @ private
*
2021-11-08 09:29:21 -05:00
* @ param { Object } conversionMap The map being validated .
2020-01-08 06:57:23 -05:00
*
* @ return { boolean } True means the map is valid .
* /
2021-05-19 11:09:27 -04:00
const isValidConversionMap = conversionMap => {
const isObject = typeof conversionMap === 'object' ;
const values = isObject && Object . values ( conversionMap ) ;
2022-04-11 08:04:30 -04:00
return isObject && values . length && values . every ( element => ( 0 , external _React _namespaceObject . isValidElement ) ( element ) ) ;
2020-01-08 06:57:23 -05:00
} ;
/ * *
* This is the iterator over the matches in the string .
*
* @ private
*
* @ param { Object } conversionMap The conversion map for the string .
*
* @ return { boolean } true for continuing to iterate , false for finished .
* /
function proceed ( conversionMap ) {
2021-05-19 11:09:27 -04:00
const next = nextToken ( ) ;
const [ tokenType , name , startOffset , tokenLength ] = next ;
const stackDepth = stack . length ;
const leadingTextStart = startOffset > offset ? offset : null ;
2020-01-08 06:57:23 -05:00
if ( ! conversionMap [ name ] ) {
addText ( ) ;
return false ;
}
switch ( tokenType ) {
case 'no-more-tokens' :
if ( stackDepth !== 0 ) {
2021-05-19 11:09:27 -04:00
const {
leadingTextStart : stackLeadingText ,
tokenStart
} = stack . pop ( ) ;
2020-01-08 06:57:23 -05:00
output . push ( indoc . substr ( stackLeadingText , tokenStart ) ) ;
}
addText ( ) ;
return false ;
case 'self-closed' :
if ( 0 === stackDepth ) {
if ( null !== leadingTextStart ) {
output . push ( indoc . substr ( leadingTextStart , startOffset - leadingTextStart ) ) ;
}
output . push ( conversionMap [ name ] ) ;
offset = startOffset + tokenLength ;
return true ;
2022-04-12 11:12:47 -04:00
} // Otherwise we found an inner element.
2020-01-08 06:57:23 -05:00
2020-06-26 09:33:47 -04:00
addChild ( createFrame ( conversionMap [ name ] , startOffset , tokenLength ) ) ;
2020-01-08 06:57:23 -05:00
offset = startOffset + tokenLength ;
return true ;
case 'opener' :
2020-06-26 09:33:47 -04:00
stack . push ( createFrame ( conversionMap [ name ] , startOffset , tokenLength , startOffset + tokenLength , leadingTextStart ) ) ;
2020-01-08 06:57:23 -05:00
offset = startOffset + tokenLength ;
return true ;
case 'closer' :
2022-04-12 11:12:47 -04:00
// If we're not nesting then this is easy - close the block.
2020-01-08 06:57:23 -05:00
if ( 1 === stackDepth ) {
closeOuterElement ( startOffset ) ;
offset = startOffset + tokenLength ;
return true ;
2022-04-12 11:12:47 -04:00
} // Otherwise we're nested and we have to close out the current
// block and add it as a innerBlock to the parent.
2020-01-08 06:57:23 -05:00
2021-05-19 11:09:27 -04:00
const stackTop = stack . pop ( ) ;
const text = indoc . substr ( stackTop . prevOffset , startOffset - stackTop . prevOffset ) ;
2020-01-08 06:57:23 -05:00
stackTop . children . push ( text ) ;
stackTop . prevOffset = startOffset + tokenLength ;
2021-05-19 11:09:27 -04:00
const frame = createFrame ( stackTop . element , stackTop . tokenStart , stackTop . tokenLength , startOffset + tokenLength ) ;
2020-01-08 06:57:23 -05:00
frame . children = stackTop . children ;
addChild ( frame ) ;
offset = startOffset + tokenLength ;
return true ;
default :
addText ( ) ;
return false ;
}
}
/ * *
* Grabs the next token match in the string and returns it ' s details .
*
* @ private
*
* @ return { Array } An array of details for the token matched .
* /
function nextToken ( ) {
2022-04-12 11:12:47 -04:00
const matches = tokenizer . exec ( indoc ) ; // We have no more tokens.
2020-01-08 06:57:23 -05:00
if ( null === matches ) {
return [ 'no-more-tokens' ] ;
}
2021-05-19 11:09:27 -04:00
const startedAt = matches . index ;
const [ match , isClosing , name , isSelfClosed ] = matches ;
const length = match . length ;
2020-01-08 06:57:23 -05:00
if ( isSelfClosed ) {
return [ 'self-closed' , name , startedAt , length ] ;
}
if ( isClosing ) {
return [ 'closer' , name , startedAt , length ] ;
}
return [ 'opener' , name , startedAt , length ] ;
}
/ * *
* Pushes text extracted from the indoc string to the output stack given the
* current rawLength value and offset ( if rawLength is provided ) or the
* indoc . length and offset .
*
* @ private
* /
function addText ( ) {
2021-05-19 11:09:27 -04:00
const length = indoc . length - offset ;
2020-01-08 06:57:23 -05:00
if ( 0 === length ) {
return ;
}
output . push ( indoc . substr ( offset , length ) ) ;
}
/ * *
* Pushes a child element to the associated parent element ' s children for the
* parent currently active in the stack .
*
* @ private
*
2021-11-08 09:29:21 -05:00
* @ param { Frame } frame The Frame containing the child element and it ' s
* token information .
2020-01-08 06:57:23 -05:00
* /
function addChild ( frame ) {
2021-05-19 11:09:27 -04:00
const {
element ,
tokenStart ,
tokenLength ,
prevOffset ,
children
} = frame ;
const parent = stack [ stack . length - 1 ] ;
const text = indoc . substr ( parent . prevOffset , tokenStart - parent . prevOffset ) ;
2020-01-08 06:57:23 -05:00
if ( text ) {
parent . children . push ( text ) ;
}
2022-04-11 08:04:30 -04:00
parent . children . push ( ( 0 , external _React _namespaceObject . cloneElement ) ( element , null , ... children ) ) ;
2020-01-08 06:57:23 -05:00
parent . prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength ;
}
/ * *
* This is called for closing tags . It creates the element currently active in
* the stack .
*
* @ private
*
* @ param { number } endOffset Offset at which the closing tag for the element
* begins in the string . If this is greater than the
* prevOffset attached to the element , then this
* helps capture any remaining nested text nodes in
* the element .
* /
function closeOuterElement ( endOffset ) {
2021-05-19 11:09:27 -04:00
const {
element ,
leadingTextStart ,
prevOffset ,
tokenStart ,
children
} = stack . pop ( ) ;
const text = endOffset ? indoc . substr ( prevOffset , endOffset - prevOffset ) : indoc . substr ( prevOffset ) ;
2020-01-08 06:57:23 -05:00
if ( text ) {
children . push ( text ) ;
}
if ( null !== leadingTextStart ) {
output . push ( indoc . substr ( leadingTextStart , tokenStart - leadingTextStart ) ) ;
}
2022-04-11 08:04:30 -04:00
output . push ( ( 0 , external _React _namespaceObject . cloneElement ) ( element , null , ... children ) ) ;
2020-01-08 06:57:23 -05:00
}
2021-05-19 11:09:27 -04:00
/* harmony default export */ var create _interpolate _element = ( createInterpolateElement ) ;
2018-12-13 23:41:57 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react.js
2018-12-13 23:41:57 -05:00
/ * *
* External dependencies
* /
2022-04-12 11:12:47 -04:00
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
2018-12-13 23:41:57 -05:00
2020-01-08 06:57:23 -05:00
/ * *
* Object containing a React element .
*
* @ typedef { import ( 'react' ) . ReactElement } WPElement
* /
/ * *
* Object containing a React component .
*
2020-06-26 09:33:47 -04:00
* @ typedef { import ( 'react' ) . ComponentType } WPComponent
2020-01-08 06:57:23 -05:00
* /
/ * *
* Object containing a React synthetic event .
*
* @ typedef { import ( 'react' ) . SyntheticEvent } WPSyntheticEvent
* /
2019-03-21 08:48:00 -04:00
/ * *
* Object that provides utilities for dealing with React children .
* /
2018-12-13 23:41:57 -05:00
/ * *
* Creates a copy of an element with extended props .
*
* @ param { WPElement } element Element
* @ param { ? Object } props Props to apply to cloned element
*
* @ return { WPElement } Cloned element .
* /
/ * *
* A base class to create WordPress Components ( Refs , state and lifecycle hooks )
* /
/ * *
* Creates a context object containing two components : a provider and consumer .
*
* @ param { Object } defaultValue A default data stored in the context .
*
* @ return { Object } Context object .
* /
/ * *
* Returns a new element of given type . Type can be either a string tag name or
* another function which itself returns an element .
*
* @ param { ? ( string | Function ) } type Tag name or element creator
* @ param { Object } props Element properties , either attribute
2020-01-08 06:57:23 -05:00
* set to apply to DOM node or values to
* pass through to element creator
2018-12-13 23:41:57 -05:00
* @ param { ... WPElement } children Descendant elements
*
* @ return { WPElement } Element .
* /
/ * *
* Returns an object tracking a reference to a rendered element via its
* ` current ` property as either a DOMElement or Element , dependent upon the
* type of element rendered with the ref attribute .
*
* @ return { Object } Ref object .
* /
/ * *
* Component enhancer used to enable passing a ref to its wrapped component .
* Pass a function argument which receives ` props ` and ` ref ` as its arguments ,
* returning an element using the forwarded ref . The return value is a new
* component which forwards its ref .
*
* @ param { Function } forwarder Function passed ` props ` and ` ref ` , expected to
* return an element .
*
* @ return { WPComponent } Enhanced component .
* /
/ * *
* A component which renders its children without any wrapping element .
* /
/ * *
2020-01-08 06:57:23 -05:00
* Checks if an object is a valid WPElement .
2018-12-13 23:41:57 -05:00
*
* @ param { Object } objectToCheck The object to be checked .
*
* @ return { boolean } true if objectToTest is a valid WPElement and false otherwise .
* /
2019-09-19 11:19:18 -04:00
/ * *
* @ see https : //reactjs.org/docs/react-api.html#reactmemo
* /
2019-03-21 08:48:00 -04:00
/ * *
* Component that activates additional checks and warnings for its descendants .
* /
/ * *
* @ see https : //reactjs.org/docs/hooks-reference.html#usecallback
* /
/ * *
* @ see https : //reactjs.org/docs/hooks-reference.html#usecontext
* /
/ * *
* @ see https : //reactjs.org/docs/hooks-reference.html#usedebugvalue
* /
/ * *
* @ see https : //reactjs.org/docs/hooks-reference.html#useeffect
* /
/ * *
* @ see https : //reactjs.org/docs/hooks-reference.html#useimperativehandle
* /
/ * *
* @ see https : //reactjs.org/docs/hooks-reference.html#uselayouteffect
* /
/ * *
* @ see https : //reactjs.org/docs/hooks-reference.html#usememo
* /
/ * *
* @ see https : //reactjs.org/docs/hooks-reference.html#usereducer
* /
/ * *
* @ see https : //reactjs.org/docs/hooks-reference.html#useref
* /
/ * *
* @ see https : //reactjs.org/docs/hooks-reference.html#usestate
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
/ * *
* @ see https : //reactjs.org/docs/react-api.html#reactlazy
* /
/ * *
* @ see https : //reactjs.org/docs/react-api.html#reactsuspense
* /
2018-12-13 23:41:57 -05:00
/ * *
* Concatenate two or more React children objects .
*
* @ param { ... ? Object } childrenArguments Array of children arguments ( array of arrays / strings / objects ) to concatenate .
*
* @ return { Array } The concatenated value .
* /
2021-11-15 07:50:17 -05:00
function concatChildren ( ) {
for ( var _len = arguments . length , childrenArguments = new Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) {
childrenArguments [ _key ] = arguments [ _key ] ;
}
2021-05-19 11:09:27 -04:00
return childrenArguments . reduce ( ( accumulator , children , i ) => {
2022-04-11 08:04:30 -04:00
external _React _namespaceObject . Children . forEach ( children , ( child , j ) => {
2018-12-13 23:41:57 -05:00
if ( child && 'string' !== typeof child ) {
2022-04-11 08:04:30 -04:00
child = ( 0 , external _React _namespaceObject . cloneElement ) ( child , {
2018-12-13 23:41:57 -05:00
key : [ i , j ] . join ( )
} ) ;
}
2020-01-08 06:57:23 -05:00
accumulator . push ( child ) ;
2018-12-13 23:41:57 -05:00
} ) ;
2020-01-08 06:57:23 -05:00
return accumulator ;
2018-12-13 23:41:57 -05:00
} , [ ] ) ;
}
/ * *
* Switches the nodeName of all the elements in the children object .
*
* @ param { ? Object } children Children object .
* @ param { string } nodeName Node name .
*
* @ return { ? Object } The updated children object .
* /
function switchChildrenNodeName ( children , nodeName ) {
2022-04-11 08:04:30 -04:00
return children && external _React _namespaceObject . Children . map ( children , ( elt , index ) => {
2022-09-20 11:43:29 -04:00
if ( typeof ( elt === null || elt === void 0 ? void 0 : elt . valueOf ( ) ) === 'string' ) {
2022-04-11 08:04:30 -04:00
return ( 0 , external _React _namespaceObject . createElement ) ( nodeName , {
2018-12-13 23:41:57 -05:00
key : index
} , elt ) ;
}
2021-05-19 11:09:27 -04:00
const {
children : childrenProp ,
... props
} = elt . props ;
2022-04-11 08:04:30 -04:00
return ( 0 , external _React _namespaceObject . createElement ) ( nodeName , {
2021-05-19 11:09:27 -04:00
key : index ,
... props
} , childrenProp ) ;
2018-12-13 23:41:57 -05:00
} ) ;
}
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external "ReactDOM"
var external _ReactDOM _namespaceObject = window [ "ReactDOM" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react-platform.js
2018-12-17 22:14:52 -05:00
/ * *
* External dependencies
* /
2018-12-13 23:41:57 -05:00
2018-12-17 22:14:52 -05:00
/ * *
* Creates a portal into which a component can be rendered .
*
* @ see https : //github.com/facebook/react/issues/10309#issuecomment-318433235
*
2021-11-08 09:29:21 -05:00
* @ param { import ( './react' ) . WPElement } child Any renderable child , such as an element ,
* string , or fragment .
* @ param { HTMLElement } container DOM node into which element should be rendered .
2018-12-17 22:14:52 -05:00
* /
2018-12-13 23:41:57 -05:00
2018-12-17 22:14:52 -05:00
/ * *
2020-01-08 06:57:23 -05:00
* Finds the dom node of a React component .
2018-12-17 22:14:52 -05:00
*
2020-06-26 09:33:47 -04:00
* @ param { import ( './react' ) . WPComponent } component Component ' s instance .
2018-12-17 22:14:52 -05:00
* /
/ * *
* Renders a given element into the target DOM node .
*
2021-11-08 09:29:21 -05:00
* @ param { import ( './react' ) . WPElement } element Element to render .
* @ param { HTMLElement } target DOM node into which element should be rendered .
2018-12-17 22:14:52 -05:00
* /
2022-09-20 11:43:29 -04:00
/ * *
* Hydrates a given element into the target DOM node .
*
* @ param { import ( './react' ) . WPElement } element Element to hydrate .
* @ param { HTMLElement } target DOM node into which element should be hydrated .
* /
2018-12-17 22:14:52 -05:00
/ * *
* Removes any mounted element from the target DOM node .
*
* @ param { Element } target DOM node in which element is to be removed
* /
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/utils.js
2018-12-17 22:14:52 -05:00
/ * *
* Checks if the provided WP element is empty .
*
* @ param { * } element WP element to check .
* @ return { boolean } True when an element is considered empty .
* /
2021-05-19 11:09:27 -04:00
const isEmptyElement = element => {
2022-09-20 11:43:29 -04:00
if ( typeof element === 'number' ) {
2018-12-17 22:14:52 -05:00
return false ;
}
2022-09-20 11:43:29 -04:00
if ( typeof ( element === null || element === void 0 ? void 0 : element . valueOf ( ) ) === 'string' || Array . isArray ( element ) ) {
2018-12-17 22:14:52 -05:00
return ! element . length ;
}
return ! element ;
} ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/platform.js
2020-01-08 06:57:23 -05:00
/ * *
* Parts of this source were derived and modified from react - native - web ,
* released under the MIT license .
*
* Copyright ( c ) 2016 - present , Nicolas Gallagher .
* Copyright ( c ) 2015 - present , Facebook , Inc .
*
* /
2021-05-19 11:09:27 -04:00
const Platform = {
2020-01-08 06:57:23 -05:00
OS : 'web' ,
2021-11-08 09:29:21 -05:00
select : spec => 'web' in spec ? spec . web : spec . default ,
isWeb : true
2020-01-08 06:57:23 -05:00
} ;
/ * *
* Component used to detect the current Platform being used .
* Use Platform . OS === 'web' to detect if running on web enviroment .
*
* This is the same concept as the React Native implementation .
*
* @ see https : //facebook.github.io/react-native/docs/platform-specific-code#platform-module
*
* Here is an example of how to use the select method :
* @ example
* ` ` ` js
* import { Platform } from '@wordpress/element' ;
*
* const placeholderLabel = Platform . select ( {
* native : _ _ ( 'Add media' ) ,
* web : _ _ ( 'Drag images, upload new ones or select files from your library.' ) ,
* } ) ;
* ` ` `
* /
/* harmony default export */ var platform = ( Platform ) ;
2018-12-17 22:14:52 -05:00
2022-09-20 11:43:29 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/element/node_modules/is-plain-object/dist/is-plain-object.mjs
/ * !
* is - plain - object < https : //github.com/jonschlinkert/is-plain-object>
*
* Copyright ( c ) 2014 - 2017 , Jon Schlinkert .
* Released under the MIT License .
* /
function isObject ( o ) {
return Object . prototype . toString . call ( o ) === '[object Object]' ;
}
function isPlainObject ( o ) {
var ctor , prot ;
if ( isObject ( o ) === false ) return false ;
// If has modified constructor
ctor = o . constructor ;
if ( ctor === undefined ) return true ;
// If has modified prototype
prot = ctor . prototype ;
if ( isObject ( prot ) === false ) return false ;
// If constructor does not have an Object-specific method
if ( prot . hasOwnProperty ( 'isPrototypeOf' ) === false ) {
return false ;
}
// Most likely a plain Object
return true ;
}
; // CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.js
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Copyright ( c ) Microsoft Corporation .
Permission to use , copy , modify , and / or distribute this software for any
purpose with or without fee is hereby granted .
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS . IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL , DIRECT ,
INDIRECT , OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE , DATA OR PROFITS , WHETHER IN AN ACTION OF CONTRACT , NEGLIGENCE OR
OTHER TORTIOUS ACTION , ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/* global Reflect, Promise */
var extendStatics = function ( d , b ) {
extendStatics = Object . setPrototypeOf ||
( { _ _proto _ _ : [ ] } instanceof Array && function ( d , b ) { d . _ _proto _ _ = b ; } ) ||
function ( d , b ) { for ( var p in b ) if ( Object . prototype . hasOwnProperty . call ( b , p ) ) d [ p ] = b [ p ] ; } ;
return extendStatics ( d , b ) ;
} ;
function _ _extends ( d , b ) {
if ( typeof b !== "function" && b !== null )
throw new TypeError ( "Class extends value " + String ( b ) + " is not a constructor or null" ) ;
extendStatics ( d , b ) ;
function _ _ ( ) { this . constructor = d ; }
d . prototype = b === null ? Object . create ( b ) : ( _ _ . prototype = b . prototype , new _ _ ( ) ) ;
}
var _ _assign = function ( ) {
_ _assign = Object . assign || function _ _assign ( t ) {
for ( var s , i = 1 , n = arguments . length ; i < n ; i ++ ) {
s = arguments [ i ] ;
for ( var p in s ) if ( Object . prototype . hasOwnProperty . call ( s , p ) ) t [ p ] = s [ p ] ;
}
return t ;
}
return _ _assign . apply ( this , arguments ) ;
}
function _ _rest ( s , e ) {
var t = { } ;
for ( var p in s ) if ( Object . prototype . hasOwnProperty . call ( s , p ) && e . indexOf ( p ) < 0 )
t [ p ] = s [ p ] ;
if ( s != null && typeof Object . getOwnPropertySymbols === "function" )
for ( var i = 0 , p = Object . getOwnPropertySymbols ( s ) ; i < p . length ; i ++ ) {
if ( e . indexOf ( p [ i ] ) < 0 && Object . prototype . propertyIsEnumerable . call ( s , p [ i ] ) )
t [ p [ i ] ] = s [ p [ i ] ] ;
}
return t ;
}
function _ _decorate ( decorators , target , key , desc ) {
var c = arguments . length , r = c < 3 ? target : desc === null ? desc = Object . getOwnPropertyDescriptor ( target , key ) : desc , d ;
if ( typeof Reflect === "object" && typeof Reflect . decorate === "function" ) r = Reflect . decorate ( decorators , target , key , desc ) ;
else for ( var i = decorators . length - 1 ; i >= 0 ; i -- ) if ( d = decorators [ i ] ) r = ( c < 3 ? d ( r ) : c > 3 ? d ( target , key , r ) : d ( target , key ) ) || r ;
return c > 3 && r && Object . defineProperty ( target , key , r ) , r ;
}
function _ _param ( paramIndex , decorator ) {
return function ( target , key ) { decorator ( target , key , paramIndex ) ; }
}
function _ _metadata ( metadataKey , metadataValue ) {
if ( typeof Reflect === "object" && typeof Reflect . metadata === "function" ) return Reflect . metadata ( metadataKey , metadataValue ) ;
}
function _ _awaiter ( thisArg , _arguments , P , generator ) {
function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
} ) ;
}
function _ _generator ( thisArg , body ) {
var _ = { label : 0 , sent : function ( ) { if ( t [ 0 ] & 1 ) throw t [ 1 ] ; return t [ 1 ] ; } , trys : [ ] , ops : [ ] } , f , y , t , g ;
return g = { next : verb ( 0 ) , "throw" : verb ( 1 ) , "return" : verb ( 2 ) } , typeof Symbol === "function" && ( g [ Symbol . iterator ] = function ( ) { return this ; } ) , g ;
function verb ( n ) { return function ( v ) { return step ( [ n , v ] ) ; } ; }
function step ( op ) {
if ( f ) throw new TypeError ( "Generator is already executing." ) ;
while ( _ ) try {
if ( f = 1 , y && ( t = op [ 0 ] & 2 ? y [ "return" ] : op [ 0 ] ? y [ "throw" ] || ( ( t = y [ "return" ] ) && t . call ( y ) , 0 ) : y . next ) && ! ( t = t . call ( y , op [ 1 ] ) ) . done ) return t ;
if ( y = 0 , t ) op = [ op [ 0 ] & 2 , t . value ] ;
switch ( op [ 0 ] ) {
case 0 : case 1 : t = op ; break ;
case 4 : _ . label ++ ; return { value : op [ 1 ] , done : false } ;
case 5 : _ . label ++ ; y = op [ 1 ] ; op = [ 0 ] ; continue ;
case 7 : op = _ . ops . pop ( ) ; _ . trys . pop ( ) ; continue ;
default :
if ( ! ( t = _ . trys , t = t . length > 0 && t [ t . length - 1 ] ) && ( op [ 0 ] === 6 || op [ 0 ] === 2 ) ) { _ = 0 ; continue ; }
if ( op [ 0 ] === 3 && ( ! t || ( op [ 1 ] > t [ 0 ] && op [ 1 ] < t [ 3 ] ) ) ) { _ . label = op [ 1 ] ; break ; }
if ( op [ 0 ] === 6 && _ . label < t [ 1 ] ) { _ . label = t [ 1 ] ; t = op ; break ; }
if ( t && _ . label < t [ 2 ] ) { _ . label = t [ 2 ] ; _ . ops . push ( op ) ; break ; }
if ( t [ 2 ] ) _ . ops . pop ( ) ;
_ . trys . pop ( ) ; continue ;
}
op = body . call ( thisArg , _ ) ;
} catch ( e ) { op = [ 6 , e ] ; y = 0 ; } finally { f = t = 0 ; }
if ( op [ 0 ] & 5 ) throw op [ 1 ] ; return { value : op [ 0 ] ? op [ 1 ] : void 0 , done : true } ;
}
}
var _ _createBinding = Object . create ? ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
Object . defineProperty ( o , k2 , { enumerable : true , get : function ( ) { return m [ k ] ; } } ) ;
} ) : ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
o [ k2 ] = m [ k ] ;
} ) ;
function _ _exportStar ( m , o ) {
for ( var p in m ) if ( p !== "default" && ! Object . prototype . hasOwnProperty . call ( o , p ) ) _ _createBinding ( o , m , p ) ;
}
function _ _values ( o ) {
var s = typeof Symbol === "function" && Symbol . iterator , m = s && o [ s ] , i = 0 ;
if ( m ) return m . call ( o ) ;
if ( o && typeof o . length === "number" ) return {
next : function ( ) {
if ( o && i >= o . length ) o = void 0 ;
return { value : o && o [ i ++ ] , done : ! o } ;
}
} ;
throw new TypeError ( s ? "Object is not iterable." : "Symbol.iterator is not defined." ) ;
}
function _ _read ( o , n ) {
var m = typeof Symbol === "function" && o [ Symbol . iterator ] ;
if ( ! m ) return o ;
var i = m . call ( o ) , r , ar = [ ] , e ;
try {
while ( ( n === void 0 || n -- > 0 ) && ! ( r = i . next ( ) ) . done ) ar . push ( r . value ) ;
}
catch ( error ) { e = { error : error } ; }
finally {
try {
if ( r && ! r . done && ( m = i [ "return" ] ) ) m . call ( i ) ;
}
finally { if ( e ) throw e . error ; }
}
return ar ;
}
/** @deprecated */
function _ _spread ( ) {
for ( var ar = [ ] , i = 0 ; i < arguments . length ; i ++ )
ar = ar . concat ( _ _read ( arguments [ i ] ) ) ;
return ar ;
}
/** @deprecated */
function _ _spreadArrays ( ) {
for ( var s = 0 , i = 0 , il = arguments . length ; i < il ; i ++ ) s += arguments [ i ] . length ;
for ( var r = Array ( s ) , k = 0 , i = 0 ; i < il ; i ++ )
for ( var a = arguments [ i ] , j = 0 , jl = a . length ; j < jl ; j ++ , k ++ )
r [ k ] = a [ j ] ;
return r ;
}
function _ _spreadArray ( to , from , pack ) {
if ( pack || arguments . length === 2 ) for ( var i = 0 , l = from . length , ar ; i < l ; i ++ ) {
if ( ar || ! ( i in from ) ) {
if ( ! ar ) ar = Array . prototype . slice . call ( from , 0 , i ) ;
ar [ i ] = from [ i ] ;
}
}
return to . concat ( ar || Array . prototype . slice . call ( from ) ) ;
}
function _ _await ( v ) {
return this instanceof _ _await ? ( this . v = v , this ) : new _ _await ( v ) ;
}
function _ _asyncGenerator ( thisArg , _arguments , generator ) {
if ( ! Symbol . asyncIterator ) throw new TypeError ( "Symbol.asyncIterator is not defined." ) ;
var g = generator . apply ( thisArg , _arguments || [ ] ) , i , q = [ ] ;
return i = { } , verb ( "next" ) , verb ( "throw" ) , verb ( "return" ) , i [ Symbol . asyncIterator ] = function ( ) { return this ; } , i ;
function verb ( n ) { if ( g [ n ] ) i [ n ] = function ( v ) { return new Promise ( function ( a , b ) { q . push ( [ n , v , a , b ] ) > 1 || resume ( n , v ) ; } ) ; } ; }
function resume ( n , v ) { try { step ( g [ n ] ( v ) ) ; } catch ( e ) { settle ( q [ 0 ] [ 3 ] , e ) ; } }
function step ( r ) { r . value instanceof _ _await ? Promise . resolve ( r . value . v ) . then ( fulfill , reject ) : settle ( q [ 0 ] [ 2 ] , r ) ; }
function fulfill ( value ) { resume ( "next" , value ) ; }
function reject ( value ) { resume ( "throw" , value ) ; }
function settle ( f , v ) { if ( f ( v ) , q . shift ( ) , q . length ) resume ( q [ 0 ] [ 0 ] , q [ 0 ] [ 1 ] ) ; }
}
function _ _asyncDelegator ( o ) {
var i , p ;
return i = { } , verb ( "next" ) , verb ( "throw" , function ( e ) { throw e ; } ) , verb ( "return" ) , i [ Symbol . iterator ] = function ( ) { return this ; } , i ;
function verb ( n , f ) { i [ n ] = o [ n ] ? function ( v ) { return ( p = ! p ) ? { value : _ _await ( o [ n ] ( v ) ) , done : n === "return" } : f ? f ( v ) : v ; } : f ; }
}
function _ _asyncValues ( o ) {
if ( ! Symbol . asyncIterator ) throw new TypeError ( "Symbol.asyncIterator is not defined." ) ;
var m = o [ Symbol . asyncIterator ] , i ;
return m ? m . call ( o ) : ( o = typeof _ _values === "function" ? _ _values ( o ) : o [ Symbol . iterator ] ( ) , i = { } , verb ( "next" ) , verb ( "throw" ) , verb ( "return" ) , i [ Symbol . asyncIterator ] = function ( ) { return this ; } , i ) ;
function verb ( n ) { i [ n ] = o [ n ] && function ( v ) { return new Promise ( function ( resolve , reject ) { v = o [ n ] ( v ) , settle ( resolve , reject , v . done , v . value ) ; } ) ; } ; }
function settle ( resolve , reject , d , v ) { Promise . resolve ( v ) . then ( function ( v ) { resolve ( { value : v , done : d } ) ; } , reject ) ; }
}
function _ _makeTemplateObject ( cooked , raw ) {
if ( Object . defineProperty ) { Object . defineProperty ( cooked , "raw" , { value : raw } ) ; } else { cooked . raw = raw ; }
return cooked ;
} ;
var _ _setModuleDefault = Object . create ? ( function ( o , v ) {
Object . defineProperty ( o , "default" , { enumerable : true , value : v } ) ;
} ) : function ( o , v ) {
o [ "default" ] = v ;
} ;
function _ _importStar ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype . hasOwnProperty . call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
_ _setModuleDefault ( result , mod ) ;
return result ;
}
function _ _importDefault ( mod ) {
return ( mod && mod . _ _esModule ) ? mod : { default : mod } ;
}
function _ _classPrivateFieldGet ( receiver , state , kind , f ) {
if ( kind === "a" && ! f ) throw new TypeError ( "Private accessor was defined without a getter" ) ;
if ( typeof state === "function" ? receiver !== state || ! f : ! state . has ( receiver ) ) throw new TypeError ( "Cannot read private member from an object whose class did not declare it" ) ;
return kind === "m" ? f : kind === "a" ? f . call ( receiver ) : f ? f . value : state . get ( receiver ) ;
}
function _ _classPrivateFieldSet ( receiver , state , value , kind , f ) {
if ( kind === "m" ) throw new TypeError ( "Private method is not writable" ) ;
if ( kind === "a" && ! f ) throw new TypeError ( "Private accessor was defined without a setter" ) ;
if ( typeof state === "function" ? receiver !== state || ! f : ! state . has ( receiver ) ) throw new TypeError ( "Cannot write private member to an object whose class did not declare it" ) ;
return ( kind === "a" ? f . call ( receiver , value ) : f ? f . value = value : state . set ( receiver , value ) ) , value ;
}
; // CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
/ * *
* Source : ftp : //ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
* /
var SUPPORTED _LOCALE = {
tr : {
regexp : /\u0130|\u0049|\u0049\u0307/g ,
map : {
İ : "\u0069" ,
I : "\u0131" ,
I ̇ : "\u0069" ,
} ,
} ,
az : {
regexp : /\u0130/g ,
map : {
İ : "\u0069" ,
I : "\u0131" ,
I ̇ : "\u0069" ,
} ,
} ,
lt : {
regexp : /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g ,
map : {
I : "\u0069\u0307" ,
J : "\u006A\u0307" ,
Į : "\u012F\u0307" ,
Ì : "\u0069\u0307\u0300" ,
Í : "\u0069\u0307\u0301" ,
Ĩ : "\u0069\u0307\u0303" ,
} ,
} ,
} ;
/ * *
* Localized lower case .
* /
function localeLowerCase ( str , locale ) {
var lang = SUPPORTED _LOCALE [ locale . toLowerCase ( ) ] ;
if ( lang )
return lowerCase ( str . replace ( lang . regexp , function ( m ) { return lang . map [ m ] ; } ) ) ;
return lowerCase ( str ) ;
}
/ * *
* Lower case as a function .
* /
function lowerCase ( str ) {
return str . toLowerCase ( ) ;
}
; // CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
var DEFAULT _SPLIT _REGEXP = [ /([a-z0-9])([A-Z])/g , /([A-Z])([A-Z][a-z])/g ] ;
// Remove all non-word characters.
var DEFAULT _STRIP _REGEXP = /[^A-Z0-9]+/gi ;
/ * *
* Normalize the string into something other libraries can manipulate easier .
* /
function noCase ( input , options ) {
if ( options === void 0 ) { options = { } ; }
var _a = options . splitRegexp , splitRegexp = _a === void 0 ? DEFAULT _SPLIT _REGEXP : _a , _b = options . stripRegexp , stripRegexp = _b === void 0 ? DEFAULT _STRIP _REGEXP : _b , _c = options . transform , transform = _c === void 0 ? lowerCase : _c , _d = options . delimiter , delimiter = _d === void 0 ? " " : _d ;
var result = replace ( replace ( input , splitRegexp , "$1\0$2" ) , stripRegexp , "\0" ) ;
var start = 0 ;
var end = result . length ;
// Trim the delimiter from around the output string.
while ( result . charAt ( start ) === "\0" )
start ++ ;
while ( result . charAt ( end - 1 ) === "\0" )
end -- ;
// Transform each token independently.
return result . slice ( start , end ) . split ( "\0" ) . map ( transform ) . join ( delimiter ) ;
}
/ * *
* Replace ` re ` in the input string with the replacement value .
* /
function replace ( input , re , value ) {
if ( re instanceof RegExp )
return input . replace ( re , value ) ;
return re . reduce ( function ( input , re ) { return input . replace ( re , value ) ; } , input ) ;
}
; // CONCATENATED MODULE: ./node_modules/dot-case/dist.es2015/index.js
function dotCase ( input , options ) {
if ( options === void 0 ) { options = { } ; }
return noCase ( input , _ _assign ( { delimiter : "." } , options ) ) ;
}
; // CONCATENATED MODULE: ./node_modules/param-case/dist.es2015/index.js
function paramCase ( input , options ) {
if ( options === void 0 ) { options = { } ; }
return dotCase ( input , _ _assign ( { delimiter : "-" } , options ) ) ;
}
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","escapeHtml"]
var external _wp _escapeHtml _namespaceObject = window [ "wp" ] [ "escapeHtml" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/raw-html.js
2018-12-17 22:14:52 -05:00
/ * *
2019-03-07 04:09:59 -05:00
* Internal dependencies
2018-12-17 22:14:52 -05:00
* /
2020-06-26 09:33:47 -04:00
// Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly.
/** @typedef {{children: string} & import('react').ComponentPropsWithoutRef<'div'>} RawHTMLProps */
2018-12-17 22:14:52 -05:00
/ * *
* Component used as equivalent of Fragment with unescaped HTML , in cases where
* it is desirable to render dangerous HTML without needing a wrapper element .
* To preserve additional props , a ` div ` wrapper _will _ be created if any props
* aside from ` children ` are passed .
*
2021-11-08 09:29:21 -05:00
* @ param { RawHTMLProps } props Children should be a string of HTML or an array
* of strings . Other props will be passed through
* to the div wrapper .
2018-12-17 22:14:52 -05:00
*
2020-06-26 09:33:47 -04:00
* @ return { JSX . Element } Dangerously - rendering component .
2018-12-17 22:14:52 -05:00
* /
2021-11-15 07:50:17 -05:00
function RawHTML ( _ref ) {
let {
children ,
... props
} = _ref ;
2021-11-08 09:29:21 -05:00
let rawHtml = '' ; // Cast children as an array, and concatenate each element if it is a string.
2022-04-11 08:04:30 -04:00
external _React _namespaceObject . Children . toArray ( children ) . forEach ( child => {
2021-11-08 09:29:21 -05:00
if ( typeof child === 'string' && child . trim ( ) !== '' ) {
rawHtml += child ;
}
} ) ; // The `div` wrapper will be stripped by the `renderElement` serializer in
// `./serialize.js` unless there are non-children props present.
2022-04-11 08:04:30 -04:00
return ( 0 , external _React _namespaceObject . createElement ) ( 'div' , {
2018-12-17 22:14:52 -05:00
dangerouslySetInnerHTML : {
2021-11-08 09:29:21 -05:00
_ _html : rawHtml
2021-05-19 11:09:27 -04:00
} ,
... props
} ) ;
2018-12-17 22:14:52 -05:00
}
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/serialize.js
2018-12-13 23:41:57 -05:00
/ * *
* Parts of this source were derived and modified from fast - react - render ,
* released under the MIT license .
*
* https : //github.com/alt-j/fast-react-render
*
* Copyright ( c ) 2016 Andrey Morozov
*
* Permission is hereby granted , free of charge , to any person obtaining a copy
* of this software and associated documentation files ( the "Software" ) , to deal
* in the Software without restriction , including without limitation the rights
* to use , copy , modify , merge , publish , distribute , sublicense , and / or sell
* copies of the Software , and to permit persons to whom the Software is
* furnished to do so , subject to the following conditions :
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software .
*
* THE SOFTWARE IS PROVIDED "AS IS" , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR
* IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY ,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER
* LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM ,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE .
* /
/ * *
* External dependencies
* /
2022-09-20 11:43:29 -04:00
2018-12-13 23:41:57 -05:00
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
2020-06-26 09:33:47 -04:00
/** @typedef {import('./react').WPElement} WPElement */
2018-12-13 23:41:57 -05:00
2021-05-19 11:09:27 -04:00
const {
Provider ,
Consumer
2022-04-11 08:04:30 -04:00
} = ( 0 , external _React _namespaceObject . createContext ) ( undefined ) ;
const ForwardRef = ( 0 , external _React _namespaceObject . forwardRef ) ( ( ) => {
2019-09-19 11:19:18 -04:00
return null ;
} ) ;
2018-12-13 23:41:57 -05:00
/ * *
* Valid attribute types .
*
2020-06-26 09:33:47 -04:00
* @ type { Set < string > }
2018-12-13 23:41:57 -05:00
* /
2021-05-19 11:09:27 -04:00
const ATTRIBUTES _TYPES = new Set ( [ 'string' , 'boolean' , 'number' ] ) ;
2018-12-13 23:41:57 -05:00
/ * *
* Element tags which can be self - closing .
*
2020-06-26 09:33:47 -04:00
* @ type { Set < string > }
2018-12-13 23:41:57 -05:00
* /
2021-05-19 11:09:27 -04:00
const SELF _CLOSING _TAGS = new Set ( [ 'area' , 'base' , 'br' , 'col' , 'command' , 'embed' , 'hr' , 'img' , 'input' , 'keygen' , 'link' , 'meta' , 'param' , 'source' , 'track' , 'wbr' ] ) ;
2018-12-13 23:41:57 -05:00
/ * *
* Boolean attributes are attributes whose presence as being assigned is
* meaningful , even if only empty .
*
* See : https : //html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes
* Extracted from : https : //html.spec.whatwg.org/multipage/indices.html#attributes-3
*
* Object . keys ( [ ... document . querySelectorAll ( '#attributes-1 > tbody > tr' ) ]
* . filter ( ( tr ) => tr . lastChild . textContent . indexOf ( 'Boolean attribute' ) !== - 1 )
* . reduce ( ( result , tr ) => Object . assign ( result , {
* [ tr . firstChild . textContent . trim ( ) ] : true
* } ) , { } ) ) . sort ( ) ;
*
2020-06-26 09:33:47 -04:00
* @ type { Set < string > }
2018-12-13 23:41:57 -05:00
* /
2021-05-19 11:09:27 -04:00
const BOOLEAN _ATTRIBUTES = new Set ( [ 'allowfullscreen' , 'allowpaymentrequest' , 'allowusermedia' , 'async' , 'autofocus' , 'autoplay' , 'checked' , 'controls' , 'default' , 'defer' , 'disabled' , 'download' , 'formnovalidate' , 'hidden' , 'ismap' , 'itemscope' , 'loop' , 'multiple' , 'muted' , 'nomodule' , 'novalidate' , 'open' , 'playsinline' , 'readonly' , 'required' , 'reversed' , 'selected' , 'typemustmatch' ] ) ;
2018-12-13 23:41:57 -05:00
/ * *
* Enumerated attributes are attributes which must be of a specific value form .
* Like boolean attributes , these are meaningful if specified , even if not of a
* valid enumerated value .
*
* See : https : //html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute
* Extracted from : https : //html.spec.whatwg.org/multipage/indices.html#attributes-3
*
* Object . keys ( [ ... document . querySelectorAll ( '#attributes-1 > tbody > tr' ) ]
* . filter ( ( tr ) => / ^ ( "(.+?)" ; ? \ s * ) + / . t e s t ( t r . l a s t C h i l d . t e x t C o n t e n t . t r i m ( ) ) )
* . reduce ( ( result , tr ) => Object . assign ( result , {
* [ tr . firstChild . textContent . trim ( ) ] : true
* } ) , { } ) ) . sort ( ) ;
*
* Some notable omissions :
*
* - ` alt ` : https : //blog.whatwg.org/omit-alt
*
2020-06-26 09:33:47 -04:00
* @ type { Set < string > }
2018-12-13 23:41:57 -05:00
* /
2021-05-19 11:09:27 -04:00
const ENUMERATED _ATTRIBUTES = new Set ( [ 'autocapitalize' , 'autocomplete' , 'charset' , 'contenteditable' , 'crossorigin' , 'decoding' , 'dir' , 'draggable' , 'enctype' , 'formenctype' , 'formmethod' , 'http-equiv' , 'inputmode' , 'kind' , 'method' , 'preload' , 'scope' , 'shape' , 'spellcheck' , 'translate' , 'type' , 'wrap' ] ) ;
2018-12-13 23:41:57 -05:00
/ * *
* Set of CSS style properties which support assignment of unitless numbers .
* Used in rendering of style properties , where ` px ` unit is assumed unless
* property is included in this set or value is zero .
*
* Generated via :
*
* Object . entries ( document . createElement ( 'div' ) . style )
* . filter ( ( [ key ] ) => (
* ! /^(webkit|ms|moz)/ . test ( key ) &&
* ( e . style [ key ] = 10 ) &&
* e . style [ key ] === '10'
* ) )
* . map ( ( [ key ] ) => key )
* . sort ( ) ;
*
2020-06-26 09:33:47 -04:00
* @ type { Set < string > }
2018-12-13 23:41:57 -05:00
* /
2021-05-19 11:09:27 -04:00
const CSS _PROPERTIES _SUPPORTS _UNITLESS = new Set ( [ 'animation' , 'animationIterationCount' , 'baselineShift' , 'borderImageOutset' , 'borderImageSlice' , 'borderImageWidth' , 'columnCount' , 'cx' , 'cy' , 'fillOpacity' , 'flexGrow' , 'flexShrink' , 'floodOpacity' , 'fontWeight' , 'gridColumnEnd' , 'gridColumnStart' , 'gridRowEnd' , 'gridRowStart' , 'lineHeight' , 'opacity' , 'order' , 'orphans' , 'r' , 'rx' , 'ry' , 'shapeImageThreshold' , 'stopOpacity' , 'strokeDasharray' , 'strokeDashoffset' , 'strokeMiterlimit' , 'strokeOpacity' , 'strokeWidth' , 'tabSize' , 'widows' , 'x' , 'y' , 'zIndex' , 'zoom' ] ) ;
2018-12-13 23:41:57 -05:00
/ * *
* Returns true if the specified string is prefixed by one of an array of
* possible prefixes .
*
* @ param { string } string String to check .
* @ param { string [ ] } prefixes Possible prefixes .
*
* @ return { boolean } Whether string has prefix .
* /
function hasPrefix ( string , prefixes ) {
2021-05-19 11:09:27 -04:00
return prefixes . some ( prefix => string . indexOf ( prefix ) === 0 ) ;
2018-12-13 23:41:57 -05:00
}
/ * *
* Returns true if the given prop name should be ignored in attributes
* serialization , or false otherwise .
*
* @ param { string } attribute Attribute to check .
*
* @ return { boolean } Whether attribute should be ignored .
* /
function isInternalAttribute ( attribute ) {
return 'key' === attribute || 'children' === attribute ;
}
/ * *
* Returns the normal form of the element ' s attribute value for HTML .
*
* @ param { string } attribute Attribute name .
* @ param { * } value Non - normalized attribute value .
*
2020-06-26 09:33:47 -04:00
* @ return { * } Normalized attribute value .
2018-12-13 23:41:57 -05:00
* /
function getNormalAttributeValue ( attribute , value ) {
switch ( attribute ) {
case 'style' :
return renderStyle ( value ) ;
}
return value ;
}
2022-04-12 11:12:47 -04:00
/ * *
* This is a map of all SVG attributes that have dashes . Map ( lower case prop => dashed lower case attribute ) .
* We need this to render e . g strokeWidth as stroke - width .
*
* List from : https : //developer.mozilla.org/en-US/docs/Web/SVG/Attribute.
* /
const SVG _ATTRIBUTE _WITH _DASHES _LIST = [ 'accentHeight' , 'alignmentBaseline' , 'arabicForm' , 'baselineShift' , 'capHeight' , 'clipPath' , 'clipRule' , 'colorInterpolation' , 'colorInterpolationFilters' , 'colorProfile' , 'colorRendering' , 'dominantBaseline' , 'enableBackground' , 'fillOpacity' , 'fillRule' , 'floodColor' , 'floodOpacity' , 'fontFamily' , 'fontSize' , 'fontSizeAdjust' , 'fontStretch' , 'fontStyle' , 'fontVariant' , 'fontWeight' , 'glyphName' , 'glyphOrientationHorizontal' , 'glyphOrientationVertical' , 'horizAdvX' , 'horizOriginX' , 'imageRendering' , 'letterSpacing' , 'lightingColor' , 'markerEnd' , 'markerMid' , 'markerStart' , 'overlinePosition' , 'overlineThickness' , 'paintOrder' , 'panose1' , 'pointerEvents' , 'renderingIntent' , 'shapeRendering' , 'stopColor' , 'stopOpacity' , 'strikethroughPosition' , 'strikethroughThickness' , 'strokeDasharray' , 'strokeDashoffset' , 'strokeLinecap' , 'strokeLinejoin' , 'strokeMiterlimit' , 'strokeOpacity' , 'strokeWidth' , 'textAnchor' , 'textDecoration' , 'textRendering' , 'underlinePosition' , 'underlineThickness' , 'unicodeBidi' , 'unicodeRange' , 'unitsPerEm' , 'vAlphabetic' , 'vHanging' , 'vIdeographic' , 'vMathematical' , 'vectorEffect' , 'vertAdvY' , 'vertOriginX' , 'vertOriginY' , 'wordSpacing' , 'writingMode' , 'xmlnsXlink' , 'xHeight' ] . reduce ( ( map , attribute ) => {
// The keys are lower-cased for more robust lookup.
map [ attribute . toLowerCase ( ) ] = attribute ;
return map ;
} , { } ) ;
/ * *
* This is a map of all case - sensitive SVG attributes . Map ( lowercase key => proper case attribute ) .
* The keys are lower - cased for more robust lookup .
* Note that this list only contains attributes that contain at least one capital letter .
* Lowercase attributes don ' t need mapping , since we lowercase all attributes by default .
* /
const CASE _SENSITIVE _SVG _ATTRIBUTES = [ 'allowReorder' , 'attributeName' , 'attributeType' , 'autoReverse' , 'baseFrequency' , 'baseProfile' , 'calcMode' , 'clipPathUnits' , 'contentScriptType' , 'contentStyleType' , 'diffuseConstant' , 'edgeMode' , 'externalResourcesRequired' , 'filterRes' , 'filterUnits' , 'glyphRef' , 'gradientTransform' , 'gradientUnits' , 'kernelMatrix' , 'kernelUnitLength' , 'keyPoints' , 'keySplines' , 'keyTimes' , 'lengthAdjust' , 'limitingConeAngle' , 'markerHeight' , 'markerUnits' , 'markerWidth' , 'maskContentUnits' , 'maskUnits' , 'numOctaves' , 'pathLength' , 'patternContentUnits' , 'patternTransform' , 'patternUnits' , 'pointsAtX' , 'pointsAtY' , 'pointsAtZ' , 'preserveAlpha' , 'preserveAspectRatio' , 'primitiveUnits' , 'refX' , 'refY' , 'repeatCount' , 'repeatDur' , 'requiredExtensions' , 'requiredFeatures' , 'specularConstant' , 'specularExponent' , 'spreadMethod' , 'startOffset' , 'stdDeviation' , 'stitchTiles' , 'suppressContentEditableWarning' , 'suppressHydrationWarning' , 'surfaceScale' , 'systemLanguage' , 'tableValues' , 'targetX' , 'targetY' , 'textLength' , 'viewBox' , 'viewTarget' , 'xChannelSelector' , 'yChannelSelector' ] . reduce ( ( map , attribute ) => {
// The keys are lower-cased for more robust lookup.
map [ attribute . toLowerCase ( ) ] = attribute ;
return map ;
} , { } ) ;
/ * *
* This is a map of all SVG attributes that have colons .
* Keys are lower - cased and stripped of their colons for more robust lookup .
* /
const SVG _ATTRIBUTES _WITH _COLONS = [ 'xlink:actuate' , 'xlink:arcrole' , 'xlink:href' , 'xlink:role' , 'xlink:show' , 'xlink:title' , 'xlink:type' , 'xml:base' , 'xml:lang' , 'xml:space' , 'xmlns:xlink' ] . reduce ( ( map , attribute ) => {
map [ attribute . replace ( ':' , '' ) . toLowerCase ( ) ] = attribute ;
return map ;
} , { } ) ;
2018-12-13 23:41:57 -05:00
/ * *
* Returns the normal form of the element ' s attribute name for HTML .
*
* @ param { string } attribute Non - normalized attribute name .
*
* @ return { string } Normalized attribute name .
* /
function getNormalAttributeName ( attribute ) {
switch ( attribute ) {
case 'htmlFor' :
return 'for' ;
case 'className' :
return 'class' ;
}
2022-04-12 11:12:47 -04:00
const attributeLowerCase = attribute . toLowerCase ( ) ;
if ( CASE _SENSITIVE _SVG _ATTRIBUTES [ attributeLowerCase ] ) {
return CASE _SENSITIVE _SVG _ATTRIBUTES [ attributeLowerCase ] ;
} else if ( SVG _ATTRIBUTE _WITH _DASHES _LIST [ attributeLowerCase ] ) {
2022-09-20 11:43:29 -04:00
return paramCase ( SVG _ATTRIBUTE _WITH _DASHES _LIST [ attributeLowerCase ] ) ;
2022-04-12 11:12:47 -04:00
} else if ( SVG _ATTRIBUTES _WITH _COLONS [ attributeLowerCase ] ) {
return SVG _ATTRIBUTES _WITH _COLONS [ attributeLowerCase ] ;
}
return attributeLowerCase ;
2018-12-13 23:41:57 -05:00
}
/ * *
* Returns the normal form of the style property name for HTML .
*
* - Converts property names to kebab - case , e . g . 'backgroundColor' → 'background-color'
* - Leaves custom attributes alone , e . g . '--myBackgroundColor' → '--myBackgroundColor'
* - Converts vendor - prefixed property names to - kebab - case , e . g . 'MozTransform' → '-moz-transform'
*
* @ param { string } property Property name .
*
* @ return { string } Normalized property name .
* /
function getNormalStylePropertyName ( property ) {
2022-09-20 11:43:29 -04:00
if ( property . startsWith ( '--' ) ) {
2018-12-13 23:41:57 -05:00
return property ;
}
if ( hasPrefix ( property , [ 'ms' , 'O' , 'Moz' , 'Webkit' ] ) ) {
2022-09-20 11:43:29 -04:00
return '-' + paramCase ( property ) ;
2018-12-13 23:41:57 -05:00
}
2022-09-20 11:43:29 -04:00
return paramCase ( property ) ;
2018-12-13 23:41:57 -05:00
}
/ * *
* Returns the normal form of the style property value for HTML . Appends a
* default pixel unit if numeric , not a unitless property , and not zero .
*
* @ param { string } property Property name .
* @ param { * } value Non - normalized property value .
*
* @ return { * } Normalized property value .
* /
function getNormalStylePropertyValue ( property , value ) {
if ( typeof value === 'number' && 0 !== value && ! CSS _PROPERTIES _SUPPORTS _UNITLESS . has ( property ) ) {
return value + 'px' ;
}
return value ;
}
/ * *
* Serializes a React element to string .
*
2020-06-26 09:33:47 -04:00
* @ param { import ( 'react' ) . ReactNode } element Element to serialize .
* @ param { Object } [ context ] Context object .
* @ param { Object } [ legacyContext ] Legacy context object .
2018-12-13 23:41:57 -05:00
*
* @ return { string } Serialized element .
* /
2021-11-15 07:50:17 -05:00
function renderElement ( element , context ) {
let legacyContext = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : { } ;
2018-12-13 23:41:57 -05:00
if ( null === element || undefined === element || false === element ) {
return '' ;
}
if ( Array . isArray ( element ) ) {
return renderChildren ( element , context , legacyContext ) ;
}
2021-05-19 11:09:27 -04:00
switch ( typeof element ) {
2018-12-13 23:41:57 -05:00
case 'string' :
2022-04-11 08:04:30 -04:00
return ( 0 , external _wp _escapeHtml _namespaceObject . escapeHTML ) ( element ) ;
2018-12-13 23:41:57 -05:00
case 'number' :
return element . toString ( ) ;
}
2021-05-19 11:09:27 -04:00
const {
type ,
props
} =
2020-06-26 09:33:47 -04:00
/** @type {{type?: any, props?: any}} */
2021-05-19 11:09:27 -04:00
element ;
2018-12-13 23:41:57 -05:00
switch ( type ) {
2022-04-11 08:04:30 -04:00
case external _React _namespaceObject . StrictMode :
case external _React _namespaceObject . Fragment :
2018-12-13 23:41:57 -05:00
return renderChildren ( props . children , context , legacyContext ) ;
2018-12-17 22:14:52 -05:00
case RawHTML :
2021-05-19 11:09:27 -04:00
const {
children ,
... wrapperProps
} = props ;
2022-09-20 11:43:29 -04:00
return renderNativeComponent ( ! Object . keys ( wrapperProps ) . length ? null : 'div' , { ... wrapperProps ,
2018-12-13 23:41:57 -05:00
dangerouslySetInnerHTML : {
_ _html : children
}
2021-05-19 11:09:27 -04:00
} , context , legacyContext ) ;
2018-12-13 23:41:57 -05:00
}
2021-05-19 11:09:27 -04:00
switch ( typeof type ) {
2018-12-13 23:41:57 -05:00
case 'string' :
return renderNativeComponent ( type , props , context , legacyContext ) ;
case 'function' :
if ( type . prototype && typeof type . prototype . render === 'function' ) {
return renderComponent ( type , props , context , legacyContext ) ;
}
return renderElement ( type ( props , legacyContext ) , context , legacyContext ) ;
}
switch ( type && type . $$typeof ) {
case Provider . $$typeof :
return renderChildren ( props . children , props . value , legacyContext ) ;
case Consumer . $$typeof :
return renderElement ( props . children ( context || type . _currentValue ) , context , legacyContext ) ;
2019-09-19 11:19:18 -04:00
case ForwardRef . $$typeof :
return renderElement ( type . render ( props ) , context , legacyContext ) ;
2018-12-13 23:41:57 -05:00
}
return '' ;
}
/ * *
* Serializes a native component type to string .
*
2020-06-26 09:33:47 -04:00
* @ param { ? string } type Native component type to serialize , or null if
* rendering as fragment of children content .
* @ param { Object } props Props object .
* @ param { Object } [ context ] Context object .
* @ param { Object } [ legacyContext ] Legacy context object .
2018-12-13 23:41:57 -05:00
*
* @ return { string } Serialized element .
* /
2021-11-15 07:50:17 -05:00
function renderNativeComponent ( type , props , context ) {
let legacyContext = arguments . length > 3 && arguments [ 3 ] !== undefined ? arguments [ 3 ] : { } ;
2021-05-19 11:09:27 -04:00
let content = '' ;
2018-12-13 23:41:57 -05:00
if ( type === 'textarea' && props . hasOwnProperty ( 'value' ) ) {
// Textarea children can be assigned as value prop. If it is, render in
// place of children. Ensure to omit so it is not assigned as attribute
// as well.
content = renderChildren ( props . value , context , legacyContext ) ;
2022-09-20 11:43:29 -04:00
const {
value ,
... restProps
} = props ;
props = restProps ;
2018-12-13 23:41:57 -05:00
} else if ( props . dangerouslySetInnerHTML && typeof props . dangerouslySetInnerHTML . _ _html === 'string' ) {
// Dangerous content is left unescaped.
content = props . dangerouslySetInnerHTML . _ _html ;
} else if ( typeof props . children !== 'undefined' ) {
content = renderChildren ( props . children , context , legacyContext ) ;
}
if ( ! type ) {
return content ;
}
2021-05-19 11:09:27 -04:00
const attributes = renderAttributes ( props ) ;
2018-12-13 23:41:57 -05:00
if ( SELF _CLOSING _TAGS . has ( type ) ) {
return '<' + type + attributes + '/>' ;
}
return '<' + type + attributes + '>' + content + '</' + type + '>' ;
}
2020-06-26 09:33:47 -04:00
/** @typedef {import('./react').WPComponent} WPComponent */
2018-12-13 23:41:57 -05:00
/ * *
* Serializes a non - native component type to string .
*
2020-06-26 09:33:47 -04:00
* @ param { WPComponent } Component Component type to serialize .
* @ param { Object } props Props object .
* @ param { Object } [ context ] Context object .
* @ param { Object } [ legacyContext ] Legacy context object .
2018-12-13 23:41:57 -05:00
*
* @ return { string } Serialized element
* /
2021-11-15 07:50:17 -05:00
function renderComponent ( Component , props , context ) {
let legacyContext = arguments . length > 3 && arguments [ 3 ] !== undefined ? arguments [ 3 ] : { } ;
2021-05-19 11:09:27 -04:00
const instance = new
2020-06-26 09:33:47 -04:00
/** @type {import('react').ComponentClass} */
Component ( props , legacyContext ) ;
if ( typeof // Ignore reason: Current prettier reformats parens and mangles type assertion
// prettier-ignore
/** @type {{getChildContext?: () => unknown}} */
instance . getChildContext === 'function' ) {
Object . assign ( legacyContext ,
/** @type {{getChildContext?: () => unknown}} */
instance . getChildContext ( ) ) ;
2018-12-13 23:41:57 -05:00
}
2021-05-19 11:09:27 -04:00
const html = renderElement ( instance . render ( ) , context , legacyContext ) ;
2018-12-13 23:41:57 -05:00
return html ;
}
/ * *
* Serializes an array of children to string .
*
2020-06-26 09:33:47 -04:00
* @ param { import ( 'react' ) . ReactNodeArray } children Children to serialize .
* @ param { Object } [ context ] Context object .
* @ param { Object } [ legacyContext ] Legacy context object .
2018-12-13 23:41:57 -05:00
*
* @ return { string } Serialized children .
* /
2021-11-15 07:50:17 -05:00
function renderChildren ( children , context ) {
let legacyContext = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : { } ;
2021-05-19 11:09:27 -04:00
let result = '' ;
2022-09-20 11:43:29 -04:00
children = Array . isArray ( children ) ? children : [ children ] ;
2018-12-13 23:41:57 -05:00
2021-05-19 11:09:27 -04:00
for ( let i = 0 ; i < children . length ; i ++ ) {
const child = children [ i ] ;
2018-12-13 23:41:57 -05:00
result += renderElement ( child , context , legacyContext ) ;
}
return result ;
}
/ * *
* Renders a props object as a string of HTML attributes .
*
* @ param { Object } props Props object .
*
* @ return { string } Attributes string .
* /
function renderAttributes ( props ) {
2021-05-19 11:09:27 -04:00
let result = '' ;
2018-12-13 23:41:57 -05:00
2021-05-19 11:09:27 -04:00
for ( const key in props ) {
const attribute = getNormalAttributeName ( key ) ;
2018-12-13 23:41:57 -05:00
2022-04-11 08:04:30 -04:00
if ( ! ( 0 , external _wp _escapeHtml _namespaceObject . isValidAttributeName ) ( attribute ) ) {
2018-12-13 23:41:57 -05:00
continue ;
}
2021-05-19 11:09:27 -04:00
let value = getNormalAttributeValue ( key , props [ key ] ) ; // If value is not of serializeable type, skip.
2018-12-13 23:41:57 -05:00
2021-05-19 11:09:27 -04:00
if ( ! ATTRIBUTES _TYPES . has ( typeof value ) ) {
2018-12-13 23:41:57 -05:00
continue ;
} // Don't render internal attribute names.
if ( isInternalAttribute ( key ) ) {
continue ;
}
2021-05-19 11:09:27 -04:00
const isBooleanAttribute = BOOLEAN _ATTRIBUTES . has ( attribute ) ; // Boolean attribute should be omitted outright if its value is false.
2018-12-13 23:41:57 -05:00
if ( isBooleanAttribute && value === false ) {
continue ;
}
2021-05-19 11:09:27 -04:00
const isMeaningfulAttribute = isBooleanAttribute || hasPrefix ( key , [ 'data-' , 'aria-' ] ) || ENUMERATED _ATTRIBUTES . has ( attribute ) ; // Only write boolean value as attribute if meaningful.
2018-12-13 23:41:57 -05:00
if ( typeof value === 'boolean' && ! isMeaningfulAttribute ) {
continue ;
}
result += ' ' + attribute ; // Boolean attributes should write attribute name, but without value.
// Mere presence of attribute name is effective truthiness.
if ( isBooleanAttribute ) {
continue ;
}
if ( typeof value === 'string' ) {
2022-04-11 08:04:30 -04:00
value = ( 0 , external _wp _escapeHtml _namespaceObject . escapeAttribute ) ( value ) ;
2018-12-13 23:41:57 -05:00
}
result += '="' + value + '"' ;
}
return result ;
}
/ * *
* Renders a style object as a string attribute value .
*
* @ param { Object } style Style object .
*
* @ return { string } Style attribute value .
* /
function renderStyle ( style ) {
// Only generate from object, e.g. tolerate string value.
2022-09-20 11:43:29 -04:00
if ( ! isPlainObject ( style ) ) {
2018-12-13 23:41:57 -05:00
return style ;
}
2021-05-19 11:09:27 -04:00
let result ;
2018-12-13 23:41:57 -05:00
2021-05-19 11:09:27 -04:00
for ( const property in style ) {
const value = style [ property ] ;
2018-12-13 23:41:57 -05:00
if ( null === value || undefined === value ) {
continue ;
}
if ( result ) {
result += ';' ;
} else {
result = '' ;
}
2021-05-19 11:09:27 -04:00
const normalName = getNormalStylePropertyName ( property ) ;
const normalValue = getNormalStylePropertyValue ( property , value ) ;
2018-12-13 23:41:57 -05:00
result += normalName + ':' + normalValue ;
}
return result ;
}
2018-12-17 22:14:52 -05:00
/* harmony default export */ var serialize = ( renderElement ) ;
2018-12-13 23:41:57 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/index.js
2018-12-13 23:41:57 -05:00
2020-01-08 06:57:23 -05:00
2018-12-13 23:41:57 -05:00
2022-04-11 08:04:30 -04:00
( window . wp = window . wp || { } ) . element = _ _webpack _exports _ _ ;
/******/ } ) ( )
;