You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1884 lines
66 KiB

1 year ago
  1. /******/ (function() { // webpackBootstrap
  2. /******/ "use strict";
  3. /******/ var __webpack_modules__ = ({
  4. /***/ 4470:
  5. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  6. var m = __webpack_require__(1850);
  7. if (true) {
  8. exports.s = m.createRoot;
  9. exports.a = m.hydrateRoot;
  10. } else { var i; }
  11. /***/ }),
  12. /***/ 1850:
  13. /***/ (function(module) {
  14. module.exports = window["ReactDOM"];
  15. /***/ })
  16. /******/ });
  17. /************************************************************************/
  18. /******/ // The module cache
  19. /******/ var __webpack_module_cache__ = {};
  20. /******/
  21. /******/ // The require function
  22. /******/ function __webpack_require__(moduleId) {
  23. /******/ // Check if module is in cache
  24. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  25. /******/ if (cachedModule !== undefined) {
  26. /******/ return cachedModule.exports;
  27. /******/ }
  28. /******/ // Create a new module (and put it into the cache)
  29. /******/ var module = __webpack_module_cache__[moduleId] = {
  30. /******/ // no module.id needed
  31. /******/ // no module.loaded needed
  32. /******/ exports: {}
  33. /******/ };
  34. /******/
  35. /******/ // Execute the module function
  36. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  37. /******/
  38. /******/ // Return the exports of the module
  39. /******/ return module.exports;
  40. /******/ }
  41. /******/
  42. /************************************************************************/
  43. /******/ /* webpack/runtime/define property getters */
  44. /******/ !function() {
  45. /******/ // define getter functions for harmony exports
  46. /******/ __webpack_require__.d = function(exports, definition) {
  47. /******/ for(var key in definition) {
  48. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  49. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  50. /******/ }
  51. /******/ }
  52. /******/ };
  53. /******/ }();
  54. /******/
  55. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  56. /******/ !function() {
  57. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  58. /******/ }();
  59. /******/
  60. /******/ /* webpack/runtime/make namespace object */
  61. /******/ !function() {
  62. /******/ // define __esModule on exports
  63. /******/ __webpack_require__.r = function(exports) {
  64. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  65. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  66. /******/ }
  67. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  68. /******/ };
  69. /******/ }();
  70. /******/
  71. /************************************************************************/
  72. var __webpack_exports__ = {};
  73. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  74. !function() {
  75. // ESM COMPAT FLAG
  76. __webpack_require__.r(__webpack_exports__);
  77. // EXPORTS
  78. __webpack_require__.d(__webpack_exports__, {
  79. Children: function() { return /* reexport */ external_React_namespaceObject.Children; },
  80. Component: function() { return /* reexport */ external_React_namespaceObject.Component; },
  81. Fragment: function() { return /* reexport */ external_React_namespaceObject.Fragment; },
  82. Platform: function() { return /* reexport */ platform; },
  83. RawHTML: function() { return /* reexport */ RawHTML; },
  84. StrictMode: function() { return /* reexport */ external_React_namespaceObject.StrictMode; },
  85. Suspense: function() { return /* reexport */ external_React_namespaceObject.Suspense; },
  86. cloneElement: function() { return /* reexport */ external_React_namespaceObject.cloneElement; },
  87. concatChildren: function() { return /* reexport */ concatChildren; },
  88. createContext: function() { return /* reexport */ external_React_namespaceObject.createContext; },
  89. createElement: function() { return /* reexport */ external_React_namespaceObject.createElement; },
  90. createInterpolateElement: function() { return /* reexport */ create_interpolate_element; },
  91. createPortal: function() { return /* reexport */ external_ReactDOM_.createPortal; },
  92. createRef: function() { return /* reexport */ external_React_namespaceObject.createRef; },
  93. createRoot: function() { return /* reexport */ client/* createRoot */.s; },
  94. findDOMNode: function() { return /* reexport */ external_ReactDOM_.findDOMNode; },
  95. flushSync: function() { return /* reexport */ external_ReactDOM_.flushSync; },
  96. forwardRef: function() { return /* reexport */ external_React_namespaceObject.forwardRef; },
  97. hydrate: function() { return /* reexport */ external_ReactDOM_.hydrate; },
  98. hydrateRoot: function() { return /* reexport */ client/* hydrateRoot */.a; },
  99. isEmptyElement: function() { return /* reexport */ isEmptyElement; },
  100. isValidElement: function() { return /* reexport */ external_React_namespaceObject.isValidElement; },
  101. lazy: function() { return /* reexport */ external_React_namespaceObject.lazy; },
  102. memo: function() { return /* reexport */ external_React_namespaceObject.memo; },
  103. render: function() { return /* reexport */ external_ReactDOM_.render; },
  104. renderToString: function() { return /* reexport */ serialize; },
  105. startTransition: function() { return /* reexport */ external_React_namespaceObject.startTransition; },
  106. switchChildrenNodeName: function() { return /* reexport */ switchChildrenNodeName; },
  107. unmountComponentAtNode: function() { return /* reexport */ external_ReactDOM_.unmountComponentAtNode; },
  108. useCallback: function() { return /* reexport */ external_React_namespaceObject.useCallback; },
  109. useContext: function() { return /* reexport */ external_React_namespaceObject.useContext; },
  110. useDebugValue: function() { return /* reexport */ external_React_namespaceObject.useDebugValue; },
  111. useDeferredValue: function() { return /* reexport */ external_React_namespaceObject.useDeferredValue; },
  112. useEffect: function() { return /* reexport */ external_React_namespaceObject.useEffect; },
  113. useId: function() { return /* reexport */ external_React_namespaceObject.useId; },
  114. useImperativeHandle: function() { return /* reexport */ external_React_namespaceObject.useImperativeHandle; },
  115. useInsertionEffect: function() { return /* reexport */ external_React_namespaceObject.useInsertionEffect; },
  116. useLayoutEffect: function() { return /* reexport */ external_React_namespaceObject.useLayoutEffect; },
  117. useMemo: function() { return /* reexport */ external_React_namespaceObject.useMemo; },
  118. useReducer: function() { return /* reexport */ external_React_namespaceObject.useReducer; },
  119. useRef: function() { return /* reexport */ external_React_namespaceObject.useRef; },
  120. useState: function() { return /* reexport */ external_React_namespaceObject.useState; },
  121. useSyncExternalStore: function() { return /* reexport */ external_React_namespaceObject.useSyncExternalStore; },
  122. useTransition: function() { return /* reexport */ external_React_namespaceObject.useTransition; }
  123. });
  124. ;// CONCATENATED MODULE: external "React"
  125. var external_React_namespaceObject = window["React"];
  126. ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/create-interpolate-element.js
  127. /**
  128. * Internal dependencies
  129. */
  130. /** @typedef {import('./react').WPElement} WPElement */
  131. let indoc, offset, output, stack;
  132. /**
  133. * Matches tags in the localized string
  134. *
  135. * This is used for extracting the tag pattern groups for parsing the localized
  136. * string and along with the map converting it to a react element.
  137. *
  138. * There are four references extracted using this tokenizer:
  139. *
  140. * match: Full match of the tag (i.e. <strong>, </strong>, <br/>)
  141. * isClosing: The closing slash, if it exists.
  142. * name: The name portion of the tag (strong, br) (if )
  143. * isSelfClosed: The slash on a self closing tag, if it exists.
  144. *
  145. * @type {RegExp}
  146. */
  147. const tokenizer = /<(\/)?(\w+)\s*(\/)?>/g;
  148. /**
  149. * The stack frame tracking parse progress.
  150. *
  151. * @typedef Frame
  152. *
  153. * @property {WPElement} element A parent element which may still have
  154. * @property {number} tokenStart Offset at which parent element first
  155. * appears.
  156. * @property {number} tokenLength Length of string marking start of parent
  157. * element.
  158. * @property {number} [prevOffset] Running offset at which parsing should
  159. * continue.
  160. * @property {number} [leadingTextStart] Offset at which last closing element
  161. * finished, used for finding text between
  162. * elements.
  163. * @property {WPElement[]} children Children.
  164. */
  165. /**
  166. * Tracks recursive-descent parse state.
  167. *
  168. * This is a Stack frame holding parent elements until all children have been
  169. * parsed.
  170. *
  171. * @private
  172. * @param {WPElement} element A parent element which may still have
  173. * nested children not yet parsed.
  174. * @param {number} tokenStart Offset at which parent element first
  175. * appears.
  176. * @param {number} tokenLength Length of string marking start of parent
  177. * element.
  178. * @param {number} [prevOffset] Running offset at which parsing should
  179. * continue.
  180. * @param {number} [leadingTextStart] Offset at which last closing element
  181. * finished, used for finding text between
  182. * elements.
  183. *
  184. * @return {Frame} The stack frame tracking parse progress.
  185. */
  186. function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextStart) {
  187. return {
  188. element,
  189. tokenStart,
  190. tokenLength,
  191. prevOffset,
  192. leadingTextStart,
  193. children: []
  194. };
  195. }
  196. /**
  197. * This function creates an interpolated element from a passed in string with
  198. * specific tags matching how the string should be converted to an element via
  199. * the conversion map value.
  200. *
  201. * @example
  202. * For example, for the given string:
  203. *
  204. * "This is a <span>string</span> with <a>a link</a> and a self-closing
  205. * <CustomComponentB/> tag"
  206. *
  207. * You would have something like this as the conversionMap value:
  208. *
  209. * ```js
  210. * {
  211. * span: <span />,
  212. * a: <a href={ 'https://github.com' } />,
  213. * CustomComponentB: <CustomComponent />,
  214. * }
  215. * ```
  216. *
  217. * @param {string} interpolatedString The interpolation string to be parsed.
  218. * @param {Record<string, WPElement>} conversionMap The map used to convert the string to
  219. * a react element.
  220. * @throws {TypeError}
  221. * @return {WPElement} A wp element.
  222. */
  223. const createInterpolateElement = (interpolatedString, conversionMap) => {
  224. indoc = interpolatedString;
  225. offset = 0;
  226. output = [];
  227. stack = [];
  228. tokenizer.lastIndex = 0;
  229. if (!isValidConversionMap(conversionMap)) {
  230. throw new TypeError('The conversionMap provided is not valid. It must be an object with values that are WPElements');
  231. }
  232. do {
  233. // twiddle our thumbs
  234. } while (proceed(conversionMap));
  235. return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, ...output);
  236. };
  237. /**
  238. * Validate conversion map.
  239. *
  240. * A map is considered valid if it's an object and every value in the object
  241. * is a WPElement
  242. *
  243. * @private
  244. *
  245. * @param {Object} conversionMap The map being validated.
  246. *
  247. * @return {boolean} True means the map is valid.
  248. */
  249. const isValidConversionMap = conversionMap => {
  250. const isObject = typeof conversionMap === 'object';
  251. const values = isObject && Object.values(conversionMap);
  252. return isObject && values.length && values.every(element => (0,external_React_namespaceObject.isValidElement)(element));
  253. };
  254. /**
  255. * This is the iterator over the matches in the string.
  256. *
  257. * @private
  258. *
  259. * @param {Object} conversionMap The conversion map for the string.
  260. *
  261. * @return {boolean} true for continuing to iterate, false for finished.
  262. */
  263. function proceed(conversionMap) {
  264. const next = nextToken();
  265. const [tokenType, name, startOffset, tokenLength] = next;
  266. const stackDepth = stack.length;
  267. const leadingTextStart = startOffset > offset ? offset : null;
  268. if (!conversionMap[name]) {
  269. addText();
  270. return false;
  271. }
  272. switch (tokenType) {
  273. case 'no-more-tokens':
  274. if (stackDepth !== 0) {
  275. const {
  276. leadingTextStart: stackLeadingText,
  277. tokenStart
  278. } = stack.pop();
  279. output.push(indoc.substr(stackLeadingText, tokenStart));
  280. }
  281. addText();
  282. return false;
  283. case 'self-closed':
  284. if (0 === stackDepth) {
  285. if (null !== leadingTextStart) {
  286. output.push(indoc.substr(leadingTextStart, startOffset - leadingTextStart));
  287. }
  288. output.push(conversionMap[name]);
  289. offset = startOffset + tokenLength;
  290. return true;
  291. }
  292. // Otherwise we found an inner element.
  293. addChild(createFrame(conversionMap[name], startOffset, tokenLength));
  294. offset = startOffset + tokenLength;
  295. return true;
  296. case 'opener':
  297. stack.push(createFrame(conversionMap[name], startOffset, tokenLength, startOffset + tokenLength, leadingTextStart));
  298. offset = startOffset + tokenLength;
  299. return true;
  300. case 'closer':
  301. // If we're not nesting then this is easy - close the block.
  302. if (1 === stackDepth) {
  303. closeOuterElement(startOffset);
  304. offset = startOffset + tokenLength;
  305. return true;
  306. }
  307. // Otherwise we're nested and we have to close out the current
  308. // block and add it as a innerBlock to the parent.
  309. const stackTop = stack.pop();
  310. const text = indoc.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset);
  311. stackTop.children.push(text);
  312. stackTop.prevOffset = startOffset + tokenLength;
  313. const frame = createFrame(stackTop.element, stackTop.tokenStart, stackTop.tokenLength, startOffset + tokenLength);
  314. frame.children = stackTop.children;
  315. addChild(frame);
  316. offset = startOffset + tokenLength;
  317. return true;
  318. default:
  319. addText();
  320. return false;
  321. }
  322. }
  323. /**
  324. * Grabs the next token match in the string and returns it's details.
  325. *
  326. * @private
  327. *
  328. * @return {Array} An array of details for the token matched.
  329. */
  330. function nextToken() {
  331. const matches = tokenizer.exec(indoc);
  332. // We have no more tokens.
  333. if (null === matches) {
  334. return ['no-more-tokens'];
  335. }
  336. const startedAt = matches.index;
  337. const [match, isClosing, name, isSelfClosed] = matches;
  338. const length = match.length;
  339. if (isSelfClosed) {
  340. return ['self-closed', name, startedAt, length];
  341. }
  342. if (isClosing) {
  343. return ['closer', name, startedAt, length];
  344. }
  345. return ['opener', name, startedAt, length];
  346. }
  347. /**
  348. * Pushes text extracted from the indoc string to the output stack given the
  349. * current rawLength value and offset (if rawLength is provided ) or the
  350. * indoc.length and offset.
  351. *
  352. * @private
  353. */
  354. function addText() {
  355. const length = indoc.length - offset;
  356. if (0 === length) {
  357. return;
  358. }
  359. output.push(indoc.substr(offset, length));
  360. }
  361. /**
  362. * Pushes a child element to the associated parent element's children for the
  363. * parent currently active in the stack.
  364. *
  365. * @private
  366. *
  367. * @param {Frame} frame The Frame containing the child element and it's
  368. * token information.
  369. */
  370. function addChild(frame) {
  371. const {
  372. element,
  373. tokenStart,
  374. tokenLength,
  375. prevOffset,
  376. children
  377. } = frame;
  378. const parent = stack[stack.length - 1];
  379. const text = indoc.substr(parent.prevOffset, tokenStart - parent.prevOffset);
  380. if (text) {
  381. parent.children.push(text);
  382. }
  383. parent.children.push((0,external_React_namespaceObject.cloneElement)(element, null, ...children));
  384. parent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength;
  385. }
  386. /**
  387. * This is called for closing tags. It creates the element currently active in
  388. * the stack.
  389. *
  390. * @private
  391. *
  392. * @param {number} endOffset Offset at which the closing tag for the element
  393. * begins in the string. If this is greater than the
  394. * prevOffset attached to the element, then this
  395. * helps capture any remaining nested text nodes in
  396. * the element.
  397. */
  398. function closeOuterElement(endOffset) {
  399. const {
  400. element,
  401. leadingTextStart,
  402. prevOffset,
  403. tokenStart,
  404. children
  405. } = stack.pop();
  406. const text = endOffset ? indoc.substr(prevOffset, endOffset - prevOffset) : indoc.substr(prevOffset);
  407. if (text) {
  408. children.push(text);
  409. }
  410. if (null !== leadingTextStart) {
  411. output.push(indoc.substr(leadingTextStart, tokenStart - leadingTextStart));
  412. }
  413. output.push((0,external_React_namespaceObject.cloneElement)(element, null, ...children));
  414. }
  415. /* harmony default export */ var create_interpolate_element = (createInterpolateElement);
  416. ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react.js
  417. /**
  418. * External dependencies
  419. */
  420. // eslint-disable-next-line @typescript-eslint/no-restricted-imports
  421. /**
  422. * Object containing a React element.
  423. *
  424. * @typedef {import('react').ReactElement} WPElement
  425. */
  426. /**
  427. * Object containing a React component.
  428. *
  429. * @typedef {import('react').ComponentType} WPComponent
  430. */
  431. /**
  432. * Object containing a React synthetic event.
  433. *
  434. * @typedef {import('react').SyntheticEvent} WPSyntheticEvent
  435. */
  436. /**
  437. * Object containing a React synthetic event.
  438. *
  439. * @template T
  440. * @typedef {import('react').RefObject<T>} RefObject<T>
  441. */
  442. /**
  443. * Object that provides utilities for dealing with React children.
  444. */
  445. /**
  446. * Creates a copy of an element with extended props.
  447. *
  448. * @param {WPElement} element Element
  449. * @param {?Object} props Props to apply to cloned element
  450. *
  451. * @return {WPElement} Cloned element.
  452. */
  453. /**
  454. * A base class to create WordPress Components (Refs, state and lifecycle hooks)
  455. */
  456. /**
  457. * Creates a context object containing two components: a provider and consumer.
  458. *
  459. * @param {Object} defaultValue A default data stored in the context.
  460. *
  461. * @return {Object} Context object.
  462. */
  463. /**
  464. * Returns a new element of given type. Type can be either a string tag name or
  465. * another function which itself returns an element.
  466. *
  467. * @param {?(string|Function)} type Tag name or element creator
  468. * @param {Object} props Element properties, either attribute
  469. * set to apply to DOM node or values to
  470. * pass through to element creator
  471. * @param {...WPElement} children Descendant elements
  472. *
  473. * @return {WPElement} Element.
  474. */
  475. /**
  476. * Returns an object tracking a reference to a rendered element via its
  477. * `current` property as either a DOMElement or Element, dependent upon the
  478. * type of element rendered with the ref attribute.
  479. *
  480. * @return {Object} Ref object.
  481. */
  482. /**
  483. * Component enhancer used to enable passing a ref to its wrapped component.
  484. * Pass a function argument which receives `props` and `ref` as its arguments,
  485. * returning an element using the forwarded ref. The return value is a new
  486. * component which forwards its ref.
  487. *
  488. * @param {Function} forwarder Function passed `props` and `ref`, expected to
  489. * return an element.
  490. *
  491. * @return {WPComponent} Enhanced component.
  492. */
  493. /**
  494. * A component which renders its children without any wrapping element.
  495. */
  496. /**
  497. * Checks if an object is a valid WPElement.
  498. *
  499. * @param {Object} objectToCheck The object to be checked.
  500. *
  501. * @return {boolean} true if objectToTest is a valid WPElement and false otherwise.
  502. */
  503. /**
  504. * @see https://reactjs.org/docs/react-api.html#reactmemo
  505. */
  506. /**
  507. * Component that activates additional checks and warnings for its descendants.
  508. */
  509. /**
  510. * @see https://reactjs.org/docs/hooks-reference.html#usecallback
  511. */
  512. /**
  513. * @see https://reactjs.org/docs/hooks-reference.html#usecontext
  514. */
  515. /**
  516. * @see https://reactjs.org/docs/hooks-reference.html#usedebugvalue
  517. */
  518. /**
  519. * @see https://reactjs.org/docs/hooks-reference.html#usedeferredvalue
  520. */
  521. /**
  522. * @see https://reactjs.org/docs/hooks-reference.html#useeffect
  523. */
  524. /**
  525. * @see https://reactjs.org/docs/hooks-reference.html#useid
  526. */
  527. /**
  528. * @see https://reactjs.org/docs/hooks-reference.html#useimperativehandle
  529. */
  530. /**
  531. * @see https://reactjs.org/docs/hooks-reference.html#useinsertioneffect
  532. */
  533. /**
  534. * @see https://reactjs.org/docs/hooks-reference.html#uselayouteffect
  535. */
  536. /**
  537. * @see https://reactjs.org/docs/hooks-reference.html#usememo
  538. */
  539. /**
  540. * @see https://reactjs.org/docs/hooks-reference.html#usereducer
  541. */
  542. /**
  543. * @see https://reactjs.org/docs/hooks-reference.html#useref
  544. */
  545. /**
  546. * @see https://reactjs.org/docs/hooks-reference.html#usestate
  547. */
  548. /**
  549. * @see https://reactjs.org/docs/hooks-reference.html#usesyncexternalstore
  550. */
  551. /**
  552. * @see https://reactjs.org/docs/hooks-reference.html#usetransition
  553. */
  554. /**
  555. * @see https://reactjs.org/docs/react-api.html#starttransition
  556. */
  557. /**
  558. * @see https://reactjs.org/docs/react-api.html#reactlazy
  559. */
  560. /**
  561. * @see https://reactjs.org/docs/react-api.html#reactsuspense
  562. */
  563. /**
  564. * Concatenate two or more React children objects.
  565. *
  566. * @param {...?Object} childrenArguments Array of children arguments (array of arrays/strings/objects) to concatenate.
  567. *
  568. * @return {Array} The concatenated value.
  569. */
  570. function concatChildren(...childrenArguments) {
  571. return childrenArguments.reduce((accumulator, children, i) => {
  572. external_React_namespaceObject.Children.forEach(children, (child, j) => {
  573. if (child && 'string' !== typeof child) {
  574. child = (0,external_React_namespaceObject.cloneElement)(child, {
  575. key: [i, j].join()
  576. });
  577. }
  578. accumulator.push(child);
  579. });
  580. return accumulator;
  581. }, []);
  582. }
  583. /**
  584. * Switches the nodeName of all the elements in the children object.
  585. *
  586. * @param {?Object} children Children object.
  587. * @param {string} nodeName Node name.
  588. *
  589. * @return {?Object} The updated children object.
  590. */
  591. function switchChildrenNodeName(children, nodeName) {
  592. return children && external_React_namespaceObject.Children.map(children, (elt, index) => {
  593. if (typeof elt?.valueOf() === 'string') {
  594. return (0,external_React_namespaceObject.createElement)(nodeName, {
  595. key: index
  596. }, elt);
  597. }
  598. const {
  599. children: childrenProp,
  600. ...props
  601. } = elt.props;
  602. return (0,external_React_namespaceObject.createElement)(nodeName, {
  603. key: index,
  604. ...props
  605. }, childrenProp);
  606. });
  607. }
  608. // EXTERNAL MODULE: external "ReactDOM"
  609. var external_ReactDOM_ = __webpack_require__(1850);
  610. // EXTERNAL MODULE: ./node_modules/react-dom/client.js
  611. var client = __webpack_require__(4470);
  612. ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react-platform.js
  613. /**
  614. * External dependencies
  615. */
  616. /**
  617. * Creates a portal into which a component can be rendered.
  618. *
  619. * @see https://github.com/facebook/react/issues/10309#issuecomment-318433235
  620. *
  621. * @param {import('./react').WPElement} child Any renderable child, such as an element,
  622. * string, or fragment.
  623. * @param {HTMLElement} container DOM node into which element should be rendered.
  624. */
  625. /**
  626. * Finds the dom node of a React component.
  627. *
  628. * @param {import('./react').WPComponent} component Component's instance.
  629. */
  630. /**
  631. * Forces React to flush any updates inside the provided callback synchronously.
  632. *
  633. * @param {Function} callback Callback to run synchronously.
  634. */
  635. /**
  636. * Renders a given element into the target DOM node.
  637. *
  638. * @deprecated since WordPress 6.2.0. Use `createRoot` instead.
  639. * @see https://react.dev/reference/react-dom/render
  640. */
  641. /**
  642. * Hydrates a given element into the target DOM node.
  643. *
  644. * @deprecated since WordPress 6.2.0. Use `hydrateRoot` instead.
  645. * @see https://react.dev/reference/react-dom/hydrate
  646. */
  647. /**
  648. * Creates a new React root for the target DOM node.
  649. *
  650. * @since 6.2.0 Introduced in WordPress core.
  651. * @see https://react.dev/reference/react-dom/client/createRoot
  652. */
  653. /**
  654. * Creates a new React root for the target DOM node and hydrates it with a pre-generated markup.
  655. *
  656. * @since 6.2.0 Introduced in WordPress core.
  657. * @see https://react.dev/reference/react-dom/client/hydrateRoot
  658. */
  659. /**
  660. * Removes any mounted element from the target DOM node.
  661. *
  662. * @deprecated since WordPress 6.2.0. Use `root.unmount()` instead.
  663. * @see https://react.dev/reference/react-dom/unmountComponentAtNode
  664. */
  665. ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/utils.js
  666. /**
  667. * Checks if the provided WP element is empty.
  668. *
  669. * @param {*} element WP element to check.
  670. * @return {boolean} True when an element is considered empty.
  671. */
  672. const isEmptyElement = element => {
  673. if (typeof element === 'number') {
  674. return false;
  675. }
  676. if (typeof element?.valueOf() === 'string' || Array.isArray(element)) {
  677. return !element.length;
  678. }
  679. return !element;
  680. };
  681. ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/platform.js
  682. /**
  683. * Parts of this source were derived and modified from react-native-web,
  684. * released under the MIT license.
  685. *
  686. * Copyright (c) 2016-present, Nicolas Gallagher.
  687. * Copyright (c) 2015-present, Facebook, Inc.
  688. *
  689. */
  690. const Platform = {
  691. OS: 'web',
  692. select: spec => 'web' in spec ? spec.web : spec.default,
  693. isWeb: true
  694. };
  695. /**
  696. * Component used to detect the current Platform being used.
  697. * Use Platform.OS === 'web' to detect if running on web enviroment.
  698. *
  699. * This is the same concept as the React Native implementation.
  700. *
  701. * @see https://facebook.github.io/react-native/docs/platform-specific-code#platform-module
  702. *
  703. * Here is an example of how to use the select method:
  704. * @example
  705. * ```js
  706. * import { Platform } from '@wordpress/element';
  707. *
  708. * const placeholderLabel = Platform.select( {
  709. * native: __( 'Add media' ),
  710. * web: __( 'Drag images, upload new ones or select files from your library.' ),
  711. * } );
  712. * ```
  713. */
  714. /* harmony default export */ var platform = (Platform);
  715. ;// CONCATENATED MODULE: ./node_modules/is-plain-object/dist/is-plain-object.mjs
  716. /*!
  717. * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
  718. *
  719. * Copyright (c) 2014-2017, Jon Schlinkert.
  720. * Released under the MIT License.
  721. */
  722. function isObject(o) {
  723. return Object.prototype.toString.call(o) === '[object Object]';
  724. }
  725. function isPlainObject(o) {
  726. var ctor,prot;
  727. if (isObject(o) === false) return false;
  728. // If has modified constructor
  729. ctor = o.constructor;
  730. if (ctor === undefined) return true;
  731. // If has modified prototype
  732. prot = ctor.prototype;
  733. if (isObject(prot) === false) return false;
  734. // If constructor does not have an Object-specific method
  735. if (prot.hasOwnProperty('isPrototypeOf') === false) {
  736. return false;
  737. }
  738. // Most likely a plain Object
  739. return true;
  740. }
  741. ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
  742. /******************************************************************************
  743. Copyright (c) Microsoft Corporation.
  744. Permission to use, copy, modify, and/or distribute this software for any
  745. purpose with or without fee is hereby granted.
  746. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  747. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  748. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  749. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  750. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  751. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  752. PERFORMANCE OF THIS SOFTWARE.
  753. ***************************************************************************** */
  754. /* global Reflect, Promise, SuppressedError, Symbol */
  755. var extendStatics = function(d, b) {
  756. extendStatics = Object.setPrototypeOf ||
  757. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  758. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  759. return extendStatics(d, b);
  760. };
  761. function __extends(d, b) {
  762. if (typeof b !== "function" && b !== null)
  763. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  764. extendStatics(d, b);
  765. function __() { this.constructor = d; }
  766. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  767. }
  768. var __assign = function() {
  769. __assign = Object.assign || function __assign(t) {
  770. for (var s, i = 1, n = arguments.length; i < n; i++) {
  771. s = arguments[i];
  772. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  773. }
  774. return t;
  775. }
  776. return __assign.apply(this, arguments);
  777. }
  778. function __rest(s, e) {
  779. var t = {};
  780. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  781. t[p] = s[p];
  782. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  783. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  784. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  785. t[p[i]] = s[p[i]];
  786. }
  787. return t;
  788. }
  789. function __decorate(decorators, target, key, desc) {
  790. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  791. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  792. 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;
  793. return c > 3 && r && Object.defineProperty(target, key, r), r;
  794. }
  795. function __param(paramIndex, decorator) {
  796. return function (target, key) { decorator(target, key, paramIndex); }
  797. }
  798. function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
  799. function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
  800. var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
  801. var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
  802. var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
  803. var _, done = false;
  804. for (var i = decorators.length - 1; i >= 0; i--) {
  805. var context = {};
  806. for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
  807. for (var p in contextIn.access) context.access[p] = contextIn.access[p];
  808. context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
  809. var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
  810. if (kind === "accessor") {
  811. if (result === void 0) continue;
  812. if (result === null || typeof result !== "object") throw new TypeError("Object expected");
  813. if (_ = accept(result.get)) descriptor.get = _;
  814. if (_ = accept(result.set)) descriptor.set = _;
  815. if (_ = accept(result.init)) initializers.unshift(_);
  816. }
  817. else if (_ = accept(result)) {
  818. if (kind === "field") initializers.unshift(_);
  819. else descriptor[key] = _;
  820. }
  821. }
  822. if (target) Object.defineProperty(target, contextIn.name, descriptor);
  823. done = true;
  824. };
  825. function __runInitializers(thisArg, initializers, value) {
  826. var useValue = arguments.length > 2;
  827. for (var i = 0; i < initializers.length; i++) {
  828. value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
  829. }
  830. return useValue ? value : void 0;
  831. };
  832. function __propKey(x) {
  833. return typeof x === "symbol" ? x : "".concat(x);
  834. };
  835. function __setFunctionName(f, name, prefix) {
  836. if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
  837. return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
  838. };
  839. function __metadata(metadataKey, metadataValue) {
  840. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  841. }
  842. function __awaiter(thisArg, _arguments, P, generator) {
  843. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  844. return new (P || (P = Promise))(function (resolve, reject) {
  845. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  846. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  847. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  848. step((generator = generator.apply(thisArg, _arguments || [])).next());
  849. });
  850. }
  851. function __generator(thisArg, body) {
  852. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  853. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  854. function verb(n) { return function (v) { return step([n, v]); }; }
  855. function step(op) {
  856. if (f) throw new TypeError("Generator is already executing.");
  857. while (g && (g = 0, op[0] && (_ = 0)), _) try {
  858. 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;
  859. if (y = 0, t) op = [op[0] & 2, t.value];
  860. switch (op[0]) {
  861. case 0: case 1: t = op; break;
  862. case 4: _.label++; return { value: op[1], done: false };
  863. case 5: _.label++; y = op[1]; op = [0]; continue;
  864. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  865. default:
  866. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  867. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  868. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  869. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  870. if (t[2]) _.ops.pop();
  871. _.trys.pop(); continue;
  872. }
  873. op = body.call(thisArg, _);
  874. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  875. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  876. }
  877. }
  878. var __createBinding = Object.create ? (function(o, m, k, k2) {
  879. if (k2 === undefined) k2 = k;
  880. var desc = Object.getOwnPropertyDescriptor(m, k);
  881. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  882. desc = { enumerable: true, get: function() { return m[k]; } };
  883. }
  884. Object.defineProperty(o, k2, desc);
  885. }) : (function(o, m, k, k2) {
  886. if (k2 === undefined) k2 = k;
  887. o[k2] = m[k];
  888. });
  889. function __exportStar(m, o) {
  890. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
  891. }
  892. function __values(o) {
  893. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  894. if (m) return m.call(o);
  895. if (o && typeof o.length === "number") return {
  896. next: function () {
  897. if (o && i >= o.length) o = void 0;
  898. return { value: o && o[i++], done: !o };
  899. }
  900. };
  901. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  902. }
  903. function __read(o, n) {
  904. var m = typeof Symbol === "function" && o[Symbol.iterator];
  905. if (!m) return o;
  906. var i = m.call(o), r, ar = [], e;
  907. try {
  908. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  909. }
  910. catch (error) { e = { error: error }; }
  911. finally {
  912. try {
  913. if (r && !r.done && (m = i["return"])) m.call(i);
  914. }
  915. finally { if (e) throw e.error; }
  916. }
  917. return ar;
  918. }
  919. /** @deprecated */
  920. function __spread() {
  921. for (var ar = [], i = 0; i < arguments.length; i++)
  922. ar = ar.concat(__read(arguments[i]));
  923. return ar;
  924. }
  925. /** @deprecated */
  926. function __spreadArrays() {
  927. for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
  928. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  929. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  930. r[k] = a[j];
  931. return r;
  932. }
  933. function __spreadArray(to, from, pack) {
  934. if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
  935. if (ar || !(i in from)) {
  936. if (!ar) ar = Array.prototype.slice.call(from, 0, i);
  937. ar[i] = from[i];
  938. }
  939. }
  940. return to.concat(ar || Array.prototype.slice.call(from));
  941. }
  942. function __await(v) {
  943. return this instanceof __await ? (this.v = v, this) : new __await(v);
  944. }
  945. function __asyncGenerator(thisArg, _arguments, generator) {
  946. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  947. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  948. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  949. 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); }); }; }
  950. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  951. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  952. function fulfill(value) { resume("next", value); }
  953. function reject(value) { resume("throw", value); }
  954. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  955. }
  956. function __asyncDelegator(o) {
  957. var i, p;
  958. return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
  959. function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
  960. }
  961. function __asyncValues(o) {
  962. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  963. var m = o[Symbol.asyncIterator], i;
  964. 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);
  965. 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); }); }; }
  966. function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  967. }
  968. function __makeTemplateObject(cooked, raw) {
  969. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  970. return cooked;
  971. };
  972. var __setModuleDefault = Object.create ? (function(o, v) {
  973. Object.defineProperty(o, "default", { enumerable: true, value: v });
  974. }) : function(o, v) {
  975. o["default"] = v;
  976. };
  977. function __importStar(mod) {
  978. if (mod && mod.__esModule) return mod;
  979. var result = {};
  980. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  981. __setModuleDefault(result, mod);
  982. return result;
  983. }
  984. function __importDefault(mod) {
  985. return (mod && mod.__esModule) ? mod : { default: mod };
  986. }
  987. function __classPrivateFieldGet(receiver, state, kind, f) {
  988. if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
  989. 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");
  990. return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
  991. }
  992. function __classPrivateFieldSet(receiver, state, value, kind, f) {
  993. if (kind === "m") throw new TypeError("Private method is not writable");
  994. if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
  995. 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");
  996. return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
  997. }
  998. function __classPrivateFieldIn(state, receiver) {
  999. if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
  1000. return typeof state === "function" ? receiver === state : state.has(receiver);
  1001. }
  1002. function __addDisposableResource(env, value, async) {
  1003. if (value !== null && value !== void 0) {
  1004. if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
  1005. var dispose;
  1006. if (async) {
  1007. if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
  1008. dispose = value[Symbol.asyncDispose];
  1009. }
  1010. if (dispose === void 0) {
  1011. if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
  1012. dispose = value[Symbol.dispose];
  1013. }
  1014. if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
  1015. env.stack.push({ value: value, dispose: dispose, async: async });
  1016. }
  1017. else if (async) {
  1018. env.stack.push({ async: true });
  1019. }
  1020. return value;
  1021. }
  1022. var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
  1023. var e = new Error(message);
  1024. return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
  1025. };
  1026. function __disposeResources(env) {
  1027. function fail(e) {
  1028. env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
  1029. env.hasError = true;
  1030. }
  1031. function next() {
  1032. while (env.stack.length) {
  1033. var rec = env.stack.pop();
  1034. try {
  1035. var result = rec.dispose && rec.dispose.call(rec.value);
  1036. if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
  1037. }
  1038. catch (e) {
  1039. fail(e);
  1040. }
  1041. }
  1042. if (env.hasError) throw env.error;
  1043. }
  1044. return next();
  1045. }
  1046. /* harmony default export */ var tslib_es6 = ({
  1047. __extends,
  1048. __assign,
  1049. __rest,
  1050. __decorate,
  1051. __param,
  1052. __metadata,
  1053. __awaiter,
  1054. __generator,
  1055. __createBinding,
  1056. __exportStar,
  1057. __values,
  1058. __read,
  1059. __spread,
  1060. __spreadArrays,
  1061. __spreadArray,
  1062. __await,
  1063. __asyncGenerator,
  1064. __asyncDelegator,
  1065. __asyncValues,
  1066. __makeTemplateObject,
  1067. __importStar,
  1068. __importDefault,
  1069. __classPrivateFieldGet,
  1070. __classPrivateFieldSet,
  1071. __classPrivateFieldIn,
  1072. __addDisposableResource,
  1073. __disposeResources,
  1074. });
  1075. ;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
  1076. /**
  1077. * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
  1078. */
  1079. var SUPPORTED_LOCALE = {
  1080. tr: {
  1081. regexp: /\u0130|\u0049|\u0049\u0307/g,
  1082. map: {
  1083. İ: "\u0069",
  1084. I: "\u0131",
  1085. : "\u0069",
  1086. },
  1087. },
  1088. az: {
  1089. regexp: /\u0130/g,
  1090. map: {
  1091. İ: "\u0069",
  1092. I: "\u0131",
  1093. : "\u0069",
  1094. },
  1095. },
  1096. lt: {
  1097. regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
  1098. map: {
  1099. I: "\u0069\u0307",
  1100. J: "\u006A\u0307",
  1101. Į: "\u012F\u0307",
  1102. Ì: "\u0069\u0307\u0300",
  1103. Í: "\u0069\u0307\u0301",
  1104. Ĩ: "\u0069\u0307\u0303",
  1105. },
  1106. },
  1107. };
  1108. /**
  1109. * Localized lower case.
  1110. */
  1111. function localeLowerCase(str, locale) {
  1112. var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
  1113. if (lang)
  1114. return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
  1115. return lowerCase(str);
  1116. }
  1117. /**
  1118. * Lower case as a function.
  1119. */
  1120. function lowerCase(str) {
  1121. return str.toLowerCase();
  1122. }
  1123. ;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
  1124. // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
  1125. var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
  1126. // Remove all non-word characters.
  1127. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
  1128. /**
  1129. * Normalize the string into something other libraries can manipulate easier.
  1130. */
  1131. function noCase(input, options) {
  1132. if (options === void 0) { options = {}; }
  1133. 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;
  1134. var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
  1135. var start = 0;
  1136. var end = result.length;
  1137. // Trim the delimiter from around the output string.
  1138. while (result.charAt(start) === "\0")
  1139. start++;
  1140. while (result.charAt(end - 1) === "\0")
  1141. end--;
  1142. // Transform each token independently.
  1143. return result.slice(start, end).split("\0").map(transform).join(delimiter);
  1144. }
  1145. /**
  1146. * Replace `re` in the input string with the replacement value.
  1147. */
  1148. function replace(input, re, value) {
  1149. if (re instanceof RegExp)
  1150. return input.replace(re, value);
  1151. return re.reduce(function (input, re) { return input.replace(re, value); }, input);
  1152. }
  1153. ;// CONCATENATED MODULE: ./node_modules/dot-case/dist.es2015/index.js
  1154. function dotCase(input, options) {
  1155. if (options === void 0) { options = {}; }
  1156. return noCase(input, __assign({ delimiter: "." }, options));
  1157. }
  1158. ;// CONCATENATED MODULE: ./node_modules/param-case/dist.es2015/index.js
  1159. function paramCase(input, options) {
  1160. if (options === void 0) { options = {}; }
  1161. return dotCase(input, __assign({ delimiter: "-" }, options));
  1162. }
  1163. ;// CONCATENATED MODULE: external ["wp","escapeHtml"]
  1164. var external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"];
  1165. ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/raw-html.js
  1166. /**
  1167. * Internal dependencies
  1168. */
  1169. /** @typedef {{children: string} & import('react').ComponentPropsWithoutRef<'div'>} RawHTMLProps */
  1170. /**
  1171. * Component used as equivalent of Fragment with unescaped HTML, in cases where
  1172. * it is desirable to render dangerous HTML without needing a wrapper element.
  1173. * To preserve additional props, a `div` wrapper _will_ be created if any props
  1174. * aside from `children` are passed.
  1175. *
  1176. * @param {RawHTMLProps} props Children should be a string of HTML or an array
  1177. * of strings. Other props will be passed through
  1178. * to the div wrapper.
  1179. *
  1180. * @return {JSX.Element} Dangerously-rendering component.
  1181. */
  1182. function RawHTML({
  1183. children,
  1184. ...props
  1185. }) {
  1186. let rawHtml = '';
  1187. // Cast children as an array, and concatenate each element if it is a string.
  1188. external_React_namespaceObject.Children.toArray(children).forEach(child => {
  1189. if (typeof child === 'string' && child.trim() !== '') {
  1190. rawHtml += child;
  1191. }
  1192. });
  1193. // The `div` wrapper will be stripped by the `renderElement` serializer in
  1194. // `./serialize.js` unless there are non-children props present.
  1195. return (0,external_React_namespaceObject.createElement)('div', {
  1196. dangerouslySetInnerHTML: {
  1197. __html: rawHtml
  1198. },
  1199. ...props
  1200. });
  1201. }
  1202. ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/serialize.js
  1203. /**
  1204. * Parts of this source were derived and modified from fast-react-render,
  1205. * released under the MIT license.
  1206. *
  1207. * https://github.com/alt-j/fast-react-render
  1208. *
  1209. * Copyright (c) 2016 Andrey Morozov
  1210. *
  1211. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1212. * of this software and associated documentation files (the "Software"), to deal
  1213. * in the Software without restriction, including without limitation the rights
  1214. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1215. * copies of the Software, and to permit persons to whom the Software is
  1216. * furnished to do so, subject to the following conditions:
  1217. *
  1218. * The above copyright notice and this permission notice shall be included in
  1219. * all copies or substantial portions of the Software.
  1220. *
  1221. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1222. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1223. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1224. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1225. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1226. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1227. * THE SOFTWARE.
  1228. */
  1229. /**
  1230. * External dependencies
  1231. */
  1232. /**
  1233. * WordPress dependencies
  1234. */
  1235. /**
  1236. * Internal dependencies
  1237. */
  1238. /** @typedef {import('./react').WPElement} WPElement */
  1239. const {
  1240. Provider,
  1241. Consumer
  1242. } = (0,external_React_namespaceObject.createContext)(undefined);
  1243. const ForwardRef = (0,external_React_namespaceObject.forwardRef)(() => {
  1244. return null;
  1245. });
  1246. /**
  1247. * Valid attribute types.
  1248. *
  1249. * @type {Set<string>}
  1250. */
  1251. const ATTRIBUTES_TYPES = new Set(['string', 'boolean', 'number']);
  1252. /**
  1253. * Element tags which can be self-closing.
  1254. *
  1255. * @type {Set<string>}
  1256. */
  1257. const SELF_CLOSING_TAGS = new Set(['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']);
  1258. /**
  1259. * Boolean attributes are attributes whose presence as being assigned is
  1260. * meaningful, even if only empty.
  1261. *
  1262. * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes
  1263. * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3
  1264. *
  1265. * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]
  1266. * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 )
  1267. * .reduce( ( result, tr ) => Object.assign( result, {
  1268. * [ tr.firstChild.textContent.trim() ]: true
  1269. * } ), {} ) ).sort();
  1270. *
  1271. * @type {Set<string>}
  1272. */
  1273. 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']);
  1274. /**
  1275. * Enumerated attributes are attributes which must be of a specific value form.
  1276. * Like boolean attributes, these are meaningful if specified, even if not of a
  1277. * valid enumerated value.
  1278. *
  1279. * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute
  1280. * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3
  1281. *
  1282. * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]
  1283. * .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) )
  1284. * .reduce( ( result, tr ) => Object.assign( result, {
  1285. * [ tr.firstChild.textContent.trim() ]: true
  1286. * } ), {} ) ).sort();
  1287. *
  1288. * Some notable omissions:
  1289. *
  1290. * - `alt`: https://blog.whatwg.org/omit-alt
  1291. *
  1292. * @type {Set<string>}
  1293. */
  1294. 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']);
  1295. /**
  1296. * Set of CSS style properties which support assignment of unitless numbers.
  1297. * Used in rendering of style properties, where `px` unit is assumed unless
  1298. * property is included in this set or value is zero.
  1299. *
  1300. * Generated via:
  1301. *
  1302. * Object.entries( document.createElement( 'div' ).style )
  1303. * .filter( ( [ key ] ) => (
  1304. * ! /^(webkit|ms|moz)/.test( key ) &&
  1305. * ( e.style[ key ] = 10 ) &&
  1306. * e.style[ key ] === '10'
  1307. * ) )
  1308. * .map( ( [ key ] ) => key )
  1309. * .sort();
  1310. *
  1311. * @type {Set<string>}
  1312. */
  1313. 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']);
  1314. /**
  1315. * Returns true if the specified string is prefixed by one of an array of
  1316. * possible prefixes.
  1317. *
  1318. * @param {string} string String to check.
  1319. * @param {string[]} prefixes Possible prefixes.
  1320. *
  1321. * @return {boolean} Whether string has prefix.
  1322. */
  1323. function hasPrefix(string, prefixes) {
  1324. return prefixes.some(prefix => string.indexOf(prefix) === 0);
  1325. }
  1326. /**
  1327. * Returns true if the given prop name should be ignored in attributes
  1328. * serialization, or false otherwise.
  1329. *
  1330. * @param {string} attribute Attribute to check.
  1331. *
  1332. * @return {boolean} Whether attribute should be ignored.
  1333. */
  1334. function isInternalAttribute(attribute) {
  1335. return 'key' === attribute || 'children' === attribute;
  1336. }
  1337. /**
  1338. * Returns the normal form of the element's attribute value for HTML.
  1339. *
  1340. * @param {string} attribute Attribute name.
  1341. * @param {*} value Non-normalized attribute value.
  1342. *
  1343. * @return {*} Normalized attribute value.
  1344. */
  1345. function getNormalAttributeValue(attribute, value) {
  1346. switch (attribute) {
  1347. case 'style':
  1348. return renderStyle(value);
  1349. }
  1350. return value;
  1351. }
  1352. /**
  1353. * This is a map of all SVG attributes that have dashes. Map(lower case prop => dashed lower case attribute).
  1354. * We need this to render e.g strokeWidth as stroke-width.
  1355. *
  1356. * List from: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute.
  1357. */
  1358. 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) => {
  1359. // The keys are lower-cased for more robust lookup.
  1360. map[attribute.toLowerCase()] = attribute;
  1361. return map;
  1362. }, {});
  1363. /**
  1364. * This is a map of all case-sensitive SVG attributes. Map(lowercase key => proper case attribute).
  1365. * The keys are lower-cased for more robust lookup.
  1366. * Note that this list only contains attributes that contain at least one capital letter.
  1367. * Lowercase attributes don't need mapping, since we lowercase all attributes by default.
  1368. */
  1369. 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) => {
  1370. // The keys are lower-cased for more robust lookup.
  1371. map[attribute.toLowerCase()] = attribute;
  1372. return map;
  1373. }, {});
  1374. /**
  1375. * This is a map of all SVG attributes that have colons.
  1376. * Keys are lower-cased and stripped of their colons for more robust lookup.
  1377. */
  1378. 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) => {
  1379. map[attribute.replace(':', '').toLowerCase()] = attribute;
  1380. return map;
  1381. }, {});
  1382. /**
  1383. * Returns the normal form of the element's attribute name for HTML.
  1384. *
  1385. * @param {string} attribute Non-normalized attribute name.
  1386. *
  1387. * @return {string} Normalized attribute name.
  1388. */
  1389. function getNormalAttributeName(attribute) {
  1390. switch (attribute) {
  1391. case 'htmlFor':
  1392. return 'for';
  1393. case 'className':
  1394. return 'class';
  1395. }
  1396. const attributeLowerCase = attribute.toLowerCase();
  1397. if (CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase]) {
  1398. return CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase];
  1399. } else if (SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]) {
  1400. return paramCase(SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]);
  1401. } else if (SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase]) {
  1402. return SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase];
  1403. }
  1404. return attributeLowerCase;
  1405. }
  1406. /**
  1407. * Returns the normal form of the style property name for HTML.
  1408. *
  1409. * - Converts property names to kebab-case, e.g. 'backgroundColor' 'background-color'
  1410. * - Leaves custom attributes alone, e.g. '--myBackgroundColor' '--myBackgroundColor'
  1411. * - Converts vendor-prefixed property names to -kebab-case, e.g. 'MozTransform' '-moz-transform'
  1412. *
  1413. * @param {string} property Property name.
  1414. *
  1415. * @return {string} Normalized property name.
  1416. */
  1417. function getNormalStylePropertyName(property) {
  1418. if (property.startsWith('--')) {
  1419. return property;
  1420. }
  1421. if (hasPrefix(property, ['ms', 'O', 'Moz', 'Webkit'])) {
  1422. return '-' + paramCase(property);
  1423. }
  1424. return paramCase(property);
  1425. }
  1426. /**
  1427. * Returns the normal form of the style property value for HTML. Appends a
  1428. * default pixel unit if numeric, not a unitless property, and not zero.
  1429. *
  1430. * @param {string} property Property name.
  1431. * @param {*} value Non-normalized property value.
  1432. *
  1433. * @return {*} Normalized property value.
  1434. */
  1435. function getNormalStylePropertyValue(property, value) {
  1436. if (typeof value === 'number' && 0 !== value && !CSS_PROPERTIES_SUPPORTS_UNITLESS.has(property)) {
  1437. return value + 'px';
  1438. }
  1439. return value;
  1440. }
  1441. /**
  1442. * Serializes a React element to string.
  1443. *
  1444. * @param {import('react').ReactNode} element Element to serialize.
  1445. * @param {Object} [context] Context object.
  1446. * @param {Object} [legacyContext] Legacy context object.
  1447. *
  1448. * @return {string} Serialized element.
  1449. */
  1450. function renderElement(element, context, legacyContext = {}) {
  1451. if (null === element || undefined === element || false === element) {
  1452. return '';
  1453. }
  1454. if (Array.isArray(element)) {
  1455. return renderChildren(element, context, legacyContext);
  1456. }
  1457. switch (typeof element) {
  1458. case 'string':
  1459. return (0,external_wp_escapeHtml_namespaceObject.escapeHTML)(element);
  1460. case 'number':
  1461. return element.toString();
  1462. }
  1463. const {
  1464. type,
  1465. props
  1466. } = /** @type {{type?: any, props?: any}} */
  1467. element;
  1468. switch (type) {
  1469. case external_React_namespaceObject.StrictMode:
  1470. case external_React_namespaceObject.Fragment:
  1471. return renderChildren(props.children, context, legacyContext);
  1472. case RawHTML:
  1473. const {
  1474. children,
  1475. ...wrapperProps
  1476. } = props;
  1477. return renderNativeComponent(!Object.keys(wrapperProps).length ? null : 'div', {
  1478. ...wrapperProps,
  1479. dangerouslySetInnerHTML: {
  1480. __html: children
  1481. }
  1482. }, context, legacyContext);
  1483. }
  1484. switch (typeof type) {
  1485. case 'string':
  1486. return renderNativeComponent(type, props, context, legacyContext);
  1487. case 'function':
  1488. if (type.prototype && typeof type.prototype.render === 'function') {
  1489. return renderComponent(type, props, context, legacyContext);
  1490. }
  1491. return renderElement(type(props, legacyContext), context, legacyContext);
  1492. }
  1493. switch (type && type.$$typeof) {
  1494. case Provider.$$typeof:
  1495. return renderChildren(props.children, props.value, legacyContext);
  1496. case Consumer.$$typeof:
  1497. return renderElement(props.children(context || type._currentValue), context, legacyContext);
  1498. case ForwardRef.$$typeof:
  1499. return renderElement(type.render(props), context, legacyContext);
  1500. }
  1501. return '';
  1502. }
  1503. /**
  1504. * Serializes a native component type to string.
  1505. *
  1506. * @param {?string} type Native component type to serialize, or null if
  1507. * rendering as fragment of children content.
  1508. * @param {Object} props Props object.
  1509. * @param {Object} [context] Context object.
  1510. * @param {Object} [legacyContext] Legacy context object.
  1511. *
  1512. * @return {string} Serialized element.
  1513. */
  1514. function renderNativeComponent(type, props, context, legacyContext = {}) {
  1515. let content = '';
  1516. if (type === 'textarea' && props.hasOwnProperty('value')) {
  1517. // Textarea children can be assigned as value prop. If it is, render in
  1518. // place of children. Ensure to omit so it is not assigned as attribute
  1519. // as well.
  1520. content = renderChildren(props.value, context, legacyContext);
  1521. const {
  1522. value,
  1523. ...restProps
  1524. } = props;
  1525. props = restProps;
  1526. } else if (props.dangerouslySetInnerHTML && typeof props.dangerouslySetInnerHTML.__html === 'string') {
  1527. // Dangerous content is left unescaped.
  1528. content = props.dangerouslySetInnerHTML.__html;
  1529. } else if (typeof props.children !== 'undefined') {
  1530. content = renderChildren(props.children, context, legacyContext);
  1531. }
  1532. if (!type) {
  1533. return content;
  1534. }
  1535. const attributes = renderAttributes(props);
  1536. if (SELF_CLOSING_TAGS.has(type)) {
  1537. return '<' + type + attributes + '/>';
  1538. }
  1539. return '<' + type + attributes + '>' + content + '</' + type + '>';
  1540. }
  1541. /** @typedef {import('./react').WPComponent} WPComponent */
  1542. /**
  1543. * Serializes a non-native component type to string.
  1544. *
  1545. * @param {WPComponent} Component Component type to serialize.
  1546. * @param {Object} props Props object.
  1547. * @param {Object} [context] Context object.
  1548. * @param {Object} [legacyContext] Legacy context object.
  1549. *
  1550. * @return {string} Serialized element
  1551. */
  1552. function renderComponent(Component, props, context, legacyContext = {}) {
  1553. const instance = new /** @type {import('react').ComponentClass} */
  1554. Component(props, legacyContext);
  1555. if (typeof
  1556. // Ignore reason: Current prettier reformats parens and mangles type assertion
  1557. // prettier-ignore
  1558. /** @type {{getChildContext?: () => unknown}} */
  1559. instance.getChildContext === 'function') {
  1560. Object.assign(legacyContext, /** @type {{getChildContext?: () => unknown}} */instance.getChildContext());
  1561. }
  1562. const html = renderElement(instance.render(), context, legacyContext);
  1563. return html;
  1564. }
  1565. /**
  1566. * Serializes an array of children to string.
  1567. *
  1568. * @param {import('react').ReactNodeArray} children Children to serialize.
  1569. * @param {Object} [context] Context object.
  1570. * @param {Object} [legacyContext] Legacy context object.
  1571. *
  1572. * @return {string} Serialized children.
  1573. */
  1574. function renderChildren(children, context, legacyContext = {}) {
  1575. let result = '';
  1576. children = Array.isArray(children) ? children : [children];
  1577. for (let i = 0; i < children.length; i++) {
  1578. const child = children[i];
  1579. result += renderElement(child, context, legacyContext);
  1580. }
  1581. return result;
  1582. }
  1583. /**
  1584. * Renders a props object as a string of HTML attributes.
  1585. *
  1586. * @param {Object} props Props object.
  1587. *
  1588. * @return {string} Attributes string.
  1589. */
  1590. function renderAttributes(props) {
  1591. let result = '';
  1592. for (const key in props) {
  1593. const attribute = getNormalAttributeName(key);
  1594. if (!(0,external_wp_escapeHtml_namespaceObject.isValidAttributeName)(attribute)) {
  1595. continue;
  1596. }
  1597. let value = getNormalAttributeValue(key, props[key]);
  1598. // If value is not of serializeable type, skip.
  1599. if (!ATTRIBUTES_TYPES.has(typeof value)) {
  1600. continue;
  1601. }
  1602. // Don't render internal attribute names.
  1603. if (isInternalAttribute(key)) {
  1604. continue;
  1605. }
  1606. const isBooleanAttribute = BOOLEAN_ATTRIBUTES.has(attribute);
  1607. // Boolean attribute should be omitted outright if its value is false.
  1608. if (isBooleanAttribute && value === false) {
  1609. continue;
  1610. }
  1611. const isMeaningfulAttribute = isBooleanAttribute || hasPrefix(key, ['data-', 'aria-']) || ENUMERATED_ATTRIBUTES.has(attribute);
  1612. // Only write boolean value as attribute if meaningful.
  1613. if (typeof value === 'boolean' && !isMeaningfulAttribute) {
  1614. continue;
  1615. }
  1616. result += ' ' + attribute;
  1617. // Boolean attributes should write attribute name, but without value.
  1618. // Mere presence of attribute name is effective truthiness.
  1619. if (isBooleanAttribute) {
  1620. continue;
  1621. }
  1622. if (typeof value === 'string') {
  1623. value = (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(value);
  1624. }
  1625. result += '="' + value + '"';
  1626. }
  1627. return result;
  1628. }
  1629. /**
  1630. * Renders a style object as a string attribute value.
  1631. *
  1632. * @param {Object} style Style object.
  1633. *
  1634. * @return {string} Style attribute value.
  1635. */
  1636. function renderStyle(style) {
  1637. // Only generate from object, e.g. tolerate string value.
  1638. if (!isPlainObject(style)) {
  1639. return style;
  1640. }
  1641. let result;
  1642. for (const property in style) {
  1643. const value = style[property];
  1644. if (null === value || undefined === value) {
  1645. continue;
  1646. }
  1647. if (result) {
  1648. result += ';';
  1649. } else {
  1650. result = '';
  1651. }
  1652. const normalName = getNormalStylePropertyName(property);
  1653. const normalValue = getNormalStylePropertyValue(property, value);
  1654. result += normalName + ':' + normalValue;
  1655. }
  1656. return result;
  1657. }
  1658. /* harmony default export */ var serialize = (renderElement);
  1659. ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/index.js
  1660. }();
  1661. (window.wp = window.wp || {}).element = __webpack_exports__;
  1662. /******/ })()
  1663. ;