PluginProbe
Gutenberg / 17.1.1
Gutenberg v17.1.1
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
gutenberg / build / element / index.js

index.js in Gutenberg 17.1.1, at build/element/index.js

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