[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> element.js (source)

   1  (function() {
   2  "use strict";
   3  var wp;
   4  (wp ||= {}).element = (() => {
   5    var __create = Object.create;
   6    var __defProp = Object.defineProperty;
   7    var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
   8    var __getOwnPropNames = Object.getOwnPropertyNames;
   9    var __getProtoOf = Object.getPrototypeOf;
  10    var __hasOwnProp = Object.prototype.hasOwnProperty;
  11    var __commonJS = (cb, mod) => function __require() {
  12      return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  13    };
  14    var __export = (target, all) => {
  15      for (var name in all)
  16        __defProp(target, name, { get: all[name], enumerable: true });
  17    };
  18    var __copyProps = (to, from, except, desc) => {
  19      if (from && typeof from === "object" || typeof from === "function") {
  20        for (let key of __getOwnPropNames(from))
  21          if (!__hasOwnProp.call(to, key) && key !== except)
  22            __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  23      }
  24      return to;
  25    };
  26    var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  27      // If the importer is in node compatibility mode or this is not an ESM
  28      // file that has been converted to a CommonJS file using a Babel-
  29      // compatible transform (i.e. "__esModule" has not been set), then set
  30      // "default" to the CommonJS "module.exports" for node compatibility.
  31      isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  32      mod
  33    ));
  34    var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  35  
  36    // vendor-external:react
  37    var require_react = __commonJS({
  38      "vendor-external:react"(exports, module) {
  39        module.exports = window.React;
  40      }
  41    });
  42  
  43    // vendor-external:react-dom
  44    var require_react_dom = __commonJS({
  45      "vendor-external:react-dom"(exports, module) {
  46        module.exports = window.ReactDOM;
  47      }
  48    });
  49  
  50    // vendor-external:react-dom/client
  51    var require_client = __commonJS({
  52      "vendor-external:react-dom/client"(exports, module) {
  53        module.exports = window.ReactDOM;
  54      }
  55    });
  56  
  57    // package-external:@wordpress/escape-html
  58    var require_escape_html = __commonJS({
  59      "package-external:@wordpress/escape-html"(exports, module) {
  60        module.exports = window.wp.escapeHtml;
  61      }
  62    });
  63  
  64    // packages/element/build-module/index.mjs
  65    var index_exports = {};
  66    __export(index_exports, {
  67      Children: () => import_react.Children,
  68      Component: () => import_react.Component,
  69      Fragment: () => import_react.Fragment,
  70      Platform: () => platform_default,
  71      PureComponent: () => import_react.PureComponent,
  72      RawHTML: () => RawHTML,
  73      StrictMode: () => import_react.StrictMode,
  74      Suspense: () => import_react.Suspense,
  75      cloneElement: () => import_react.cloneElement,
  76      concatChildren: () => concatChildren,
  77      createContext: () => import_react.createContext,
  78      createElement: () => import_react.createElement,
  79      createInterpolateElement: () => create_interpolate_element_default,
  80      createPortal: () => import_react_dom.createPortal,
  81      createRef: () => import_react.createRef,
  82      createRoot: () => import_client.createRoot,
  83      findDOMNode: () => import_react_dom.findDOMNode,
  84      flushSync: () => import_react_dom.flushSync,
  85      forwardRef: () => import_react.forwardRef,
  86      hydrate: () => import_react_dom.hydrate,
  87      hydrateRoot: () => import_client.hydrateRoot,
  88      isEmptyElement: () => isEmptyElement,
  89      isValidElement: () => import_react.isValidElement,
  90      lazy: () => import_react.lazy,
  91      memo: () => import_react.memo,
  92      render: () => import_react_dom.render,
  93      renderToString: () => serialize_default,
  94      startTransition: () => import_react.startTransition,
  95      switchChildrenNodeName: () => switchChildrenNodeName,
  96      unmountComponentAtNode: () => import_react_dom.unmountComponentAtNode,
  97      useCallback: () => import_react.useCallback,
  98      useContext: () => import_react.useContext,
  99      useDebugValue: () => import_react.useDebugValue,
 100      useDeferredValue: () => import_react.useDeferredValue,
 101      useEffect: () => import_react.useEffect,
 102      useId: () => import_react.useId,
 103      useImperativeHandle: () => import_react.useImperativeHandle,
 104      useInsertionEffect: () => import_react.useInsertionEffect,
 105      useLayoutEffect: () => import_react.useLayoutEffect,
 106      useMemo: () => import_react.useMemo,
 107      useReducer: () => import_react.useReducer,
 108      useRef: () => import_react.useRef,
 109      useState: () => import_react.useState,
 110      useSyncExternalStore: () => import_react.useSyncExternalStore,
 111      useTransition: () => import_react.useTransition
 112    });
 113  
 114    // packages/element/build-module/react.mjs
 115    var import_react = __toESM(require_react(), 1);
 116    function concatChildren(...childrenArguments) {
 117      return childrenArguments.reduce(
 118        (accumulator, children, i) => {
 119          import_react.Children.forEach(children, (child, j) => {
 120            if ((0, import_react.isValidElement)(child) && typeof child !== "string") {
 121              child = (0, import_react.cloneElement)(child, {
 122                key: [i, j].join()
 123              });
 124            }
 125            accumulator.push(child);
 126          });
 127          return accumulator;
 128        },
 129        []
 130      );
 131    }
 132    function switchChildrenNodeName(children, nodeName) {
 133      return children && import_react.Children.map(children, (elt, index) => {
 134        if (typeof elt?.valueOf() === "string") {
 135          return (0, import_react.createElement)(nodeName, { key: index }, elt);
 136        }
 137        if (!(0, import_react.isValidElement)(elt)) {
 138          return elt;
 139        }
 140        const { children: childrenProp, ...props } = elt.props;
 141        return (0, import_react.createElement)(
 142          nodeName,
 143          { key: index, ...props },
 144          childrenProp
 145        );
 146      });
 147    }
 148  
 149    // packages/element/build-module/create-interpolate-element.mjs
 150    var indoc;
 151    var offset;
 152    var output;
 153    var stack;
 154    var tokenizer = /<(\/)?(\w+)\s*(\/)?>/g;
 155    function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextStart) {
 156      return {
 157        element,
 158        tokenStart,
 159        tokenLength,
 160        prevOffset,
 161        leadingTextStart,
 162        children: []
 163      };
 164    }
 165    function createInterpolateElement(interpolatedString, conversionMap) {
 166      indoc = interpolatedString;
 167      offset = 0;
 168      output = [];
 169      stack = [];
 170      tokenizer.lastIndex = 0;
 171      if (!isValidConversionMap(conversionMap)) {
 172        throw new TypeError(
 173          "The conversionMap provided is not valid. It must be an object with values that are React Elements"
 174        );
 175      }
 176      do {
 177      } while (proceed(conversionMap));
 178      return (0, import_react.createElement)(import_react.Fragment, null, ...output);
 179    }
 180    var isValidConversionMap = (conversionMap) => {
 181      const isObject2 = typeof conversionMap === "object" && conversionMap !== null;
 182      const values = isObject2 && Object.values(conversionMap);
 183      return isObject2 && values.length > 0 && values.every((element) => (0, import_react.isValidElement)(element));
 184    };
 185    function proceed(conversionMap) {
 186      const next = nextToken();
 187      const [tokenType, name, startOffset, tokenLength] = next;
 188      const stackDepth = stack.length;
 189      const leadingTextStart = startOffset > offset ? offset : null;
 190      if (name && !conversionMap[name]) {
 191        addText();
 192        return false;
 193      }
 194      switch (tokenType) {
 195        case "no-more-tokens":
 196          if (stackDepth !== 0) {
 197            const { leadingTextStart: stackLeadingText, tokenStart } = stack.pop();
 198            output.push(indoc.substr(stackLeadingText, tokenStart));
 199          }
 200          addText();
 201          return false;
 202        case "self-closed":
 203          if (0 === stackDepth) {
 204            if (null !== leadingTextStart) {
 205              output.push(
 206                indoc.substr(
 207                  leadingTextStart,
 208                  startOffset - leadingTextStart
 209                )
 210              );
 211            }
 212            output.push(conversionMap[name]);
 213            offset = startOffset + tokenLength;
 214            return true;
 215          }
 216          addChild(
 217            createFrame(conversionMap[name], startOffset, tokenLength)
 218          );
 219          offset = startOffset + tokenLength;
 220          return true;
 221        case "opener":
 222          stack.push(
 223            createFrame(
 224              conversionMap[name],
 225              startOffset,
 226              tokenLength,
 227              startOffset + tokenLength,
 228              leadingTextStart
 229            )
 230          );
 231          offset = startOffset + tokenLength;
 232          return true;
 233        case "closer":
 234          if (1 === stackDepth) {
 235            closeOuterElement(startOffset);
 236            offset = startOffset + tokenLength;
 237            return true;
 238          }
 239          const stackTop = stack.pop();
 240          const text = indoc.substr(
 241            stackTop.prevOffset,
 242            startOffset - stackTop.prevOffset
 243          );
 244          stackTop.children.push(text);
 245          stackTop.prevOffset = startOffset + tokenLength;
 246          const frame = createFrame(
 247            stackTop.element,
 248            stackTop.tokenStart,
 249            stackTop.tokenLength,
 250            startOffset + tokenLength
 251          );
 252          frame.children = stackTop.children;
 253          addChild(frame);
 254          offset = startOffset + tokenLength;
 255          return true;
 256        default:
 257          addText();
 258          return false;
 259      }
 260    }
 261    function nextToken() {
 262      const matches = tokenizer.exec(indoc);
 263      if (null === matches) {
 264        return ["no-more-tokens"];
 265      }
 266      const startedAt = matches.index;
 267      const [match, isClosing, name, isSelfClosed] = matches;
 268      const length = match.length;
 269      if (isSelfClosed) {
 270        return ["self-closed", name, startedAt, length];
 271      }
 272      if (isClosing) {
 273        return ["closer", name, startedAt, length];
 274      }
 275      return ["opener", name, startedAt, length];
 276    }
 277    function addText() {
 278      const length = indoc.length - offset;
 279      if (0 === length) {
 280        return;
 281      }
 282      output.push(indoc.substr(offset, length));
 283    }
 284    function addChild(frame) {
 285      const { element, tokenStart, tokenLength, prevOffset, children } = frame;
 286      const parent = stack[stack.length - 1];
 287      const text = indoc.substr(
 288        parent.prevOffset,
 289        tokenStart - parent.prevOffset
 290      );
 291      if (text) {
 292        parent.children.push(text);
 293      }
 294      parent.children.push((0, import_react.cloneElement)(element, null, ...children));
 295      parent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength;
 296    }
 297    function closeOuterElement(endOffset) {
 298      const { element, leadingTextStart, prevOffset, tokenStart, children } = stack.pop();
 299      const text = endOffset ? indoc.substr(prevOffset, endOffset - prevOffset) : indoc.substr(prevOffset);
 300      if (text) {
 301        children.push(text);
 302      }
 303      if (null !== leadingTextStart) {
 304        output.push(
 305          indoc.substr(leadingTextStart, tokenStart - leadingTextStart)
 306        );
 307      }
 308      output.push((0, import_react.cloneElement)(element, null, ...children));
 309    }
 310    var create_interpolate_element_default = createInterpolateElement;
 311  
 312    // packages/element/build-module/react-platform.mjs
 313    var import_react_dom = __toESM(require_react_dom(), 1);
 314    var import_client = __toESM(require_client(), 1);
 315  
 316    // packages/element/build-module/utils.mjs
 317    var isEmptyElement = (element) => {
 318      if (typeof element === "number") {
 319        return false;
 320      }
 321      if (typeof element?.valueOf() === "string" || Array.isArray(element)) {
 322        return !element.length;
 323      }
 324      return !element;
 325    };
 326  
 327    // packages/element/build-module/platform.mjs
 328    var Platform = {
 329      /** Platform identifier. Will always be `'web'` in this module. */
 330      OS: "web",
 331      /**
 332       * Select a value based on the platform.
 333       *
 334       * @template T
 335       * @param    spec - Object with optional platform-specific values.
 336       * @return The selected value.
 337       */
 338      select(spec) {
 339        return "web" in spec ? spec.web : spec.default;
 340      },
 341      /** Whether the platform is web */
 342      isWeb: true
 343    };
 344    var platform_default = Platform;
 345  
 346    // node_modules/is-plain-object/dist/is-plain-object.mjs
 347    function isObject(o) {
 348      return Object.prototype.toString.call(o) === "[object Object]";
 349    }
 350    function isPlainObject(o) {
 351      var ctor, prot;
 352      if (isObject(o) === false) return false;
 353      ctor = o.constructor;
 354      if (ctor === void 0) return true;
 355      prot = ctor.prototype;
 356      if (isObject(prot) === false) return false;
 357      if (prot.hasOwnProperty("isPrototypeOf") === false) {
 358        return false;
 359      }
 360      return true;
 361    }
 362  
 363    // node_modules/tslib/tslib.es6.mjs
 364    var __assign = function() {
 365      __assign = Object.assign || function __assign2(t) {
 366        for (var s, i = 1, n = arguments.length; i < n; i++) {
 367          s = arguments[i];
 368          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
 369        }
 370        return t;
 371      };
 372      return __assign.apply(this, arguments);
 373    };
 374  
 375    // node_modules/lower-case/dist.es2015/index.js
 376    function lowerCase(str) {
 377      return str.toLowerCase();
 378    }
 379  
 380    // node_modules/no-case/dist.es2015/index.js
 381    var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
 382    var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
 383    function noCase(input, options) {
 384      if (options === void 0) {
 385        options = {};
 386      }
 387      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;
 388      var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
 389      var start = 0;
 390      var end = result.length;
 391      while (result.charAt(start) === "\0")
 392        start++;
 393      while (result.charAt(end - 1) === "\0")
 394        end--;
 395      return result.slice(start, end).split("\0").map(transform).join(delimiter);
 396    }
 397    function replace(input, re, value) {
 398      if (re instanceof RegExp)
 399        return input.replace(re, value);
 400      return re.reduce(function(input2, re2) {
 401        return input2.replace(re2, value);
 402      }, input);
 403    }
 404  
 405    // node_modules/dot-case/dist.es2015/index.js
 406    function dotCase(input, options) {
 407      if (options === void 0) {
 408        options = {};
 409      }
 410      return noCase(input, __assign({ delimiter: "." }, options));
 411    }
 412  
 413    // node_modules/param-case/dist.es2015/index.js
 414    function paramCase(input, options) {
 415      if (options === void 0) {
 416        options = {};
 417      }
 418      return dotCase(input, __assign({ delimiter: "-" }, options));
 419    }
 420  
 421    // packages/element/build-module/serialize.mjs
 422    var import_escape_html = __toESM(require_escape_html(), 1);
 423  
 424    // packages/element/build-module/raw-html.mjs
 425    function RawHTML({ children, ...props }) {
 426      let rawHtml = "";
 427      import_react.Children.toArray(children).forEach((child) => {
 428        if (typeof child === "string" && child.trim() !== "") {
 429          rawHtml += child;
 430        }
 431      });
 432      return (0, import_react.createElement)("div", {
 433        dangerouslySetInnerHTML: { __html: rawHtml },
 434        ...props
 435      });
 436    }
 437  
 438    // packages/element/build-module/serialize.mjs
 439    var Context = (0, import_react.createContext)(void 0);
 440    Context.displayName = "ElementContext";
 441    var { Provider, Consumer } = Context;
 442    var ForwardRef = (0, import_react.forwardRef)(() => {
 443      return null;
 444    });
 445    var ATTRIBUTES_TYPES = /* @__PURE__ */ new Set(["string", "boolean", "number"]);
 446    var SELF_CLOSING_TAGS = /* @__PURE__ */ new Set([
 447      "area",
 448      "base",
 449      "br",
 450      "col",
 451      "command",
 452      "embed",
 453      "hr",
 454      "img",
 455      "input",
 456      "keygen",
 457      "link",
 458      "meta",
 459      "param",
 460      "source",
 461      "track",
 462      "wbr"
 463    ]);
 464    var BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
 465      "allowfullscreen",
 466      "allowpaymentrequest",
 467      "allowusermedia",
 468      "async",
 469      "autofocus",
 470      "autoplay",
 471      "checked",
 472      "controls",
 473      "default",
 474      "defer",
 475      "disabled",
 476      "download",
 477      "formnovalidate",
 478      "hidden",
 479      "ismap",
 480      "itemscope",
 481      "loop",
 482      "multiple",
 483      "muted",
 484      "nomodule",
 485      "novalidate",
 486      "open",
 487      "playsinline",
 488      "readonly",
 489      "required",
 490      "reversed",
 491      "selected",
 492      "typemustmatch"
 493    ]);
 494    var ENUMERATED_ATTRIBUTES = /* @__PURE__ */ new Set([
 495      "autocapitalize",
 496      "autocomplete",
 497      "charset",
 498      "contenteditable",
 499      "crossorigin",
 500      "decoding",
 501      "dir",
 502      "draggable",
 503      "enctype",
 504      "formenctype",
 505      "formmethod",
 506      "http-equiv",
 507      "inputmode",
 508      "kind",
 509      "method",
 510      "preload",
 511      "scope",
 512      "shape",
 513      "spellcheck",
 514      "translate",
 515      "type",
 516      "wrap"
 517    ]);
 518    var CSS_PROPERTIES_SUPPORTS_UNITLESS = /* @__PURE__ */ new Set([
 519      "animation",
 520      "animationIterationCount",
 521      "baselineShift",
 522      "borderImageOutset",
 523      "borderImageSlice",
 524      "borderImageWidth",
 525      "columnCount",
 526      "cx",
 527      "cy",
 528      "fillOpacity",
 529      "flexGrow",
 530      "flexShrink",
 531      "floodOpacity",
 532      "fontWeight",
 533      "gridColumnEnd",
 534      "gridColumnStart",
 535      "gridRowEnd",
 536      "gridRowStart",
 537      "lineHeight",
 538      "opacity",
 539      "order",
 540      "orphans",
 541      "r",
 542      "rx",
 543      "ry",
 544      "shapeImageThreshold",
 545      "stopOpacity",
 546      "strokeDasharray",
 547      "strokeDashoffset",
 548      "strokeMiterlimit",
 549      "strokeOpacity",
 550      "strokeWidth",
 551      "tabSize",
 552      "widows",
 553      "x",
 554      "y",
 555      "zIndex",
 556      "zoom"
 557    ]);
 558    function hasPrefix(string, prefixes) {
 559      return prefixes.some((prefix) => string.indexOf(prefix) === 0);
 560    }
 561    function isInternalAttribute(attribute) {
 562      return "key" === attribute || "children" === attribute;
 563    }
 564    function getNormalAttributeValue(attribute, value) {
 565      switch (attribute) {
 566        case "style":
 567          return renderStyle(value);
 568      }
 569      return value;
 570    }
 571    var SVG_ATTRIBUTE_WITH_DASHES_LIST = [
 572      "accentHeight",
 573      "alignmentBaseline",
 574      "arabicForm",
 575      "baselineShift",
 576      "capHeight",
 577      "clipPath",
 578      "clipRule",
 579      "colorInterpolation",
 580      "colorInterpolationFilters",
 581      "colorProfile",
 582      "colorRendering",
 583      "dominantBaseline",
 584      "enableBackground",
 585      "fillOpacity",
 586      "fillRule",
 587      "floodColor",
 588      "floodOpacity",
 589      "fontFamily",
 590      "fontSize",
 591      "fontSizeAdjust",
 592      "fontStretch",
 593      "fontStyle",
 594      "fontVariant",
 595      "fontWeight",
 596      "glyphName",
 597      "glyphOrientationHorizontal",
 598      "glyphOrientationVertical",
 599      "horizAdvX",
 600      "horizOriginX",
 601      "imageRendering",
 602      "letterSpacing",
 603      "lightingColor",
 604      "markerEnd",
 605      "markerMid",
 606      "markerStart",
 607      "overlinePosition",
 608      "overlineThickness",
 609      "paintOrder",
 610      "panose1",
 611      "pointerEvents",
 612      "renderingIntent",
 613      "shapeRendering",
 614      "stopColor",
 615      "stopOpacity",
 616      "strikethroughPosition",
 617      "strikethroughThickness",
 618      "strokeDasharray",
 619      "strokeDashoffset",
 620      "strokeLinecap",
 621      "strokeLinejoin",
 622      "strokeMiterlimit",
 623      "strokeOpacity",
 624      "strokeWidth",
 625      "textAnchor",
 626      "textDecoration",
 627      "textRendering",
 628      "underlinePosition",
 629      "underlineThickness",
 630      "unicodeBidi",
 631      "unicodeRange",
 632      "unitsPerEm",
 633      "vAlphabetic",
 634      "vHanging",
 635      "vIdeographic",
 636      "vMathematical",
 637      "vectorEffect",
 638      "vertAdvY",
 639      "vertOriginX",
 640      "vertOriginY",
 641      "wordSpacing",
 642      "writingMode",
 643      "xmlnsXlink",
 644      "xHeight"
 645    ].reduce(
 646      (map, attribute) => {
 647        map[attribute.toLowerCase()] = attribute;
 648        return map;
 649      },
 650      {}
 651    );
 652    var CASE_SENSITIVE_SVG_ATTRIBUTES = [
 653      "allowReorder",
 654      "attributeName",
 655      "attributeType",
 656      "autoReverse",
 657      "baseFrequency",
 658      "baseProfile",
 659      "calcMode",
 660      "clipPathUnits",
 661      "contentScriptType",
 662      "contentStyleType",
 663      "diffuseConstant",
 664      "edgeMode",
 665      "externalResourcesRequired",
 666      "filterRes",
 667      "filterUnits",
 668      "glyphRef",
 669      "gradientTransform",
 670      "gradientUnits",
 671      "kernelMatrix",
 672      "kernelUnitLength",
 673      "keyPoints",
 674      "keySplines",
 675      "keyTimes",
 676      "lengthAdjust",
 677      "limitingConeAngle",
 678      "markerHeight",
 679      "markerUnits",
 680      "markerWidth",
 681      "maskContentUnits",
 682      "maskUnits",
 683      "numOctaves",
 684      "pathLength",
 685      "patternContentUnits",
 686      "patternTransform",
 687      "patternUnits",
 688      "pointsAtX",
 689      "pointsAtY",
 690      "pointsAtZ",
 691      "preserveAlpha",
 692      "preserveAspectRatio",
 693      "primitiveUnits",
 694      "refX",
 695      "refY",
 696      "repeatCount",
 697      "repeatDur",
 698      "requiredExtensions",
 699      "requiredFeatures",
 700      "specularConstant",
 701      "specularExponent",
 702      "spreadMethod",
 703      "startOffset",
 704      "stdDeviation",
 705      "stitchTiles",
 706      "suppressContentEditableWarning",
 707      "suppressHydrationWarning",
 708      "surfaceScale",
 709      "systemLanguage",
 710      "tableValues",
 711      "targetX",
 712      "targetY",
 713      "textLength",
 714      "viewBox",
 715      "viewTarget",
 716      "xChannelSelector",
 717      "yChannelSelector"
 718    ].reduce(
 719      (map, attribute) => {
 720        map[attribute.toLowerCase()] = attribute;
 721        return map;
 722      },
 723      {}
 724    );
 725    var SVG_ATTRIBUTES_WITH_COLONS = [
 726      "xlink:actuate",
 727      "xlink:arcrole",
 728      "xlink:href",
 729      "xlink:role",
 730      "xlink:show",
 731      "xlink:title",
 732      "xlink:type",
 733      "xml:base",
 734      "xml:lang",
 735      "xml:space",
 736      "xmlns:xlink"
 737    ].reduce(
 738      (map, attribute) => {
 739        map[attribute.replace(":", "").toLowerCase()] = attribute;
 740        return map;
 741      },
 742      {}
 743    );
 744    function getNormalAttributeName(attribute) {
 745      switch (attribute) {
 746        case "htmlFor":
 747          return "for";
 748        case "className":
 749          return "class";
 750      }
 751      const attributeLowerCase = attribute.toLowerCase();
 752      if (CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase]) {
 753        return CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase];
 754      } else if (SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]) {
 755        return paramCase(
 756          SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]
 757        );
 758      } else if (SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase]) {
 759        return SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase];
 760      }
 761      return attributeLowerCase;
 762    }
 763    function getNormalStylePropertyName(property) {
 764      if (property.startsWith("--")) {
 765        return property;
 766      }
 767      if (hasPrefix(property, ["ms", "O", "Moz", "Webkit"])) {
 768        return "-" + paramCase(property);
 769      }
 770      return paramCase(property);
 771    }
 772    function getNormalStylePropertyValue(property, value) {
 773      if (typeof value === "number" && 0 !== value && !hasPrefix(property, ["--"]) && !CSS_PROPERTIES_SUPPORTS_UNITLESS.has(property)) {
 774        return value + "px";
 775      }
 776      return value;
 777    }
 778    function renderElement(element, context, legacyContext = {}) {
 779      if (null === element || void 0 === element || false === element) {
 780        return "";
 781      }
 782      if (Array.isArray(element)) {
 783        return renderChildren(element, context, legacyContext);
 784      }
 785      switch (typeof element) {
 786        case "string":
 787          return (0, import_escape_html.escapeHTML)(element);
 788        case "number":
 789          return element.toString();
 790      }
 791      const { type, props } = element;
 792      switch (type) {
 793        case import_react.StrictMode:
 794        case import_react.Fragment:
 795          return renderChildren(props.children, context, legacyContext);
 796        case RawHTML:
 797          const { children, ...wrapperProps } = props;
 798          return renderNativeComponent(
 799            !Object.keys(wrapperProps).length ? null : "div",
 800            {
 801              ...wrapperProps,
 802              dangerouslySetInnerHTML: { __html: children }
 803            },
 804            context,
 805            legacyContext
 806          );
 807      }
 808      switch (typeof type) {
 809        case "string":
 810          return renderNativeComponent(type, props, context, legacyContext);
 811        case "function":
 812          if (type.prototype && typeof type.prototype.render === "function") {
 813            return renderComponent(type, props, context, legacyContext);
 814          }
 815          return renderElement(
 816            type(props, legacyContext),
 817            context,
 818            legacyContext
 819          );
 820      }
 821      switch (type && type.$$typeof) {
 822        case Provider.$$typeof:
 823          return renderChildren(props.children, props.value, legacyContext);
 824        case Consumer.$$typeof:
 825          return renderElement(
 826            props.children(context || type._currentValue),
 827            context,
 828            legacyContext
 829          );
 830        case ForwardRef.$$typeof:
 831          return renderElement(
 832            type.render(props),
 833            context,
 834            legacyContext
 835          );
 836      }
 837      return "";
 838    }
 839    function renderNativeComponent(type, props, context, legacyContext = {}) {
 840      let content = "";
 841      if (type === "textarea" && props.hasOwnProperty("value")) {
 842        content = renderChildren(props.value, context, legacyContext);
 843        const { value, ...restProps } = props;
 844        props = restProps;
 845      } else if (props.dangerouslySetInnerHTML && typeof props.dangerouslySetInnerHTML.__html === "string") {
 846        content = props.dangerouslySetInnerHTML.__html;
 847      } else if (typeof props.children !== "undefined") {
 848        content = renderChildren(props.children, context, legacyContext);
 849      }
 850      if (!type) {
 851        return content;
 852      }
 853      const attributes = renderAttributes(props);
 854      if (SELF_CLOSING_TAGS.has(type)) {
 855        return "<" + type + attributes + "/>";
 856      }
 857      return "<" + type + attributes + ">" + content + "</" + type + ">";
 858    }
 859    function renderComponent(Component2, props, context, legacyContext = {}) {
 860      const instance = new Component2(props, legacyContext);
 861      if (typeof instance.getChildContext === "function") {
 862        Object.assign(legacyContext, instance.getChildContext());
 863      }
 864      const html = renderElement(instance.render(), context, legacyContext);
 865      return html;
 866    }
 867    function renderChildren(children, context, legacyContext = {}) {
 868      let result = "";
 869      const childrenArray = Array.isArray(children) ? children : [children];
 870      for (let i = 0; i < childrenArray.length; i++) {
 871        const child = childrenArray[i];
 872        result += renderElement(child, context, legacyContext);
 873      }
 874      return result;
 875    }
 876    function renderAttributes(props) {
 877      let result = "";
 878      for (const key in props) {
 879        const attribute = getNormalAttributeName(key);
 880        if (!(0, import_escape_html.isValidAttributeName)(attribute)) {
 881          continue;
 882        }
 883        let value = getNormalAttributeValue(key, props[key]);
 884        if (!ATTRIBUTES_TYPES.has(typeof value)) {
 885          continue;
 886        }
 887        if (isInternalAttribute(key)) {
 888          continue;
 889        }
 890        const isBooleanAttribute = BOOLEAN_ATTRIBUTES.has(attribute);
 891        if (isBooleanAttribute && value === false) {
 892          continue;
 893        }
 894        const isMeaningfulAttribute = isBooleanAttribute || hasPrefix(key, ["data-", "aria-"]) || ENUMERATED_ATTRIBUTES.has(attribute);
 895        if (typeof value === "boolean" && !isMeaningfulAttribute) {
 896          continue;
 897        }
 898        result += " " + attribute;
 899        if (isBooleanAttribute) {
 900          continue;
 901        }
 902        if (typeof value === "string") {
 903          value = (0, import_escape_html.escapeAttribute)(value);
 904        }
 905        result += '="' + value + '"';
 906      }
 907      return result;
 908    }
 909    function renderStyle(style) {
 910      if (!isPlainObject(style)) {
 911        return style;
 912      }
 913      let result;
 914      const styleObj = style;
 915      for (const property in styleObj) {
 916        const value = styleObj[property];
 917        if (null === value || void 0 === value) {
 918          continue;
 919        }
 920        if (result) {
 921          result += ";";
 922        } else {
 923          result = "";
 924        }
 925        const normalName = getNormalStylePropertyName(property);
 926        const normalValue = getNormalStylePropertyValue(property, value);
 927        result += normalName + ":" + normalValue;
 928      }
 929      return result;
 930    }
 931    var serialize_default = renderElement;
 932    return __toCommonJS(index_exports);
 933  })();
 934  /*! Bundled license information:
 935  
 936  is-plain-object/dist/is-plain-object.mjs:
 937    (*!
 938     * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
 939     *
 940     * Copyright (c) 2014-2017, Jon Schlinkert.
 941     * Released under the MIT License.
 942     *)
 943  */
 944  (window.wp ||= {}).element = wp.element;
 945  })();


Generated : Sun Aug 16 08:20:24 2026 Cross-referenced by PHPXref