HEX
Server: nginx/1.28.1
System: Linux VM-0-12-opencloudos 6.6.117-45.oc9.x86_64 #1 SMP Thu Dec 4 10:26:39 CST 2025 x86_64
User: www (1000)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.waciwang.com/wp-content/plugins/gutenberg/build/scripts/editor/index.js
"use strict";
var wp;
(wp ||= {}).editor = (() => {
  var __create = Object.create;
  var __defProp = Object.defineProperty;
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  var __getOwnPropNames = Object.getOwnPropertyNames;
  var __getProtoOf = Object.getPrototypeOf;
  var __hasOwnProp = Object.prototype.hasOwnProperty;
  var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
    get: (a3, b3) => (typeof require !== "undefined" ? require : a3)[b3]
  }) : x2)(function(x2) {
    if (typeof require !== "undefined") return require.apply(this, arguments);
    throw Error('Dynamic require of "' + x2 + '" is not supported');
  });
  var __commonJS = (cb, mod) => function __require4() {
    return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  };
  var __export = (target, all) => {
    for (var name2 in all)
      __defProp(target, name2, { get: all[name2], enumerable: true });
  };
  var __copyProps = (to, from, except, desc) => {
    if (from && typeof from === "object" || typeof from === "function") {
      for (let key of __getOwnPropNames(from))
        if (!__hasOwnProp.call(to, key) && key !== except)
          __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
    }
    return to;
  };
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
    // If the importer is in node compatibility mode or this is not an ESM
    // file that has been converted to a CommonJS file using a Babel-
    // compatible transform (i.e. "__esModule" has not been set), then set
    // "default" to the CommonJS "module.exports" for node compatibility.
    isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
    mod
  ));
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

  // package-external:@wordpress/data
  var require_data = __commonJS({
    "package-external:@wordpress/data"(exports, module) {
      module.exports = window.wp.data;
    }
  });

  // package-external:@wordpress/core-data
  var require_core_data = __commonJS({
    "package-external:@wordpress/core-data"(exports, module) {
      module.exports = window.wp.coreData;
    }
  });

  // package-external:@wordpress/element
  var require_element = __commonJS({
    "package-external:@wordpress/element"(exports, module) {
      module.exports = window.wp.element;
    }
  });

  // package-external:@wordpress/compose
  var require_compose = __commonJS({
    "package-external:@wordpress/compose"(exports, module) {
      module.exports = window.wp.compose;
    }
  });

  // package-external:@wordpress/hooks
  var require_hooks = __commonJS({
    "package-external:@wordpress/hooks"(exports, module) {
      module.exports = window.wp.hooks;
    }
  });

  // package-external:@wordpress/block-editor
  var require_block_editor = __commonJS({
    "package-external:@wordpress/block-editor"(exports, module) {
      module.exports = window.wp.blockEditor;
    }
  });

  // package-external:@wordpress/blocks
  var require_blocks = __commonJS({
    "package-external:@wordpress/blocks"(exports, module) {
      module.exports = window.wp.blocks;
    }
  });

  // package-external:@wordpress/date
  var require_date = __commonJS({
    "package-external:@wordpress/date"(exports, module) {
      module.exports = window.wp.date;
    }
  });

  // package-external:@wordpress/url
  var require_url = __commonJS({
    "package-external:@wordpress/url"(exports, module) {
      module.exports = window.wp.url;
    }
  });

  // package-external:@wordpress/deprecated
  var require_deprecated = __commonJS({
    "package-external:@wordpress/deprecated"(exports, module) {
      module.exports = window.wp.deprecated;
    }
  });

  // package-external:@wordpress/preferences
  var require_preferences = __commonJS({
    "package-external:@wordpress/preferences"(exports, module) {
      module.exports = window.wp.preferences;
    }
  });

  // package-external:@wordpress/primitives
  var require_primitives = __commonJS({
    "package-external:@wordpress/primitives"(exports, module) {
      module.exports = window.wp.primitives;
    }
  });

  // vendor-external:react/jsx-runtime
  var require_jsx_runtime = __commonJS({
    "vendor-external:react/jsx-runtime"(exports, module) {
      module.exports = window.ReactJSXRuntime;
    }
  });

  // package-external:@wordpress/private-apis
  var require_private_apis = __commonJS({
    "package-external:@wordpress/private-apis"(exports, module) {
      module.exports = window.wp.privateApis;
    }
  });

  // package-external:@wordpress/a11y
  var require_a11y = __commonJS({
    "package-external:@wordpress/a11y"(exports, module) {
      module.exports = window.wp.a11y;
    }
  });

  // package-external:@wordpress/api-fetch
  var require_api_fetch = __commonJS({
    "package-external:@wordpress/api-fetch"(exports, module) {
      module.exports = window.wp.apiFetch;
    }
  });

  // package-external:@wordpress/notices
  var require_notices = __commonJS({
    "package-external:@wordpress/notices"(exports, module) {
      module.exports = window.wp.notices;
    }
  });

  // package-external:@wordpress/i18n
  var require_i18n = __commonJS({
    "package-external:@wordpress/i18n"(exports, module) {
      module.exports = window.wp.i18n;
    }
  });

  // package-external:@wordpress/html-entities
  var require_html_entities = __commonJS({
    "package-external:@wordpress/html-entities"(exports, module) {
      module.exports = window.wp.htmlEntities;
    }
  });

  // package-external:@wordpress/components
  var require_components = __commonJS({
    "package-external:@wordpress/components"(exports, module) {
      module.exports = window.wp.components;
    }
  });

  // package-external:@wordpress/patterns
  var require_patterns = __commonJS({
    "package-external:@wordpress/patterns"(exports, module) {
      module.exports = window.wp.patterns;
    }
  });

  // package-external:@wordpress/blob
  var require_blob = __commonJS({
    "package-external:@wordpress/blob"(exports, module) {
      module.exports = window.wp.blob;
    }
  });

  // package-external:@wordpress/media-utils
  var require_media_utils = __commonJS({
    "package-external:@wordpress/media-utils"(exports, module) {
      module.exports = window.wp.mediaUtils;
    }
  });

  // node_modules/remove-accents/index.js
  var require_remove_accents = __commonJS({
    "node_modules/remove-accents/index.js"(exports, module) {
      var characterMap = {
        "\xC0": "A",
        "\xC1": "A",
        "\xC2": "A",
        "\xC3": "A",
        "\xC4": "A",
        "\xC5": "A",
        "\u1EA4": "A",
        "\u1EAE": "A",
        "\u1EB2": "A",
        "\u1EB4": "A",
        "\u1EB6": "A",
        "\xC6": "AE",
        "\u1EA6": "A",
        "\u1EB0": "A",
        "\u0202": "A",
        "\u1EA2": "A",
        "\u1EA0": "A",
        "\u1EA8": "A",
        "\u1EAA": "A",
        "\u1EAC": "A",
        "\xC7": "C",
        "\u1E08": "C",
        "\xC8": "E",
        "\xC9": "E",
        "\xCA": "E",
        "\xCB": "E",
        "\u1EBE": "E",
        "\u1E16": "E",
        "\u1EC0": "E",
        "\u1E14": "E",
        "\u1E1C": "E",
        "\u0206": "E",
        "\u1EBA": "E",
        "\u1EBC": "E",
        "\u1EB8": "E",
        "\u1EC2": "E",
        "\u1EC4": "E",
        "\u1EC6": "E",
        "\xCC": "I",
        "\xCD": "I",
        "\xCE": "I",
        "\xCF": "I",
        "\u1E2E": "I",
        "\u020A": "I",
        "\u1EC8": "I",
        "\u1ECA": "I",
        "\xD0": "D",
        "\xD1": "N",
        "\xD2": "O",
        "\xD3": "O",
        "\xD4": "O",
        "\xD5": "O",
        "\xD6": "O",
        "\xD8": "O",
        "\u1ED0": "O",
        "\u1E4C": "O",
        "\u1E52": "O",
        "\u020E": "O",
        "\u1ECE": "O",
        "\u1ECC": "O",
        "\u1ED4": "O",
        "\u1ED6": "O",
        "\u1ED8": "O",
        "\u1EDC": "O",
        "\u1EDE": "O",
        "\u1EE0": "O",
        "\u1EDA": "O",
        "\u1EE2": "O",
        "\xD9": "U",
        "\xDA": "U",
        "\xDB": "U",
        "\xDC": "U",
        "\u1EE6": "U",
        "\u1EE4": "U",
        "\u1EEC": "U",
        "\u1EEE": "U",
        "\u1EF0": "U",
        "\xDD": "Y",
        "\xE0": "a",
        "\xE1": "a",
        "\xE2": "a",
        "\xE3": "a",
        "\xE4": "a",
        "\xE5": "a",
        "\u1EA5": "a",
        "\u1EAF": "a",
        "\u1EB3": "a",
        "\u1EB5": "a",
        "\u1EB7": "a",
        "\xE6": "ae",
        "\u1EA7": "a",
        "\u1EB1": "a",
        "\u0203": "a",
        "\u1EA3": "a",
        "\u1EA1": "a",
        "\u1EA9": "a",
        "\u1EAB": "a",
        "\u1EAD": "a",
        "\xE7": "c",
        "\u1E09": "c",
        "\xE8": "e",
        "\xE9": "e",
        "\xEA": "e",
        "\xEB": "e",
        "\u1EBF": "e",
        "\u1E17": "e",
        "\u1EC1": "e",
        "\u1E15": "e",
        "\u1E1D": "e",
        "\u0207": "e",
        "\u1EBB": "e",
        "\u1EBD": "e",
        "\u1EB9": "e",
        "\u1EC3": "e",
        "\u1EC5": "e",
        "\u1EC7": "e",
        "\xEC": "i",
        "\xED": "i",
        "\xEE": "i",
        "\xEF": "i",
        "\u1E2F": "i",
        "\u020B": "i",
        "\u1EC9": "i",
        "\u1ECB": "i",
        "\xF0": "d",
        "\xF1": "n",
        "\xF2": "o",
        "\xF3": "o",
        "\xF4": "o",
        "\xF5": "o",
        "\xF6": "o",
        "\xF8": "o",
        "\u1ED1": "o",
        "\u1E4D": "o",
        "\u1E53": "o",
        "\u020F": "o",
        "\u1ECF": "o",
        "\u1ECD": "o",
        "\u1ED5": "o",
        "\u1ED7": "o",
        "\u1ED9": "o",
        "\u1EDD": "o",
        "\u1EDF": "o",
        "\u1EE1": "o",
        "\u1EDB": "o",
        "\u1EE3": "o",
        "\xF9": "u",
        "\xFA": "u",
        "\xFB": "u",
        "\xFC": "u",
        "\u1EE7": "u",
        "\u1EE5": "u",
        "\u1EED": "u",
        "\u1EEF": "u",
        "\u1EF1": "u",
        "\xFD": "y",
        "\xFF": "y",
        "\u0100": "A",
        "\u0101": "a",
        "\u0102": "A",
        "\u0103": "a",
        "\u0104": "A",
        "\u0105": "a",
        "\u0106": "C",
        "\u0107": "c",
        "\u0108": "C",
        "\u0109": "c",
        "\u010A": "C",
        "\u010B": "c",
        "\u010C": "C",
        "\u010D": "c",
        "C\u0306": "C",
        "c\u0306": "c",
        "\u010E": "D",
        "\u010F": "d",
        "\u0110": "D",
        "\u0111": "d",
        "\u0112": "E",
        "\u0113": "e",
        "\u0114": "E",
        "\u0115": "e",
        "\u0116": "E",
        "\u0117": "e",
        "\u0118": "E",
        "\u0119": "e",
        "\u011A": "E",
        "\u011B": "e",
        "\u011C": "G",
        "\u01F4": "G",
        "\u011D": "g",
        "\u01F5": "g",
        "\u011E": "G",
        "\u011F": "g",
        "\u0120": "G",
        "\u0121": "g",
        "\u0122": "G",
        "\u0123": "g",
        "\u0124": "H",
        "\u0125": "h",
        "\u0126": "H",
        "\u0127": "h",
        "\u1E2A": "H",
        "\u1E2B": "h",
        "\u0128": "I",
        "\u0129": "i",
        "\u012A": "I",
        "\u012B": "i",
        "\u012C": "I",
        "\u012D": "i",
        "\u012E": "I",
        "\u012F": "i",
        "\u0130": "I",
        "\u0131": "i",
        "\u0132": "IJ",
        "\u0133": "ij",
        "\u0134": "J",
        "\u0135": "j",
        "\u0136": "K",
        "\u0137": "k",
        "\u1E30": "K",
        "\u1E31": "k",
        "K\u0306": "K",
        "k\u0306": "k",
        "\u0139": "L",
        "\u013A": "l",
        "\u013B": "L",
        "\u013C": "l",
        "\u013D": "L",
        "\u013E": "l",
        "\u013F": "L",
        "\u0140": "l",
        "\u0141": "l",
        "\u0142": "l",
        "\u1E3E": "M",
        "\u1E3F": "m",
        "M\u0306": "M",
        "m\u0306": "m",
        "\u0143": "N",
        "\u0144": "n",
        "\u0145": "N",
        "\u0146": "n",
        "\u0147": "N",
        "\u0148": "n",
        "\u0149": "n",
        "N\u0306": "N",
        "n\u0306": "n",
        "\u014C": "O",
        "\u014D": "o",
        "\u014E": "O",
        "\u014F": "o",
        "\u0150": "O",
        "\u0151": "o",
        "\u0152": "OE",
        "\u0153": "oe",
        "P\u0306": "P",
        "p\u0306": "p",
        "\u0154": "R",
        "\u0155": "r",
        "\u0156": "R",
        "\u0157": "r",
        "\u0158": "R",
        "\u0159": "r",
        "R\u0306": "R",
        "r\u0306": "r",
        "\u0212": "R",
        "\u0213": "r",
        "\u015A": "S",
        "\u015B": "s",
        "\u015C": "S",
        "\u015D": "s",
        "\u015E": "S",
        "\u0218": "S",
        "\u0219": "s",
        "\u015F": "s",
        "\u0160": "S",
        "\u0161": "s",
        "\u0162": "T",
        "\u0163": "t",
        "\u021B": "t",
        "\u021A": "T",
        "\u0164": "T",
        "\u0165": "t",
        "\u0166": "T",
        "\u0167": "t",
        "T\u0306": "T",
        "t\u0306": "t",
        "\u0168": "U",
        "\u0169": "u",
        "\u016A": "U",
        "\u016B": "u",
        "\u016C": "U",
        "\u016D": "u",
        "\u016E": "U",
        "\u016F": "u",
        "\u0170": "U",
        "\u0171": "u",
        "\u0172": "U",
        "\u0173": "u",
        "\u0216": "U",
        "\u0217": "u",
        "V\u0306": "V",
        "v\u0306": "v",
        "\u0174": "W",
        "\u0175": "w",
        "\u1E82": "W",
        "\u1E83": "w",
        "X\u0306": "X",
        "x\u0306": "x",
        "\u0176": "Y",
        "\u0177": "y",
        "\u0178": "Y",
        "Y\u0306": "Y",
        "y\u0306": "y",
        "\u0179": "Z",
        "\u017A": "z",
        "\u017B": "Z",
        "\u017C": "z",
        "\u017D": "Z",
        "\u017E": "z",
        "\u017F": "s",
        "\u0192": "f",
        "\u01A0": "O",
        "\u01A1": "o",
        "\u01AF": "U",
        "\u01B0": "u",
        "\u01CD": "A",
        "\u01CE": "a",
        "\u01CF": "I",
        "\u01D0": "i",
        "\u01D1": "O",
        "\u01D2": "o",
        "\u01D3": "U",
        "\u01D4": "u",
        "\u01D5": "U",
        "\u01D6": "u",
        "\u01D7": "U",
        "\u01D8": "u",
        "\u01D9": "U",
        "\u01DA": "u",
        "\u01DB": "U",
        "\u01DC": "u",
        "\u1EE8": "U",
        "\u1EE9": "u",
        "\u1E78": "U",
        "\u1E79": "u",
        "\u01FA": "A",
        "\u01FB": "a",
        "\u01FC": "AE",
        "\u01FD": "ae",
        "\u01FE": "O",
        "\u01FF": "o",
        "\xDE": "TH",
        "\xFE": "th",
        "\u1E54": "P",
        "\u1E55": "p",
        "\u1E64": "S",
        "\u1E65": "s",
        "X\u0301": "X",
        "x\u0301": "x",
        "\u0403": "\u0413",
        "\u0453": "\u0433",
        "\u040C": "\u041A",
        "\u045C": "\u043A",
        "A\u030B": "A",
        "a\u030B": "a",
        "E\u030B": "E",
        "e\u030B": "e",
        "I\u030B": "I",
        "i\u030B": "i",
        "\u01F8": "N",
        "\u01F9": "n",
        "\u1ED2": "O",
        "\u1ED3": "o",
        "\u1E50": "O",
        "\u1E51": "o",
        "\u1EEA": "U",
        "\u1EEB": "u",
        "\u1E80": "W",
        "\u1E81": "w",
        "\u1EF2": "Y",
        "\u1EF3": "y",
        "\u0200": "A",
        "\u0201": "a",
        "\u0204": "E",
        "\u0205": "e",
        "\u0208": "I",
        "\u0209": "i",
        "\u020C": "O",
        "\u020D": "o",
        "\u0210": "R",
        "\u0211": "r",
        "\u0214": "U",
        "\u0215": "u",
        "B\u030C": "B",
        "b\u030C": "b",
        "\u010C\u0323": "C",
        "\u010D\u0323": "c",
        "\xCA\u030C": "E",
        "\xEA\u030C": "e",
        "F\u030C": "F",
        "f\u030C": "f",
        "\u01E6": "G",
        "\u01E7": "g",
        "\u021E": "H",
        "\u021F": "h",
        "J\u030C": "J",
        "\u01F0": "j",
        "\u01E8": "K",
        "\u01E9": "k",
        "M\u030C": "M",
        "m\u030C": "m",
        "P\u030C": "P",
        "p\u030C": "p",
        "Q\u030C": "Q",
        "q\u030C": "q",
        "\u0158\u0329": "R",
        "\u0159\u0329": "r",
        "\u1E66": "S",
        "\u1E67": "s",
        "V\u030C": "V",
        "v\u030C": "v",
        "W\u030C": "W",
        "w\u030C": "w",
        "X\u030C": "X",
        "x\u030C": "x",
        "Y\u030C": "Y",
        "y\u030C": "y",
        "A\u0327": "A",
        "a\u0327": "a",
        "B\u0327": "B",
        "b\u0327": "b",
        "\u1E10": "D",
        "\u1E11": "d",
        "\u0228": "E",
        "\u0229": "e",
        "\u0190\u0327": "E",
        "\u025B\u0327": "e",
        "\u1E28": "H",
        "\u1E29": "h",
        "I\u0327": "I",
        "i\u0327": "i",
        "\u0197\u0327": "I",
        "\u0268\u0327": "i",
        "M\u0327": "M",
        "m\u0327": "m",
        "O\u0327": "O",
        "o\u0327": "o",
        "Q\u0327": "Q",
        "q\u0327": "q",
        "U\u0327": "U",
        "u\u0327": "u",
        "X\u0327": "X",
        "x\u0327": "x",
        "Z\u0327": "Z",
        "z\u0327": "z",
        "\u0439": "\u0438",
        "\u0419": "\u0418",
        "\u0451": "\u0435",
        "\u0401": "\u0415"
      };
      var chars = Object.keys(characterMap).join("|");
      var allAccents = new RegExp(chars, "g");
      var firstAccent = new RegExp(chars, "");
      function matcher(match2) {
        return characterMap[match2];
      }
      var removeAccents4 = function(string) {
        return string.replace(allAccents, matcher);
      };
      var hasAccents = function(string) {
        return !!string.match(firstAccent);
      };
      module.exports = removeAccents4;
      module.exports.has = hasAccents;
      module.exports.remove = removeAccents4;
    }
  });

  // package-external:@wordpress/style-engine
  var require_style_engine = __commonJS({
    "package-external:@wordpress/style-engine"(exports, module) {
      module.exports = window.wp.styleEngine;
    }
  });

  // node_modules/fast-deep-equal/es6/index.js
  var require_es6 = __commonJS({
    "node_modules/fast-deep-equal/es6/index.js"(exports, module) {
      "use strict";
      module.exports = function equal(a3, b3) {
        if (a3 === b3) return true;
        if (a3 && b3 && typeof a3 == "object" && typeof b3 == "object") {
          if (a3.constructor !== b3.constructor) return false;
          var length, i3, keys;
          if (Array.isArray(a3)) {
            length = a3.length;
            if (length != b3.length) return false;
            for (i3 = length; i3-- !== 0; )
              if (!equal(a3[i3], b3[i3])) return false;
            return true;
          }
          if (a3 instanceof Map && b3 instanceof Map) {
            if (a3.size !== b3.size) return false;
            for (i3 of a3.entries())
              if (!b3.has(i3[0])) return false;
            for (i3 of a3.entries())
              if (!equal(i3[1], b3.get(i3[0]))) return false;
            return true;
          }
          if (a3 instanceof Set && b3 instanceof Set) {
            if (a3.size !== b3.size) return false;
            for (i3 of a3.entries())
              if (!b3.has(i3[0])) return false;
            return true;
          }
          if (ArrayBuffer.isView(a3) && ArrayBuffer.isView(b3)) {
            length = a3.length;
            if (length != b3.length) return false;
            for (i3 = length; i3-- !== 0; )
              if (a3[i3] !== b3[i3]) return false;
            return true;
          }
          if (a3.constructor === RegExp) return a3.source === b3.source && a3.flags === b3.flags;
          if (a3.valueOf !== Object.prototype.valueOf) return a3.valueOf() === b3.valueOf();
          if (a3.toString !== Object.prototype.toString) return a3.toString() === b3.toString();
          keys = Object.keys(a3);
          length = keys.length;
          if (length !== Object.keys(b3).length) return false;
          for (i3 = length; i3-- !== 0; )
            if (!Object.prototype.hasOwnProperty.call(b3, keys[i3])) return false;
          for (i3 = length; i3-- !== 0; ) {
            var key = keys[i3];
            if (!equal(a3[key], b3[key])) return false;
          }
          return true;
        }
        return a3 !== a3 && b3 !== b3;
      };
    }
  });

  // node_modules/deepmerge/dist/cjs.js
  var require_cjs = __commonJS({
    "node_modules/deepmerge/dist/cjs.js"(exports, module) {
      "use strict";
      var isMergeableObject = function isMergeableObject2(value) {
        return isNonNullObject(value) && !isSpecial(value);
      };
      function isNonNullObject(value) {
        return !!value && typeof value === "object";
      }
      function isSpecial(value) {
        var stringValue = Object.prototype.toString.call(value);
        return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
      }
      var canUseSymbol = typeof Symbol === "function" && Symbol.for;
      var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
      function isReactElement(value) {
        return value.$$typeof === REACT_ELEMENT_TYPE;
      }
      function emptyTarget(val) {
        return Array.isArray(val) ? [] : {};
      }
      function cloneUnlessOtherwiseSpecified(value, options) {
        return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
      }
      function defaultArrayMerge(target, source, options) {
        return target.concat(source).map(function(element) {
          return cloneUnlessOtherwiseSpecified(element, options);
        });
      }
      function getMergeFunction(key, options) {
        if (!options.customMerge) {
          return deepmerge2;
        }
        var customMerge = options.customMerge(key);
        return typeof customMerge === "function" ? customMerge : deepmerge2;
      }
      function getEnumerableOwnPropertySymbols(target) {
        return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
          return Object.propertyIsEnumerable.call(target, symbol);
        }) : [];
      }
      function getKeys(target) {
        return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
      }
      function propertyIsOnObject(object, property) {
        try {
          return property in object;
        } catch (_) {
          return false;
        }
      }
      function propertyIsUnsafe(target, key) {
        return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
      }
      function mergeObject(target, source, options) {
        var destination = {};
        if (options.isMergeableObject(target)) {
          getKeys(target).forEach(function(key) {
            destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
          });
        }
        getKeys(source).forEach(function(key) {
          if (propertyIsUnsafe(target, key)) {
            return;
          }
          if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
            destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
          } else {
            destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
          }
        });
        return destination;
      }
      function deepmerge2(target, source, options) {
        options = options || {};
        options.arrayMerge = options.arrayMerge || defaultArrayMerge;
        options.isMergeableObject = options.isMergeableObject || isMergeableObject;
        options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
        var sourceIsArray = Array.isArray(source);
        var targetIsArray = Array.isArray(target);
        var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
        if (!sourceAndTargetTypesMatch) {
          return cloneUnlessOtherwiseSpecified(source, options);
        } else if (sourceIsArray) {
          return options.arrayMerge(target, source, options);
        } else {
          return mergeObject(target, source, options);
        }
      }
      deepmerge2.all = function deepmergeAll(array, options) {
        if (!Array.isArray(array)) {
          throw new Error("first argument should be an array");
        }
        return array.reduce(function(prev, next) {
          return deepmerge2(prev, next, options);
        }, {});
      };
      var deepmerge_1 = deepmerge2;
      module.exports = deepmerge_1;
    }
  });

  // package-external:@wordpress/commands
  var require_commands = __commonJS({
    "package-external:@wordpress/commands"(exports, module) {
      module.exports = window.wp.commands;
    }
  });

  // package-external:@wordpress/viewport
  var require_viewport = __commonJS({
    "package-external:@wordpress/viewport"(exports, module) {
      module.exports = window.wp.viewport;
    }
  });

  // package-external:@wordpress/plugins
  var require_plugins = __commonJS({
    "package-external:@wordpress/plugins"(exports, module) {
      module.exports = window.wp.plugins;
    }
  });

  // package-external:@wordpress/keyboard-shortcuts
  var require_keyboard_shortcuts = __commonJS({
    "package-external:@wordpress/keyboard-shortcuts"(exports, module) {
      module.exports = window.wp.keyboardShortcuts;
    }
  });

  // package-external:@wordpress/keycodes
  var require_keycodes = __commonJS({
    "package-external:@wordpress/keycodes"(exports, module) {
      module.exports = window.wp.keycodes;
    }
  });

  // node_modules/fast-deep-equal/index.js
  var require_fast_deep_equal = __commonJS({
    "node_modules/fast-deep-equal/index.js"(exports, module) {
      "use strict";
      module.exports = function equal(a3, b3) {
        if (a3 === b3) return true;
        if (a3 && b3 && typeof a3 == "object" && typeof b3 == "object") {
          if (a3.constructor !== b3.constructor) return false;
          var length, i3, keys;
          if (Array.isArray(a3)) {
            length = a3.length;
            if (length != b3.length) return false;
            for (i3 = length; i3-- !== 0; )
              if (!equal(a3[i3], b3[i3])) return false;
            return true;
          }
          if (a3.constructor === RegExp) return a3.source === b3.source && a3.flags === b3.flags;
          if (a3.valueOf !== Object.prototype.valueOf) return a3.valueOf() === b3.valueOf();
          if (a3.toString !== Object.prototype.toString) return a3.toString() === b3.toString();
          keys = Object.keys(a3);
          length = keys.length;
          if (length !== Object.keys(b3).length) return false;
          for (i3 = length; i3-- !== 0; )
            if (!Object.prototype.hasOwnProperty.call(b3, keys[i3])) return false;
          for (i3 = length; i3-- !== 0; ) {
            var key = keys[i3];
            if (!equal(a3[key], b3[key])) return false;
          }
          return true;
        }
        return a3 !== a3 && b3 !== b3;
      };
    }
  });

  // package-external:@wordpress/dom
  var require_dom = __commonJS({
    "package-external:@wordpress/dom"(exports, module) {
      module.exports = window.wp.dom;
    }
  });

  // package-external:@wordpress/rich-text
  var require_rich_text = __commonJS({
    "package-external:@wordpress/rich-text"(exports, module) {
      module.exports = window.wp.richText;
    }
  });

  // package-external:@wordpress/warning
  var require_warning = __commonJS({
    "package-external:@wordpress/warning"(exports, module) {
      module.exports = window.wp.warning;
    }
  });

  // vendor-external:react
  var require_react = __commonJS({
    "vendor-external:react"(exports, module) {
      module.exports = window.React;
    }
  });

  // node_modules/react-is/cjs/react-is.development.js
  var require_react_is_development = __commonJS({
    "node_modules/react-is/cjs/react-is.development.js"(exports) {
      "use strict";
      if (true) {
        (function() {
          "use strict";
          var hasSymbol = typeof Symbol === "function" && Symbol.for;
          var REACT_ELEMENT_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
          var REACT_PORTAL_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.portal") : 60106;
          var REACT_FRAGMENT_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.fragment") : 60107;
          var REACT_STRICT_MODE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.strict_mode") : 60108;
          var REACT_PROFILER_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.profiler") : 60114;
          var REACT_PROVIDER_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.provider") : 60109;
          var REACT_CONTEXT_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.context") : 60110;
          var REACT_ASYNC_MODE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.async_mode") : 60111;
          var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.concurrent_mode") : 60111;
          var REACT_FORWARD_REF_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.forward_ref") : 60112;
          var REACT_SUSPENSE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.suspense") : 60113;
          var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.suspense_list") : 60120;
          var REACT_MEMO_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.memo") : 60115;
          var REACT_LAZY_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.lazy") : 60116;
          var REACT_BLOCK_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.block") : 60121;
          var REACT_FUNDAMENTAL_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.fundamental") : 60117;
          var REACT_RESPONDER_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.responder") : 60118;
          var REACT_SCOPE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.scope") : 60119;
          function isValidElementType(type) {
            return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
            type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
          }
          function typeOf(object) {
            if (typeof object === "object" && object !== null) {
              var $$typeof = object.$$typeof;
              switch ($$typeof) {
                case REACT_ELEMENT_TYPE:
                  var type = object.type;
                  switch (type) {
                    case REACT_ASYNC_MODE_TYPE:
                    case REACT_CONCURRENT_MODE_TYPE:
                    case REACT_FRAGMENT_TYPE:
                    case REACT_PROFILER_TYPE:
                    case REACT_STRICT_MODE_TYPE:
                    case REACT_SUSPENSE_TYPE:
                      return type;
                    default:
                      var $$typeofType = type && type.$$typeof;
                      switch ($$typeofType) {
                        case REACT_CONTEXT_TYPE:
                        case REACT_FORWARD_REF_TYPE:
                        case REACT_LAZY_TYPE:
                        case REACT_MEMO_TYPE:
                        case REACT_PROVIDER_TYPE:
                          return $$typeofType;
                        default:
                          return $$typeof;
                      }
                  }
                case REACT_PORTAL_TYPE:
                  return $$typeof;
              }
            }
            return void 0;
          }
          var AsyncMode = REACT_ASYNC_MODE_TYPE;
          var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
          var ContextConsumer = REACT_CONTEXT_TYPE;
          var ContextProvider = REACT_PROVIDER_TYPE;
          var Element2 = REACT_ELEMENT_TYPE;
          var ForwardRef = REACT_FORWARD_REF_TYPE;
          var Fragment82 = REACT_FRAGMENT_TYPE;
          var Lazy = REACT_LAZY_TYPE;
          var Memo = REACT_MEMO_TYPE;
          var Portal = REACT_PORTAL_TYPE;
          var Profiler = REACT_PROFILER_TYPE;
          var StrictMode = REACT_STRICT_MODE_TYPE;
          var Suspense = REACT_SUSPENSE_TYPE;
          var hasWarnedAboutDeprecatedIsAsyncMode = false;
          function isAsyncMode(object) {
            {
              if (!hasWarnedAboutDeprecatedIsAsyncMode) {
                hasWarnedAboutDeprecatedIsAsyncMode = true;
                console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
              }
            }
            return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
          }
          function isConcurrentMode(object) {
            return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
          }
          function isContextConsumer(object) {
            return typeOf(object) === REACT_CONTEXT_TYPE;
          }
          function isContextProvider(object) {
            return typeOf(object) === REACT_PROVIDER_TYPE;
          }
          function isElement2(object) {
            return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
          }
          function isForwardRef(object) {
            return typeOf(object) === REACT_FORWARD_REF_TYPE;
          }
          function isFragment(object) {
            return typeOf(object) === REACT_FRAGMENT_TYPE;
          }
          function isLazy(object) {
            return typeOf(object) === REACT_LAZY_TYPE;
          }
          function isMemo(object) {
            return typeOf(object) === REACT_MEMO_TYPE;
          }
          function isPortal(object) {
            return typeOf(object) === REACT_PORTAL_TYPE;
          }
          function isProfiler(object) {
            return typeOf(object) === REACT_PROFILER_TYPE;
          }
          function isStrictMode(object) {
            return typeOf(object) === REACT_STRICT_MODE_TYPE;
          }
          function isSuspense(object) {
            return typeOf(object) === REACT_SUSPENSE_TYPE;
          }
          exports.AsyncMode = AsyncMode;
          exports.ConcurrentMode = ConcurrentMode;
          exports.ContextConsumer = ContextConsumer;
          exports.ContextProvider = ContextProvider;
          exports.Element = Element2;
          exports.ForwardRef = ForwardRef;
          exports.Fragment = Fragment82;
          exports.Lazy = Lazy;
          exports.Memo = Memo;
          exports.Portal = Portal;
          exports.Profiler = Profiler;
          exports.StrictMode = StrictMode;
          exports.Suspense = Suspense;
          exports.isAsyncMode = isAsyncMode;
          exports.isConcurrentMode = isConcurrentMode;
          exports.isContextConsumer = isContextConsumer;
          exports.isContextProvider = isContextProvider;
          exports.isElement = isElement2;
          exports.isForwardRef = isForwardRef;
          exports.isFragment = isFragment;
          exports.isLazy = isLazy;
          exports.isMemo = isMemo;
          exports.isPortal = isPortal;
          exports.isProfiler = isProfiler;
          exports.isStrictMode = isStrictMode;
          exports.isSuspense = isSuspense;
          exports.isValidElementType = isValidElementType;
          exports.typeOf = typeOf;
        })();
      }
    }
  });

  // node_modules/react-is/index.js
  var require_react_is = __commonJS({
    "node_modules/react-is/index.js"(exports, module) {
      "use strict";
      if (false) {
        module.exports = null;
      } else {
        module.exports = require_react_is_development();
      }
    }
  });

  // node_modules/object-assign/index.js
  var require_object_assign = __commonJS({
    "node_modules/object-assign/index.js"(exports, module) {
      "use strict";
      var getOwnPropertySymbols = Object.getOwnPropertySymbols;
      var hasOwnProperty = Object.prototype.hasOwnProperty;
      var propIsEnumerable = Object.prototype.propertyIsEnumerable;
      function toObject(val) {
        if (val === null || val === void 0) {
          throw new TypeError("Object.assign cannot be called with null or undefined");
        }
        return Object(val);
      }
      function shouldUseNative() {
        try {
          if (!Object.assign) {
            return false;
          }
          var test1 = new String("abc");
          test1[5] = "de";
          if (Object.getOwnPropertyNames(test1)[0] === "5") {
            return false;
          }
          var test2 = {};
          for (var i3 = 0; i3 < 10; i3++) {
            test2["_" + String.fromCharCode(i3)] = i3;
          }
          var order2 = Object.getOwnPropertyNames(test2).map(function(n3) {
            return test2[n3];
          });
          if (order2.join("") !== "0123456789") {
            return false;
          }
          var test3 = {};
          "abcdefghijklmnopqrst".split("").forEach(function(letter) {
            test3[letter] = letter;
          });
          if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
            return false;
          }
          return true;
        } catch (err) {
          return false;
        }
      }
      module.exports = shouldUseNative() ? Object.assign : function(target, source) {
        var from;
        var to = toObject(target);
        var symbols;
        for (var s3 = 1; s3 < arguments.length; s3++) {
          from = Object(arguments[s3]);
          for (var key in from) {
            if (hasOwnProperty.call(from, key)) {
              to[key] = from[key];
            }
          }
          if (getOwnPropertySymbols) {
            symbols = getOwnPropertySymbols(from);
            for (var i3 = 0; i3 < symbols.length; i3++) {
              if (propIsEnumerable.call(from, symbols[i3])) {
                to[symbols[i3]] = from[symbols[i3]];
              }
            }
          }
        }
        return to;
      };
    }
  });

  // node_modules/prop-types/lib/ReactPropTypesSecret.js
  var require_ReactPropTypesSecret = __commonJS({
    "node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
      "use strict";
      var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
      module.exports = ReactPropTypesSecret;
    }
  });

  // node_modules/prop-types/lib/has.js
  var require_has = __commonJS({
    "node_modules/prop-types/lib/has.js"(exports, module) {
      module.exports = Function.call.bind(Object.prototype.hasOwnProperty);
    }
  });

  // node_modules/prop-types/checkPropTypes.js
  var require_checkPropTypes = __commonJS({
    "node_modules/prop-types/checkPropTypes.js"(exports, module) {
      "use strict";
      var printWarning = function() {
      };
      if (true) {
        ReactPropTypesSecret = require_ReactPropTypesSecret();
        loggedTypeFailures = {};
        has = require_has();
        printWarning = function(text) {
          var message = "Warning: " + text;
          if (typeof console !== "undefined") {
            console.error(message);
          }
          try {
            throw new Error(message);
          } catch (x2) {
          }
        };
      }
      var ReactPropTypesSecret;
      var loggedTypeFailures;
      var has;
      function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
        if (true) {
          for (var typeSpecName in typeSpecs) {
            if (has(typeSpecs, typeSpecName)) {
              var error;
              try {
                if (typeof typeSpecs[typeSpecName] !== "function") {
                  var err = Error(
                    (componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
                  );
                  err.name = "Invariant Violation";
                  throw err;
                }
                error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
              } catch (ex) {
                error = ex;
              }
              if (error && !(error instanceof Error)) {
                printWarning(
                  (componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
                );
              }
              if (error instanceof Error && !(error.message in loggedTypeFailures)) {
                loggedTypeFailures[error.message] = true;
                var stack = getStack ? getStack() : "";
                printWarning(
                  "Failed " + location + " type: " + error.message + (stack != null ? stack : "")
                );
              }
            }
          }
        }
      }
      checkPropTypes.resetWarningCache = function() {
        if (true) {
          loggedTypeFailures = {};
        }
      };
      module.exports = checkPropTypes;
    }
  });

  // node_modules/prop-types/factoryWithTypeCheckers.js
  var require_factoryWithTypeCheckers = __commonJS({
    "node_modules/prop-types/factoryWithTypeCheckers.js"(exports, module) {
      "use strict";
      var ReactIs = require_react_is();
      var assign = require_object_assign();
      var ReactPropTypesSecret = require_ReactPropTypesSecret();
      var has = require_has();
      var checkPropTypes = require_checkPropTypes();
      var printWarning = function() {
      };
      if (true) {
        printWarning = function(text) {
          var message = "Warning: " + text;
          if (typeof console !== "undefined") {
            console.error(message);
          }
          try {
            throw new Error(message);
          } catch (x2) {
          }
        };
      }
      function emptyFunctionThatReturnsNull() {
        return null;
      }
      module.exports = function(isValidElement, throwOnDirectAccess) {
        var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
        var FAUX_ITERATOR_SYMBOL = "@@iterator";
        function getIteratorFn(maybeIterable) {
          var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
          if (typeof iteratorFn === "function") {
            return iteratorFn;
          }
        }
        var ANONYMOUS = "<<anonymous>>";
        var ReactPropTypes = {
          array: createPrimitiveTypeChecker("array"),
          bigint: createPrimitiveTypeChecker("bigint"),
          bool: createPrimitiveTypeChecker("boolean"),
          func: createPrimitiveTypeChecker("function"),
          number: createPrimitiveTypeChecker("number"),
          object: createPrimitiveTypeChecker("object"),
          string: createPrimitiveTypeChecker("string"),
          symbol: createPrimitiveTypeChecker("symbol"),
          any: createAnyTypeChecker(),
          arrayOf: createArrayOfTypeChecker,
          element: createElementTypeChecker(),
          elementType: createElementTypeTypeChecker(),
          instanceOf: createInstanceTypeChecker,
          node: createNodeChecker(),
          objectOf: createObjectOfTypeChecker,
          oneOf: createEnumTypeChecker,
          oneOfType: createUnionTypeChecker,
          shape: createShapeTypeChecker,
          exact: createStrictShapeTypeChecker
        };
        function is(x2, y3) {
          if (x2 === y3) {
            return x2 !== 0 || 1 / x2 === 1 / y3;
          } else {
            return x2 !== x2 && y3 !== y3;
          }
        }
        function PropTypeError(message, data) {
          this.message = message;
          this.data = data && typeof data === "object" ? data : {};
          this.stack = "";
        }
        PropTypeError.prototype = Error.prototype;
        function createChainableTypeChecker(validate) {
          if (true) {
            var manualPropTypeCallCache = {};
            var manualPropTypeWarningCount = 0;
          }
          function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
            componentName = componentName || ANONYMOUS;
            propFullName = propFullName || propName;
            if (secret !== ReactPropTypesSecret) {
              if (throwOnDirectAccess) {
                var err = new Error(
                  "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
                );
                err.name = "Invariant Violation";
                throw err;
              } else if (typeof console !== "undefined") {
                var cacheKey = componentName + ":" + propName;
                if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
                manualPropTypeWarningCount < 3) {
                  printWarning(
                    "You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
                  );
                  manualPropTypeCallCache[cacheKey] = true;
                  manualPropTypeWarningCount++;
                }
              }
            }
            if (props[propName] == null) {
              if (isRequired) {
                if (props[propName] === null) {
                  return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
                }
                return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
              }
              return null;
            } else {
              return validate(props, propName, componentName, location, propFullName);
            }
          }
          var chainedCheckType = checkType.bind(null, false);
          chainedCheckType.isRequired = checkType.bind(null, true);
          return chainedCheckType;
        }
        function createPrimitiveTypeChecker(expectedType) {
          function validate(props, propName, componentName, location, propFullName, secret) {
            var propValue = props[propName];
            var propType = getPropType(propValue);
            if (propType !== expectedType) {
              var preciseType = getPreciseType(propValue);
              return new PropTypeError(
                "Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
                { expectedType }
              );
            }
            return null;
          }
          return createChainableTypeChecker(validate);
        }
        function createAnyTypeChecker() {
          return createChainableTypeChecker(emptyFunctionThatReturnsNull);
        }
        function createArrayOfTypeChecker(typeChecker) {
          function validate(props, propName, componentName, location, propFullName) {
            if (typeof typeChecker !== "function") {
              return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
            }
            var propValue = props[propName];
            if (!Array.isArray(propValue)) {
              var propType = getPropType(propValue);
              return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
            }
            for (var i3 = 0; i3 < propValue.length; i3++) {
              var error = typeChecker(propValue, i3, componentName, location, propFullName + "[" + i3 + "]", ReactPropTypesSecret);
              if (error instanceof Error) {
                return error;
              }
            }
            return null;
          }
          return createChainableTypeChecker(validate);
        }
        function createElementTypeChecker() {
          function validate(props, propName, componentName, location, propFullName) {
            var propValue = props[propName];
            if (!isValidElement(propValue)) {
              var propType = getPropType(propValue);
              return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
            }
            return null;
          }
          return createChainableTypeChecker(validate);
        }
        function createElementTypeTypeChecker() {
          function validate(props, propName, componentName, location, propFullName) {
            var propValue = props[propName];
            if (!ReactIs.isValidElementType(propValue)) {
              var propType = getPropType(propValue);
              return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
            }
            return null;
          }
          return createChainableTypeChecker(validate);
        }
        function createInstanceTypeChecker(expectedClass) {
          function validate(props, propName, componentName, location, propFullName) {
            if (!(props[propName] instanceof expectedClass)) {
              var expectedClassName = expectedClass.name || ANONYMOUS;
              var actualClassName = getClassName(props[propName]);
              return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
            }
            return null;
          }
          return createChainableTypeChecker(validate);
        }
        function createEnumTypeChecker(expectedValues) {
          if (!Array.isArray(expectedValues)) {
            if (true) {
              if (arguments.length > 1) {
                printWarning(
                  "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
                );
              } else {
                printWarning("Invalid argument supplied to oneOf, expected an array.");
              }
            }
            return emptyFunctionThatReturnsNull;
          }
          function validate(props, propName, componentName, location, propFullName) {
            var propValue = props[propName];
            for (var i3 = 0; i3 < expectedValues.length; i3++) {
              if (is(propValue, expectedValues[i3])) {
                return null;
              }
            }
            var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
              var type = getPreciseType(value);
              if (type === "symbol") {
                return String(value);
              }
              return value;
            });
            return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
          }
          return createChainableTypeChecker(validate);
        }
        function createObjectOfTypeChecker(typeChecker) {
          function validate(props, propName, componentName, location, propFullName) {
            if (typeof typeChecker !== "function") {
              return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
            }
            var propValue = props[propName];
            var propType = getPropType(propValue);
            if (propType !== "object") {
              return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
            }
            for (var key in propValue) {
              if (has(propValue, key)) {
                var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
                if (error instanceof Error) {
                  return error;
                }
              }
            }
            return null;
          }
          return createChainableTypeChecker(validate);
        }
        function createUnionTypeChecker(arrayOfTypeCheckers) {
          if (!Array.isArray(arrayOfTypeCheckers)) {
            true ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
            return emptyFunctionThatReturnsNull;
          }
          for (var i3 = 0; i3 < arrayOfTypeCheckers.length; i3++) {
            var checker = arrayOfTypeCheckers[i3];
            if (typeof checker !== "function") {
              printWarning(
                "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i3 + "."
              );
              return emptyFunctionThatReturnsNull;
            }
          }
          function validate(props, propName, componentName, location, propFullName) {
            var expectedTypes = [];
            for (var i4 = 0; i4 < arrayOfTypeCheckers.length; i4++) {
              var checker2 = arrayOfTypeCheckers[i4];
              var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
              if (checkerResult == null) {
                return null;
              }
              if (checkerResult.data && has(checkerResult.data, "expectedType")) {
                expectedTypes.push(checkerResult.data.expectedType);
              }
            }
            var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
            return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
          }
          return createChainableTypeChecker(validate);
        }
        function createNodeChecker() {
          function validate(props, propName, componentName, location, propFullName) {
            if (!isNode2(props[propName])) {
              return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
            }
            return null;
          }
          return createChainableTypeChecker(validate);
        }
        function invalidValidatorError(componentName, location, propFullName, key, type) {
          return new PropTypeError(
            (componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
          );
        }
        function createShapeTypeChecker(shapeTypes) {
          function validate(props, propName, componentName, location, propFullName) {
            var propValue = props[propName];
            var propType = getPropType(propValue);
            if (propType !== "object") {
              return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
            }
            for (var key in shapeTypes) {
              var checker = shapeTypes[key];
              if (typeof checker !== "function") {
                return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
              }
              var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
              if (error) {
                return error;
              }
            }
            return null;
          }
          return createChainableTypeChecker(validate);
        }
        function createStrictShapeTypeChecker(shapeTypes) {
          function validate(props, propName, componentName, location, propFullName) {
            var propValue = props[propName];
            var propType = getPropType(propValue);
            if (propType !== "object") {
              return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
            }
            var allKeys = assign({}, props[propName], shapeTypes);
            for (var key in allKeys) {
              var checker = shapeTypes[key];
              if (has(shapeTypes, key) && typeof checker !== "function") {
                return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
              }
              if (!checker) {
                return new PropTypeError(
                  "Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, "  ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, "  ")
                );
              }
              var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
              if (error) {
                return error;
              }
            }
            return null;
          }
          return createChainableTypeChecker(validate);
        }
        function isNode2(propValue) {
          switch (typeof propValue) {
            case "number":
            case "string":
            case "undefined":
              return true;
            case "boolean":
              return !propValue;
            case "object":
              if (Array.isArray(propValue)) {
                return propValue.every(isNode2);
              }
              if (propValue === null || isValidElement(propValue)) {
                return true;
              }
              var iteratorFn = getIteratorFn(propValue);
              if (iteratorFn) {
                var iterator = iteratorFn.call(propValue);
                var step;
                if (iteratorFn !== propValue.entries) {
                  while (!(step = iterator.next()).done) {
                    if (!isNode2(step.value)) {
                      return false;
                    }
                  }
                } else {
                  while (!(step = iterator.next()).done) {
                    var entry = step.value;
                    if (entry) {
                      if (!isNode2(entry[1])) {
                        return false;
                      }
                    }
                  }
                }
              } else {
                return false;
              }
              return true;
            default:
              return false;
          }
        }
        function isSymbol(propType, propValue) {
          if (propType === "symbol") {
            return true;
          }
          if (!propValue) {
            return false;
          }
          if (propValue["@@toStringTag"] === "Symbol") {
            return true;
          }
          if (typeof Symbol === "function" && propValue instanceof Symbol) {
            return true;
          }
          return false;
        }
        function getPropType(propValue) {
          var propType = typeof propValue;
          if (Array.isArray(propValue)) {
            return "array";
          }
          if (propValue instanceof RegExp) {
            return "object";
          }
          if (isSymbol(propType, propValue)) {
            return "symbol";
          }
          return propType;
        }
        function getPreciseType(propValue) {
          if (typeof propValue === "undefined" || propValue === null) {
            return "" + propValue;
          }
          var propType = getPropType(propValue);
          if (propType === "object") {
            if (propValue instanceof Date) {
              return "date";
            } else if (propValue instanceof RegExp) {
              return "regexp";
            }
          }
          return propType;
        }
        function getPostfixForTypeWarning(value) {
          var type = getPreciseType(value);
          switch (type) {
            case "array":
            case "object":
              return "an " + type;
            case "boolean":
            case "date":
            case "regexp":
              return "a " + type;
            default:
              return type;
          }
        }
        function getClassName(propValue) {
          if (!propValue.constructor || !propValue.constructor.name) {
            return ANONYMOUS;
          }
          return propValue.constructor.name;
        }
        ReactPropTypes.checkPropTypes = checkPropTypes;
        ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
        ReactPropTypes.PropTypes = ReactPropTypes;
        return ReactPropTypes;
      };
    }
  });

  // node_modules/prop-types/index.js
  var require_prop_types = __commonJS({
    "node_modules/prop-types/index.js"(exports, module) {
      if (true) {
        ReactIs = require_react_is();
        throwOnDirectAccess = true;
        module.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
      } else {
        module.exports = null();
      }
      var ReactIs;
      var throwOnDirectAccess;
    }
  });

  // node_modules/autosize/dist/autosize.js
  var require_autosize = __commonJS({
    "node_modules/autosize/dist/autosize.js"(exports, module) {
      (function(global, factory) {
        if (typeof define === "function" && define.amd) {
          define(["module", "exports"], factory);
        } else if (typeof exports !== "undefined") {
          factory(module, exports);
        } else {
          var mod = {
            exports: {}
          };
          factory(mod, mod.exports);
          global.autosize = mod.exports;
        }
      })(exports, function(module2, exports2) {
        "use strict";
        var map = typeof Map === "function" ? /* @__PURE__ */ new Map() : /* @__PURE__ */ (function() {
          var keys = [];
          var values = [];
          return {
            has: function has(key) {
              return keys.indexOf(key) > -1;
            },
            get: function get(key) {
              return values[keys.indexOf(key)];
            },
            set: function set(key, value) {
              if (keys.indexOf(key) === -1) {
                keys.push(key);
                values.push(value);
              }
            },
            delete: function _delete(key) {
              var index2 = keys.indexOf(key);
              if (index2 > -1) {
                keys.splice(index2, 1);
                values.splice(index2, 1);
              }
            }
          };
        })();
        var createEvent = function createEvent2(name2) {
          return new Event(name2, { bubbles: true });
        };
        try {
          new Event("test");
        } catch (e3) {
          createEvent = function createEvent2(name2) {
            var evt = document.createEvent("Event");
            evt.initEvent(name2, true, false);
            return evt;
          };
        }
        function assign(ta) {
          if (!ta || !ta.nodeName || ta.nodeName !== "TEXTAREA" || map.has(ta)) return;
          var heightOffset = null;
          var clientWidth = null;
          var cachedHeight = null;
          function init() {
            var style = window.getComputedStyle(ta, null);
            if (style.resize === "vertical") {
              ta.style.resize = "none";
            } else if (style.resize === "both") {
              ta.style.resize = "horizontal";
            }
            if (style.boxSizing === "content-box") {
              heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
            } else {
              heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
            }
            if (isNaN(heightOffset)) {
              heightOffset = 0;
            }
            update2();
          }
          function changeOverflow(value) {
            {
              var width = ta.style.width;
              ta.style.width = "0px";
              ta.offsetWidth;
              ta.style.width = width;
            }
            ta.style.overflowY = value;
          }
          function getParentOverflows(el) {
            var arr = [];
            while (el && el.parentNode && el.parentNode instanceof Element) {
              if (el.parentNode.scrollTop) {
                arr.push({
                  node: el.parentNode,
                  scrollTop: el.parentNode.scrollTop
                });
              }
              el = el.parentNode;
            }
            return arr;
          }
          function resize() {
            if (ta.scrollHeight === 0) {
              return;
            }
            var overflows = getParentOverflows(ta);
            var docTop = document.documentElement && document.documentElement.scrollTop;
            ta.style.height = "";
            ta.style.height = ta.scrollHeight + heightOffset + "px";
            clientWidth = ta.clientWidth;
            overflows.forEach(function(el) {
              el.node.scrollTop = el.scrollTop;
            });
            if (docTop) {
              document.documentElement.scrollTop = docTop;
            }
          }
          function update2() {
            resize();
            var styleHeight = Math.round(parseFloat(ta.style.height));
            var computed = window.getComputedStyle(ta, null);
            var actualHeight = computed.boxSizing === "content-box" ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
            if (actualHeight < styleHeight) {
              if (computed.overflowY === "hidden") {
                changeOverflow("scroll");
                resize();
                actualHeight = computed.boxSizing === "content-box" ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
              }
            } else {
              if (computed.overflowY !== "hidden") {
                changeOverflow("hidden");
                resize();
                actualHeight = computed.boxSizing === "content-box" ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
              }
            }
            if (cachedHeight !== actualHeight) {
              cachedHeight = actualHeight;
              var evt = createEvent("autosize:resized");
              try {
                ta.dispatchEvent(evt);
              } catch (err) {
              }
            }
          }
          var pageResize = function pageResize2() {
            if (ta.clientWidth !== clientWidth) {
              update2();
            }
          };
          var destroy2 = function(style) {
            window.removeEventListener("resize", pageResize, false);
            ta.removeEventListener("input", update2, false);
            ta.removeEventListener("keyup", update2, false);
            ta.removeEventListener("autosize:destroy", destroy2, false);
            ta.removeEventListener("autosize:update", update2, false);
            Object.keys(style).forEach(function(key) {
              ta.style[key] = style[key];
            });
            map.delete(ta);
          }.bind(ta, {
            height: ta.style.height,
            resize: ta.style.resize,
            overflowY: ta.style.overflowY,
            overflowX: ta.style.overflowX,
            wordWrap: ta.style.wordWrap
          });
          ta.addEventListener("autosize:destroy", destroy2, false);
          if ("onpropertychange" in ta && "oninput" in ta) {
            ta.addEventListener("keyup", update2, false);
          }
          window.addEventListener("resize", pageResize, false);
          ta.addEventListener("input", update2, false);
          ta.addEventListener("autosize:update", update2, false);
          ta.style.overflowX = "hidden";
          ta.style.wordWrap = "break-word";
          map.set(ta, {
            destroy: destroy2,
            update: update2
          });
          init();
        }
        function destroy(ta) {
          var methods = map.get(ta);
          if (methods) {
            methods.destroy();
          }
        }
        function update(ta) {
          var methods = map.get(ta);
          if (methods) {
            methods.update();
          }
        }
        var autosize = null;
        if (typeof window === "undefined" || typeof window.getComputedStyle !== "function") {
          autosize = function autosize2(el) {
            return el;
          };
          autosize.destroy = function(el) {
            return el;
          };
          autosize.update = function(el) {
            return el;
          };
        } else {
          autosize = function autosize2(el, options) {
            if (el) {
              Array.prototype.forEach.call(el.length ? el : [el], function(x2) {
                return assign(x2, options);
              });
            }
            return el;
          };
          autosize.destroy = function(el) {
            if (el) {
              Array.prototype.forEach.call(el.length ? el : [el], destroy);
            }
            return el;
          };
          autosize.update = function(el) {
            if (el) {
              Array.prototype.forEach.call(el.length ? el : [el], update);
            }
            return el;
          };
        }
        exports2.default = autosize;
        module2.exports = exports2["default"];
      });
    }
  });

  // node_modules/computed-style/dist/computedStyle.commonjs.js
  var require_computedStyle_commonjs = __commonJS({
    "node_modules/computed-style/dist/computedStyle.commonjs.js"(exports, module) {
      var computedStyle = function(el, prop, getComputedStyle3) {
        getComputedStyle3 = window.getComputedStyle;
        return (
          // If we have getComputedStyle
          (getComputedStyle3 ? (
            // Query it
            // TODO: From CSS-Query notes, we might need (node, null) for FF
            getComputedStyle3(el)
          ) : (
            // Otherwise, we are in IE and use currentStyle
            el.currentStyle
          ))[
            // Switch to camelCase for CSSOM
            // DEV: Grabbed from jQuery
            // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
            // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
            prop.replace(/-(\w)/gi, function(word, letter) {
              return letter.toUpperCase();
            })
          ]
        );
      };
      module.exports = computedStyle;
    }
  });

  // node_modules/line-height/lib/line-height.js
  var require_line_height = __commonJS({
    "node_modules/line-height/lib/line-height.js"(exports, module) {
      var computedStyle = require_computedStyle_commonjs();
      function lineHeight(node) {
        var lnHeightStr = computedStyle(node, "line-height");
        var lnHeight = parseFloat(lnHeightStr, 10);
        if (lnHeightStr === lnHeight + "") {
          var _lnHeightStyle = node.style.lineHeight;
          node.style.lineHeight = lnHeightStr + "em";
          lnHeightStr = computedStyle(node, "line-height");
          lnHeight = parseFloat(lnHeightStr, 10);
          if (_lnHeightStyle) {
            node.style.lineHeight = _lnHeightStyle;
          } else {
            delete node.style.lineHeight;
          }
        }
        if (lnHeightStr.indexOf("pt") !== -1) {
          lnHeight *= 4;
          lnHeight /= 3;
        } else if (lnHeightStr.indexOf("mm") !== -1) {
          lnHeight *= 96;
          lnHeight /= 25.4;
        } else if (lnHeightStr.indexOf("cm") !== -1) {
          lnHeight *= 96;
          lnHeight /= 2.54;
        } else if (lnHeightStr.indexOf("in") !== -1) {
          lnHeight *= 96;
        } else if (lnHeightStr.indexOf("pc") !== -1) {
          lnHeight *= 16;
        }
        lnHeight = Math.round(lnHeight);
        if (lnHeightStr === "normal") {
          var nodeName = node.nodeName;
          var _node = document.createElement(nodeName);
          _node.innerHTML = "&nbsp;";
          if (nodeName.toUpperCase() === "TEXTAREA") {
            _node.setAttribute("rows", "1");
          }
          var fontSizeStr = computedStyle(node, "font-size");
          _node.style.fontSize = fontSizeStr;
          _node.style.padding = "0px";
          _node.style.border = "0px";
          var body = document.body;
          body.appendChild(_node);
          var height = _node.offsetHeight;
          lnHeight = height;
          body.removeChild(_node);
        }
        return lnHeight;
      }
      module.exports = lineHeight;
    }
  });

  // node_modules/react-autosize-textarea/lib/TextareaAutosize.js
  var require_TextareaAutosize = __commonJS({
    "node_modules/react-autosize-textarea/lib/TextareaAutosize.js"(exports) {
      "use strict";
      var __extends = exports && exports.__extends || (function() {
        var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p4 in b3) if (b3.hasOwnProperty(p4)) d3[p4] = b3[p4];
        };
        return function(d3, b3) {
          extendStatics(d3, b3);
          function __218() {
            this.constructor = d3;
          }
          d3.prototype = b3 === null ? Object.create(b3) : (__218.prototype = b3.prototype, new __218());
        };
      })();
      var __assign2 = exports && exports.__assign || Object.assign || function(t4) {
        for (var s3, i3 = 1, n3 = arguments.length; i3 < n3; i3++) {
          s3 = arguments[i3];
          for (var p4 in s3) if (Object.prototype.hasOwnProperty.call(s3, p4))
            t4[p4] = s3[p4];
        }
        return t4;
      };
      var __rest = exports && exports.__rest || function(s3, e3) {
        var t4 = {};
        for (var p4 in s3) if (Object.prototype.hasOwnProperty.call(s3, p4) && e3.indexOf(p4) < 0)
          t4[p4] = s3[p4];
        if (s3 != null && typeof Object.getOwnPropertySymbols === "function") {
          for (var i3 = 0, p4 = Object.getOwnPropertySymbols(s3); i3 < p4.length; i3++) if (e3.indexOf(p4[i3]) < 0)
            t4[p4[i3]] = s3[p4[i3]];
        }
        return t4;
      };
      exports.__esModule = true;
      var React2 = require_react();
      var PropTypes = require_prop_types();
      var autosize = require_autosize();
      var _getLineHeight = require_line_height();
      var getLineHeight = _getLineHeight;
      var RESIZED = "autosize:resized";
      var TextareaAutosizeClass = (
        /** @class */
        (function(_super) {
          __extends(TextareaAutosizeClass2, _super);
          function TextareaAutosizeClass2() {
            var _this = _super !== null && _super.apply(this, arguments) || this;
            _this.state = {
              lineHeight: null
            };
            _this.textarea = null;
            _this.onResize = function(e3) {
              if (_this.props.onResize) {
                _this.props.onResize(e3);
              }
            };
            _this.updateLineHeight = function() {
              if (_this.textarea) {
                _this.setState({
                  lineHeight: getLineHeight(_this.textarea)
                });
              }
            };
            _this.onChange = function(e3) {
              var onChange = _this.props.onChange;
              _this.currentValue = e3.currentTarget.value;
              onChange && onChange(e3);
            };
            return _this;
          }
          TextareaAutosizeClass2.prototype.componentDidMount = function() {
            var _this = this;
            var _a = this.props, maxRows = _a.maxRows, async = _a.async;
            if (typeof maxRows === "number") {
              this.updateLineHeight();
            }
            if (typeof maxRows === "number" || async) {
              setTimeout(function() {
                return _this.textarea && autosize(_this.textarea);
              });
            } else {
              this.textarea && autosize(this.textarea);
            }
            if (this.textarea) {
              this.textarea.addEventListener(RESIZED, this.onResize);
            }
          };
          TextareaAutosizeClass2.prototype.componentWillUnmount = function() {
            if (this.textarea) {
              this.textarea.removeEventListener(RESIZED, this.onResize);
              autosize.destroy(this.textarea);
            }
          };
          TextareaAutosizeClass2.prototype.render = function() {
            var _this = this;
            var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight;
            var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
            return React2.createElement("textarea", __assign2({}, props, { onChange: this.onChange, style: maxHeight ? __assign2({}, style, { maxHeight }) : style, ref: function(element) {
              _this.textarea = element;
              if (typeof _this.props.innerRef === "function") {
                _this.props.innerRef(element);
              } else if (_this.props.innerRef) {
                _this.props.innerRef.current = element;
              }
            } }), children);
          };
          TextareaAutosizeClass2.prototype.componentDidUpdate = function() {
            this.textarea && autosize.update(this.textarea);
          };
          TextareaAutosizeClass2.defaultProps = {
            rows: 1,
            async: false
          };
          TextareaAutosizeClass2.propTypes = {
            rows: PropTypes.number,
            maxRows: PropTypes.number,
            onResize: PropTypes.func,
            innerRef: PropTypes.any,
            async: PropTypes.bool
          };
          return TextareaAutosizeClass2;
        })(React2.Component)
      );
      exports.TextareaAutosize = React2.forwardRef(function(props, ref) {
        return React2.createElement(TextareaAutosizeClass, __assign2({}, props, { innerRef: ref }));
      });
    }
  });

  // node_modules/react-autosize-textarea/lib/index.js
  var require_lib = __commonJS({
    "node_modules/react-autosize-textarea/lib/index.js"(exports, module) {
      "use strict";
      var TextareaAutosize_1 = require_TextareaAutosize();
      module.exports = TextareaAutosize_1.TextareaAutosize;
    }
  });

  // package-external:@wordpress/wordcount
  var require_wordcount = __commonJS({
    "package-external:@wordpress/wordcount"(exports, module) {
      module.exports = window.wp.wordcount;
    }
  });

  // package-external:@wordpress/server-side-render
  var require_server_side_render = __commonJS({
    "package-external:@wordpress/server-side-render"(exports, module) {
      module.exports = window.wp.serverSideRender;
    }
  });

  // vendor-external:react-dom
  var require_react_dom = __commonJS({
    "vendor-external:react-dom"(exports, module) {
      module.exports = window.ReactDOM;
    }
  });

  // packages/editor/build-module/index.mjs
  var index_exports = {};
  __export(index_exports, {
    AlignmentToolbar: () => AlignmentToolbar,
    Autocomplete: () => Autocomplete,
    AutosaveMonitor: () => autosave_monitor_default,
    BlockAlignmentToolbar: () => BlockAlignmentToolbar,
    BlockControls: () => BlockControls,
    BlockEdit: () => BlockEdit,
    BlockEditorKeyboardShortcuts: () => BlockEditorKeyboardShortcuts2,
    BlockFormatControls: () => BlockFormatControls,
    BlockIcon: () => BlockIcon3,
    BlockInspector: () => BlockInspector,
    BlockList: () => BlockList4,
    BlockMover: () => BlockMover,
    BlockNavigationDropdown: () => BlockNavigationDropdown,
    BlockSelectionClearer: () => BlockSelectionClearer,
    BlockSettingsMenu: () => BlockSettingsMenu,
    BlockTitle: () => BlockTitle,
    BlockToolbar: () => BlockToolbar,
    CharacterCount: () => CharacterCount,
    ColorPalette: () => ColorPalette2,
    ContrastChecker: () => ContrastChecker,
    CopyHandler: () => CopyHandler,
    DefaultBlockAppender: () => DefaultBlockAppender,
    DocumentBar: () => DocumentBar,
    DocumentOutline: () => DocumentOutline,
    DocumentOutlineCheck: () => DocumentOutlineCheck,
    EditorHistoryRedo: () => redo_default2,
    EditorHistoryUndo: () => undo_default2,
    EditorKeyboardShortcuts: () => EditorKeyboardShortcuts,
    EditorKeyboardShortcutsRegister: () => register_shortcuts_default,
    EditorNotices: () => editor_notices_default,
    EditorProvider: () => provider_default,
    EditorSnackbars: () => EditorSnackbars,
    EntitiesSavedStates: () => EntitiesSavedStates,
    ErrorBoundary: () => error_boundary_default,
    FontSizePicker: () => FontSizePicker,
    InnerBlocks: () => InnerBlocks,
    Inserter: () => Inserter,
    InspectorAdvancedControls: () => InspectorAdvancedControls,
    InspectorControls: () => InspectorControls,
    LocalAutosaveMonitor: () => local_autosave_monitor_default,
    MediaPlaceholder: () => MediaPlaceholder,
    MediaUpload: () => MediaUpload3,
    MediaUploadCheck: () => MediaUploadCheck2,
    MultiSelectScrollIntoView: () => MultiSelectScrollIntoView,
    NavigableToolbar: () => NavigableToolbar,
    ObserveTyping: () => ObserveTyping,
    PageAttributesCheck: () => check_default2,
    PageAttributesOrder: () => PageAttributesOrderWithChecks,
    PageAttributesPanel: () => PageAttributesPanel,
    PageAttributesParent: () => parent_default2,
    PageTemplate: () => classic_theme_default,
    PanelColorSettings: () => PanelColorSettings,
    PlainText: () => PlainText,
    PluginBlockSettingsMenuItem: () => plugin_block_settings_menu_item_default,
    PluginDocumentSettingPanel: () => plugin_document_setting_panel_default,
    PluginMoreMenuItem: () => PluginMoreMenuItem,
    PluginPostPublishPanel: () => plugin_post_publish_panel_default,
    PluginPostStatusInfo: () => plugin_post_status_info_default,
    PluginPrePublishPanel: () => plugin_pre_publish_panel_default,
    PluginPreviewMenuItem: () => PluginPreviewMenuItem,
    PluginSidebar: () => PluginSidebar,
    PluginSidebarMoreMenuItem: () => PluginSidebarMoreMenuItem,
    PostAuthor: () => post_author_default,
    PostAuthorCheck: () => PostAuthorCheck,
    PostAuthorPanel: () => panel_default,
    PostComments: () => post_comments_default,
    PostDiscussionPanel: () => PostDiscussionPanel,
    PostExcerpt: () => PostExcerpt,
    PostExcerptCheck: () => check_default3,
    PostExcerptPanel: () => PostExcerptPanel,
    PostFeaturedImage: () => post_featured_image_default,
    PostFeaturedImageCheck: () => check_default4,
    PostFeaturedImagePanel: () => PostFeaturedImagePanel,
    PostFormat: () => PostFormat,
    PostFormatCheck: () => PostFormatCheck,
    PostLastRevision: () => post_last_revision_default,
    PostLastRevisionCheck: () => check_default5,
    PostLastRevisionPanel: () => panel_default2,
    PostLockedModal: () => post_locked_modal_default,
    PostPendingStatus: () => post_pending_status_default,
    PostPendingStatusCheck: () => check_default6,
    PostPingbacks: () => post_pingbacks_default,
    PostPreviewButton: () => PostPreviewButton,
    PostPublishButton: () => post_publish_button_default,
    PostPublishButtonLabel: () => PublishButtonLabel,
    PostPublishPanel: () => post_publish_panel_default,
    PostSavedState: () => PostSavedState,
    PostSchedule: () => PostSchedule,
    PostScheduleCheck: () => PostScheduleCheck,
    PostScheduleLabel: () => PostScheduleLabel,
    PostSchedulePanel: () => PostSchedulePanel,
    PostSticky: () => PostSticky,
    PostStickyCheck: () => PostStickyCheck,
    PostSwitchToDraftButton: () => PostSwitchToDraftButton,
    PostSyncStatus: () => PostSyncStatus,
    PostTaxonomies: () => post_taxonomies_default,
    PostTaxonomiesCheck: () => PostTaxonomiesCheck,
    PostTaxonomiesFlatTermSelector: () => FlatTermSelector,
    PostTaxonomiesHierarchicalTermSelector: () => HierarchicalTermSelector,
    PostTaxonomiesPanel: () => PostTaxonomies2,
    PostTemplatePanel: () => PostTemplatePanel,
    PostTextEditor: () => PostTextEditor,
    PostTitle: () => post_title_default,
    PostTitleRaw: () => post_title_raw_default,
    PostTrash: () => PostTrash,
    PostTrashCheck: () => PostTrashCheck,
    PostTypeSupportCheck: () => post_type_support_check_default,
    PostURL: () => PostURL,
    PostURLCheck: () => PostURLCheck,
    PostURLLabel: () => PostURLLabel,
    PostURLPanel: () => PostURLPanel,
    PostVisibility: () => PostVisibility,
    PostVisibilityCheck: () => PostVisibilityCheck,
    PostVisibilityLabel: () => PostVisibilityLabel,
    RichText: () => RichText,
    RichTextShortcut: () => RichTextShortcut,
    RichTextToolbarButton: () => RichTextToolbarButton,
    ServerSideRender: () => import_server_side_render.default,
    SkipToSelectedBlock: () => SkipToSelectedBlock,
    TableOfContents: () => table_of_contents_default,
    TextEditorGlobalKeyboardShortcuts: () => TextEditorGlobalKeyboardShortcuts,
    ThemeSupportCheck: () => ThemeSupportCheck,
    TimeToRead: () => TimeToRead,
    URLInput: () => URLInput,
    URLInputButton: () => URLInputButton,
    URLPopover: () => URLPopover,
    UnsavedChangesWarning: () => UnsavedChangesWarning,
    VisualEditorGlobalKeyboardShortcuts: () => VisualEditorGlobalKeyboardShortcuts,
    Warning: () => Warning,
    WordCount: () => WordCount,
    WritingFlow: () => WritingFlow,
    __unstableRichTextInputEvent: () => __unstableRichTextInputEvent,
    cleanForSlug: () => cleanForSlug3,
    createCustomColorsHOC: () => createCustomColorsHOC,
    getColorClassName: () => getColorClassName2,
    getColorObjectByAttributeValues: () => getColorObjectByAttributeValues,
    getColorObjectByColorValue: () => getColorObjectByColorValue,
    getFontSize: () => getFontSize,
    getFontSizeClass: () => getFontSizeClass,
    getTemplatePartIcon: () => getTemplatePartIcon,
    mediaUpload: () => mediaUpload,
    privateApis: () => privateApis3,
    registerEntityAction: () => registerEntityAction2,
    registerEntityField: () => registerEntityField2,
    store: () => store,
    storeConfig: () => storeConfig,
    transformStyles: () => import_block_editor103.transformStyles,
    unregisterEntityAction: () => unregisterEntityAction2,
    unregisterEntityField: () => unregisterEntityField2,
    useEntitiesSavedStatesIsDirty: () => useIsDirty,
    usePostScheduleLabel: () => usePostScheduleLabel,
    usePostURLLabel: () => usePostURLLabel,
    usePostVisibilityLabel: () => usePostVisibilityLabel,
    userAutocompleter: () => user_default,
    withColorContext: () => withColorContext,
    withColors: () => withColors,
    withFontSizes: () => withFontSizes
  });

  // packages/editor/build-module/hooks/custom-sources-backwards-compatibility.mjs
  var import_data67 = __toESM(require_data(), 1);
  var import_core_data48 = __toESM(require_core_data(), 1);
  var import_element72 = __toESM(require_element(), 1);
  var import_compose16 = __toESM(require_compose(), 1);
  var import_hooks37 = __toESM(require_hooks(), 1);

  // packages/editor/build-module/store/index.mjs
  var import_data66 = __toESM(require_data(), 1);

  // packages/editor/build-module/store/reducer.mjs
  var import_data2 = __toESM(require_data(), 1);

  // packages/editor/build-module/store/defaults.mjs
  var import_block_editor = __toESM(require_block_editor(), 1);
  var EDITOR_SETTINGS_DEFAULTS = {
    ...import_block_editor.SETTINGS_DEFAULTS,
    richEditingEnabled: true,
    codeEditingEnabled: true,
    fontLibraryEnabled: true,
    enableCustomFields: void 0,
    defaultRenderingMode: "post-only"
  };

  // packages/editor/build-module/dataviews/store/reducer.mjs
  var import_data = __toESM(require_data(), 1);
  function isReady(state = {}, action) {
    switch (action.type) {
      case "SET_IS_READY":
        return {
          ...state,
          [action.kind]: {
            ...state[action.kind],
            [action.name]: true
          }
        };
    }
    return state;
  }
  function actions(state = {}, action) {
    switch (action.type) {
      case "REGISTER_ENTITY_ACTION":
        return {
          ...state,
          [action.kind]: {
            ...state[action.kind],
            [action.name]: [
              ...(state[action.kind]?.[action.name] ?? []).filter(
                (_action) => _action.id !== action.config.id
              ),
              action.config
            ]
          }
        };
      case "UNREGISTER_ENTITY_ACTION": {
        return {
          ...state,
          [action.kind]: {
            ...state[action.kind],
            [action.name]: (state[action.kind]?.[action.name] ?? []).filter((_action) => _action.id !== action.actionId)
          }
        };
      }
    }
    return state;
  }
  function fields(state = {}, action) {
    switch (action.type) {
      case "REGISTER_ENTITY_FIELD":
        return {
          ...state,
          [action.kind]: {
            ...state[action.kind],
            [action.name]: [
              ...(state[action.kind]?.[action.name] ?? []).filter(
                (_field) => _field.id !== action.config.id
              ),
              action.config
            ]
          }
        };
      case "UNREGISTER_ENTITY_FIELD":
        return {
          ...state,
          [action.kind]: {
            ...state[action.kind],
            [action.name]: (state[action.kind]?.[action.name] ?? []).filter((_field) => _field.id !== action.fieldId)
          }
        };
    }
    return state;
  }
  var reducer_default = (0, import_data.combineReducers)({
    actions,
    fields,
    isReady
  });

  // packages/editor/build-module/store/reducer.mjs
  function getPostRawValue(value) {
    if (value && "object" === typeof value && "raw" in value) {
      return value.raw;
    }
    return value;
  }
  function postId(state = null, action) {
    switch (action.type) {
      case "SET_EDITED_POST":
        return action.postId;
    }
    return state;
  }
  function templateId(state = null, action) {
    switch (action.type) {
      case "SET_CURRENT_TEMPLATE_ID":
        return action.id;
    }
    return state;
  }
  function postType(state = null, action) {
    switch (action.type) {
      case "SET_EDITED_POST":
        return action.postType;
    }
    return state;
  }
  function template(state = { isValid: true }, action) {
    switch (action.type) {
      case "SET_TEMPLATE_VALIDITY":
        return {
          ...state,
          isValid: action.isValid
        };
    }
    return state;
  }
  function saving(state = {}, action) {
    switch (action.type) {
      case "REQUEST_POST_UPDATE_START":
      case "REQUEST_POST_UPDATE_FINISH":
        return {
          pending: action.type === "REQUEST_POST_UPDATE_START",
          options: action.options || {}
        };
    }
    return state;
  }
  function deleting(state = {}, action) {
    switch (action.type) {
      case "REQUEST_POST_DELETE_START":
      case "REQUEST_POST_DELETE_FINISH":
        return {
          pending: action.type === "REQUEST_POST_DELETE_START"
        };
    }
    return state;
  }
  function postLock(state = { isLocked: false }, action) {
    switch (action.type) {
      case "UPDATE_POST_LOCK":
        return action.lock;
    }
    return state;
  }
  function postSavingLock(state = {}, action) {
    switch (action.type) {
      case "LOCK_POST_SAVING":
        return { ...state, [action.lockName]: true };
      case "UNLOCK_POST_SAVING": {
        const { [action.lockName]: removedLockName, ...restState } = state;
        return restState;
      }
    }
    return state;
  }
  function postAutosavingLock(state = {}, action) {
    switch (action.type) {
      case "LOCK_POST_AUTOSAVING":
        return { ...state, [action.lockName]: true };
      case "UNLOCK_POST_AUTOSAVING": {
        const { [action.lockName]: removedLockName, ...restState } = state;
        return restState;
      }
    }
    return state;
  }
  function editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) {
    switch (action.type) {
      case "UPDATE_EDITOR_SETTINGS":
        return {
          ...state,
          ...action.settings
        };
    }
    return state;
  }
  function renderingMode(state = "post-only", action) {
    switch (action.type) {
      case "SET_RENDERING_MODE":
        return action.mode;
    }
    return state;
  }
  function deviceType(state = "Desktop", action) {
    switch (action.type) {
      case "SET_DEVICE_TYPE":
        return action.deviceType;
    }
    return state;
  }
  function removedPanels(state = [], action) {
    switch (action.type) {
      case "REMOVE_PANEL":
        if (!state.includes(action.panelName)) {
          return [...state, action.panelName];
        }
    }
    return state;
  }
  function blockInserterPanel(state = false, action) {
    switch (action.type) {
      case "SET_IS_LIST_VIEW_OPENED":
        return action.isOpen ? false : state;
      case "SET_IS_INSERTER_OPENED":
        return action.value;
    }
    return state;
  }
  function listViewPanel(state = false, action) {
    switch (action.type) {
      case "SET_IS_INSERTER_OPENED":
        return action.value ? false : state;
      case "SET_IS_LIST_VIEW_OPENED":
        return action.isOpen;
    }
    return state;
  }
  function listViewToggleRef(state = { current: null }) {
    return state;
  }
  function inserterSidebarToggleRef(state = { current: null }) {
    return state;
  }
  function publishSidebarActive(state = false, action) {
    switch (action.type) {
      case "OPEN_PUBLISH_SIDEBAR":
        return true;
      case "CLOSE_PUBLISH_SIDEBAR":
        return false;
      case "TOGGLE_PUBLISH_SIDEBAR":
        return !state;
    }
    return state;
  }
  function stylesPath(state = "/", action) {
    switch (action.type) {
      case "SET_STYLES_PATH":
        return action.path;
      case "RESET_STYLES_NAVIGATION":
        return "/";
    }
    return state;
  }
  function showStylebook(state = false, action) {
    switch (action.type) {
      case "SET_SHOW_STYLEBOOK":
        return action.show;
      case "RESET_STYLES_NAVIGATION":
        return false;
    }
    return state;
  }
  function canvasMinHeight(state = 0, action) {
    switch (action.type) {
      case "SET_CANVAS_MIN_HEIGHT":
        return action.minHeight;
    }
    return state;
  }
  var reducer_default2 = (0, import_data2.combineReducers)({
    postId,
    postType,
    templateId,
    saving,
    deleting,
    postLock,
    template,
    postSavingLock,
    editorSettings,
    postAutosavingLock,
    renderingMode,
    deviceType,
    removedPanels,
    blockInserterPanel,
    inserterSidebarToggleRef,
    listViewPanel,
    listViewToggleRef,
    publishSidebarActive,
    stylesPath,
    showStylebook,
    canvasMinHeight,
    dataviews: reducer_default
  });

  // packages/editor/build-module/store/selectors.mjs
  var selectors_exports = {};
  __export(selectors_exports, {
    __experimentalGetDefaultTemplatePartAreas: () => __experimentalGetDefaultTemplatePartAreas,
    __experimentalGetDefaultTemplateType: () => __experimentalGetDefaultTemplateType,
    __experimentalGetDefaultTemplateTypes: () => __experimentalGetDefaultTemplateTypes,
    __experimentalGetTemplateInfo: () => __experimentalGetTemplateInfo,
    __unstableIsEditorReady: () => __unstableIsEditorReady,
    canInsertBlockType: () => canInsertBlockType,
    canUserUseUnfilteredHTML: () => canUserUseUnfilteredHTML,
    didPostSaveRequestFail: () => didPostSaveRequestFail,
    didPostSaveRequestSucceed: () => didPostSaveRequestSucceed,
    getActivePostLock: () => getActivePostLock,
    getAdjacentBlockClientId: () => getAdjacentBlockClientId,
    getAutosaveAttribute: () => getAutosaveAttribute,
    getBlock: () => getBlock,
    getBlockAttributes: () => getBlockAttributes,
    getBlockCount: () => getBlockCount,
    getBlockHierarchyRootClientId: () => getBlockHierarchyRootClientId,
    getBlockIndex: () => getBlockIndex,
    getBlockInsertionPoint: () => getBlockInsertionPoint,
    getBlockListSettings: () => getBlockListSettings,
    getBlockMode: () => getBlockMode,
    getBlockName: () => getBlockName,
    getBlockOrder: () => getBlockOrder,
    getBlockRootClientId: () => getBlockRootClientId,
    getBlockSelectionEnd: () => getBlockSelectionEnd,
    getBlockSelectionStart: () => getBlockSelectionStart,
    getBlocks: () => getBlocks,
    getBlocksByClientId: () => getBlocksByClientId,
    getClientIdsOfDescendants: () => getClientIdsOfDescendants,
    getClientIdsWithDescendants: () => getClientIdsWithDescendants,
    getCurrentPost: () => getCurrentPost,
    getCurrentPostAttribute: () => getCurrentPostAttribute,
    getCurrentPostId: () => getCurrentPostId,
    getCurrentPostLastRevisionId: () => getCurrentPostLastRevisionId,
    getCurrentPostRevisionsCount: () => getCurrentPostRevisionsCount,
    getCurrentPostType: () => getCurrentPostType,
    getCurrentTemplateId: () => getCurrentTemplateId,
    getDeviceType: () => getDeviceType,
    getEditedPostAttribute: () => getEditedPostAttribute,
    getEditedPostContent: () => getEditedPostContent,
    getEditedPostPreviewLink: () => getEditedPostPreviewLink,
    getEditedPostSlug: () => getEditedPostSlug,
    getEditedPostVisibility: () => getEditedPostVisibility,
    getEditorBlocks: () => getEditorBlocks,
    getEditorMode: () => getEditorMode,
    getEditorSelection: () => getEditorSelection,
    getEditorSelectionEnd: () => getEditorSelectionEnd,
    getEditorSelectionStart: () => getEditorSelectionStart,
    getEditorSettings: () => getEditorSettings,
    getFirstMultiSelectedBlockClientId: () => getFirstMultiSelectedBlockClientId,
    getGlobalBlockCount: () => getGlobalBlockCount,
    getInserterItems: () => getInserterItems,
    getLastMultiSelectedBlockClientId: () => getLastMultiSelectedBlockClientId,
    getMultiSelectedBlockClientIds: () => getMultiSelectedBlockClientIds,
    getMultiSelectedBlocks: () => getMultiSelectedBlocks,
    getMultiSelectedBlocksEndClientId: () => getMultiSelectedBlocksEndClientId,
    getMultiSelectedBlocksStartClientId: () => getMultiSelectedBlocksStartClientId,
    getNextBlockClientId: () => getNextBlockClientId,
    getPermalink: () => getPermalink,
    getPermalinkParts: () => getPermalinkParts,
    getPostEdits: () => getPostEdits,
    getPostLockUser: () => getPostLockUser,
    getPostTypeLabel: () => getPostTypeLabel,
    getPreviousBlockClientId: () => getPreviousBlockClientId,
    getRenderingMode: () => getRenderingMode,
    getSelectedBlock: () => getSelectedBlock,
    getSelectedBlockClientId: () => getSelectedBlockClientId,
    getSelectedBlockCount: () => getSelectedBlockCount,
    getSelectedBlocksInitialCaretPosition: () => getSelectedBlocksInitialCaretPosition,
    getStateBeforeOptimisticTransaction: () => getStateBeforeOptimisticTransaction,
    getSuggestedPostFormat: () => getSuggestedPostFormat,
    getTemplate: () => getTemplate,
    getTemplateLock: () => getTemplateLock,
    hasChangedContent: () => hasChangedContent,
    hasEditorRedo: () => hasEditorRedo,
    hasEditorUndo: () => hasEditorUndo,
    hasInserterItems: () => hasInserterItems,
    hasMultiSelection: () => hasMultiSelection,
    hasNonPostEntityChanges: () => hasNonPostEntityChanges,
    hasSelectedBlock: () => hasSelectedBlock,
    hasSelectedInnerBlock: () => hasSelectedInnerBlock,
    inSomeHistory: () => inSomeHistory,
    isAncestorMultiSelected: () => isAncestorMultiSelected,
    isAutosavingPost: () => isAutosavingPost,
    isBlockInsertionPointVisible: () => isBlockInsertionPointVisible,
    isBlockMultiSelected: () => isBlockMultiSelected,
    isBlockSelected: () => isBlockSelected,
    isBlockValid: () => isBlockValid,
    isBlockWithinSelection: () => isBlockWithinSelection,
    isCaretWithinFormattedText: () => isCaretWithinFormattedText,
    isCleanNewPost: () => isCleanNewPost,
    isCurrentPostPending: () => isCurrentPostPending,
    isCurrentPostPublished: () => isCurrentPostPublished,
    isCurrentPostScheduled: () => isCurrentPostScheduled,
    isDeletingPost: () => isDeletingPost,
    isEditedPostAutosaveable: () => isEditedPostAutosaveable,
    isEditedPostBeingScheduled: () => isEditedPostBeingScheduled,
    isEditedPostDateFloating: () => isEditedPostDateFloating,
    isEditedPostDirty: () => isEditedPostDirty,
    isEditedPostEmpty: () => isEditedPostEmpty,
    isEditedPostNew: () => isEditedPostNew,
    isEditedPostPublishable: () => isEditedPostPublishable,
    isEditedPostSaveable: () => isEditedPostSaveable,
    isEditorPanelEnabled: () => isEditorPanelEnabled,
    isEditorPanelOpened: () => isEditorPanelOpened,
    isEditorPanelRemoved: () => isEditorPanelRemoved,
    isFirstMultiSelectedBlock: () => isFirstMultiSelectedBlock,
    isInserterOpened: () => isInserterOpened,
    isListViewOpened: () => isListViewOpened,
    isMultiSelecting: () => isMultiSelecting,
    isPermalinkEditable: () => isPermalinkEditable,
    isPostAutosavingLocked: () => isPostAutosavingLocked,
    isPostLockTakeover: () => isPostLockTakeover,
    isPostLocked: () => isPostLocked,
    isPostSavingLocked: () => isPostSavingLocked,
    isPreviewingPost: () => isPreviewingPost,
    isPublishSidebarEnabled: () => isPublishSidebarEnabled,
    isPublishSidebarOpened: () => isPublishSidebarOpened,
    isPublishingPost: () => isPublishingPost,
    isSavingNonPostEntityChanges: () => isSavingNonPostEntityChanges,
    isSavingPost: () => isSavingPost,
    isSelectionEnabled: () => isSelectionEnabled,
    isTyping: () => isTyping,
    isValidTemplate: () => isValidTemplate
  });
  var import_blocks = __toESM(require_blocks(), 1);
  var import_date = __toESM(require_date(), 1);
  var import_url = __toESM(require_url(), 1);
  var import_data3 = __toESM(require_data(), 1);
  var import_deprecated = __toESM(require_deprecated(), 1);
  var import_element2 = __toESM(require_element(), 1);
  var import_block_editor2 = __toESM(require_block_editor(), 1);
  var import_core_data = __toESM(require_core_data(), 1);
  var import_preferences = __toESM(require_preferences(), 1);

  // packages/editor/build-module/store/constants.mjs
  var EDIT_MERGE_PROPERTIES = /* @__PURE__ */ new Set(["meta"]);
  var STORE_NAME = "core/editor";
  var PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
  var ONE_MINUTE_IN_MS = 60 * 1e3;
  var AUTOSAVE_PROPERTIES = ["title", "excerpt", "content"];
  var TEMPLATE_POST_TYPE = "wp_template";
  var TEMPLATE_PART_POST_TYPE = "wp_template_part";
  var PATTERN_POST_TYPE = "wp_block";
  var NAVIGATION_POST_TYPE = "wp_navigation";
  var TEMPLATE_ORIGINS = {
    custom: "custom",
    theme: "theme",
    plugin: "plugin"
  };
  var TEMPLATE_POST_TYPES = ["wp_template", "wp_template_part"];
  var GLOBAL_POST_TYPES = [
    ...TEMPLATE_POST_TYPES,
    "wp_block",
    "wp_navigation"
  ];
  var DESIGN_POST_TYPES = [
    TEMPLATE_POST_TYPE,
    TEMPLATE_PART_POST_TYPE,
    PATTERN_POST_TYPE,
    NAVIGATION_POST_TYPE
  ];

  // packages/icons/build-module/icon/index.mjs
  var import_element = __toESM(require_element(), 1);
  var icon_default = (0, import_element.forwardRef)(
    ({ icon, size: size3 = 24, ...props }, ref) => {
      return (0, import_element.cloneElement)(icon, {
        width: size3,
        height: size3,
        ...props,
        ref
      });
    }
  );

  // packages/icons/build-module/library/add-template.mjs
  var import_primitives = __toESM(require_primitives(), 1);
  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
  var add_template_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    import_primitives.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z"
    }
  ) });

  // packages/icons/build-module/library/archive.mjs
  var import_primitives2 = __toESM(require_primitives(), 1);
  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
  var archive_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
    import_primitives2.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z"
    }
  ) });

  // packages/icons/build-module/library/audio.mjs
  var import_primitives3 = __toESM(require_primitives(), 1);
  var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
  var audio_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "M17.7 4.3c-1.2 0-2.8 0-3.8 1-.6.6-.9 1.5-.9 2.6V14c-.6-.6-1.5-1-2.5-1C8.6 13 7 14.6 7 16.5S8.6 20 10.5 20c1.5 0 2.8-1 3.3-2.3.5-.8.7-1.8.7-2.5V7.9c0-.7.2-1.2.5-1.6.6-.6 1.8-.6 2.8-.6h.3V4.3h-.4z" }) });

  // packages/icons/build-module/library/background.mjs
  var import_primitives4 = __toESM(require_primitives(), 1);
  var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
  var background_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
    import_primitives4.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M11.53 4.47a.75.75 0 1 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm5 1a.75.75 0 1 0-1.06 1.06l2 2a.75.75 0 1 0 1.06-1.06l-2-2Zm-11.06 10a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06Zm.06-5a.75.75 0 0 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm-.06-3a.75.75 0 0 1 1.06 0l10 10a.75.75 0 1 1-1.06 1.06l-10-10a.75.75 0 0 1 0-1.06Zm3.06-2a.75.75 0 0 0-1.06 1.06l10 10a.75.75 0 1 0 1.06-1.06l-10-10Z"
    }
  ) });

  // packages/icons/build-module/library/backup.mjs
  var import_primitives5 = __toESM(require_primitives(), 1);
  var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
  var backup_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" }) });

  // packages/icons/build-module/library/block-default.mjs
  var import_primitives6 = __toESM(require_primitives(), 1);
  var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
  var block_default_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.Path, { d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" }) });

  // packages/icons/build-module/library/check.mjs
  var import_primitives7 = __toESM(require_primitives(), 1);
  var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
  var check_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) });

  // packages/icons/build-module/library/chevron-left-small.mjs
  var import_primitives8 = __toESM(require_primitives(), 1);
  var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
  var chevron_left_small_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) });

  // packages/icons/build-module/library/chevron-left.mjs
  var import_primitives9 = __toESM(require_primitives(), 1);
  var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
  var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) });

  // packages/icons/build-module/library/chevron-right-small.mjs
  var import_primitives10 = __toESM(require_primitives(), 1);
  var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
  var chevron_right_small_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) });

  // packages/icons/build-module/library/chevron-right.mjs
  var import_primitives11 = __toESM(require_primitives(), 1);
  var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
  var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) });

  // packages/icons/build-module/library/close-small.mjs
  var import_primitives12 = __toESM(require_primitives(), 1);
  var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
  var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) });

  // packages/icons/build-module/library/cloud-upload.mjs
  var import_primitives13 = __toESM(require_primitives(), 1);
  var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
  var cloud_upload_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.Path, { d: "M17.3 10.1C17.3 7.60001 15.2 5.70001 12.5 5.70001C10.3 5.70001 8.4 7.10001 7.9 9.00001H7.7C5.7 9.00001 4 10.7 4 12.8C4 14.9 5.7 16.6 7.7 16.6H9.5V15.2H7.7C6.5 15.2 5.5 14.1 5.5 12.9C5.5 11.7 6.5 10.5 7.7 10.5H9L9.3 9.40001C9.7 8.10001 11 7.20001 12.5 7.20001C14.3 7.20001 15.8 8.50001 15.8 10.1V11.4L17.1 11.6C17.9 11.7 18.5 12.5 18.5 13.4C18.5 14.4 17.7 15.2 16.8 15.2H14.5V16.6H16.7C18.5 16.6 19.9 15.1 19.9 13.3C20 11.7 18.8 10.4 17.3 10.1Z M14.1245 14.2426L15.1852 13.182L12.0032 10L8.82007 13.1831L9.88072 14.2438L11.25 12.8745V18H12.75V12.8681L14.1245 14.2426Z" }) });

  // packages/icons/build-module/library/cloud.mjs
  var import_primitives14 = __toESM(require_primitives(), 1);
  var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
  var cloud_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z" }) });

  // packages/icons/build-module/library/code.mjs
  var import_primitives15 = __toESM(require_primitives(), 1);
  var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
  var code_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.Path, { d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" }) });

  // packages/icons/build-module/library/color.mjs
  var import_primitives16 = __toESM(require_primitives(), 1);
  var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
  var color_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.Path, { d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" }) });

  // packages/icons/build-module/library/comment-author-avatar.mjs
  var import_primitives17 = __toESM(require_primitives(), 1);
  var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
  var comment_author_avatar_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
    import_primitives17.Path,
    {
      fillRule: "evenodd",
      d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",
      clipRule: "evenodd"
    }
  ) });

  // packages/icons/build-module/library/comment.mjs
  var import_primitives18 = __toESM(require_primitives(), 1);
  var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
  var comment_default = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.Path, { d: "M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z" }) });

  // packages/icons/build-module/library/copy-small.mjs
  var import_primitives19 = __toESM(require_primitives(), 1);
  var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
  var copy_small_default = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives19.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
    import_primitives19.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z"
    }
  ) });

  // packages/icons/build-module/library/desktop.mjs
  var import_primitives20 = __toESM(require_primitives(), 1);
  var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
  var desktop_default = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives20.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives20.Path, { d: "M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z" }) });

  // packages/icons/build-module/library/download.mjs
  var import_primitives21 = __toESM(require_primitives(), 1);
  var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
  var download_default = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives21.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives21.Path, { d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" }) });

  // packages/icons/build-module/library/drafts.mjs
  var import_primitives22 = __toESM(require_primitives(), 1);
  var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
  var drafts_default = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives22.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
    import_primitives22.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z"
    }
  ) });

  // packages/icons/build-module/library/drawer-left.mjs
  var import_primitives23 = __toESM(require_primitives(), 1);
  var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
  var drawer_left_default = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives23.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
    import_primitives23.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"
    }
  ) });

  // packages/icons/build-module/library/drawer-right.mjs
  var import_primitives24 = __toESM(require_primitives(), 1);
  var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
  var drawer_right_default = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives24.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
    import_primitives24.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"
    }
  ) });

  // packages/icons/build-module/library/external.mjs
  var import_primitives25 = __toESM(require_primitives(), 1);
  var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
  var external_default = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives25.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives25.Path, { d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) });

  // packages/icons/build-module/library/file.mjs
  var import_primitives26 = __toESM(require_primitives(), 1);
  var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
  var file_default = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives26.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
    import_primitives26.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"
    }
  ) });

  // packages/icons/build-module/library/footer.mjs
  var import_primitives27 = __toESM(require_primitives(), 1);
  var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
  var footer_default = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives27.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
    import_primitives27.Path,
    {
      fillRule: "evenodd",
      d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
    }
  ) });

  // packages/icons/build-module/library/format-list-bullets.mjs
  var import_primitives28 = __toESM(require_primitives(), 1);
  var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
  var format_list_bullets_default = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives28.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives28.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) });

  // packages/icons/build-module/library/header.mjs
  var import_primitives29 = __toESM(require_primitives(), 1);
  var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
  var header_default = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives29.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives29.Path, { d: "M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) });

  // packages/icons/build-module/library/info.mjs
  var import_primitives30 = __toESM(require_primitives(), 1);
  var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
  var info_default = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives30.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
    import_primitives30.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z"
    }
  ) });

  // packages/icons/build-module/library/keyboard.mjs
  var import_primitives31 = __toESM(require_primitives(), 1);
  var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
  var keyboard_default = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_primitives31.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
    /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives31.Path, { d: "m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z" }),
    /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives31.Path, { d: "m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z" })
  ] });

  // packages/icons/build-module/library/layout.mjs
  var import_primitives32 = __toESM(require_primitives(), 1);
  var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
  var layout_default = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives32.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives32.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) });

  // packages/icons/build-module/library/list-view.mjs
  var import_primitives33 = __toESM(require_primitives(), 1);
  var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
  var list_view_default = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives33.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives33.Path, { d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) });

  // packages/icons/build-module/library/lock-small.mjs
  var import_primitives34 = __toESM(require_primitives(), 1);
  var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
  var lock_small_default = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives34.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
    import_primitives34.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z"
    }
  ) });

  // packages/icons/build-module/library/mobile.mjs
  var import_primitives35 = __toESM(require_primitives(), 1);
  var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
  var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives35.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives35.Path, { d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" }) });

  // packages/icons/build-module/library/more-vertical.mjs
  var import_primitives36 = __toESM(require_primitives(), 1);
  var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
  var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives36.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives36.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) });

  // packages/icons/build-module/library/navigation.mjs
  var import_primitives37 = __toESM(require_primitives(), 1);
  var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
  var navigation_default = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives37.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives37.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" }) });

  // packages/icons/build-module/library/next.mjs
  var import_primitives38 = __toESM(require_primitives(), 1);
  var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
  var next_default = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives38.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives38.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) });

  // packages/icons/build-module/library/not-allowed.mjs
  var import_primitives39 = __toESM(require_primitives(), 1);
  var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
  var not_allowed_default = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives39.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
    import_primitives39.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z"
    }
  ) });

  // packages/icons/build-module/library/page.mjs
  var import_primitives40 = __toESM(require_primitives(), 1);
  var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
  var page_default = /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_primitives40.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
    /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives40.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }),
    /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives40.Path, { d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" })
  ] });

  // packages/icons/build-module/library/pencil.mjs
  var import_primitives41 = __toESM(require_primitives(), 1);
  var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
  var pencil_default = /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives41.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives41.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) });

  // packages/icons/build-module/library/pending.mjs
  var import_primitives42 = __toESM(require_primitives(), 1);
  var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
  var pending_default = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives42.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
    import_primitives42.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z"
    }
  ) });

  // packages/icons/build-module/library/plus.mjs
  var import_primitives43 = __toESM(require_primitives(), 1);
  var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
  var plus_default = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives43.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives43.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) });

  // packages/icons/build-module/library/previous.mjs
  var import_primitives44 = __toESM(require_primitives(), 1);
  var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
  var previous_default = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives44.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives44.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) });

  // packages/icons/build-module/library/published.mjs
  var import_primitives45 = __toESM(require_primitives(), 1);
  var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
  var published_default = /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives45.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
    import_primitives45.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z"
    }
  ) });

  // packages/icons/build-module/library/redo.mjs
  var import_primitives46 = __toESM(require_primitives(), 1);
  var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
  var redo_default = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives46.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives46.Path, { d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" }) });

  // packages/icons/build-module/library/reset.mjs
  var import_primitives47 = __toESM(require_primitives(), 1);
  var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
  var reset_default = /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives47.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives47.Path, { d: "M7 11.5h10V13H7z" }) });

  // packages/icons/build-module/library/rotate-left.mjs
  var import_primitives48 = __toESM(require_primitives(), 1);
  var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
  var rotate_left_default = /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives48.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives48.Path, { d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z" }) });

  // packages/icons/build-module/library/rotate-right.mjs
  var import_primitives49 = __toESM(require_primitives(), 1);
  var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
  var rotate_right_default = /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives49.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives49.Path, { d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" }) });

  // packages/icons/build-module/library/scheduled.mjs
  var import_primitives50 = __toESM(require_primitives(), 1);
  var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
  var scheduled_default = /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives50.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
    import_primitives50.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z"
    }
  ) });

  // packages/icons/build-module/library/seen.mjs
  var import_primitives51 = __toESM(require_primitives(), 1);
  var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
  var seen_default = /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives51.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives51.Path, { d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z" }) });

  // packages/icons/build-module/library/settings.mjs
  var import_primitives52 = __toESM(require_primitives(), 1);
  var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
  var settings_default = /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_primitives52.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
    /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_primitives52.Path, { d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" }),
    /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_primitives52.Path, { d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" })
  ] });

  // packages/icons/build-module/library/shadow.mjs
  var import_primitives53 = __toESM(require_primitives(), 1);
  var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
  var shadow_default = /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives53.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives53.Path, { d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z" }) });

  // packages/icons/build-module/library/shuffle.mjs
  var import_primitives54 = __toESM(require_primitives(), 1);
  var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
  var shuffle_default = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives54.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/SVG", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives54.Path, { d: "M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z" }) });

  // packages/icons/build-module/library/sidebar.mjs
  var import_primitives55 = __toESM(require_primitives(), 1);
  var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
  var sidebar_default = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_primitives55.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_primitives55.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) });

  // packages/icons/build-module/library/square.mjs
  var import_primitives56 = __toESM(require_primitives(), 1);
  var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
  var square_default = /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_primitives56.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
    import_primitives56.Path,
    {
      fill: "none",
      d: "M5.75 12.75V18.25H11.25M12.75 5.75H18.25V11.25",
      stroke: "currentColor",
      strokeWidth: "1.5",
      strokeLinecap: "square"
    }
  ) });

  // packages/icons/build-module/library/star-empty.mjs
  var import_primitives57 = __toESM(require_primitives(), 1);
  var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
  var star_empty_default = /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_primitives57.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
    import_primitives57.Path,
    {
      fillRule: "evenodd",
      d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",
      clipRule: "evenodd"
    }
  ) });

  // packages/icons/build-module/library/star-filled.mjs
  var import_primitives58 = __toESM(require_primitives(), 1);
  var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
  var star_filled_default = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_primitives58.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_primitives58.Path, { d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" }) });

  // packages/icons/build-module/library/styles.mjs
  var import_primitives59 = __toESM(require_primitives(), 1);
  var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
  var styles_default = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_primitives59.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
    import_primitives59.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z"
    }
  ) });

  // packages/icons/build-module/library/symbol-filled.mjs
  var import_primitives60 = __toESM(require_primitives(), 1);
  var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1);
  var symbol_filled_default = /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_primitives60.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_primitives60.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) });

  // packages/icons/build-module/library/symbol.mjs
  var import_primitives61 = __toESM(require_primitives(), 1);
  var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1);
  var symbol_default = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_primitives61.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_primitives61.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) });

  // packages/icons/build-module/library/table-column-after.mjs
  var import_primitives62 = __toESM(require_primitives(), 1);
  var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1);
  var table_column_after_default = /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_primitives62.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_primitives62.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14.2c.1.9.9 1.7 1.8 1.8H19.2c1-.1 1.8-1 1.8-2V5c0-1.1-.9-2-2-2ZM8.5 19.5H5c-.3 0-.5-.2-.5-.5v-3.5h4v4Zm0-5.5h-4v-4h4v4Zm0-5.5h-4V5c0-.3.2-.5.5-.5h3.5v4Zm11 10.5c0 .3-.2.5-.5.5h-9v-15h9c.3 0 .5.2.5.5v14Zm-4-10.8H14v3h-3v1.5h3v3h1.5v-3h3v-1.5h-3v-3Z" }) });

  // packages/icons/build-module/library/tablet.mjs
  var import_primitives63 = __toESM(require_primitives(), 1);
  var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
  var tablet_default = /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_primitives63.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_primitives63.Path, { d: "M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z" }) });

  // packages/icons/build-module/library/trash.mjs
  var import_primitives64 = __toESM(require_primitives(), 1);
  var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1);
  var trash_default = /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_primitives64.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
    import_primitives64.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"
    }
  ) });

  // packages/icons/build-module/library/typography.mjs
  var import_primitives65 = __toESM(require_primitives(), 1);
  var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1);
  var typography_default = /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_primitives65.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_primitives65.Path, { d: "m8.6 7 3.9 10.8h-1.7l-1-2.8H5.7l-1 2.8H3L6.9 7h1.7Zm-2.4 6.6h3L7.7 9.3l-1.5 4.3ZM17.691 8.879c.473 0 .88.055 1.221.165.352.1.643.264.875.495.274.253.456.572.544.957.088.374.132.83.132 1.37v4.554c0 .274.033.472.099.593.077.11.198.166.363.166.11 0 .215-.028.313-.083.11-.055.237-.137.38-.247l.165.28a3.304 3.304 0 0 1-.71.446c-.23.11-.527.165-.89.165-.352 0-.639-.055-.858-.165-.22-.11-.386-.27-.495-.479-.1-.209-.149-.468-.149-.775-.286.462-.627.814-1.023 1.056-.396.242-.858.363-1.386.363-.462 0-.858-.088-1.188-.264a1.752 1.752 0 0 1-.742-.726 2.201 2.201 0 0 1-.248-1.056c0-.484.11-.875.33-1.172.22-.308.5-.556.841-.742.352-.187.721-.341 1.106-.462.396-.132.765-.253 1.106-.363.351-.121.637-.259.857-.413.232-.154.347-.357.347-.61V10.81c0-.396-.066-.71-.198-.941a1.05 1.05 0 0 0-.511-.511 1.763 1.763 0 0 0-.76-.149c-.253 0-.522.039-.808.116a1.165 1.165 0 0 0-.677.412 1.1 1.1 0 0 1 .595.396c.165.187.247.424.247.71 0 .307-.104.55-.313.726-.198.176-.451.263-.76.263-.34 0-.594-.104-.758-.313a1.231 1.231 0 0 1-.248-.759c0-.297.072-.539.214-.726.154-.187.352-.363.595-.528.264-.176.6-.324 1.006-.445.418-.121.88-.182 1.386-.182Zm.99 3.729a1.57 1.57 0 0 1-.528.462c-.231.121-.479.248-.742.38a5.377 5.377 0 0 0-.76.462c-.23.165-.423.38-.577.643-.154.264-.231.6-.231 1.007 0 .429.11.77.33 1.023.22.242.517.363.891.363.308 0 .594-.088.858-.264.275-.176.528-.44.759-.792v-3.284Z" }) });

  // packages/icons/build-module/library/undo.mjs
  var import_primitives66 = __toESM(require_primitives(), 1);
  var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
  var undo_default = /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_primitives66.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_primitives66.Path, { d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" }) });

  // packages/icons/build-module/library/verse.mjs
  var import_primitives67 = __toESM(require_primitives(), 1);
  var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
  var verse_default = /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_primitives67.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_primitives67.Path, { d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" }) });

  // packages/icons/build-module/library/video.mjs
  var import_primitives68 = __toESM(require_primitives(), 1);
  var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
  var video_default = /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_primitives68.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_primitives68.Path, { d: "M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z" }) });

  // packages/icons/build-module/library/wordpress.mjs
  var import_primitives69 = __toESM(require_primitives(), 1);
  var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
  var wordpress_default = /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_primitives69.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_primitives69.Path, { d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" }) });

  // packages/editor/build-module/utils/get-template-part-icon.mjs
  function getTemplatePartIcon(areaOrIconName) {
    if ("header" === areaOrIconName) {
      return header_default;
    } else if ("footer" === areaOrIconName) {
      return footer_default;
    } else if ("sidebar" === areaOrIconName) {
      return sidebar_default;
    } else if ("overlay" === areaOrIconName) {
      return table_column_after_default;
    }
    if ("menu" === areaOrIconName) {
      return table_column_after_default;
    }
    return symbol_filled_default;
  }

  // packages/editor/build-module/lock-unlock.mjs
  var import_private_apis = __toESM(require_private_apis(), 1);
  var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
    "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
    "@wordpress/editor"
  );

  // packages/editor/build-module/utils/get-template-info.mjs
  var EMPTY_OBJECT = {};
  var getTemplateInfo = (params) => {
    if (!params) {
      return EMPTY_OBJECT;
    }
    const { templateTypes, templateAreas, template: template2 } = params;
    const { description, slug, title, area } = template2;
    const { title: defaultTitle, description: defaultDescription } = Object.values(templateTypes).find((type) => type.slug === slug) ?? EMPTY_OBJECT;
    const templateTitle = typeof title === "string" ? title : title?.rendered;
    const templateDescription = typeof description === "string" ? description : description?.raw;
    const templateAreasWithIcon = templateAreas?.map((item) => ({
      ...item,
      icon: getTemplatePartIcon(item.icon)
    }));
    const templateIcon = templateAreasWithIcon?.find((item) => area === item.area)?.icon || layout_default;
    return {
      title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug,
      description: templateDescription || defaultDescription,
      icon: templateIcon
    };
  };

  // packages/editor/build-module/store/selectors.mjs
  var EMPTY_OBJECT2 = {};
  var hasEditorUndo = (0, import_data3.createRegistrySelector)((select5) => () => {
    return select5(import_core_data.store).hasUndo();
  });
  var hasEditorRedo = (0, import_data3.createRegistrySelector)((select5) => () => {
    return select5(import_core_data.store).hasRedo();
  });
  function isEditedPostNew(state) {
    return getCurrentPost(state).status === "auto-draft";
  }
  function hasChangedContent(state) {
    const edits = getPostEdits(state);
    return "content" in edits;
  }
  var isEditedPostDirty = (0, import_data3.createRegistrySelector)(
    (select5) => (state) => {
      const postType2 = getCurrentPostType(state);
      const postId2 = getCurrentPostId(state);
      return select5(import_core_data.store).hasEditsForEntityRecord(
        "postType",
        postType2,
        postId2
      );
    }
  );
  var hasNonPostEntityChanges = (0, import_data3.createRegistrySelector)(
    (select5) => (state) => {
      const dirtyEntityRecords = select5(import_core_data.store).__experimentalGetDirtyEntityRecords();
      const { type, id } = getCurrentPost(state);
      return dirtyEntityRecords.some(
        (entityRecord) => entityRecord.kind !== "postType" || entityRecord.name !== type || entityRecord.key !== id
      );
    }
  );
  function isCleanNewPost(state) {
    return !isEditedPostDirty(state) && isEditedPostNew(state);
  }
  var getCurrentPost = (0, import_data3.createRegistrySelector)(
    (select5) => (state) => {
      const postId2 = getCurrentPostId(state);
      const postType2 = getCurrentPostType(state);
      const post2 = select5(import_core_data.store).getRawEntityRecord(
        "postType",
        postType2,
        postId2
      );
      if (post2) {
        return post2;
      }
      return EMPTY_OBJECT2;
    }
  );
  function getCurrentPostType(state) {
    return state.postType;
  }
  function getCurrentPostId(state) {
    return state.postId;
  }
  function getCurrentTemplateId(state) {
    return state.templateId;
  }
  function getCurrentPostRevisionsCount(state) {
    return getCurrentPost(state)._links?.["version-history"]?.[0]?.count ?? 0;
  }
  function getCurrentPostLastRevisionId(state) {
    return getCurrentPost(state)._links?.["predecessor-version"]?.[0]?.id ?? null;
  }
  var getPostEdits = (0, import_data3.createRegistrySelector)((select5) => (state) => {
    const postType2 = getCurrentPostType(state);
    const postId2 = getCurrentPostId(state);
    return select5(import_core_data.store).getEntityRecordEdits(
      "postType",
      postType2,
      postId2
    ) || EMPTY_OBJECT2;
  });
  function getCurrentPostAttribute(state, attributeName) {
    switch (attributeName) {
      case "type":
        return getCurrentPostType(state);
      case "id":
        return getCurrentPostId(state);
      default:
        const post2 = getCurrentPost(state);
        if (!post2.hasOwnProperty(attributeName)) {
          break;
        }
        return getPostRawValue(post2[attributeName]);
    }
  }
  var getNestedEditedPostProperty = (0, import_data3.createSelector)(
    (state, attributeName) => {
      const edits = getPostEdits(state);
      if (!edits.hasOwnProperty(attributeName)) {
        return getCurrentPostAttribute(state, attributeName);
      }
      return {
        ...getCurrentPostAttribute(state, attributeName),
        ...edits[attributeName]
      };
    },
    (state, attributeName) => [
      getCurrentPostAttribute(state, attributeName),
      getPostEdits(state)[attributeName]
    ]
  );
  function getEditedPostAttribute(state, attributeName) {
    switch (attributeName) {
      case "content":
        return getEditedPostContent(state);
    }
    const edits = getPostEdits(state);
    if (!edits.hasOwnProperty(attributeName)) {
      return getCurrentPostAttribute(state, attributeName);
    }
    if (EDIT_MERGE_PROPERTIES.has(attributeName)) {
      return getNestedEditedPostProperty(state, attributeName);
    }
    return edits[attributeName];
  }
  var getAutosaveAttribute = (0, import_data3.createRegistrySelector)(
    (select5) => (state, attributeName) => {
      if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== "preview_link") {
        return;
      }
      const postType2 = getCurrentPostType(state);
      const postId2 = getCurrentPostId(state);
      const currentUserId = select5(import_core_data.store).getCurrentUser()?.id;
      const autosave2 = select5(import_core_data.store).getAutosave(
        postType2,
        postId2,
        currentUserId
      );
      if (autosave2) {
        return getPostRawValue(autosave2[attributeName]);
      }
    }
  );
  function getEditedPostVisibility(state) {
    const status = getEditedPostAttribute(state, "status");
    if (status === "private") {
      return "private";
    }
    const password = getEditedPostAttribute(state, "password");
    if (password) {
      return "password";
    }
    return "public";
  }
  function isCurrentPostPending(state) {
    return getCurrentPost(state).status === "pending";
  }
  function isCurrentPostPublished(state, currentPost) {
    const post2 = currentPost || getCurrentPost(state);
    return ["publish", "private"].indexOf(post2.status) !== -1 || post2.status === "future" && !(0, import_date.isInTheFuture)(
      new Date(Number((0, import_date.getDate)(post2.date)) - ONE_MINUTE_IN_MS)
    );
  }
  function isCurrentPostScheduled(state) {
    return getCurrentPost(state).status === "future" && !isCurrentPostPublished(state);
  }
  function isEditedPostPublishable(state) {
    const post2 = getCurrentPost(state);
    return isEditedPostDirty(state) || ["publish", "private", "future"].indexOf(post2.status) === -1;
  }
  function isEditedPostSaveable(state) {
    if (isSavingPost(state)) {
      return false;
    }
    return !!getEditedPostAttribute(state, "title") || !!getEditedPostAttribute(state, "excerpt") || !isEditedPostEmpty(state) || import_element2.Platform.OS === "native";
  }
  var isEditedPostEmpty = (0, import_data3.createRegistrySelector)(
    (select5) => (state) => {
      const postId2 = getCurrentPostId(state);
      const postType2 = getCurrentPostType(state);
      const record = select5(import_core_data.store).getEditedEntityRecord(
        "postType",
        postType2,
        postId2
      );
      if (typeof record.content !== "function") {
        return !record.content;
      }
      const blocks = getEditedPostAttribute(state, "blocks");
      if (blocks.length === 0) {
        return true;
      }
      if (blocks.length > 1) {
        return false;
      }
      const blockName = blocks[0].name;
      if (blockName !== (0, import_blocks.getDefaultBlockName)() && blockName !== (0, import_blocks.getFreeformContentHandlerName)()) {
        return false;
      }
      return !getEditedPostContent(state);
    }
  );
  var isEditedPostAutosaveable = (0, import_data3.createRegistrySelector)(
    (select5) => (state) => {
      if (!isEditedPostSaveable(state)) {
        return false;
      }
      if (isPostAutosavingLocked(state)) {
        return false;
      }
      const postType2 = getCurrentPostType(state);
      const postTypeObject = select5(import_core_data.store).getPostType(postType2);
      if (!postTypeObject?.supports?.autosave) {
        return false;
      }
      const postId2 = getCurrentPostId(state);
      const hasFetchedAutosave = select5(import_core_data.store).hasFetchedAutosaves(
        postType2,
        postId2
      );
      const currentUserId = select5(import_core_data.store).getCurrentUser()?.id;
      const autosave2 = select5(import_core_data.store).getAutosave(
        postType2,
        postId2,
        currentUserId
      );
      if (!hasFetchedAutosave) {
        return false;
      }
      if (!autosave2) {
        return true;
      }
      if (hasChangedContent(state)) {
        return true;
      }
      return ["title", "excerpt", "meta"].some(
        (field) => getPostRawValue(autosave2[field]) !== getEditedPostAttribute(state, field)
      );
    }
  );
  function isEditedPostBeingScheduled(state) {
    const date = getEditedPostAttribute(state, "date");
    const checkedDate = new Date(
      Number((0, import_date.getDate)(date)) - ONE_MINUTE_IN_MS
    );
    return (0, import_date.isInTheFuture)(checkedDate);
  }
  function isEditedPostDateFloating(state) {
    const date = getEditedPostAttribute(state, "date");
    const modified = getEditedPostAttribute(state, "modified");
    const status = getCurrentPost(state).status;
    if (status === "draft" || status === "auto-draft" || status === "pending") {
      return date === modified || date === null;
    }
    return false;
  }
  function isDeletingPost(state) {
    return !!state.deleting.pending;
  }
  function isSavingPost(state) {
    return !!state.saving.pending;
  }
  var isSavingNonPostEntityChanges = (0, import_data3.createRegistrySelector)(
    (select5) => (state) => {
      const entitiesBeingSaved = select5(import_core_data.store).__experimentalGetEntitiesBeingSaved();
      const { type, id } = getCurrentPost(state);
      return entitiesBeingSaved.some(
        (entityRecord) => entityRecord.kind !== "postType" || entityRecord.name !== type || entityRecord.key !== id
      );
    }
  );
  var didPostSaveRequestSucceed = (0, import_data3.createRegistrySelector)(
    (select5) => (state) => {
      const postType2 = getCurrentPostType(state);
      const postId2 = getCurrentPostId(state);
      return !select5(import_core_data.store).getLastEntitySaveError(
        "postType",
        postType2,
        postId2
      );
    }
  );
  var didPostSaveRequestFail = (0, import_data3.createRegistrySelector)(
    (select5) => (state) => {
      const postType2 = getCurrentPostType(state);
      const postId2 = getCurrentPostId(state);
      return !!select5(import_core_data.store).getLastEntitySaveError(
        "postType",
        postType2,
        postId2
      );
    }
  );
  function isAutosavingPost(state) {
    return isSavingPost(state) && Boolean(state.saving.options?.isAutosave);
  }
  function isPreviewingPost(state) {
    return isSavingPost(state) && Boolean(state.saving.options?.isPreview);
  }
  function getEditedPostPreviewLink(state) {
    if (state.saving.pending || isSavingPost(state)) {
      return;
    }
    let previewLink = getAutosaveAttribute(state, "preview_link");
    if (!previewLink || "draft" === getCurrentPost(state).status) {
      previewLink = getEditedPostAttribute(state, "link");
      if (previewLink) {
        previewLink = (0, import_url.addQueryArgs)(previewLink, { preview: true });
      }
    }
    const featuredImageId = getEditedPostAttribute(state, "featured_media");
    if (previewLink && featuredImageId) {
      return (0, import_url.addQueryArgs)(previewLink, { _thumbnail_id: featuredImageId });
    }
    return previewLink;
  }
  var getSuggestedPostFormat = (0, import_data3.createRegistrySelector)(
    (select5) => () => {
      const blocks = select5(import_block_editor2.store).getBlocks();
      if (blocks.length > 2) {
        return null;
      }
      let name2;
      if (blocks.length === 1) {
        name2 = blocks[0].name;
        if (name2 === "core/embed") {
          const provider = blocks[0].attributes?.providerNameSlug;
          if (["youtube", "vimeo"].includes(provider)) {
            name2 = "core/video";
          } else if (["spotify", "soundcloud"].includes(provider)) {
            name2 = "core/audio";
          }
        }
      }
      if (blocks.length === 2 && blocks[1].name === "core/paragraph") {
        name2 = blocks[0].name;
      }
      switch (name2) {
        case "core/image":
          return "image";
        case "core/quote":
        case "core/pullquote":
          return "quote";
        case "core/gallery":
          return "gallery";
        case "core/video":
          return "video";
        case "core/audio":
          return "audio";
        default:
          return null;
      }
    }
  );
  var getEditedPostContent = (0, import_data3.createRegistrySelector)(
    (select5) => (state) => {
      const postId2 = getCurrentPostId(state);
      const postType2 = getCurrentPostType(state);
      const record = select5(import_core_data.store).getEditedEntityRecord(
        "postType",
        postType2,
        postId2
      );
      if (record) {
        if (typeof record.content === "function") {
          return record.content(record);
        } else if (record.blocks) {
          return (0, import_blocks.__unstableSerializeAndClean)(record.blocks);
        } else if (record.content) {
          return record.content;
        }
      }
      return "";
    }
  );
  function isPublishingPost(state) {
    return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, "status") === "publish";
  }
  function isPermalinkEditable(state) {
    const permalinkTemplate = getEditedPostAttribute(
      state,
      "permalink_template"
    );
    return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate);
  }
  function getPermalink(state) {
    const permalinkParts = getPermalinkParts(state);
    if (!permalinkParts) {
      return null;
    }
    const { prefix, postName, suffix } = permalinkParts;
    if (isPermalinkEditable(state)) {
      return prefix + postName + suffix;
    }
    return prefix;
  }
  function getEditedPostSlug(state) {
    return getEditedPostAttribute(state, "slug") || (0, import_url.cleanForSlug)(getEditedPostAttribute(state, "title")) || getCurrentPostId(state);
  }
  function getPermalinkParts(state) {
    const permalinkTemplate = getEditedPostAttribute(
      state,
      "permalink_template"
    );
    if (!permalinkTemplate) {
      return null;
    }
    const postName = getEditedPostAttribute(state, "slug") || getEditedPostAttribute(state, "generated_slug");
    const [prefix, suffix] = permalinkTemplate.split(
      PERMALINK_POSTNAME_REGEX
    );
    return {
      prefix,
      postName,
      suffix
    };
  }
  function isPostLocked(state) {
    return state.postLock.isLocked;
  }
  function isPostSavingLocked(state) {
    return Object.keys(state.postSavingLock).length > 0;
  }
  function isPostAutosavingLocked(state) {
    return Object.keys(state.postAutosavingLock).length > 0;
  }
  function isPostLockTakeover(state) {
    return state.postLock.isTakeover;
  }
  function getPostLockUser(state) {
    return state.postLock.user;
  }
  function getActivePostLock(state) {
    return state.postLock.activePostLock;
  }
  function canUserUseUnfilteredHTML(state) {
    return Boolean(
      getCurrentPost(state)._links?.hasOwnProperty(
        "wp:action-unfiltered-html"
      )
    );
  }
  var isPublishSidebarEnabled = (0, import_data3.createRegistrySelector)(
    (select5) => () => !!select5(import_preferences.store).get("core", "isPublishSidebarEnabled")
  );
  var getEditorBlocks = (0, import_data3.createSelector)(
    (state) => {
      return getEditedPostAttribute(state, "blocks") || (0, import_blocks.parse)(getEditedPostContent(state));
    },
    (state) => [
      getEditedPostAttribute(state, "blocks"),
      getEditedPostContent(state)
    ]
  );
  function isEditorPanelRemoved(state, panelName) {
    return state.removedPanels.includes(panelName);
  }
  var isEditorPanelEnabled = (0, import_data3.createRegistrySelector)(
    (select5) => (state, panelName) => {
      const inactivePanels = select5(import_preferences.store).get(
        "core",
        "inactivePanels"
      );
      return !isEditorPanelRemoved(state, panelName) && !inactivePanels?.includes(panelName);
    }
  );
  var isEditorPanelOpened = (0, import_data3.createRegistrySelector)(
    (select5) => (state, panelName) => {
      const openPanels = select5(import_preferences.store).get(
        "core",
        "openPanels"
      );
      return !!openPanels?.includes(panelName);
    }
  );
  function getEditorSelectionStart(state) {
    (0, import_deprecated.default)("select('core/editor').getEditorSelectionStart", {
      since: "5.8",
      alternative: "select('core/editor').getEditorSelection"
    });
    return getEditedPostAttribute(state, "selection")?.selectionStart;
  }
  function getEditorSelectionEnd(state) {
    (0, import_deprecated.default)("select('core/editor').getEditorSelectionStart", {
      since: "5.8",
      alternative: "select('core/editor').getEditorSelection"
    });
    return getEditedPostAttribute(state, "selection")?.selectionEnd;
  }
  function getEditorSelection(state) {
    return getEditedPostAttribute(state, "selection");
  }
  function __unstableIsEditorReady(state) {
    return !!state.postId;
  }
  function getEditorSettings(state) {
    return state.editorSettings;
  }
  function getRenderingMode(state) {
    return state.renderingMode;
  }
  var getDeviceType = (0, import_data3.createRegistrySelector)(
    (select5) => (state) => {
      const isZoomOut = unlock(select5(import_block_editor2.store)).isZoomOut();
      if (isZoomOut) {
        return "Desktop";
      }
      return state.deviceType;
    }
  );
  function isListViewOpened(state) {
    return state.listViewPanel;
  }
  function isInserterOpened(state) {
    return !!state.blockInserterPanel;
  }
  var getEditorMode = (0, import_data3.createRegistrySelector)(
    (select5) => () => select5(import_preferences.store).get("core", "editorMode") ?? "visual"
  );
  function getStateBeforeOptimisticTransaction() {
    (0, import_deprecated.default)("select('core/editor').getStateBeforeOptimisticTransaction", {
      since: "5.7",
      hint: "No state history is kept on this store anymore"
    });
    return null;
  }
  function inSomeHistory() {
    (0, import_deprecated.default)("select('core/editor').inSomeHistory", {
      since: "5.7",
      hint: "No state history is kept on this store anymore"
    });
    return false;
  }
  function getBlockEditorSelector(name2) {
    return (0, import_data3.createRegistrySelector)((select5) => (state, ...args) => {
      (0, import_deprecated.default)("`wp.data.select( 'core/editor' )." + name2 + "`", {
        since: "5.3",
        alternative: "`wp.data.select( 'core/block-editor' )." + name2 + "`",
        version: "6.2"
      });
      return select5(import_block_editor2.store)[name2](...args);
    });
  }
  var getBlockName = getBlockEditorSelector("getBlockName");
  var isBlockValid = getBlockEditorSelector("isBlockValid");
  var getBlockAttributes = getBlockEditorSelector("getBlockAttributes");
  var getBlock = getBlockEditorSelector("getBlock");
  var getBlocks = getBlockEditorSelector("getBlocks");
  var getClientIdsOfDescendants = getBlockEditorSelector(
    "getClientIdsOfDescendants"
  );
  var getClientIdsWithDescendants = getBlockEditorSelector(
    "getClientIdsWithDescendants"
  );
  var getGlobalBlockCount = getBlockEditorSelector(
    "getGlobalBlockCount"
  );
  var getBlocksByClientId = getBlockEditorSelector(
    "getBlocksByClientId"
  );
  var getBlockCount = getBlockEditorSelector("getBlockCount");
  var getBlockSelectionStart = getBlockEditorSelector(
    "getBlockSelectionStart"
  );
  var getBlockSelectionEnd = getBlockEditorSelector(
    "getBlockSelectionEnd"
  );
  var getSelectedBlockCount = getBlockEditorSelector(
    "getSelectedBlockCount"
  );
  var hasSelectedBlock = getBlockEditorSelector("hasSelectedBlock");
  var getSelectedBlockClientId = getBlockEditorSelector(
    "getSelectedBlockClientId"
  );
  var getSelectedBlock = getBlockEditorSelector("getSelectedBlock");
  var getBlockRootClientId = getBlockEditorSelector(
    "getBlockRootClientId"
  );
  var getBlockHierarchyRootClientId = getBlockEditorSelector(
    "getBlockHierarchyRootClientId"
  );
  var getAdjacentBlockClientId = getBlockEditorSelector(
    "getAdjacentBlockClientId"
  );
  var getPreviousBlockClientId = getBlockEditorSelector(
    "getPreviousBlockClientId"
  );
  var getNextBlockClientId = getBlockEditorSelector(
    "getNextBlockClientId"
  );
  var getSelectedBlocksInitialCaretPosition = getBlockEditorSelector(
    "getSelectedBlocksInitialCaretPosition"
  );
  var getMultiSelectedBlockClientIds = getBlockEditorSelector(
    "getMultiSelectedBlockClientIds"
  );
  var getMultiSelectedBlocks = getBlockEditorSelector(
    "getMultiSelectedBlocks"
  );
  var getFirstMultiSelectedBlockClientId = getBlockEditorSelector(
    "getFirstMultiSelectedBlockClientId"
  );
  var getLastMultiSelectedBlockClientId = getBlockEditorSelector(
    "getLastMultiSelectedBlockClientId"
  );
  var isFirstMultiSelectedBlock = getBlockEditorSelector(
    "isFirstMultiSelectedBlock"
  );
  var isBlockMultiSelected = getBlockEditorSelector(
    "isBlockMultiSelected"
  );
  var isAncestorMultiSelected = getBlockEditorSelector(
    "isAncestorMultiSelected"
  );
  var getMultiSelectedBlocksStartClientId = getBlockEditorSelector(
    "getMultiSelectedBlocksStartClientId"
  );
  var getMultiSelectedBlocksEndClientId = getBlockEditorSelector(
    "getMultiSelectedBlocksEndClientId"
  );
  var getBlockOrder = getBlockEditorSelector("getBlockOrder");
  var getBlockIndex = getBlockEditorSelector("getBlockIndex");
  var isBlockSelected = getBlockEditorSelector("isBlockSelected");
  var hasSelectedInnerBlock = getBlockEditorSelector(
    "hasSelectedInnerBlock"
  );
  var isBlockWithinSelection = getBlockEditorSelector(
    "isBlockWithinSelection"
  );
  var hasMultiSelection = getBlockEditorSelector("hasMultiSelection");
  var isMultiSelecting = getBlockEditorSelector("isMultiSelecting");
  var isSelectionEnabled = getBlockEditorSelector("isSelectionEnabled");
  var getBlockMode = getBlockEditorSelector("getBlockMode");
  var isTyping = getBlockEditorSelector("isTyping");
  var isCaretWithinFormattedText = getBlockEditorSelector(
    "isCaretWithinFormattedText"
  );
  var getBlockInsertionPoint = getBlockEditorSelector(
    "getBlockInsertionPoint"
  );
  var isBlockInsertionPointVisible = getBlockEditorSelector(
    "isBlockInsertionPointVisible"
  );
  var isValidTemplate = getBlockEditorSelector("isValidTemplate");
  var getTemplate = getBlockEditorSelector("getTemplate");
  var getTemplateLock = getBlockEditorSelector("getTemplateLock");
  var canInsertBlockType = getBlockEditorSelector("canInsertBlockType");
  var getInserterItems = getBlockEditorSelector("getInserterItems");
  var hasInserterItems = getBlockEditorSelector("hasInserterItems");
  var getBlockListSettings = getBlockEditorSelector(
    "getBlockListSettings"
  );
  var __experimentalGetDefaultTemplateTypes = (0, import_data3.createRegistrySelector)(
    (select5) => () => {
      (0, import_deprecated.default)(
        "select('core/editor').__experimentalGetDefaultTemplateTypes",
        {
          since: "6.8",
          alternative: "select('core/core-data').getCurrentTheme()?.default_template_types"
        }
      );
      return select5(import_core_data.store).getCurrentTheme()?.default_template_types;
    }
  );
  var __experimentalGetDefaultTemplatePartAreas = (0, import_data3.createRegistrySelector)(
    (select5) => (0, import_data3.createSelector)(() => {
      (0, import_deprecated.default)(
        "select('core/editor').__experimentalGetDefaultTemplatePartAreas",
        {
          since: "6.8",
          alternative: "select('core/core-data').getCurrentTheme()?.default_template_part_areas"
        }
      );
      const areas = select5(import_core_data.store).getCurrentTheme()?.default_template_part_areas || [];
      return areas.map((item) => {
        return { ...item, icon: getTemplatePartIcon(item.icon) };
      });
    })
  );
  var __experimentalGetDefaultTemplateType = (0, import_data3.createRegistrySelector)(
    (select5) => (0, import_data3.createSelector)((state, slug) => {
      (0, import_deprecated.default)(
        "select('core/editor').__experimentalGetDefaultTemplateType",
        {
          since: "6.8"
        }
      );
      const templateTypes = select5(import_core_data.store).getCurrentTheme()?.default_template_types;
      if (!templateTypes) {
        return EMPTY_OBJECT2;
      }
      return Object.values(templateTypes).find(
        (type) => type.slug === slug
      ) ?? EMPTY_OBJECT2;
    })
  );
  var __experimentalGetTemplateInfo = (0, import_data3.createRegistrySelector)(
    (select5) => (0, import_data3.createSelector)((state, template2) => {
      (0, import_deprecated.default)("select('core/editor').__experimentalGetTemplateInfo", {
        since: "6.8"
      });
      if (!template2) {
        return EMPTY_OBJECT2;
      }
      const currentTheme = select5(import_core_data.store).getCurrentTheme();
      const templateTypes = currentTheme?.default_template_types || [];
      const templateAreas = currentTheme?.default_template_part_areas || [];
      return getTemplateInfo({
        template: template2,
        templateAreas,
        templateTypes
      });
    })
  );
  var getPostTypeLabel = (0, import_data3.createRegistrySelector)(
    (select5) => (state) => {
      const currentPostType = getCurrentPostType(state);
      const postType2 = select5(import_core_data.store).getPostType(currentPostType);
      return postType2?.labels?.singular_name;
    }
  );
  function isPublishSidebarOpened(state) {
    return state.publishSidebarActive;
  }

  // packages/editor/build-module/store/actions.mjs
  var actions_exports = {};
  __export(actions_exports, {
    __experimentalTearDownEditor: () => __experimentalTearDownEditor,
    __unstableSaveForPreview: () => __unstableSaveForPreview,
    autosave: () => autosave,
    clearSelectedBlock: () => clearSelectedBlock,
    closePublishSidebar: () => closePublishSidebar,
    createUndoLevel: () => createUndoLevel,
    disablePublishSidebar: () => disablePublishSidebar,
    editPost: () => editPost,
    enablePublishSidebar: () => enablePublishSidebar,
    enterFormattedText: () => enterFormattedText,
    exitFormattedText: () => exitFormattedText,
    hideInsertionPoint: () => hideInsertionPoint,
    insertBlock: () => insertBlock,
    insertBlocks: () => insertBlocks,
    insertDefaultBlock: () => insertDefaultBlock,
    lockPostAutosaving: () => lockPostAutosaving,
    lockPostSaving: () => lockPostSaving,
    mergeBlocks: () => mergeBlocks,
    moveBlockToPosition: () => moveBlockToPosition,
    moveBlocksDown: () => moveBlocksDown,
    moveBlocksUp: () => moveBlocksUp,
    multiSelect: () => multiSelect,
    openPublishSidebar: () => openPublishSidebar,
    receiveBlocks: () => receiveBlocks,
    redo: () => redo,
    refreshPost: () => refreshPost,
    removeBlock: () => removeBlock,
    removeBlocks: () => removeBlocks,
    removeEditorPanel: () => removeEditorPanel,
    replaceBlock: () => replaceBlock,
    replaceBlocks: () => replaceBlocks,
    resetBlocks: () => resetBlocks,
    resetEditorBlocks: () => resetEditorBlocks,
    resetPost: () => resetPost,
    savePost: () => savePost,
    selectBlock: () => selectBlock,
    setDeviceType: () => setDeviceType,
    setEditedPost: () => setEditedPost,
    setIsInserterOpened: () => setIsInserterOpened,
    setIsListViewOpened: () => setIsListViewOpened,
    setRenderingMode: () => setRenderingMode,
    setTemplateValidity: () => setTemplateValidity,
    setupEditor: () => setupEditor,
    setupEditorState: () => setupEditorState,
    showInsertionPoint: () => showInsertionPoint,
    startMultiSelect: () => startMultiSelect,
    startTyping: () => startTyping,
    stopMultiSelect: () => stopMultiSelect,
    stopTyping: () => stopTyping,
    switchEditorMode: () => switchEditorMode,
    synchronizeTemplate: () => synchronizeTemplate,
    toggleBlockMode: () => toggleBlockMode,
    toggleDistractionFree: () => toggleDistractionFree,
    toggleEditorPanelEnabled: () => toggleEditorPanelEnabled,
    toggleEditorPanelOpened: () => toggleEditorPanelOpened,
    togglePublishSidebar: () => togglePublishSidebar,
    toggleSelection: () => toggleSelection,
    toggleSpotlightMode: () => toggleSpotlightMode,
    toggleTopToolbar: () => toggleTopToolbar,
    trashPost: () => trashPost,
    undo: () => undo,
    unlockPostAutosaving: () => unlockPostAutosaving,
    unlockPostSaving: () => unlockPostSaving,
    updateBlock: () => updateBlock,
    updateBlockAttributes: () => updateBlockAttributes,
    updateBlockListSettings: () => updateBlockListSettings,
    updateEditorSettings: () => updateEditorSettings,
    updatePost: () => updatePost,
    updatePostLock: () => updatePostLock
  });
  var import_a11y = __toESM(require_a11y(), 1);
  var import_api_fetch = __toESM(require_api_fetch(), 1);
  var import_deprecated2 = __toESM(require_deprecated(), 1);
  var import_blocks2 = __toESM(require_blocks(), 1);
  var import_notices = __toESM(require_notices(), 1);
  var import_core_data2 = __toESM(require_core_data(), 1);
  var import_block_editor3 = __toESM(require_block_editor(), 1);
  var import_hooks = __toESM(require_hooks(), 1);
  var import_preferences2 = __toESM(require_preferences(), 1);
  var import_i18n2 = __toESM(require_i18n(), 1);

  // packages/editor/build-module/store/local-autosave.mjs
  function postKey(postId2, isPostNew) {
    return `wp-autosave-block-editor-post-${isPostNew ? "auto-draft" : postId2}`;
  }
  function localAutosaveGet(postId2, isPostNew) {
    return window.sessionStorage.getItem(postKey(postId2, isPostNew));
  }
  function localAutosaveSet(postId2, isPostNew, title, content, excerpt) {
    window.sessionStorage.setItem(
      postKey(postId2, isPostNew),
      JSON.stringify({
        post_title: title,
        content,
        excerpt
      })
    );
  }
  function localAutosaveClear(postId2, isPostNew) {
    window.sessionStorage.removeItem(postKey(postId2, isPostNew));
  }

  // packages/editor/build-module/store/utils/notice-builder.mjs
  var import_i18n = __toESM(require_i18n(), 1);
  function getNotificationArgumentsForSaveSuccess(data) {
    const { previousPost, post: post2, postType: postType2 } = data;
    if (data.options?.isAutosave) {
      return [];
    }
    const publishStatus = ["publish", "private", "future"];
    const isPublished = publishStatus.includes(previousPost.status);
    const willPublish = publishStatus.includes(post2.status);
    const willTrash = post2.status === "trash" && previousPost.status !== "trash";
    let noticeMessage;
    let shouldShowLink = postType2?.viewable ?? false;
    let isDraft;
    if (willTrash) {
      noticeMessage = postType2.labels.item_trashed;
      shouldShowLink = false;
    } else if (!isPublished && !willPublish) {
      noticeMessage = (0, import_i18n.__)("Draft saved.");
      isDraft = true;
    } else if (isPublished && !willPublish) {
      noticeMessage = postType2.labels.item_reverted_to_draft;
      shouldShowLink = false;
    } else if (!isPublished && willPublish) {
      noticeMessage = {
        publish: postType2.labels.item_published,
        private: postType2.labels.item_published_privately,
        future: postType2.labels.item_scheduled
      }[post2.status];
    } else {
      noticeMessage = postType2.labels.item_updated;
    }
    const actions2 = [];
    if (shouldShowLink) {
      actions2.push({
        label: isDraft ? (0, import_i18n.__)("View Preview") : postType2.labels.view_item,
        url: post2.link,
        openInNewTab: true
      });
    }
    return [
      noticeMessage,
      {
        id: "editor-save",
        type: "snackbar",
        actions: actions2
      }
    ];
  }
  function getNotificationArgumentsForSaveFail(data) {
    const { post: post2, edits, error } = data;
    if (error && "rest_autosave_no_changes" === error.code) {
      return [];
    }
    const publishStatus = ["publish", "private", "future"];
    const isPublished = publishStatus.indexOf(post2.status) !== -1;
    if (error.code === "offline_error") {
      const messages2 = {
        publish: (0, import_i18n.__)(
          "Publishing failed because you were offline. Please verify your connection and try again."
        ),
        private: (0, import_i18n.__)(
          "Publishing failed because you were offline. Please verify your connection and try again."
        ),
        future: (0, import_i18n.__)(
          "Scheduling failed because you were offline. Please verify your connection and try again."
        ),
        default: (0, import_i18n.__)(
          "Updating failed because you were offline. Please verify your connection and try again."
        )
      };
      const noticeMessage2 = !isPublished && edits.status in messages2 ? messages2[edits.status] : messages2.default;
      return [noticeMessage2, { id: "editor-save" }];
    }
    const messages = {
      publish: (0, import_i18n.__)("Publishing failed."),
      private: (0, import_i18n.__)("Publishing failed."),
      future: (0, import_i18n.__)("Scheduling failed."),
      default: (0, import_i18n.__)("Updating failed.")
    };
    let noticeMessage = !isPublished && edits.status in messages ? messages[edits.status] : messages.default;
    if (error.message && !/<\/?[^>]*>/.test(error.message)) {
      noticeMessage = [noticeMessage, error.message].join(" ");
    }
    return [
      noticeMessage,
      {
        id: "editor-save"
      }
    ];
  }
  function getNotificationArgumentsForTrashFail(data) {
    return [
      data.error.message && data.error.code !== "unknown_error" ? data.error.message : (0, import_i18n.__)("Trashing failed"),
      {
        id: "editor-trash-fail"
      }
    ];
  }

  // packages/editor/build-module/store/actions.mjs
  var setupEditor = (post2, edits, template2) => ({ dispatch: dispatch6 }) => {
    dispatch6.setEditedPost(post2.type, post2.id);
    const isNewPost = post2.status === "auto-draft";
    if (isNewPost && template2) {
      let content;
      if ("content" in edits) {
        content = edits.content;
      } else {
        content = post2.content.raw;
      }
      let blocks = (0, import_blocks2.parse)(content);
      blocks = (0, import_blocks2.synchronizeBlocksWithTemplate)(blocks, template2);
      dispatch6.resetEditorBlocks(blocks, {
        __unstableShouldCreateUndoLevel: false
      });
    }
    if (edits && Object.entries(edits).some(
      ([key, edit]) => edit !== (post2[key]?.raw ?? post2[key])
    )) {
      dispatch6.editPost(edits);
    }
  };
  function __experimentalTearDownEditor() {
    (0, import_deprecated2.default)(
      "wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor",
      {
        since: "6.5"
      }
    );
    return { type: "DO_NOTHING" };
  }
  function resetPost() {
    (0, import_deprecated2.default)("wp.data.dispatch( 'core/editor' ).resetPost", {
      since: "6.0",
      version: "6.3",
      alternative: "Initialize the editor with the setupEditorState action"
    });
    return { type: "DO_NOTHING" };
  }
  function updatePost() {
    (0, import_deprecated2.default)("wp.data.dispatch( 'core/editor' ).updatePost", {
      since: "5.7",
      alternative: "Use the core entities store instead"
    });
    return {
      type: "DO_NOTHING"
    };
  }
  function setupEditorState(post2) {
    (0, import_deprecated2.default)("wp.data.dispatch( 'core/editor' ).setupEditorState", {
      since: "6.5",
      alternative: "wp.data.dispatch( 'core/editor' ).setEditedPost"
    });
    return setEditedPost(post2.type, post2.id);
  }
  function setEditedPost(postType2, postId2) {
    return {
      type: "SET_EDITED_POST",
      postType: postType2,
      postId: postId2
    };
  }
  var editPost = (edits, options) => ({ select: select5, registry }) => {
    const { id, type } = select5.getCurrentPost();
    registry.dispatch(import_core_data2.store).editEntityRecord("postType", type, id, edits, options);
  };
  var savePost = (options = {}) => async ({ select: select5, dispatch: dispatch6, registry }) => {
    if (!select5.isEditedPostSaveable()) {
      return;
    }
    const content = select5.getEditedPostContent();
    if (!options.isAutosave) {
      dispatch6.editPost({ content }, { undoIgnore: true });
    }
    const previousRecord = select5.getCurrentPost();
    let edits = {
      id: previousRecord.id,
      ...registry.select(import_core_data2.store).getEntityRecordNonTransientEdits(
        "postType",
        previousRecord.type,
        previousRecord.id
      ),
      content
    };
    dispatch6({ type: "REQUEST_POST_UPDATE_START", options });
    let error = false;
    try {
      edits = await (0, import_hooks.applyFiltersAsync)(
        "editor.preSavePost",
        edits,
        options
      );
    } catch (err) {
      error = err;
    }
    if (!error) {
      try {
        await registry.dispatch(import_core_data2.store).saveEntityRecord(
          "postType",
          previousRecord.type,
          edits,
          options
        );
      } catch (err) {
        error = err.message && err.code !== "unknown_error" ? err.message : (0, import_i18n2.__)("An error occurred while updating.");
      }
    }
    if (!error) {
      error = registry.select(import_core_data2.store).getLastEntitySaveError(
        "postType",
        previousRecord.type,
        previousRecord.id
      );
    }
    if (!error) {
      try {
        await (0, import_hooks.applyFilters)(
          "editor.__unstableSavePost",
          Promise.resolve(),
          options
        );
      } catch (err) {
        error = err;
      }
    }
    if (!error) {
      try {
        await (0, import_hooks.doActionAsync)(
          "editor.savePost",
          { id: previousRecord.id, type: previousRecord.type },
          options
        );
      } catch (err) {
        error = err;
      }
    }
    dispatch6({ type: "REQUEST_POST_UPDATE_FINISH", options });
    if (typeof window !== "undefined" && window.__experimentalTemplateActivate && !options.isAutosave && previousRecord.type === "wp_template" && (typeof previousRecord.id === "number" || /^\d+$/.test(previousRecord.id))) {
      templateActivationNotice({ select: select5, dispatch: dispatch6, registry });
    }
    if (error) {
      const args = getNotificationArgumentsForSaveFail({
        post: previousRecord,
        edits,
        error
      });
      if (args.length) {
        registry.dispatch(import_notices.store).createErrorNotice(...args);
      }
    } else {
      const updatedRecord = select5.getCurrentPost();
      const args = getNotificationArgumentsForSaveSuccess({
        previousPost: previousRecord,
        post: updatedRecord,
        postType: await registry.resolveSelect(import_core_data2.store).getPostType(updatedRecord.type),
        options
      });
      if (args.length) {
        registry.dispatch(import_notices.store).createSuccessNotice(...args);
      }
      if (!options.isAutosave) {
        registry.dispatch(import_block_editor3.store).__unstableMarkLastChangeAsPersistent();
      }
    }
  };
  async function templateActivationNotice({ select: select5, registry }) {
    const editorSettings2 = select5.getEditorSettings();
    if (editorSettings2.onNavigateToPreviousEntityRecord) {
      return;
    }
    const { id, slug } = select5.getCurrentPost();
    const site = await registry.select(import_core_data2.store).getEntityRecord("root", "site");
    if (site.active_templates[slug] === id) {
      return;
    }
    const currentTheme = await registry.resolveSelect(import_core_data2.store).getCurrentTheme();
    const templateType = currentTheme?.default_template_types.find(
      (type) => type.slug === slug
    );
    await registry.dispatch(import_notices.store).createNotice(
      "info",
      (0, import_i18n2.sprintf)(
        // translators: %s: The name (or slug) of the type of template.
        (0, import_i18n2.__)('Do you want to activate this "%s" template?'),
        templateType?.title ?? slug
      ),
      {
        id: "template-activate-notice",
        actions: [
          {
            label: (0, import_i18n2.__)("Activate"),
            onClick: async () => {
              await registry.dispatch(import_notices.store).createNotice(
                "info",
                (0, import_i18n2.__)("Activating template\u2026"),
                { id: "template-activate-notice" }
              );
              try {
                const currentSite = await registry.select(import_core_data2.store).getEntityRecord("root", "site");
                await registry.dispatch(import_core_data2.store).saveEntityRecord(
                  "root",
                  "site",
                  {
                    active_templates: {
                      ...currentSite.active_templates,
                      [slug]: id
                    }
                  },
                  { throwOnError: true }
                );
                await registry.dispatch(import_notices.store).createSuccessNotice(
                  (0, import_i18n2.__)("Template activated."),
                  { id: "template-activate-notice" }
                );
              } catch (error) {
                await registry.dispatch(import_notices.store).createErrorNotice(
                  (0, import_i18n2.__)("Template activation failed."),
                  { id: "template-activate-notice" }
                );
                throw error;
              }
            }
          }
        ]
      }
    );
  }
  function refreshPost() {
    (0, import_deprecated2.default)("wp.data.dispatch( 'core/editor' ).refreshPost", {
      since: "6.0",
      version: "6.3",
      alternative: "Use the core entities store instead"
    });
    return { type: "DO_NOTHING" };
  }
  var trashPost = () => async ({ select: select5, dispatch: dispatch6, registry }) => {
    const postTypeSlug = select5.getCurrentPostType();
    const postType2 = await registry.resolveSelect(import_core_data2.store).getPostType(postTypeSlug);
    const { rest_base: restBase, rest_namespace: restNamespace = "wp/v2" } = postType2;
    dispatch6({ type: "REQUEST_POST_DELETE_START" });
    try {
      const post2 = select5.getCurrentPost();
      await (0, import_api_fetch.default)({
        path: `/${restNamespace}/${restBase}/${post2.id}`,
        method: "DELETE"
      });
      await dispatch6.savePost();
    } catch (error) {
      registry.dispatch(import_notices.store).createErrorNotice(
        ...getNotificationArgumentsForTrashFail({ error })
      );
    }
    dispatch6({ type: "REQUEST_POST_DELETE_FINISH" });
  };
  var autosave = ({ local = false, ...options } = {}) => async ({ select: select5, dispatch: dispatch6 }) => {
    const post2 = select5.getCurrentPost();
    if (local) {
      const isPostNew = select5.isEditedPostNew();
      const title = select5.getEditedPostAttribute("title");
      const content = select5.getEditedPostAttribute("content");
      const excerpt = select5.getEditedPostAttribute("excerpt");
      localAutosaveSet(post2.id, isPostNew, title, content, excerpt);
    } else {
      await dispatch6.savePost({ isAutosave: true, ...options });
    }
  };
  var __unstableSaveForPreview = ({ forceIsAutosaveable } = {}) => async ({ select: select5, dispatch: dispatch6 }) => {
    if ((forceIsAutosaveable || select5.isEditedPostAutosaveable()) && !select5.isPostLocked()) {
      const isDraft = ["draft", "auto-draft"].includes(
        select5.getEditedPostAttribute("status")
      );
      if (isDraft) {
        await dispatch6.savePost({ isPreview: true });
      } else {
        await dispatch6.autosave({ isPreview: true });
      }
    }
    return select5.getEditedPostPreviewLink();
  };
  var redo = () => ({ registry }) => {
    registry.dispatch(import_core_data2.store).redo();
  };
  var undo = () => ({ registry }) => {
    registry.dispatch(import_core_data2.store).undo();
  };
  function createUndoLevel() {
    (0, import_deprecated2.default)("wp.data.dispatch( 'core/editor' ).createUndoLevel", {
      since: "6.0",
      version: "6.3",
      alternative: "Use the core entities store instead"
    });
    return { type: "DO_NOTHING" };
  }
  function updatePostLock(lock4) {
    return {
      type: "UPDATE_POST_LOCK",
      lock: lock4
    };
  }
  var enablePublishSidebar = () => ({ registry }) => {
    registry.dispatch(import_preferences2.store).set("core", "isPublishSidebarEnabled", true);
  };
  var disablePublishSidebar = () => ({ registry }) => {
    registry.dispatch(import_preferences2.store).set("core", "isPublishSidebarEnabled", false);
  };
  function lockPostSaving(lockName) {
    return {
      type: "LOCK_POST_SAVING",
      lockName
    };
  }
  function unlockPostSaving(lockName) {
    return {
      type: "UNLOCK_POST_SAVING",
      lockName
    };
  }
  function lockPostAutosaving(lockName) {
    return {
      type: "LOCK_POST_AUTOSAVING",
      lockName
    };
  }
  function unlockPostAutosaving(lockName) {
    return {
      type: "UNLOCK_POST_AUTOSAVING",
      lockName
    };
  }
  var resetEditorBlocks = (blocks, options = {}) => ({ select: select5, dispatch: dispatch6, registry }) => {
    const { __unstableShouldCreateUndoLevel, selection } = options;
    const edits = { blocks, selection };
    if (__unstableShouldCreateUndoLevel !== false) {
      const { id, type } = select5.getCurrentPost();
      const noChange = registry.select(import_core_data2.store).getEditedEntityRecord("postType", type, id).blocks === edits.blocks;
      if (noChange) {
        registry.dispatch(import_core_data2.store).__unstableCreateUndoLevel("postType", type, id);
        return;
      }
      edits.content = ({ blocks: blocksForSerialization = [] }) => (0, import_blocks2.__unstableSerializeAndClean)(blocksForSerialization);
    }
    dispatch6.editPost(edits);
  };
  function updateEditorSettings(settings) {
    return {
      type: "UPDATE_EDITOR_SETTINGS",
      settings
    };
  }
  var setRenderingMode = (mode) => ({ dispatch: dispatch6, registry, select: select5 }) => {
    if (select5.__unstableIsEditorReady() && !select5.getEditorSettings().isPreviewMode) {
      registry.dispatch(import_block_editor3.store).clearSelectedBlock();
      dispatch6.editPost({ selection: void 0 }, { undoIgnore: true });
    }
    dispatch6({
      type: "SET_RENDERING_MODE",
      mode
    });
  };
  function setDeviceType(deviceType2) {
    return {
      type: "SET_DEVICE_TYPE",
      deviceType: deviceType2
    };
  }
  var toggleEditorPanelEnabled = (panelName) => ({ registry }) => {
    const inactivePanels = registry.select(import_preferences2.store).get("core", "inactivePanels") ?? [];
    const isPanelInactive = !!inactivePanels?.includes(panelName);
    let updatedInactivePanels;
    if (isPanelInactive) {
      updatedInactivePanels = inactivePanels.filter(
        (invactivePanelName) => invactivePanelName !== panelName
      );
    } else {
      updatedInactivePanels = [...inactivePanels, panelName];
    }
    registry.dispatch(import_preferences2.store).set("core", "inactivePanels", updatedInactivePanels);
  };
  var toggleEditorPanelOpened = (panelName) => ({ registry }) => {
    const openPanels = registry.select(import_preferences2.store).get("core", "openPanels") ?? [];
    const isPanelOpen = !!openPanels?.includes(panelName);
    let updatedOpenPanels;
    if (isPanelOpen) {
      updatedOpenPanels = openPanels.filter(
        (openPanelName) => openPanelName !== panelName
      );
    } else {
      updatedOpenPanels = [...openPanels, panelName];
    }
    registry.dispatch(import_preferences2.store).set("core", "openPanels", updatedOpenPanels);
  };
  function removeEditorPanel(panelName) {
    return {
      type: "REMOVE_PANEL",
      panelName
    };
  }
  var setIsInserterOpened = (value) => ({ dispatch: dispatch6, registry }) => {
    if (typeof value === "object" && value.hasOwnProperty("rootClientId") && value.hasOwnProperty("insertionIndex")) {
      unlock(registry.dispatch(import_block_editor3.store)).setInsertionPoint({
        rootClientId: value.rootClientId,
        index: value.insertionIndex
      });
    }
    dispatch6({
      type: "SET_IS_INSERTER_OPENED",
      value
    });
  };
  function setIsListViewOpened(isOpen) {
    return {
      type: "SET_IS_LIST_VIEW_OPENED",
      isOpen
    };
  }
  var toggleDistractionFree = ({ createNotice = true } = {}) => ({ dispatch: dispatch6, registry }) => {
    const isDistractionFree = registry.select(import_preferences2.store).get("core", "distractionFree");
    if (isDistractionFree) {
      registry.dispatch(import_preferences2.store).set("core", "fixedToolbar", false);
    }
    if (!isDistractionFree) {
      registry.batch(() => {
        registry.dispatch(import_preferences2.store).set("core", "fixedToolbar", true);
        dispatch6.setIsInserterOpened(false);
        dispatch6.setIsListViewOpened(false);
        unlock(
          registry.dispatch(import_block_editor3.store)
        ).resetZoomLevel();
      });
    }
    registry.batch(() => {
      registry.dispatch(import_preferences2.store).set("core", "distractionFree", !isDistractionFree);
      if (createNotice) {
        registry.dispatch(import_notices.store).createInfoNotice(
          isDistractionFree ? (0, import_i18n2.__)("Distraction free mode deactivated.") : (0, import_i18n2.__)("Distraction free mode activated."),
          {
            id: "core/editor/distraction-free-mode/notice",
            type: "snackbar",
            actions: [
              {
                label: (0, import_i18n2.__)("Undo"),
                onClick: () => {
                  registry.batch(() => {
                    registry.dispatch(import_preferences2.store).set(
                      "core",
                      "fixedToolbar",
                      isDistractionFree
                    );
                    registry.dispatch(import_preferences2.store).toggle(
                      "core",
                      "distractionFree"
                    );
                  });
                }
              }
            ]
          }
        );
      }
    });
  };
  var toggleSpotlightMode = () => ({ registry }) => {
    registry.dispatch(import_preferences2.store).toggle("core", "focusMode");
    const isFocusMode = registry.select(import_preferences2.store).get("core", "focusMode");
    registry.dispatch(import_notices.store).createInfoNotice(
      isFocusMode ? (0, import_i18n2.__)("Spotlight mode activated.") : (0, import_i18n2.__)("Spotlight mode deactivated."),
      {
        id: "core/editor/toggle-spotlight-mode/notice",
        type: "snackbar",
        actions: [
          {
            label: (0, import_i18n2.__)("Undo"),
            onClick: () => {
              registry.dispatch(import_preferences2.store).toggle("core", "focusMode");
            }
          }
        ]
      }
    );
  };
  var toggleTopToolbar = () => ({ registry }) => {
    registry.dispatch(import_preferences2.store).toggle("core", "fixedToolbar");
    const isTopToolbar = registry.select(import_preferences2.store).get("core", "fixedToolbar");
    registry.dispatch(import_notices.store).createInfoNotice(
      isTopToolbar ? (0, import_i18n2.__)("Top toolbar activated.") : (0, import_i18n2.__)("Top toolbar deactivated."),
      {
        id: "core/editor/toggle-top-toolbar/notice",
        type: "snackbar",
        actions: [
          {
            label: (0, import_i18n2.__)("Undo"),
            onClick: () => {
              registry.dispatch(import_preferences2.store).toggle("core", "fixedToolbar");
            }
          }
        ]
      }
    );
  };
  var switchEditorMode = (mode) => ({ dispatch: dispatch6, registry }) => {
    registry.dispatch(import_preferences2.store).set("core", "editorMode", mode);
    if (mode !== "visual") {
      registry.dispatch(import_block_editor3.store).clearSelectedBlock();
      unlock(registry.dispatch(import_block_editor3.store)).resetZoomLevel();
    }
    if (mode === "visual") {
      (0, import_a11y.speak)((0, import_i18n2.__)("Visual editor selected"), "assertive");
    } else if (mode === "text") {
      const isDistractionFree = registry.select(import_preferences2.store).get("core", "distractionFree");
      if (isDistractionFree) {
        dispatch6.toggleDistractionFree();
      }
      (0, import_a11y.speak)((0, import_i18n2.__)("Code editor selected"), "assertive");
    }
  };
  function openPublishSidebar() {
    return {
      type: "OPEN_PUBLISH_SIDEBAR"
    };
  }
  function closePublishSidebar() {
    return {
      type: "CLOSE_PUBLISH_SIDEBAR"
    };
  }
  function togglePublishSidebar() {
    return {
      type: "TOGGLE_PUBLISH_SIDEBAR"
    };
  }
  var getBlockEditorAction = (name2) => (...args) => ({ registry }) => {
    (0, import_deprecated2.default)("`wp.data.dispatch( 'core/editor' )." + name2 + "`", {
      since: "5.3",
      alternative: "`wp.data.dispatch( 'core/block-editor' )." + name2 + "`",
      version: "6.2"
    });
    registry.dispatch(import_block_editor3.store)[name2](...args);
  };
  var resetBlocks = getBlockEditorAction("resetBlocks");
  var receiveBlocks = getBlockEditorAction("receiveBlocks");
  var updateBlock = getBlockEditorAction("updateBlock");
  var updateBlockAttributes = getBlockEditorAction(
    "updateBlockAttributes"
  );
  var selectBlock = getBlockEditorAction("selectBlock");
  var startMultiSelect = getBlockEditorAction("startMultiSelect");
  var stopMultiSelect = getBlockEditorAction("stopMultiSelect");
  var multiSelect = getBlockEditorAction("multiSelect");
  var clearSelectedBlock = getBlockEditorAction("clearSelectedBlock");
  var toggleSelection = getBlockEditorAction("toggleSelection");
  var replaceBlocks = getBlockEditorAction("replaceBlocks");
  var replaceBlock = getBlockEditorAction("replaceBlock");
  var moveBlocksDown = getBlockEditorAction("moveBlocksDown");
  var moveBlocksUp = getBlockEditorAction("moveBlocksUp");
  var moveBlockToPosition = getBlockEditorAction(
    "moveBlockToPosition"
  );
  var insertBlock = getBlockEditorAction("insertBlock");
  var insertBlocks = getBlockEditorAction("insertBlocks");
  var showInsertionPoint = getBlockEditorAction("showInsertionPoint");
  var hideInsertionPoint = getBlockEditorAction("hideInsertionPoint");
  var setTemplateValidity = getBlockEditorAction(
    "setTemplateValidity"
  );
  var synchronizeTemplate = getBlockEditorAction(
    "synchronizeTemplate"
  );
  var mergeBlocks = getBlockEditorAction("mergeBlocks");
  var removeBlocks = getBlockEditorAction("removeBlocks");
  var removeBlock = getBlockEditorAction("removeBlock");
  var toggleBlockMode = getBlockEditorAction("toggleBlockMode");
  var startTyping = getBlockEditorAction("startTyping");
  var stopTyping = getBlockEditorAction("stopTyping");
  var enterFormattedText = getBlockEditorAction("enterFormattedText");
  var exitFormattedText = getBlockEditorAction("exitFormattedText");
  var insertDefaultBlock = getBlockEditorAction("insertDefaultBlock");
  var updateBlockListSettings = getBlockEditorAction(
    "updateBlockListSettings"
  );

  // packages/editor/build-module/store/private-actions.mjs
  var private_actions_exports = {};
  __export(private_actions_exports, {
    createTemplate: () => createTemplate,
    hideBlockTypes: () => hideBlockTypes,
    registerEntityAction: () => registerEntityAction,
    registerEntityField: () => registerEntityField,
    registerPostTypeSchema: () => registerPostTypeSchema,
    removeTemplates: () => removeTemplates,
    resetStylesNavigation: () => resetStylesNavigation,
    revertTemplate: () => revertTemplate2,
    saveDirtyEntities: () => saveDirtyEntities,
    setCanvasMinHeight: () => setCanvasMinHeight,
    setCurrentTemplateId: () => setCurrentTemplateId,
    setDefaultRenderingMode: () => setDefaultRenderingMode,
    setIsReady: () => setIsReady,
    setShowStylebook: () => setShowStylebook,
    setStylesPath: () => setStylesPath,
    showBlockTypes: () => showBlockTypes,
    unregisterEntityAction: () => unregisterEntityAction,
    unregisterEntityField: () => unregisterEntityField
  });
  var import_core_data46 = __toESM(require_core_data(), 1);
  var import_i18n108 = __toESM(require_i18n(), 1);
  var import_notices17 = __toESM(require_notices(), 1);
  var import_block_editor35 = __toESM(require_block_editor(), 1);
  var import_preferences9 = __toESM(require_preferences(), 1);
  var import_url9 = __toESM(require_url(), 1);
  var import_api_fetch4 = __toESM(require_api_fetch(), 1);
  var import_blocks19 = __toESM(require_blocks(), 1);
  var import_html_entities9 = __toESM(require_html_entities(), 1);

  // packages/editor/build-module/store/utils/is-template-revertable.mjs
  function isTemplateRevertable(templateOrTemplatePart) {
    if (!templateOrTemplatePart) {
      return false;
    }
    return templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file);
  }

  // packages/editor/build-module/dataviews/store/private-actions.mjs
  var import_core_data45 = __toESM(require_core_data(), 1);
  var import_hooks36 = __toESM(require_hooks(), 1);

  // packages/fields/build-module/fields/slug/index.mjs
  var import_i18n5 = __toESM(require_i18n(), 1);

  // packages/fields/build-module/fields/slug/slug-edit.mjs
  var import_components = __toESM(require_components(), 1);
  var import_compose = __toESM(require_compose(), 1);
  var import_data4 = __toESM(require_data(), 1);
  var import_element3 = __toESM(require_element(), 1);
  var import_notices2 = __toESM(require_notices(), 1);
  var import_url3 = __toESM(require_url(), 1);
  var import_i18n4 = __toESM(require_i18n(), 1);

  // packages/fields/build-module/fields/slug/utils.mjs
  var import_url2 = __toESM(require_url(), 1);

  // packages/fields/build-module/actions/utils.mjs
  var import_html_entities = __toESM(require_html_entities(), 1);
  var import_i18n3 = __toESM(require_i18n(), 1);
  function isTemplate(post2) {
    return post2.type === "wp_template";
  }
  function isTemplatePart(post2) {
    return post2.type === "wp_template_part";
  }
  function isTemplateOrTemplatePart(p4) {
    return p4.type === "wp_template" || p4.type === "wp_template_part";
  }
  function getItemTitle(item, fallback = (0, import_i18n3.__)("(no title)")) {
    let title = "";
    if (typeof item.title === "string") {
      title = (0, import_html_entities.decodeEntities)(item.title);
    } else if (item.title && "rendered" in item.title) {
      title = (0, import_html_entities.decodeEntities)(item.title.rendered);
    } else if (item.title && "raw" in item.title) {
      title = (0, import_html_entities.decodeEntities)(item.title.raw);
    }
    return title || fallback;
  }
  function isTemplateRemovable(template2) {
    if (!template2) {
      return false;
    }
    return [template2.source, template2.source].includes("custom") && !Boolean(template2.type === "wp_template" && template2?.plugin) && !template2.has_theme_file;
  }

  // packages/fields/build-module/fields/slug/utils.mjs
  var getSlug = (item) => {
    if (typeof item !== "object") {
      return "";
    }
    return item.slug || (0, import_url2.cleanForSlug)(getItemTitle(item)) || item.id.toString();
  };

  // packages/fields/build-module/fields/slug/slug-edit.mjs
  var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
  var SlugEdit = ({
    field,
    onChange,
    data
  }) => {
    const { id } = field;
    const slug = field.getValue({ item: data }) || getSlug(data);
    const permalinkTemplate = data.permalink_template || "";
    const PERMALINK_POSTNAME_REGEX2 = /%(?:postname|pagename)%/;
    const [prefix, suffix] = permalinkTemplate.split(
      PERMALINK_POSTNAME_REGEX2
    );
    const permalinkPrefix = prefix;
    const permalinkSuffix = suffix;
    const isEditable = PERMALINK_POSTNAME_REGEX2.test(permalinkTemplate);
    const originalSlugRef = (0, import_element3.useRef)(slug);
    const slugToDisplay = slug || originalSlugRef.current;
    const permalink = isEditable ? `${permalinkPrefix}${slugToDisplay}${permalinkSuffix}` : (0, import_url3.safeDecodeURIComponent)(data.link || "");
    (0, import_element3.useEffect)(() => {
      if (slug && originalSlugRef.current === void 0) {
        originalSlugRef.current = slug;
      }
    }, [slug]);
    const onChangeControl = (0, import_element3.useCallback)(
      (newValue) => onChange({
        [id]: newValue
      }),
      [id, onChange]
    );
    const { createNotice } = (0, import_data4.useDispatch)(import_notices2.store);
    const copyButtonRef = (0, import_compose.useCopyToClipboard)(permalink, () => {
      createNotice("info", (0, import_i18n4.__)("Copied Permalink to clipboard."), {
        isDismissible: true,
        type: "snackbar"
      });
    });
    const postUrlSlugDescriptionId = "editor-post-url__slug-description-" + (0, import_compose.useInstanceId)(SlugEdit);
    return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("fieldset", { className: "fields-controls__slug", children: [
      isEditable && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_components.__experimentalVStack, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_components.__experimentalVStack, { spacing: "0px", children: [
          /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { children: (0, import_i18n4.__)(
            "Customize the last part of the Permalink."
          ) }),
          /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_components.ExternalLink, { href: "https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink", children: (0, import_i18n4.__)("Learn more") })
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
          import_components.__experimentalInputControl,
          {
            __next40pxDefaultSize: true,
            prefix: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_components.__experimentalInputControlPrefixWrapper, { children: "/" }),
            suffix: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_components.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
              import_components.Button,
              {
                size: "small",
                icon: copy_small_default,
                ref: copyButtonRef,
                label: (0, import_i18n4.__)("Copy")
              }
            ) }),
            label: (0, import_i18n4.__)("Link"),
            hideLabelFromVision: true,
            value: slug,
            autoComplete: "off",
            spellCheck: "false",
            type: "text",
            className: "fields-controls__slug-input",
            onChange: (newValue) => {
              onChangeControl(newValue);
            },
            onBlur: () => {
              if (slug === "") {
                onChangeControl(originalSlugRef.current);
              }
            },
            "aria-describedby": postUrlSlugDescriptionId
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "fields-controls__slug-help", children: [
          /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "fields-controls__slug-help-visual-label", children: (0, import_i18n4.__)("Permalink:") }),
          /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
            import_components.ExternalLink,
            {
              className: "fields-controls__slug-help-link",
              href: permalink,
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "fields-controls__slug-help-prefix", children: permalinkPrefix }),
                /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "fields-controls__slug-help-slug", children: slugToDisplay }),
                /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "fields-controls__slug-help-suffix", children: permalinkSuffix })
              ]
            }
          )
        ] })
      ] }),
      !isEditable && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
        import_components.ExternalLink,
        {
          className: "fields-controls__slug-help",
          href: permalink,
          children: permalink
        }
      )
    ] });
  };
  var slug_edit_default = SlugEdit;

  // packages/fields/build-module/fields/slug/slug-view.mjs
  var import_element4 = __toESM(require_element(), 1);
  var SlugView = ({ item }) => {
    const slug = getSlug(item);
    const originalSlugRef = (0, import_element4.useRef)(slug);
    (0, import_element4.useEffect)(() => {
      if (slug && originalSlugRef.current === void 0) {
        originalSlugRef.current = slug;
      }
    }, [slug]);
    const slugToDisplay = slug || originalSlugRef.current;
    return `${slugToDisplay}`;
  };
  var slug_view_default = SlugView;

  // packages/fields/build-module/fields/slug/index.mjs
  var slugField = {
    id: "slug",
    type: "text",
    label: (0, import_i18n5.__)("Slug"),
    Edit: slug_edit_default,
    render: slug_view_default,
    filterBy: false
  };
  var slug_default = slugField;

  // packages/fields/build-module/fields/title/index.mjs
  var import_i18n7 = __toESM(require_i18n(), 1);

  // node_modules/clsx/dist/clsx.mjs
  function r(e3) {
    var t4, f3, n3 = "";
    if ("string" == typeof e3 || "number" == typeof e3) n3 += e3;
    else if ("object" == typeof e3) if (Array.isArray(e3)) {
      var o4 = e3.length;
      for (t4 = 0; t4 < o4; t4++) e3[t4] && (f3 = r(e3[t4])) && (n3 && (n3 += " "), n3 += f3);
    } else for (f3 in e3) e3[f3] && (n3 && (n3 += " "), n3 += f3);
    return n3;
  }
  function clsx() {
    for (var e3, t4, f3 = 0, n3 = "", o4 = arguments.length; f3 < o4; f3++) (e3 = arguments[f3]) && (t4 = r(e3)) && (n3 && (n3 += " "), n3 += t4);
    return n3;
  }
  var clsx_default = clsx;

  // packages/fields/build-module/fields/title/view.mjs
  var import_components2 = __toESM(require_components(), 1);
  var import_i18n6 = __toESM(require_i18n(), 1);
  var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
  function BaseTitleView({
    item,
    className,
    children
  }) {
    const renderedTitle = getItemTitle(item);
    return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
      import_components2.__experimentalHStack,
      {
        className: clsx_default("fields-field__title", className),
        alignment: "center",
        justify: "flex-start",
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { children: renderedTitle || (0, import_i18n6.__)("(no title)") }),
          children
        ]
      }
    );
  }
  function TitleView({ item }) {
    return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(BaseTitleView, { item });
  }

  // packages/fields/build-module/fields/title/index.mjs
  var titleField = {
    type: "text",
    id: "title",
    label: (0, import_i18n7.__)("Title"),
    placeholder: (0, import_i18n7.__)("No title"),
    getValue: ({ item }) => getItemTitle(item),
    render: TitleView,
    enableHiding: true,
    enableGlobalSearch: true,
    filterBy: false
  };
  var title_default = titleField;

  // packages/fields/build-module/fields/page-title/index.mjs
  var import_i18n9 = __toESM(require_i18n(), 1);

  // packages/fields/build-module/fields/page-title/view.mjs
  var import_i18n8 = __toESM(require_i18n(), 1);
  var import_data5 = __toESM(require_data(), 1);
  var import_core_data3 = __toESM(require_core_data(), 1);
  var import_components3 = __toESM(require_components(), 1);

  // packages/fields/build-module/lock-unlock.mjs
  var import_private_apis2 = __toESM(require_private_apis(), 1);
  var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
    "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
    "@wordpress/fields"
  );

  // packages/fields/build-module/fields/page-title/view.mjs
  var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
  var { Badge } = unlock2(import_components3.privateApis);
  function PageTitleView({ item }) {
    const { frontPageId, postsPageId } = (0, import_data5.useSelect)((select5) => {
      const { getEntityRecord } = select5(import_core_data3.store);
      const siteSettings = getEntityRecord(
        "root",
        "site"
      );
      return {
        frontPageId: siteSettings?.page_on_front,
        postsPageId: siteSettings?.page_for_posts
      };
    }, []);
    return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(BaseTitleView, { item, className: "fields-field__page-title", children: [frontPageId, postsPageId].includes(item.id) && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Badge, { children: item.id === frontPageId ? (0, import_i18n8.__)("Homepage") : (0, import_i18n8.__)("Posts Page") }) });
  }

  // packages/fields/build-module/fields/page-title/index.mjs
  var pageTitleField = {
    type: "text",
    id: "title",
    label: (0, import_i18n9.__)("Title"),
    placeholder: (0, import_i18n9.__)("No title"),
    getValue: ({ item }) => getItemTitle(item),
    render: PageTitleView,
    enableHiding: false,
    enableGlobalSearch: true,
    filterBy: false
  };
  var page_title_default = pageTitleField;

  // packages/fields/build-module/fields/template-title/index.mjs
  var import_i18n10 = __toESM(require_i18n(), 1);
  var templateTitleField = {
    type: "text",
    label: (0, import_i18n10.__)("Template"),
    placeholder: (0, import_i18n10.__)("No title"),
    id: "title",
    getValue: ({ item }) => getItemTitle(item),
    render: TitleView,
    enableHiding: false,
    enableGlobalSearch: true,
    filterBy: false
  };
  var template_title_default = templateTitleField;

  // packages/fields/build-module/fields/pattern-title/index.mjs
  var import_i18n12 = __toESM(require_i18n(), 1);

  // packages/fields/build-module/fields/pattern-title/view.mjs
  var import_i18n11 = __toESM(require_i18n(), 1);
  var import_components4 = __toESM(require_components(), 1);
  var import_patterns = __toESM(require_patterns(), 1);
  var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
  var { PATTERN_TYPES } = unlock2(import_patterns.privateApis);
  function PatternTitleView({ item }) {
    return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(BaseTitleView, { item, className: "fields-field__pattern-title", children: item.type === PATTERN_TYPES.theme && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
      import_components4.Tooltip,
      {
        placement: "top",
        text: (0, import_i18n11.__)("This pattern cannot be edited."),
        children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(icon_default, { icon: lock_small_default, size: 24 })
      }
    ) });
  }

  // packages/fields/build-module/fields/pattern-title/index.mjs
  var patternTitleField = {
    type: "text",
    id: "title",
    label: (0, import_i18n12.__)("Title"),
    placeholder: (0, import_i18n12.__)("No title"),
    getValue: ({ item }) => getItemTitle(item),
    render: PatternTitleView,
    enableHiding: false,
    enableGlobalSearch: true,
    filterBy: false
  };
  var pattern_title_default = patternTitleField;

  // packages/fields/build-module/fields/featured-image/index.mjs
  var import_i18n14 = __toESM(require_i18n(), 1);

  // packages/fields/build-module/components/media-edit/index.mjs
  var import_components5 = __toESM(require_components(), 1);
  var import_blob = __toESM(require_blob(), 1);
  var import_core_data4 = __toESM(require_core_data(), 1);
  var import_data6 = __toESM(require_data(), 1);
  var import_element5 = __toESM(require_element(), 1);
  var import_i18n13 = __toESM(require_i18n(), 1);
  var import_media_utils = __toESM(require_media_utils(), 1);
  var import_notices3 = __toESM(require_notices(), 1);
  var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
  var { MediaUploadModal } = unlock2(import_media_utils.privateApis);
  function ConditionalMediaUpload({ render, multiple, ...props }) {
    const [isModalOpen, setIsModalOpen] = (0, import_element5.useState)(false);
    if (window.__experimentalDataViewsMediaModal) {
      return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
        render && render({ open: () => setIsModalOpen(true) }),
        isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
          MediaUploadModal,
          {
            ...props,
            multiple,
            isOpen: isModalOpen,
            onClose: () => {
              setIsModalOpen(false);
              props.onClose?.();
            },
            onSelect: (media) => {
              setIsModalOpen(false);
              props.onSelect?.(media);
            }
          }
        )
      ] });
    }
    return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
      import_media_utils.MediaUpload,
      {
        ...props,
        render,
        multiple: multiple ? "add" : void 0
      }
    );
  }
  function MediaPickerButton({
    open,
    children,
    label,
    showTooltip = false,
    onFilesDrop,
    attachment,
    isUploading = false
  }) {
    const isBlob = attachment && (0, import_blob.isBlobURL)(attachment.source_url);
    const mediaPickerButton = /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
      "div",
      {
        className: "fields__media-edit-picker-button",
        role: "button",
        tabIndex: 0,
        onClick: () => {
          if (!isUploading) {
            open();
          }
        },
        onKeyDown: (event) => {
          if (isUploading) {
            return;
          }
          if (event.key === "Enter" || event.key === " ") {
            event.preventDefault();
            open();
          }
        },
        "aria-label": label,
        "aria-disabled": isUploading,
        children: [
          children,
          isBlob && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "fields__media-edit-picker-button-spinner", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components5.Spinner, {}) }),
          !isUploading && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
            import_components5.DropZone,
            {
              onFilesDrop: (files) => onFilesDrop(files, attachment?.id)
            }
          )
        ]
      }
    );
    if (!showTooltip) {
      return mediaPickerButton;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components5.Tooltip, { text: label, children: mediaPickerButton });
  }
  var archiveMimeTypes = [
    "application/zip",
    "application/x-zip-compressed",
    "application/x-rar-compressed",
    "application/x-7z-compressed",
    "application/x-tar",
    "application/x-gzip"
  ];
  function MediaTitle({ attachment }) {
    return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components5.__experimentalTruncate, { className: "fields__media-edit-filename", children: attachment.title.rendered });
  }
  function MediaEditPlaceholder(props) {
    return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(MediaPickerButton, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "fields__media-edit-placeholder", children: props.label }) });
  }
  function MediaPreview({ attachment }) {
    const url = attachment.source_url;
    const mimeType = attachment.mime_type || "";
    if (mimeType.startsWith("image")) {
      return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
        "img",
        {
          className: "fields__media-edit-thumbnail",
          alt: attachment.alt_text || "",
          src: url
        }
      );
    } else if (mimeType.startsWith("audio")) {
      return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components5.Icon, { icon: audio_default });
    } else if (mimeType.startsWith("video")) {
      return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components5.Icon, { icon: video_default });
    } else if (archiveMimeTypes.includes(mimeType)) {
      return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components5.Icon, { icon: archive_default });
    }
    return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components5.Icon, { icon: file_default });
  }
  function ExpandedMediaEditAttachments({
    allItems,
    addButtonLabel,
    multiple,
    removeItem,
    open,
    onFilesDrop,
    isUploading
  }) {
    return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
      "div",
      {
        className: clsx_default("fields__media-edit-expanded", {
          "is-multiple": multiple,
          "is-single": !multiple,
          "is-empty": !allItems?.length
        }),
        children: [
          allItems?.map((attachment) => {
            const hasPreviewImage = attachment.mime_type?.startsWith("image");
            const isBlob = (0, import_blob.isBlobURL)(attachment.source_url);
            return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
              "div",
              {
                className: clsx_default("fields__media-edit-expanded-item", {
                  "has-preview-image": hasPreviewImage
                }),
                children: [
                  /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
                    MediaPickerButton,
                    {
                      open,
                      label: (0, import_i18n13.__)("Replace"),
                      showTooltip: true,
                      onFilesDrop,
                      attachment,
                      isUploading,
                      children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "fields__media-edit-expanded-preview", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
                        import_components5.__experimentalVStack,
                        {
                          spacing: 0,
                          alignment: "center",
                          justify: "center",
                          className: "fields__media-edit-expanded-preview-stack",
                          children: [
                            (!isBlob || hasPreviewImage) && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
                              MediaPreview,
                              {
                                attachment
                              }
                            ),
                            !isBlob && (!hasPreviewImage ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
                              MediaTitle,
                              {
                                attachment
                              }
                            ) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "fields__media-edit-expanded-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "fields__media-edit-expanded-title", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
                              MediaTitle,
                              {
                                attachment
                              }
                            ) }) }))
                          ]
                        }
                      ) })
                    }
                  ),
                  !isBlob && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "fields__media-edit-expanded-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
                    import_components5.Button,
                    {
                      __next40pxDefaultSize: true,
                      className: "fields__media-edit-expanded-remove",
                      icon: close_small_default,
                      label: (0, import_i18n13.__)("Remove"),
                      size: "small",
                      disabled: isUploading,
                      accessibleWhenDisabled: true,
                      onClick: (event) => {
                        event.stopPropagation();
                        removeItem(attachment.id);
                      }
                    }
                  ) })
                ]
              },
              attachment.id
            );
          }),
          (multiple || !allItems?.length) && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
            MediaEditPlaceholder,
            {
              open,
              label: addButtonLabel,
              onFilesDrop,
              isUploading
            }
          )
        ]
      }
    );
  }
  function CompactMediaEditAttachments({
    allItems,
    addButtonLabel,
    multiple,
    removeItem,
    open,
    onFilesDrop,
    isUploading
  }) {
    return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
      !!allItems?.length && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components5.__experimentalVStack, { spacing: 2, children: allItems.map((attachment) => {
        const isBlob = (0, import_blob.isBlobURL)(attachment.source_url);
        return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
          "div",
          {
            className: "fields__media-edit-compact",
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
                MediaPickerButton,
                {
                  open,
                  label: (0, import_i18n13.__)("Replace"),
                  showTooltip: true,
                  onFilesDrop,
                  attachment,
                  isUploading,
                  children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
                    /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
                      MediaPreview,
                      {
                        attachment
                      }
                    ),
                    !isBlob && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
                      MediaTitle,
                      {
                        attachment
                      }
                    )
                  ] })
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
                import_components5.Button,
                {
                  __next40pxDefaultSize: true,
                  className: "fields__media-edit-remove",
                  text: (0, import_i18n13.__)("Remove"),
                  variant: "secondary",
                  disabled: isUploading,
                  accessibleWhenDisabled: true,
                  onClick: (event) => {
                    event.stopPropagation();
                    if (typeof attachment.id === "number") {
                      removeItem(attachment.id);
                    }
                  }
                }
              )
            ]
          },
          attachment.id
        );
      }) }),
      (multiple || !allItems?.length) && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
        MediaEditPlaceholder,
        {
          open,
          label: addButtonLabel,
          onFilesDrop,
          isUploading
        }
      )
    ] });
  }
  function MediaEdit({
    data,
    field,
    onChange,
    hideLabelFromVision,
    allowedTypes = ["image"],
    multiple,
    isExpanded
  }) {
    const value = field.getValue({ item: data });
    const attachments = (0, import_data6.useSelect)(
      (select5) => {
        if (!value) {
          return null;
        }
        const normalizedValue = Array.isArray(value) ? value : [value];
        const { getEntityRecords } = select5(import_core_data4.store);
        return getEntityRecords("postType", "attachment", {
          include: normalizedValue
        });
      },
      [value]
    );
    const { createErrorNotice } = (0, import_data6.useDispatch)(import_notices3.store);
    const [replacementId, setReplacementId] = (0, import_element5.useState)();
    const [blobs, setBlobs] = (0, import_element5.useState)([]);
    const onChangeControl = (0, import_element5.useCallback)(
      (newValue) => onChange(field.setValue({ item: data, value: newValue })),
      [data, field, onChange]
    );
    const removeItem = (itemId) => {
      const currentIds = Array.isArray(value) ? value : [value];
      const newIds = currentIds.filter((id) => id !== itemId);
      onChangeControl(newIds.length ? newIds : void 0);
    };
    const onFilesDrop = (0, import_element5.useCallback)(
      (files, _replacementId) => {
        (0, import_media_utils.uploadMedia)({
          allowedTypes: allowedTypes?.length ? allowedTypes : void 0,
          filesList: files,
          onFileChange(uploadedMedia) {
            setReplacementId(_replacementId);
            const { blobItems, uploadedItems } = uploadedMedia.reduce(
              (accumulator, item) => {
                if ((0, import_blob.isBlobURL)(item.url)) {
                  accumulator.blobItems.push(item.url);
                } else {
                  accumulator.uploadedItems.push(item.id);
                }
                return accumulator;
              },
              {
                blobItems: [],
                uploadedItems: []
              }
            );
            setBlobs(blobItems);
            if (uploadedItems.length === uploadedMedia.length) {
              setReplacementId(void 0);
            }
            if (!uploadedItems.length) {
              return;
            }
            if (!multiple) {
              onChangeControl(uploadedItems[0]);
              return;
            }
            if (!value) {
              onChangeControl(uploadedItems);
              return;
            }
            const normalizedValue = Array.isArray(value) ? value : [value];
            const newIds = [
              ..._replacementId ? normalizedValue.filter(
                (id) => id !== _replacementId
              ) : normalizedValue,
              ...uploadedItems
            ];
            onChangeControl(newIds);
          },
          onError(error) {
            setReplacementId(void 0);
            setBlobs([]);
            createErrorNotice(error.message, { type: "snackbar" });
          },
          multiple: !!multiple
        });
      },
      [allowedTypes, value, multiple, createErrorNotice, onChangeControl]
    );
    const addButtonLabel = field.placeholder || (multiple ? (0, import_i18n13.__)("Choose files") : (0, import_i18n13.__)("Choose file"));
    const allItems = (0, import_element5.useMemo)(() => {
      if (!blobs.length) {
        return attachments;
      }
      const items = [
        ...attachments || []
      ];
      const blobItems = blobs.map((url) => ({
        id: url,
        source_url: url,
        mime_type: (0, import_blob.getBlobTypeByURL)(url)
      }));
      const replacementIndex = items.findIndex(
        (a3) => a3.id === replacementId
      );
      if (replacementIndex !== -1) {
        return [
          ...items.slice(0, replacementIndex),
          ...blobItems,
          ...items.slice(replacementIndex + 1)
        ];
      }
      items.push(...blobItems);
      return items;
    }, [attachments, replacementId, blobs]);
    return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("fieldset", { className: "fields__media-edit", "data-field-id": field.id, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
      ConditionalMediaUpload,
      {
        onSelect: (selectedMedia) => {
          if (multiple) {
            const newIds = Array.isArray(selectedMedia) ? selectedMedia.map((m2) => m2.id) : [selectedMedia.id];
            onChangeControl(newIds);
          } else {
            onChangeControl(selectedMedia.id);
          }
        },
        allowedTypes,
        value,
        multiple,
        title: field.label,
        render: ({ open }) => {
          const AttachmentsComponent = isExpanded ? ExpandedMediaEditAttachments : CompactMediaEditAttachments;
          return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_components5.__experimentalVStack, { spacing: 2, children: [
            field.label && (hideLabelFromVision ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components5.VisuallyHidden, { as: "legend", children: field.label }) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components5.BaseControl.VisualLabel, { as: "legend", children: field.label })),
            /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
              AttachmentsComponent,
              {
                allItems,
                addButtonLabel,
                multiple,
                removeItem,
                open,
                onFilesDrop,
                isUploading: !!blobs.length
              }
            ),
            field.description && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components5.__experimentalText, { variant: "muted", children: field.description })
          ] });
        }
      }
    ) });
  }

  // packages/fields/build-module/fields/featured-image/featured-image-view.mjs
  var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
  var FeaturedImageView = ({
    item,
    config
  }) => {
    const media = item?._embedded?.["wp:featuredmedia"]?.[0];
    const url = media?.source_url;
    if (url) {
      return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
        "img",
        {
          className: "fields-controls__featured-image-image",
          src: url,
          alt: "",
          srcSet: media?.media_details?.sizes ? Object.values(media.media_details.sizes).map(
            (size3) => `${size3.source_url} ${size3.width}w`
          ).join(", ") : void 0,
          sizes: config?.sizes || "100vw"
        }
      );
    }
    return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "fields-controls__featured-image-placeholder" });
  };

  // packages/fields/build-module/fields/featured-image/index.mjs
  var featuredImageField = {
    id: "featured_media",
    type: "media",
    label: (0, import_i18n14.__)("Featured Image"),
    Edit: MediaEdit,
    render: FeaturedImageView,
    setValue: ({ value }) => ({
      featured_media: value ?? 0
    }),
    enableSorting: false,
    filterBy: false
  };
  var featured_image_default = featuredImageField;

  // packages/fields/build-module/fields/template/index.mjs
  var import_i18n16 = __toESM(require_i18n(), 1);

  // packages/fields/build-module/fields/template/template-edit.mjs
  var import_element6 = __toESM(require_element(), 1);
  var import_blocks3 = __toESM(require_blocks(), 1);
  var import_core_data5 = __toESM(require_core_data(), 1);
  var import_block_editor4 = __toESM(require_block_editor(), 1);
  var import_components6 = __toESM(require_components(), 1);
  var import_compose2 = __toESM(require_compose(), 1);
  var import_data7 = __toESM(require_data(), 1);
  var import_html_entities2 = __toESM(require_html_entities(), 1);
  var import_i18n15 = __toESM(require_i18n(), 1);
  var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
  var EMPTY_ARRAY = [];
  var TemplateEdit = ({
    data,
    field,
    onChange
  }) => {
    const { id } = field;
    const postType2 = data.type;
    const postId2 = typeof data.id === "number" ? data.id : parseInt(data.id, 10);
    const slug = data.slug;
    const { canSwitchTemplate, templates } = (0, import_data7.useSelect)(
      (select5) => {
        const allTemplates = select5(import_core_data5.store).getEntityRecords(
          "postType",
          "wp_template",
          {
            per_page: -1,
            post_type: postType2
          }
        ) ?? EMPTY_ARRAY;
        const { getHomePage, getPostsPageId } = unlock2(
          select5(import_core_data5.store)
        );
        const isPostsPage = getPostsPageId() === +postId2;
        const isFrontPage = postType2 === "page" && getHomePage()?.postId === +postId2;
        const allowSwitchingTemplate = !isPostsPage && !isFrontPage;
        return {
          templates: allTemplates,
          canSwitchTemplate: allowSwitchingTemplate
        };
      },
      [postId2, postType2]
    );
    const templatesAsPatterns = (0, import_element6.useMemo)(() => {
      if (!canSwitchTemplate) {
        return [];
      }
      return templates.filter(
        (template2) => template2.is_custom && template2.slug !== data.template && // Skip empty templates.
        !!template2.content.raw
      ).map((template2) => ({
        name: template2.slug,
        blocks: (0, import_blocks3.parse)(template2.content.raw),
        title: (0, import_html_entities2.decodeEntities)(template2.title.rendered),
        id: template2.id
      }));
    }, [canSwitchTemplate, data.template, templates]);
    const shownTemplates = (0, import_compose2.useAsyncList)(templatesAsPatterns);
    const value = field.getValue({ item: data });
    const foundTemplate = templates.find(
      (template2) => template2.slug === value
    );
    const currentTemplate = (0, import_data7.useSelect)(
      (select5) => {
        if (foundTemplate) {
          return foundTemplate;
        }
        let slugToCheck;
        if (slug) {
          slugToCheck = postType2 === "page" ? `${postType2}-${slug}` : `single-${postType2}-${slug}`;
        } else {
          slugToCheck = postType2 === "page" ? "page" : `single-${postType2}`;
        }
        if (postType2) {
          const templateId2 = select5(import_core_data5.store).getDefaultTemplateId({
            slug: slugToCheck
          });
          return select5(import_core_data5.store).getEntityRecord(
            "postType",
            "wp_template",
            templateId2
          );
        }
      },
      [foundTemplate, postType2, slug]
    );
    const [showModal, setShowModal] = (0, import_element6.useState)(false);
    const onChangeControl = (0, import_element6.useCallback)(
      (newValue) => onChange({
        [id]: newValue
      }),
      [id, onChange]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("fieldset", { className: "fields-controls__template", children: [
      /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
        import_components6.Dropdown,
        {
          popoverProps: { placement: "bottom-start" },
          renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
            import_components6.Button,
            {
              __next40pxDefaultSize: true,
              variant: "tertiary",
              size: "compact",
              onClick: onToggle,
              children: currentTemplate ? getItemTitle(currentTemplate) : ""
            }
          ),
          renderContent: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_components6.MenuGroup, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
              import_components6.MenuItem,
              {
                onClick: () => {
                  setShowModal(true);
                  onToggle();
                },
                children: (0, import_i18n15.__)("Change template")
              }
            ),
            // The default template in a post is indicated by an empty string
            value !== "" && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
              import_components6.MenuItem,
              {
                onClick: () => {
                  onChangeControl("");
                  onToggle();
                },
                children: (0, import_i18n15.__)("Use default template")
              }
            )
          ] })
        }
      ),
      showModal && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
        import_components6.Modal,
        {
          title: (0, import_i18n15.__)("Choose a template"),
          onRequestClose: () => setShowModal(false),
          overlayClassName: "fields-controls__template-modal",
          isFullScreen: true,
          children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "fields-controls__template-content", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
            import_block_editor4.__experimentalBlockPatternsList,
            {
              label: (0, import_i18n15.__)("Templates"),
              blockPatterns: templatesAsPatterns,
              shownPatterns: shownTemplates,
              onClickPattern: (template2) => {
                onChangeControl(template2.name);
                setShowModal(false);
              }
            }
          ) })
        }
      )
    ] });
  };

  // packages/fields/build-module/fields/template/index.mjs
  var templateField = {
    id: "template",
    type: "text",
    label: (0, import_i18n16.__)("Template"),
    Edit: TemplateEdit,
    enableSorting: false,
    filterBy: false
  };
  var template_default = templateField;

  // packages/fields/build-module/fields/parent/index.mjs
  var import_i18n20 = __toESM(require_i18n(), 1);

  // packages/fields/build-module/fields/parent/parent-edit.mjs
  var import_remove_accents = __toESM(require_remove_accents(), 1);
  var import_components7 = __toESM(require_components(), 1);
  var import_data8 = __toESM(require_data(), 1);
  var import_element7 = __toESM(require_element(), 1);
  var import_core_data6 = __toESM(require_core_data(), 1);
  var import_compose3 = __toESM(require_compose(), 1);
  var import_html_entities4 = __toESM(require_html_entities(), 1);
  var import_i18n18 = __toESM(require_i18n(), 1);
  var import_url4 = __toESM(require_url(), 1);

  // packages/fields/build-module/fields/parent/utils.mjs
  var import_html_entities3 = __toESM(require_html_entities(), 1);
  var import_i18n17 = __toESM(require_i18n(), 1);
  function getTitleWithFallbackName(post2) {
    return typeof post2.title === "object" && "rendered" in post2.title && post2.title.rendered ? (0, import_html_entities3.decodeEntities)(post2.title.rendered) : `#${post2?.id} (${(0, import_i18n17.__)("no title")})`;
  }

  // packages/fields/build-module/fields/parent/parent-edit.mjs
  var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
  function buildTermsTree(flatTerms) {
    const flatTermsWithParentAndChildren = flatTerms.map((term) => {
      return {
        children: [],
        ...term
      };
    });
    if (flatTermsWithParentAndChildren.some(
      ({ parent }) => parent === null || parent === void 0
    )) {
      return flatTermsWithParentAndChildren;
    }
    const termsByParent = flatTermsWithParentAndChildren.reduce(
      (acc, term) => {
        const { parent } = term;
        if (!acc[parent]) {
          acc[parent] = [];
        }
        acc[parent].push(term);
        return acc;
      },
      {}
    );
    const fillWithChildren = (terms) => {
      return terms.map((term) => {
        const children = termsByParent[term.id];
        return {
          ...term,
          children: children && children.length ? fillWithChildren(children) : []
        };
      });
    };
    return fillWithChildren(termsByParent["0"] || []);
  }
  var getItemPriority = (name2, searchValue) => {
    const normalizedName = (0, import_remove_accents.default)(name2 || "").toLowerCase();
    const normalizedSearch = (0, import_remove_accents.default)(searchValue || "").toLowerCase();
    if (normalizedName === normalizedSearch) {
      return 0;
    }
    if (normalizedName.startsWith(normalizedSearch)) {
      return normalizedName.length;
    }
    return Infinity;
  };
  function PageAttributesParent({
    data,
    onChangeControl
  }) {
    const [fieldValue, setFieldValue] = (0, import_element7.useState)(null);
    const pageId = data.parent;
    const postId2 = data.id;
    const postTypeSlug = data.type;
    const { parentPostTitle, pageItems, isHierarchical } = (0, import_data8.useSelect)(
      (select5) => {
        const { getEntityRecord, getEntityRecords, getPostType } = select5(import_core_data6.store);
        const postTypeInfo = getPostType(postTypeSlug);
        const postIsHierarchical = postTypeInfo?.hierarchical && postTypeInfo.viewable;
        const parentPost = pageId ? getEntityRecord(
          "postType",
          postTypeSlug,
          pageId
        ) : null;
        const query = {
          per_page: 100,
          exclude: postId2,
          parent_exclude: postId2,
          orderby: "menu_order",
          order: "asc",
          _fields: "id,title,parent",
          ...fieldValue !== null && {
            // Perform a search by relevance when the field is changed.
            search: fieldValue,
            orderby: "relevance"
          }
        };
        return {
          isHierarchical: postIsHierarchical,
          parentPostTitle: parentPost ? getTitleWithFallbackName(parentPost) : "",
          pageItems: postIsHierarchical ? getEntityRecords(
            "postType",
            postTypeSlug,
            query
          ) : null
        };
      },
      [fieldValue, pageId, postId2, postTypeSlug]
    );
    const parentOptions = (0, import_element7.useMemo)(() => {
      const getOptionsFromTree = (tree2, level = 0) => {
        const mappedNodes = tree2.map((treeNode) => [
          {
            value: treeNode.id,
            label: "\u2014 ".repeat(level) + (0, import_html_entities4.decodeEntities)(treeNode.name),
            rawName: treeNode.name
          },
          ...getOptionsFromTree(treeNode.children || [], level + 1)
        ]);
        const sortedNodes = mappedNodes.sort(([a3], [b3]) => {
          const priorityA = getItemPriority(
            a3.rawName,
            fieldValue ?? ""
          );
          const priorityB = getItemPriority(
            b3.rawName,
            fieldValue ?? ""
          );
          return priorityA >= priorityB ? 1 : -1;
        });
        return sortedNodes.flat();
      };
      if (!pageItems) {
        return [];
      }
      let tree = pageItems.map((item) => ({
        id: item.id,
        parent: item.parent ?? null,
        name: getTitleWithFallbackName(item)
      }));
      if (!fieldValue) {
        tree = buildTermsTree(tree);
      }
      const opts = getOptionsFromTree(tree);
      const optsHasParent = opts.find((item) => item.value === pageId);
      if (pageId && parentPostTitle && !optsHasParent) {
        opts.unshift({
          value: pageId,
          label: parentPostTitle,
          rawName: ""
        });
      }
      return opts.map((option) => ({
        ...option,
        value: option.value.toString()
      }));
    }, [pageItems, fieldValue, parentPostTitle, pageId]);
    if (!isHierarchical) {
      return null;
    }
    const handleKeydown = (inputValue) => {
      setFieldValue(inputValue);
    };
    const handleChange = (selectedPostId) => {
      if (selectedPostId) {
        return onChangeControl(parseInt(selectedPostId, 10) ?? 0);
      }
      onChangeControl(0);
    };
    return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
      import_components7.ComboboxControl,
      {
        __next40pxDefaultSize: true,
        label: (0, import_i18n18.__)("Parent"),
        help: (0, import_i18n18.__)("Choose a parent page."),
        value: pageId?.toString(),
        options: parentOptions,
        onFilterValueChange: (0, import_compose3.debounce)(
          (value) => handleKeydown(value),
          300
        ),
        onChange: handleChange,
        hideLabelFromVision: true
      }
    );
  }
  var ParentEdit = ({
    data,
    field,
    onChange
  }) => {
    const { id } = field;
    const homeUrl = (0, import_data8.useSelect)((select5) => {
      return select5(import_core_data6.store).getEntityRecord("root", "__unstableBase")?.home;
    }, []);
    const onChangeControl = (0, import_element7.useCallback)(
      (newValue) => onChange({
        [id]: newValue
      }),
      [id, onChange]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("fieldset", { className: "fields-controls__parent", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { children: [
      (0, import_element7.createInterpolateElement)(
        (0, import_i18n18.sprintf)(
          /* translators: %1$s The home URL of the WordPress installation without the scheme. */
          (0, import_i18n18.__)(
            'Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %1$s<wbr />/services<wbr />/pricing.'
          ),
          (0, import_url4.filterURLForDisplay)(homeUrl).replace(
            /([/.])/g,
            "<wbr />$1"
          )
        ),
        {
          wbr: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("wbr", {})
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("p", { children: (0, import_element7.createInterpolateElement)(
        (0, import_i18n18.__)(
          "They also show up as sub-items in the default navigation menu. <a>Learn more.</a>"
        ),
        {
          a: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
            import_components7.ExternalLink,
            {
              href: (0, import_i18n18.__)(
                "https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes"
              ),
              children: void 0
            }
          )
        }
      ) }),
      /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
        PageAttributesParent,
        {
          data,
          onChangeControl
        }
      )
    ] }) });
  };

  // packages/fields/build-module/fields/parent/parent-view.mjs
  var import_data9 = __toESM(require_data(), 1);
  var import_core_data7 = __toESM(require_core_data(), 1);
  var import_i18n19 = __toESM(require_i18n(), 1);
  var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1);
  var ParentView = ({
    item
  }) => {
    const parent = (0, import_data9.useSelect)(
      (select5) => {
        const { getEntityRecord } = select5(import_core_data7.store);
        return item?.parent ? getEntityRecord("postType", item.type, item.parent) : null;
      },
      [item.parent, item.type]
    );
    if (parent) {
      return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_jsx_runtime78.Fragment, { children: getTitleWithFallbackName(parent) });
    }
    return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_jsx_runtime78.Fragment, { children: (0, import_i18n19.__)("None") });
  };

  // packages/fields/build-module/fields/parent/index.mjs
  var parentField = {
    id: "parent",
    type: "text",
    label: (0, import_i18n20.__)("Parent"),
    Edit: ParentEdit,
    render: ParentView,
    enableSorting: true,
    filterBy: false
  };
  var parent_default = parentField;

  // packages/fields/build-module/fields/password/index.mjs
  var import_i18n22 = __toESM(require_i18n(), 1);

  // packages/fields/build-module/fields/password/edit.mjs
  var import_components8 = __toESM(require_components(), 1);
  var import_element8 = __toESM(require_element(), 1);
  var import_i18n21 = __toESM(require_i18n(), 1);
  var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
  function PasswordEdit({
    data,
    onChange,
    field
  }) {
    const [showPassword, setShowPassword] = (0, import_element8.useState)(
      !!field.getValue({ item: data })
    );
    const handleTogglePassword = (value) => {
      setShowPassword(value);
      if (!value) {
        onChange({ password: "" });
      }
    };
    return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
      import_components8.__experimentalVStack,
      {
        as: "fieldset",
        spacing: 4,
        className: "fields-controls__password",
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
            import_components8.CheckboxControl,
            {
              label: (0, import_i18n21.__)("Password protected"),
              help: (0, import_i18n21.__)("Only visible to those who know the password"),
              checked: showPassword,
              onChange: handleTogglePassword
            }
          ),
          showPassword && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "fields-controls__password-input", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
            import_components8.TextControl,
            {
              label: (0, import_i18n21.__)("Password"),
              onChange: (value) => onChange({
                password: value
              }),
              value: field.getValue({ item: data }) || "",
              placeholder: (0, import_i18n21.__)("Use a secure password"),
              type: "text",
              __next40pxDefaultSize: true,
              maxLength: 255
            }
          ) })
        ]
      }
    );
  }
  var edit_default = PasswordEdit;

  // packages/fields/build-module/fields/password/index.mjs
  var passwordField = {
    id: "password",
    type: "text",
    label: (0, import_i18n22.__)("Password"),
    Edit: edit_default,
    enableSorting: false,
    enableHiding: false,
    isVisible: (item) => item.status !== "private",
    filterBy: false
  };
  var password_default = passwordField;

  // packages/fields/build-module/fields/status/index.mjs
  var import_i18n24 = __toESM(require_i18n(), 1);

  // packages/fields/build-module/fields/status/status-view.mjs
  var import_components9 = __toESM(require_components(), 1);

  // packages/fields/build-module/fields/status/status-elements.mjs
  var import_i18n23 = __toESM(require_i18n(), 1);
  var STATUSES = [
    {
      value: "draft",
      label: (0, import_i18n23.__)("Draft"),
      icon: drafts_default,
      description: (0, import_i18n23.__)("Not ready to publish.")
    },
    {
      value: "future",
      label: (0, import_i18n23.__)("Scheduled"),
      icon: scheduled_default,
      description: (0, import_i18n23.__)("Publish automatically on a chosen date.")
    },
    {
      value: "pending",
      label: (0, import_i18n23.__)("Pending Review"),
      icon: pending_default,
      description: (0, import_i18n23.__)("Waiting for review before publishing.")
    },
    {
      value: "private",
      label: (0, import_i18n23.__)("Private"),
      icon: not_allowed_default,
      description: (0, import_i18n23.__)("Only visible to site admins and editors.")
    },
    {
      value: "publish",
      label: (0, import_i18n23.__)("Published"),
      icon: published_default,
      description: (0, import_i18n23.__)("Visible to everyone.")
    },
    { value: "trash", label: (0, import_i18n23.__)("Trash"), icon: trash_default }
  ];
  var status_elements_default = STATUSES;

  // packages/fields/build-module/fields/status/status-view.mjs
  var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1);
  function StatusView({ item }) {
    const status = status_elements_default.find(({ value }) => value === item.status);
    const label = status?.label || item.status;
    const icon = status?.icon;
    return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_components9.__experimentalHStack, { alignment: "left", spacing: 0, children: [
      icon && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "edit-site-post-list__status-icon", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components9.Icon, { icon }) }),
      /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { children: label })
    ] });
  }
  var status_view_default = StatusView;

  // packages/fields/build-module/fields/status/index.mjs
  var OPERATOR_IS_ANY = "isAny";
  var statusField = {
    label: (0, import_i18n24.__)("Status"),
    id: "status",
    type: "text",
    elements: status_elements_default,
    render: status_view_default,
    Edit: "radio",
    enableSorting: false,
    filterBy: {
      operators: [OPERATOR_IS_ANY]
    }
  };
  var status_default = statusField;

  // packages/fields/build-module/fields/comment-status/index.mjs
  var import_i18n25 = __toESM(require_i18n(), 1);
  var commentStatusField = {
    id: "comment_status",
    label: (0, import_i18n25.__)("Comments"),
    type: "text",
    Edit: "radio",
    enableSorting: false,
    enableHiding: false,
    filterBy: false,
    elements: [
      {
        value: "open",
        label: (0, import_i18n25.__)("Open"),
        description: (0, import_i18n25.__)("Visitors can add new comments and replies.")
      },
      {
        value: "closed",
        label: (0, import_i18n25.__)("Closed"),
        description: (0, import_i18n25.__)(
          "Visitors cannot add new comments or replies. Existing comments remain visible."
        )
      }
    ]
  };
  var comment_status_default = commentStatusField;

  // packages/fields/build-module/fields/ping-status/index.mjs
  var import_i18n26 = __toESM(require_i18n(), 1);
  var import_components10 = __toESM(require_components(), 1);
  var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1);
  function PingStatusEdit({
    data,
    onChange
  }) {
    const pingStatus = data?.ping_status ?? "open";
    const onTogglePingback = (checked) => {
      onChange({
        ...data,
        ping_status: checked ? "open" : "closed"
      });
    };
    return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
      import_components10.CheckboxControl,
      {
        label: (0, import_i18n26.__)("Enable pingbacks & trackbacks"),
        checked: pingStatus === "open",
        onChange: onTogglePingback,
        help: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
          import_components10.ExternalLink,
          {
            href: (0, import_i18n26.__)(
              "https://wordpress.org/documentation/article/trackbacks-and-pingbacks/"
            ),
            children: (0, import_i18n26.__)("Learn more about pingbacks & trackbacks")
          }
        )
      }
    );
  }
  var pingStatusField = {
    id: "ping_status",
    label: (0, import_i18n26.__)("Trackbacks & Pingbacks"),
    type: "text",
    Edit: PingStatusEdit,
    enableSorting: false,
    enableHiding: false,
    filterBy: false,
    elements: [
      {
        value: "open",
        label: (0, import_i18n26.__)("Allow"),
        description: (0, import_i18n26.__)(
          "Allow link notifications from other blogs (pingbacks and trackbacks) on new articles."
        )
      },
      {
        value: "closed",
        label: (0, import_i18n26.__)("Don't allow"),
        description: (0, import_i18n26.__)(
          "Don't allow link notifications from other blogs (pingbacks and trackbacks) on new articles."
        )
      }
    ]
  };
  var ping_status_default = pingStatusField;

  // packages/fields/build-module/fields/discussion/index.mjs
  var import_i18n27 = __toESM(require_i18n(), 1);
  var discussionField = {
    id: "discussion",
    label: (0, import_i18n27.__)("Discussion"),
    type: "text",
    render: ({ item }) => {
      const commentsOpen = item.comment_status === "open";
      const pingsOpen = item.ping_status === "open";
      if (commentsOpen && pingsOpen) {
        return (0, import_i18n27.__)("Open");
      }
      if (commentsOpen && !pingsOpen) {
        return (0, import_i18n27.__)("Comments only");
      }
      if (!commentsOpen && pingsOpen) {
        return (0, import_i18n27.__)("Pings only");
      }
      return (0, import_i18n27.__)("Closed");
    },
    filterBy: false
  };
  var discussion_default = discussionField;

  // packages/fields/build-module/fields/date/index.mjs
  var import_i18n29 = __toESM(require_i18n(), 1);

  // packages/fields/build-module/fields/date/date-view.mjs
  var import_i18n28 = __toESM(require_i18n(), 1);
  var import_element9 = __toESM(require_element(), 1);
  var import_date2 = __toESM(require_date(), 1);
  var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1);
  var getFormattedDate = (dateToDisplay) => (0, import_date2.dateI18n)(
    (0, import_date2.getSettings)().formats.datetimeAbbreviated,
    (0, import_date2.getDate)(dateToDisplay)
  );
  var DateView = ({ item }) => {
    const isDraftOrPrivate = ["draft", "private"].includes(
      item.status ?? ""
    );
    if (isDraftOrPrivate) {
      return (0, import_element9.createInterpolateElement)(
        (0, import_i18n28.sprintf)(
          /* translators: %s: page creation or modification date. */
          (0, import_i18n28.__)("<span>Modified: <time>%s</time></span>"),
          getFormattedDate(item.date ?? null)
        ),
        {
          span: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", {}),
          time: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("time", {})
        }
      );
    }
    const isScheduled = item.status === "future";
    if (isScheduled) {
      return (0, import_element9.createInterpolateElement)(
        (0, import_i18n28.sprintf)(
          /* translators: %s: page creation date */
          (0, import_i18n28.__)("<span>Scheduled: <time>%s</time></span>"),
          getFormattedDate(item.date ?? null)
        ),
        {
          span: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", {}),
          time: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("time", {})
        }
      );
    }
    const isPublished = item.status === "publish";
    if (isPublished) {
      return (0, import_element9.createInterpolateElement)(
        (0, import_i18n28.sprintf)(
          /* translators: %s: page creation time */
          (0, import_i18n28.__)("<span>Published: <time>%s</time></span>"),
          getFormattedDate(item.date ?? null)
        ),
        {
          span: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", {}),
          time: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("time", {})
        }
      );
    }
    const dateToDisplay = (0, import_date2.getDate)(item.modified ?? null) > (0, import_date2.getDate)(item.date ?? null) ? item.modified : item.date;
    const isPending = item.status === "pending";
    if (isPending) {
      return (0, import_element9.createInterpolateElement)(
        (0, import_i18n28.sprintf)(
          /* translators: %s: page creation or modification date. */
          (0, import_i18n28.__)("<span>Modified: <time>%s</time></span>"),
          getFormattedDate(dateToDisplay ?? null)
        ),
        {
          span: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", {}),
          time: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("time", {})
        }
      );
    }
    return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("time", { children: getFormattedDate(item.date ?? null) });
  };
  var date_view_default = DateView;

  // packages/fields/build-module/fields/date/index.mjs
  var dateField = {
    id: "date",
    type: "datetime",
    label: (0, import_i18n29.__)("Date"),
    render: date_view_default,
    filterBy: {
      operators: ["before", "after"]
    }
  };
  var date_default = dateField;

  // packages/fields/build-module/fields/author/index.mjs
  var import_i18n31 = __toESM(require_i18n(), 1);
  var import_data11 = __toESM(require_data(), 1);
  var import_core_data9 = __toESM(require_core_data(), 1);

  // packages/fields/build-module/fields/author/author-view.mjs
  var import_i18n30 = __toESM(require_i18n(), 1);
  var import_element10 = __toESM(require_element(), 1);
  var import_components11 = __toESM(require_components(), 1);
  var import_data10 = __toESM(require_data(), 1);
  var import_core_data8 = __toESM(require_core_data(), 1);
  var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1);
  function AuthorView({ item }) {
    const authorId = item?.author;
    const embeddedAuthorId = item?._embedded?.author?.[0]?.id;
    const shouldFetch = Boolean(
      authorId && embeddedAuthorId && authorId !== embeddedAuthorId
    );
    const author = (0, import_data10.useSelect)(
      (select5) => {
        if (!shouldFetch) {
          return null;
        }
        const { getEntityRecord } = select5(import_core_data8.store);
        return authorId ? getEntityRecord("root", "user", authorId) : null;
      },
      [authorId, shouldFetch]
    );
    const text = author?.name || item?._embedded?.author?.[0]?.name;
    const imageUrl = author?.avatar_urls?.[48] || item?._embedded?.author?.[0]?.avatar_urls?.[48];
    const [isImageLoaded, setIsImageLoaded] = (0, import_element10.useState)(false);
    return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_components11.__experimentalHStack, { alignment: "left", spacing: 0, children: [
      !!imageUrl && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
        "div",
        {
          className: clsx_default("page-templates-author-field__avatar", {
            "is-loaded": isImageLoaded
          }),
          children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
            "img",
            {
              onLoad: () => setIsImageLoaded(true),
              alt: (0, import_i18n30.__)("Author avatar"),
              src: imageUrl
            }
          )
        }
      ),
      !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_components11.Icon, { icon: comment_author_avatar_default }) }),
      /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "page-templates-author-field__name", children: text })
    ] });
  }
  var author_view_default = AuthorView;

  // packages/fields/build-module/fields/author/index.mjs
  var authorField = {
    label: (0, import_i18n31.__)("Author"),
    id: "author",
    type: "integer",
    getElements: async () => {
      const authors = await (0, import_data11.resolveSelect)(import_core_data9.store).getEntityRecords(
        "root",
        "user",
        {
          per_page: -1
        }
      ) ?? [];
      return authors.map(({ id, name: name2 }) => ({
        value: id,
        label: name2
      }));
    },
    setValue: ({ value }) => ({ author: Number(value) }),
    render: author_view_default,
    sort: (a3, b3, direction) => {
      const nameA = a3._embedded?.author?.[0]?.name || "";
      const nameB = b3._embedded?.author?.[0]?.name || "";
      return direction === "asc" ? nameA.localeCompare(nameB) : nameB.localeCompare(nameA);
    },
    filterBy: {
      operators: ["isAny", "isNone"]
    }
  };
  var author_default = authorField;

  // packages/fields/build-module/fields/notes/index.mjs
  var import_i18n32 = __toESM(require_i18n(), 1);
  var notesField = {
    id: "notesCount",
    label: (0, import_i18n32.__)("Notes"),
    type: "integer",
    enableSorting: false,
    filterBy: false
  };
  var notes_default = notesField;

  // packages/fields/build-module/actions/view-post.mjs
  var import_i18n33 = __toESM(require_i18n(), 1);
  var viewPost = {
    id: "view-post",
    label: (0, import_i18n33._x)("View", "verb"),
    isPrimary: true,
    icon: external_default,
    isEligible(post2) {
      return post2.status !== "trash";
    },
    callback(posts, { onActionPerformed }) {
      const post2 = posts[0];
      window.open(post2?.link, "_blank");
      if (onActionPerformed) {
        onActionPerformed(posts);
      }
    }
  };
  var view_post_default = viewPost;

  // packages/fields/build-module/actions/reorder-page.mjs
  var import_data12 = __toESM(require_data(), 1);
  var import_core_data10 = __toESM(require_core_data(), 1);
  var import_i18n34 = __toESM(require_i18n(), 1);
  var import_notices4 = __toESM(require_notices(), 1);
  var import_element11 = __toESM(require_element(), 1);
  var import_components12 = __toESM(require_components(), 1);
  var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1);
  function isItemValid(item) {
    return typeof item.menu_order === "number" && Number.isInteger(item.menu_order);
  }
  function ReorderModal({
    items,
    closeModal: closeModal2,
    onActionPerformed
  }) {
    const [item, setItem] = (0, import_element11.useState)(items[0]);
    const { editEntityRecord, saveEditedEntityRecord } = (0, import_data12.useDispatch)(import_core_data10.store);
    const { createSuccessNotice, createErrorNotice } = (0, import_data12.useDispatch)(import_notices4.store);
    const isValid = isItemValid(item);
    async function onOrder(event) {
      event.preventDefault();
      if (!isValid) {
        return;
      }
      try {
        await editEntityRecord("postType", item.type, item.id, {
          menu_order: item.menu_order
        });
        closeModal2?.();
        await saveEditedEntityRecord("postType", item.type, item.id, {
          throwOnError: true
        });
        createSuccessNotice((0, import_i18n34.__)("Order updated."), {
          type: "snackbar"
        });
        onActionPerformed?.(items);
      } catch (error) {
        const typedError = error;
        const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : (0, import_i18n34.__)("An error occurred while updating the order");
        createErrorNotice(errorMessage, {
          type: "snackbar"
        });
      }
    }
    return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("form", { onSubmit: onOrder, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(import_components12.__experimentalVStack, { spacing: "5", children: [
      /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { children: (0, import_i18n34.__)(
        "Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported."
      ) }),
      /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
        import_components12.__experimentalInputControl,
        {
          __next40pxDefaultSize: true,
          label: (0, import_i18n34.__)("Order"),
          type: "number",
          value: typeof item.menu_order === "number" && Number.isInteger(item.menu_order) ? String(item.menu_order) : "",
          onChange: (value) => {
            const parsed = parseInt(value, 10);
            setItem({
              ...item,
              menu_order: isNaN(parsed) ? void 0 : parsed
            });
          }
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(import_components12.__experimentalHStack, { justify: "right", children: [
        /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
          import_components12.Button,
          {
            __next40pxDefaultSize: true,
            variant: "tertiary",
            onClick: () => {
              closeModal2?.();
            },
            children: (0, import_i18n34.__)("Cancel")
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
          import_components12.Button,
          {
            __next40pxDefaultSize: true,
            variant: "primary",
            type: "submit",
            accessibleWhenDisabled: true,
            disabled: !isValid,
            children: (0, import_i18n34.__)("Save")
          }
        )
      ] })
    ] }) });
  }
  var reorderPage = {
    id: "order-pages",
    label: (0, import_i18n34.__)("Order"),
    isEligible({ status }) {
      return status !== "trash";
    },
    modalFocusOnMount: "firstContentElement",
    RenderModal: ReorderModal
  };
  var reorder_page_default = reorderPage;

  // packages/fields/build-module/actions/duplicate-post.mjs
  var import_data13 = __toESM(require_data(), 1);
  var import_core_data11 = __toESM(require_core_data(), 1);
  var import_i18n35 = __toESM(require_i18n(), 1);
  var import_notices5 = __toESM(require_notices(), 1);
  var import_element12 = __toESM(require_element(), 1);
  var import_components13 = __toESM(require_components(), 1);
  var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1);
  var duplicatePost = {
    id: "duplicate-post",
    label: (0, import_i18n35._x)("Duplicate", "action label"),
    isEligible({ status }) {
      return status !== "trash";
    },
    modalFocusOnMount: "firstContentElement",
    RenderModal: ({ items, closeModal: closeModal2, onActionPerformed }) => {
      const [item, setItem] = (0, import_element12.useState)({
        ...items[0],
        title: (0, import_i18n35.sprintf)(
          /* translators: %s: Existing post title */
          (0, import_i18n35._x)("%s (Copy)", "post"),
          getItemTitle(items[0])
        )
      });
      const [isCreatingPage, setIsCreatingPage] = (0, import_element12.useState)(false);
      const { saveEntityRecord } = (0, import_data13.useDispatch)(import_core_data11.store);
      const { createSuccessNotice, createErrorNotice } = (0, import_data13.useDispatch)(import_notices5.store);
      async function createPage(event) {
        event.preventDefault();
        if (isCreatingPage) {
          return;
        }
        const isTemplate2 = item.type === "wp_template";
        const newItemObject = {
          status: isTemplate2 ? "publish" : "draft",
          title: item.title,
          slug: isTemplate2 ? item.slug : item.title || (0, import_i18n35.__)("No title"),
          comment_status: item.comment_status,
          content: typeof item.content === "string" ? item.content : item.content.raw,
          excerpt: typeof item.excerpt === "string" ? item.excerpt : item.excerpt?.raw,
          meta: item.meta,
          parent: item.parent,
          password: item.password,
          template: item.template,
          format: item.format,
          featured_media: item.featured_media,
          menu_order: item.menu_order,
          ping_status: item.ping_status
        };
        const assignablePropertiesPrefix = "wp:action-assign-";
        const assignableProperties = Object.keys(item?._links || {}).filter(
          (property) => property.startsWith(assignablePropertiesPrefix)
        ).map(
          (property) => property.slice(assignablePropertiesPrefix.length)
        );
        assignableProperties.forEach((property) => {
          if (item.hasOwnProperty(property)) {
            newItemObject[property] = item[property];
          }
        });
        setIsCreatingPage(true);
        try {
          const newItem = await saveEntityRecord(
            "postType",
            item.type,
            newItemObject,
            { throwOnError: true }
          );
          createSuccessNotice(
            (0, import_i18n35.sprintf)(
              // translators: %s: Title of the created post, e.g: "Hello world".
              (0, import_i18n35.__)('"%s" successfully created.'),
              getItemTitle(newItem)
            ),
            {
              id: "duplicate-post-action",
              type: "snackbar"
            }
          );
          if (onActionPerformed) {
            onActionPerformed([newItem]);
          }
        } catch (error) {
          const typedError = error;
          const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : (0, import_i18n35.__)("An error occurred while duplicating the page.");
          createErrorNotice(errorMessage, {
            type: "snackbar"
          });
        } finally {
          setIsCreatingPage(false);
          closeModal2?.();
        }
      }
      return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("form", { onSubmit: createPage, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_components13.__experimentalVStack, { spacing: 3, children: [
        typeof item.id === "string" && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { children: (0, import_i18n35.__)(
          "You are about to duplicate a bundled template. Changes will not be live until you activate the new template."
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
          import_components13.__experimentalInputControl,
          {
            __next40pxDefaultSize: true,
            label: (0, import_i18n35.__)("Title"),
            placeholder: (0, import_i18n35.__)("No title"),
            value: getItemTitle(item),
            onChange: (value) => setItem((prev) => ({
              ...prev,
              title: value || (0, import_i18n35.__)("No title")
            }))
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_components13.__experimentalHStack, { spacing: 2, justify: "end", children: [
          /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
            import_components13.Button,
            {
              variant: "tertiary",
              onClick: closeModal2,
              __next40pxDefaultSize: true,
              children: (0, import_i18n35.__)("Cancel")
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
            import_components13.Button,
            {
              variant: "primary",
              type: "submit",
              isBusy: isCreatingPage,
              "aria-disabled": isCreatingPage,
              __next40pxDefaultSize: true,
              children: (0, import_i18n35._x)("Duplicate", "action label")
            }
          )
        ] })
      ] }) });
    }
  };
  var duplicate_post_default = duplicatePost;

  // packages/fields/build-module/actions/rename-post.mjs
  var import_data14 = __toESM(require_data(), 1);
  var import_core_data12 = __toESM(require_core_data(), 1);
  var import_i18n36 = __toESM(require_i18n(), 1);
  var import_element13 = __toESM(require_element(), 1);
  var import_patterns2 = __toESM(require_patterns(), 1);
  var import_components14 = __toESM(require_components(), 1);
  var import_notices6 = __toESM(require_notices(), 1);
  var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1);
  var { PATTERN_TYPES: PATTERN_TYPES2 } = unlock2(import_patterns2.privateApis);
  var renamePost = {
    id: "rename-post",
    label: (0, import_i18n36.__)("Rename"),
    modalFocusOnMount: "firstContentElement",
    isEligible(post2) {
      if (post2.status === "trash") {
        return false;
      }
      if (post2.type === "wp_template" && typeof post2.id === "string" && window?.__experimentalTemplateActivate) {
        return false;
      }
      const specialChecks = ["wp_template", "wp_template_part"];
      if (!window?.__experimentalTemplateActivate) {
        specialChecks.push("wp_template");
      }
      if (!specialChecks.includes(post2.type)) {
        return post2.permissions?.update;
      }
      if (isTemplate(post2) && !window?.__experimentalTemplateActivate) {
        return isTemplateRemovable(post2) && post2.is_custom && post2.permissions?.update;
      }
      if (isTemplatePart(post2)) {
        return post2.source === "custom" && !post2?.has_theme_file && post2.permissions?.update;
      }
      return post2.type === PATTERN_TYPES2.user && post2.permissions?.update;
    },
    RenderModal: ({ items, closeModal: closeModal2, onActionPerformed }) => {
      const [item] = items;
      const [title, setTitle] = (0, import_element13.useState)(() => getItemTitle(item, ""));
      const { editEntityRecord, saveEditedEntityRecord } = (0, import_data14.useDispatch)(import_core_data12.store);
      const { createSuccessNotice, createErrorNotice } = (0, import_data14.useDispatch)(import_notices6.store);
      async function onRename(event) {
        event.preventDefault();
        try {
          await editEntityRecord("postType", item.type, item.id, {
            title
          });
          setTitle("");
          closeModal2?.();
          await saveEditedEntityRecord("postType", item.type, item.id, {
            throwOnError: true
          });
          createSuccessNotice((0, import_i18n36.__)("Name updated"), {
            type: "snackbar"
          });
          onActionPerformed?.(items);
        } catch (error) {
          const typedError = error;
          const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : (0, import_i18n36.__)("An error occurred while updating the name");
          createErrorNotice(errorMessage, { type: "snackbar" });
        }
      }
      return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("form", { onSubmit: onRename, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_components14.__experimentalVStack, { spacing: "5", children: [
        /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
          import_components14.TextControl,
          {
            __next40pxDefaultSize: true,
            label: (0, import_i18n36.__)("Name"),
            value: title,
            onChange: setTitle,
            required: true
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_components14.__experimentalHStack, { justify: "right", children: [
          /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
            import_components14.Button,
            {
              __next40pxDefaultSize: true,
              variant: "tertiary",
              onClick: () => {
                closeModal2?.();
              },
              children: (0, import_i18n36.__)("Cancel")
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
            import_components14.Button,
            {
              __next40pxDefaultSize: true,
              variant: "primary",
              type: "submit",
              children: (0, import_i18n36.__)("Save")
            }
          )
        ] })
      ] }) });
    }
  };
  var rename_post_default = renamePost;

  // packages/fields/build-module/actions/reset-post.mjs
  var import_data15 = __toESM(require_data(), 1);
  var import_core_data13 = __toESM(require_core_data(), 1);
  var import_i18n37 = __toESM(require_i18n(), 1);
  var import_notices7 = __toESM(require_notices(), 1);
  var import_element14 = __toESM(require_element(), 1);
  var import_blocks4 = __toESM(require_blocks(), 1);
  var import_components15 = __toESM(require_components(), 1);
  var import_url5 = __toESM(require_url(), 1);
  var import_api_fetch2 = __toESM(require_api_fetch(), 1);
  var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1);
  var isTemplateRevertable2 = (templateOrTemplatePart) => {
    if (!templateOrTemplatePart) {
      return false;
    }
    return templateOrTemplatePart.source === "custom" && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file);
  };
  var revertTemplate = async (template2, { allowUndo = true } = {}) => {
    const noticeId = "edit-site-template-reverted";
    (0, import_data15.dispatch)(import_notices7.store).removeNotice(noticeId);
    if (!isTemplateRevertable2(template2)) {
      (0, import_data15.dispatch)(import_notices7.store).createErrorNotice(
        (0, import_i18n37.__)("This template is not revertable."),
        {
          type: "snackbar"
        }
      );
      return;
    }
    try {
      const templateEntityConfig = (0, import_data15.select)(import_core_data13.store).getEntityConfig(
        "postType",
        template2.type
      );
      if (!templateEntityConfig) {
        (0, import_data15.dispatch)(import_notices7.store).createErrorNotice(
          (0, import_i18n37.__)(
            "The editor has encountered an unexpected error. Please reload."
          ),
          { type: "snackbar" }
        );
        return;
      }
      const fileTemplatePath = (0, import_url5.addQueryArgs)(
        `${templateEntityConfig.baseURL}/${template2.id}`,
        { context: "edit", source: template2.origin }
      );
      const fileTemplate = await (0, import_api_fetch2.default)({
        path: fileTemplatePath
      });
      if (!fileTemplate) {
        (0, import_data15.dispatch)(import_notices7.store).createErrorNotice(
          (0, import_i18n37.__)(
            "The editor has encountered an unexpected error. Please reload."
          ),
          { type: "snackbar" }
        );
        return;
      }
      const serializeBlocks = ({ blocks: blocksForSerialization = [] }) => (0, import_blocks4.__unstableSerializeAndClean)(blocksForSerialization);
      const edited = (0, import_data15.select)(import_core_data13.store).getEditedEntityRecord(
        "postType",
        template2.type,
        template2.id
      );
      (0, import_data15.dispatch)(import_core_data13.store).editEntityRecord(
        "postType",
        template2.type,
        template2.id,
        {
          content: serializeBlocks,
          // Required to make the `undo` behave correctly.
          blocks: edited.blocks,
          // Required to revert the blocks in the editor.
          source: "custom"
          // required to avoid turning the editor into a dirty state
        },
        {
          undoIgnore: true
          // Required to merge this edit with the last undo level.
        }
      );
      const blocks = (0, import_blocks4.parse)(fileTemplate?.content?.raw);
      (0, import_data15.dispatch)(import_core_data13.store).editEntityRecord(
        "postType",
        template2.type,
        fileTemplate.id,
        {
          content: serializeBlocks,
          blocks,
          source: "theme"
        }
      );
      if (allowUndo) {
        const undoRevert = () => {
          (0, import_data15.dispatch)(import_core_data13.store).editEntityRecord(
            "postType",
            template2.type,
            edited.id,
            {
              content: serializeBlocks,
              blocks: edited.blocks,
              source: "custom"
            }
          );
        };
        (0, import_data15.dispatch)(import_notices7.store).createSuccessNotice(
          (0, import_i18n37.__)("Template reset."),
          {
            type: "snackbar",
            id: noticeId,
            actions: [
              {
                label: (0, import_i18n37.__)("Undo"),
                onClick: undoRevert
              }
            ]
          }
        );
      }
    } catch (error) {
      const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n37.__)("Template revert failed. Please reload.");
      (0, import_data15.dispatch)(import_notices7.store).createErrorNotice(errorMessage, {
        type: "snackbar"
      });
    }
  };
  var resetPostAction = {
    id: "reset-post",
    label: (0, import_i18n37.__)("Reset"),
    isEligible: (item) => {
      if (window?.__experimentalTemplateActivate) {
        return item.type === "wp_template_part" && item?.source === "custom" && item?.has_theme_file;
      }
      return isTemplateOrTemplatePart(item) && item?.source === "custom" && (Boolean(item.type === "wp_template" && item?.plugin) || item?.has_theme_file);
    },
    icon: backup_default,
    supportsBulk: true,
    hideModalHeader: true,
    modalFocusOnMount: "firstContentElement",
    RenderModal: ({ items, closeModal: closeModal2, onActionPerformed }) => {
      const [isBusy, setIsBusy] = (0, import_element14.useState)(false);
      const { saveEditedEntityRecord } = (0, import_data15.useDispatch)(import_core_data13.store);
      const { createSuccessNotice, createErrorNotice } = (0, import_data15.useDispatch)(import_notices7.store);
      const onConfirm = async () => {
        try {
          for (const template2 of items) {
            await revertTemplate(template2, {
              allowUndo: false
            });
            await saveEditedEntityRecord(
              "postType",
              template2.type,
              template2.id
            );
          }
          createSuccessNotice(
            items.length > 1 ? (0, import_i18n37.sprintf)(
              /* translators: %d: The number of items. */
              (0, import_i18n37.__)("%d items reset."),
              items.length
            ) : (0, import_i18n37.sprintf)(
              /* translators: %s: The template/part's name. */
              (0, import_i18n37.__)('"%s" reset.'),
              getItemTitle(items[0])
            ),
            {
              type: "snackbar",
              id: "revert-template-action"
            }
          );
        } catch (error) {
          let fallbackErrorMessage;
          if (items[0].type === "wp_template") {
            fallbackErrorMessage = items.length === 1 ? (0, import_i18n37.__)(
              "An error occurred while reverting the template."
            ) : (0, import_i18n37.__)(
              "An error occurred while reverting the templates."
            );
          } else {
            fallbackErrorMessage = items.length === 1 ? (0, import_i18n37.__)(
              "An error occurred while reverting the template part."
            ) : (0, import_i18n37.__)(
              "An error occurred while reverting the template parts."
            );
          }
          const typedError = error;
          const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : fallbackErrorMessage;
          createErrorNotice(errorMessage, { type: "snackbar" });
        }
      };
      return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_components15.__experimentalVStack, { spacing: "5", children: [
        /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_components15.__experimentalText, { children: (0, import_i18n37.__)("Reset to default and clear all customizations?") }),
        /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_components15.__experimentalHStack, { justify: "right", children: [
          /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
            import_components15.Button,
            {
              __next40pxDefaultSize: true,
              variant: "tertiary",
              onClick: closeModal2,
              disabled: isBusy,
              accessibleWhenDisabled: true,
              children: (0, import_i18n37.__)("Cancel")
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
            import_components15.Button,
            {
              __next40pxDefaultSize: true,
              variant: "primary",
              onClick: async () => {
                setIsBusy(true);
                await onConfirm();
                onActionPerformed?.(items);
                setIsBusy(false);
                closeModal2?.();
              },
              isBusy,
              disabled: isBusy,
              accessibleWhenDisabled: true,
              children: (0, import_i18n37.__)("Reset")
            }
          )
        ] })
      ] });
    }
  };
  var reset_post_default = resetPostAction;

  // packages/fields/build-module/actions/duplicate-pattern.mjs
  var import_i18n38 = __toESM(require_i18n(), 1);
  var import_patterns3 = __toESM(require_patterns(), 1);
  var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1);
  var { CreatePatternModalContents, useDuplicatePatternProps } = unlock2(import_patterns3.privateApis);
  var duplicatePattern = {
    id: "duplicate-pattern",
    label: (0, import_i18n38._x)("Duplicate", "action label"),
    isEligible: (item) => item.type !== "wp_template_part",
    modalHeader: (0, import_i18n38._x)("Duplicate pattern", "action label"),
    modalFocusOnMount: "firstContentElement",
    RenderModal: ({ items, closeModal: closeModal2 }) => {
      const [item] = items;
      const duplicatedProps = useDuplicatePatternProps({
        pattern: item,
        onSuccess: () => closeModal2?.()
      });
      return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
        CreatePatternModalContents,
        {
          onClose: closeModal2,
          confirmLabel: (0, import_i18n38._x)("Duplicate", "action label"),
          ...duplicatedProps
        }
      );
    }
  };
  var duplicate_pattern_default = duplicatePattern;

  // node_modules/tslib/tslib.es6.mjs
  var __assign = function() {
    __assign = Object.assign || function __assign2(t4) {
      for (var s3, i3 = 1, n3 = arguments.length; i3 < n3; i3++) {
        s3 = arguments[i3];
        for (var p4 in s3) if (Object.prototype.hasOwnProperty.call(s3, p4)) t4[p4] = s3[p4];
      }
      return t4;
    };
    return __assign.apply(this, arguments);
  };

  // node_modules/lower-case/dist.es2015/index.js
  function lowerCase(str) {
    return str.toLowerCase();
  }

  // node_modules/no-case/dist.es2015/index.js
  var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
  var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
  function noCase(input, options) {
    if (options === void 0) {
      options = {};
    }
    var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
    var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
    var start = 0;
    var end = result.length;
    while (result.charAt(start) === "\0")
      start++;
    while (result.charAt(end - 1) === "\0")
      end--;
    return result.slice(start, end).split("\0").map(transform).join(delimiter);
  }
  function replace(input, re, value) {
    if (re instanceof RegExp)
      return input.replace(re, value);
    return re.reduce(function(input2, re2) {
      return input2.replace(re2, value);
    }, input);
  }

  // node_modules/dot-case/dist.es2015/index.js
  function dotCase(input, options) {
    if (options === void 0) {
      options = {};
    }
    return noCase(input, __assign({ delimiter: "." }, options));
  }

  // node_modules/param-case/dist.es2015/index.js
  function paramCase(input, options) {
    if (options === void 0) {
      options = {};
    }
    return dotCase(input, __assign({ delimiter: "-" }, options));
  }

  // node_modules/client-zip/index.js
  "stream" in Blob.prototype || Object.defineProperty(Blob.prototype, "stream", { value() {
    return new Response(this).body;
  } }), "setBigUint64" in DataView.prototype || Object.defineProperty(DataView.prototype, "setBigUint64", { value(e3, n3, t4) {
    const i3 = Number(0xffffffffn & n3), r4 = Number(n3 >> 32n);
    this.setUint32(e3 + (t4 ? 0 : 4), i3, t4), this.setUint32(e3 + (t4 ? 4 : 0), r4, t4);
  } });
  var e = (e3) => new DataView(new ArrayBuffer(e3));
  var n = (e3) => new Uint8Array(e3.buffer || e3);
  var t = (e3) => new TextEncoder().encode(String(e3));
  var i = (e3) => Math.min(4294967295, Number(e3));
  var r2 = (e3) => Math.min(65535, Number(e3));
  function f(e3, i3) {
    if (void 0 === i3 || i3 instanceof Date || (i3 = new Date(i3)), e3 instanceof File) return { isFile: 1, t: i3 || new Date(e3.lastModified), i: e3.stream() };
    if (e3 instanceof Response) return { isFile: 1, t: i3 || new Date(e3.headers.get("Last-Modified") || Date.now()), i: e3.body };
    if (void 0 === i3) i3 = /* @__PURE__ */ new Date();
    else if (isNaN(i3)) throw new Error("Invalid modification date.");
    if (void 0 === e3) return { isFile: 0, t: i3 };
    if ("string" == typeof e3) return { isFile: 1, t: i3, i: t(e3) };
    if (e3 instanceof Blob) return { isFile: 1, t: i3, i: e3.stream() };
    if (e3 instanceof Uint8Array || e3 instanceof ReadableStream) return { isFile: 1, t: i3, i: e3 };
    if (e3 instanceof ArrayBuffer || ArrayBuffer.isView(e3)) return { isFile: 1, t: i3, i: n(e3) };
    if (Symbol.asyncIterator in e3) return { isFile: 1, t: i3, i: o(e3[Symbol.asyncIterator]()) };
    throw new TypeError("Unsupported input format.");
  }
  function o(e3, n3 = e3) {
    return new ReadableStream({ async pull(n4) {
      let t4 = 0;
      for (; n4.desiredSize > t4; ) {
        const i3 = await e3.next();
        if (!i3.value) {
          n4.close();
          break;
        }
        {
          const e4 = a(i3.value);
          n4.enqueue(e4), t4 += e4.byteLength;
        }
      }
    }, cancel(e4) {
      n3.throw?.(e4);
    } });
  }
  function a(e3) {
    return "string" == typeof e3 ? t(e3) : e3 instanceof Uint8Array ? e3 : n(e3);
  }
  function s(e3, i3, r4) {
    let [f3, o4] = (function(e4) {
      return e4 ? e4 instanceof Uint8Array ? [e4, 1] : ArrayBuffer.isView(e4) || e4 instanceof ArrayBuffer ? [n(e4), 1] : [t(e4), 0] : [void 0, 0];
    })(i3);
    if (e3 instanceof File) return { o: d(f3 || t(e3.name)), u: BigInt(e3.size), l: o4 };
    if (e3 instanceof Response) {
      const n3 = e3.headers.get("content-disposition"), i4 = n3 && n3.match(/;\s*filename\*?=["']?(.*?)["']?$/i), a3 = i4 && i4[1] || e3.url && new URL(e3.url).pathname.split("/").findLast(Boolean), s3 = a3 && decodeURIComponent(a3), u3 = r4 || +e3.headers.get("content-length");
      return { o: d(f3 || t(s3)), u: BigInt(u3), l: o4 };
    }
    return f3 = d(f3, void 0 !== e3 || void 0 !== r4), "string" == typeof e3 ? { o: f3, u: BigInt(t(e3).length), l: o4 } : e3 instanceof Blob ? { o: f3, u: BigInt(e3.size), l: o4 } : e3 instanceof ArrayBuffer || ArrayBuffer.isView(e3) ? { o: f3, u: BigInt(e3.byteLength), l: o4 } : { o: f3, u: u(e3, r4), l: o4 };
  }
  function u(e3, n3) {
    return n3 > -1 ? BigInt(n3) : e3 ? void 0 : 0n;
  }
  function d(e3, n3 = 1) {
    if (!e3 || e3.every(((c2) => 47 === c2))) throw new Error("The file must have a name.");
    if (n3) for (; 47 === e3[e3.length - 1]; ) e3 = e3.subarray(0, -1);
    else 47 !== e3[e3.length - 1] && (e3 = new Uint8Array([...e3, 47]));
    return e3;
  }
  var l = new Uint32Array(256);
  for (let e3 = 0; e3 < 256; ++e3) {
    let n3 = e3;
    for (let e4 = 0; e4 < 8; ++e4) n3 = n3 >>> 1 ^ (1 & n3 && 3988292384);
    l[e3] = n3;
  }
  function y(e3, n3 = 0) {
    n3 ^= -1;
    for (var t4 = 0, i3 = e3.length; t4 < i3; t4++) n3 = n3 >>> 8 ^ l[255 & n3 ^ e3[t4]];
    return (-1 ^ n3) >>> 0;
  }
  function w(e3, n3, t4 = 0) {
    const i3 = e3.getSeconds() >> 1 | e3.getMinutes() << 5 | e3.getHours() << 11, r4 = e3.getDate() | e3.getMonth() + 1 << 5 | e3.getFullYear() - 1980 << 9;
    n3.setUint16(t4, i3, 1), n3.setUint16(t4 + 2, r4, 1);
  }
  function B({ o: e3, l: n3 }, t4) {
    return 8 * (!n3 || (t4 ?? (function(e4) {
      try {
        b.decode(e4);
      } catch {
        return 0;
      }
      return 1;
    })(e3)));
  }
  var b = new TextDecoder("utf8", { fatal: 1 });
  function p2(t4, i3 = 0) {
    const r4 = e(30);
    return r4.setUint32(0, 1347093252), r4.setUint32(4, 754976768 | i3), w(t4.t, r4, 10), r4.setUint16(26, t4.o.length, 1), n(r4);
  }
  async function* g(e3) {
    let { i: n3 } = e3;
    if ("then" in n3 && (n3 = await n3), n3 instanceof Uint8Array) yield n3, e3.m = y(n3, 0), e3.u = BigInt(n3.length);
    else {
      e3.u = 0n;
      const t4 = n3.getReader();
      for (; ; ) {
        const { value: n4, done: i3 } = await t4.read();
        if (i3) break;
        e3.m = y(n4, e3.m), e3.u += BigInt(n4.length), yield n4;
      }
    }
  }
  function I(t4, r4) {
    const f3 = e(16 + (r4 ? 8 : 0));
    return f3.setUint32(0, 1347094280), f3.setUint32(4, t4.isFile ? t4.m : 0, 1), r4 ? (f3.setBigUint64(8, t4.u, 1), f3.setBigUint64(16, t4.u, 1)) : (f3.setUint32(8, i(t4.u), 1), f3.setUint32(12, i(t4.u), 1)), n(f3);
  }
  function v(t4, r4, f3 = 0, o4 = 0) {
    const a3 = e(46);
    return a3.setUint32(0, 1347092738), a3.setUint32(4, 755182848), a3.setUint16(8, 2048 | f3), w(t4.t, a3, 12), a3.setUint32(16, t4.isFile ? t4.m : 0, 1), a3.setUint32(20, i(t4.u), 1), a3.setUint32(24, i(t4.u), 1), a3.setUint16(28, t4.o.length, 1), a3.setUint16(30, o4, 1), a3.setUint16(40, t4.isFile ? 33204 : 16893, 1), a3.setUint32(42, i(r4), 1), n(a3);
  }
  function h(t4, i3, r4) {
    const f3 = e(r4);
    return f3.setUint16(0, 1, 1), f3.setUint16(2, r4 - 4, 1), 16 & r4 && (f3.setBigUint64(4, t4.u, 1), f3.setBigUint64(12, t4.u, 1)), f3.setBigUint64(r4 - 8, i3, 1), n(f3);
  }
  function D(e3) {
    return e3 instanceof File || e3 instanceof Response ? [[e3], [e3]] : [[e3.input, e3.name, e3.size], [e3.input, e3.lastModified]];
  }
  var S = (e3) => (function(e4) {
    let n3 = BigInt(22), t4 = 0n, i3 = 0;
    for (const r4 of e4) {
      if (!r4.o) throw new Error("Every file must have a non-empty name.");
      if (void 0 === r4.u) throw new Error(`Missing size for file "${new TextDecoder().decode(r4.o)}".`);
      const e5 = r4.u >= 0xffffffffn, f3 = t4 >= 0xffffffffn;
      t4 += BigInt(46 + r4.o.length + (e5 && 8)) + r4.u, n3 += BigInt(r4.o.length + 46 + (12 * f3 | 28 * e5)), i3 || (i3 = e5);
    }
    return (i3 || t4 >= 0xffffffffn) && (n3 += BigInt(76)), n3 + t4;
  })((function* (e4) {
    for (const n3 of e4) yield s(...D(n3)[0]);
  })(e3));
  function A(e3, n3 = {}) {
    const t4 = { "Content-Type": "application/zip", "Content-Disposition": "attachment" };
    return ("bigint" == typeof n3.length || Number.isInteger(n3.length)) && n3.length > 0 && (t4["Content-Length"] = String(n3.length)), n3.metadata && (t4["Content-Length"] = String(S(n3.metadata))), new Response(N(e3, n3), { headers: t4 });
  }
  function N(t4, a3 = {}) {
    const u3 = (function(e3) {
      const n3 = e3[Symbol.iterator in e3 ? Symbol.iterator : Symbol.asyncIterator]();
      return { async next() {
        const e4 = await n3.next();
        if (e4.done) return e4;
        const [t5, i3] = D(e4.value);
        return { done: 0, value: Object.assign(f(...i3), s(...t5)) };
      }, throw: n3.throw?.bind(n3), [Symbol.asyncIterator]() {
        return this;
      } };
    })(t4);
    return o((async function* (t5, f3) {
      const o4 = [];
      let a4 = 0n, s3 = 0n, u4 = 0;
      for await (const e3 of t5) {
        const n3 = B(e3, f3.buffersAreUTF8);
        yield p2(e3, n3), yield new Uint8Array(e3.o), e3.isFile && (yield* g(e3));
        const t6 = e3.u >= 0xffffffffn, i3 = 12 * (a4 >= 0xffffffffn) | 28 * t6;
        yield I(e3, t6), o4.push(v(e3, a4, n3, i3)), o4.push(e3.o), i3 && o4.push(h(e3, a4, i3)), t6 && (a4 += 8n), s3++, a4 += BigInt(46 + e3.o.length) + e3.u, u4 || (u4 = t6);
      }
      let d3 = 0n;
      for (const e3 of o4) yield e3, d3 += BigInt(e3.length);
      if (u4 || a4 >= 0xffffffffn) {
        const t6 = e(76);
        t6.setUint32(0, 1347094022), t6.setBigUint64(4, BigInt(44), 1), t6.setUint32(12, 755182848), t6.setBigUint64(24, s3, 1), t6.setBigUint64(32, s3, 1), t6.setBigUint64(40, d3, 1), t6.setBigUint64(48, a4, 1), t6.setUint32(56, 1347094023), t6.setBigUint64(64, a4 + d3, 1), t6.setUint32(72, 1, 1), yield n(t6);
      }
      const l3 = e(22);
      l3.setUint32(0, 1347093766), l3.setUint16(8, r2(s3), 1), l3.setUint16(10, r2(s3), 1), l3.setUint32(12, i(d3), 1), l3.setUint32(16, i(a4), 1), yield n(l3);
    })(u3, a3), u3);
  }

  // packages/fields/build-module/actions/export-pattern.mjs
  var import_blob2 = __toESM(require_blob(), 1);
  var import_i18n39 = __toESM(require_i18n(), 1);
  function getJsonFromItem(item) {
    return JSON.stringify(
      {
        __file: item.type,
        title: getItemTitle(item),
        content: typeof item.content === "string" ? item.content : item.content?.raw,
        syncStatus: item.wp_pattern_sync_status
      },
      null,
      2
    );
  }
  var exportPattern = {
    id: "export-pattern",
    label: (0, import_i18n39.__)("Export as JSON"),
    icon: download_default,
    supportsBulk: true,
    isEligible: (item) => item.type === "wp_block",
    callback: async (items) => {
      if (items.length === 1) {
        return (0, import_blob2.downloadBlob)(
          `${paramCase(
            getItemTitle(items[0]) || items[0].slug
          )}.json`,
          getJsonFromItem(items[0]),
          "application/json"
        );
      }
      const nameCount = {};
      const filesToZip = items.map((item) => {
        const name2 = paramCase(getItemTitle(item) || item.slug);
        nameCount[name2] = (nameCount[name2] || 0) + 1;
        return {
          name: `${name2 + (nameCount[name2] > 1 ? "-" + (nameCount[name2] - 1) : "")}.json`,
          lastModified: /* @__PURE__ */ new Date(),
          input: getJsonFromItem(item)
        };
      });
      return (0, import_blob2.downloadBlob)(
        (0, import_i18n39.__)("patterns-export") + ".zip",
        await A(filesToZip).blob(),
        "application/zip"
      );
    }
  };
  var export_pattern_default = exportPattern;

  // packages/fields/build-module/actions/view-post-revisions.mjs
  var import_url6 = __toESM(require_url(), 1);
  var import_i18n40 = __toESM(require_i18n(), 1);
  var viewPostRevisions = {
    id: "view-post-revisions",
    context: "list",
    label(items) {
      const revisionsCount = items[0]._links?.["version-history"]?.[0]?.count ?? 0;
      return (0, import_i18n40.sprintf)(
        /* translators: %d: number of revisions. */
        (0, import_i18n40.__)("View revisions (%d)"),
        revisionsCount
      );
    },
    isEligible(post2) {
      if (post2.status === "trash") {
        return false;
      }
      const lastRevisionId = post2?._links?.["predecessor-version"]?.[0]?.id ?? null;
      const revisionsCount = post2?._links?.["version-history"]?.[0]?.count ?? 0;
      return !!lastRevisionId && revisionsCount > 1;
    },
    callback(posts, { onActionPerformed }) {
      const post2 = posts[0];
      const href = (0, import_url6.addQueryArgs)("revision.php", {
        revision: post2?._links?.["predecessor-version"]?.[0]?.id
      });
      document.location.href = href;
      if (onActionPerformed) {
        onActionPerformed(posts);
      }
    }
  };
  var view_post_revisions_default = viewPostRevisions;

  // packages/fields/build-module/actions/permanently-delete-post.mjs
  var import_core_data14 = __toESM(require_core_data(), 1);
  var import_i18n41 = __toESM(require_i18n(), 1);
  var import_notices8 = __toESM(require_notices(), 1);
  var import_element15 = __toESM(require_element(), 1);
  var import_data16 = __toESM(require_data(), 1);
  var import_components16 = __toESM(require_components(), 1);
  var import_html_entities5 = __toESM(require_html_entities(), 1);
  var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1);
  var permanentlyDeletePost = {
    id: "permanently-delete",
    label: (0, import_i18n41.__)("Permanently delete"),
    supportsBulk: true,
    icon: trash_default,
    isEligible(item) {
      if (isTemplateOrTemplatePart(item) || item.type === "wp_block") {
        return false;
      }
      const { status, permissions } = item;
      return status === "trash" && permissions?.delete;
    },
    hideModalHeader: true,
    modalFocusOnMount: "firstContentElement",
    RenderModal: ({ items, closeModal: closeModal2, onActionPerformed }) => {
      const [isBusy, setIsBusy] = (0, import_element15.useState)(false);
      const { createSuccessNotice, createErrorNotice } = (0, import_data16.useDispatch)(import_notices8.store);
      const { deleteEntityRecord } = (0, import_data16.useDispatch)(import_core_data14.store);
      return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_components16.__experimentalVStack, { spacing: "5", children: [
        /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_components16.__experimentalText, { children: items.length > 1 ? (0, import_i18n41.sprintf)(
          // translators: %d: number of items to delete.
          (0, import_i18n41._n)(
            "Are you sure you want to permanently delete %d item?",
            "Are you sure you want to permanently delete %d items?",
            items.length
          ),
          items.length
        ) : (0, import_i18n41.sprintf)(
          // translators: %s: The post's title
          (0, import_i18n41.__)(
            'Are you sure you want to permanently delete "%s"?'
          ),
          (0, import_html_entities5.decodeEntities)(getItemTitle(items[0]))
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_components16.__experimentalHStack, { justify: "right", children: [
          /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
            import_components16.Button,
            {
              variant: "tertiary",
              onClick: closeModal2,
              disabled: isBusy,
              accessibleWhenDisabled: true,
              __next40pxDefaultSize: true,
              children: (0, import_i18n41.__)("Cancel")
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
            import_components16.Button,
            {
              variant: "primary",
              onClick: async () => {
                setIsBusy(true);
                const promiseResult = await Promise.allSettled(
                  items.map(
                    (post2) => deleteEntityRecord(
                      "postType",
                      post2.type,
                      post2.id,
                      { force: true },
                      { throwOnError: true }
                    )
                  )
                );
                if (promiseResult.every(
                  ({ status }) => status === "fulfilled"
                )) {
                  let successMessage;
                  if (promiseResult.length === 1) {
                    successMessage = (0, import_i18n41.sprintf)(
                      /* translators: %s: The posts's title. */
                      (0, import_i18n41.__)('"%s" permanently deleted.'),
                      getItemTitle(items[0])
                    );
                  } else {
                    successMessage = (0, import_i18n41.__)(
                      "The items were permanently deleted."
                    );
                  }
                  createSuccessNotice(successMessage, {
                    type: "snackbar",
                    id: "permanently-delete-post-action"
                  });
                  onActionPerformed?.(items);
                } else {
                  let errorMessage;
                  if (promiseResult.length === 1) {
                    const typedError = promiseResult[0];
                    if (typedError.reason?.message) {
                      errorMessage = typedError.reason.message;
                    } else {
                      errorMessage = (0, import_i18n41.__)(
                        "An error occurred while permanently deleting the item."
                      );
                    }
                  } else {
                    const errorMessages = /* @__PURE__ */ new Set();
                    const failedPromises = promiseResult.filter(
                      ({ status }) => status === "rejected"
                    );
                    for (const failedPromise of failedPromises) {
                      const typedError = failedPromise;
                      if (typedError.reason?.message) {
                        errorMessages.add(
                          typedError.reason.message
                        );
                      }
                    }
                    if (errorMessages.size === 0) {
                      errorMessage = (0, import_i18n41.__)(
                        "An error occurred while permanently deleting the items."
                      );
                    } else if (errorMessages.size === 1) {
                      errorMessage = (0, import_i18n41.sprintf)(
                        /* translators: %s: an error message */
                        (0, import_i18n41.__)(
                          "An error occurred while permanently deleting the items: %s"
                        ),
                        [...errorMessages][0]
                      );
                    } else {
                      errorMessage = (0, import_i18n41.sprintf)(
                        /* translators: %s: a list of comma separated error messages */
                        (0, import_i18n41.__)(
                          "Some errors occurred while permanently deleting the items: %s"
                        ),
                        [...errorMessages].join(",")
                      );
                    }
                  }
                  createErrorNotice(errorMessage, {
                    type: "snackbar"
                  });
                }
                setIsBusy(false);
                closeModal2?.();
              },
              isBusy,
              disabled: isBusy,
              accessibleWhenDisabled: true,
              __next40pxDefaultSize: true,
              children: (0, import_i18n41.__)("Delete permanently")
            }
          )
        ] })
      ] });
    }
  };
  var permanently_delete_post_default = permanentlyDeletePost;

  // packages/fields/build-module/actions/restore-post.mjs
  var import_core_data15 = __toESM(require_core_data(), 1);
  var import_i18n42 = __toESM(require_i18n(), 1);
  var import_notices9 = __toESM(require_notices(), 1);
  var restorePost = {
    id: "restore",
    label: (0, import_i18n42.__)("Restore"),
    isPrimary: true,
    icon: backup_default,
    supportsBulk: true,
    isEligible(item) {
      return !isTemplateOrTemplatePart(item) && item.type !== "wp_block" && item.status === "trash" && item.permissions?.update;
    },
    async callback(posts, { registry, onActionPerformed }) {
      const { createSuccessNotice, createErrorNotice } = registry.dispatch(import_notices9.store);
      const { editEntityRecord, saveEditedEntityRecord } = registry.dispatch(import_core_data15.store);
      await Promise.allSettled(
        posts.map((post2) => {
          return editEntityRecord("postType", post2.type, post2.id, {
            status: "draft"
          });
        })
      );
      const promiseResult = await Promise.allSettled(
        posts.map((post2) => {
          return saveEditedEntityRecord("postType", post2.type, post2.id, {
            throwOnError: true
          });
        })
      );
      if (promiseResult.every(({ status }) => status === "fulfilled")) {
        let successMessage;
        if (posts.length === 1) {
          successMessage = (0, import_i18n42.sprintf)(
            /* translators: %s: The number of posts. */
            (0, import_i18n42.__)('"%s" has been restored.'),
            getItemTitle(posts[0])
          );
        } else if (posts[0].type === "page") {
          successMessage = (0, import_i18n42.sprintf)(
            /* translators: %d: The number of posts. */
            (0, import_i18n42.__)("%d pages have been restored."),
            posts.length
          );
        } else {
          successMessage = (0, import_i18n42.sprintf)(
            /* translators: %d: The number of posts. */
            (0, import_i18n42.__)("%d posts have been restored."),
            posts.length
          );
        }
        createSuccessNotice(successMessage, {
          type: "snackbar",
          id: "restore-post-action"
        });
        if (onActionPerformed) {
          onActionPerformed(posts);
        }
      } else {
        let errorMessage;
        if (promiseResult.length === 1) {
          const typedError = promiseResult[0];
          if (typedError.reason?.message) {
            errorMessage = typedError.reason.message;
          } else {
            errorMessage = (0, import_i18n42.__)(
              "An error occurred while restoring the post."
            );
          }
        } else {
          const errorMessages = /* @__PURE__ */ new Set();
          const failedPromises = promiseResult.filter(
            ({ status }) => status === "rejected"
          );
          for (const failedPromise of failedPromises) {
            const typedError = failedPromise;
            if (typedError.reason?.message) {
              errorMessages.add(typedError.reason.message);
            }
          }
          if (errorMessages.size === 0) {
            errorMessage = (0, import_i18n42.__)(
              "An error occurred while restoring the posts."
            );
          } else if (errorMessages.size === 1) {
            errorMessage = (0, import_i18n42.sprintf)(
              /* translators: %s: an error message */
              (0, import_i18n42.__)("An error occurred while restoring the posts: %s"),
              [...errorMessages][0]
            );
          } else {
            errorMessage = (0, import_i18n42.sprintf)(
              /* translators: %s: a list of comma separated error messages */
              (0, import_i18n42.__)(
                "Some errors occurred while restoring the posts: %s"
              ),
              [...errorMessages].join(",")
            );
          }
        }
        createErrorNotice(errorMessage, {
          type: "snackbar"
        });
      }
    }
  };
  var restore_post_default = restorePost;

  // packages/fields/build-module/actions/trash-post.mjs
  var import_data17 = __toESM(require_data(), 1);
  var import_core_data16 = __toESM(require_core_data(), 1);
  var import_i18n43 = __toESM(require_i18n(), 1);
  var import_notices10 = __toESM(require_notices(), 1);
  var import_element16 = __toESM(require_element(), 1);
  var import_components17 = __toESM(require_components(), 1);
  var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
  var trashPost2 = {
    id: "move-to-trash",
    label: (0, import_i18n43._x)("Trash", "verb"),
    isPrimary: true,
    icon: trash_default,
    isEligible(item) {
      if (item.type === "wp_template_part" || item.type === "wp_block") {
        return false;
      }
      if (item.type === "wp_template" && typeof item.id === "string") {
        return false;
      }
      return !!item.status && !["auto-draft", "trash"].includes(item.status) && item.permissions?.delete;
    },
    supportsBulk: true,
    hideModalHeader: true,
    modalFocusOnMount: "firstContentElement",
    RenderModal: ({ items, closeModal: closeModal2, onActionPerformed }) => {
      const [isBusy, setIsBusy] = (0, import_element16.useState)(false);
      const { createSuccessNotice, createErrorNotice } = (0, import_data17.useDispatch)(import_notices10.store);
      const { deleteEntityRecord } = (0, import_data17.useDispatch)(import_core_data16.store);
      return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_components17.__experimentalVStack, { spacing: "5", children: [
        /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_components17.__experimentalText, { children: items.length === 1 ? (0, import_i18n43.sprintf)(
          // translators: %s: The item's title.
          (0, import_i18n43.__)(
            'Are you sure you want to move "%s" to the trash?'
          ),
          getItemTitle(items[0])
        ) : (0, import_i18n43.sprintf)(
          // translators: %d: The number of items (2 or more).
          (0, import_i18n43._n)(
            "Are you sure you want to move %d item to the trash ?",
            "Are you sure you want to move %d items to the trash ?",
            items.length
          ),
          items.length
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_components17.__experimentalHStack, { justify: "right", children: [
          /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
            import_components17.Button,
            {
              __next40pxDefaultSize: true,
              variant: "tertiary",
              onClick: closeModal2,
              disabled: isBusy,
              accessibleWhenDisabled: true,
              children: (0, import_i18n43.__)("Cancel")
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
            import_components17.Button,
            {
              __next40pxDefaultSize: true,
              variant: "primary",
              onClick: async () => {
                setIsBusy(true);
                const promiseResult = await Promise.allSettled(
                  items.map(
                    (item) => deleteEntityRecord(
                      "postType",
                      item.type,
                      item.id.toString(),
                      {},
                      { throwOnError: true }
                    )
                  )
                );
                if (promiseResult.every(
                  ({ status }) => status === "fulfilled"
                )) {
                  let successMessage;
                  if (promiseResult.length === 1) {
                    successMessage = (0, import_i18n43.sprintf)(
                      /* translators: %s: The item's title. */
                      (0, import_i18n43.__)('"%s" moved to the trash.'),
                      getItemTitle(items[0])
                    );
                  } else {
                    successMessage = (0, import_i18n43.sprintf)(
                      /* translators: %d: The number of items. */
                      (0, import_i18n43._n)(
                        "%d item moved to the trash.",
                        "%d items moved to the trash.",
                        items.length
                      ),
                      items.length
                    );
                  }
                  createSuccessNotice(successMessage, {
                    type: "snackbar",
                    id: "move-to-trash-action"
                  });
                } else {
                  let errorMessage;
                  if (promiseResult.length === 1) {
                    const typedError = promiseResult[0];
                    if (typedError.reason?.message) {
                      errorMessage = typedError.reason.message;
                    } else {
                      errorMessage = (0, import_i18n43.__)(
                        "An error occurred while moving the item to the trash."
                      );
                    }
                  } else {
                    const errorMessages = /* @__PURE__ */ new Set();
                    const failedPromises = promiseResult.filter(
                      ({ status }) => status === "rejected"
                    );
                    for (const failedPromise of failedPromises) {
                      const typedError = failedPromise;
                      if (typedError.reason?.message) {
                        errorMessages.add(
                          typedError.reason.message
                        );
                      }
                    }
                    if (errorMessages.size === 0) {
                      errorMessage = (0, import_i18n43.__)(
                        "An error occurred while moving the items to the trash."
                      );
                    } else if (errorMessages.size === 1) {
                      errorMessage = (0, import_i18n43.sprintf)(
                        /* translators: %s: an error message */
                        (0, import_i18n43.__)(
                          "An error occurred while moving the item to the trash: %s"
                        ),
                        [...errorMessages][0]
                      );
                    } else {
                      errorMessage = (0, import_i18n43.sprintf)(
                        /* translators: %s: a list of comma separated error messages */
                        (0, import_i18n43.__)(
                          "Some errors occurred while moving the items to the trash: %s"
                        ),
                        [...errorMessages].join(",")
                      );
                    }
                  }
                  createErrorNotice(errorMessage, {
                    type: "snackbar"
                  });
                }
                if (onActionPerformed) {
                  onActionPerformed(items);
                }
                setIsBusy(false);
                closeModal2?.();
              },
              isBusy,
              disabled: isBusy,
              accessibleWhenDisabled: true,
              children: (0, import_i18n43._x)("Trash", "verb")
            }
          )
        ] })
      ] });
    }
  };
  var trash_post_default = trashPost2;

  // packages/fields/build-module/actions/delete-post.mjs
  var import_i18n44 = __toESM(require_i18n(), 1);
  var import_element17 = __toESM(require_element(), 1);
  var import_components18 = __toESM(require_components(), 1);
  var import_patterns4 = __toESM(require_patterns(), 1);
  var import_html_entities6 = __toESM(require_html_entities(), 1);

  // packages/fields/build-module/mutation/index.mjs
  var import_notices11 = __toESM(require_notices(), 1);
  var import_core_data17 = __toESM(require_core_data(), 1);
  var import_data18 = __toESM(require_data(), 1);
  function getErrorMessagesFromPromises(allSettledResults) {
    const errorMessages = /* @__PURE__ */ new Set();
    if (allSettledResults.length === 1) {
      const typedError = allSettledResults[0];
      if (typedError.reason?.message) {
        errorMessages.add(typedError.reason.message);
      }
    } else {
      const failedPromises = allSettledResults.filter(
        ({ status }) => status === "rejected"
      );
      for (const failedPromise of failedPromises) {
        const typedError = failedPromise;
        if (typedError.reason?.message) {
          errorMessages.add(typedError.reason.message);
        }
      }
    }
    return errorMessages;
  }
  var deletePostWithNotices = async (posts, notice, callbacks) => {
    const { createSuccessNotice, createErrorNotice } = (0, import_data18.dispatch)(import_notices11.store);
    const { deleteEntityRecord } = (0, import_data18.dispatch)(import_core_data17.store);
    const allSettledResults = await Promise.allSettled(
      posts.map((post2) => {
        return deleteEntityRecord(
          "postType",
          post2.type,
          post2.id,
          { force: true },
          { throwOnError: true }
        );
      })
    );
    if (allSettledResults.every(({ status }) => status === "fulfilled")) {
      let successMessage;
      if (allSettledResults.length === 1) {
        successMessage = notice.success.messages.getMessage(posts[0]);
      } else {
        successMessage = notice.success.messages.getBatchMessage(posts);
      }
      createSuccessNotice(successMessage, {
        type: notice.success.type ?? "snackbar",
        id: notice.success.id
      });
      callbacks.onActionPerformed?.(posts);
    } else {
      const errorMessages = getErrorMessagesFromPromises(allSettledResults);
      let errorMessage = "";
      if (allSettledResults.length === 1) {
        errorMessage = notice.error.messages.getMessage(errorMessages);
      } else {
        errorMessage = notice.error.messages.getBatchMessage(errorMessages);
      }
      createErrorNotice(errorMessage, {
        type: notice.error.type ?? "snackbar",
        id: notice.error.id
      });
      callbacks.onActionError?.();
    }
  };

  // packages/fields/build-module/actions/delete-post.mjs
  var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
  var { PATTERN_TYPES: PATTERN_TYPES3 } = unlock2(import_patterns4.privateApis);
  var deletePostAction = {
    id: "delete-post",
    label: (0, import_i18n44.__)("Delete"),
    isPrimary: true,
    icon: trash_default,
    isEligible(post2) {
      if (isTemplateOrTemplatePart(post2)) {
        return isTemplateRemovable(post2);
      }
      return post2.type === PATTERN_TYPES3.user;
    },
    supportsBulk: true,
    hideModalHeader: true,
    modalFocusOnMount: "firstContentElement",
    RenderModal: ({ items, closeModal: closeModal2, onActionPerformed }) => {
      const [isBusy, setIsBusy] = (0, import_element17.useState)(false);
      const isResetting = items.every(
        (item) => isTemplateOrTemplatePart(item) && item?.has_theme_file
      );
      return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_components18.__experimentalVStack, { spacing: "5", children: [
        /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_components18.__experimentalText, { children: items.length > 1 ? (0, import_i18n44.sprintf)(
          // translators: %d: number of items to delete.
          (0, import_i18n44._n)(
            "Delete %d item?",
            "Delete %d items?",
            items.length
          ),
          items.length
        ) : (0, import_i18n44.sprintf)(
          // translators: %s: The template or template part's title
          (0, import_i18n44._x)('Delete "%s"?', "template part"),
          getItemTitle(items[0])
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_components18.__experimentalHStack, { justify: "right", children: [
          /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
            import_components18.Button,
            {
              variant: "tertiary",
              onClick: closeModal2,
              disabled: isBusy,
              accessibleWhenDisabled: true,
              __next40pxDefaultSize: true,
              children: (0, import_i18n44.__)("Cancel")
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
            import_components18.Button,
            {
              variant: "primary",
              onClick: async () => {
                setIsBusy(true);
                const notice = {
                  success: {
                    messages: {
                      getMessage: (item) => {
                        return isResetting ? (0, import_i18n44.sprintf)(
                          /* translators: %s: The template/part's name. */
                          (0, import_i18n44.__)('"%s" reset.'),
                          (0, import_html_entities6.decodeEntities)(
                            getItemTitle(item)
                          )
                        ) : (0, import_i18n44.sprintf)(
                          /* translators: %s: The template/part's name. */
                          (0, import_i18n44._x)(
                            '"%s" deleted.',
                            "template part"
                          ),
                          (0, import_html_entities6.decodeEntities)(
                            getItemTitle(item)
                          )
                        );
                      },
                      getBatchMessage: () => {
                        return isResetting ? (0, import_i18n44.__)("Items reset.") : (0, import_i18n44.__)("Items deleted.");
                      }
                    }
                  },
                  error: {
                    messages: {
                      getMessage: (error) => {
                        if (error.size === 1) {
                          return [...error][0];
                        }
                        return isResetting ? (0, import_i18n44.__)(
                          "An error occurred while reverting the item."
                        ) : (0, import_i18n44.__)(
                          "An error occurred while deleting the item."
                        );
                      },
                      getBatchMessage: (errors) => {
                        if (errors.size === 0) {
                          return isResetting ? (0, import_i18n44.__)(
                            "An error occurred while reverting the items."
                          ) : (0, import_i18n44.__)(
                            "An error occurred while deleting the items."
                          );
                        }
                        if (errors.size === 1) {
                          return isResetting ? (0, import_i18n44.sprintf)(
                            /* translators: %s: an error message */
                            (0, import_i18n44.__)(
                              "An error occurred while reverting the items: %s"
                            ),
                            [...errors][0]
                          ) : (0, import_i18n44.sprintf)(
                            /* translators: %s: an error message */
                            (0, import_i18n44.__)(
                              "An error occurred while deleting the items: %s"
                            ),
                            [...errors][0]
                          );
                        }
                        return isResetting ? (0, import_i18n44.sprintf)(
                          /* translators: %s: a list of comma separated error messages */
                          (0, import_i18n44.__)(
                            "Some errors occurred while reverting the items: %s"
                          ),
                          [...errors].join(
                            ","
                          )
                        ) : (0, import_i18n44.sprintf)(
                          /* translators: %s: a list of comma separated error messages */
                          (0, import_i18n44.__)(
                            "Some errors occurred while deleting the items: %s"
                          ),
                          [...errors].join(
                            ","
                          )
                        );
                      }
                    }
                  }
                };
                await deletePostWithNotices(items, notice, {
                  onActionPerformed
                });
                setIsBusy(false);
                closeModal2?.();
              },
              isBusy,
              disabled: isBusy,
              accessibleWhenDisabled: true,
              __next40pxDefaultSize: true,
              children: (0, import_i18n44.__)("Delete")
            }
          )
        ] })
      ] });
    }
  };
  var delete_post_default = deletePostAction;

  // packages/fields/build-module/actions/duplicate-template-part.mjs
  var import_data21 = __toESM(require_data(), 1);
  var import_i18n46 = __toESM(require_i18n(), 1);
  var import_notices13 = __toESM(require_notices(), 1);
  var import_element19 = __toESM(require_element(), 1);
  var import_blocks6 = __toESM(require_blocks(), 1);

  // packages/fields/build-module/components/create-template-part-modal/index.mjs
  var import_components19 = __toESM(require_components(), 1);
  var import_compose4 = __toESM(require_compose(), 1);
  var import_core_data19 = __toESM(require_core_data(), 1);
  var import_data20 = __toESM(require_data(), 1);
  var import_element18 = __toESM(require_element(), 1);
  var import_i18n45 = __toESM(require_i18n(), 1);
  var import_notices12 = __toESM(require_notices(), 1);
  var import_blocks5 = __toESM(require_blocks(), 1);

  // packages/fields/build-module/components/create-template-part-modal/utils.mjs
  var import_data19 = __toESM(require_data(), 1);
  var import_core_data18 = __toESM(require_core_data(), 1);
  var useExistingTemplateParts = () => {
    return (0, import_data19.useSelect)(
      (select5) => select5(import_core_data18.store).getEntityRecords(
        "postType",
        "wp_template_part",
        {
          per_page: -1
        }
      ),
      []
    ) ?? [];
  };
  var getUniqueTemplatePartTitle = (title, templateParts) => {
    const lowercaseTitle = title.toLowerCase();
    const existingTitles = templateParts.map(
      (templatePart) => templatePart.title.rendered.toLowerCase()
    );
    if (!existingTitles.includes(lowercaseTitle)) {
      return title;
    }
    let suffix = 2;
    while (existingTitles.includes(`${lowercaseTitle} ${suffix}`)) {
      suffix++;
    }
    return `${title} ${suffix}`;
  };
  var getCleanTemplatePartSlug = (title) => {
    return paramCase(title).replace(/[^\w-]+/g, "") || "wp-custom-part";
  };

  // packages/fields/build-module/components/create-template-part-modal/index.mjs
  var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
  function getAreaRadioId(value, instanceId) {
    return `fields-create-template-part-modal__area-option-${value}-${instanceId}`;
  }
  function getAreaRadioDescriptionId(value, instanceId) {
    return `fields-create-template-part-modal__area-option-description-${value}-${instanceId}`;
  }
  function CreateTemplatePartModal({
    modalTitle,
    ...restProps
  }) {
    const defaultModalTitle = (0, import_data20.useSelect)(
      (select5) => select5(import_core_data19.store).getPostType("wp_template_part")?.labels?.add_new_item,
      []
    );
    return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
      import_components19.Modal,
      {
        title: modalTitle || defaultModalTitle,
        onRequestClose: restProps.closeModal,
        overlayClassName: "fields-create-template-part-modal",
        focusOnMount: "firstContentElement",
        size: "medium",
        children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(CreateTemplatePartModalContents, { ...restProps })
      }
    );
  }
  var getTemplatePartIcon2 = (areaOrIconName) => {
    if ("header" === areaOrIconName) {
      return header_default;
    } else if ("footer" === areaOrIconName) {
      return footer_default;
    } else if ("sidebar" === areaOrIconName) {
      return sidebar_default;
    } else if ("overlay" === areaOrIconName) {
      return table_column_after_default;
    }
    if ("menu" === areaOrIconName) {
      return table_column_after_default;
    }
    return symbol_filled_default;
  };
  function CreateTemplatePartModalContents({
    defaultArea = "uncategorized",
    blocks = [],
    confirmLabel = (0, import_i18n45.__)("Add"),
    closeModal: closeModal2,
    onCreate,
    onError,
    defaultTitle = ""
  }) {
    const { createErrorNotice } = (0, import_data20.useDispatch)(import_notices12.store);
    const { saveEntityRecord } = (0, import_data20.useDispatch)(import_core_data19.store);
    const existingTemplateParts = useExistingTemplateParts();
    const [title, setTitle] = (0, import_element18.useState)(defaultTitle);
    const [area, setArea] = (0, import_element18.useState)(defaultArea);
    const [isSubmitting, setIsSubmitting] = (0, import_element18.useState)(false);
    const instanceId = (0, import_compose4.useInstanceId)(CreateTemplatePartModal);
    const defaultTemplatePartAreas = (0, import_data20.useSelect)(
      (select5) => select5(import_core_data19.store).getCurrentTheme()?.default_template_part_areas,
      []
    );
    async function createTemplatePart() {
      if (!title || isSubmitting) {
        return;
      }
      try {
        setIsSubmitting(true);
        const uniqueTitle = getUniqueTemplatePartTitle(
          title,
          existingTemplateParts
        );
        const cleanSlug = getCleanTemplatePartSlug(uniqueTitle);
        const templatePart = await saveEntityRecord(
          "postType",
          "wp_template_part",
          {
            slug: cleanSlug,
            title: uniqueTitle,
            content: (0, import_blocks5.serialize)(blocks),
            area
          },
          { throwOnError: true }
        );
        await onCreate(templatePart);
      } catch (error) {
        const errorMessage = error instanceof Error && "code" in error && error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n45.__)(
          "An error occurred while creating the template part."
        );
        createErrorNotice(errorMessage, { type: "snackbar" });
        onError?.();
      } finally {
        setIsSubmitting(false);
      }
    }
    return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
      "form",
      {
        onSubmit: async (event) => {
          event.preventDefault();
          await createTemplatePart();
        },
        children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_components19.__experimentalVStack, { spacing: "4", children: [
          /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
            import_components19.TextControl,
            {
              __next40pxDefaultSize: true,
              label: (0, import_i18n45.__)("Name"),
              value: title,
              onChange: setTitle,
              required: true
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("fieldset", { className: "fields-create-template-part-modal__area-fieldset", children: [
            /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_components19.BaseControl.VisualLabel, { as: "legend", children: (0, import_i18n45.__)("Area") }),
            /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "fields-create-template-part-modal__area-radio-group", children: (defaultTemplatePartAreas ?? []).map(
              (item) => {
                const icon = getTemplatePartIcon2(item.icon);
                return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
                  "div",
                  {
                    className: "fields-create-template-part-modal__area-radio-wrapper",
                    children: [
                      /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
                        "input",
                        {
                          type: "radio",
                          id: getAreaRadioId(
                            item.area,
                            instanceId
                          ),
                          name: `fields-create-template-part-modal__area-${instanceId}`,
                          value: item.area,
                          checked: area === item.area,
                          onChange: () => {
                            setArea(item.area);
                          },
                          "aria-describedby": getAreaRadioDescriptionId(
                            item.area,
                            instanceId
                          )
                        }
                      ),
                      /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
                        import_components19.Icon,
                        {
                          icon,
                          className: "fields-create-template-part-modal__area-radio-icon"
                        }
                      ),
                      /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
                        "label",
                        {
                          htmlFor: getAreaRadioId(
                            item.area,
                            instanceId
                          ),
                          className: "fields-create-template-part-modal__area-radio-label",
                          children: item.label
                        }
                      ),
                      /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
                        import_components19.Icon,
                        {
                          icon: check_default,
                          className: "fields-create-template-part-modal__area-radio-checkmark"
                        }
                      ),
                      /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
                        "p",
                        {
                          className: "fields-create-template-part-modal__area-radio-description",
                          id: getAreaRadioDescriptionId(
                            item.area,
                            instanceId
                          ),
                          children: item.description
                        }
                      )
                    ]
                  },
                  item.area
                );
              }
            ) })
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_components19.__experimentalHStack, { justify: "right", children: [
            /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
              import_components19.Button,
              {
                __next40pxDefaultSize: true,
                variant: "tertiary",
                onClick: () => {
                  closeModal2();
                },
                children: (0, import_i18n45.__)("Cancel")
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
              import_components19.Button,
              {
                __next40pxDefaultSize: true,
                variant: "primary",
                type: "submit",
                "aria-disabled": !title || isSubmitting,
                isBusy: isSubmitting,
                children: confirmLabel
              }
            )
          ] })
        ] })
      }
    );
  }

  // packages/fields/build-module/actions/duplicate-template-part.mjs
  var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
  var duplicateTemplatePart = {
    id: "duplicate-template-part",
    label: (0, import_i18n46._x)("Duplicate", "action label"),
    isEligible: (item) => item.type === "wp_template_part",
    modalHeader: (0, import_i18n46._x)("Duplicate template part", "action label"),
    modalFocusOnMount: "firstContentElement",
    RenderModal: ({ items, closeModal: closeModal2 }) => {
      const [item] = items;
      const blocks = (0, import_element19.useMemo)(() => {
        return item.blocks ?? (0, import_blocks6.parse)(
          typeof item.content === "string" ? item.content : item.content.raw,
          {
            __unstableSkipMigrationLogs: true
          }
        );
      }, [item.content, item.blocks]);
      const { createSuccessNotice } = (0, import_data21.useDispatch)(import_notices13.store);
      function onTemplatePartSuccess(templatePart) {
        createSuccessNotice(
          (0, import_i18n46.sprintf)(
            // translators: %s: The new template part's title e.g. 'Call to action (copy)'.
            (0, import_i18n46._x)('"%s" duplicated.', "template part"),
            getItemTitle(templatePart)
          ),
          { type: "snackbar", id: "edit-site-patterns-success" }
        );
        closeModal2?.();
      }
      return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
        CreateTemplatePartModalContents,
        {
          blocks,
          defaultArea: item.area,
          defaultTitle: (0, import_i18n46.sprintf)(
            /* translators: %s: Existing template part title */
            (0, import_i18n46._x)("%s (Copy)", "template part"),
            getItemTitle(item)
          ),
          onCreate: onTemplatePartSuccess,
          onError: closeModal2,
          confirmLabel: (0, import_i18n46._x)("Duplicate", "action label"),
          closeModal: closeModal2 ?? (() => {
          })
        }
      );
    }
  };
  var duplicate_template_part_default = duplicateTemplatePart;

  // packages/editor/build-module/dataviews/fields/content-preview/index.mjs
  var import_i18n107 = __toESM(require_i18n(), 1);

  // packages/editor/build-module/dataviews/fields/content-preview/content-preview-view.mjs
  var import_i18n106 = __toESM(require_i18n(), 1);
  var import_block_editor34 = __toESM(require_block_editor(), 1);
  var import_data64 = __toESM(require_data(), 1);
  var import_core_data44 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/provider/index.mjs
  var import_element37 = __toESM(require_element(), 1);
  var import_data48 = __toESM(require_data(), 1);
  var import_i18n60 = __toESM(require_i18n(), 1);
  var import_core_data30 = __toESM(require_core_data(), 1);
  var import_block_editor18 = __toESM(require_block_editor(), 1);
  var import_notices16 = __toESM(require_notices(), 1);
  var import_patterns7 = __toESM(require_patterns(), 1);
  var import_blocks13 = __toESM(require_blocks(), 1);

  // packages/editor/build-module/components/provider/with-registry-provider.mjs
  var import_element20 = __toESM(require_element(), 1);
  var import_data22 = __toESM(require_data(), 1);
  var import_compose5 = __toESM(require_compose(), 1);
  var import_block_editor5 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
  function getSubRegistry(subRegistries, registry, useSubRegistry) {
    if (!useSubRegistry) {
      return registry;
    }
    let subRegistry = subRegistries.get(registry);
    if (!subRegistry) {
      subRegistry = (0, import_data22.createRegistry)(
        {
          "core/block-editor": import_block_editor5.storeConfig
        },
        registry
      );
      subRegistry.registerStore("core/editor", storeConfig);
      subRegistries.set(registry, subRegistry);
    }
    return subRegistry;
  }
  var withRegistryProvider = (0, import_compose5.createHigherOrderComponent)(
    (WrappedComponent) => ({ useSubRegistry = true, ...props }) => {
      const registry = (0, import_data22.useRegistry)();
      const [subRegistries] = (0, import_element20.useState)(() => /* @__PURE__ */ new WeakMap());
      const subRegistry = getSubRegistry(
        subRegistries,
        registry,
        useSubRegistry
      );
      if (subRegistry === registry) {
        return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(WrappedComponent, { registry, ...props });
      }
      return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_data22.RegistryProvider, { value: subRegistry, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(WrappedComponent, { registry: subRegistry, ...props }) });
    },
    "withRegistryProvider"
  );
  var with_registry_provider_default = withRegistryProvider;

  // packages/editor/build-module/components/provider/use-block-editor-settings.mjs
  var import_element22 = __toESM(require_element(), 1);
  var import_data27 = __toESM(require_data(), 1);
  var import_core_data23 = __toESM(require_core_data(), 1);
  var import_i18n49 = __toESM(require_i18n(), 1);
  var import_preferences3 = __toESM(require_preferences(), 1);
  var import_compose6 = __toESM(require_compose(), 1);
  var import_blocks9 = __toESM(require_blocks(), 1);
  var import_block_editor7 = __toESM(require_block_editor(), 1);

  // packages/editor/build-module/components/media-categories/index.mjs
  var import_i18n47 = __toESM(require_i18n(), 1);
  var import_data23 = __toESM(require_data(), 1);
  var import_html_entities7 = __toESM(require_html_entities(), 1);
  var import_core_data20 = __toESM(require_core_data(), 1);
  var getExternalLink = (url, text) => `<a ${getExternalLinkAttributes(url)}>${text}</a>`;
  var getExternalLinkAttributes = (url) => `href="${url}" target="_blank" rel="noreferrer noopener"`;
  var getOpenverseLicense = (license, licenseVersion) => {
    let licenseName = license.trim();
    if (license !== "pdm") {
      licenseName = license.toUpperCase().replace("SAMPLING", "Sampling");
    }
    if (licenseVersion) {
      licenseName += ` ${licenseVersion}`;
    }
    if (!["pdm", "cc0"].includes(license)) {
      licenseName = `CC ${licenseName}`;
    }
    return licenseName;
  };
  var getOpenverseCaption = (item) => {
    const {
      title,
      foreign_landing_url: foreignLandingUrl,
      creator,
      creator_url: creatorUrl,
      license,
      license_version: licenseVersion,
      license_url: licenseUrl
    } = item;
    const fullLicense = getOpenverseLicense(license, licenseVersion);
    const _creator = (0, import_html_entities7.decodeEntities)(creator);
    let _caption;
    if (_creator) {
      _caption = title ? (0, import_i18n47.sprintf)(
        // translators: %1s: Title of a media work from Openverse; %2$s: Name of the work's creator; %3s: Work's licence e.g: "CC0 1.0".
        (0, import_i18n47._x)('"%1$s" by %2$s/ %3$s', "caption"),
        getExternalLink(
          foreignLandingUrl,
          (0, import_html_entities7.decodeEntities)(title)
        ),
        creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator,
        licenseUrl ? getExternalLink(
          `${licenseUrl}?ref=openverse`,
          fullLicense
        ) : fullLicense
      ) : (0, import_i18n47.sprintf)(
        // translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: "CC0 1.0".
        (0, import_i18n47._x)("<a %1$s>Work</a> by %2$s/ %3$s", "caption"),
        getExternalLinkAttributes(foreignLandingUrl),
        creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator,
        licenseUrl ? getExternalLink(
          `${licenseUrl}?ref=openverse`,
          fullLicense
        ) : fullLicense
      );
    } else {
      _caption = title ? (0, import_i18n47.sprintf)(
        // translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: "CC0 1.0".
        (0, import_i18n47._x)('"%1$s"/ %2$s', "caption"),
        getExternalLink(
          foreignLandingUrl,
          (0, import_html_entities7.decodeEntities)(title)
        ),
        licenseUrl ? getExternalLink(
          `${licenseUrl}?ref=openverse`,
          fullLicense
        ) : fullLicense
      ) : (0, import_i18n47.sprintf)(
        // translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: "CC0 1.0".
        (0, import_i18n47._x)("<a %1$s>Work</a>/ %2$s", "caption"),
        getExternalLinkAttributes(foreignLandingUrl),
        licenseUrl ? getExternalLink(
          `${licenseUrl}?ref=openverse`,
          fullLicense
        ) : fullLicense
      );
    }
    return _caption.replace(/\s{2}/g, " ");
  };
  var coreMediaFetch = async (query = {}) => {
    const mediaItems = await (0, import_data23.resolveSelect)(import_core_data20.store).getEntityRecords(
      "postType",
      "attachment",
      {
        ...query,
        orderBy: !!query?.search ? "relevance" : "date"
      }
    );
    return mediaItems.map((mediaItem) => ({
      ...mediaItem,
      alt: mediaItem.alt_text,
      url: mediaItem.source_url,
      previewUrl: mediaItem.media_details?.sizes?.medium?.source_url,
      caption: mediaItem.caption?.raw
    }));
  };
  var inserterMediaCategories = [
    {
      name: "images",
      labels: {
        name: (0, import_i18n47.__)("Images"),
        search_items: (0, import_i18n47.__)("Search images")
      },
      mediaType: "image",
      async fetch(query = {}) {
        return coreMediaFetch({ ...query, media_type: "image" });
      }
    },
    {
      name: "videos",
      labels: {
        name: (0, import_i18n47.__)("Videos"),
        search_items: (0, import_i18n47.__)("Search videos")
      },
      mediaType: "video",
      async fetch(query = {}) {
        return coreMediaFetch({ ...query, media_type: "video" });
      }
    },
    {
      name: "audio",
      labels: {
        name: (0, import_i18n47.__)("Audio"),
        search_items: (0, import_i18n47.__)("Search audio")
      },
      mediaType: "audio",
      async fetch(query = {}) {
        return coreMediaFetch({ ...query, media_type: "audio" });
      }
    },
    {
      name: "openverse",
      labels: {
        name: (0, import_i18n47.__)("Openverse"),
        search_items: (0, import_i18n47.__)("Search Openverse")
      },
      mediaType: "image",
      async fetch(query = {}) {
        const defaultArgs = {
          mature: false,
          excluded_source: "flickr,inaturalist,wikimedia",
          license: "pdm,cc0"
        };
        const finalQuery = { ...query, ...defaultArgs };
        const mapFromInserterMediaRequest = {
          per_page: "page_size",
          search: "q"
        };
        const url = new URL("https://api.openverse.org/v1/images/");
        Object.entries(finalQuery).forEach(([key, value]) => {
          const queryKey = mapFromInserterMediaRequest[key] || key;
          url.searchParams.set(queryKey, value);
        });
        const response = await window.fetch(url, {
          headers: {
            "User-Agent": "WordPress/inserter-media-fetch"
          }
        });
        const jsonResponse = await response.json();
        const results = jsonResponse.results;
        return results.map((result) => ({
          ...result,
          // This is a temp solution for better titles, until Openverse API
          // completes the cleaning up of some titles of their upstream data.
          title: result.title?.toLowerCase().startsWith("file:") ? result.title.slice(5) : result.title,
          sourceId: result.id,
          id: void 0,
          caption: getOpenverseCaption(result),
          previewUrl: result.thumbnail
        }));
      },
      getReportUrl: ({ sourceId }) => `https://wordpress.org/openverse/image/${sourceId}/report/`,
      isExternalResource: true
    }
  ];
  var media_categories_default = inserterMediaCategories;

  // node_modules/uuid/dist/esm-browser/rng.js
  var getRandomValues;
  var rnds8 = new Uint8Array(16);
  function rng() {
    if (!getRandomValues) {
      getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
      if (!getRandomValues) {
        throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
      }
    }
    return getRandomValues(rnds8);
  }

  // node_modules/uuid/dist/esm-browser/stringify.js
  var byteToHex = [];
  for (let i3 = 0; i3 < 256; ++i3) {
    byteToHex.push((i3 + 256).toString(16).slice(1));
  }
  function unsafeStringify(arr, offset3 = 0) {
    return byteToHex[arr[offset3 + 0]] + byteToHex[arr[offset3 + 1]] + byteToHex[arr[offset3 + 2]] + byteToHex[arr[offset3 + 3]] + "-" + byteToHex[arr[offset3 + 4]] + byteToHex[arr[offset3 + 5]] + "-" + byteToHex[arr[offset3 + 6]] + byteToHex[arr[offset3 + 7]] + "-" + byteToHex[arr[offset3 + 8]] + byteToHex[arr[offset3 + 9]] + "-" + byteToHex[arr[offset3 + 10]] + byteToHex[arr[offset3 + 11]] + byteToHex[arr[offset3 + 12]] + byteToHex[arr[offset3 + 13]] + byteToHex[arr[offset3 + 14]] + byteToHex[arr[offset3 + 15]];
  }

  // node_modules/uuid/dist/esm-browser/native.js
  var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
  var native_default = {
    randomUUID
  };

  // node_modules/uuid/dist/esm-browser/v4.js
  function v4(options, buf, offset3) {
    if (native_default.randomUUID && !buf && !options) {
      return native_default.randomUUID();
    }
    options = options || {};
    const rnds = options.random || (options.rng || rng)();
    rnds[6] = rnds[6] & 15 | 64;
    rnds[8] = rnds[8] & 63 | 128;
    if (buf) {
      offset3 = offset3 || 0;
      for (let i3 = 0; i3 < 16; ++i3) {
        buf[offset3 + i3] = rnds[i3];
      }
      return buf;
    }
    return unsafeStringify(rnds);
  }
  var v4_default = v4;

  // packages/editor/build-module/utils/media-upload/index.mjs
  var import_data24 = __toESM(require_data(), 1);
  var import_core_data21 = __toESM(require_core_data(), 1);
  var import_media_utils2 = __toESM(require_media_utils(), 1);
  var noop = () => {
  };
  function mediaUpload({
    additionalData = {},
    allowedTypes,
    filesList,
    maxUploadFileSize,
    onError = noop,
    onFileChange,
    onSuccess,
    multiple = true
  }) {
    const { receiveEntityRecords } = (0, import_data24.dispatch)(import_core_data21.store);
    const { getCurrentPost: getCurrentPost2, getEditorSettings: getEditorSettings2 } = (0, import_data24.select)(store);
    const {
      lockPostAutosaving: lockPostAutosaving2,
      unlockPostAutosaving: unlockPostAutosaving2,
      lockPostSaving: lockPostSaving2,
      unlockPostSaving: unlockPostSaving2
    } = (0, import_data24.dispatch)(store);
    const wpAllowedMimeTypes = getEditorSettings2().allowedMimeTypes;
    const lockKey = `image-upload-${v4_default()}`;
    let imageIsUploading = false;
    maxUploadFileSize = maxUploadFileSize || getEditorSettings2().maxUploadFileSize;
    const currentPost = getCurrentPost2();
    const currentPostId = typeof currentPost?.id === "number" ? currentPost.id : currentPost?.wp_id;
    const setSaveLock = () => {
      lockPostSaving2(lockKey);
      lockPostAutosaving2(lockKey);
      imageIsUploading = true;
    };
    const postData = currentPostId ? { post: currentPostId } : {};
    const clearSaveLock = () => {
      unlockPostSaving2(lockKey);
      unlockPostAutosaving2(lockKey);
      imageIsUploading = false;
    };
    (0, import_media_utils2.uploadMedia)({
      allowedTypes,
      filesList,
      onFileChange: (file) => {
        if (!imageIsUploading) {
          setSaveLock();
        } else {
          clearSaveLock();
        }
        onFileChange?.(file);
        const entityFiles = file.filter((_file) => _file?.id);
        if (entityFiles?.length) {
          const invalidateCache = true;
          receiveEntityRecords(
            "postType",
            "attachment",
            entityFiles,
            void 0,
            invalidateCache
          );
        }
      },
      onSuccess,
      additionalData: {
        ...postData,
        ...additionalData
      },
      maxUploadFileSize,
      onError: ({ message }) => {
        clearSaveLock();
        onError(message);
      },
      wpAllowedMimeTypes,
      multiple
    });
  }

  // packages/editor/build-module/utils/url.mjs
  var import_url7 = __toESM(require_url(), 1);
  var import_deprecated3 = __toESM(require_deprecated(), 1);
  function cleanForSlug3(string) {
    (0, import_deprecated3.default)("wp.editor.cleanForSlug", {
      since: "12.7",
      plugin: "Gutenberg",
      alternative: "wp.url.cleanForSlug"
    });
    return (0, import_url7.cleanForSlug)(string);
  }

  // packages/editor/build-module/utils/media-sideload/index.mjs
  var import_media_utils3 = __toESM(require_media_utils(), 1);
  var { sideloadMedia: mediaSideload } = unlock(import_media_utils3.privateApis);
  var media_sideload_default = mediaSideload;

  // packages/editor/build-module/components/global-styles-provider/index.mjs
  var import_block_editor6 = __toESM(require_block_editor(), 1);
  var import_core_data22 = __toESM(require_core_data(), 1);
  var import_data26 = __toESM(require_data(), 1);
  var import_element21 = __toESM(require_element(), 1);

  // packages/global-styles-engine/build-module/utils/object.mjs
  function setImmutably(object, path, value) {
    path = Array.isArray(path) ? [...path] : [path];
    object = Array.isArray(object) ? [...object] : { ...object };
    const leaf = path.pop();
    let prev = object;
    for (const key of path) {
      const lvl = prev[key];
      prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl };
    }
    prev[leaf] = value;
    return object;
  }
  var getValueFromObjectPath = (object, path, defaultValue) => {
    const arrayPath = Array.isArray(path) ? path : path.split(".");
    let value = object;
    arrayPath.forEach((fieldName) => {
      value = value?.[fieldName];
    });
    return value ?? defaultValue;
  };

  // packages/global-styles-engine/build-module/settings/get-setting.mjs
  var VALID_SETTINGS = [
    "appearanceTools",
    "useRootPaddingAwareAlignments",
    "background.backgroundImage",
    "background.backgroundRepeat",
    "background.backgroundSize",
    "background.backgroundPosition",
    "border.color",
    "border.radius",
    "border.radiusSizes",
    "border.style",
    "border.width",
    "shadow.presets",
    "shadow.defaultPresets",
    "color.background",
    "color.button",
    "color.caption",
    "color.custom",
    "color.customDuotone",
    "color.customGradient",
    "color.defaultDuotone",
    "color.defaultGradients",
    "color.defaultPalette",
    "color.duotone",
    "color.gradients",
    "color.heading",
    "color.link",
    "color.palette",
    "color.text",
    "custom",
    "dimensions.aspectRatio",
    "dimensions.height",
    "dimensions.minHeight",
    "dimensions.width",
    "dimensions.dimensionSizes",
    "layout.contentSize",
    "layout.definitions",
    "layout.wideSize",
    "lightbox.enabled",
    "lightbox.allowEditing",
    "position.fixed",
    "position.sticky",
    "spacing.customSpacingSize",
    "spacing.defaultSpacingSizes",
    "spacing.spacingSizes",
    "spacing.spacingScale",
    "spacing.blockGap",
    "spacing.margin",
    "spacing.padding",
    "spacing.units",
    "typography.fluid",
    "typography.customFontSize",
    "typography.defaultFontSizes",
    "typography.dropCap",
    "typography.fontFamilies",
    "typography.fontSizes",
    "typography.fontStyle",
    "typography.fontWeight",
    "typography.letterSpacing",
    "typography.lineHeight",
    "typography.textAlign",
    "typography.textColumns",
    "typography.textDecoration",
    "typography.textTransform",
    "typography.writingMode"
  ];
  function getSetting(globalStyles, path, blockName) {
    const appendedBlockPath = blockName ? ".blocks." + blockName : "";
    const appendedPropertyPath = path ? "." + path : "";
    const contextualPath = `settings${appendedBlockPath}${appendedPropertyPath}`;
    const globalPath = `settings${appendedPropertyPath}`;
    if (path) {
      return getValueFromObjectPath(globalStyles, contextualPath) ?? getValueFromObjectPath(globalStyles, globalPath);
    }
    let result = {};
    VALID_SETTINGS.forEach((setting) => {
      const value = getValueFromObjectPath(
        globalStyles,
        `settings${appendedBlockPath}.${setting}`
      ) ?? getValueFromObjectPath(globalStyles, `settings.${setting}`);
      if (value !== void 0) {
        result = setImmutably(result, setting.split("."), value);
      }
    });
    return result;
  }

  // packages/global-styles-engine/build-module/settings/set-setting.mjs
  function setSetting(globalStyles, path, newValue, blockName) {
    const appendedBlockPath = blockName ? ".blocks." + blockName : "";
    const appendedPropertyPath = path ? "." + path : "";
    const finalPath = `settings${appendedBlockPath}${appendedPropertyPath}`;
    return setImmutably(
      globalStyles,
      finalPath.split("."),
      newValue
    );
  }

  // packages/global-styles-engine/build-module/utils/common.mjs
  var import_style_engine = __toESM(require_style_engine(), 1);

  // packages/global-styles-engine/build-module/utils/fluid.mjs
  var DEFAULT_MAXIMUM_VIEWPORT_WIDTH = "1600px";
  var DEFAULT_MINIMUM_VIEWPORT_WIDTH = "320px";
  var DEFAULT_SCALE_FACTOR = 1;
  var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN = 0.25;
  var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX = 0.75;
  var DEFAULT_MINIMUM_FONT_SIZE_LIMIT = "14px";
  function getComputedFluidTypographyValue({
    minimumFontSize,
    maximumFontSize,
    fontSize,
    minimumViewportWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH,
    maximumViewportWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH,
    scaleFactor = DEFAULT_SCALE_FACTOR,
    minimumFontSizeLimit
  }) {
    minimumFontSizeLimit = !!getTypographyValueAndUnit(minimumFontSizeLimit) ? minimumFontSizeLimit : DEFAULT_MINIMUM_FONT_SIZE_LIMIT;
    if (fontSize) {
      const fontSizeParsed = getTypographyValueAndUnit(fontSize);
      if (!fontSizeParsed?.unit || !fontSizeParsed?.value) {
        return null;
      }
      const minimumFontSizeLimitParsed = getTypographyValueAndUnit(
        minimumFontSizeLimit,
        {
          coerceTo: fontSizeParsed.unit
        }
      );
      if (!!minimumFontSizeLimitParsed?.value && !minimumFontSize && !maximumFontSize) {
        if (fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value) {
          return null;
        }
      }
      if (!maximumFontSize) {
        maximumFontSize = `${fontSizeParsed.value}${fontSizeParsed.unit}`;
      }
      if (!minimumFontSize) {
        const fontSizeValueInPx = fontSizeParsed.unit === "px" ? fontSizeParsed.value : fontSizeParsed.value * 16;
        const minimumFontSizeFactor = Math.min(
          Math.max(
            1 - 0.075 * Math.log2(fontSizeValueInPx),
            DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN
          ),
          DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX
        );
        const calculatedMinimumFontSize = roundToPrecision(
          fontSizeParsed.value * minimumFontSizeFactor,
          3
        );
        if (!!minimumFontSizeLimitParsed?.value && calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value) {
          minimumFontSize = `${minimumFontSizeLimitParsed.value}${minimumFontSizeLimitParsed.unit}`;
        } else {
          minimumFontSize = `${calculatedMinimumFontSize}${fontSizeParsed.unit}`;
        }
      }
    }
    const minimumFontSizeParsed = getTypographyValueAndUnit(minimumFontSize);
    const fontSizeUnit = minimumFontSizeParsed?.unit || "rem";
    const maximumFontSizeParsed = getTypographyValueAndUnit(maximumFontSize, {
      coerceTo: fontSizeUnit
    });
    if (!minimumFontSizeParsed || !maximumFontSizeParsed) {
      return null;
    }
    const minimumFontSizeRem = getTypographyValueAndUnit(minimumFontSize, {
      coerceTo: "rem"
    });
    const maximumViewportWidthParsed = getTypographyValueAndUnit(
      maximumViewportWidth,
      { coerceTo: fontSizeUnit }
    );
    const minimumViewportWidthParsed = getTypographyValueAndUnit(
      minimumViewportWidth,
      { coerceTo: fontSizeUnit }
    );
    if (!maximumViewportWidthParsed || !minimumViewportWidthParsed || !minimumFontSizeRem) {
      return null;
    }
    const linearDenominator = maximumViewportWidthParsed.value - minimumViewportWidthParsed.value;
    if (!linearDenominator) {
      return null;
    }
    const minViewportWidthOffsetValue = roundToPrecision(
      minimumViewportWidthParsed.value / 100,
      3
    );
    const viewportWidthOffset = roundToPrecision(minViewportWidthOffsetValue, 3) + fontSizeUnit;
    const linearFactor = 100 * ((maximumFontSizeParsed.value - minimumFontSizeParsed.value) / linearDenominator);
    const linearFactorScaled = roundToPrecision(
      (linearFactor || 1) * scaleFactor,
      3
    );
    const fluidTargetFontSize = `${minimumFontSizeRem.value}${minimumFontSizeRem.unit} + ((1vw - ${viewportWidthOffset}) * ${linearFactorScaled})`;
    return `clamp(${minimumFontSize}, ${fluidTargetFontSize}, ${maximumFontSize})`;
  }
  function getTypographyValueAndUnit(rawValue, options = {}) {
    if (typeof rawValue !== "string" && typeof rawValue !== "number") {
      return null;
    }
    if (isFinite(rawValue)) {
      rawValue = `${rawValue}px`;
    }
    const { coerceTo, rootSizeValue, acceptableUnits } = {
      coerceTo: "",
      // Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`.
      rootSizeValue: 16,
      acceptableUnits: ["rem", "px", "em"],
      ...options
    };
    const acceptableUnitsGroup = acceptableUnits?.join("|");
    const regexUnits = new RegExp(
      `^(\\d*\\.?\\d+)(${acceptableUnitsGroup}){1,1}$`
    );
    const matches = rawValue.toString().match(regexUnits);
    if (!matches || matches.length < 3) {
      return null;
    }
    let [, value, unit] = matches;
    let returnValue = parseFloat(value);
    if ("px" === coerceTo && ("em" === unit || "rem" === unit)) {
      returnValue = returnValue * rootSizeValue;
      unit = coerceTo;
    }
    if ("px" === unit && ("em" === coerceTo || "rem" === coerceTo)) {
      returnValue = returnValue / rootSizeValue;
      unit = coerceTo;
    }
    if (("em" === coerceTo || "rem" === coerceTo) && ("em" === unit || "rem" === unit)) {
      unit = coerceTo;
    }
    if (!unit) {
      return null;
    }
    return {
      value: roundToPrecision(returnValue, 3),
      unit
    };
  }
  function roundToPrecision(value, digits = 3) {
    const base = Math.pow(10, digits);
    return Math.round(value * base) / base;
  }

  // packages/global-styles-engine/build-module/utils/typography.mjs
  function isFluidTypographyEnabled(typographySettings) {
    const fluidSettings = typographySettings?.fluid;
    return true === fluidSettings || fluidSettings && typeof fluidSettings === "object" && Object.keys(fluidSettings).length > 0;
  }
  function getFluidTypographyOptionsFromSettings(settings) {
    const typographySettings = settings?.typography ?? {};
    const layoutSettings = settings?.layout;
    const defaultMaxViewportWidth = getTypographyValueAndUnit(
      layoutSettings?.wideSize
    ) ? layoutSettings?.wideSize : null;
    return isFluidTypographyEnabled(typographySettings) && defaultMaxViewportWidth ? {
      fluid: {
        maxViewportWidth: defaultMaxViewportWidth,
        ...typeof typographySettings.fluid === "object" ? typographySettings.fluid : {}
      }
    } : {
      fluid: typographySettings?.fluid
    };
  }
  function getTypographyFontSizeValue(preset, settings) {
    const { size: defaultSize } = preset;
    if (!defaultSize || "0" === defaultSize || false === preset?.fluid) {
      return defaultSize;
    }
    if (!isFluidTypographyEnabled(settings?.typography) && !isFluidTypographyEnabled(preset)) {
      return defaultSize;
    }
    const fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings)?.fluid ?? {};
    const fluidFontSizeValue = getComputedFluidTypographyValue({
      minimumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.min,
      maximumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.max,
      fontSize: defaultSize,
      minimumFontSizeLimit: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minFontSize : void 0,
      maximumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.maxViewportWidth : void 0,
      minimumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minViewportWidth : void 0
    });
    if (!!fluidFontSizeValue) {
      return fluidFontSizeValue;
    }
    return defaultSize;
  }

  // packages/global-styles-engine/build-module/utils/common.mjs
  var ROOT_BLOCK_SELECTOR = "body";
  var ROOT_CSS_PROPERTIES_SELECTOR = ":root";
  var PRESET_METADATA = [
    {
      path: ["color", "palette"],
      valueKey: "color",
      cssVarInfix: "color",
      classes: [
        { classSuffix: "color", propertyName: "color" },
        {
          classSuffix: "background-color",
          propertyName: "background-color"
        },
        {
          classSuffix: "border-color",
          propertyName: "border-color"
        }
      ]
    },
    {
      path: ["color", "gradients"],
      valueKey: "gradient",
      cssVarInfix: "gradient",
      classes: [
        {
          classSuffix: "gradient-background",
          propertyName: "background"
        }
      ]
    },
    {
      path: ["color", "duotone"],
      valueKey: "colors",
      cssVarInfix: "duotone",
      valueFunc: ({ slug }) => `url( '#wp-duotone-${slug}' )`,
      classes: []
    },
    {
      path: ["shadow", "presets"],
      valueKey: "shadow",
      cssVarInfix: "shadow",
      classes: []
    },
    {
      path: ["typography", "fontSizes"],
      valueFunc: (preset, settings) => getTypographyFontSizeValue(preset, settings),
      valueKey: "size",
      cssVarInfix: "font-size",
      classes: [{ classSuffix: "font-size", propertyName: "font-size" }]
    },
    {
      path: ["typography", "fontFamilies"],
      valueKey: "fontFamily",
      cssVarInfix: "font-family",
      classes: [
        { classSuffix: "font-family", propertyName: "font-family" }
      ]
    },
    {
      path: ["spacing", "spacingSizes"],
      valueKey: "size",
      cssVarInfix: "spacing",
      valueFunc: ({ size: size3 }) => size3,
      classes: []
    },
    {
      path: ["border", "radiusSizes"],
      valueKey: "size",
      cssVarInfix: "border-radius",
      classes: []
    },
    {
      path: ["dimensions", "dimensionSizes"],
      valueKey: "size",
      cssVarInfix: "dimension",
      classes: []
    }
  ];
  function scopeSelector(scope, selector) {
    if (!scope || !selector) {
      return selector;
    }
    const scopes = scope.split(",");
    const selectors = selector.split(",");
    const selectorsScoped = [];
    scopes.forEach((outer) => {
      selectors.forEach((inner) => {
        selectorsScoped.push(`${outer.trim()} ${inner.trim()}`);
      });
    });
    return selectorsScoped.join(", ");
  }
  function scopeFeatureSelectors(scope, selectors) {
    if (!scope || !selectors) {
      return;
    }
    const featureSelectors = {};
    Object.entries(selectors).forEach(([feature, selector]) => {
      if (typeof selector === "string") {
        featureSelectors[feature] = scopeSelector(scope, selector);
      }
      if (typeof selector === "object") {
        featureSelectors[feature] = {};
        Object.entries(selector).forEach(
          ([subfeature, subfeatureSelector]) => {
            featureSelectors[feature][subfeature] = scopeSelector(
              scope,
              subfeatureSelector
            );
          }
        );
      }
    });
    return featureSelectors;
  }
  function appendToSelector(selector, toAppend) {
    if (!selector.includes(",")) {
      return selector + toAppend;
    }
    const selectors = selector.split(",");
    const newSelectors = selectors.map((sel) => sel + toAppend);
    return newSelectors.join(",");
  }
  function getBlockStyleVariationSelector(variation, blockSelector) {
    const variationClass = `.is-style-${variation}`;
    if (!blockSelector) {
      return variationClass;
    }
    const ancestorRegex = /((?::\([^)]+\))?\s*)([^\s:]+)/;
    const addVariationClass = (_match, group1, group2) => {
      return group1 + group2 + variationClass;
    };
    const result = blockSelector.split(",").map((part) => part.replace(ancestorRegex, addVariationClass));
    return result.join(",");
  }
  function getResolvedRefValue(ruleValue, tree) {
    if (!ruleValue || !tree) {
      return ruleValue;
    }
    if (typeof ruleValue === "object" && "ref" in ruleValue && ruleValue?.ref) {
      const resolvedRuleValue = (0, import_style_engine.getCSSValueFromRawStyle)(
        getValueFromObjectPath(tree, ruleValue.ref)
      );
      if (typeof resolvedRuleValue === "object" && resolvedRuleValue !== null && "ref" in resolvedRuleValue && resolvedRuleValue?.ref) {
        return void 0;
      }
      if (resolvedRuleValue === void 0) {
        return ruleValue;
      }
      return resolvedRuleValue;
    }
    return ruleValue;
  }
  function getResolvedThemeFilePath(file, themeFileURIs) {
    if (!file || !themeFileURIs || !Array.isArray(themeFileURIs)) {
      return file;
    }
    const uri = themeFileURIs.find(
      (themeFileUri) => themeFileUri?.name === file
    );
    if (!uri?.href) {
      return file;
    }
    return uri?.href;
  }
  function getResolvedValue(ruleValue, tree) {
    if (!ruleValue || !tree) {
      return ruleValue;
    }
    const resolvedValue = getResolvedRefValue(ruleValue, tree);
    if (typeof resolvedValue === "object" && resolvedValue !== null && "url" in resolvedValue && resolvedValue?.url) {
      resolvedValue.url = getResolvedThemeFilePath(
        resolvedValue.url,
        tree?._links?.["wp:theme-file"]
      );
    }
    return resolvedValue;
  }
  function findInPresetsBy(settings, blockName, presetPath = [], presetProperty = "slug", presetValueValue) {
    const orderedPresetsByOrigin = [
      blockName ? getValueFromObjectPath(settings, [
        "blocks",
        blockName,
        ...presetPath
      ]) : void 0,
      getValueFromObjectPath(settings, presetPath)
    ].filter(Boolean);
    for (const presetByOrigin of orderedPresetsByOrigin) {
      if (presetByOrigin) {
        const origins = ["custom", "theme", "default"];
        for (const origin of origins) {
          const presets = presetByOrigin[origin];
          if (presets) {
            const presetObject = presets.find(
              (preset) => preset[presetProperty] === presetValueValue
            );
            if (presetObject) {
              if (presetProperty === "slug") {
                return presetObject;
              }
              const highestPresetObjectWithSameSlug = findInPresetsBy(
                settings,
                blockName,
                presetPath,
                "slug",
                presetObject.slug
              );
              if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) {
                return presetObject;
              }
              return void 0;
            }
          }
        }
      }
    }
  }
  function getValueFromPresetVariable(features, blockName, variable, [presetType, slug] = []) {
    const metadata = PRESET_METADATA.find(
      (data) => data.cssVarInfix === presetType
    );
    if (!metadata || !features.settings) {
      return variable;
    }
    const presetObject = findInPresetsBy(
      features.settings,
      blockName,
      metadata.path,
      "slug",
      slug
    );
    if (presetObject) {
      const { valueKey } = metadata;
      const result = presetObject[valueKey];
      return getValueFromVariable(features, blockName, result);
    }
    return variable;
  }
  function getValueFromCustomVariable(features, blockName, variable, path = []) {
    const result = (blockName ? getValueFromObjectPath(features?.settings ?? {}, [
      "blocks",
      blockName,
      "custom",
      ...path
    ]) : void 0) ?? getValueFromObjectPath(features?.settings ?? {}, [
      "custom",
      ...path
    ]);
    if (!result) {
      return variable;
    }
    return getValueFromVariable(features, blockName, result);
  }
  function getValueFromVariable(features, blockName, variable) {
    if (!variable || typeof variable !== "string") {
      if (typeof variable === "object" && variable !== null && "ref" in variable && typeof variable.ref === "string") {
        const resolvedVariable = getValueFromObjectPath(
          features,
          variable.ref
        );
        if (!resolvedVariable || typeof resolvedVariable === "object" && "ref" in resolvedVariable) {
          return resolvedVariable;
        }
        variable = resolvedVariable;
      } else {
        return variable;
      }
    }
    const USER_VALUE_PREFIX = "var:";
    const THEME_VALUE_PREFIX = "var(--wp--";
    const THEME_VALUE_SUFFIX = ")";
    let parsedVar;
    if (variable.startsWith(USER_VALUE_PREFIX)) {
      parsedVar = variable.slice(USER_VALUE_PREFIX.length).split("|");
    } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) {
      parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split("--");
    } else {
      return variable;
    }
    const [type, ...path] = parsedVar;
    if (type === "preset") {
      return getValueFromPresetVariable(
        features,
        blockName,
        variable,
        path
      );
    }
    if (type === "custom") {
      return getValueFromCustomVariable(
        features,
        blockName,
        variable,
        path
      );
    }
    return variable;
  }

  // packages/global-styles-engine/build-module/settings/get-style.mjs
  function getStyle(globalStyles, path, blockName, shouldDecodeEncode = true) {
    const appendedPath = path ? "." + path : "";
    const finalPath = !blockName ? `styles${appendedPath}` : `styles.blocks.${blockName}${appendedPath}`;
    if (!globalStyles) {
      return void 0;
    }
    const rawResult = getValueFromObjectPath(globalStyles, finalPath);
    const result = shouldDecodeEncode ? getValueFromVariable(globalStyles, blockName, rawResult) : rawResult;
    return result;
  }

  // packages/global-styles-engine/build-module/settings/set-style.mjs
  function setStyle(globalStyles, path, newValue, blockName) {
    const appendedPath = path ? "." + path : "";
    const finalPath = !blockName ? `styles${appendedPath}` : `styles.blocks.${blockName}${appendedPath}`;
    return setImmutably(
      globalStyles,
      finalPath.split("."),
      newValue
    );
  }

  // packages/global-styles-engine/build-module/core/equal.mjs
  var import_es6 = __toESM(require_es6(), 1);
  function areGlobalStylesEqual(original, variation) {
    if (typeof original !== "object" || typeof variation !== "object") {
      return original === variation;
    }
    return (0, import_es6.default)(original?.styles, variation?.styles) && (0, import_es6.default)(original?.settings, variation?.settings);
  }

  // packages/global-styles-engine/build-module/core/merge.mjs
  var import_deepmerge = __toESM(require_cjs(), 1);

  // node_modules/is-plain-object/dist/is-plain-object.mjs
  function isObject(o4) {
    return Object.prototype.toString.call(o4) === "[object Object]";
  }
  function isPlainObject(o4) {
    var ctor, prot;
    if (isObject(o4) === false) return false;
    ctor = o4.constructor;
    if (ctor === void 0) return true;
    prot = ctor.prototype;
    if (isObject(prot) === false) return false;
    if (prot.hasOwnProperty("isPrototypeOf") === false) {
      return false;
    }
    return true;
  }

  // packages/global-styles-engine/build-module/core/merge.mjs
  function mergeGlobalStyles(base, user) {
    return (0, import_deepmerge.default)(base, user, {
      /*
       * We only pass as arrays the presets,
       * in which case we want the new array of values
       * to override the old array (no merging).
       */
      isMergeableObject: isPlainObject,
      /*
       * Exceptions to the above rule.
       * Background images should be replaced, not merged,
       * as they themselves are specific object definitions for the style.
       */
      customMerge: (key) => {
        if (key === "backgroundImage") {
          return (baseConfig, userConfig) => userConfig ?? baseConfig;
        }
        return void 0;
      }
    });
  }

  // node_modules/memize/dist/index.js
  function memize(fn, options) {
    var size3 = 0;
    var head2;
    var tail;
    options = options || {};
    function memoized() {
      var node = head2, len = arguments.length, args, i3;
      searchCache: while (node) {
        if (node.args.length !== arguments.length) {
          node = node.next;
          continue;
        }
        for (i3 = 0; i3 < len; i3++) {
          if (node.args[i3] !== arguments[i3]) {
            node = node.next;
            continue searchCache;
          }
        }
        if (node !== head2) {
          if (node === tail) {
            tail = node.prev;
          }
          node.prev.next = node.next;
          if (node.next) {
            node.next.prev = node.prev;
          }
          node.next = head2;
          node.prev = null;
          head2.prev = node;
          head2 = node;
        }
        return node.val;
      }
      args = new Array(len);
      for (i3 = 0; i3 < len; i3++) {
        args[i3] = arguments[i3];
      }
      node = {
        args,
        // Generate the result from original function
        val: fn.apply(null, args)
      };
      if (head2) {
        head2.prev = node;
        node.next = head2;
      } else {
        tail = node;
      }
      if (size3 === /** @type {MemizeOptions} */
      options.maxSize) {
        tail = /** @type {MemizeCacheNode} */
        tail.prev;
        tail.next = null;
      } else {
        size3++;
      }
      head2 = node;
      return node.val;
    }
    memoized.clear = function() {
      head2 = null;
      tail = null;
      size3 = 0;
    };
    return memoized;
  }

  // packages/global-styles-engine/build-module/utils/get-global-styles-changes.mjs
  var import_i18n48 = __toESM(require_i18n(), 1);
  var import_blocks7 = __toESM(require_blocks(), 1);
  var globalStylesChangesCache = /* @__PURE__ */ new Map();
  var EMPTY_ARRAY2 = [];
  var translationMap = {
    caption: (0, import_i18n48.__)("Caption"),
    link: (0, import_i18n48.__)("Link"),
    button: (0, import_i18n48.__)("Button"),
    heading: (0, import_i18n48.__)("Heading"),
    h1: (0, import_i18n48.__)("H1"),
    h2: (0, import_i18n48.__)("H2"),
    h3: (0, import_i18n48.__)("H3"),
    h4: (0, import_i18n48.__)("H4"),
    h5: (0, import_i18n48.__)("H5"),
    h6: (0, import_i18n48.__)("H6"),
    "settings.color": (0, import_i18n48.__)("Color"),
    "settings.typography": (0, import_i18n48.__)("Typography"),
    "settings.shadow": (0, import_i18n48.__)("Shadow"),
    "settings.layout": (0, import_i18n48.__)("Layout"),
    "styles.color": (0, import_i18n48.__)("Colors"),
    "styles.spacing": (0, import_i18n48.__)("Spacing"),
    "styles.background": (0, import_i18n48.__)("Background"),
    "styles.typography": (0, import_i18n48.__)("Typography")
  };
  var getBlockNames = memize(
    () => (0, import_blocks7.getBlockTypes)().reduce(
      (accumulator, {
        name: name2,
        title
      }) => {
        accumulator[name2] = title;
        return accumulator;
      },
      {}
    )
  );
  var isObject2 = (obj) => obj !== null && typeof obj === "object";
  function getTranslation(key) {
    if (translationMap[key]) {
      return translationMap[key];
    }
    const keyArray = key.split(".");
    if (keyArray?.[0] === "blocks") {
      const blockName = getBlockNames()?.[keyArray[1]];
      return blockName || keyArray[1];
    }
    if (keyArray?.[0] === "elements") {
      return translationMap[keyArray[1]] || keyArray[1];
    }
    return void 0;
  }
  function deepCompare(changedObject, originalObject, parentPath = "") {
    if (!isObject2(changedObject) && !isObject2(originalObject)) {
      return changedObject !== originalObject ? parentPath.split(".").slice(0, 2).join(".") : void 0;
    }
    changedObject = isObject2(changedObject) ? changedObject : {};
    originalObject = isObject2(originalObject) ? originalObject : {};
    const allKeys = /* @__PURE__ */ new Set([
      ...Object.keys(changedObject),
      ...Object.keys(originalObject)
    ]);
    let diffs = [];
    for (const key of allKeys) {
      const path = parentPath ? parentPath + "." + key : key;
      const changedPath = deepCompare(
        changedObject[key],
        originalObject[key],
        path
      );
      if (changedPath) {
        diffs = diffs.concat(changedPath);
      }
    }
    return diffs;
  }
  function getGlobalStylesChangelist(next, previous) {
    const cacheKey = JSON.stringify({ next, previous });
    if (globalStylesChangesCache.has(cacheKey)) {
      return globalStylesChangesCache.get(cacheKey);
    }
    const changedValueTree = deepCompare(
      {
        styles: {
          background: next?.styles?.background,
          color: next?.styles?.color,
          typography: next?.styles?.typography,
          spacing: next?.styles?.spacing
        },
        blocks: next?.styles?.blocks,
        elements: next?.styles?.elements,
        settings: next?.settings
      },
      {
        styles: {
          background: previous?.styles?.background,
          color: previous?.styles?.color,
          typography: previous?.styles?.typography,
          spacing: previous?.styles?.spacing
        },
        blocks: previous?.styles?.blocks,
        elements: previous?.styles?.elements,
        settings: previous?.settings
      }
    );
    if (!changedValueTree || Array.isArray(changedValueTree) && !changedValueTree.length) {
      globalStylesChangesCache.set(cacheKey, []);
      return [];
    }
    const changedValueArray = Array.isArray(changedValueTree) ? changedValueTree : [changedValueTree];
    const result = [...new Set(changedValueArray)].reduce((acc, curr) => {
      const translation = getTranslation(curr);
      if (translation) {
        acc.push([curr.split(".")[0], translation]);
      }
      return acc;
    }, []);
    globalStylesChangesCache.set(cacheKey, result);
    return result;
  }
  function getGlobalStylesChanges(next, previous, options = {}) {
    let changeList = getGlobalStylesChangelist(next, previous);
    const changesLength = changeList.length;
    const { maxResults } = options;
    if (changesLength) {
      if (!!maxResults && changesLength > maxResults) {
        changeList = changeList.slice(0, maxResults);
      }
      return Object.entries(
        changeList.reduce((acc, curr) => {
          const group = acc[curr[0]] || [];
          if (!group.includes(curr[1])) {
            acc[curr[0]] = [...group, curr[1]];
          }
          return acc;
        }, {})
      ).map(([key, changeValues]) => {
        const changeValuesLength = changeValues.length;
        const joinedChangesValue = changeValues.join(
          /* translators: Used between list items, there is a space after the comma. */
          (0, import_i18n48.__)(", ")
          // eslint-disable-line @wordpress/i18n-no-flanking-whitespace
        );
        switch (key) {
          case "blocks": {
            return (0, import_i18n48.sprintf)(
              // translators: %s: a list of block names separated by a comma.
              (0, import_i18n48._n)("%s block.", "%s blocks.", changeValuesLength),
              joinedChangesValue
            );
          }
          case "elements": {
            return (0, import_i18n48.sprintf)(
              // translators: %s: a list of element names separated by a comma.
              (0, import_i18n48._n)("%s element.", "%s elements.", changeValuesLength),
              joinedChangesValue
            );
          }
          case "settings": {
            return (0, import_i18n48.sprintf)(
              // translators: %s: a list of theme.json setting labels separated by a comma.
              (0, import_i18n48.__)("%s settings."),
              joinedChangesValue
            );
          }
          case "styles": {
            return (0, import_i18n48.sprintf)(
              // translators: %s: a list of theme.json top-level styles labels separated by a comma.
              (0, import_i18n48.__)("%s styles."),
              joinedChangesValue
            );
          }
          default: {
            return (0, import_i18n48.sprintf)(
              // translators: %s: a list of global styles changes separated by a comma.
              (0, import_i18n48.__)("%s."),
              joinedChangesValue
            );
          }
        }
      });
    }
    return EMPTY_ARRAY2;
  }

  // packages/global-styles-engine/build-module/core/render.mjs
  var import_blocks8 = __toESM(require_blocks(), 1);
  var import_style_engine2 = __toESM(require_style_engine(), 1);
  var import_data25 = __toESM(require_data(), 1);

  // packages/global-styles-engine/build-module/core/selectors.mjs
  function getBlockSelector(blockType, target = "root", options = {}) {
    if (!target) {
      return null;
    }
    const { fallback = false } = options;
    const { name: name2, selectors, supports } = blockType;
    const hasSelectors = selectors && Object.keys(selectors).length > 0;
    const path = Array.isArray(target) ? target.join(".") : target;
    let rootSelector = null;
    if (hasSelectors && selectors.root) {
      rootSelector = selectors?.root;
    } else if (supports?.__experimentalSelector) {
      rootSelector = supports.__experimentalSelector;
    } else {
      rootSelector = ".wp-block-" + name2.replace("core/", "").replace("/", "-");
    }
    if (path === "root") {
      return rootSelector;
    }
    const pathArray = Array.isArray(target) ? target : target.split(".");
    if (pathArray.length === 1) {
      const fallbackSelector = fallback ? rootSelector : null;
      if (hasSelectors) {
        const featureSelector2 = getValueFromObjectPath(
          selectors,
          `${path}.root`,
          null
        ) || getValueFromObjectPath(selectors, path, null);
        return featureSelector2 || fallbackSelector;
      }
      const featureSelector = supports ? getValueFromObjectPath(
        supports,
        `${path}.__experimentalSelector`,
        null
      ) : void 0;
      if (!featureSelector) {
        return fallbackSelector;
      }
      return scopeSelector(rootSelector, featureSelector);
    }
    let subfeatureSelector;
    if (hasSelectors) {
      subfeatureSelector = getValueFromObjectPath(selectors, path, null);
    }
    if (subfeatureSelector) {
      return subfeatureSelector;
    }
    if (fallback) {
      return getBlockSelector(blockType, pathArray[0], options);
    }
    return null;
  }

  // node_modules/colord/index.mjs
  var r3 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) };
  var t2 = function(r4) {
    return "string" == typeof r4 ? r4.length > 0 : "number" == typeof r4;
  };
  var n2 = function(r4, t4, n3) {
    return void 0 === t4 && (t4 = 0), void 0 === n3 && (n3 = Math.pow(10, t4)), Math.round(n3 * r4) / n3 + 0;
  };
  var e2 = function(r4, t4, n3) {
    return void 0 === t4 && (t4 = 0), void 0 === n3 && (n3 = 1), r4 > n3 ? n3 : r4 > t4 ? r4 : t4;
  };
  var u2 = function(r4) {
    return (r4 = isFinite(r4) ? r4 % 360 : 0) > 0 ? r4 : r4 + 360;
  };
  var a2 = function(r4) {
    return { r: e2(r4.r, 0, 255), g: e2(r4.g, 0, 255), b: e2(r4.b, 0, 255), a: e2(r4.a) };
  };
  var o2 = function(r4) {
    return { r: n2(r4.r), g: n2(r4.g), b: n2(r4.b), a: n2(r4.a, 3) };
  };
  var i2 = /^#([0-9a-f]{3,8})$/i;
  var s2 = function(r4) {
    var t4 = r4.toString(16);
    return t4.length < 2 ? "0" + t4 : t4;
  };
  var h2 = function(r4) {
    var t4 = r4.r, n3 = r4.g, e3 = r4.b, u3 = r4.a, a3 = Math.max(t4, n3, e3), o4 = a3 - Math.min(t4, n3, e3), i3 = o4 ? a3 === t4 ? (n3 - e3) / o4 : a3 === n3 ? 2 + (e3 - t4) / o4 : 4 + (t4 - n3) / o4 : 0;
    return { h: 60 * (i3 < 0 ? i3 + 6 : i3), s: a3 ? o4 / a3 * 100 : 0, v: a3 / 255 * 100, a: u3 };
  };
  var b2 = function(r4) {
    var t4 = r4.h, n3 = r4.s, e3 = r4.v, u3 = r4.a;
    t4 = t4 / 360 * 6, n3 /= 100, e3 /= 100;
    var a3 = Math.floor(t4), o4 = e3 * (1 - n3), i3 = e3 * (1 - (t4 - a3) * n3), s3 = e3 * (1 - (1 - t4 + a3) * n3), h3 = a3 % 6;
    return { r: 255 * [e3, i3, o4, o4, s3, e3][h3], g: 255 * [s3, e3, e3, i3, o4, o4][h3], b: 255 * [o4, o4, s3, e3, e3, i3][h3], a: u3 };
  };
  var g2 = function(r4) {
    return { h: u2(r4.h), s: e2(r4.s, 0, 100), l: e2(r4.l, 0, 100), a: e2(r4.a) };
  };
  var d2 = function(r4) {
    return { h: n2(r4.h), s: n2(r4.s), l: n2(r4.l), a: n2(r4.a, 3) };
  };
  var f2 = function(r4) {
    return b2((n3 = (t4 = r4).s, { h: t4.h, s: (n3 *= ((e3 = t4.l) < 50 ? e3 : 100 - e3) / 100) > 0 ? 2 * n3 / (e3 + n3) * 100 : 0, v: e3 + n3, a: t4.a }));
    var t4, n3, e3;
  };
  var c = function(r4) {
    return { h: (t4 = h2(r4)).h, s: (u3 = (200 - (n3 = t4.s)) * (e3 = t4.v) / 100) > 0 && u3 < 200 ? n3 * e3 / 100 / (u3 <= 100 ? u3 : 200 - u3) * 100 : 0, l: u3 / 2, a: t4.a };
    var t4, n3, e3, u3;
  };
  var l2 = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
  var p3 = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
  var v2 = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
  var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
  var y2 = { string: [[function(r4) {
    var t4 = i2.exec(r4);
    return t4 ? (r4 = t4[1]).length <= 4 ? { r: parseInt(r4[0] + r4[0], 16), g: parseInt(r4[1] + r4[1], 16), b: parseInt(r4[2] + r4[2], 16), a: 4 === r4.length ? n2(parseInt(r4[3] + r4[3], 16) / 255, 2) : 1 } : 6 === r4.length || 8 === r4.length ? { r: parseInt(r4.substr(0, 2), 16), g: parseInt(r4.substr(2, 2), 16), b: parseInt(r4.substr(4, 2), 16), a: 8 === r4.length ? n2(parseInt(r4.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
  }, "hex"], [function(r4) {
    var t4 = v2.exec(r4) || m.exec(r4);
    return t4 ? t4[2] !== t4[4] || t4[4] !== t4[6] ? null : a2({ r: Number(t4[1]) / (t4[2] ? 100 / 255 : 1), g: Number(t4[3]) / (t4[4] ? 100 / 255 : 1), b: Number(t4[5]) / (t4[6] ? 100 / 255 : 1), a: void 0 === t4[7] ? 1 : Number(t4[7]) / (t4[8] ? 100 : 1) }) : null;
  }, "rgb"], [function(t4) {
    var n3 = l2.exec(t4) || p3.exec(t4);
    if (!n3) return null;
    var e3, u3, a3 = g2({ h: (e3 = n3[1], u3 = n3[2], void 0 === u3 && (u3 = "deg"), Number(e3) * (r3[u3] || 1)), s: Number(n3[3]), l: Number(n3[4]), a: void 0 === n3[5] ? 1 : Number(n3[5]) / (n3[6] ? 100 : 1) });
    return f2(a3);
  }, "hsl"]], object: [[function(r4) {
    var n3 = r4.r, e3 = r4.g, u3 = r4.b, o4 = r4.a, i3 = void 0 === o4 ? 1 : o4;
    return t2(n3) && t2(e3) && t2(u3) ? a2({ r: Number(n3), g: Number(e3), b: Number(u3), a: Number(i3) }) : null;
  }, "rgb"], [function(r4) {
    var n3 = r4.h, e3 = r4.s, u3 = r4.l, a3 = r4.a, o4 = void 0 === a3 ? 1 : a3;
    if (!t2(n3) || !t2(e3) || !t2(u3)) return null;
    var i3 = g2({ h: Number(n3), s: Number(e3), l: Number(u3), a: Number(o4) });
    return f2(i3);
  }, "hsl"], [function(r4) {
    var n3 = r4.h, a3 = r4.s, o4 = r4.v, i3 = r4.a, s3 = void 0 === i3 ? 1 : i3;
    if (!t2(n3) || !t2(a3) || !t2(o4)) return null;
    var h3 = (function(r5) {
      return { h: u2(r5.h), s: e2(r5.s, 0, 100), v: e2(r5.v, 0, 100), a: e2(r5.a) };
    })({ h: Number(n3), s: Number(a3), v: Number(o4), a: Number(s3) });
    return b2(h3);
  }, "hsv"]] };
  var N2 = function(r4, t4) {
    for (var n3 = 0; n3 < t4.length; n3++) {
      var e3 = t4[n3][0](r4);
      if (e3) return [e3, t4[n3][1]];
    }
    return [null, void 0];
  };
  var x = function(r4) {
    return "string" == typeof r4 ? N2(r4.trim(), y2.string) : "object" == typeof r4 && null !== r4 ? N2(r4, y2.object) : [null, void 0];
  };
  var M = function(r4, t4) {
    var n3 = c(r4);
    return { h: n3.h, s: e2(n3.s + 100 * t4, 0, 100), l: n3.l, a: n3.a };
  };
  var H = function(r4) {
    return (299 * r4.r + 587 * r4.g + 114 * r4.b) / 1e3 / 255;
  };
  var $ = function(r4, t4) {
    var n3 = c(r4);
    return { h: n3.h, s: n3.s, l: e2(n3.l + 100 * t4, 0, 100), a: n3.a };
  };
  var j = (function() {
    function r4(r5) {
      this.parsed = x(r5)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
    }
    return r4.prototype.isValid = function() {
      return null !== this.parsed;
    }, r4.prototype.brightness = function() {
      return n2(H(this.rgba), 2);
    }, r4.prototype.isDark = function() {
      return H(this.rgba) < 0.5;
    }, r4.prototype.isLight = function() {
      return H(this.rgba) >= 0.5;
    }, r4.prototype.toHex = function() {
      return r5 = o2(this.rgba), t4 = r5.r, e3 = r5.g, u3 = r5.b, i3 = (a3 = r5.a) < 1 ? s2(n2(255 * a3)) : "", "#" + s2(t4) + s2(e3) + s2(u3) + i3;
      var r5, t4, e3, u3, a3, i3;
    }, r4.prototype.toRgb = function() {
      return o2(this.rgba);
    }, r4.prototype.toRgbString = function() {
      return r5 = o2(this.rgba), t4 = r5.r, n3 = r5.g, e3 = r5.b, (u3 = r5.a) < 1 ? "rgba(" + t4 + ", " + n3 + ", " + e3 + ", " + u3 + ")" : "rgb(" + t4 + ", " + n3 + ", " + e3 + ")";
      var r5, t4, n3, e3, u3;
    }, r4.prototype.toHsl = function() {
      return d2(c(this.rgba));
    }, r4.prototype.toHslString = function() {
      return r5 = d2(c(this.rgba)), t4 = r5.h, n3 = r5.s, e3 = r5.l, (u3 = r5.a) < 1 ? "hsla(" + t4 + ", " + n3 + "%, " + e3 + "%, " + u3 + ")" : "hsl(" + t4 + ", " + n3 + "%, " + e3 + "%)";
      var r5, t4, n3, e3, u3;
    }, r4.prototype.toHsv = function() {
      return r5 = h2(this.rgba), { h: n2(r5.h), s: n2(r5.s), v: n2(r5.v), a: n2(r5.a, 3) };
      var r5;
    }, r4.prototype.invert = function() {
      return w2({ r: 255 - (r5 = this.rgba).r, g: 255 - r5.g, b: 255 - r5.b, a: r5.a });
      var r5;
    }, r4.prototype.saturate = function(r5) {
      return void 0 === r5 && (r5 = 0.1), w2(M(this.rgba, r5));
    }, r4.prototype.desaturate = function(r5) {
      return void 0 === r5 && (r5 = 0.1), w2(M(this.rgba, -r5));
    }, r4.prototype.grayscale = function() {
      return w2(M(this.rgba, -1));
    }, r4.prototype.lighten = function(r5) {
      return void 0 === r5 && (r5 = 0.1), w2($(this.rgba, r5));
    }, r4.prototype.darken = function(r5) {
      return void 0 === r5 && (r5 = 0.1), w2($(this.rgba, -r5));
    }, r4.prototype.rotate = function(r5) {
      return void 0 === r5 && (r5 = 15), this.hue(this.hue() + r5);
    }, r4.prototype.alpha = function(r5) {
      return "number" == typeof r5 ? w2({ r: (t4 = this.rgba).r, g: t4.g, b: t4.b, a: r5 }) : n2(this.rgba.a, 3);
      var t4;
    }, r4.prototype.hue = function(r5) {
      var t4 = c(this.rgba);
      return "number" == typeof r5 ? w2({ h: r5, s: t4.s, l: t4.l, a: t4.a }) : n2(t4.h);
    }, r4.prototype.isEqual = function(r5) {
      return this.toHex() === w2(r5).toHex();
    }, r4;
  })();
  var w2 = function(r4) {
    return r4 instanceof j ? r4 : new j(r4);
  };
  var S2 = [];
  var k = function(r4) {
    r4.forEach(function(r5) {
      S2.indexOf(r5) < 0 && (r5(j, y2), S2.push(r5));
    });
  };

  // packages/global-styles-engine/build-module/utils/duotone.mjs
  function getValuesFromColors(colors = []) {
    const values = {
      r: [],
      g: [],
      b: [],
      a: []
    };
    colors.forEach((color) => {
      const rgbColor = w2(color).toRgb();
      values.r.push(rgbColor.r / 255);
      values.g.push(rgbColor.g / 255);
      values.b.push(rgbColor.b / 255);
      values.a.push(rgbColor.a);
    });
    return values;
  }
  function getDuotoneFilter(id, colors) {
    const values = getValuesFromColors(colors);
    return `
<svg
	xmlns:xlink="http://www.w3.org/1999/xlink"
	viewBox="0 0 0 0"
	width="0"
	height="0"
	focusable="false"
	role="none"
	aria-hidden="true"
	style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;"
>
	<defs>
		<filter id="${id}">
			<!--
				Use sRGB instead of linearRGB so transparency looks correct.
				Use perceptual brightness to convert to grayscale.
			-->
			<feColorMatrix color-interpolation-filters="sRGB" type="matrix" values=" .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "></feColorMatrix>
			<!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. -->
			<feComponentTransfer color-interpolation-filters="sRGB">
				<feFuncR type="table" tableValues="${values.r.join(" ")}"></feFuncR>
				<feFuncG type="table" tableValues="${values.g.join(" ")}"></feFuncG>
				<feFuncB type="table" tableValues="${values.b.join(" ")}"></feFuncB>
				<feFuncA type="table" tableValues="${values.a.join(" ")}"></feFuncA>
			</feComponentTransfer>
			<!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. -->
			<feComposite in2="SourceGraphic" operator="in"></feComposite>
		</filter>
	</defs>
</svg>`;
  }

  // packages/global-styles-engine/build-module/utils/string.mjs
  function kebabCase(str) {
    return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([0-9])([a-zA-Z])/g, "$1-$2").replace(/([a-zA-Z])([0-9])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
  }

  // packages/global-styles-engine/build-module/utils/spacing.mjs
  function getSpacingPresetCssVar(value) {
    if (!value) {
      return;
    }
    const slug = value.match(/var:preset\|spacing\|(.+)/);
    if (!slug) {
      return value;
    }
    return `var(--wp--preset--spacing--${slug[1]})`;
  }

  // packages/global-styles-engine/build-module/utils/gap.mjs
  function getGapBoxControlValueFromStyle(blockGapValue) {
    if (!blockGapValue) {
      return null;
    }
    const isValueString = typeof blockGapValue === "string";
    return {
      top: isValueString ? blockGapValue : blockGapValue?.top,
      left: isValueString ? blockGapValue : blockGapValue?.left
    };
  }
  function getGapCSSValue(blockGapValue, defaultValue = "0") {
    const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue);
    if (!blockGapBoxControlValue) {
      return null;
    }
    const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue;
    const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue;
    return row === column ? row : `${row} ${column}`;
  }

  // packages/global-styles-engine/build-module/utils/background.mjs
  var BACKGROUND_BLOCK_DEFAULT_VALUES = {
    backgroundSize: "cover",
    backgroundPosition: "50% 50%"
    // used only when backgroundSize is 'contain'.
  };
  function setBackgroundStyleDefaults(backgroundStyle) {
    if (!backgroundStyle || // @ts-expect-error
    !backgroundStyle?.backgroundImage?.url) {
      return;
    }
    let backgroundStylesWithDefaults;
    if (!backgroundStyle?.backgroundSize) {
      backgroundStylesWithDefaults = {
        backgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize
      };
    }
    if ("contain" === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) {
      backgroundStylesWithDefaults = {
        backgroundPosition: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition
      };
    }
    return backgroundStylesWithDefaults;
  }

  // packages/global-styles-engine/build-module/utils/layout.mjs
  var LAYOUT_DEFINITIONS = {
    default: {
      name: "default",
      slug: "flow",
      className: "is-layout-flow",
      baseStyles: [
        {
          selector: " > .alignleft",
          rules: {
            float: "left",
            "margin-inline-start": "0",
            "margin-inline-end": "2em"
          }
        },
        {
          selector: " > .alignright",
          rules: {
            float: "right",
            "margin-inline-start": "2em",
            "margin-inline-end": "0"
          }
        },
        {
          selector: " > .aligncenter",
          rules: {
            "margin-left": "auto !important",
            "margin-right": "auto !important"
          }
        }
      ],
      spacingStyles: [
        {
          selector: " > :first-child",
          rules: {
            "margin-block-start": "0"
          }
        },
        {
          selector: " > :last-child",
          rules: {
            "margin-block-end": "0"
          }
        },
        {
          selector: " > *",
          rules: {
            "margin-block-start": null,
            "margin-block-end": "0"
          }
        }
      ]
    },
    constrained: {
      name: "constrained",
      slug: "constrained",
      className: "is-layout-constrained",
      baseStyles: [
        {
          selector: " > .alignleft",
          rules: {
            float: "left",
            "margin-inline-start": "0",
            "margin-inline-end": "2em"
          }
        },
        {
          selector: " > .alignright",
          rules: {
            float: "right",
            "margin-inline-start": "2em",
            "margin-inline-end": "0"
          }
        },
        {
          selector: " > .aligncenter",
          rules: {
            "margin-left": "auto !important",
            "margin-right": "auto !important"
          }
        },
        {
          selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))",
          rules: {
            "max-width": "var(--wp--style--global--content-size)",
            "margin-left": "auto !important",
            "margin-right": "auto !important"
          }
        },
        {
          selector: " > .alignwide",
          rules: {
            "max-width": "var(--wp--style--global--wide-size)"
          }
        }
      ],
      spacingStyles: [
        {
          selector: " > :first-child",
          rules: {
            "margin-block-start": "0"
          }
        },
        {
          selector: " > :last-child",
          rules: {
            "margin-block-end": "0"
          }
        },
        {
          selector: " > *",
          rules: {
            "margin-block-start": null,
            "margin-block-end": "0"
          }
        }
      ]
    },
    flex: {
      name: "flex",
      slug: "flex",
      className: "is-layout-flex",
      displayMode: "flex",
      baseStyles: [
        {
          selector: "",
          rules: {
            "flex-wrap": "wrap",
            "align-items": "center"
          }
        },
        {
          selector: " > :is(*, div)",
          // :is(*, div) instead of just * increases the specificity by 001.
          rules: {
            margin: "0"
          }
        }
      ],
      spacingStyles: [
        {
          selector: "",
          rules: {
            gap: null
          }
        }
      ]
    },
    grid: {
      name: "grid",
      slug: "grid",
      className: "is-layout-grid",
      displayMode: "grid",
      baseStyles: [
        {
          selector: " > :is(*, div)",
          // :is(*, div) instead of just * increases the specificity by 001.
          rules: {
            margin: "0"
          }
        }
      ],
      spacingStyles: [
        {
          selector: "",
          rules: {
            gap: null
          }
        }
      ]
    }
  };

  // packages/global-styles-engine/build-module/core/render.mjs
  var ELEMENT_CLASS_NAMES = {
    button: "wp-element-button",
    caption: "wp-element-caption"
  };
  var BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {
    __experimentalBorder: "border",
    color: "color",
    dimensions: "dimensions",
    spacing: "spacing",
    typography: "typography"
  };
  function getPresetsDeclarations(blockPresets = {}, mergedSettings) {
    return PRESET_METADATA.reduce(
      (declarations, { path, valueKey, valueFunc, cssVarInfix }) => {
        const presetByOrigin = getValueFromObjectPath(
          blockPresets,
          path,
          []
        );
        ["default", "theme", "custom"].forEach((origin) => {
          if (presetByOrigin[origin]) {
            presetByOrigin[origin].forEach((value) => {
              if (valueKey && !valueFunc) {
                declarations.push(
                  `--wp--preset--${cssVarInfix}--${kebabCase(
                    value.slug
                  )}: ${value[valueKey]}`
                );
              } else if (valueFunc && typeof valueFunc === "function") {
                declarations.push(
                  `--wp--preset--${cssVarInfix}--${kebabCase(
                    value.slug
                  )}: ${valueFunc(value, mergedSettings)}`
                );
              }
            });
          }
        });
        return declarations;
      },
      []
    );
  }
  function getPresetsClasses(blockSelector = "*", blockPresets = {}) {
    return PRESET_METADATA.reduce(
      (declarations, { path, cssVarInfix, classes }) => {
        if (!classes) {
          return declarations;
        }
        const presetByOrigin = getValueFromObjectPath(
          blockPresets,
          path,
          []
        );
        ["default", "theme", "custom"].forEach((origin) => {
          if (presetByOrigin[origin]) {
            presetByOrigin[origin].forEach(
              ({ slug }) => {
                classes.forEach(
                  ({
                    classSuffix,
                    propertyName
                  }) => {
                    const classSelectorToUse = `.has-${kebabCase(
                      slug
                    )}-${classSuffix}`;
                    const selectorToUse = blockSelector.split(",").map(
                      (selector) => `${selector}${classSelectorToUse}`
                    ).join(",");
                    const value = `var(--wp--preset--${cssVarInfix}--${kebabCase(
                      slug
                    )})`;
                    declarations += `${selectorToUse}{${propertyName}: ${value} !important;}`;
                  }
                );
              }
            );
          }
        });
        return declarations;
      },
      ""
    );
  }
  function getPresetsSvgFilters(blockPresets = {}) {
    return PRESET_METADATA.filter(
      // Duotone are the only type of filters for now.
      (metadata) => metadata.path.at(-1) === "duotone"
    ).flatMap((metadata) => {
      const presetByOrigin = getValueFromObjectPath(
        blockPresets,
        metadata.path,
        {}
      );
      return ["default", "theme"].filter((origin) => presetByOrigin[origin]).flatMap(
        (origin) => presetByOrigin[origin].map(
          (preset) => getDuotoneFilter(
            `wp-duotone-${preset.slug}`,
            preset.colors
          )
        )
      ).join("");
    });
  }
  function flattenTree(input = {}, prefix, token) {
    let result = [];
    Object.keys(input).forEach((key) => {
      const newKey = prefix + kebabCase(key.replace("/", "-"));
      const newLeaf = input[key];
      if (newLeaf instanceof Object) {
        const newPrefix = newKey + token;
        result = [...result, ...flattenTree(newLeaf, newPrefix, token)];
      } else {
        result.push(`${newKey}: ${newLeaf}`);
      }
    });
    return result;
  }
  function concatFeatureVariationSelectorString(featureSelector, styleVariationSelector) {
    const featureSelectors = featureSelector.split(",");
    const combinedSelectors = [];
    featureSelectors.forEach((selector) => {
      combinedSelectors.push(
        `${styleVariationSelector.trim()}${selector.trim()}`
      );
    });
    return combinedSelectors.join(", ");
  }
  var getFeatureDeclarations = (selectors, styles) => {
    const declarations = {};
    Object.entries(selectors).forEach(([feature, selector]) => {
      if (feature === "root" || !styles?.[feature]) {
        return;
      }
      const isShorthand = typeof selector === "string";
      if (!isShorthand && typeof selector === "object" && selector !== null) {
        Object.entries(selector).forEach(
          ([subfeature, subfeatureSelector]) => {
            if (subfeature === "root" || !styles?.[feature][subfeature]) {
              return;
            }
            const subfeatureStyles = {
              [feature]: {
                [subfeature]: styles[feature][subfeature]
              }
            };
            const newDeclarations = getStylesDeclarations(subfeatureStyles);
            declarations[subfeatureSelector] = [
              ...declarations[subfeatureSelector] || [],
              ...newDeclarations
            ];
            delete styles[feature][subfeature];
          }
        );
      }
      if (isShorthand || typeof selector === "object" && selector !== null && "root" in selector) {
        const featureSelector = isShorthand ? selector : selector.root;
        const featureStyles = { [feature]: styles[feature] };
        const newDeclarations = getStylesDeclarations(featureStyles);
        declarations[featureSelector] = [
          ...declarations[featureSelector] || [],
          ...newDeclarations
        ];
        delete styles[feature];
      }
    });
    return declarations;
  };
  function getStylesDeclarations(blockStyles = {}, selector = "", useRootPaddingAlign, tree = {}, disableRootPadding = false) {
    const isRoot = ROOT_BLOCK_SELECTOR === selector;
    const output = Object.entries(
      import_blocks8.__EXPERIMENTAL_STYLE_PROPERTY
    ).reduce(
      (declarations, [key, { value, properties, useEngine, rootOnly }]) => {
        if (rootOnly && !isRoot) {
          return declarations;
        }
        const pathToValue = value;
        if (pathToValue[0] === "elements" || useEngine) {
          return declarations;
        }
        const styleValue = getValueFromObjectPath(
          blockStyles,
          pathToValue
        );
        if (key === "--wp--style--root--padding" && (typeof styleValue === "string" || !useRootPaddingAlign)) {
          return declarations;
        }
        if (properties && typeof styleValue !== "string") {
          Object.entries(properties).forEach((entry) => {
            const [name2, prop] = entry;
            if (!getValueFromObjectPath(styleValue, [prop], false)) {
              return;
            }
            const cssProperty = name2.startsWith("--") ? name2 : kebabCase(name2);
            declarations.push(
              `${cssProperty}: ${(0, import_style_engine2.getCSSValueFromRawStyle)(
                getValueFromObjectPath(styleValue, [prop])
              )}`
            );
          });
        } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) {
          const cssProperty = key.startsWith("--") ? key : kebabCase(key);
          declarations.push(
            `${cssProperty}: ${(0, import_style_engine2.getCSSValueFromRawStyle)(
              getValueFromObjectPath(blockStyles, pathToValue)
            )}`
          );
        }
        return declarations;
      },
      []
    );
    if (!!blockStyles.background) {
      if (blockStyles.background?.backgroundImage) {
        blockStyles.background.backgroundImage = getResolvedValue(
          blockStyles.background.backgroundImage,
          tree
        );
      }
      if (!isRoot && !!blockStyles.background?.backgroundImage?.id) {
        blockStyles = {
          ...blockStyles,
          background: {
            ...blockStyles.background,
            ...setBackgroundStyleDefaults(blockStyles.background)
          }
        };
      }
    }
    const extraRules = (0, import_style_engine2.getCSSRules)(blockStyles);
    extraRules.forEach((rule) => {
      if (isRoot && (useRootPaddingAlign || disableRootPadding) && rule.key.startsWith("padding")) {
        return;
      }
      const cssProperty = rule.key.startsWith("--") ? rule.key : kebabCase(rule.key);
      let ruleValue = getResolvedValue(rule.value, tree);
      if (cssProperty === "font-size") {
        ruleValue = getTypographyFontSizeValue(
          { name: "", slug: "", size: ruleValue },
          tree?.settings
        );
      }
      if (cssProperty === "aspect-ratio") {
        output.push("min-height: unset");
      }
      output.push(`${cssProperty}: ${ruleValue}`);
    });
    return output;
  }
  function getLayoutStyles({
    layoutDefinitions = LAYOUT_DEFINITIONS,
    style,
    selector,
    hasBlockGapSupport,
    hasFallbackGapSupport,
    fallbackGapValue
  }) {
    let ruleset = "";
    let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : "";
    if (hasFallbackGapSupport) {
      if (selector === ROOT_BLOCK_SELECTOR) {
        gapValue = !gapValue ? "0.5em" : gapValue;
      } else if (!hasBlockGapSupport && fallbackGapValue) {
        gapValue = fallbackGapValue;
      }
    }
    if (gapValue && layoutDefinitions) {
      Object.values(layoutDefinitions).forEach(
        ({ className, name: name2, spacingStyles }) => {
          if (!hasBlockGapSupport && "flex" !== name2 && "grid" !== name2) {
            return;
          }
          if (spacingStyles?.length) {
            spacingStyles.forEach((spacingStyle) => {
              const declarations = [];
              if (spacingStyle.rules) {
                Object.entries(spacingStyle.rules).forEach(
                  ([cssProperty, cssValue]) => {
                    declarations.push(
                      `${cssProperty}: ${cssValue ? cssValue : gapValue}`
                    );
                  }
                );
              }
              if (declarations.length) {
                let combinedSelector = "";
                if (!hasBlockGapSupport) {
                  combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.${className}${spacingStyle?.selector || ""})` : `:where(${selector}.${className}${spacingStyle?.selector || ""})`;
                } else {
                  combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:root :where(.${className})${spacingStyle?.selector || ""}` : `:root :where(${selector}-${className})${spacingStyle?.selector || ""}`;
                }
                ruleset += `${combinedSelector} { ${declarations.join(
                  "; "
                )}; }`;
              }
            });
          }
        }
      );
      if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) {
        ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: ${gapValue}; }`;
      }
    }
    if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) {
      const validDisplayModes = ["block", "flex", "grid"];
      Object.values(layoutDefinitions).forEach(
        ({ className, displayMode, baseStyles }) => {
          if (displayMode && validDisplayModes.includes(displayMode)) {
            ruleset += `${selector} .${className} { display:${displayMode}; }`;
          }
          if (baseStyles?.length) {
            baseStyles.forEach((baseStyle) => {
              const declarations = [];
              if (baseStyle.rules) {
                Object.entries(baseStyle.rules).forEach(
                  ([cssProperty, cssValue]) => {
                    declarations.push(
                      `${cssProperty}: ${cssValue}`
                    );
                  }
                );
              }
              if (declarations.length) {
                const combinedSelector = `.${className}${baseStyle?.selector || ""}`;
                ruleset += `${combinedSelector} { ${declarations.join(
                  "; "
                )}; }`;
              }
            });
          }
        }
      );
    }
    return ruleset;
  }
  var STYLE_KEYS = [
    "border",
    "color",
    "dimensions",
    "spacing",
    "typography",
    "filter",
    "outline",
    "shadow",
    "background"
  ];
  function pickStyleKeys(treeToPickFrom) {
    if (!treeToPickFrom) {
      return {};
    }
    const entries = Object.entries(treeToPickFrom);
    const pickedEntries = entries.filter(
      ([key]) => STYLE_KEYS.includes(key)
    );
    const clonedEntries = pickedEntries.map(([key, style]) => [
      key,
      JSON.parse(JSON.stringify(style))
    ]);
    return Object.fromEntries(clonedEntries);
  }
  var getNodesWithStyles = (tree, blockSelectors) => {
    const nodes = [];
    if (!tree?.styles) {
      return nodes;
    }
    const styles = pickStyleKeys(tree.styles);
    if (styles) {
      nodes.push({
        styles,
        selector: ROOT_BLOCK_SELECTOR,
        // Root selector (body) styles should not be wrapped in `:root where()` to keep
        // specificity at (0,0,1) and maintain backwards compatibility.
        skipSelectorWrapper: true
      });
    }
    Object.entries(import_blocks8.__EXPERIMENTAL_ELEMENTS).forEach(([name2, selector]) => {
      if (tree.styles?.elements?.[name2]) {
        nodes.push({
          styles: tree.styles?.elements?.[name2] ?? {},
          selector,
          // Top level elements that don't use a class name should not receive the
          // `:root :where()` wrapper to maintain backwards compatibility.
          skipSelectorWrapper: !ELEMENT_CLASS_NAMES[name2]
        });
      }
    });
    Object.entries(tree.styles?.blocks ?? {}).forEach(
      ([blockName, node]) => {
        const blockStyles = pickStyleKeys(node);
        const typedNode = node;
        if (typedNode?.variations) {
          const variations = {};
          Object.entries(typedNode.variations).forEach(
            ([variationName, variation]) => {
              const typedVariation = variation;
              variations[variationName] = pickStyleKeys(typedVariation);
              if (typedVariation?.css) {
                variations[variationName].css = typedVariation.css;
              }
              const variationSelector = typeof blockSelectors !== "string" ? blockSelectors[blockName]?.styleVariationSelectors?.[variationName] : void 0;
              Object.entries(
                typedVariation?.elements ?? {}
              ).forEach(([element, elementStyles]) => {
                if (elementStyles && import_blocks8.__EXPERIMENTAL_ELEMENTS[element]) {
                  nodes.push({
                    styles: elementStyles,
                    selector: scopeSelector(
                      variationSelector,
                      import_blocks8.__EXPERIMENTAL_ELEMENTS[element]
                    )
                  });
                }
              });
              Object.entries(typedVariation?.blocks ?? {}).forEach(
                ([
                  variationBlockName,
                  variationBlockStyles
                ]) => {
                  const variationBlockSelector = typeof blockSelectors !== "string" ? scopeSelector(
                    variationSelector,
                    blockSelectors[variationBlockName]?.selector
                  ) : void 0;
                  const variationDuotoneSelector = typeof blockSelectors !== "string" ? scopeSelector(
                    variationSelector,
                    blockSelectors[variationBlockName]?.duotoneSelector
                  ) : void 0;
                  const variationFeatureSelectors = typeof blockSelectors !== "string" ? scopeFeatureSelectors(
                    variationSelector,
                    blockSelectors[variationBlockName]?.featureSelectors ?? {}
                  ) : void 0;
                  const variationBlockStyleNodes = pickStyleKeys(variationBlockStyles);
                  if (variationBlockStyles?.css) {
                    variationBlockStyleNodes.css = variationBlockStyles.css;
                  }
                  if (!variationBlockSelector || typeof blockSelectors === "string") {
                    return;
                  }
                  nodes.push({
                    selector: variationBlockSelector,
                    duotoneSelector: variationDuotoneSelector,
                    featureSelectors: variationFeatureSelectors,
                    fallbackGapValue: blockSelectors[variationBlockName]?.fallbackGapValue,
                    hasLayoutSupport: blockSelectors[variationBlockName]?.hasLayoutSupport,
                    styles: variationBlockStyleNodes
                  });
                  Object.entries(
                    variationBlockStyles.elements ?? {}
                  ).forEach(
                    ([
                      variationBlockElement,
                      variationBlockElementStyles
                    ]) => {
                      if (variationBlockElementStyles && import_blocks8.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) {
                        nodes.push({
                          styles: variationBlockElementStyles,
                          selector: scopeSelector(
                            variationBlockSelector,
                            import_blocks8.__EXPERIMENTAL_ELEMENTS[variationBlockElement]
                          )
                        });
                      }
                    }
                  );
                }
              );
            }
          );
          blockStyles.variations = variations;
        }
        if (typeof blockSelectors !== "string" && blockSelectors?.[blockName]?.selector) {
          nodes.push({
            duotoneSelector: blockSelectors[blockName].duotoneSelector,
            fallbackGapValue: blockSelectors[blockName].fallbackGapValue,
            hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport,
            selector: blockSelectors[blockName].selector,
            styles: blockStyles,
            featureSelectors: blockSelectors[blockName].featureSelectors,
            styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors
          });
        }
        Object.entries(typedNode?.elements ?? {}).forEach(
          ([elementName, value]) => {
            if (typeof blockSelectors !== "string" && value && blockSelectors?.[blockName] && import_blocks8.__EXPERIMENTAL_ELEMENTS[elementName]) {
              nodes.push({
                styles: value,
                selector: blockSelectors[blockName]?.selector.split(",").map((sel) => {
                  const elementSelectors = import_blocks8.__EXPERIMENTAL_ELEMENTS[elementName].split(",");
                  return elementSelectors.map(
                    (elementSelector) => sel + " " + elementSelector
                  );
                }).join(",")
              });
            }
          }
        );
      }
    );
    return nodes;
  };
  var getNodesWithSettings = (tree, blockSelectors) => {
    const nodes = [];
    if (!tree?.settings) {
      return nodes;
    }
    const pickPresets = (treeToPickFrom) => {
      let presets2 = {};
      PRESET_METADATA.forEach(({ path }) => {
        const value = getValueFromObjectPath(treeToPickFrom, path, false);
        if (value !== false) {
          presets2 = setImmutably(presets2, path, value);
        }
      });
      return presets2;
    };
    const presets = pickPresets(tree.settings);
    const custom = tree.settings?.custom;
    if (Object.keys(presets).length > 0 || custom) {
      nodes.push({
        presets,
        custom,
        selector: ROOT_CSS_PROPERTIES_SELECTOR
      });
    }
    Object.entries(tree.settings?.blocks ?? {}).forEach(
      ([blockName, node]) => {
        const blockCustom = node.custom;
        if (typeof blockSelectors === "string" || !blockSelectors[blockName]) {
          return;
        }
        const blockPresets = pickPresets(node);
        if (Object.keys(blockPresets).length > 0 || blockCustom) {
          nodes.push({
            presets: blockPresets,
            custom: blockCustom,
            selector: blockSelectors[blockName]?.selector
          });
        }
      }
    );
    return nodes;
  };
  var generateCustomProperties = (tree, blockSelectors) => {
    const settings = getNodesWithSettings(tree, blockSelectors);
    let ruleset = "";
    settings.forEach(({ presets, custom, selector }) => {
      const declarations = tree?.settings ? getPresetsDeclarations(presets, tree?.settings) : [];
      const customProps = flattenTree(custom, "--wp--custom--", "--");
      if (customProps.length > 0) {
        declarations.push(...customProps);
      }
      if (declarations.length > 0) {
        ruleset += `${selector}{${declarations.join(";")};}`;
      }
    });
    return ruleset;
  };
  var transformToStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, disableRootPadding = false, styleOptions = {}) => {
    const options = {
      blockGap: true,
      blockStyles: true,
      layoutStyles: true,
      marginReset: true,
      presets: true,
      rootPadding: true,
      variationStyles: false,
      ...styleOptions
    };
    const nodesWithStyles = getNodesWithStyles(tree, blockSelectors);
    const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
    const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;
    const { contentSize, wideSize } = tree?.settings?.layout || {};
    const hasBodyStyles = options.marginReset || options.rootPadding || options.layoutStyles;
    let ruleset = "";
    if (options.presets && (contentSize || wideSize)) {
      ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} {`;
      ruleset = contentSize ? ruleset + ` --wp--style--global--content-size: ${contentSize};` : ruleset;
      ruleset = wideSize ? ruleset + ` --wp--style--global--wide-size: ${wideSize};` : ruleset;
      ruleset += "}";
    }
    if (hasBodyStyles) {
      ruleset += ":where(body) {margin: 0;";
      if (options.rootPadding && useRootPaddingAlign) {
        ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
				.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
				.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
				.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; }
				.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0;
				`;
      }
      ruleset += "}";
    }
    if (options.blockStyles) {
      nodesWithStyles.forEach(
        ({
          selector,
          duotoneSelector,
          styles,
          fallbackGapValue,
          hasLayoutSupport,
          featureSelectors,
          styleVariationSelectors,
          skipSelectorWrapper
        }) => {
          if (featureSelectors) {
            const featureDeclarations = getFeatureDeclarations(
              featureSelectors,
              styles
            );
            Object.entries(featureDeclarations).forEach(
              ([cssSelector, declarations]) => {
                if (declarations.length) {
                  const rules = declarations.join(";");
                  ruleset += `:root :where(${cssSelector}){${rules};}`;
                }
              }
            );
          }
          if (duotoneSelector) {
            const duotoneStyles = {};
            if (styles?.filter) {
              duotoneStyles.filter = styles.filter;
              delete styles.filter;
            }
            const duotoneDeclarations = getStylesDeclarations(duotoneStyles);
            if (duotoneDeclarations.length) {
              ruleset += `${duotoneSelector}{${duotoneDeclarations.join(
                ";"
              )};}`;
            }
          }
          if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport)) {
            ruleset += getLayoutStyles({
              style: styles,
              selector,
              hasBlockGapSupport,
              hasFallbackGapSupport,
              fallbackGapValue
            });
          }
          const styleDeclarations = getStylesDeclarations(
            styles,
            selector,
            useRootPaddingAlign,
            tree,
            disableRootPadding
          );
          if (styleDeclarations?.length) {
            const generalSelector = skipSelectorWrapper ? selector : `:root :where(${selector})`;
            ruleset += `${generalSelector}{${styleDeclarations.join(
              ";"
            )};}`;
          }
          if (styles?.css) {
            ruleset += processCSSNesting(
              styles.css,
              `:root :where(${selector})`
            );
          }
          if (options.variationStyles && styleVariationSelectors) {
            Object.entries(styleVariationSelectors).forEach(
              ([styleVariationName, styleVariationSelector]) => {
                const styleVariations = styles?.variations?.[styleVariationName];
                if (styleVariations) {
                  if (featureSelectors) {
                    const featureDeclarations = getFeatureDeclarations(
                      featureSelectors,
                      styleVariations
                    );
                    Object.entries(
                      featureDeclarations
                    ).forEach(
                      ([baseSelector, declarations]) => {
                        if (declarations.length) {
                          const cssSelector = concatFeatureVariationSelectorString(
                            baseSelector,
                            styleVariationSelector
                          );
                          const rules = declarations.join(";");
                          ruleset += `:root :where(${cssSelector}){${rules};}`;
                        }
                      }
                    );
                  }
                  const styleVariationDeclarations = getStylesDeclarations(
                    styleVariations,
                    styleVariationSelector,
                    useRootPaddingAlign,
                    tree
                  );
                  if (styleVariationDeclarations.length) {
                    ruleset += `:root :where(${styleVariationSelector}){${styleVariationDeclarations.join(
                      ";"
                    )};}`;
                  }
                  if (styleVariations?.css) {
                    ruleset += processCSSNesting(
                      styleVariations.css,
                      `:root :where(${styleVariationSelector})`
                    );
                  }
                }
              }
            );
          }
          const pseudoSelectorStyles = Object.entries(styles).filter(
            ([key]) => key.startsWith(":")
          );
          if (pseudoSelectorStyles?.length) {
            pseudoSelectorStyles.forEach(
              ([pseudoKey, pseudoStyle]) => {
                const pseudoDeclarations = getStylesDeclarations(pseudoStyle);
                if (!pseudoDeclarations?.length) {
                  return;
                }
                const _selector = selector.split(",").map((sel) => sel + pseudoKey).join(",");
                const pseudoRule = `:root :where(${_selector}){${pseudoDeclarations.join(
                  ";"
                )};}`;
                ruleset += pseudoRule;
              }
            );
          }
        }
      );
    }
    if (options.layoutStyles) {
      ruleset = ruleset + ".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }";
      ruleset = ruleset + ".wp-site-blocks > .alignright { float: right; margin-left: 2em; }";
      ruleset = ruleset + ".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }";
    }
    if (options.blockGap && hasBlockGapSupport) {
      const gapValue = getGapCSSValue(tree?.styles?.spacing?.blockGap) || "0.5em";
      ruleset = ruleset + `:root :where(.wp-site-blocks) > * { margin-block-start: ${gapValue}; margin-block-end: 0; }`;
      ruleset = ruleset + ":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }";
      ruleset = ruleset + ":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }";
    }
    if (options.presets) {
      nodesWithSettings.forEach(({ selector, presets }) => {
        if (ROOT_BLOCK_SELECTOR === selector || ROOT_CSS_PROPERTIES_SELECTOR === selector) {
          selector = "";
        }
        const classes = getPresetsClasses(selector, presets);
        if (classes.length > 0) {
          ruleset += classes;
        }
      });
    }
    return ruleset;
  };
  function generateSvgFilters(tree, blockSelectors) {
    const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
    return nodesWithSettings.flatMap(({ presets }) => {
      return getPresetsSvgFilters(presets);
    });
  }
  var getSelectorsConfig = (blockType, rootSelector) => {
    if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) {
      return blockType.selectors;
    }
    const config = {
      root: rootSelector
    };
    Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(
      ([featureKey, featureName]) => {
        const featureSelector = getBlockSelector(blockType, featureKey);
        if (featureSelector) {
          config[featureName] = featureSelector;
        }
      }
    );
    return config;
  };
  var getBlockSelectors = (blockTypes, variationInstanceId) => {
    const { getBlockStyles } = (0, import_data25.select)(import_blocks8.store);
    const result = {};
    blockTypes.forEach((blockType) => {
      const name2 = blockType.name;
      const selector = getBlockSelector(blockType);
      if (!selector) {
        return;
      }
      let duotoneSelector = getBlockSelector(blockType, "filter.duotone");
      if (!duotoneSelector) {
        const rootSelector = getBlockSelector(blockType);
        const duotoneSupport = (0, import_blocks8.getBlockSupport)(
          blockType,
          "color.__experimentalDuotone",
          false
        );
        duotoneSelector = duotoneSupport && rootSelector && scopeSelector(rootSelector, duotoneSupport);
      }
      const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout;
      const fallbackGapValue = (
        // @ts-expect-error
        blockType?.supports?.spacing?.blockGap?.__experimentalDefault
      );
      const blockStyleVariations = getBlockStyles(name2);
      const styleVariationSelectors = {};
      blockStyleVariations?.forEach((variation) => {
        const variationSuffix = variationInstanceId ? `-${variationInstanceId}` : "";
        const variationName = `${variation.name}${variationSuffix}`;
        const styleVariationSelector = getBlockStyleVariationSelector(
          variationName,
          selector
        );
        styleVariationSelectors[variationName] = styleVariationSelector;
      });
      const featureSelectors = getSelectorsConfig(blockType, selector);
      result[name2] = {
        duotoneSelector: duotoneSelector ?? void 0,
        fallbackGapValue,
        featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : void 0,
        hasLayoutSupport,
        name: name2,
        selector,
        styleVariationSelectors: blockStyleVariations?.length ? styleVariationSelectors : void 0
      };
    });
    return result;
  };
  function updateConfigWithSeparator(config) {
    const blocks = config.styles?.blocks;
    const separatorBlock = blocks?.["core/separator"];
    const needsSeparatorStyleUpdate = separatorBlock && separatorBlock.color?.background && !separatorBlock.color?.text && !separatorBlock.border?.color;
    if (needsSeparatorStyleUpdate) {
      return {
        ...config,
        styles: {
          ...config.styles,
          blocks: {
            ...blocks,
            "core/separator": {
              ...separatorBlock,
              color: {
                ...separatorBlock.color,
                text: separatorBlock.color?.background
              }
            }
          }
        }
      };
    }
    return config;
  }
  function processCSSNesting(css, blockSelector) {
    let processedCSS = "";
    if (!css || css.trim() === "") {
      return processedCSS;
    }
    const parts = css.split("&");
    parts.forEach((part) => {
      if (!part || part.trim() === "") {
        return;
      }
      const isRootCss = !part.includes("{");
      if (isRootCss) {
        processedCSS += `:root :where(${blockSelector}){${part.trim()}}`;
      } else {
        const splitPart = part.replace("}", "").split("{");
        if (splitPart.length !== 2) {
          return;
        }
        const [nestedSelector, cssValue] = splitPart;
        const matches = nestedSelector.match(/([>+~\s]*::[a-zA-Z-]+)/);
        const pseudoPart = matches ? matches[1] : "";
        const withoutPseudoElement = matches ? nestedSelector.replace(pseudoPart, "").trim() : nestedSelector.trim();
        let combinedSelector;
        if (withoutPseudoElement === "") {
          combinedSelector = blockSelector;
        } else {
          combinedSelector = nestedSelector.startsWith(" ") ? scopeSelector(blockSelector, withoutPseudoElement) : appendToSelector(blockSelector, withoutPseudoElement);
        }
        processedCSS += `:root :where(${combinedSelector})${pseudoPart}{${cssValue.trim()}}`;
      }
    });
    return processedCSS;
  }
  function generateGlobalStyles(config = {}, blockTypes = [], options = {}) {
    const {
      hasBlockGapSupport: hasBlockGapSupportOption,
      hasFallbackGapSupport: hasFallbackGapSupportOption,
      disableLayoutStyles = false,
      disableRootPadding = false,
      styleOptions = {}
    } = options;
    const blocks = blockTypes.length > 0 ? blockTypes : (0, import_blocks8.getBlockTypes)();
    const blockGap = getSetting(config, "spacing.blockGap");
    const hasBlockGapSupport = hasBlockGapSupportOption ?? blockGap !== null;
    const hasFallbackGapSupport = hasFallbackGapSupportOption ?? !hasBlockGapSupport;
    if (!config?.styles || !config?.settings) {
      return [[], {}];
    }
    const updatedConfig = updateConfigWithSeparator(config);
    const blockSelectors = getBlockSelectors(blocks);
    const customProperties = generateCustomProperties(
      updatedConfig,
      blockSelectors
    );
    const globalStyles = transformToStyles(
      updatedConfig,
      blockSelectors,
      hasBlockGapSupport,
      hasFallbackGapSupport,
      disableLayoutStyles,
      disableRootPadding,
      styleOptions
    );
    const svgs = generateSvgFilters(updatedConfig, blockSelectors);
    const styles = [
      {
        css: customProperties,
        isGlobalStyles: true
      },
      {
        css: globalStyles,
        isGlobalStyles: true
      },
      // Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.
      {
        css: updatedConfig?.styles?.css ?? "",
        isGlobalStyles: true
      },
      {
        assets: svgs,
        __unstableType: "svg",
        isGlobalStyles: true
      }
    ];
    blocks.forEach((blockType) => {
      const blockStyles = updatedConfig?.styles?.blocks?.[blockType.name];
      if (blockStyles?.css) {
        const selector = blockSelectors[blockType.name].selector;
        styles.push({
          css: processCSSNesting(blockStyles.css, selector),
          isGlobalStyles: true
        });
      }
    });
    return [styles, updatedConfig.settings];
  }

  // packages/editor/build-module/components/global-styles-provider/index.mjs
  var { cleanEmptyObject } = unlock(import_block_editor6.privateApis);
  function useGlobalStylesUserConfig() {
    const { globalStylesId, isReady: isReady2, settings, styles, _links } = (0, import_data26.useSelect)(
      (select5) => {
        const {
          getEntityRecord,
          getEditedEntityRecord: getEditedEntityRecord2,
          hasFinishedResolution,
          canUser
        } = select5(import_core_data22.store);
        const _globalStylesId = select5(import_core_data22.store).__experimentalGetCurrentGlobalStylesId();
        let record;
        const userCanEditGlobalStyles = _globalStylesId ? canUser("update", {
          kind: "root",
          name: "globalStyles",
          id: _globalStylesId
        }) : null;
        if (_globalStylesId && /*
        * Test that the OPTIONS request for user capabilities is complete
        * before fetching the global styles entity record.
        * This is to avoid fetching the global styles entity unnecessarily.
        */
        typeof userCanEditGlobalStyles === "boolean") {
          if (userCanEditGlobalStyles) {
            record = getEditedEntityRecord2(
              "root",
              "globalStyles",
              _globalStylesId
            );
          } else {
            record = getEntityRecord(
              "root",
              "globalStyles",
              _globalStylesId,
              { context: "view" }
            );
          }
        }
        let hasResolved = false;
        if (hasFinishedResolution(
          "__experimentalGetCurrentGlobalStylesId"
        )) {
          if (_globalStylesId) {
            hasResolved = userCanEditGlobalStyles ? hasFinishedResolution("getEditedEntityRecord", [
              "root",
              "globalStyles",
              _globalStylesId
            ]) : hasFinishedResolution("getEntityRecord", [
              "root",
              "globalStyles",
              _globalStylesId,
              { context: "view" }
            ]);
          } else {
            hasResolved = true;
          }
        }
        return {
          globalStylesId: _globalStylesId,
          isReady: hasResolved,
          settings: record?.settings,
          styles: record?.styles,
          _links: record?._links
        };
      },
      []
    );
    const { getEditedEntityRecord } = (0, import_data26.useSelect)(import_core_data22.store);
    const { editEntityRecord } = (0, import_data26.useDispatch)(import_core_data22.store);
    const config = (0, import_element21.useMemo)(() => {
      return {
        settings: settings ?? {},
        styles: styles ?? {},
        _links: _links ?? {}
      };
    }, [settings, styles, _links]);
    const setConfig = (0, import_element21.useCallback)(
      /**
       * Set the global styles config.
       * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.
       *                                           Otherwise, overwrite the current config with the incoming object.
       * @param {Object}          options          Options for editEntityRecord Core selector.
       */
      (callbackOrObject, options = {}) => {
        const record = getEditedEntityRecord(
          "root",
          "globalStyles",
          globalStylesId
        );
        const currentConfig = {
          styles: record?.styles ?? {},
          settings: record?.settings ?? {},
          _links: record?._links ?? {}
        };
        const updatedConfig = typeof callbackOrObject === "function" ? callbackOrObject(currentConfig) : callbackOrObject;
        editEntityRecord(
          "root",
          "globalStyles",
          globalStylesId,
          {
            styles: cleanEmptyObject(updatedConfig.styles) || {},
            settings: cleanEmptyObject(updatedConfig.settings) || {},
            _links: cleanEmptyObject(updatedConfig._links) || {}
          },
          options
        );
      },
      [globalStylesId, editEntityRecord, getEditedEntityRecord]
    );
    return [isReady2, config, setConfig];
  }
  function useGlobalStylesBaseConfig() {
    const baseConfig = (0, import_data26.useSelect)(
      (select5) => select5(import_core_data22.store).__experimentalGetCurrentThemeBaseGlobalStyles(),
      []
    );
    return [!!baseConfig, baseConfig];
  }
  function useGlobalStylesContext() {
    const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig();
    const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig();
    const mergedConfig = (0, import_element21.useMemo)(() => {
      if (!baseConfig || !userConfig) {
        return {};
      }
      return mergeGlobalStyles(baseConfig, userConfig);
    }, [userConfig, baseConfig]);
    const context = (0, import_element21.useMemo)(() => {
      return {
        isReady: isUserConfigReady && isBaseConfigReady,
        user: userConfig,
        base: baseConfig,
        merged: mergedConfig,
        setUserConfig
      };
    }, [
      mergedConfig,
      userConfig,
      baseConfig,
      setUserConfig,
      isUserConfigReady,
      isBaseConfigReady
    ]);
    return context;
  }

  // packages/editor/build-module/components/provider/use-block-editor-settings.mjs
  var EMPTY_OBJECT3 = {};
  function __experimentalReusableBlocksSelect(select5) {
    const { RECEIVE_INTERMEDIATE_RESULTS: RECEIVE_INTERMEDIATE_RESULTS2 } = unlock(import_core_data23.privateApis);
    const { getEntityRecords } = select5(import_core_data23.store);
    return getEntityRecords("postType", "wp_block", {
      per_page: -1,
      [RECEIVE_INTERMEDIATE_RESULTS2]: true
    });
  }
  var BLOCK_EDITOR_SETTINGS = [
    "__experimentalBlockBindingsSupportedAttributes",
    "__experimentalBlockDirectory",
    "__experimentalDiscussionSettings",
    "__experimentalFeatures",
    "__experimentalGlobalStylesBaseStyles",
    "alignWide",
    "blockInspectorTabs",
    "maxUploadFileSize",
    "allowedMimeTypes",
    "bodyPlaceholder",
    "canLockBlocks",
    "canUpdateBlockBindings",
    "capabilities",
    "clearBlockSelection",
    "codeEditingEnabled",
    "colors",
    "disableCustomColors",
    "disableCustomFontSizes",
    "disableCustomSpacingSizes",
    "disableCustomGradients",
    "disableLayoutStyles",
    "enableCustomLineHeight",
    "enableCustomSpacing",
    "enableCustomUnits",
    "enableOpenverseMediaCategory",
    "fontSizes",
    "gradients",
    "generateAnchors",
    "onNavigateToEntityRecord",
    "imageDefaultSize",
    "imageDimensions",
    "imageEditing",
    "imageSizes",
    "isPreviewMode",
    "isRTL",
    "locale",
    "maxWidth",
    "postContentAttributes",
    "postsPerPage",
    "readOnly",
    "styles",
    "titlePlaceholder",
    "supportsLayout",
    "widgetTypesToHideFromLegacyWidgetBlock",
    "__unstableHasCustomAppender",
    "__unstableResolvedAssets",
    "__unstableIsBlockBasedTheme"
  ];
  var {
    globalStylesDataKey,
    globalStylesLinksDataKey,
    selectBlockPatternsKey,
    reusableBlocksSelectKey,
    sectionRootClientIdKey,
    mediaEditKey,
    getMediaSelectKey,
    isIsolatedEditorKey,
    deviceTypeKey
  } = unlock(import_block_editor7.privateApis);
  function useBlockEditorSettings(settings, postType2, postId2, renderingMode2) {
    const isLargeViewport = (0, import_compose6.useViewportMatch)("medium");
    const {
      allowRightClickOverrides,
      blockTypes,
      focusMode,
      hasFixedToolbar,
      isDistractionFree,
      keepCaretInsideBlock,
      hasUploadPermissions,
      hiddenBlockTypes,
      canUseUnfilteredHTML,
      userCanCreatePages,
      pageOnFront,
      pageForPosts,
      userPatternCategories,
      restBlockPatternCategories,
      sectionRootClientId,
      deviceType: deviceType2
    } = (0, import_data27.useSelect)(
      (select5) => {
        const {
          canUser,
          getRawEntityRecord,
          getEntityRecord,
          getUserPatternCategories,
          getBlockPatternCategories
        } = select5(import_core_data23.store);
        const { get } = select5(import_preferences3.store);
        const { getBlockTypes: getBlockTypes6 } = select5(import_blocks9.store);
        const { getDeviceType: getDeviceType2 } = unlock(select5(store));
        const { getBlocksByName, getBlockAttributes: getBlockAttributes2 } = select5(import_block_editor7.store);
        const siteSettings = canUser("read", {
          kind: "root",
          name: "site"
        }) ? getEntityRecord("root", "site") : void 0;
        function getSectionRootBlock() {
          if (renderingMode2 === "template-locked") {
            return getBlocksByName("core/post-content")?.[0] ?? "";
          }
          return getBlocksByName("core/group").find(
            (clientId) => getBlockAttributes2(clientId)?.tagName === "main"
          ) ?? "";
        }
        return {
          allowRightClickOverrides: get(
            "core",
            "allowRightClickOverrides"
          ),
          blockTypes: getBlockTypes6(),
          canUseUnfilteredHTML: getRawEntityRecord(
            "postType",
            postType2,
            postId2
          )?._links?.hasOwnProperty("wp:action-unfiltered-html"),
          focusMode: get("core", "focusMode"),
          hasFixedToolbar: get("core", "fixedToolbar") || !isLargeViewport,
          hiddenBlockTypes: get("core", "hiddenBlockTypes"),
          isDistractionFree: get("core", "distractionFree"),
          keepCaretInsideBlock: get("core", "keepCaretInsideBlock"),
          hasUploadPermissions: canUser("create", {
            kind: "postType",
            name: "attachment"
          }) ?? true,
          userCanCreatePages: canUser("create", {
            kind: "postType",
            name: "page"
          }),
          pageOnFront: siteSettings?.page_on_front,
          pageForPosts: siteSettings?.page_for_posts,
          userPatternCategories: getUserPatternCategories(),
          restBlockPatternCategories: getBlockPatternCategories(),
          sectionRootClientId: getSectionRootBlock(),
          deviceType: getDeviceType2()
        };
      },
      [postType2, postId2, isLargeViewport, renderingMode2]
    );
    const { merged: mergedGlobalStyles } = useGlobalStylesContext();
    const globalStylesData = mergedGlobalStyles.styles ?? EMPTY_OBJECT3;
    const globalStylesLinksData = mergedGlobalStyles._links ?? EMPTY_OBJECT3;
    const settingsBlockPatterns = settings.__experimentalAdditionalBlockPatterns ?? // WP 6.0
    settings.__experimentalBlockPatterns;
    const settingsBlockPatternCategories = settings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0
    settings.__experimentalBlockPatternCategories;
    const blockPatterns = (0, import_element22.useMemo)(
      () => [...settingsBlockPatterns || []].filter(
        ({ postTypes }) => {
          return !postTypes || Array.isArray(postTypes) && postTypes.includes(postType2);
        }
      ),
      [settingsBlockPatterns, postType2]
    );
    const blockPatternCategories = (0, import_element22.useMemo)(
      () => [
        ...settingsBlockPatternCategories || [],
        ...restBlockPatternCategories || []
      ].filter(
        (x2, index2, arr) => index2 === arr.findIndex((y3) => x2.name === y3.name)
      ),
      [settingsBlockPatternCategories, restBlockPatternCategories]
    );
    const { undo: undo2, setIsInserterOpened: setIsInserterOpened2 } = (0, import_data27.useDispatch)(store);
    const { editMediaEntity } = unlock((0, import_data27.useDispatch)(import_core_data23.store));
    const { saveEntityRecord } = (0, import_data27.useDispatch)(import_core_data23.store);
    const createPageEntity = (0, import_element22.useCallback)(
      (options) => {
        if (!userCanCreatePages) {
          return Promise.reject({
            message: (0, import_i18n49.__)(
              "You do not have permission to create Pages."
            )
          });
        }
        return saveEntityRecord("postType", "page", options);
      },
      [saveEntityRecord, userCanCreatePages]
    );
    const { getSelectedBlockClientId: getSelectedBlockClientId2 } = (0, import_data27.useSelect)(import_block_editor7.store);
    const wrappedOnNavigateToEntityRecord = (0, import_element22.useCallback)(
      (params) => {
        if (!settings.onNavigateToEntityRecord) {
          return;
        }
        const selectedBlockClientId = getSelectedBlockClientId2();
        return settings.onNavigateToEntityRecord({
          ...params,
          selectedBlockClientId
        });
      },
      [settings, getSelectedBlockClientId2]
    );
    const allowedBlockTypes = (0, import_element22.useMemo)(() => {
      if (hiddenBlockTypes && hiddenBlockTypes.length > 0) {
        const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? blockTypes.map(({ name: name2 }) => name2) : settings.allowedBlockTypes || [];
        return defaultAllowedBlockTypes.filter(
          (type) => !hiddenBlockTypes.includes(type)
        );
      }
      return settings.allowedBlockTypes;
    }, [settings.allowedBlockTypes, hiddenBlockTypes, blockTypes]);
    const forceDisableFocusMode = settings.focusMode === false;
    return (0, import_element22.useMemo)(() => {
      const blockEditorSettings = {
        ...Object.fromEntries(
          Object.entries(settings).filter(
            ([key]) => BLOCK_EDITOR_SETTINGS.includes(key)
          ).filter(([key]) => key !== "onNavigateToEntityRecord")
        ),
        [globalStylesDataKey]: globalStylesData,
        [globalStylesLinksDataKey]: globalStylesLinksData,
        allowedBlockTypes,
        allowRightClickOverrides,
        focusMode: focusMode && !forceDisableFocusMode,
        hasFixedToolbar,
        isDistractionFree,
        keepCaretInsideBlock,
        onNavigateToEntityRecord: settings.onNavigateToEntityRecord ? wrappedOnNavigateToEntityRecord : void 0,
        [getMediaSelectKey]: (select5, attachmentId) => {
          return select5(import_core_data23.store).getEntityRecord(
            "postType",
            "attachment",
            attachmentId
          );
        },
        [mediaEditKey]: hasUploadPermissions ? editMediaEntity : void 0,
        mediaUpload: hasUploadPermissions ? mediaUpload : void 0,
        mediaSideload: hasUploadPermissions ? media_sideload_default : void 0,
        __experimentalBlockPatterns: blockPatterns,
        [selectBlockPatternsKey]: (select5) => {
          const { hasFinishedResolution, getBlockPatternsForPostType } = unlock(select5(import_core_data23.store));
          const patterns2 = getBlockPatternsForPostType(postType2);
          return hasFinishedResolution("getBlockPatterns") ? patterns2 : void 0;
        },
        [reusableBlocksSelectKey]: __experimentalReusableBlocksSelect,
        __experimentalBlockPatternCategories: blockPatternCategories,
        __experimentalUserPatternCategories: userPatternCategories,
        __experimentalFetchLinkSuggestions: (search, searchOptions) => (0, import_core_data23.__experimentalFetchLinkSuggestions)(search, searchOptions, settings),
        inserterMediaCategories: media_categories_default,
        __experimentalFetchRichUrlData: import_core_data23.__experimentalFetchUrlData,
        // Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.
        // This might be better as a generic "canUser" selector.
        __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
        //Todo: this is only needed for native and should probably be removed.
        __experimentalUndo: undo2,
        // Check whether we want all site editor frames to have outlines
        // including the navigation / pattern / parts editors.
        outlineMode: !isDistractionFree && postType2 === "wp_template",
        // Check these two properties: they were not present in the site editor.
        __experimentalCreatePageEntity: createPageEntity,
        __experimentalUserCanCreatePages: userCanCreatePages,
        pageOnFront,
        pageForPosts,
        __experimentalPreferPatternsOnRoot: postType2 === "wp_template",
        templateLock: postType2 === "wp_navigation" ? "insert" : settings.templateLock,
        template: postType2 === "wp_navigation" ? [["core/navigation", {}, []]] : settings.template,
        __experimentalSetIsInserterOpened: setIsInserterOpened2,
        [sectionRootClientIdKey]: sectionRootClientId,
        editorTool: renderingMode2 === "post-only" && postType2 !== "wp_template" ? "edit" : void 0,
        // When editing template parts, patterns, or navigation directly,
        // we're in an isolated editing context (focused on that entity alone).
        [isIsolatedEditorKey]: [
          "wp_template_part",
          "wp_block",
          "wp_navigation"
        ].includes(postType2),
        ...window.__experimentalHideBlocksBasedOnScreenSize && deviceType2 ? { [deviceTypeKey]: deviceType2 } : {}
      };
      return blockEditorSettings;
    }, [
      allowedBlockTypes,
      allowRightClickOverrides,
      focusMode,
      forceDisableFocusMode,
      hasFixedToolbar,
      isDistractionFree,
      keepCaretInsideBlock,
      settings,
      hasUploadPermissions,
      userPatternCategories,
      blockPatterns,
      blockPatternCategories,
      canUseUnfilteredHTML,
      undo2,
      createPageEntity,
      userCanCreatePages,
      pageOnFront,
      pageForPosts,
      postType2,
      setIsInserterOpened2,
      sectionRootClientId,
      globalStylesData,
      globalStylesLinksData,
      renderingMode2,
      editMediaEntity,
      wrappedOnNavigateToEntityRecord,
      deviceType2
    ]);
  }
  var use_block_editor_settings_default = useBlockEditorSettings;

  // packages/editor/build-module/components/provider/disable-non-page-content-blocks.mjs
  var import_data29 = __toESM(require_data(), 1);
  var import_block_editor8 = __toESM(require_block_editor(), 1);
  var import_element24 = __toESM(require_element(), 1);

  // packages/editor/build-module/components/provider/use-post-content-blocks.mjs
  var import_data28 = __toESM(require_data(), 1);
  var import_element23 = __toESM(require_element(), 1);
  var import_hooks2 = __toESM(require_hooks(), 1);
  var POST_CONTENT_BLOCK_TYPES = [
    "core/post-title",
    "core/post-featured-image",
    "core/post-content"
  ];
  function usePostContentBlocks() {
    const contentOnlyBlockTypes = (0, import_element23.useMemo)(
      () => [
        ...(0, import_hooks2.applyFilters)(
          "editor.postContentBlockTypes",
          POST_CONTENT_BLOCK_TYPES
        )
      ],
      []
    );
    const contentOnlyIds = (0, import_data28.useSelect)(
      (select5) => {
        const { getPostBlocksByName: getPostBlocksByName2 } = unlock(select5(store));
        return getPostBlocksByName2(contentOnlyBlockTypes);
      },
      [contentOnlyBlockTypes]
    );
    return contentOnlyIds;
  }

  // packages/editor/build-module/components/provider/disable-non-page-content-blocks.mjs
  function DisableNonPageContentBlocks() {
    const contentOnlyIds = usePostContentBlocks();
    const { templateParts } = (0, import_data29.useSelect)((select5) => {
      const { getBlocksByName } = select5(import_block_editor8.store);
      return {
        templateParts: getBlocksByName("core/template-part")
      };
    }, []);
    const disabledIds = (0, import_data29.useSelect)(
      (select5) => {
        const { getBlockOrder: getBlockOrder2 } = select5(import_block_editor8.store);
        return templateParts.flatMap(
          (clientId) => getBlockOrder2(clientId)
        );
      },
      [templateParts]
    );
    const registry = (0, import_data29.useRegistry)();
    (0, import_element24.useEffect)(() => {
      const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(import_block_editor8.store);
      setBlockEditingMode("", "disabled");
      return () => {
        unsetBlockEditingMode("");
      };
    }, [registry]);
    (0, import_element24.useEffect)(() => {
      const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(import_block_editor8.store);
      registry.batch(() => {
        for (const clientId of contentOnlyIds) {
          setBlockEditingMode(clientId, "contentOnly");
        }
      });
      return () => {
        registry.batch(() => {
          for (const clientId of contentOnlyIds) {
            unsetBlockEditingMode(clientId);
          }
        });
      };
    }, [contentOnlyIds, registry]);
    (0, import_element24.useEffect)(() => {
      const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(import_block_editor8.store);
      registry.batch(() => {
        for (const clientId of templateParts) {
          setBlockEditingMode(clientId, "contentOnly");
        }
      });
      return () => {
        registry.batch(() => {
          for (const clientId of templateParts) {
            unsetBlockEditingMode(clientId);
          }
        });
      };
    }, [templateParts, registry]);
    (0, import_element24.useEffect)(() => {
      const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(import_block_editor8.store);
      registry.batch(() => {
        for (const clientId of disabledIds) {
          setBlockEditingMode(clientId, "disabled");
        }
      });
      return () => {
        registry.batch(() => {
          for (const clientId of disabledIds) {
            unsetBlockEditingMode(clientId);
          }
        });
      };
    }, [disabledIds, registry]);
    return null;
  }

  // packages/editor/build-module/components/provider/navigation-block-editing-mode.mjs
  var import_element25 = __toESM(require_element(), 1);
  var import_data30 = __toESM(require_data(), 1);
  var import_block_editor9 = __toESM(require_block_editor(), 1);
  function NavigationBlockEditingMode() {
    const blockClientId = (0, import_data30.useSelect)(
      (select5) => select5(import_block_editor9.store).getBlockOrder()?.[0],
      []
    );
    const { setBlockEditingMode, unsetBlockEditingMode } = (0, import_data30.useDispatch)(import_block_editor9.store);
    (0, import_element25.useEffect)(() => {
      if (!blockClientId) {
        return;
      }
      setBlockEditingMode(blockClientId, "contentOnly");
      return () => {
        unsetBlockEditingMode(blockClientId);
      };
    }, [blockClientId, unsetBlockEditingMode, setBlockEditingMode]);
  }

  // packages/editor/build-module/components/provider/use-hide-blocks-from-inserter.mjs
  var import_element26 = __toESM(require_element(), 1);
  var import_hooks3 = __toESM(require_hooks(), 1);
  var POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART = [
    "wp_block",
    "wp_template",
    "wp_template_part"
  ];
  function useHideBlocksFromInserter(postType2, mode) {
    (0, import_element26.useEffect)(() => {
      (0, import_hooks3.addFilter)(
        "blockEditor.__unstableCanInsertBlockType",
        "removeTemplatePartsFromInserter",
        (canInsert, blockType) => {
          if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes(
            postType2
          ) && blockType.name === "core/template-part" && mode === "post-only") {
            return false;
          }
          return canInsert;
        }
      );
      (0, import_hooks3.addFilter)(
        "blockEditor.__unstableCanInsertBlockType",
        "removePostContentFromInserter",
        (canInsert, blockType, rootClientId, { getBlockParentsByBlockName }) => {
          if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes(
            postType2
          ) && blockType.name === "core/post-content") {
            return getBlockParentsByBlockName(rootClientId, "core/query").length > 0;
          }
          return canInsert;
        }
      );
      return () => {
        (0, import_hooks3.removeFilter)(
          "blockEditor.__unstableCanInsertBlockType",
          "removeTemplatePartsFromInserter"
        );
        (0, import_hooks3.removeFilter)(
          "blockEditor.__unstableCanInsertBlockType",
          "removePostContentFromInserter"
        );
      };
    }, [postType2, mode]);
  }

  // packages/editor/build-module/components/commands/index.mjs
  var import_data38 = __toESM(require_data(), 1);
  var import_i18n52 = __toESM(require_i18n(), 1);
  var import_commands = __toESM(require_commands(), 1);
  var import_preferences7 = __toESM(require_preferences(), 1);
  var import_notices14 = __toESM(require_notices(), 1);
  var import_block_editor10 = __toESM(require_block_editor(), 1);
  var import_core_data26 = __toESM(require_core_data(), 1);

  // packages/interface/build-module/index.mjs
  var build_module_exports = {};
  __export(build_module_exports, {
    ActionItem: () => action_item_default,
    ComplementaryArea: () => complementary_area_default,
    ComplementaryAreaMoreMenuItem: () => ComplementaryAreaMoreMenuItem,
    FullscreenMode: () => fullscreen_mode_default,
    InterfaceSkeleton: () => interface_skeleton_default,
    PinnedItems: () => pinned_items_default,
    store: () => store2
  });

  // packages/interface/build-module/components/complementary-area/index.mjs
  var import_components24 = __toESM(require_components(), 1);
  var import_data35 = __toESM(require_data(), 1);
  var import_i18n50 = __toESM(require_i18n(), 1);
  var import_element28 = __toESM(require_element(), 1);
  var import_viewport = __toESM(require_viewport(), 1);
  var import_preferences6 = __toESM(require_preferences(), 1);
  var import_compose7 = __toESM(require_compose(), 1);
  var import_plugins2 = __toESM(require_plugins(), 1);

  // packages/interface/build-module/components/complementary-area-toggle/index.mjs
  var import_components20 = __toESM(require_components(), 1);
  var import_data34 = __toESM(require_data(), 1);
  var import_plugins = __toESM(require_plugins(), 1);

  // packages/interface/build-module/store/index.mjs
  var import_data33 = __toESM(require_data(), 1);

  // packages/interface/build-module/store/actions.mjs
  var actions_exports2 = {};
  __export(actions_exports2, {
    closeModal: () => closeModal,
    disableComplementaryArea: () => disableComplementaryArea,
    enableComplementaryArea: () => enableComplementaryArea,
    openModal: () => openModal,
    pinItem: () => pinItem,
    setDefaultComplementaryArea: () => setDefaultComplementaryArea,
    setFeatureDefaults: () => setFeatureDefaults,
    setFeatureValue: () => setFeatureValue,
    toggleFeature: () => toggleFeature,
    unpinItem: () => unpinItem
  });
  var import_deprecated5 = __toESM(require_deprecated(), 1);
  var import_preferences4 = __toESM(require_preferences(), 1);

  // packages/interface/build-module/store/deprecated.mjs
  var import_deprecated4 = __toESM(require_deprecated(), 1);
  function normalizeComplementaryAreaScope(scope) {
    if (["core/edit-post", "core/edit-site"].includes(scope)) {
      (0, import_deprecated4.default)(`${scope} interface scope`, {
        alternative: "core interface scope",
        hint: "core/edit-post and core/edit-site are merging.",
        version: "6.6"
      });
      return "core";
    }
    return scope;
  }
  function normalizeComplementaryAreaName(scope, name2) {
    if (scope === "core" && name2 === "edit-site/template") {
      (0, import_deprecated4.default)(`edit-site/template sidebar`, {
        alternative: "edit-post/document",
        version: "6.6"
      });
      return "edit-post/document";
    }
    if (scope === "core" && name2 === "edit-site/block-inspector") {
      (0, import_deprecated4.default)(`edit-site/block-inspector sidebar`, {
        alternative: "edit-post/block",
        version: "6.6"
      });
      return "edit-post/block";
    }
    return name2;
  }

  // packages/interface/build-module/store/actions.mjs
  var setDefaultComplementaryArea = (scope, area) => {
    scope = normalizeComplementaryAreaScope(scope);
    area = normalizeComplementaryAreaName(scope, area);
    return {
      type: "SET_DEFAULT_COMPLEMENTARY_AREA",
      scope,
      area
    };
  };
  var enableComplementaryArea = (scope, area) => ({ registry, dispatch: dispatch6 }) => {
    if (!area) {
      return;
    }
    scope = normalizeComplementaryAreaScope(scope);
    area = normalizeComplementaryAreaName(scope, area);
    const isComplementaryAreaVisible = registry.select(import_preferences4.store).get(scope, "isComplementaryAreaVisible");
    if (!isComplementaryAreaVisible) {
      registry.dispatch(import_preferences4.store).set(scope, "isComplementaryAreaVisible", true);
    }
    dispatch6({
      type: "ENABLE_COMPLEMENTARY_AREA",
      scope,
      area
    });
  };
  var disableComplementaryArea = (scope) => ({ registry }) => {
    scope = normalizeComplementaryAreaScope(scope);
    const isComplementaryAreaVisible = registry.select(import_preferences4.store).get(scope, "isComplementaryAreaVisible");
    if (isComplementaryAreaVisible) {
      registry.dispatch(import_preferences4.store).set(scope, "isComplementaryAreaVisible", false);
    }
  };
  var pinItem = (scope, item) => ({ registry }) => {
    if (!item) {
      return;
    }
    scope = normalizeComplementaryAreaScope(scope);
    item = normalizeComplementaryAreaName(scope, item);
    const pinnedItems = registry.select(import_preferences4.store).get(scope, "pinnedItems");
    if (pinnedItems?.[item] === true) {
      return;
    }
    registry.dispatch(import_preferences4.store).set(scope, "pinnedItems", {
      ...pinnedItems,
      [item]: true
    });
  };
  var unpinItem = (scope, item) => ({ registry }) => {
    if (!item) {
      return;
    }
    scope = normalizeComplementaryAreaScope(scope);
    item = normalizeComplementaryAreaName(scope, item);
    const pinnedItems = registry.select(import_preferences4.store).get(scope, "pinnedItems");
    registry.dispatch(import_preferences4.store).set(scope, "pinnedItems", {
      ...pinnedItems,
      [item]: false
    });
  };
  function toggleFeature(scope, featureName) {
    return function({ registry }) {
      (0, import_deprecated5.default)(`dispatch( 'core/interface' ).toggleFeature`, {
        since: "6.0",
        alternative: `dispatch( 'core/preferences' ).toggle`
      });
      registry.dispatch(import_preferences4.store).toggle(scope, featureName);
    };
  }
  function setFeatureValue(scope, featureName, value) {
    return function({ registry }) {
      (0, import_deprecated5.default)(`dispatch( 'core/interface' ).setFeatureValue`, {
        since: "6.0",
        alternative: `dispatch( 'core/preferences' ).set`
      });
      registry.dispatch(import_preferences4.store).set(scope, featureName, !!value);
    };
  }
  function setFeatureDefaults(scope, defaults) {
    return function({ registry }) {
      (0, import_deprecated5.default)(`dispatch( 'core/interface' ).setFeatureDefaults`, {
        since: "6.0",
        alternative: `dispatch( 'core/preferences' ).setDefaults`
      });
      registry.dispatch(import_preferences4.store).setDefaults(scope, defaults);
    };
  }
  function openModal(name2) {
    return {
      type: "OPEN_MODAL",
      name: name2
    };
  }
  function closeModal() {
    return {
      type: "CLOSE_MODAL"
    };
  }

  // packages/interface/build-module/store/selectors.mjs
  var selectors_exports2 = {};
  __export(selectors_exports2, {
    getActiveComplementaryArea: () => getActiveComplementaryArea,
    isComplementaryAreaLoading: () => isComplementaryAreaLoading,
    isFeatureActive: () => isFeatureActive,
    isItemPinned: () => isItemPinned,
    isModalActive: () => isModalActive
  });
  var import_data31 = __toESM(require_data(), 1);
  var import_deprecated7 = __toESM(require_deprecated(), 1);
  var import_preferences5 = __toESM(require_preferences(), 1);
  var getActiveComplementaryArea = (0, import_data31.createRegistrySelector)(
    (select5) => (state, scope) => {
      scope = normalizeComplementaryAreaScope(scope);
      const isComplementaryAreaVisible = select5(import_preferences5.store).get(
        scope,
        "isComplementaryAreaVisible"
      );
      if (isComplementaryAreaVisible === void 0) {
        return void 0;
      }
      if (isComplementaryAreaVisible === false) {
        return null;
      }
      return state?.complementaryAreas?.[scope];
    }
  );
  var isComplementaryAreaLoading = (0, import_data31.createRegistrySelector)(
    (select5) => (state, scope) => {
      scope = normalizeComplementaryAreaScope(scope);
      const isVisible = select5(import_preferences5.store).get(
        scope,
        "isComplementaryAreaVisible"
      );
      const identifier = state?.complementaryAreas?.[scope];
      return isVisible && identifier === void 0;
    }
  );
  var isItemPinned = (0, import_data31.createRegistrySelector)(
    (select5) => (state, scope, item) => {
      scope = normalizeComplementaryAreaScope(scope);
      item = normalizeComplementaryAreaName(scope, item);
      const pinnedItems = select5(import_preferences5.store).get(
        scope,
        "pinnedItems"
      );
      return pinnedItems?.[item] ?? true;
    }
  );
  var isFeatureActive = (0, import_data31.createRegistrySelector)(
    (select5) => (state, scope, featureName) => {
      (0, import_deprecated7.default)(
        `select( 'core/interface' ).isFeatureActive( scope, featureName )`,
        {
          since: "6.0",
          alternative: `select( 'core/preferences' ).get( scope, featureName )`
        }
      );
      return !!select5(import_preferences5.store).get(scope, featureName);
    }
  );
  function isModalActive(state, modalName3) {
    return state.activeModal === modalName3;
  }

  // packages/interface/build-module/store/reducer.mjs
  var import_data32 = __toESM(require_data(), 1);
  function complementaryAreas(state = {}, action) {
    switch (action.type) {
      case "SET_DEFAULT_COMPLEMENTARY_AREA": {
        const { scope, area } = action;
        if (state[scope]) {
          return state;
        }
        return {
          ...state,
          [scope]: area
        };
      }
      case "ENABLE_COMPLEMENTARY_AREA": {
        const { scope, area } = action;
        return {
          ...state,
          [scope]: area
        };
      }
    }
    return state;
  }
  function activeModal(state = null, action) {
    switch (action.type) {
      case "OPEN_MODAL":
        return action.name;
      case "CLOSE_MODAL":
        return null;
    }
    return state;
  }
  var reducer_default3 = (0, import_data32.combineReducers)({
    complementaryAreas,
    activeModal
  });

  // packages/interface/build-module/store/constants.mjs
  var STORE_NAME2 = "core/interface";

  // packages/interface/build-module/store/index.mjs
  var store2 = (0, import_data33.createReduxStore)(STORE_NAME2, {
    reducer: reducer_default3,
    actions: actions_exports2,
    selectors: selectors_exports2
  });
  (0, import_data33.register)(store2);

  // packages/interface/build-module/components/complementary-area-toggle/index.mjs
  var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
  function roleSupportsCheckedState(role) {
    return [
      "checkbox",
      "option",
      "radio",
      "switch",
      "menuitemcheckbox",
      "menuitemradio",
      "treeitem"
    ].includes(role);
  }
  function ComplementaryAreaToggle({
    as = import_components20.Button,
    scope,
    identifier: identifierProp,
    icon: iconProp,
    selectedIcon,
    name: name2,
    shortcut,
    ...props
  }) {
    const ComponentToUse = as;
    const context = (0, import_plugins.usePluginContext)();
    const icon = iconProp || context.icon;
    const identifier = identifierProp || `${context.name}/${name2}`;
    const isSelected = (0, import_data34.useSelect)(
      (select5) => select5(store2).getActiveComplementaryArea(scope) === identifier,
      [identifier, scope]
    );
    const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data34.useDispatch)(store2);
    return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
      ComponentToUse,
      {
        icon: selectedIcon && isSelected ? selectedIcon : icon,
        "aria-controls": identifier.replace("/", ":"),
        "aria-checked": roleSupportsCheckedState(props.role) ? isSelected : void 0,
        onClick: () => {
          if (isSelected) {
            disableComplementaryArea2(scope);
          } else {
            enableComplementaryArea2(scope, identifier);
          }
        },
        shortcut,
        ...props
      }
    );
  }

  // packages/interface/build-module/components/complementary-area-header/index.mjs
  var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
  var ComplementaryAreaHeader = ({
    children,
    className,
    toggleButtonProps
  }) => {
    const toggleButton = /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(ComplementaryAreaToggle, { icon: close_small_default, ...toggleButtonProps });
    return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
      "div",
      {
        className: clsx_default(
          "components-panel__header",
          "interface-complementary-area-header",
          className
        ),
        tabIndex: -1,
        children: [
          children,
          toggleButton
        ]
      }
    );
  };
  var complementary_area_header_default = ComplementaryAreaHeader;

  // packages/interface/build-module/components/complementary-area-more-menu-item/index.mjs
  var import_components22 = __toESM(require_components(), 1);

  // packages/interface/build-module/components/action-item/index.mjs
  var import_components21 = __toESM(require_components(), 1);
  var import_element27 = __toESM(require_element(), 1);
  var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1);
  var noop2 = () => {
  };
  function ActionItemSlot({
    name: name2,
    as: Component6 = import_components21.MenuGroup,
    fillProps = {},
    bubblesVirtually,
    ...props
  }) {
    return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
      import_components21.Slot,
      {
        name: name2,
        bubblesVirtually,
        fillProps,
        children: (fills) => {
          if (!import_element27.Children.toArray(fills).length) {
            return null;
          }
          const initializedByPlugins = [];
          import_element27.Children.forEach(
            fills,
            ({
              props: { __unstableExplicitMenuItem, __unstableTarget }
            }) => {
              if (__unstableTarget && __unstableExplicitMenuItem) {
                initializedByPlugins.push(__unstableTarget);
              }
            }
          );
          const children = import_element27.Children.map(fills, (child) => {
            if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(
              child.props.__unstableTarget
            )) {
              return null;
            }
            return child;
          });
          return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Component6, { ...props, children });
        }
      }
    );
  }
  function ActionItem({ name: name2, as: Component6 = import_components21.Button, onClick, ...props }) {
    return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_components21.Fill, { name: name2, children: ({ onClick: fpOnClick }) => {
      return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
        Component6,
        {
          onClick: onClick || fpOnClick ? (...args) => {
            (onClick || noop2)(...args);
            (fpOnClick || noop2)(...args);
          } : void 0,
          ...props
        }
      );
    } });
  }
  ActionItem.Slot = ActionItemSlot;
  var action_item_default = ActionItem;

  // packages/interface/build-module/components/complementary-area-more-menu-item/index.mjs
  var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
  var PluginsMenuItem = ({
    // Menu item is marked with unstable prop for backward compatibility.
    // They are removed so they don't leak to DOM elements.
    // @see https://github.com/WordPress/gutenberg/issues/14457
    __unstableExplicitMenuItem,
    __unstableTarget,
    ...restProps
  }) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_components22.MenuItem, { ...restProps });
  function ComplementaryAreaMoreMenuItem({
    scope,
    target,
    __unstableExplicitMenuItem,
    ...props
  }) {
    return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
      ComplementaryAreaToggle,
      {
        as: (toggleProps) => {
          return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
            action_item_default,
            {
              __unstableExplicitMenuItem,
              __unstableTarget: `${scope}/${target}`,
              as: PluginsMenuItem,
              name: `${scope}/plugin-more-menu`,
              ...toggleProps
            }
          );
        },
        role: "menuitemcheckbox",
        selectedIcon: check_default,
        name: target,
        scope,
        ...props
      }
    );
  }

  // packages/interface/build-module/components/pinned-items/index.mjs
  var import_components23 = __toESM(require_components(), 1);
  var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1);
  function PinnedItems({ scope, ...props }) {
    return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_components23.Fill, { name: `PinnedItems/${scope}`, ...props });
  }
  function PinnedItemsSlot({ scope, className, ...props }) {
    return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_components23.Slot, { name: `PinnedItems/${scope}`, ...props, children: (fills) => fills?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
      "div",
      {
        className: clsx_default(
          className,
          "interface-pinned-items"
        ),
        children: fills
      }
    ) });
  }
  PinnedItems.Slot = PinnedItemsSlot;
  var pinned_items_default = PinnedItems;

  // packages/interface/build-module/components/complementary-area/index.mjs
  var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1);
  var ANIMATION_DURATION = 0.3;
  function ComplementaryAreaSlot({ scope, ...props }) {
    return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_components24.Slot, { name: `ComplementaryArea/${scope}`, ...props });
  }
  var SIDEBAR_WIDTH = 280;
  var variants = {
    open: { width: SIDEBAR_WIDTH },
    closed: { width: 0 },
    mobileOpen: { width: "100vw" }
  };
  function ComplementaryAreaFill({
    activeArea,
    isActive,
    scope,
    children,
    className,
    id
  }) {
    const disableMotion = (0, import_compose7.useReducedMotion)();
    const isMobileViewport = (0, import_compose7.useViewportMatch)("medium", "<");
    const previousActiveArea = (0, import_compose7.usePrevious)(activeArea);
    const previousIsActive = (0, import_compose7.usePrevious)(isActive);
    const [, setState] = (0, import_element28.useState)({});
    (0, import_element28.useEffect)(() => {
      setState({});
    }, [isActive]);
    const transition = {
      type: "tween",
      duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION,
      ease: [0.6, 0, 0.4, 1]
    };
    return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_components24.Fill, { name: `ComplementaryArea/${scope}`, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_components24.__unstableAnimatePresence, { initial: false, children: (previousIsActive || isActive) && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
      import_components24.__unstableMotion.div,
      {
        variants,
        initial: "closed",
        animate: isMobileViewport ? "mobileOpen" : "open",
        exit: "closed",
        transition,
        className: "interface-complementary-area__fill",
        children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
          "div",
          {
            id,
            className,
            style: {
              width: isMobileViewport ? "100vw" : SIDEBAR_WIDTH
            },
            children
          }
        )
      }
    ) }) });
  }
  function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
    const previousIsSmallRef = (0, import_element28.useRef)(false);
    const shouldOpenWhenNotSmallRef = (0, import_element28.useRef)(false);
    const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data35.useDispatch)(store2);
    (0, import_element28.useEffect)(() => {
      if (isActive && isSmall && !previousIsSmallRef.current) {
        disableComplementaryArea2(scope);
        shouldOpenWhenNotSmallRef.current = true;
      } else if (
        // If there is a flag indicating the complementary area should be
        // enabled when we go from small to big window size and we are going
        // from a small to big window size.
        shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current
      ) {
        shouldOpenWhenNotSmallRef.current = false;
        enableComplementaryArea2(scope, identifier);
      } else if (
        // If the flag is indicating the current complementary should be
        // reopened but another complementary area becomes active, remove
        // the flag.
        shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier
      ) {
        shouldOpenWhenNotSmallRef.current = false;
      }
      if (isSmall !== previousIsSmallRef.current) {
        previousIsSmallRef.current = isSmall;
      }
    }, [
      isActive,
      isSmall,
      scope,
      identifier,
      activeArea,
      disableComplementaryArea2,
      enableComplementaryArea2
    ]);
  }
  function ComplementaryArea({
    children,
    className,
    closeLabel = (0, import_i18n50.__)("Close plugin"),
    identifier: identifierProp,
    header,
    headerClassName,
    icon: iconProp,
    isPinnable = true,
    panelClassName,
    scope,
    name: name2,
    title,
    toggleShortcut,
    isActiveByDefault
  }) {
    const context = (0, import_plugins2.usePluginContext)();
    const icon = iconProp || context.icon;
    const identifier = identifierProp || `${context.name}/${name2}`;
    const [isReady2, setIsReady2] = (0, import_element28.useState)(false);
    const {
      isLoading,
      isActive,
      isPinned,
      activeArea,
      isSmall,
      isLarge,
      showIconLabels
    } = (0, import_data35.useSelect)(
      (select5) => {
        const {
          getActiveComplementaryArea: getActiveComplementaryArea2,
          isComplementaryAreaLoading: isComplementaryAreaLoading2,
          isItemPinned: isItemPinned2
        } = select5(store2);
        const { get } = select5(import_preferences6.store);
        const _activeArea = getActiveComplementaryArea2(scope);
        return {
          isLoading: isComplementaryAreaLoading2(scope),
          isActive: _activeArea === identifier,
          isPinned: isItemPinned2(scope, identifier),
          activeArea: _activeArea,
          isSmall: select5(import_viewport.store).isViewportMatch("< medium"),
          isLarge: select5(import_viewport.store).isViewportMatch("large"),
          showIconLabels: get("core", "showIconLabels")
        };
      },
      [identifier, scope]
    );
    const isMobileViewport = (0, import_compose7.useViewportMatch)("medium", "<");
    useAdjustComplementaryListener(
      scope,
      identifier,
      activeArea,
      isActive,
      isSmall
    );
    const {
      enableComplementaryArea: enableComplementaryArea2,
      disableComplementaryArea: disableComplementaryArea2,
      pinItem: pinItem2,
      unpinItem: unpinItem2
    } = (0, import_data35.useDispatch)(store2);
    (0, import_element28.useEffect)(() => {
      if (isActiveByDefault && activeArea === void 0 && !isSmall) {
        enableComplementaryArea2(scope, identifier);
      } else if (activeArea === void 0 && isSmall) {
        disableComplementaryArea2(scope, identifier);
      }
      setIsReady2(true);
    }, [
      activeArea,
      isActiveByDefault,
      scope,
      identifier,
      isSmall,
      enableComplementaryArea2,
      disableComplementaryArea2
    ]);
    if (!isReady2) {
      return;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(import_jsx_runtime100.Fragment, { children: [
      isPinnable && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(pinned_items_default, { scope, children: isPinned && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
        ComplementaryAreaToggle,
        {
          scope,
          identifier,
          isPressed: isActive && (!showIconLabels || isLarge),
          "aria-expanded": isActive,
          "aria-disabled": isLoading,
          label: title,
          icon: showIconLabels ? check_default : icon,
          showTooltip: !showIconLabels,
          variant: showIconLabels ? "tertiary" : void 0,
          size: "compact",
          shortcut: toggleShortcut
        }
      ) }),
      name2 && isPinnable && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
        ComplementaryAreaMoreMenuItem,
        {
          target: name2,
          scope,
          icon,
          identifier,
          children: title
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
        ComplementaryAreaFill,
        {
          activeArea,
          isActive,
          className: clsx_default("interface-complementary-area", className),
          scope,
          id: identifier.replace("/", ":"),
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
              complementary_area_header_default,
              {
                className: headerClassName,
                closeLabel,
                onClose: () => disableComplementaryArea2(scope),
                toggleButtonProps: {
                  label: closeLabel,
                  size: "compact",
                  shortcut: toggleShortcut,
                  scope,
                  identifier
                },
                children: header || /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(import_jsx_runtime100.Fragment, { children: [
                  /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("h2", { className: "interface-complementary-area-header__title", children: title }),
                  isPinnable && !isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
                    import_components24.Button,
                    {
                      className: "interface-complementary-area__pin-unpin-item",
                      icon: isPinned ? star_filled_default : star_empty_default,
                      label: isPinned ? (0, import_i18n50.__)("Unpin from toolbar") : (0, import_i18n50.__)("Pin to toolbar"),
                      onClick: () => (isPinned ? unpinItem2 : pinItem2)(
                        scope,
                        identifier
                      ),
                      isPressed: isPinned,
                      "aria-expanded": isPinned,
                      size: "compact"
                    }
                  )
                ] })
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_components24.Panel, { className: panelClassName, children })
          ]
        }
      )
    ] });
  }
  ComplementaryArea.Slot = ComplementaryAreaSlot;
  var complementary_area_default = ComplementaryArea;

  // packages/interface/build-module/components/fullscreen-mode/index.mjs
  var import_element29 = __toESM(require_element(), 1);
  var FullscreenMode = ({ isActive }) => {
    (0, import_element29.useEffect)(() => {
      let isSticky = false;
      if (document.body.classList.contains("sticky-menu")) {
        isSticky = true;
        document.body.classList.remove("sticky-menu");
      }
      return () => {
        if (isSticky) {
          document.body.classList.add("sticky-menu");
        }
      };
    }, []);
    (0, import_element29.useEffect)(() => {
      if (isActive) {
        document.body.classList.add("is-fullscreen-mode");
      } else {
        document.body.classList.remove("is-fullscreen-mode");
      }
      return () => {
        if (isActive) {
          document.body.classList.remove("is-fullscreen-mode");
        }
      };
    }, [isActive]);
    return null;
  };
  var fullscreen_mode_default = FullscreenMode;

  // packages/admin-ui/build-module/navigable-region/index.mjs
  var import_element30 = __toESM(require_element(), 1);
  var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1);
  var NavigableRegion = (0, import_element30.forwardRef)(
    ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => {
      return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
        Tag,
        {
          ref,
          className: clsx_default("admin-ui-navigable-region", className),
          "aria-label": ariaLabel,
          role: "region",
          tabIndex: "-1",
          ...props,
          children
        }
      );
    }
  );
  NavigableRegion.displayName = "NavigableRegion";
  var navigable_region_default = NavigableRegion;

  // packages/interface/build-module/components/interface-skeleton/index.mjs
  var import_element31 = __toESM(require_element(), 1);
  var import_components25 = __toESM(require_components(), 1);
  var import_i18n51 = __toESM(require_i18n(), 1);
  var import_compose8 = __toESM(require_compose(), 1);
  var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1);
  var ANIMATION_DURATION2 = 0.25;
  var commonTransition = {
    type: "tween",
    duration: ANIMATION_DURATION2,
    ease: [0.6, 0, 0.4, 1]
  };
  function useHTMLClass(className) {
    (0, import_element31.useEffect)(() => {
      const element = document && document.querySelector(`html:not(.${className})`);
      if (!element) {
        return;
      }
      element.classList.toggle(className);
      return () => {
        element.classList.toggle(className);
      };
    }, [className]);
  }
  var headerVariants = {
    hidden: { opacity: 1, marginTop: -60 },
    visible: { opacity: 1, marginTop: 0 },
    distractionFreeHover: {
      opacity: 1,
      marginTop: 0,
      transition: {
        ...commonTransition,
        delay: 0.2,
        delayChildren: 0.2
      }
    },
    distractionFreeHidden: {
      opacity: 0,
      marginTop: -60
    },
    distractionFreeDisabled: {
      opacity: 0,
      marginTop: 0,
      transition: {
        ...commonTransition,
        delay: 0.8,
        delayChildren: 0.8
      }
    }
  };
  function InterfaceSkeleton({
    isDistractionFree,
    footer,
    header,
    editorNotices,
    sidebar,
    secondarySidebar,
    content,
    actions: actions2,
    labels,
    className
  }, ref) {
    const [secondarySidebarResizeListener, secondarySidebarSize] = (0, import_compose8.useResizeObserver)();
    const isMobileViewport = (0, import_compose8.useViewportMatch)("medium", "<");
    const disableMotion = (0, import_compose8.useReducedMotion)();
    const defaultTransition = {
      type: "tween",
      duration: disableMotion ? 0 : ANIMATION_DURATION2,
      ease: [0.6, 0, 0.4, 1]
    };
    useHTMLClass("interface-interface-skeleton__html-container");
    const defaultLabels = {
      /* translators: accessibility text for the top bar landmark region. */
      header: (0, import_i18n51._x)("Header", "header landmark area"),
      /* translators: accessibility text for the content landmark region. */
      body: (0, import_i18n51.__)("Content"),
      /* translators: accessibility text for the secondary sidebar landmark region. */
      secondarySidebar: (0, import_i18n51.__)("Block Library"),
      /* translators: accessibility text for the settings landmark region. */
      sidebar: (0, import_i18n51._x)("Settings", "settings landmark area"),
      /* translators: accessibility text for the publish landmark region. */
      actions: (0, import_i18n51.__)("Publish"),
      /* translators: accessibility text for the footer landmark region. */
      footer: (0, import_i18n51.__)("Footer")
    };
    const mergedLabels = { ...defaultLabels, ...labels };
    return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
      "div",
      {
        ref,
        className: clsx_default(
          className,
          "interface-interface-skeleton",
          !!footer && "has-footer"
        ),
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "interface-interface-skeleton__editor", children: [
            /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components25.__unstableAnimatePresence, { initial: false, children: !!header && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
              navigable_region_default,
              {
                as: import_components25.__unstableMotion.div,
                className: "interface-interface-skeleton__header",
                "aria-label": mergedLabels.header,
                initial: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden",
                whileHover: isDistractionFree && !isMobileViewport ? "distractionFreeHover" : "visible",
                animate: isDistractionFree && !isMobileViewport ? "distractionFreeDisabled" : "visible",
                exit: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden",
                variants: headerVariants,
                transition: defaultTransition,
                children: header
              }
            ) }),
            isDistractionFree && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "interface-interface-skeleton__header", children: editorNotices }),
            /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "interface-interface-skeleton__body", children: [
              /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components25.__unstableAnimatePresence, { initial: false, children: !!secondarySidebar && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
                navigable_region_default,
                {
                  className: "interface-interface-skeleton__secondary-sidebar",
                  ariaLabel: mergedLabels.secondarySidebar,
                  as: import_components25.__unstableMotion.div,
                  initial: "closed",
                  animate: "open",
                  exit: "closed",
                  variants: {
                    open: { width: secondarySidebarSize.width },
                    closed: { width: 0 }
                  },
                  transition: defaultTransition,
                  children: /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
                    import_components25.__unstableMotion.div,
                    {
                      style: {
                        position: "absolute",
                        width: isMobileViewport ? "100vw" : "fit-content",
                        height: "100%",
                        left: 0
                      },
                      variants: {
                        open: { x: 0 },
                        closed: { x: "-100%" }
                      },
                      transition: defaultTransition,
                      children: [
                        secondarySidebarResizeListener,
                        secondarySidebar
                      ]
                    }
                  )
                }
              ) }),
              /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
                navigable_region_default,
                {
                  className: "interface-interface-skeleton__content",
                  ariaLabel: mergedLabels.body,
                  children: content
                }
              ),
              !!sidebar && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
                navigable_region_default,
                {
                  className: "interface-interface-skeleton__sidebar",
                  ariaLabel: mergedLabels.sidebar,
                  children: sidebar
                }
              ),
              !!actions2 && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
                navigable_region_default,
                {
                  className: "interface-interface-skeleton__actions",
                  ariaLabel: mergedLabels.actions,
                  children: actions2
                }
              )
            ] })
          ] }),
          !!footer && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
            navigable_region_default,
            {
              className: "interface-interface-skeleton__footer",
              ariaLabel: mergedLabels.footer,
              children: footer
            }
          )
        ]
      }
    );
  }
  var interface_skeleton_default = (0, import_element31.forwardRef)(InterfaceSkeleton);

  // packages/editor/build-module/components/commands/index.mjs
  var import_html_entities8 = __toESM(require_html_entities(), 1);

  // packages/editor/build-module/components/pattern-rename-modal/index.mjs
  var import_data36 = __toESM(require_data(), 1);
  var import_patterns5 = __toESM(require_patterns(), 1);
  var import_core_data24 = __toESM(require_core_data(), 1);
  var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1);
  var { RenamePatternModal } = unlock(import_patterns5.privateApis);
  var modalName = "editor/pattern-rename";
  function PatternRenameModal() {
    const isActive = (0, import_data36.useSelect)(
      (select5) => select5(store2).isModalActive(modalName)
    );
    const { record, postType: postType2 } = (0, import_data36.useSelect)(
      (select5) => {
        if (!isActive) {
          return {};
        }
        const { getCurrentPostType: getCurrentPostType2, getCurrentPostId: getCurrentPostId2 } = select5(store);
        const { getEditedEntityRecord } = select5(import_core_data24.store);
        const _postType = getCurrentPostType2();
        return {
          record: getEditedEntityRecord(
            "postType",
            _postType,
            getCurrentPostId2()
          ),
          postType: _postType
        };
      },
      [isActive]
    );
    const { closeModal: closeModal2 } = (0, import_data36.useDispatch)(store2);
    if (!isActive || postType2 !== PATTERN_POST_TYPE) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(RenamePatternModal, { onClose: closeModal2, pattern: record });
  }

  // packages/editor/build-module/components/pattern-duplicate-modal/index.mjs
  var import_data37 = __toESM(require_data(), 1);
  var import_patterns6 = __toESM(require_patterns(), 1);
  var import_core_data25 = __toESM(require_core_data(), 1);
  var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1);
  var { DuplicatePatternModal } = unlock(import_patterns6.privateApis);
  var modalName2 = "editor/pattern-duplicate";
  function PatternDuplicateModal() {
    const isActive = (0, import_data37.useSelect)(
      (select5) => select5(store2).isModalActive(modalName2)
    );
    const { record, postType: postType2 } = (0, import_data37.useSelect)(
      (select5) => {
        if (!isActive) {
          return {};
        }
        const { getCurrentPostType: getCurrentPostType2, getCurrentPostId: getCurrentPostId2 } = select5(store);
        const { getEditedEntityRecord } = select5(import_core_data25.store);
        const _postType = getCurrentPostType2();
        return {
          record: getEditedEntityRecord(
            "postType",
            _postType,
            getCurrentPostId2()
          ),
          postType: _postType
        };
      },
      [isActive]
    );
    const { closeModal: closeModal2 } = (0, import_data37.useDispatch)(store2);
    if (!isActive || postType2 !== PATTERN_POST_TYPE) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
      DuplicatePatternModal,
      {
        onClose: closeModal2,
        onSuccess: () => closeModal2(),
        pattern: record
      }
    );
  }

  // packages/editor/build-module/components/commands/index.mjs
  var getEditorCommandLoader = () => function useEditorCommandLoader() {
    const {
      editorMode,
      isListViewOpen,
      showBlockBreadcrumbs,
      isDistractionFree,
      isFocusMode,
      isPreviewMode,
      isViewable,
      isCodeEditingEnabled,
      isRichEditingEnabled,
      isPublishSidebarEnabled: isPublishSidebarEnabled2
    } = (0, import_data38.useSelect)((select5) => {
      const { get } = select5(import_preferences7.store);
      const { isListViewOpened: isListViewOpened2, getCurrentPostType: getCurrentPostType2, getEditorSettings: getEditorSettings2 } = select5(store);
      const { getSettings: getSettings5 } = select5(import_block_editor10.store);
      const { getPostType } = select5(import_core_data26.store);
      return {
        editorMode: get("core", "editorMode") ?? "visual",
        isListViewOpen: isListViewOpened2(),
        showBlockBreadcrumbs: get("core", "showBlockBreadcrumbs"),
        isDistractionFree: get("core", "distractionFree"),
        isFocusMode: get("core", "focusMode"),
        isPreviewMode: getSettings5().isPreviewMode,
        isViewable: getPostType(getCurrentPostType2())?.viewable ?? false,
        isCodeEditingEnabled: getEditorSettings2().codeEditingEnabled,
        isRichEditingEnabled: getEditorSettings2().richEditingEnabled,
        isPublishSidebarEnabled: select5(store).isPublishSidebarEnabled()
      };
    }, []);
    const { getActiveComplementaryArea: getActiveComplementaryArea2 } = (0, import_data38.useSelect)(store2);
    const { toggle } = (0, import_data38.useDispatch)(import_preferences7.store);
    const { createInfoNotice } = (0, import_data38.useDispatch)(import_notices14.store);
    const {
      __unstableSaveForPreview: __unstableSaveForPreview2,
      setIsListViewOpened: setIsListViewOpened2,
      switchEditorMode: switchEditorMode2,
      toggleDistractionFree: toggleDistractionFree2,
      toggleSpotlightMode: toggleSpotlightMode2,
      toggleTopToolbar: toggleTopToolbar2
    } = (0, import_data38.useDispatch)(store);
    const { openModal: openModal2, enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data38.useDispatch)(store2);
    const { getCurrentPostId: getCurrentPostId2 } = (0, import_data38.useSelect)(store);
    const allowSwitchEditorMode = isCodeEditingEnabled && isRichEditingEnabled;
    if (isPreviewMode) {
      return { commands: [], isLoading: false };
    }
    const commands = [];
    commands.push({
      name: "core/open-shortcut-help",
      label: (0, import_i18n52.__)("Keyboard shortcuts"),
      icon: keyboard_default,
      callback: ({ close }) => {
        close();
        openModal2("editor/keyboard-shortcut-help");
      }
    });
    commands.push({
      name: "core/toggle-distraction-free",
      label: isDistractionFree ? (0, import_i18n52.__)("Exit Distraction free") : (0, import_i18n52.__)("Enter Distraction free"),
      callback: ({ close }) => {
        toggleDistractionFree2();
        close();
      }
    });
    commands.push({
      name: "core/open-preferences",
      label: (0, import_i18n52.__)("Editor preferences"),
      callback: ({ close }) => {
        close();
        openModal2("editor/preferences");
      }
    });
    commands.push({
      name: "core/toggle-spotlight-mode",
      label: isFocusMode ? (0, import_i18n52.__)("Exit Spotlight mode") : (0, import_i18n52.__)("Enter Spotlight mode"),
      callback: ({ close }) => {
        toggleSpotlightMode2();
        close();
      }
    });
    commands.push({
      name: "core/toggle-list-view",
      label: isListViewOpen ? (0, import_i18n52.__)("Close List View") : (0, import_i18n52.__)("Open List View"),
      icon: list_view_default,
      callback: ({ close }) => {
        setIsListViewOpened2(!isListViewOpen);
        close();
        createInfoNotice(
          isListViewOpen ? (0, import_i18n52.__)("List View off.") : (0, import_i18n52.__)("List View on."),
          {
            id: "core/editor/toggle-list-view/notice",
            type: "snackbar"
          }
        );
      }
    });
    commands.push({
      name: "core/toggle-top-toolbar",
      label: (0, import_i18n52.__)("Top toolbar"),
      callback: ({ close }) => {
        toggleTopToolbar2();
        close();
      }
    });
    if (allowSwitchEditorMode) {
      commands.push({
        name: "core/toggle-code-editor",
        label: editorMode === "visual" ? (0, import_i18n52.__)("Open code editor") : (0, import_i18n52.__)("Exit code editor"),
        icon: code_default,
        callback: ({ close }) => {
          switchEditorMode2(
            editorMode === "visual" ? "text" : "visual"
          );
          close();
        }
      });
    }
    commands.push({
      name: "core/toggle-breadcrumbs",
      label: showBlockBreadcrumbs ? (0, import_i18n52.__)("Hide block breadcrumbs") : (0, import_i18n52.__)("Show block breadcrumbs"),
      callback: ({ close }) => {
        toggle("core", "showBlockBreadcrumbs");
        close();
        createInfoNotice(
          showBlockBreadcrumbs ? (0, import_i18n52.__)("Breadcrumbs hidden.") : (0, import_i18n52.__)("Breadcrumbs visible."),
          {
            id: "core/editor/toggle-breadcrumbs/notice",
            type: "snackbar"
          }
        );
      }
    });
    commands.push({
      name: "core/open-settings-sidebar",
      label: (0, import_i18n52.__)("Show or hide the Settings panel"),
      icon: (0, import_i18n52.isRTL)() ? drawer_left_default : drawer_right_default,
      callback: ({ close }) => {
        const activeSidebar = getActiveComplementaryArea2("core");
        close();
        if (activeSidebar === "edit-post/document") {
          disableComplementaryArea2("core");
        } else {
          enableComplementaryArea2("core", "edit-post/document");
        }
      }
    });
    commands.push({
      name: "core/open-block-inspector",
      label: (0, import_i18n52.__)("Show or hide the Block settings panel"),
      icon: block_default_default,
      callback: ({ close }) => {
        const activeSidebar = getActiveComplementaryArea2("core");
        close();
        if (activeSidebar === "edit-post/block") {
          disableComplementaryArea2("core");
        } else {
          enableComplementaryArea2("core", "edit-post/block");
        }
      }
    });
    commands.push({
      name: "core/toggle-publish-sidebar",
      label: isPublishSidebarEnabled2 ? (0, import_i18n52.__)("Disable pre-publish checks") : (0, import_i18n52.__)("Enable pre-publish checks"),
      icon: format_list_bullets_default,
      callback: ({ close }) => {
        close();
        toggle("core", "isPublishSidebarEnabled");
        createInfoNotice(
          isPublishSidebarEnabled2 ? (0, import_i18n52.__)("Pre-publish checks disabled.") : (0, import_i18n52.__)("Pre-publish checks enabled."),
          {
            id: "core/editor/publish-sidebar/notice",
            type: "snackbar"
          }
        );
      }
    });
    if (isViewable) {
      commands.push({
        name: "core/preview-link",
        label: (0, import_i18n52.__)("Preview in a new tab"),
        icon: external_default,
        callback: async ({ close }) => {
          close();
          const postId2 = getCurrentPostId2();
          const link = await __unstableSaveForPreview2();
          window.open(link, `wp-preview-${postId2}`);
        }
      });
    }
    return {
      commands,
      isLoading: false
    };
  };
  var getEditedEntityContextualCommands = () => function useEditedEntityContextualCommands() {
    const { postType: postType2 } = (0, import_data38.useSelect)((select5) => {
      const { getCurrentPostType: getCurrentPostType2 } = select5(store);
      return {
        postType: getCurrentPostType2()
      };
    }, []);
    const { openModal: openModal2 } = (0, import_data38.useDispatch)(store2);
    const commands = [];
    if (postType2 === PATTERN_POST_TYPE) {
      commands.push({
        name: "core/rename-pattern",
        label: (0, import_i18n52.__)("Rename pattern"),
        icon: pencil_default,
        callback: ({ close }) => {
          openModal2(modalName);
          close();
        }
      });
      commands.push({
        name: "core/duplicate-pattern",
        label: (0, import_i18n52.__)("Duplicate pattern"),
        icon: symbol_default,
        callback: ({ close }) => {
          openModal2(modalName2);
          close();
        }
      });
    }
    return { isLoading: false, commands };
  };
  var getPageContentFocusCommands = () => function usePageContentFocusCommands() {
    const {
      onNavigateToEntityRecord,
      goBack,
      templateId: templateId2,
      isPreviewMode,
      canEditTemplate
    } = (0, import_data38.useSelect)((select5) => {
      const {
        getRenderingMode: getRenderingMode2,
        getEditorSettings: _getEditorSettings,
        getCurrentTemplateId: getCurrentTemplateId2
      } = unlock(select5(store));
      const editorSettings2 = _getEditorSettings();
      const _templateId = getCurrentTemplateId2();
      return {
        isTemplateHidden: getRenderingMode2() === "post-only",
        onNavigateToEntityRecord: editorSettings2.onNavigateToEntityRecord,
        getEditorSettings: _getEditorSettings,
        goBack: editorSettings2.onNavigateToPreviousEntityRecord,
        templateId: _templateId,
        isPreviewMode: editorSettings2.isPreviewMode,
        canEditTemplate: !!_templateId && select5(import_core_data26.store).canUser("update", {
          kind: "postType",
          name: "wp_template",
          id: _templateId
        })
      };
    }, []);
    const { editedRecord: template2, hasResolved } = (0, import_core_data26.useEntityRecord)(
      "postType",
      "wp_template",
      templateId2
    );
    if (isPreviewMode) {
      return { isLoading: false, commands: [] };
    }
    const commands = [];
    if (templateId2 && hasResolved && canEditTemplate) {
      commands.push({
        name: "core/switch-to-template-focus",
        label: (0, import_i18n52.sprintf)(
          /* translators: %s: template title */
          (0, import_i18n52.__)("Edit template: %s"),
          (0, import_html_entities8.decodeEntities)(template2.title)
        ),
        icon: layout_default,
        callback: ({ close }) => {
          onNavigateToEntityRecord({
            postId: templateId2,
            postType: "wp_template"
          });
          close();
        }
      });
    }
    if (!!goBack) {
      commands.push({
        name: "core/switch-to-previous-entity",
        label: (0, import_i18n52.__)("Go back"),
        icon: page_default,
        callback: ({ close }) => {
          goBack();
          close();
        }
      });
    }
    return { isLoading: false, commands };
  };
  var getManipulateDocumentCommands = () => function useManipulateDocumentCommands() {
    const { postType: postType2, postId: postId2 } = (0, import_data38.useSelect)((select5) => {
      const { getCurrentPostId: getCurrentPostId2, getCurrentPostType: getCurrentPostType2 } = select5(store);
      return {
        postType: getCurrentPostType2(),
        postId: getCurrentPostId2()
      };
    }, []);
    const { editedRecord: template2, hasResolved } = (0, import_core_data26.useEntityRecord)(
      "postType",
      postType2,
      postId2
    );
    const { revertTemplate: revertTemplate3 } = unlock((0, import_data38.useDispatch)(store));
    if (!hasResolved || ![TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE].includes(
      postType2
    )) {
      return { isLoading: true, commands: [] };
    }
    const commands = [];
    if (isTemplateRevertable(template2)) {
      const label = template2.type === TEMPLATE_POST_TYPE ? (0, import_i18n52.sprintf)(
        /* translators: %s: template title */
        (0, import_i18n52.__)("Reset template: %s"),
        (0, import_html_entities8.decodeEntities)(template2.title)
      ) : (0, import_i18n52.sprintf)(
        /* translators: %s: template part title */
        (0, import_i18n52.__)("Reset template part: %s"),
        (0, import_html_entities8.decodeEntities)(template2.title)
      );
      commands.push({
        name: "core/reset-template",
        label,
        icon: (0, import_i18n52.isRTL)() ? rotate_right_default : rotate_left_default,
        callback: ({ close }) => {
          revertTemplate3(template2);
          close();
        }
      });
    }
    return {
      isLoading: !hasResolved,
      commands
    };
  };
  function useCommands() {
    (0, import_commands.useCommandLoader)({
      name: "core/editor/edit-ui",
      hook: getEditorCommandLoader()
    });
    (0, import_commands.useCommandLoader)({
      name: "core/editor/contextual-commands",
      hook: getEditedEntityContextualCommands(),
      context: "entity-edit"
    });
    (0, import_commands.useCommandLoader)({
      name: "core/editor/page-content-focus",
      hook: getPageContentFocusCommands(),
      context: "entity-edit"
    });
    (0, import_commands.useCommandLoader)({
      name: "core/edit-site/manipulate-document",
      hook: getManipulateDocumentCommands()
    });
  }

  // packages/editor/build-module/components/block-removal-warnings/index.mjs
  var import_i18n53 = __toESM(require_i18n(), 1);
  var import_block_editor11 = __toESM(require_block_editor(), 1);
  var import_data39 = __toESM(require_data(), 1);
  var import_element32 = __toESM(require_element(), 1);
  var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1);
  var { BlockRemovalWarningModal } = unlock(import_block_editor11.privateApis);
  var TEMPLATE_BLOCKS = [
    "core/post-content",
    "core/post-template",
    "core/query"
  ];
  var BLOCK_REMOVAL_RULES = [
    {
      // Template blocks.
      // The warning is only shown when a user manipulates templates or template parts.
      postTypes: ["wp_template", "wp_template_part"],
      callback(removedBlocks) {
        const removedTemplateBlocks = removedBlocks.filter(
          ({ name: name2 }) => TEMPLATE_BLOCKS.includes(name2)
        );
        if (removedTemplateBlocks.length) {
          return (0, import_i18n53._n)(
            "Deleting this block will stop your post or page content from displaying on this template. It is not recommended.",
            "Some of the deleted blocks will stop your post or page content from displaying on this template. It is not recommended.",
            removedBlocks.length
          );
        }
      }
    },
    {
      // Pattern overrides.
      // The warning is only shown when the user edits a pattern.
      postTypes: ["wp_block"],
      callback(removedBlocks) {
        const removedBlocksWithOverrides = removedBlocks.filter(
          ({ attributes }) => attributes?.metadata?.bindings && Object.values(attributes.metadata.bindings).some(
            (binding) => binding.source === "core/pattern-overrides"
          )
        );
        if (removedBlocksWithOverrides.length) {
          return (0, import_i18n53._n)(
            "The deleted block allows instance overrides. Removing it may result in content not displaying where this pattern is used. Are you sure you want to proceed?",
            "Some of the deleted blocks allow instance overrides. Removing them may result in content not displaying where this pattern is used. Are you sure you want to proceed?",
            removedBlocks.length
          );
        }
      }
    }
  ];
  function BlockRemovalWarnings() {
    const currentPostType = (0, import_data39.useSelect)(
      (select5) => select5(store).getCurrentPostType(),
      []
    );
    const removalRulesForPostType = (0, import_element32.useMemo)(
      () => BLOCK_REMOVAL_RULES.filter(
        (rule) => rule.postTypes.includes(currentPostType)
      ),
      [currentPostType]
    );
    if (!BlockRemovalWarningModal) {
      return null;
    }
    if (!removalRulesForPostType) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(BlockRemovalWarningModal, { rules: removalRulesForPostType });
  }

  // packages/editor/build-module/components/start-page-options/index.mjs
  var import_components26 = __toESM(require_components(), 1);
  var import_i18n54 = __toESM(require_i18n(), 1);
  var import_element33 = __toESM(require_element(), 1);
  var import_block_editor12 = __toESM(require_block_editor(), 1);
  var import_data40 = __toESM(require_data(), 1);
  var import_core_data27 = __toESM(require_core_data(), 1);
  var import_blocks10 = __toESM(require_blocks(), 1);
  var import_preferences8 = __toESM(require_preferences(), 1);
  var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1);
  function useStartPatterns() {
    const { blockPatternsWithPostContentBlockType, postType: postType2 } = (0, import_data40.useSelect)(
      (select5) => {
        const { getPatternsByBlockTypes, getBlocksByName } = select5(import_block_editor12.store);
        const { getCurrentPostType: getCurrentPostType2, getRenderingMode: getRenderingMode2 } = select5(store);
        const rootClientId = getRenderingMode2() === "post-only" ? "" : getBlocksByName("core/post-content")?.[0];
        return {
          blockPatternsWithPostContentBlockType: getPatternsByBlockTypes(
            "core/post-content",
            rootClientId
          ),
          postType: getCurrentPostType2()
        };
      },
      []
    );
    return (0, import_element33.useMemo)(() => {
      if (!blockPatternsWithPostContentBlockType?.length) {
        return [];
      }
      return blockPatternsWithPostContentBlockType.filter((pattern) => {
        return postType2 === "page" && !pattern.postTypes || Array.isArray(pattern.postTypes) && pattern.postTypes.includes(postType2);
      });
    }, [postType2, blockPatternsWithPostContentBlockType]);
  }
  function PatternSelection({ blockPatterns, onChoosePattern }) {
    const { editEntityRecord } = (0, import_data40.useDispatch)(import_core_data27.store);
    const { postType: postType2, postId: postId2 } = (0, import_data40.useSelect)((select5) => {
      const { getCurrentPostType: getCurrentPostType2, getCurrentPostId: getCurrentPostId2 } = select5(store);
      return {
        postType: getCurrentPostType2(),
        postId: getCurrentPostId2()
      };
    }, []);
    return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
      import_block_editor12.__experimentalBlockPatternsList,
      {
        blockPatterns,
        onClickPattern: (_pattern, blocks) => {
          editEntityRecord("postType", postType2, postId2, {
            blocks,
            content: ({ blocks: blocksForSerialization = [] }) => (0, import_blocks10.__unstableSerializeAndClean)(blocksForSerialization)
          });
          onChoosePattern();
        }
      }
    );
  }
  function StartPageOptionsModal({ onClose }) {
    const [showStartPatterns, setShowStartPatterns] = (0, import_element33.useState)(true);
    const { set: setPreference } = (0, import_data40.useDispatch)(import_preferences8.store);
    const startPatterns = useStartPatterns();
    const hasStartPattern = startPatterns.length > 0;
    if (!hasStartPattern) {
      return null;
    }
    function handleClose() {
      onClose();
      setPreference("core", "enableChoosePatternModal", showStartPatterns);
    }
    return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(
      import_components26.Modal,
      {
        className: "editor-start-page-options__modal",
        title: (0, import_i18n54.__)("Choose a pattern"),
        isFullScreen: true,
        onRequestClose: handleClose,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "editor-start-page-options__modal-content", children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
            PatternSelection,
            {
              blockPatterns: startPatterns,
              onChoosePattern: handleClose
            }
          ) }),
          /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
            import_components26.Flex,
            {
              className: "editor-start-page-options__modal__actions",
              justify: "flex-start",
              expanded: false,
              children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_components26.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
                import_components26.CheckboxControl,
                {
                  checked: showStartPatterns,
                  label: (0, import_i18n54.__)(
                    "Always show starter patterns for new pages"
                  ),
                  onChange: (newValue) => {
                    setShowStartPatterns(newValue);
                  }
                }
              ) })
            }
          )
        ]
      }
    );
  }
  function StartPageOptions() {
    const [isOpen, setIsOpen] = (0, import_element33.useState)(false);
    const { isEditedPostDirty: isEditedPostDirty2, isEditedPostEmpty: isEditedPostEmpty2 } = (0, import_data40.useSelect)(store);
    const { isModalActive: isModalActive2 } = (0, import_data40.useSelect)(store2);
    const { enabled, postId: postId2 } = (0, import_data40.useSelect)((select5) => {
      const { getCurrentPostId: getCurrentPostId2, getCurrentPostType: getCurrentPostType2 } = select5(store);
      const choosePatternModalEnabled = select5(import_preferences8.store).get(
        "core",
        "enableChoosePatternModal"
      );
      const currentPostType = getCurrentPostType2();
      return {
        postId: getCurrentPostId2(),
        enabled: choosePatternModalEnabled && TEMPLATE_POST_TYPE !== currentPostType && TEMPLATE_PART_POST_TYPE !== currentPostType
      };
    }, []);
    (0, import_element33.useEffect)(() => {
      const isFreshPage = !isEditedPostDirty2() && isEditedPostEmpty2();
      const isPreferencesModalActive = isModalActive2("editor/preferences");
      if (!enabled || !isFreshPage || isPreferencesModalActive) {
        return;
      }
      setIsOpen(true);
    }, [
      enabled,
      postId2,
      isEditedPostDirty2,
      isEditedPostEmpty2,
      isModalActive2
    ]);
    if (!isOpen) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(StartPageOptionsModal, { onClose: () => setIsOpen(false) });
  }

  // packages/editor/build-module/components/keyboard-shortcut-help-modal/index.mjs
  var import_components27 = __toESM(require_components(), 1);
  var import_i18n56 = __toESM(require_i18n(), 1);
  var import_keyboard_shortcuts2 = __toESM(require_keyboard_shortcuts(), 1);
  var import_data42 = __toESM(require_data(), 1);

  // packages/editor/build-module/components/keyboard-shortcut-help-modal/config.mjs
  var import_i18n55 = __toESM(require_i18n(), 1);
  var textFormattingShortcuts = [
    {
      keyCombination: { modifier: "primary", character: "b" },
      description: (0, import_i18n55.__)("Make the selected text bold.")
    },
    {
      keyCombination: { modifier: "primary", character: "i" },
      description: (0, import_i18n55.__)("Make the selected text italic.")
    },
    {
      keyCombination: { modifier: "primary", character: "k" },
      description: (0, import_i18n55.__)("Convert the selected text into a link.")
    },
    {
      keyCombination: { modifier: "primaryShift", character: "k" },
      description: (0, import_i18n55.__)("Remove a link.")
    },
    {
      keyCombination: { character: "[[" },
      description: (0, import_i18n55.__)("Insert a link to a post or page.")
    },
    {
      keyCombination: { modifier: "primary", character: "u" },
      description: (0, import_i18n55.__)("Underline the selected text.")
    },
    {
      keyCombination: { modifier: "access", character: "d" },
      description: (0, import_i18n55.__)("Strikethrough the selected text.")
    },
    {
      keyCombination: { modifier: "access", character: "x" },
      description: (0, import_i18n55.__)("Make the selected text inline code.")
    },
    {
      keyCombination: {
        modifier: "access",
        character: "0"
      },
      aliases: [
        {
          modifier: "access",
          character: "7"
        }
      ],
      description: (0, import_i18n55.__)("Convert the current heading to a paragraph.")
    },
    {
      keyCombination: { modifier: "access", character: "1-6" },
      description: (0, import_i18n55.__)(
        "Convert the current paragraph or heading to a heading of level 1 to 6."
      )
    },
    {
      keyCombination: { modifier: "primaryShift", character: "SPACE" },
      description: (0, import_i18n55.__)("Add non breaking space.")
    }
  ];

  // packages/editor/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs
  var import_element34 = __toESM(require_element(), 1);
  var import_keycodes = __toESM(require_keycodes(), 1);
  var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1);
  function KeyCombination({ keyCombination, forceAriaLabel }) {
    const shortcut = keyCombination.modifier ? import_keycodes.displayShortcutList[keyCombination.modifier](
      keyCombination.character
    ) : keyCombination.character;
    const ariaLabel = keyCombination.modifier ? import_keycodes.shortcutAriaLabel[keyCombination.modifier](
      keyCombination.character
    ) : keyCombination.character;
    return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
      "kbd",
      {
        className: "editor-keyboard-shortcut-help-modal__shortcut-key-combination",
        "aria-label": forceAriaLabel || ariaLabel,
        children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map(
          (character, index2) => {
            if (character === "+") {
              return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_element34.Fragment, { children: character }, index2);
            }
            return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
              "kbd",
              {
                className: "editor-keyboard-shortcut-help-modal__shortcut-key",
                children: character
              },
              index2
            );
          }
        )
      }
    );
  }
  function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) {
    return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "editor-keyboard-shortcut-help-modal__shortcut-description", children: description }),
      /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "editor-keyboard-shortcut-help-modal__shortcut-term", children: [
        /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
          KeyCombination,
          {
            keyCombination,
            forceAriaLabel: ariaLabel
          }
        ),
        aliases.map((alias, index2) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
          KeyCombination,
          {
            keyCombination: alias,
            forceAriaLabel: ariaLabel
          },
          index2
        ))
      ] })
    ] });
  }
  var shortcut_default = Shortcut;

  // packages/editor/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs
  var import_data41 = __toESM(require_data(), 1);
  var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1);
  var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1);
  function DynamicShortcut({ name: name2 }) {
    const { keyCombination, description, aliases } = (0, import_data41.useSelect)(
      (select5) => {
        const {
          getShortcutKeyCombination,
          getShortcutDescription,
          getShortcutAliases
        } = select5(import_keyboard_shortcuts.store);
        return {
          keyCombination: getShortcutKeyCombination(name2),
          aliases: getShortcutAliases(name2),
          description: getShortcutDescription(name2)
        };
      },
      [name2]
    );
    if (!keyCombination) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
      shortcut_default,
      {
        keyCombination,
        description,
        aliases
      }
    );
  }
  var dynamic_shortcut_default = DynamicShortcut;

  // packages/editor/build-module/components/keyboard-shortcut-help-modal/index.mjs
  var import_jsx_runtime109 = __toESM(require_jsx_runtime(), 1);
  var KEYBOARD_SHORTCUT_HELP_MODAL_NAME = "editor/keyboard-shortcut-help";
  var ShortcutList = ({ shortcuts }) => (
    /*
     * Disable reason: The `list` ARIA role is redundant but
     * Safari+VoiceOver won't announce the list otherwise.
     */
    /* eslint-disable jsx-a11y/no-redundant-roles */
    /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
      "ul",
      {
        className: "editor-keyboard-shortcut-help-modal__shortcut-list",
        role: "list",
        children: shortcuts.map((shortcut, index2) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
          "li",
          {
            className: "editor-keyboard-shortcut-help-modal__shortcut",
            children: typeof shortcut === "string" ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(dynamic_shortcut_default, { name: shortcut }) : /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(shortcut_default, { ...shortcut })
          },
          index2
        ))
      }
    )
  );
  var ShortcutSection = ({ title, shortcuts, className }) => /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(
    "section",
    {
      className: clsx_default(
        "editor-keyboard-shortcut-help-modal__section",
        className
      ),
      children: [
        !!title && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("h2", { className: "editor-keyboard-shortcut-help-modal__section-title", children: title }),
        /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ShortcutList, { shortcuts })
      ]
    }
  );
  var ShortcutCategorySection = ({
    title,
    categoryName,
    additionalShortcuts = []
  }) => {
    const categoryShortcuts = (0, import_data42.useSelect)(
      (select5) => {
        return select5(import_keyboard_shortcuts2.store).getCategoryShortcuts(
          categoryName
        );
      },
      [categoryName]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
      ShortcutSection,
      {
        title,
        shortcuts: categoryShortcuts.concat(additionalShortcuts)
      }
    );
  };
  function KeyboardShortcutHelpModal() {
    const isModalActive2 = (0, import_data42.useSelect)(
      (select5) => select5(store2).isModalActive(
        KEYBOARD_SHORTCUT_HELP_MODAL_NAME
      ),
      []
    );
    const { openModal: openModal2, closeModal: closeModal2 } = (0, import_data42.useDispatch)(store2);
    const toggleModal = () => {
      if (isModalActive2) {
        closeModal2();
      } else {
        openModal2(KEYBOARD_SHORTCUT_HELP_MODAL_NAME);
      }
    };
    (0, import_keyboard_shortcuts2.useShortcut)("core/editor/keyboard-shortcuts", toggleModal);
    if (!isModalActive2) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(
      import_components27.Modal,
      {
        className: "editor-keyboard-shortcut-help-modal",
        title: (0, import_i18n56.__)("Keyboard shortcuts"),
        closeButtonLabel: (0, import_i18n56.__)("Close"),
        onRequestClose: toggleModal,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
            ShortcutSection,
            {
              className: "editor-keyboard-shortcut-help-modal__main-shortcuts",
              shortcuts: ["core/editor/keyboard-shortcuts"]
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
            ShortcutCategorySection,
            {
              title: (0, import_i18n56.__)("Global shortcuts"),
              categoryName: "global"
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
            ShortcutCategorySection,
            {
              title: (0, import_i18n56.__)("Selection shortcuts"),
              categoryName: "selection"
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
            ShortcutCategorySection,
            {
              title: (0, import_i18n56.__)("Block shortcuts"),
              categoryName: "block",
              additionalShortcuts: [
                {
                  keyCombination: { character: "/" },
                  description: (0, import_i18n56.__)(
                    "Change the block type after adding a new paragraph."
                  ),
                  /* translators: The forward-slash character. e.g. '/'. */
                  ariaLabel: (0, import_i18n56.__)("Forward-slash")
                }
              ]
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
            ShortcutSection,
            {
              title: (0, import_i18n56.__)("Text formatting"),
              shortcuts: textFormattingShortcuts
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
            ShortcutCategorySection,
            {
              title: (0, import_i18n56.__)("List View shortcuts"),
              categoryName: "list-view"
            }
          )
        ]
      }
    );
  }
  var keyboard_shortcut_help_modal_default = KeyboardShortcutHelpModal;

  // packages/editor/build-module/components/start-template-options/index.mjs
  var import_components28 = __toESM(require_components(), 1);
  var import_i18n57 = __toESM(require_i18n(), 1);
  var import_element35 = __toESM(require_element(), 1);
  var import_block_editor13 = __toESM(require_block_editor(), 1);
  var import_data43 = __toESM(require_data(), 1);
  var import_blocks11 = __toESM(require_blocks(), 1);
  var import_core_data28 = __toESM(require_core_data(), 1);
  var import_jsx_runtime110 = __toESM(require_jsx_runtime(), 1);
  function useFallbackTemplateContent(slug, isCustom = false) {
    return (0, import_data43.useSelect)(
      (select5) => {
        const { getEntityRecord, getDefaultTemplateId } = select5(import_core_data28.store);
        const templateId2 = getDefaultTemplateId({
          slug,
          is_custom: isCustom,
          ignore_empty: true
        });
        return templateId2 ? getEntityRecord("postType", TEMPLATE_POST_TYPE, templateId2)?.content?.raw : void 0;
      },
      [slug, isCustom]
    );
  }
  function useStartPatterns2(fallbackContent) {
    const { slug, patterns: patterns2 } = (0, import_data43.useSelect)((select5) => {
      const { getCurrentPostType: getCurrentPostType2, getCurrentPostId: getCurrentPostId2 } = select5(store);
      const { getEntityRecord, getBlockPatterns } = select5(import_core_data28.store);
      const postId2 = getCurrentPostId2();
      const postType2 = getCurrentPostType2();
      const record = getEntityRecord("postType", postType2, postId2);
      return {
        slug: record.slug,
        patterns: getBlockPatterns()
      };
    }, []);
    const currentThemeStylesheet = (0, import_data43.useSelect)(
      (select5) => select5(import_core_data28.store).getCurrentTheme().stylesheet
    );
    function injectThemeAttributeInBlockTemplateContent2(block) {
      if (block.innerBlocks.find(
        (innerBlock) => innerBlock.name === "core/template-part"
      )) {
        block.innerBlocks = block.innerBlocks.map((innerBlock) => {
          if (innerBlock.name === "core/template-part" && innerBlock.attributes.theme === void 0) {
            innerBlock.attributes.theme = currentThemeStylesheet;
          }
          return innerBlock;
        });
      }
      if (block.name === "core/template-part" && block.attributes.theme === void 0) {
        block.attributes.theme = currentThemeStylesheet;
      }
      return block;
    }
    return (0, import_element35.useMemo)(() => {
      return [
        {
          name: "fallback",
          blocks: (0, import_blocks11.parse)(fallbackContent),
          title: (0, import_i18n57.__)("Fallback content")
        },
        ...patterns2.filter((pattern) => {
          return Array.isArray(pattern.templateTypes) && pattern.templateTypes.some(
            (templateType) => slug.startsWith(templateType)
          );
        }).map((pattern) => {
          return {
            ...pattern,
            blocks: (0, import_blocks11.parse)(pattern.content).map(
              (block) => injectThemeAttributeInBlockTemplateContent2(block)
            )
          };
        })
      ];
    }, [fallbackContent, slug, patterns2]);
  }
  function PatternSelection2({ fallbackContent, onChoosePattern, postType: postType2 }) {
    const [, , onChange] = (0, import_core_data28.useEntityBlockEditor)("postType", postType2);
    const blockPatterns = useStartPatterns2(fallbackContent);
    return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
      import_block_editor13.__experimentalBlockPatternsList,
      {
        blockPatterns,
        onClickPattern: (pattern, blocks) => {
          onChange(blocks, { selection: void 0 });
          onChoosePattern();
        }
      }
    );
  }
  function StartModal({ slug, isCustom, onClose, postType: postType2 }) {
    const fallbackContent = useFallbackTemplateContent(slug, isCustom);
    if (!fallbackContent) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(
      import_components28.Modal,
      {
        className: "editor-start-template-options__modal",
        title: (0, import_i18n57.__)("Choose a pattern"),
        closeLabel: (0, import_i18n57.__)("Cancel"),
        focusOnMount: "firstElement",
        onRequestClose: onClose,
        isFullScreen: true,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: "editor-start-template-options__modal-content", children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
            PatternSelection2,
            {
              fallbackContent,
              slug,
              isCustom,
              postType: postType2,
              onChoosePattern: () => {
                onClose();
              }
            }
          ) }),
          /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
            import_components28.Flex,
            {
              className: "editor-start-template-options__modal__actions",
              justify: "flex-end",
              expanded: false,
              children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_components28.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
                import_components28.Button,
                {
                  __next40pxDefaultSize: true,
                  variant: "tertiary",
                  onClick: onClose,
                  children: (0, import_i18n57.__)("Skip")
                }
              ) })
            }
          )
        ]
      }
    );
  }
  function StartTemplateOptions() {
    const [isClosed, setIsClosed] = (0, import_element35.useState)(false);
    const { shouldOpenModal, slug, isCustom, postType: postType2, postId: postId2 } = (0, import_data43.useSelect)(
      (select5) => {
        const { getCurrentPostType: getCurrentPostType2, getCurrentPostId: getCurrentPostId2 } = select5(store);
        const _postType = getCurrentPostType2();
        const _postId = getCurrentPostId2();
        const { getEditedEntityRecord, hasEditsForEntityRecord } = select5(import_core_data28.store);
        const templateRecord = getEditedEntityRecord(
          "postType",
          _postType,
          _postId
        );
        const hasEdits = hasEditsForEntityRecord(
          "postType",
          _postType,
          _postId
        );
        return {
          shouldOpenModal: !hasEdits && "" === templateRecord.content && TEMPLATE_POST_TYPE === _postType,
          slug: templateRecord.slug,
          isCustom: templateRecord.is_custom,
          postType: _postType,
          postId: _postId
        };
      },
      []
    );
    (0, import_element35.useEffect)(() => {
      setIsClosed(false);
    }, [postType2, postId2]);
    if (!shouldOpenModal || isClosed) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
      StartModal,
      {
        slug,
        isCustom,
        postType: postType2,
        onClose: () => setIsClosed(true)
      }
    );
  }

  // packages/editor/build-module/components/global-keyboard-shortcuts/index.mjs
  var import_keyboard_shortcuts3 = __toESM(require_keyboard_shortcuts(), 1);
  var import_data44 = __toESM(require_data(), 1);
  var import_block_editor14 = __toESM(require_block_editor(), 1);
  function EditorKeyboardShortcuts() {
    const isModeToggleDisabled = (0, import_data44.useSelect)((select5) => {
      const { richEditingEnabled, codeEditingEnabled } = select5(store).getEditorSettings();
      return !richEditingEnabled || !codeEditingEnabled;
    }, []);
    const { getBlockSelectionStart: getBlockSelectionStart2 } = (0, import_data44.useSelect)(import_block_editor14.store);
    const { getActiveComplementaryArea: getActiveComplementaryArea2 } = (0, import_data44.useSelect)(store2);
    const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data44.useDispatch)(store2);
    const {
      redo: redo2,
      undo: undo2,
      savePost: savePost2,
      setIsListViewOpened: setIsListViewOpened2,
      switchEditorMode: switchEditorMode2,
      toggleDistractionFree: toggleDistractionFree2
    } = (0, import_data44.useDispatch)(store);
    const {
      isEditedPostDirty: isEditedPostDirty2,
      isPostSavingLocked: isPostSavingLocked2,
      isListViewOpened: isListViewOpened2,
      getEditorMode: getEditorMode2
    } = (0, import_data44.useSelect)(store);
    (0, import_keyboard_shortcuts3.useShortcut)(
      "core/editor/toggle-mode",
      () => {
        switchEditorMode2(
          getEditorMode2() === "visual" ? "text" : "visual"
        );
      },
      {
        isDisabled: isModeToggleDisabled
      }
    );
    (0, import_keyboard_shortcuts3.useShortcut)("core/editor/toggle-distraction-free", () => {
      toggleDistractionFree2();
    });
    (0, import_keyboard_shortcuts3.useShortcut)("core/editor/undo", (event) => {
      undo2();
      event.preventDefault();
    });
    (0, import_keyboard_shortcuts3.useShortcut)("core/editor/redo", (event) => {
      redo2();
      event.preventDefault();
    });
    (0, import_keyboard_shortcuts3.useShortcut)("core/editor/save", (event) => {
      event.preventDefault();
      if (isPostSavingLocked2()) {
        return;
      }
      if (!isEditedPostDirty2()) {
        return;
      }
      savePost2();
    });
    (0, import_keyboard_shortcuts3.useShortcut)("core/editor/toggle-list-view", (event) => {
      if (!isListViewOpened2()) {
        event.preventDefault();
        setIsListViewOpened2(true);
      }
    });
    (0, import_keyboard_shortcuts3.useShortcut)("core/editor/toggle-sidebar", (event) => {
      event.preventDefault();
      const isEditorSidebarOpened = [
        "edit-post/document",
        "edit-post/block"
      ].includes(getActiveComplementaryArea2("core"));
      if (isEditorSidebarOpened) {
        disableComplementaryArea2("core");
      } else {
        const sidebarToOpen = getBlockSelectionStart2() ? "edit-post/block" : "edit-post/document";
        enableComplementaryArea2("core", sidebarToOpen);
      }
    });
    return null;
  }

  // packages/editor/build-module/components/template-part-menu-items/index.mjs
  var import_data47 = __toESM(require_data(), 1);
  var import_block_editor17 = __toESM(require_block_editor(), 1);

  // packages/editor/build-module/components/template-part-menu-items/convert-to-regular.mjs
  var import_data45 = __toESM(require_data(), 1);
  var import_block_editor15 = __toESM(require_block_editor(), 1);
  var import_components29 = __toESM(require_components(), 1);
  var import_i18n58 = __toESM(require_i18n(), 1);
  var import_jsx_runtime111 = __toESM(require_jsx_runtime(), 1);
  function ConvertToRegularBlocks({ clientId, onClose }) {
    const { getBlocks: getBlocks2 } = (0, import_data45.useSelect)(import_block_editor15.store);
    const { replaceBlocks: replaceBlocks2 } = (0, import_data45.useDispatch)(import_block_editor15.store);
    const canRemove = (0, import_data45.useSelect)(
      (select5) => select5(import_block_editor15.store).canRemoveBlock(clientId),
      [clientId]
    );
    if (!canRemove) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
      import_components29.MenuItem,
      {
        onClick: () => {
          replaceBlocks2(clientId, getBlocks2(clientId));
          onClose();
        },
        children: (0, import_i18n58.__)("Detach")
      }
    );
  }

  // packages/editor/build-module/components/template-part-menu-items/convert-to-template-part.mjs
  var import_data46 = __toESM(require_data(), 1);
  var import_block_editor16 = __toESM(require_block_editor(), 1);
  var import_components30 = __toESM(require_components(), 1);
  var import_blocks12 = __toESM(require_blocks(), 1);
  var import_i18n59 = __toESM(require_i18n(), 1);
  var import_element36 = __toESM(require_element(), 1);
  var import_notices15 = __toESM(require_notices(), 1);
  var import_core_data29 = __toESM(require_core_data(), 1);
  var import_jsx_runtime112 = __toESM(require_jsx_runtime(), 1);
  function ConvertToTemplatePart({ clientIds, blocks }) {
    const [isModalOpen, setIsModalOpen] = (0, import_element36.useState)(false);
    const { replaceBlocks: replaceBlocks2 } = (0, import_data46.useDispatch)(import_block_editor16.store);
    const { createSuccessNotice } = (0, import_data46.useDispatch)(import_notices15.store);
    const { isBlockBasedTheme, canCreate } = (0, import_data46.useSelect)((select5) => {
      return {
        isBlockBasedTheme: select5(import_core_data29.store).getCurrentTheme()?.is_block_theme,
        canCreate: select5(import_block_editor16.store).canInsertBlockType(
          "core/template-part"
        )
      };
    }, []);
    if (!isBlockBasedTheme || !canCreate) {
      return null;
    }
    const onConvert = async (templatePart) => {
      replaceBlocks2(
        clientIds,
        (0, import_blocks12.createBlock)("core/template-part", {
          slug: templatePart.slug,
          theme: templatePart.theme
        })
      );
      createSuccessNotice((0, import_i18n59.__)("Template part created."), {
        type: "snackbar"
      });
    };
    return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(import_jsx_runtime112.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
        import_components30.MenuItem,
        {
          icon: symbol_filled_default,
          onClick: () => {
            setIsModalOpen(true);
          },
          "aria-expanded": isModalOpen,
          "aria-haspopup": "dialog",
          children: (0, import_i18n59.__)("Create template part")
        }
      ),
      isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
        CreateTemplatePartModal,
        {
          closeModal: () => {
            setIsModalOpen(false);
          },
          blocks,
          onCreate: onConvert
        }
      )
    ] });
  }

  // packages/editor/build-module/components/template-part-menu-items/index.mjs
  var import_jsx_runtime113 = __toESM(require_jsx_runtime(), 1);
  function TemplatePartMenuItems() {
    return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_block_editor17.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
      TemplatePartConverterMenuItem,
      {
        clientIds: selectedClientIds,
        onClose
      }
    ) });
  }
  function TemplatePartConverterMenuItem({ clientIds, onClose }) {
    const { blocks } = (0, import_data47.useSelect)(
      (select5) => {
        const { getBlocksByClientId: getBlocksByClientId2 } = select5(import_block_editor17.store);
        return {
          blocks: getBlocksByClientId2(clientIds)
        };
      },
      [clientIds]
    );
    if (blocks.length === 1 && blocks[0]?.name === "core/template-part") {
      return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
        ConvertToRegularBlocks,
        {
          clientId: clientIds[0],
          onClose
        }
      );
    }
    return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(ConvertToTemplatePart, { clientIds, blocks });
  }

  // packages/editor/build-module/components/provider/index.mjs
  var import_jsx_runtime114 = __toESM(require_jsx_runtime(), 1);
  var { ExperimentalBlockEditorProvider } = unlock(import_block_editor18.privateApis);
  var { PatternsMenuItems } = unlock(import_patterns7.privateApis);
  var noop3 = () => {
  };
  var NON_CONTEXTUAL_POST_TYPES = [
    "wp_block",
    "wp_navigation",
    "wp_template_part"
  ];
  function useBlockEditorProps(post2, template2, mode) {
    const rootLevelPost = mode === "template-locked" ? "template" : "post";
    const [postBlocks, onInput, onChange] = (0, import_core_data30.useEntityBlockEditor)(
      "postType",
      post2.type,
      { id: post2.id }
    );
    const [templateBlocks, onInputTemplate, onChangeTemplate] = (0, import_core_data30.useEntityBlockEditor)("postType", template2?.type, {
      id: template2?.id
    });
    const maybeNavigationBlocks = (0, import_element37.useMemo)(() => {
      if (post2.type === "wp_navigation") {
        return [
          (0, import_blocks13.createBlock)("core/navigation", {
            ref: post2.id,
            // As the parent editor is locked with `templateLock`, the template locking
            // must be explicitly "unset" on the block itself to allow the user to modify
            // the block's content.
            templateLock: false
          })
        ];
      }
    }, [post2.type, post2.id]);
    const blocks = (0, import_element37.useMemo)(() => {
      if (maybeNavigationBlocks) {
        return maybeNavigationBlocks;
      }
      if (rootLevelPost === "template") {
        return templateBlocks;
      }
      return postBlocks;
    }, [maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks]);
    const disableRootLevelChanges = !!template2 && mode === "template-locked" || post2.type === "wp_navigation";
    if (disableRootLevelChanges) {
      return [blocks, noop3, noop3];
    }
    return [
      blocks,
      rootLevelPost === "post" ? onInput : onInputTemplate,
      rootLevelPost === "post" ? onChange : onChangeTemplate
    ];
  }
  var ExperimentalEditorProvider = with_registry_provider_default(
    ({
      post: post2,
      settings,
      recovery,
      initialEdits,
      children,
      BlockEditorProviderComponent = ExperimentalBlockEditorProvider,
      __unstableTemplate: template2
    }) => {
      const hasTemplate = !!template2;
      const {
        editorSettings: editorSettings2,
        selection,
        isReady: isReady2,
        mode,
        defaultMode,
        postTypeEntities
      } = (0, import_data48.useSelect)(
        (select5) => {
          const {
            getEditorSettings: getEditorSettings2,
            getEditorSelection: getEditorSelection2,
            getRenderingMode: getRenderingMode2,
            __unstableIsEditorReady: __unstableIsEditorReady2,
            getDefaultRenderingMode: getDefaultRenderingMode2
          } = unlock(select5(store));
          const { getEntitiesConfig } = select5(import_core_data30.store);
          const _mode = getRenderingMode2();
          const _defaultMode = getDefaultRenderingMode2(post2.type);
          const hasResolvedDefaultMode = _defaultMode === "template-locked" ? hasTemplate : _defaultMode !== void 0;
          const isRenderingModeReady = _defaultMode !== void 0;
          return {
            editorSettings: getEditorSettings2(),
            isReady: __unstableIsEditorReady2(),
            mode: isRenderingModeReady ? _mode : void 0,
            defaultMode: hasResolvedDefaultMode ? _defaultMode : void 0,
            selection: getEditorSelection2(),
            postTypeEntities: post2.type === "wp_template" ? getEntitiesConfig("postType") : null
          };
        },
        [post2.type, hasTemplate]
      );
      const shouldRenderTemplate = hasTemplate && mode !== "post-only";
      const rootLevelPost = shouldRenderTemplate ? template2 : post2;
      const defaultBlockContext = (0, import_element37.useMemo)(() => {
        const postContext = {};
        if (post2.type === "wp_template") {
          if (post2.slug === "page") {
            postContext.postType = "page";
          } else if (post2.slug === "single") {
            postContext.postType = "post";
          } else if (post2.slug.split("-")[0] === "single") {
            const postTypeNames = postTypeEntities?.map((entity) => entity.name) || [];
            const match2 = post2.slug.match(
              `^single-(${postTypeNames.join("|")})(?:-.+)?$`
            );
            if (match2) {
              postContext.postType = match2[1];
            }
          }
        } else if (!NON_CONTEXTUAL_POST_TYPES.includes(rootLevelPost.type) || shouldRenderTemplate) {
          postContext.postId = post2.id;
          postContext.postType = post2.type;
        }
        return {
          ...postContext,
          templateSlug: rootLevelPost.type === "wp_template" ? rootLevelPost.slug : void 0
        };
      }, [
        shouldRenderTemplate,
        post2.id,
        post2.type,
        post2.slug,
        rootLevelPost.type,
        rootLevelPost.slug,
        postTypeEntities
      ]);
      const { id, type } = rootLevelPost;
      const blockEditorSettings = use_block_editor_settings_default(
        editorSettings2,
        type,
        id,
        mode
      );
      const [blocks, onInput, onChange] = useBlockEditorProps(
        post2,
        template2,
        mode
      );
      const {
        updatePostLock: updatePostLock2,
        setupEditor: setupEditor2,
        updateEditorSettings: updateEditorSettings2,
        setCurrentTemplateId: setCurrentTemplateId2,
        setEditedPost: setEditedPost2,
        setRenderingMode: setRenderingMode2
      } = unlock((0, import_data48.useDispatch)(store));
      const { createWarningNotice, removeNotice } = (0, import_data48.useDispatch)(import_notices16.store);
      (0, import_element37.useLayoutEffect)(() => {
        if (recovery) {
          return;
        }
        updatePostLock2(settings.postLock);
        setupEditor2(post2, initialEdits, settings.template);
        if (settings.autosave) {
          createWarningNotice(
            (0, import_i18n60.__)(
              "There is an autosave of this post that is more recent than the version below."
            ),
            {
              id: "autosave-exists",
              actions: [
                {
                  label: (0, import_i18n60.__)("View the autosave"),
                  url: settings.autosave.editLink
                }
              ]
            }
          );
        }
      }, []);
      (0, import_element37.useEffect)(() => {
        setEditedPost2(post2.type, post2.id);
        if (typeof window !== "undefined" && window.__experimentalTemplateActivate) {
          removeNotice("template-activate-notice");
        }
        return () => setEditedPost2(null, null);
      }, [post2.type, post2.id, setEditedPost2, removeNotice]);
      (0, import_element37.useEffect)(() => {
        updateEditorSettings2(settings);
      }, [settings, updateEditorSettings2]);
      (0, import_element37.useEffect)(() => {
        setCurrentTemplateId2(template2?.id);
      }, [template2?.id, setCurrentTemplateId2]);
      (0, import_element37.useEffect)(() => {
        if (defaultMode) {
          setRenderingMode2(defaultMode);
        }
      }, [defaultMode, setRenderingMode2]);
      useHideBlocksFromInserter(post2.type, mode);
      useCommands();
      if (!isReady2 || !mode) {
        return null;
      }
      return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_core_data30.EntityProvider, { kind: "root", type: "site", children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
        import_core_data30.EntityProvider,
        {
          kind: "postType",
          type: post2.type,
          id: post2.id,
          children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_block_editor18.BlockContextProvider, { value: defaultBlockContext, children: /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(
            BlockEditorProviderComponent,
            {
              value: blocks,
              onChange,
              onInput,
              selection,
              settings: blockEditorSettings,
              useSubRegistry: false,
              children: [
                children,
                !settings.isPreviewMode && /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_jsx_runtime114.Fragment, { children: [
                  /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(PatternsMenuItems, {}),
                  /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(TemplatePartMenuItems, {}),
                  mode === "template-locked" && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(DisableNonPageContentBlocks, {}),
                  type === "wp_navigation" && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(NavigationBlockEditingMode, {}),
                  /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(EditorKeyboardShortcuts, {}),
                  /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(keyboard_shortcut_help_modal_default, {}),
                  /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(BlockRemovalWarnings, {}),
                  /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(StartPageOptions, {}),
                  /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(StartTemplateOptions, {}),
                  /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(PatternRenameModal, {}),
                  /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(PatternDuplicateModal, {})
                ] })
              ]
            }
          ) })
        }
      ) });
    }
  );
  function EditorProvider(props) {
    return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
      ExperimentalEditorProvider,
      {
        ...props,
        BlockEditorProviderComponent: import_block_editor18.BlockEditorProvider,
        children: props.children
      }
    );
  }
  var provider_default = EditorProvider;

  // packages/editor/build-module/components/global-styles/index.mjs
  var import_core_data43 = __toESM(require_core_data(), 1);
  var import_data63 = __toESM(require_data(), 1);
  var import_element71 = __toESM(require_element(), 1);

  // packages/global-styles-ui/build-module/global-styles-ui.mjs
  var import_components90 = __toESM(require_components(), 1);
  var import_blocks18 = __toESM(require_blocks(), 1);
  var import_data60 = __toESM(require_data(), 1);
  var import_block_editor31 = __toESM(require_block_editor(), 1);
  var import_element68 = __toESM(require_element(), 1);
  var import_compose14 = __toESM(require_compose(), 1);

  // packages/global-styles-ui/build-module/provider.mjs
  var import_element39 = __toESM(require_element(), 1);

  // packages/global-styles-ui/build-module/context.mjs
  var import_element38 = __toESM(require_element(), 1);
  var GlobalStylesContext = (0, import_element38.createContext)({
    user: { styles: {}, settings: {} },
    base: { styles: {}, settings: {} },
    merged: { styles: {}, settings: {} },
    onChange: () => {
    },
    fontLibraryEnabled: false
  });

  // packages/global-styles-ui/build-module/provider.mjs
  var import_jsx_runtime115 = __toESM(require_jsx_runtime(), 1);
  function GlobalStylesProvider({
    children,
    value,
    baseValue,
    onChange,
    fontLibraryEnabled
  }) {
    const merged = (0, import_element39.useMemo)(() => {
      return mergeGlobalStyles(baseValue, value);
    }, [baseValue, value]);
    const contextValue = (0, import_element39.useMemo)(
      () => ({
        user: value,
        base: baseValue,
        merged,
        onChange,
        fontLibraryEnabled
      }),
      [value, baseValue, merged, onChange, fontLibraryEnabled]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(GlobalStylesContext.Provider, { value: contextValue, children });
  }

  // packages/global-styles-ui/build-module/screen-root.mjs
  var import_components37 = __toESM(require_components(), 1);
  var import_i18n64 = __toESM(require_i18n(), 1);
  var import_data50 = __toESM(require_data(), 1);
  var import_core_data32 = __toESM(require_core_data(), 1);

  // packages/global-styles-ui/build-module/icon-with-current-color.mjs
  var import_jsx_runtime116 = __toESM(require_jsx_runtime(), 1);
  function IconWithCurrentColor({
    className,
    ...props
  }) {
    return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
      icon_default,
      {
        className: clsx_default(
          className,
          "global-styles-ui-icon-with-current-color"
        ),
        ...props
      }
    );
  }

  // packages/global-styles-ui/build-module/navigation-button.mjs
  var import_components31 = __toESM(require_components(), 1);
  var import_jsx_runtime117 = __toESM(require_jsx_runtime(), 1);
  function GenericNavigationButton({
    icon,
    children,
    ...props
  }) {
    return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(import_components31.__experimentalItem, { ...props, children: [
      icon && /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(import_components31.__experimentalHStack, { justify: "flex-start", children: [
        /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(IconWithCurrentColor, { icon, size: 24 }),
        /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_components31.FlexItem, { children })
      ] }),
      !icon && children
    ] });
  }
  function NavigationButtonAsItem(props) {
    return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_components31.Navigator.Button, { as: GenericNavigationButton, ...props });
  }

  // packages/global-styles-ui/build-module/root-menu.mjs
  var import_components32 = __toESM(require_components(), 1);
  var import_i18n62 = __toESM(require_i18n(), 1);
  var import_block_editor19 = __toESM(require_block_editor(), 1);

  // node_modules/colord/plugins/a11y.mjs
  var o3 = function(o4) {
    var t4 = o4 / 255;
    return t4 < 0.04045 ? t4 / 12.92 : Math.pow((t4 + 0.055) / 1.055, 2.4);
  };
  var t3 = function(t4) {
    return 0.2126 * o3(t4.r) + 0.7152 * o3(t4.g) + 0.0722 * o3(t4.b);
  };
  function a11y_default(o4) {
    o4.prototype.luminance = function() {
      return o5 = t3(this.rgba), void 0 === (r4 = 2) && (r4 = 0), void 0 === n3 && (n3 = Math.pow(10, r4)), Math.round(n3 * o5) / n3 + 0;
      var o5, r4, n3;
    }, o4.prototype.contrast = function(r4) {
      void 0 === r4 && (r4 = "#FFF");
      var n3, a3, i3, e3, v3, u3, d3, c2 = r4 instanceof o4 ? r4 : new o4(r4);
      return e3 = this.rgba, v3 = c2.toRgb(), u3 = t3(e3), d3 = t3(v3), n3 = u3 > d3 ? (u3 + 0.05) / (d3 + 0.05) : (d3 + 0.05) / (u3 + 0.05), void 0 === (a3 = 2) && (a3 = 0), void 0 === i3 && (i3 = Math.pow(10, a3)), Math.floor(i3 * n3) / i3 + 0;
    }, o4.prototype.isReadable = function(o5, t4) {
      return void 0 === o5 && (o5 = "#FFF"), void 0 === t4 && (t4 = {}), this.contrast(o5) >= (e3 = void 0 === (i3 = (r4 = t4).size) ? "normal" : i3, "AAA" === (a3 = void 0 === (n3 = r4.level) ? "AA" : n3) && "normal" === e3 ? 7 : "AA" === a3 && "large" === e3 ? 3 : 4.5);
      var r4, n3, a3, i3, e3;
    };
  }

  // packages/global-styles-ui/build-module/hooks.mjs
  var import_element40 = __toESM(require_element(), 1);
  var import_data49 = __toESM(require_data(), 1);
  var import_core_data31 = __toESM(require_core_data(), 1);
  var import_i18n61 = __toESM(require_i18n(), 1);

  // packages/global-styles-ui/build-module/utils.mjs
  function removePropertiesFromObject(object, properties) {
    if (!properties?.length) {
      return object;
    }
    if (typeof object !== "object" || !object || !Object.keys(object).length) {
      return object;
    }
    for (const key in object) {
      if (properties.includes(key)) {
        delete object[key];
      } else if (typeof object[key] === "object") {
        removePropertiesFromObject(object[key], properties);
      }
    }
    return object;
  }
  var filterObjectByProperties = (object, properties) => {
    if (!object || !properties?.length) {
      return {};
    }
    const newObject = {};
    Object.keys(object).forEach((key) => {
      if (properties.includes(key)) {
        newObject[key] = object[key];
      } else if (typeof object[key] === "object") {
        const newFilter = filterObjectByProperties(
          object[key],
          properties
        );
        if (Object.keys(newFilter).length) {
          newObject[key] = newFilter;
        }
      }
    });
    return newObject;
  };
  function isVariationWithProperties(variation, properties) {
    const variationWithProperties = filterObjectByProperties(
      structuredClone(variation),
      properties
    );
    return areGlobalStylesEqual(variationWithProperties, variation);
  }
  function getFontFamilyFromSetting(fontFamilies, setting) {
    if (!Array.isArray(fontFamilies) || !setting) {
      return null;
    }
    const fontFamilyVariable = setting.replace("var(", "").replace(")", "");
    const fontFamilySlug = fontFamilyVariable?.split("--").slice(-1)[0];
    return fontFamilies.find(
      (fontFamily) => fontFamily.slug === fontFamilySlug
    );
  }
  function getFontFamilies(themeJson) {
    const themeFontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme;
    const customFontFamilies = themeJson?.settings?.typography?.fontFamilies?.custom;
    let fontFamilies = [];
    if (themeFontFamilies && customFontFamilies) {
      fontFamilies = [...themeFontFamilies, ...customFontFamilies];
    } else if (themeFontFamilies) {
      fontFamilies = themeFontFamilies;
    } else if (customFontFamilies) {
      fontFamilies = customFontFamilies;
    }
    const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily;
    const bodyFontFamily = getFontFamilyFromSetting(
      fontFamilies,
      bodyFontFamilySetting
    );
    const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily;
    let headingFontFamily;
    if (!headingFontFamilySetting) {
      headingFontFamily = bodyFontFamily;
    } else {
      headingFontFamily = getFontFamilyFromSetting(
        fontFamilies,
        themeJson?.styles?.elements?.heading?.typography?.fontFamily
      );
    }
    return [bodyFontFamily, headingFontFamily];
  }
  function getVariationClassName(variation) {
    if (!variation) {
      return "";
    }
    return `is-style-${variation}`;
  }
  function getNewIndexFromPresets(presets, slugPrefix) {
    const nameRegex = new RegExp(`^${slugPrefix}([\\d]+)$`);
    const highestPresetValue = presets.reduce((currentHighest, preset) => {
      if (typeof preset?.slug === "string") {
        const matches = preset?.slug.match(nameRegex);
        if (matches) {
          const id = parseInt(matches[1], 10);
          if (id > currentHighest) {
            return id;
          }
        }
      }
      return currentHighest;
    }, 0);
    return highestPresetValue + 1;
  }

  // packages/global-styles-ui/build-module/hooks.mjs
  k([a11y_default]);
  function useStyle(path, blockName, readFrom = "merged", shouldDecodeEncode = true) {
    const { user, base, merged, onChange } = (0, import_element40.useContext)(GlobalStylesContext);
    let sourceValue = merged;
    if (readFrom === "base") {
      sourceValue = base;
    } else if (readFrom === "user") {
      sourceValue = user;
    }
    const styleValue = (0, import_element40.useMemo)(
      () => getStyle(sourceValue, path, blockName, shouldDecodeEncode),
      [sourceValue, path, blockName, shouldDecodeEncode]
    );
    const setStyleValue = (0, import_element40.useCallback)(
      (newValue) => {
        const newGlobalStyles = setStyle(
          user,
          path,
          newValue,
          blockName
        );
        onChange(newGlobalStyles);
      },
      [user, onChange, path, blockName]
    );
    return [styleValue, setStyleValue];
  }
  function useSetting(path, blockName, readFrom = "merged") {
    const { user, base, merged, onChange } = (0, import_element40.useContext)(GlobalStylesContext);
    let sourceValue = merged;
    if (readFrom === "base") {
      sourceValue = base;
    } else if (readFrom === "user") {
      sourceValue = user;
    }
    const settingValue = (0, import_element40.useMemo)(
      () => getSetting(sourceValue, path, blockName),
      [sourceValue, path, blockName]
    );
    const setSettingValue = (0, import_element40.useCallback)(
      (newValue) => {
        const newGlobalStyles = setSetting(
          user,
          path,
          newValue,
          blockName
        );
        onChange(newGlobalStyles);
      },
      [user, onChange, path, blockName]
    );
    return [settingValue, setSettingValue];
  }
  var EMPTY_ARRAY3 = [];
  function hasThemeVariation({
    title,
    settings,
    styles
  }) {
    return title === (0, import_i18n61.__)("Default") || Object.keys(settings || {}).length > 0 || Object.keys(styles || {}).length > 0;
  }
  function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) {
    const { variationsFromTheme } = (0, import_data49.useSelect)((select5) => {
      const _variationsFromTheme = select5(
        import_core_data31.store
      ).__experimentalGetCurrentThemeGlobalStylesVariations?.();
      return {
        variationsFromTheme: _variationsFromTheme || EMPTY_ARRAY3
      };
    }, []);
    const { user: userVariation } = (0, import_element40.useContext)(GlobalStylesContext);
    return (0, import_element40.useMemo)(() => {
      const clonedUserVariation = structuredClone(userVariation);
      const userVariationWithoutProperties = removePropertiesFromObject(
        clonedUserVariation,
        properties
      );
      userVariationWithoutProperties.title = (0, import_i18n61.__)("Default");
      const variationsWithPropertiesAndBase = variationsFromTheme.filter((variation) => {
        return isVariationWithProperties(variation, properties);
      }).map((variation) => {
        return mergeGlobalStyles(
          userVariationWithoutProperties,
          variation
        );
      });
      const variationsByProperties = [
        userVariationWithoutProperties,
        ...variationsWithPropertiesAndBase
      ];
      return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : [];
    }, [properties, userVariation, variationsFromTheme]);
  }
  function useColorRandomizer(blockName) {
    const [themeColors, setThemeColors] = useSetting(
      "color.palette.theme",
      blockName
    );
    const randomizeColors = (0, import_element40.useCallback)(() => {
      if (!themeColors || !themeColors.length) {
        return;
      }
      const randomRotationValue = Math.floor(Math.random() * 225);
      const newColors = themeColors.map((colorObject) => {
        const { color } = colorObject;
        const newColor = w2(color).rotate(randomRotationValue).toHex();
        return {
          ...colorObject,
          color: newColor
        };
      });
      setThemeColors(newColors);
    }, [themeColors, setThemeColors]);
    return window.__experimentalEnableColorRandomizer ? [randomizeColors] : [];
  }

  // packages/global-styles-ui/build-module/lock-unlock.mjs
  var import_private_apis3 = __toESM(require_private_apis(), 1);
  var { lock: lock3, unlock: unlock3 } = (0, import_private_apis3.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
    "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
    "@wordpress/global-styles-ui"
  );

  // packages/global-styles-ui/build-module/root-menu.mjs
  var import_jsx_runtime118 = __toESM(require_jsx_runtime(), 1);
  var {
    useHasDimensionsPanel,
    useHasTypographyPanel,
    useHasColorPanel,
    useSettingsForBlockElement,
    useHasBackgroundPanel
  } = unlock3(import_block_editor19.privateApis);
  function RootMenu() {
    const [rawSettings] = useSetting("");
    const settings = useSettingsForBlockElement(rawSettings);
    const hasBackgroundPanel = useHasBackgroundPanel(rawSettings);
    const hasTypographyPanel = useHasTypographyPanel(settings);
    const hasColorPanel = useHasColorPanel(settings);
    const hasShadowPanel = true;
    const hasDimensionsPanel = useHasDimensionsPanel(settings);
    const hasLayoutPanel = hasDimensionsPanel;
    return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(import_jsx_runtime118.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)(import_components32.__experimentalItemGroup, { children: [
      hasTypographyPanel && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
        NavigationButtonAsItem,
        {
          icon: typography_default,
          path: "/typography",
          children: (0, import_i18n62.__)("Typography")
        }
      ),
      hasColorPanel && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(NavigationButtonAsItem, { icon: color_default, path: "/colors", children: (0, import_i18n62.__)("Colors") }),
      hasBackgroundPanel && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
        NavigationButtonAsItem,
        {
          icon: background_default,
          path: "/background",
          "aria-label": (0, import_i18n62.__)("Background styles"),
          children: (0, import_i18n62.__)("Background")
        }
      ),
      hasShadowPanel && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(NavigationButtonAsItem, { icon: shadow_default, path: "/shadows", children: (0, import_i18n62.__)("Shadows") }),
      hasLayoutPanel && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(NavigationButtonAsItem, { icon: layout_default, path: "/layout", children: (0, import_i18n62.__)("Layout") })
    ] }) });
  }
  var root_menu_default = RootMenu;

  // packages/global-styles-ui/build-module/preview-styles.mjs
  var import_components36 = __toESM(require_components(), 1);

  // packages/global-styles-ui/build-module/preview-hooks.mjs
  function useStylesPreviewColors() {
    const [textColor = "black"] = useStyle("color.text");
    const [backgroundColor = "white"] = useStyle("color.background");
    const [headingColor = textColor] = useStyle(
      "elements.h1.color.text"
    );
    const [linkColor = headingColor] = useStyle(
      "elements.link.color.text"
    );
    const [buttonBackgroundColor = linkColor] = useStyle(
      "elements.button.color.background"
    );
    const [coreColors] = useSetting("color.palette.core") || [];
    const [themeColors] = useSetting("color.palette.theme") || [];
    const [customColors] = useSetting("color.palette.custom") || [];
    const paletteColors = (themeColors ?? []).concat(customColors ?? []).concat(coreColors ?? []);
    const textColorObject = paletteColors.filter(
      ({ color }) => color === textColor
    );
    const buttonBackgroundColorObject = paletteColors.filter(
      ({ color }) => color === buttonBackgroundColor
    );
    const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter(
      // we exclude these background color because it is already visible in the preview.
      ({ color }) => color !== backgroundColor
    ).slice(0, 2);
    return {
      paletteColors,
      highlightedColors
    };
  }

  // packages/global-styles-ui/build-module/typography-example.mjs
  var import_element41 = __toESM(require_element(), 1);
  var import_components33 = __toESM(require_components(), 1);
  var import_i18n63 = __toESM(require_i18n(), 1);

  // packages/global-styles-ui/build-module/font-library/utils/preview-styles.mjs
  function findNearest(input, numbers) {
    if (numbers.length === 0) {
      return null;
    }
    numbers.sort((a3, b3) => Math.abs(input - a3) - Math.abs(input - b3));
    return numbers[0];
  }
  function extractFontWeights(fontFaces) {
    const result = [];
    fontFaces.forEach((face) => {
      const weights = String(face.fontWeight).split(" ");
      if (weights.length === 2) {
        const start = parseInt(weights[0]);
        const end = parseInt(weights[1]);
        for (let i3 = start; i3 <= end; i3 += 100) {
          result.push(i3);
        }
      } else if (weights.length === 1) {
        result.push(parseInt(weights[0]));
      }
    });
    return result;
  }
  function formatFontFamily(input) {
    const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/;
    const output = input.trim();
    const formatItem = (item) => {
      item = item.trim();
      if (item.match(regex)) {
        item = item.replace(/^["']|["']$/g, "");
        return `"${item}"`;
      }
      return item;
    };
    if (output.includes(",")) {
      return output.split(",").map(formatItem).filter((item) => item !== "").join(", ");
    }
    return formatItem(output);
  }
  function formatFontFaceName(input) {
    if (!input) {
      return "";
    }
    let output = input.trim();
    if (output.includes(",")) {
      output = (output.split(",").find((item) => item.trim() !== "") ?? "").trim();
    }
    output = output.replace(/^["']|["']$/g, "");
    if (window.navigator.userAgent.toLowerCase().includes("firefox")) {
      output = `"${output}"`;
    }
    return output;
  }
  function getFamilyPreviewStyle(family) {
    const style = {
      fontFamily: formatFontFamily(family.fontFamily)
    };
    if (!("fontFace" in family) || !Array.isArray(family.fontFace)) {
      style.fontWeight = "400";
      style.fontStyle = "normal";
      return style;
    }
    if (family.fontFace) {
      const normalFaces = family.fontFace.filter(
        (face) => face?.fontStyle && face.fontStyle.toLowerCase() === "normal"
      );
      if (normalFaces.length > 0) {
        style.fontStyle = "normal";
        const normalWeights = extractFontWeights(normalFaces);
        const nearestWeight = findNearest(400, normalWeights);
        style.fontWeight = String(nearestWeight) || "400";
      } else {
        style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || "normal";
        style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || "400";
      }
    }
    return style;
  }
  function getFacePreviewStyle(face) {
    return {
      fontFamily: formatFontFamily(face.fontFamily),
      fontStyle: face.fontStyle || "normal",
      fontWeight: face.fontWeight || "400"
    };
  }

  // packages/global-styles-ui/build-module/typography-example.mjs
  var import_jsx_runtime119 = __toESM(require_jsx_runtime(), 1);
  function PreviewTypography({
    fontSize,
    variation
  }) {
    const { base } = (0, import_element41.useContext)(GlobalStylesContext);
    let config = base;
    if (variation) {
      config = { ...base, ...variation };
    }
    const [textColor] = useStyle("color.text");
    const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config);
    const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {};
    const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {};
    if (textColor) {
      bodyPreviewStyle.color = textColor;
      headingPreviewStyle.color = textColor;
    }
    if (fontSize) {
      bodyPreviewStyle.fontSize = fontSize;
      headingPreviewStyle.fontSize = fontSize;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
      import_components33.__unstableMotion.div,
      {
        animate: {
          scale: 1,
          opacity: 1
        },
        initial: {
          scale: 0.1,
          opacity: 0
        },
        transition: {
          delay: 0.3,
          type: "tween"
        },
        style: {
          textAlign: "center",
          lineHeight: 1
        },
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { style: headingPreviewStyle, children: (0, import_i18n63._x)("A", "Uppercase letter A") }),
          /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { style: bodyPreviewStyle, children: (0, import_i18n63._x)("a", "Lowercase letter A") })
        ]
      }
    );
  }

  // packages/global-styles-ui/build-module/highlighted-colors.mjs
  var import_components34 = __toESM(require_components(), 1);
  var import_jsx_runtime120 = __toESM(require_jsx_runtime(), 1);
  function HighlightedColors({
    normalizedColorSwatchSize,
    ratio
  }) {
    const { highlightedColors } = useStylesPreviewColors();
    const scaledSwatchSize = normalizedColorSwatchSize * ratio;
    return highlightedColors.map(({ slug, color }, index2) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
      import_components34.__unstableMotion.div,
      {
        style: {
          height: scaledSwatchSize,
          width: scaledSwatchSize,
          background: color,
          borderRadius: scaledSwatchSize / 2
        },
        animate: {
          scale: 1,
          opacity: 1
        },
        initial: {
          scale: 0.1,
          opacity: 0
        },
        transition: {
          delay: index2 === 1 ? 0.2 : 0.1
        }
      },
      `${slug}-${index2}`
    ));
  }

  // packages/global-styles-ui/build-module/preview-wrapper.mjs
  var import_components35 = __toESM(require_components(), 1);
  var import_compose9 = __toESM(require_compose(), 1);
  var import_element42 = __toESM(require_element(), 1);
  var import_jsx_runtime121 = __toESM(require_jsx_runtime(), 1);
  var normalizedWidth = 248;
  var normalizedHeight = 152;
  var THROTTLE_OPTIONS = {
    leading: true,
    trailing: true
  };
  function PreviewWrapper({
    children,
    label,
    isFocused,
    withHoverView
  }) {
    const [backgroundColor = "white"] = useStyle("color.background");
    const [gradientValue] = useStyle("color.gradient");
    const disableMotion = (0, import_compose9.useReducedMotion)();
    const [isHovered, setIsHovered] = (0, import_element42.useState)(false);
    const [containerResizeListener, { width }] = (0, import_compose9.useResizeObserver)();
    const [throttledWidth, setThrottledWidthState] = (0, import_element42.useState)(width);
    const [ratioState, setRatioState] = (0, import_element42.useState)();
    const setThrottledWidth = (0, import_compose9.useThrottle)(
      setThrottledWidthState,
      250,
      THROTTLE_OPTIONS
    );
    (0, import_element42.useLayoutEffect)(() => {
      if (width) {
        setThrottledWidth(width);
      }
    }, [width, setThrottledWidth]);
    (0, import_element42.useLayoutEffect)(() => {
      const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;
      const ratioDiff = newRatio - (ratioState || 0);
      const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1;
      if (isRatioDiffBigEnough || !ratioState) {
        setRatioState(newRatio);
      }
    }, [throttledWidth, ratioState]);
    const fallbackRatio = width ? width / normalizedWidth : 1;
    const ratio = ratioState ? ratioState : fallbackRatio;
    const isReady2 = !!width;
    return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_jsx_runtime121.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { style: { position: "relative" }, children: containerResizeListener }),
      isReady2 && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
        "div",
        {
          className: "global-styles-ui-preview__wrapper",
          style: {
            height: normalizedHeight * ratio
          },
          onMouseEnter: () => setIsHovered(true),
          onMouseLeave: () => setIsHovered(false),
          tabIndex: -1,
          children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
            import_components35.__unstableMotion.div,
            {
              style: {
                height: normalizedHeight * ratio,
                width: "100%",
                background: gradientValue ?? backgroundColor,
                cursor: withHoverView ? "pointer" : void 0
              },
              initial: "start",
              animate: (isHovered || isFocused) && !disableMotion && label ? "hover" : "start",
              children: [].concat(children).map(
                (child, key) => child({ ratio, key })
              )
            }
          )
        }
      )
    ] });
  }
  var preview_wrapper_default = PreviewWrapper;

  // packages/global-styles-ui/build-module/preview-styles.mjs
  var import_jsx_runtime122 = __toESM(require_jsx_runtime(), 1);
  var firstFrameVariants = {
    start: {
      scale: 1,
      opacity: 1
    },
    hover: {
      scale: 0,
      opacity: 0
    }
  };
  var midFrameVariants = {
    hover: {
      opacity: 1
    },
    start: {
      opacity: 0.5
    }
  };
  var secondFrameVariants = {
    hover: {
      scale: 1,
      opacity: 1
    },
    start: {
      scale: 0,
      opacity: 0
    }
  };
  function PreviewStyles({
    label,
    isFocused,
    withHoverView,
    variation
  }) {
    const [fontWeight] = useStyle("typography.fontWeight");
    const [fontFamily = "serif"] = useStyle(
      "typography.fontFamily"
    );
    const [headingFontFamily = fontFamily] = useStyle(
      "elements.h1.typography.fontFamily"
    );
    const [headingFontWeight = fontWeight] = useStyle(
      "elements.h1.typography.fontWeight"
    );
    const [textColor = "black"] = useStyle("color.text");
    const [headingColor = textColor] = useStyle(
      "elements.h1.color.text"
    );
    const { paletteColors } = useStylesPreviewColors();
    return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
      preview_wrapper_default,
      {
        label,
        isFocused,
        withHoverView,
        children: [
          ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
            import_components36.__unstableMotion.div,
            {
              variants: firstFrameVariants,
              style: {
                height: "100%",
                overflow: "hidden"
              },
              children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
                import_components36.__experimentalHStack,
                {
                  spacing: 10 * ratio,
                  justify: "center",
                  style: {
                    height: "100%",
                    overflow: "hidden"
                  },
                  children: [
                    /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
                      PreviewTypography,
                      {
                        fontSize: 65 * ratio,
                        variation
                      }
                    ),
                    /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_components36.__experimentalVStack, { spacing: 4 * ratio, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
                      HighlightedColors,
                      {
                        normalizedColorSwatchSize: 32,
                        ratio
                      }
                    ) })
                  ]
                }
              )
            },
            key
          ),
          ({ key }) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
            import_components36.__unstableMotion.div,
            {
              variants: withHoverView ? midFrameVariants : void 0,
              style: {
                height: "100%",
                width: "100%",
                position: "absolute",
                top: 0,
                overflow: "hidden",
                filter: "blur(60px)",
                opacity: 0.1
              },
              children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
                import_components36.__experimentalHStack,
                {
                  spacing: 0,
                  justify: "flex-start",
                  style: {
                    height: "100%",
                    overflow: "hidden"
                  },
                  children: paletteColors.slice(0, 4).map(({ color }, index2) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
                    "div",
                    {
                      style: {
                        height: "100%",
                        background: color,
                        flexGrow: 1
                      }
                    },
                    index2
                  ))
                }
              )
            },
            key
          ),
          ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
            import_components36.__unstableMotion.div,
            {
              variants: secondFrameVariants,
              style: {
                height: "100%",
                width: "100%",
                overflow: "hidden",
                position: "absolute",
                top: 0
              },
              children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
                import_components36.__experimentalVStack,
                {
                  spacing: 3 * ratio,
                  justify: "center",
                  style: {
                    height: "100%",
                    overflow: "hidden",
                    padding: 10 * ratio,
                    boxSizing: "border-box"
                  },
                  children: label && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
                    "div",
                    {
                      style: {
                        fontSize: 40 * ratio,
                        fontFamily: headingFontFamily,
                        color: headingColor,
                        fontWeight: headingFontWeight,
                        lineHeight: "1em",
                        textAlign: "center"
                      },
                      children: label
                    }
                  )
                }
              )
            },
            key
          )
        ]
      }
    );
  }
  var preview_styles_default = PreviewStyles;

  // packages/global-styles-ui/build-module/screen-root.mjs
  var import_jsx_runtime123 = __toESM(require_jsx_runtime(), 1);
  function ScreenRoot() {
    const hasVariations = (0, import_data50.useSelect)((select5) => {
      const { __experimentalGetCurrentThemeGlobalStylesVariations } = select5(import_core_data32.store);
      return !!__experimentalGetCurrentThemeGlobalStylesVariations()?.length;
    }, []);
    return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
      import_components37.Card,
      {
        size: "small",
        isBorderless: true,
        className: "global-styles-ui-screen-root",
        isRounded: false,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components37.CardBody, { children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_components37.__experimentalVStack, { spacing: 4, children: [
            /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components37.Card, { className: "global-styles-ui-screen-root__active-style-tile", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components37.CardMedia, { className: "global-styles-ui-screen-root__active-style-tile-preview", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(preview_styles_default, {}) }) }),
            hasVariations && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components37.__experimentalItemGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(NavigationButtonAsItem, { path: "/variations", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_components37.__experimentalHStack, { justify: "space-between", children: [
              /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components37.FlexItem, { children: (0, import_i18n64.__)("Browse styles") }),
              /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
                IconWithCurrentColor,
                {
                  icon: (0, import_i18n64.isRTL)() ? chevron_left_default : chevron_right_default
                }
              )
            ] }) }) }),
            /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(root_menu_default, {})
          ] }) }),
          /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components37.CardDivider, {}),
          /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_components37.CardBody, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
              import_components37.__experimentalSpacer,
              {
                as: "p",
                paddingTop: 2,
                paddingX: "13px",
                marginBottom: 4,
                children: (0, import_i18n64.__)(
                  "Customize the appearance of specific blocks for the whole site."
                )
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components37.__experimentalItemGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(NavigationButtonAsItem, { path: "/blocks", children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_components37.__experimentalHStack, { justify: "space-between", children: [
              /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components37.FlexItem, { children: (0, import_i18n64.__)("Blocks") }),
              /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
                IconWithCurrentColor,
                {
                  icon: (0, import_i18n64.isRTL)() ? chevron_left_default : chevron_right_default
                }
              )
            ] }) }) })
          ] })
        ]
      }
    );
  }
  var screen_root_default = ScreenRoot;

  // packages/global-styles-ui/build-module/screen-block-list.mjs
  var import_blocks15 = __toESM(require_blocks(), 1);
  var import_i18n66 = __toESM(require_i18n(), 1);
  var import_components40 = __toESM(require_components(), 1);
  var import_data52 = __toESM(require_data(), 1);
  var import_element43 = __toESM(require_element(), 1);
  var import_block_editor20 = __toESM(require_block_editor(), 1);
  var import_compose10 = __toESM(require_compose(), 1);
  var import_a11y3 = __toESM(require_a11y(), 1);

  // packages/global-styles-ui/build-module/variations/variations-panel.mjs
  var import_blocks14 = __toESM(require_blocks(), 1);
  var import_data51 = __toESM(require_data(), 1);
  var import_components38 = __toESM(require_components(), 1);
  var import_jsx_runtime124 = __toESM(require_jsx_runtime(), 1);
  function getFilteredBlockStyles(blockStyles, variations) {
    return blockStyles?.filter(
      (style) => style.source === "block" || variations.includes(style.name)
    ) || [];
  }
  function useBlockVariations(name2) {
    const blockStyles = (0, import_data51.useSelect)(
      (select5) => {
        const { getBlockStyles } = select5(import_blocks14.store);
        return getBlockStyles(name2);
      },
      [name2]
    );
    const [variations] = useStyle("variations", name2);
    const variationNames = Object.keys(variations ?? {});
    return getFilteredBlockStyles(blockStyles, variationNames);
  }
  function VariationsPanel({ name: name2 }) {
    const coreBlockStyles = useBlockVariations(name2);
    return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_components38.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: coreBlockStyles.map((style, index2) => {
      if (style?.isDefault) {
        return null;
      }
      return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
        NavigationButtonAsItem,
        {
          path: "/blocks/" + encodeURIComponent(name2) + "/variations/" + encodeURIComponent(style.name),
          children: style.label
        },
        index2
      );
    }) });
  }

  // packages/global-styles-ui/build-module/screen-header.mjs
  var import_components39 = __toESM(require_components(), 1);
  var import_i18n65 = __toESM(require_i18n(), 1);
  var import_jsx_runtime125 = __toESM(require_jsx_runtime(), 1);
  function ScreenHeader({
    title,
    description,
    onBack
  }) {
    return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_components39.__experimentalVStack, { spacing: 0, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_components39.__experimentalView, { children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_components39.__experimentalSpacer, { marginBottom: 0, paddingX: 4, paddingY: 3, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(import_components39.__experimentalVStack, { spacing: 2, children: [
      /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(import_components39.__experimentalHStack, { spacing: 2, children: [
        /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
          import_components39.Navigator.BackButton,
          {
            icon: (0, import_i18n65.isRTL)() ? chevron_right_default : chevron_left_default,
            size: "small",
            label: (0, import_i18n65.__)("Back"),
            onClick: onBack
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_components39.__experimentalSpacer, { children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
          import_components39.__experimentalHeading,
          {
            className: "global-styles-ui-header",
            level: 2,
            size: 13,
            children: title
          }
        ) })
      ] }),
      description && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_components39.__experimentalText, { className: "global-styles-ui-header__description", children: description })
    ] }) }) }) });
  }

  // packages/global-styles-ui/build-module/screen-block-list.mjs
  var import_jsx_runtime126 = __toESM(require_jsx_runtime(), 1);
  var {
    useHasDimensionsPanel: useHasDimensionsPanel2,
    useHasTypographyPanel: useHasTypographyPanel2,
    useHasBorderPanel,
    useSettingsForBlockElement: useSettingsForBlockElement2,
    useHasColorPanel: useHasColorPanel2
  } = unlock3(import_block_editor20.privateApis);
  function useSortedBlockTypes() {
    const blockItems = (0, import_data52.useSelect)(
      (select5) => select5(import_blocks15.store).getBlockTypes(),
      []
    );
    const groupByType = (blocks, block) => {
      const { core, noncore } = blocks;
      const type = block.name.startsWith("core/") ? core : noncore;
      type.push(block);
      return blocks;
    };
    const { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(
      groupByType,
      { core: [], noncore: [] }
    );
    return [...coreItems, ...nonCoreItems];
  }
  function useBlockHasGlobalStyles(blockName) {
    const [rawSettings] = useSetting("", blockName);
    const settings = useSettingsForBlockElement2(rawSettings, blockName);
    const hasTypographyPanel = useHasTypographyPanel2(settings);
    const hasColorPanel = useHasColorPanel2(settings);
    const hasBorderPanel = useHasBorderPanel(settings);
    const hasDimensionsPanel = useHasDimensionsPanel2(settings);
    const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
    const hasVariationsPanel = !!useBlockVariations(blockName)?.length;
    const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel;
    return hasGlobalStyles;
  }
  function BlockMenuItem({ block }) {
    const hasBlockMenuItem = useBlockHasGlobalStyles(block.name);
    if (!hasBlockMenuItem) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
      NavigationButtonAsItem,
      {
        path: "/blocks/" + encodeURIComponent(block.name),
        children: /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(import_components40.__experimentalHStack, { justify: "flex-start", children: [
          /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_block_editor20.BlockIcon, { icon: block.icon }),
          /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_components40.FlexItem, { children: block.title })
        ] })
      }
    );
  }
  function BlockList({ filterValue }) {
    const sortedBlockTypes = useSortedBlockTypes();
    const debouncedSpeak = (0, import_compose10.useDebounce)(import_a11y3.speak, 500);
    const { isMatchingSearchTerm } = (0, import_data52.useSelect)(import_blocks15.store);
    const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter(
      (blockType) => isMatchingSearchTerm(blockType, filterValue)
    );
    const blockTypesListRef = (0, import_element43.useRef)(null);
    (0, import_element43.useEffect)(() => {
      if (!filterValue) {
        return;
      }
      const count = blockTypesListRef.current?.childElementCount || 0;
      const resultsFoundMessage = (0, import_i18n66.sprintf)(
        /* translators: %d: number of results. */
        (0, import_i18n66._n)("%d result found.", "%d results found.", count),
        count
      );
      debouncedSpeak(resultsFoundMessage, "polite");
    }, [filterValue, debouncedSpeak]);
    return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
      "div",
      {
        ref: blockTypesListRef,
        className: "global-styles-ui-block-types-item-list",
        role: "list",
        children: filteredBlockTypes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_components40.__experimentalText, { align: "center", as: "p", children: (0, import_i18n66.__)("No blocks found.") }) : filteredBlockTypes.map((block) => /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
          BlockMenuItem,
          {
            block
          },
          "menu-itemblock-" + block.name
        ))
      }
    );
  }
  var MemoizedBlockList = (0, import_element43.memo)(BlockList);
  function ScreenBlockList() {
    const [filterValue, setFilterValue] = (0, import_element43.useState)("");
    const deferredFilterValue = (0, import_element43.useDeferredValue)(filterValue);
    return /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(import_jsx_runtime126.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
        ScreenHeader,
        {
          title: (0, import_i18n66.__)("Blocks"),
          description: (0, import_i18n66.__)(
            "Customize the appearance of specific blocks and for the whole site."
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
        import_components40.SearchControl,
        {
          className: "global-styles-ui-block-types-search",
          onChange: setFilterValue,
          value: filterValue,
          label: (0, import_i18n66.__)("Search"),
          placeholder: (0, import_i18n66.__)("Search")
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(MemoizedBlockList, { filterValue: deferredFilterValue })
    ] });
  }
  var screen_block_list_default = ScreenBlockList;

  // packages/global-styles-ui/build-module/screen-block.mjs
  var import_blocks17 = __toESM(require_blocks(), 1);
  var import_block_editor22 = __toESM(require_block_editor(), 1);
  var import_element45 = __toESM(require_element(), 1);
  var import_data53 = __toESM(require_data(), 1);
  var import_core_data33 = __toESM(require_core_data(), 1);
  var import_components43 = __toESM(require_components(), 1);
  var import_i18n67 = __toESM(require_i18n(), 1);

  // packages/global-styles-ui/build-module/block-preview-panel.mjs
  var import_block_editor21 = __toESM(require_block_editor(), 1);
  var import_blocks16 = __toESM(require_blocks(), 1);
  var import_components41 = __toESM(require_components(), 1);
  var import_element44 = __toESM(require_element(), 1);
  var import_jsx_runtime127 = __toESM(require_jsx_runtime(), 1);
  var BlockPreviewPanel = ({
    name: name2,
    variation = ""
  }) => {
    const blockExample = (0, import_blocks16.getBlockType)(name2)?.example;
    const blocks = (0, import_element44.useMemo)(() => {
      if (!blockExample) {
        return null;
      }
      const example = {
        ...blockExample,
        attributes: {
          ...blockExample.attributes,
          style: void 0,
          className: variation ? getVariationClassName(variation) : blockExample.attributes?.className
        }
      };
      return (0, import_blocks16.getBlockFromExample)(name2, example);
    }, [name2, blockExample, variation]);
    const viewportWidth = blockExample?.viewportWidth ?? 500;
    const previewHeight = 144;
    const sidebarWidth = 235;
    const scale = sidebarWidth / viewportWidth;
    const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight;
    if (!blockExample) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_components41.__experimentalSpacer, { marginX: 4, marginBottom: 4, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
      "div",
      {
        className: "global-styles-ui__block-preview-panel",
        style: { maxHeight: previewHeight, boxSizing: "initial" },
        children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
          import_block_editor21.BlockPreview,
          {
            blocks,
            viewportWidth,
            minHeight: previewHeight,
            additionalStyles: (
              //We want this CSS to be in sync with the one in InserterPreviewPanel.
              [
                {
                  css: `
								body{
									padding: 24px;
									min-height:${Math.round(minHeight)}px;
									display:flex;
									align-items:center;
								}
								.is-root-container { width: 100%; }
							`
                }
              ]
            )
          }
        )
      }
    ) });
  };
  var block_preview_panel_default = BlockPreviewPanel;

  // packages/global-styles-ui/build-module/subtitle.mjs
  var import_components42 = __toESM(require_components(), 1);
  var import_jsx_runtime128 = __toESM(require_jsx_runtime(), 1);
  function Subtitle({ children, level = 2 }) {
    return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(import_components42.__experimentalHeading, { className: "global-styles-ui-subtitle", level, children });
  }

  // packages/global-styles-ui/build-module/screen-block.mjs
  var import_jsx_runtime129 = __toESM(require_jsx_runtime(), 1);
  var BACKGROUND_BLOCK_DEFAULT_VALUES2 = {
    backgroundSize: "cover",
    backgroundPosition: "50% 50%"
    // used only when backgroundSize is 'contain'.
  };
  function applyFallbackStyle(border) {
    if (!border) {
      return border;
    }
    const hasColorOrWidth = border.color || border.width;
    if (!border.style && hasColorOrWidth) {
      return { ...border, style: "solid" };
    }
    if (border.style && !hasColorOrWidth) {
      return void 0;
    }
    return border;
  }
  function applyAllFallbackStyles(border) {
    if (!border) {
      return border;
    }
    if ((0, import_components43.__experimentalHasSplitBorders)(border)) {
      return {
        top: applyFallbackStyle(border.top),
        right: applyFallbackStyle(border.right),
        bottom: applyFallbackStyle(border.bottom),
        left: applyFallbackStyle(border.left)
      };
    }
    return applyFallbackStyle(border);
  }
  var {
    useHasDimensionsPanel: useHasDimensionsPanel3,
    useHasTypographyPanel: useHasTypographyPanel3,
    useHasBorderPanel: useHasBorderPanel2,
    useSettingsForBlockElement: useSettingsForBlockElement3,
    useHasColorPanel: useHasColorPanel3,
    useHasFiltersPanel,
    useHasImageSettingsPanel,
    useHasBackgroundPanel: useHasBackgroundPanel2,
    BackgroundPanel: StylesBackgroundPanel,
    BorderPanel: StylesBorderPanel,
    ColorPanel: StylesColorPanel,
    TypographyPanel: StylesTypographyPanel,
    DimensionsPanel: StylesDimensionsPanel,
    FiltersPanel: StylesFiltersPanel,
    ImageSettingsPanel,
    AdvancedPanel: StylesAdvancedPanel
  } = unlock3(import_block_editor22.privateApis);
  function ScreenBlock({ name: name2, variation }) {
    let prefixParts = [];
    if (variation) {
      prefixParts = ["variations", variation].concat(prefixParts);
    }
    const prefix = prefixParts.join(".");
    const [style] = useStyle(prefix, name2, "user", false);
    const [inheritedStyle, setStyle2] = useStyle(
      prefix,
      name2,
      "merged",
      false
    );
    const [userSettings] = useSetting("", name2, "user");
    const [rawSettings, setSettings] = useSetting("", name2);
    const settingsForBlockElement = useSettingsForBlockElement3(
      rawSettings,
      name2
    );
    const blockType = (0, import_blocks17.getBlockType)(name2);
    let disableBlockGap = false;
    if (settingsForBlockElement?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.__experimentalSkipSerialization === true || blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(
      (spacingType) => spacingType === "blockGap"
    ))) {
      disableBlockGap = true;
    }
    let disableAspectRatio = false;
    if (settingsForBlockElement?.dimensions?.aspectRatio && name2 === "core/group") {
      disableAspectRatio = true;
    }
    const settings = (0, import_element45.useMemo)(() => {
      const updatedSettings = structuredClone(settingsForBlockElement);
      if (disableBlockGap) {
        updatedSettings.spacing.blockGap = false;
      }
      if (disableAspectRatio) {
        updatedSettings.dimensions.aspectRatio = false;
      }
      return updatedSettings;
    }, [settingsForBlockElement, disableBlockGap, disableAspectRatio]);
    const blockVariations = useBlockVariations(name2);
    const hasBackgroundPanel = useHasBackgroundPanel2(settings);
    const hasTypographyPanel = useHasTypographyPanel3(settings);
    const hasColorPanel = useHasColorPanel3(settings);
    const hasBorderPanel = useHasBorderPanel2(settings);
    const hasDimensionsPanel = useHasDimensionsPanel3(settings);
    const hasFiltersPanel = useHasFiltersPanel(settings);
    const hasImageSettingsPanel = useHasImageSettingsPanel(
      name2,
      userSettings,
      settings
    );
    const hasVariationsPanel = !!blockVariations?.length && !variation;
    const { canEditCSS } = (0, import_data53.useSelect)((select5) => {
      const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select5(import_core_data33.store);
      const globalStylesId = __experimentalGetCurrentGlobalStylesId();
      const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
      return {
        canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"]
      };
    }, []);
    const currentBlockStyle = variation ? blockVariations.find((s3) => s3.name === variation) : null;
    const inheritedStyleWithLayout = (0, import_element45.useMemo)(() => {
      return {
        ...inheritedStyle,
        layout: settings.layout
      };
    }, [inheritedStyle, settings.layout]);
    const styleWithLayout = (0, import_element45.useMemo)(() => {
      return {
        ...style,
        layout: userSettings.layout
      };
    }, [style, userSettings.layout]);
    const onChangeDimensions = (newStyle) => {
      const updatedStyle = { ...newStyle };
      delete updatedStyle.layout;
      setStyle2(updatedStyle);
      if (newStyle.layout !== userSettings.layout) {
        setSettings({
          ...userSettings,
          layout: newStyle.layout
        });
      }
    };
    const onChangeLightbox = (newSetting) => {
      if (newSetting === void 0) {
        setSettings({
          ...rawSettings,
          lightbox: void 0
        });
      } else {
        setSettings({
          ...rawSettings,
          lightbox: {
            ...rawSettings.lightbox,
            ...newSetting
          }
        });
      }
    };
    const onChangeBorders = (newStyle) => {
      if (!newStyle?.border) {
        setStyle2(newStyle);
        return;
      }
      const { radius, ...newBorder } = newStyle.border;
      const border = applyAllFallbackStyles(newBorder);
      const updatedBorder = !(0, import_components43.__experimentalHasSplitBorders)(border) ? {
        top: border,
        right: border,
        bottom: border,
        left: border
      } : {
        color: null,
        style: null,
        width: null,
        ...border
      };
      setStyle2({ ...newStyle, border: { ...updatedBorder, radius } });
    };
    return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_jsx_runtime129.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
        ScreenHeader,
        {
          title: variation ? currentBlockStyle?.label : blockType?.title
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(block_preview_panel_default, { name: name2, variation }),
      hasVariationsPanel && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { className: "global-styles-ui-screen-variations", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_components43.__experimentalVStack, { spacing: 3, children: [
        /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Subtitle, { children: (0, import_i18n67.__)("Style Variations") }),
        /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(VariationsPanel, { name: name2 })
      ] }) }),
      hasColorPanel && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
        StylesColorPanel,
        {
          inheritedValue: inheritedStyle,
          value: style,
          onChange: setStyle2,
          settings
        }
      ),
      hasBackgroundPanel && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
        StylesBackgroundPanel,
        {
          inheritedValue: inheritedStyle,
          value: style,
          onChange: setStyle2,
          settings,
          defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES2
        }
      ),
      hasTypographyPanel && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
        StylesTypographyPanel,
        {
          inheritedValue: inheritedStyle,
          value: style,
          onChange: setStyle2,
          settings
        }
      ),
      hasDimensionsPanel && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
        StylesDimensionsPanel,
        {
          inheritedValue: inheritedStyleWithLayout,
          value: styleWithLayout,
          onChange: onChangeDimensions,
          settings,
          includeLayoutControls: true
        }
      ),
      hasBorderPanel && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
        StylesBorderPanel,
        {
          inheritedValue: inheritedStyle,
          value: style,
          onChange: onChangeBorders,
          settings
        }
      ),
      hasFiltersPanel && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
        StylesFiltersPanel,
        {
          inheritedValue: inheritedStyleWithLayout,
          value: styleWithLayout,
          onChange: setStyle2,
          settings,
          includeLayoutControls: true
        }
      ),
      hasImageSettingsPanel && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
        ImageSettingsPanel,
        {
          onChange: onChangeLightbox,
          value: userSettings,
          inheritedValue: settings
        }
      ),
      canEditCSS && /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_components43.PanelBody, { title: (0, import_i18n67.__)("Advanced"), initialOpen: false, children: [
        /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { children: (0, import_i18n67.sprintf)(
          // translators: %s: is the name of a block e.g., 'Image' or 'Table'.
          (0, import_i18n67.__)(
            "Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value."
          ),
          blockType?.title
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
          StylesAdvancedPanel,
          {
            value: style,
            onChange: setStyle2,
            inheritedValue: inheritedStyle
          }
        )
      ] })
    ] });
  }
  var screen_block_default = ScreenBlock;

  // packages/global-styles-ui/build-module/screen-typography.mjs
  var import_i18n81 = __toESM(require_i18n(), 1);
  var import_components63 = __toESM(require_components(), 1);
  var import_element56 = __toESM(require_element(), 1);

  // packages/global-styles-ui/build-module/screen-body.mjs
  var import_components44 = __toESM(require_components(), 1);
  var import_jsx_runtime130 = __toESM(require_jsx_runtime(), 1);
  function ScreenBody({ children, className }) {
    return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
      import_components44.__experimentalSpacer,
      {
        className: clsx_default("global-styles-ui-screen-body", className),
        padding: 4,
        children
      }
    );
  }

  // packages/global-styles-ui/build-module/typography-elements.mjs
  var import_i18n68 = __toESM(require_i18n(), 1);
  var import_components45 = __toESM(require_components(), 1);
  var import_jsx_runtime131 = __toESM(require_jsx_runtime(), 1);
  function ElementItem({ parentMenu, element, label }) {
    const prefix = element === "text" || !element ? "" : `elements.${element}.`;
    const extraStyles = element === "link" ? {
      textDecoration: "underline"
    } : {};
    const [fontFamily] = useStyle(
      prefix + "typography.fontFamily"
    );
    const [fontStyle] = useStyle(prefix + "typography.fontStyle");
    const [fontWeight] = useStyle(
      prefix + "typography.fontWeight"
    );
    const [backgroundColor] = useStyle(
      prefix + "color.background"
    );
    const [fallbackBackgroundColor] = useStyle("color.background");
    const [gradientValue] = useStyle(prefix + "color.gradient");
    const [color] = useStyle(prefix + "color.text");
    return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(NavigationButtonAsItem, { path: parentMenu + "/typography/" + element, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_components45.__experimentalHStack, { justify: "flex-start", children: [
      /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
        import_components45.FlexItem,
        {
          className: "global-styles-ui-screen-typography__indicator",
          "aria-hidden": "true",
          style: {
            fontFamily: fontFamily ?? "serif",
            background: gradientValue ?? backgroundColor ?? fallbackBackgroundColor,
            color,
            fontStyle,
            fontWeight,
            ...extraStyles
          },
          children: (0, import_i18n68.__)("Aa")
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_components45.FlexItem, { children: label })
    ] }) });
  }
  function TypographyElements() {
    const parentMenu = "";
    return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_components45.__experimentalVStack, { spacing: 3, children: [
      /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Subtitle, { level: 3, children: (0, import_i18n68.__)("Elements") }),
      /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_components45.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [
        /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
          ElementItem,
          {
            parentMenu,
            element: "text",
            label: (0, import_i18n68.__)("Text")
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
          ElementItem,
          {
            parentMenu,
            element: "link",
            label: (0, import_i18n68.__)("Links")
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
          ElementItem,
          {
            parentMenu,
            element: "heading",
            label: (0, import_i18n68.__)("Headings")
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
          ElementItem,
          {
            parentMenu,
            element: "caption",
            label: (0, import_i18n68.__)("Captions")
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
          ElementItem,
          {
            parentMenu,
            element: "button",
            label: (0, import_i18n68.__)("Buttons")
          }
        )
      ] })
    ] });
  }
  var typography_elements_default = TypographyElements;

  // packages/global-styles-ui/build-module/variations/variations-typography.mjs
  var import_components48 = __toESM(require_components(), 1);

  // packages/global-styles-ui/build-module/preview-typography.mjs
  var import_components46 = __toESM(require_components(), 1);
  var import_jsx_runtime132 = __toESM(require_jsx_runtime(), 1);
  var StylesPreviewTypography = ({
    variation,
    isFocused,
    withHoverView
  }) => {
    return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
      preview_wrapper_default,
      {
        label: variation.title,
        isFocused,
        withHoverView,
        children: ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
          import_components46.__experimentalHStack,
          {
            spacing: 10 * ratio,
            justify: "center",
            style: {
              height: "100%",
              overflow: "hidden"
            },
            children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
              PreviewTypography,
              {
                variation,
                fontSize: 85 * ratio
              }
            )
          },
          key
        )
      }
    );
  };
  var preview_typography_default = StylesPreviewTypography;

  // packages/global-styles-ui/build-module/variations/variation.mjs
  var import_components47 = __toESM(require_components(), 1);
  var import_element46 = __toESM(require_element(), 1);
  var import_keycodes2 = __toESM(require_keycodes(), 1);
  var import_i18n69 = __toESM(require_i18n(), 1);
  var import_jsx_runtime133 = __toESM(require_jsx_runtime(), 1);
  function Variation({
    variation,
    children,
    isPill = false,
    properties,
    showTooltip = false
  }) {
    const [isFocused, setIsFocused] = (0, import_element46.useState)(false);
    const {
      base,
      user,
      onChange: setUserConfig
    } = (0, import_element46.useContext)(GlobalStylesContext);
    const context = (0, import_element46.useMemo)(() => {
      let merged = mergeGlobalStyles(base, variation);
      if (properties) {
        merged = filterObjectByProperties(merged, properties);
      }
      return {
        user: variation,
        base,
        merged,
        onChange: () => {
        }
      };
    }, [variation, base, properties]);
    const selectVariation = () => setUserConfig(variation);
    const selectOnEnter = (event) => {
      if (event.keyCode === import_keycodes2.ENTER) {
        event.preventDefault();
        selectVariation();
      }
    };
    const isActive = (0, import_element46.useMemo)(
      () => areGlobalStylesEqual(user, variation),
      [user, variation]
    );
    let label = variation?.title;
    if (variation?.description) {
      label = (0, import_i18n69.sprintf)(
        /* translators: 1: variation title. 2: variation description. */
        (0, import_i18n69._x)("%1$s (%2$s)", "variation label"),
        variation?.title,
        variation?.description
      );
    }
    const content = /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
      "div",
      {
        className: clsx_default("global-styles-ui-variations_item", {
          "is-active": isActive
        }),
        role: "button",
        onClick: selectVariation,
        onKeyDown: selectOnEnter,
        tabIndex: 0,
        "aria-label": label,
        "aria-current": isActive,
        onFocus: () => setIsFocused(true),
        onBlur: () => setIsFocused(false),
        children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
          "div",
          {
            className: clsx_default("global-styles-ui-variations_item-preview", {
              "is-pill": isPill
            }),
            children: children(isFocused)
          }
        )
      }
    );
    return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(GlobalStylesContext.Provider, { value: context, children: showTooltip ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_components47.Tooltip, { text: variation?.title, children: content }) : content });
  }

  // packages/global-styles-ui/build-module/variations/variations-typography.mjs
  var import_jsx_runtime134 = __toESM(require_jsx_runtime(), 1);
  var propertiesToFilter = ["typography"];
  function TypographyVariations({
    title,
    gap = 2
  }) {
    const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter);
    if (typographyVariations?.length <= 1) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_components48.__experimentalVStack, { spacing: 3, children: [
      title && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Subtitle, { level: 3, children: title }),
      /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
        import_components48.__experimentalGrid,
        {
          columns: 3,
          gap,
          className: "global-styles-ui-style-variations-container",
          children: typographyVariations.map(
            (variation, index2) => {
              return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
                Variation,
                {
                  variation,
                  properties: propertiesToFilter,
                  showTooltip: true,
                  children: () => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
                    preview_typography_default,
                    {
                      variation
                    }
                  )
                },
                index2
              );
            }
          )
        }
      )
    ] });
  }

  // packages/global-styles-ui/build-module/font-families.mjs
  var import_i18n79 = __toESM(require_i18n(), 1);
  var import_components61 = __toESM(require_components(), 1);
  var import_element55 = __toESM(require_element(), 1);

  // packages/global-styles-ui/build-module/font-library/context.mjs
  var import_element47 = __toESM(require_element(), 1);
  var import_data54 = __toESM(require_data(), 1);
  var import_core_data35 = __toESM(require_core_data(), 1);
  var import_i18n71 = __toESM(require_i18n(), 1);

  // packages/global-styles-ui/build-module/font-library/api.mjs
  var import_api_fetch3 = __toESM(require_api_fetch(), 1);
  var import_core_data34 = __toESM(require_core_data(), 1);
  var FONT_FAMILIES_URL = "/wp/v2/font-families";
  function invalidateFontFamilyCache(registry) {
    const { receiveEntityRecords } = registry.dispatch(import_core_data34.store);
    receiveEntityRecords(
      "postType",
      "wp_font_family",
      [],
      void 0,
      true
      // invalidateCache
    );
  }
  async function fetchInstallFontFamily(data, registry) {
    const config = {
      path: FONT_FAMILIES_URL,
      method: "POST",
      body: data
    };
    const response = await (0, import_api_fetch3.default)(config);
    invalidateFontFamilyCache(registry);
    return {
      id: response.id,
      ...response.font_family_settings,
      fontFace: []
    };
  }
  async function fetchInstallFontFace(fontFamilyId, data, registry) {
    const config = {
      path: `${FONT_FAMILIES_URL}/${fontFamilyId}/font-faces`,
      method: "POST",
      body: data
    };
    const response = await (0, import_api_fetch3.default)(config);
    invalidateFontFamilyCache(registry);
    return {
      id: response.id,
      ...response.font_face_settings
    };
  }

  // packages/global-styles-ui/build-module/font-library/utils/index.mjs
  var import_components49 = __toESM(require_components(), 1);

  // packages/global-styles-ui/build-module/font-library/utils/constants.mjs
  var import_i18n70 = __toESM(require_i18n(), 1);
  var ALLOWED_FILE_EXTENSIONS = ["otf", "ttf", "woff", "woff2"];
  var FONT_WEIGHTS = {
    100: (0, import_i18n70._x)("Thin", "font weight"),
    200: (0, import_i18n70._x)("Extra-light", "font weight"),
    300: (0, import_i18n70._x)("Light", "font weight"),
    400: (0, import_i18n70._x)("Normal", "font weight"),
    500: (0, import_i18n70._x)("Medium", "font weight"),
    600: (0, import_i18n70._x)("Semi-bold", "font weight"),
    700: (0, import_i18n70._x)("Bold", "font weight"),
    800: (0, import_i18n70._x)("Extra-bold", "font weight"),
    900: (0, import_i18n70._x)("Black", "font weight")
  };
  var FONT_STYLES = {
    normal: (0, import_i18n70._x)("Normal", "font style"),
    italic: (0, import_i18n70._x)("Italic", "font style")
  };

  // packages/global-styles-ui/build-module/font-library/utils/index.mjs
  var { File: File2 } = window;
  var { kebabCase: kebabCase2 } = unlock3(import_components49.privateApis);
  function setUIValuesNeeded(font2, extraValues = {}) {
    if (!font2.name && (font2.fontFamily || font2.slug)) {
      font2.name = font2.fontFamily || font2.slug;
    }
    return {
      ...font2,
      ...extraValues
    };
  }
  function isUrlEncoded(url) {
    if (typeof url !== "string") {
      return false;
    }
    return url !== decodeURIComponent(url);
  }
  function getFontFaceVariantName(face) {
    const weightName = FONT_WEIGHTS[face.fontWeight ?? ""] || face.fontWeight;
    const styleName = face.fontStyle === "normal" ? "" : FONT_STYLES[face.fontStyle ?? ""] || face.fontStyle;
    return `${weightName} ${styleName}`;
  }
  function mergeFontFaces(existing = [], incoming = []) {
    const map = /* @__PURE__ */ new Map();
    for (const face of existing) {
      map.set(`${face.fontWeight}${face.fontStyle}`, face);
    }
    for (const face of incoming) {
      map.set(`${face.fontWeight}${face.fontStyle}`, face);
    }
    return Array.from(map.values());
  }
  function mergeFontFamilies(existing = [], incoming = []) {
    const map = /* @__PURE__ */ new Map();
    for (const font2 of existing) {
      map.set(font2.slug, { ...font2 });
    }
    for (const font2 of incoming) {
      if (map.has(font2.slug)) {
        const { fontFace: incomingFontFaces, ...restIncoming } = font2;
        const existingFont = map.get(font2.slug);
        const mergedFontFaces = mergeFontFaces(
          existingFont.fontFace,
          incomingFontFaces
        );
        map.set(font2.slug, {
          ...restIncoming,
          fontFace: mergedFontFaces
        });
      } else {
        map.set(font2.slug, { ...font2 });
      }
    }
    return Array.from(map.values());
  }
  async function loadFontFaceInBrowser(fontFace, source, addTo = "all") {
    let dataSource;
    if (typeof source === "string") {
      dataSource = `url(${source})`;
    } else if (source instanceof File2) {
      dataSource = await source.arrayBuffer();
    } else {
      return;
    }
    const newFont = new window.FontFace(
      formatFontFaceName(fontFace.fontFamily),
      dataSource,
      {
        style: fontFace.fontStyle,
        weight: String(fontFace.fontWeight)
      }
    );
    const loadedFace = await newFont.load();
    if (addTo === "document" || addTo === "all") {
      document.fonts.add(loadedFace);
    }
    if (addTo === "iframe" || addTo === "all") {
      const iframe = document.querySelector(
        'iframe[name="editor-canvas"]'
      );
      if (iframe?.contentDocument) {
        iframe.contentDocument.fonts.add(loadedFace);
      }
    }
  }
  function unloadFontFaceInBrowser(fontFace, removeFrom = "all") {
    const unloadFontFace = (fonts) => {
      fonts.forEach((f3) => {
        if (f3.family === formatFontFaceName(fontFace?.fontFamily) && f3.weight === fontFace?.fontWeight && f3.style === fontFace?.fontStyle) {
          fonts.delete(f3);
        }
      });
    };
    if (removeFrom === "document" || removeFrom === "all") {
      unloadFontFace(document.fonts);
    }
    if (removeFrom === "iframe" || removeFrom === "all") {
      const iframe = document.querySelector(
        'iframe[name="editor-canvas"]'
      );
      if (iframe?.contentDocument) {
        unloadFontFace(iframe.contentDocument.fonts);
      }
    }
  }
  function getDisplaySrcFromFontFace(input) {
    if (!input) {
      return;
    }
    let src;
    if (Array.isArray(input)) {
      src = input[0];
    } else {
      src = input;
    }
    if (src.startsWith("file:.")) {
      return;
    }
    if (!isUrlEncoded(src)) {
      src = encodeURI(src);
    }
    return src;
  }
  function makeFontFamilyFormData(fontFamily) {
    const formData = new FormData();
    const { fontFace, category, ...familyWithValidParameters } = fontFamily;
    const fontFamilySettings = {
      ...familyWithValidParameters,
      slug: kebabCase2(fontFamily.slug)
    };
    formData.append(
      "font_family_settings",
      JSON.stringify(fontFamilySettings)
    );
    return formData;
  }
  function makeFontFacesFormData(font2) {
    const fontFacesFormData = (font2?.fontFace ?? []).map(
      (item, faceIndex) => {
        const face = { ...item };
        const formData = new FormData();
        if (face.file) {
          const files = Array.isArray(face.file) ? face.file : [face.file];
          const src = [];
          files.forEach((file, key) => {
            const fileId = `file-${faceIndex}-${key}`;
            formData.append(fileId, file, file.name);
            src.push(fileId);
          });
          face.src = src.length === 1 ? src[0] : src;
          delete face.file;
          formData.append("font_face_settings", JSON.stringify(face));
        } else {
          formData.append("font_face_settings", JSON.stringify(face));
        }
        return formData;
      }
    );
    return fontFacesFormData;
  }
  async function batchInstallFontFaces(fontFamilyId, fontFacesData, registry) {
    const responses = [];
    for (const faceData of fontFacesData) {
      try {
        const response = await fetchInstallFontFace(
          fontFamilyId,
          faceData,
          registry
        );
        responses.push({ status: "fulfilled", value: response });
      } catch (error) {
        responses.push({ status: "rejected", reason: error });
      }
    }
    const results = {
      errors: [],
      successes: []
    };
    responses.forEach((result, index2) => {
      if (result.status === "fulfilled" && result.value) {
        const response = result.value;
        results.successes.push(response);
      } else if (result.reason) {
        results.errors.push({
          data: fontFacesData[index2],
          message: result.reason.message
        });
      }
    });
    return results;
  }
  async function downloadFontFaceAssets(src) {
    src = Array.isArray(src) ? src : [src];
    const files = await Promise.all(
      src.map(async (url) => {
        return fetch(new Request(url)).then((response) => {
          if (!response.ok) {
            throw new Error(
              `Error downloading font face asset from ${url}. Server responded with status: ${response.status}`
            );
          }
          return response.blob();
        }).then((blob) => {
          const filename = url.split("/").pop();
          const file = new File2([blob], filename, {
            type: blob.type
          });
          return file;
        });
      })
    );
    return files.length === 1 ? files[0] : files;
  }
  function checkFontFaceInstalled(fontFace, collection) {
    return -1 !== collection.findIndex((collectionFontFace) => {
      return collectionFontFace.fontWeight === fontFace.fontWeight && collectionFontFace.fontStyle === fontFace.fontStyle;
    });
  }

  // packages/global-styles-ui/build-module/font-library/utils/set-immutably.mjs
  function setImmutably2(object, path, value) {
    path = Array.isArray(path) ? [...path] : [path];
    object = Array.isArray(object) ? [...object] : { ...object };
    const leaf = path.pop();
    let prev = object;
    for (const key of path) {
      const lvl = prev[key];
      prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl };
    }
    prev[leaf] = value;
    return object;
  }

  // packages/global-styles-ui/build-module/font-library/utils/toggleFont.mjs
  function toggleFont(font2, face, initialfonts = []) {
    const isFontActivated = (f3) => f3.slug === font2.slug;
    const getActivatedFont = (fonts) => fonts.find(isFontActivated);
    const toggleEntireFontFamily = (activatedFont2) => {
      if (!activatedFont2) {
        return [...initialfonts, font2];
      }
      return initialfonts.filter(
        (f3) => !isFontActivated(f3)
      );
    };
    const toggleFontVariant = (activatedFont2) => {
      const isFaceActivated = (f3) => f3.fontWeight === face.fontWeight && f3.fontStyle === face.fontStyle;
      if (!activatedFont2) {
        return [...initialfonts, { ...font2, fontFace: [face] }];
      }
      let newFontFaces = activatedFont2.fontFace || [];
      if (newFontFaces.find(isFaceActivated)) {
        newFontFaces = newFontFaces.filter(
          (f3) => !isFaceActivated(f3)
        );
      } else {
        newFontFaces = [...newFontFaces, face];
      }
      if (newFontFaces.length === 0) {
        return initialfonts.filter(
          (f3) => !isFontActivated(f3)
        );
      }
      return initialfonts.map(
        (f3) => isFontActivated(f3) ? { ...f3, fontFace: newFontFaces } : f3
      );
    };
    const activatedFont = getActivatedFont(initialfonts);
    if (!face) {
      return toggleEntireFontFamily(activatedFont);
    }
    return toggleFontVariant(activatedFont);
  }

  // packages/global-styles-ui/build-module/font-library/context.mjs
  var import_jsx_runtime135 = __toESM(require_jsx_runtime(), 1);
  var FontLibraryContext = (0, import_element47.createContext)(
    {}
  );
  FontLibraryContext.displayName = "FontLibraryContext";
  function FontLibraryProvider({ children }) {
    const registry = (0, import_data54.useRegistry)();
    const { saveEntityRecord, deleteEntityRecord } = (0, import_data54.useDispatch)(import_core_data35.store);
    const { globalStylesId } = (0, import_data54.useSelect)((select5) => {
      const { __experimentalGetCurrentGlobalStylesId } = select5(import_core_data35.store);
      return { globalStylesId: __experimentalGetCurrentGlobalStylesId() };
    }, []);
    const globalStyles = (0, import_core_data35.useEntityRecord)(
      "root",
      "globalStyles",
      globalStylesId
    );
    const [isInstalling, setIsInstalling] = (0, import_element47.useState)(false);
    const { records: libraryPosts = [], isResolving: isResolvingLibrary } = (0, import_core_data35.useEntityRecords)(
      "postType",
      "wp_font_family",
      {
        _embed: true
      }
    );
    const libraryFonts = (libraryPosts || []).map((fontFamilyPost) => {
      return {
        id: fontFamilyPost.id,
        ...fontFamilyPost.font_family_settings || {},
        fontFace: fontFamilyPost?._embedded?.font_faces?.map(
          (face) => face.font_face_settings
        ) || []
      };
    }) || [];
    const [fontFamilies, setFontFamilies] = useSetting("typography.fontFamilies");
    const saveFontFamilies = async (fonts) => {
      if (!globalStyles.record) {
        return;
      }
      const updatedGlobalStyles = globalStyles.record;
      const finalGlobalStyles = setImmutably2(
        updatedGlobalStyles ?? {},
        ["settings", "typography", "fontFamilies"],
        fonts
      );
      await saveEntityRecord("root", "globalStyles", finalGlobalStyles);
    };
    const [modalTabOpen, setModalTabOpen] = (0, import_element47.useState)("");
    const [libraryFontSelected, setLibraryFontSelected] = (0, import_element47.useState)(void 0);
    const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f3) => setUIValuesNeeded(f3, { source: "theme" })).sort((a3, b3) => a3.name.localeCompare(b3.name)) : [];
    const customFonts = fontFamilies?.custom ? fontFamilies.custom.map((f3) => setUIValuesNeeded(f3, { source: "custom" })).sort((a3, b3) => a3.name.localeCompare(b3.name)) : [];
    const baseCustomFonts = libraryFonts ? libraryFonts.map((f3) => setUIValuesNeeded(f3, { source: "custom" })).sort((a3, b3) => a3.name.localeCompare(b3.name)) : [];
    (0, import_element47.useEffect)(() => {
      if (!modalTabOpen) {
        setLibraryFontSelected(void 0);
      }
    }, [modalTabOpen]);
    const handleSetLibraryFontSelected = (font2) => {
      if (!font2) {
        setLibraryFontSelected(void 0);
        return;
      }
      const fonts = font2.source === "theme" ? themeFonts : baseCustomFonts;
      const fontSelected = fonts.find((f3) => f3.slug === font2.slug);
      setLibraryFontSelected({
        ...fontSelected || font2,
        source: font2.source
      });
    };
    const [loadedFontUrls] = (0, import_element47.useState)(/* @__PURE__ */ new Set());
    const getAvailableFontsOutline = (availableFontFamilies) => {
      const outline = availableFontFamilies.reduce(
        (acc, font2) => {
          const availableFontFaces = font2?.fontFace && font2.fontFace?.length > 0 ? font2?.fontFace.map(
            (face) => `${face.fontStyle ?? ""}${face.fontWeight ?? ""}`
          ) : ["normal400"];
          acc[font2.slug] = availableFontFaces;
          return acc;
        },
        {}
      );
      return outline;
    };
    const getActivatedFontsOutline = (source) => {
      switch (source) {
        case "theme":
          return getAvailableFontsOutline(themeFonts);
        case "custom":
        default:
          return getAvailableFontsOutline(customFonts);
      }
    };
    const isFontActivated = (slug, style, weight, source) => {
      if (!style && !weight) {
        return !!getActivatedFontsOutline(source)[slug];
      }
      return !!getActivatedFontsOutline(source)[slug]?.includes(
        (style ?? "") + (weight ?? "")
      );
    };
    const getFontFacesActivated = (slug, source) => {
      return getActivatedFontsOutline(source)[slug] || [];
    };
    async function installFonts(fontFamiliesToInstall) {
      setIsInstalling(true);
      try {
        const fontFamiliesToActivate = [];
        let installationErrors = [];
        for (const fontFamilyToInstall of fontFamiliesToInstall) {
          let isANewFontFamily = false;
          const fontFamilyRecords = await (0, import_data54.resolveSelect)(
            import_core_data35.store
          ).getEntityRecords(
            "postType",
            "wp_font_family",
            {
              slug: fontFamilyToInstall.slug,
              per_page: 1,
              _embed: true
            }
          );
          const fontFamilyPost = fontFamilyRecords && fontFamilyRecords.length > 0 ? fontFamilyRecords[0] : null;
          let installedFontFamily = fontFamilyPost ? {
            id: fontFamilyPost.id,
            ...fontFamilyPost.font_family_settings,
            fontFace: (fontFamilyPost?._embedded?.font_faces ?? []).map(
              (face) => face.font_face_settings
            ) || []
          } : null;
          if (!installedFontFamily) {
            isANewFontFamily = true;
            installedFontFamily = await fetchInstallFontFamily(
              makeFontFamilyFormData(fontFamilyToInstall),
              registry
            );
          }
          const alreadyInstalledFontFaces = installedFontFamily.fontFace && fontFamilyToInstall.fontFace ? installedFontFamily.fontFace.filter(
            (fontFaceToInstall) => fontFaceToInstall && fontFamilyToInstall.fontFace && checkFontFaceInstalled(
              fontFaceToInstall,
              fontFamilyToInstall.fontFace
            )
          ) : [];
          if (installedFontFamily.fontFace && fontFamilyToInstall.fontFace) {
            fontFamilyToInstall.fontFace = fontFamilyToInstall.fontFace.filter(
              (fontFaceToInstall) => !checkFontFaceInstalled(
                fontFaceToInstall,
                installedFontFamily.fontFace
              )
            );
          }
          let successfullyInstalledFontFaces = [];
          let unsuccessfullyInstalledFontFaces = [];
          if (fontFamilyToInstall?.fontFace?.length ?? 0 > 0) {
            const response = await batchInstallFontFaces(
              // @ts-expect-error - Type mismatch: WpFontFamily.id can be number | string, but batchInstallFontFaces expects only string.
              installedFontFamily.id,
              makeFontFacesFormData(
                fontFamilyToInstall
              ),
              registry
            );
            successfullyInstalledFontFaces = response?.successes;
            unsuccessfullyInstalledFontFaces = response?.errors;
          }
          if (successfullyInstalledFontFaces?.length > 0 || alreadyInstalledFontFaces?.length > 0) {
            installedFontFamily.fontFace = [
              ...successfullyInstalledFontFaces
            ];
            fontFamiliesToActivate.push(installedFontFamily);
          }
          if (installedFontFamily && !fontFamilyToInstall?.fontFace?.length) {
            fontFamiliesToActivate.push(installedFontFamily);
          }
          if (isANewFontFamily && (fontFamilyToInstall?.fontFace?.length ?? 0) > 0 && successfullyInstalledFontFaces?.length === 0) {
            await deleteEntityRecord(
              "postType",
              "wp_font_family",
              installedFontFamily.id,
              { force: true }
            );
          }
          installationErrors = installationErrors.concat(
            unsuccessfullyInstalledFontFaces
          );
        }
        const installationErrorMessages = installationErrors.reduce(
          (unique, item) => unique.includes(item.message) ? unique : [...unique, item.message],
          []
        );
        if (fontFamiliesToActivate.length > 0) {
          const activeFonts = activateCustomFontFamilies(
            // @ts-expect-error - Type mismatch: items may have id as number | string, but FontFamily.id should be string | undefined.
            fontFamiliesToActivate
          );
          await saveFontFamilies(activeFonts);
        }
        if (installationErrorMessages.length > 0) {
          const installError = new Error((0, import_i18n71.__)("There was an error installing fonts."));
          installError.installationErrors = installationErrorMessages;
          throw installError;
        }
      } finally {
        setIsInstalling(false);
      }
    }
    async function uninstallFontFamily(fontFamilyToUninstall) {
      if (!fontFamilyToUninstall?.id) {
        throw new Error((0, import_i18n71.__)("Font family to uninstall is not defined."));
      }
      try {
        await deleteEntityRecord(
          "postType",
          "wp_font_family",
          fontFamilyToUninstall.id,
          { force: true }
        );
        const activeFonts = deactivateFontFamily(fontFamilyToUninstall);
        await saveFontFamilies(activeFonts);
        return { deleted: true };
      } catch (error) {
        console.error(
          `There was an error uninstalling the font family:`,
          error
        );
        throw error;
      }
    }
    const deactivateFontFamily = (font2) => {
      const initialCustomFonts = fontFamilies?.[font2.source ?? ""] ?? [];
      const newCustomFonts = initialCustomFonts.filter(
        (f3) => f3.slug !== font2.slug
      );
      const activeFonts = {
        ...fontFamilies,
        [font2.source ?? ""]: newCustomFonts
      };
      setFontFamilies(activeFonts);
      if (font2.fontFace) {
        font2.fontFace.forEach((face) => {
          unloadFontFaceInBrowser(face, "all");
        });
      }
      return activeFonts;
    };
    const activateCustomFontFamilies = (fontsToAdd) => {
      const fontsToActivate = cleanFontsForSave(fontsToAdd);
      const activeFonts = {
        ...fontFamilies,
        // Merge the existing custom fonts with the new fonts.
        custom: mergeFontFamilies(fontFamilies?.custom, fontsToActivate)
      };
      setFontFamilies(activeFonts);
      loadFontsInBrowser(fontsToActivate);
      return activeFonts;
    };
    const cleanFontsForSave = (fonts) => {
      return fonts.map(({ id: _familyDbId, fontFace, ...font2 }) => ({
        ...font2,
        ...fontFace && fontFace.length > 0 ? {
          fontFace: fontFace.map(
            ({ id: _faceDbId, ...face }) => face
          )
        } : {}
      }));
    };
    const loadFontsInBrowser = (fonts) => {
      fonts.forEach((font2) => {
        if (font2.fontFace) {
          font2.fontFace.forEach((face) => {
            const displaySrc = getDisplaySrcFromFontFace(
              face?.src ?? ""
            );
            if (displaySrc) {
              loadFontFaceInBrowser(face, displaySrc, "all");
            }
          });
        }
      });
    };
    const toggleActivateFont = (font2, face) => {
      const initialFonts = fontFamilies?.[font2.source ?? ""] ?? [];
      const newFonts = toggleFont(font2, face, initialFonts);
      setFontFamilies({
        ...fontFamilies,
        [font2.source ?? ""]: newFonts
      });
      const isFaceActivated = isFontActivated(
        font2.slug,
        face?.fontStyle ?? "",
        face?.fontWeight ?? "",
        font2.source ?? "custom"
      );
      if (face && isFaceActivated) {
        unloadFontFaceInBrowser(face, "all");
      } else {
        const displaySrc = getDisplaySrcFromFontFace(face?.src ?? "");
        if (face && displaySrc) {
          loadFontFaceInBrowser(face, displaySrc, "all");
        }
      }
    };
    const loadFontFaceAsset = async (fontFace) => {
      if (!fontFace.src) {
        return;
      }
      const src = getDisplaySrcFromFontFace(fontFace.src);
      if (!src || loadedFontUrls.has(src)) {
        return;
      }
      loadFontFaceInBrowser(fontFace, src, "document");
      loadedFontUrls.add(src);
    };
    return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
      FontLibraryContext.Provider,
      {
        value: {
          libraryFontSelected,
          handleSetLibraryFontSelected,
          fontFamilies: fontFamilies ?? {},
          baseCustomFonts,
          isFontActivated,
          getFontFacesActivated,
          loadFontFaceAsset,
          installFonts,
          uninstallFontFamily,
          toggleActivateFont,
          getAvailableFontsOutline,
          modalTabOpen,
          setModalTabOpen,
          saveFontFamilies,
          isResolvingLibrary,
          isInstalling
        },
        children
      }
    );
  }
  var context_default = FontLibraryProvider;

  // packages/global-styles-ui/build-module/font-library/modal.mjs
  var import_i18n77 = __toESM(require_i18n(), 1);
  var import_components59 = __toESM(require_components(), 1);
  var import_core_data38 = __toESM(require_core_data(), 1);
  var import_data56 = __toESM(require_data(), 1);

  // packages/global-styles-ui/build-module/font-library/installed-fonts.mjs
  var import_components53 = __toESM(require_components(), 1);
  var import_core_data36 = __toESM(require_core_data(), 1);
  var import_data55 = __toESM(require_data(), 1);
  var import_element50 = __toESM(require_element(), 1);
  var import_i18n73 = __toESM(require_i18n(), 1);

  // packages/global-styles-ui/build-module/font-library/font-card.mjs
  var import_i18n72 = __toESM(require_i18n(), 1);
  var import_components51 = __toESM(require_components(), 1);

  // packages/global-styles-ui/build-module/font-library/font-demo.mjs
  var import_components50 = __toESM(require_components(), 1);
  var import_element48 = __toESM(require_element(), 1);
  var import_jsx_runtime136 = __toESM(require_jsx_runtime(), 1);
  function getPreviewUrl(fontFace) {
    if (fontFace.preview) {
      return fontFace.preview;
    }
    if (fontFace.src) {
      return Array.isArray(fontFace.src) ? fontFace.src[0] : fontFace.src;
    }
    return void 0;
  }
  function getDisplayFontFace(font2) {
    if ("fontStyle" in font2 && font2.fontStyle || "fontWeight" in font2 && font2.fontWeight) {
      return font2;
    }
    if ("fontFace" in font2 && font2.fontFace && font2.fontFace.length) {
      return font2.fontFace.find(
        (face) => face.fontStyle === "normal" && face.fontWeight === "400"
      ) || font2.fontFace[0];
    }
    return {
      fontStyle: "normal",
      fontWeight: "400",
      fontFamily: font2.fontFamily
    };
  }
  function FontDemo({ font: font2, text }) {
    const ref = (0, import_element48.useRef)(null);
    const fontFace = getDisplayFontFace(font2);
    const style = getFamilyPreviewStyle(font2);
    text = text || ("name" in font2 ? font2.name : "");
    const customPreviewUrl = font2.preview;
    const [isIntersecting, setIsIntersecting] = (0, import_element48.useState)(false);
    const [isAssetLoaded, setIsAssetLoaded] = (0, import_element48.useState)(false);
    const { loadFontFaceAsset } = (0, import_element48.useContext)(FontLibraryContext);
    const previewUrl = customPreviewUrl ?? getPreviewUrl(fontFace);
    const isPreviewImage = previewUrl && previewUrl.match(/\.(png|jpg|jpeg|gif|svg)$/i);
    const faceStyles = getFacePreviewStyle(fontFace);
    const textDemoStyle = {
      fontSize: "18px",
      lineHeight: 1,
      opacity: isAssetLoaded ? "1" : "0",
      ...style,
      ...faceStyles
    };
    (0, import_element48.useEffect)(() => {
      const observer = new window.IntersectionObserver(([entry]) => {
        setIsIntersecting(entry.isIntersecting);
      }, {});
      if (ref.current) {
        observer.observe(ref.current);
      }
      return () => observer.disconnect();
    }, [ref]);
    (0, import_element48.useEffect)(() => {
      const loadAsset = async () => {
        if (isIntersecting) {
          if (!isPreviewImage && fontFace.src) {
            await loadFontFaceAsset(fontFace);
          }
          setIsAssetLoaded(true);
        }
      };
      loadAsset();
    }, [fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage]);
    return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("div", { ref, children: isPreviewImage ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
      "img",
      {
        src: previewUrl,
        loading: "lazy",
        alt: text,
        className: "font-library__font-variant_demo-image"
      }
    ) : /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
      import_components50.__experimentalText,
      {
        style: textDemoStyle,
        className: "font-library__font-variant_demo-text",
        children: text
      }
    ) });
  }
  var font_demo_default = FontDemo;

  // packages/global-styles-ui/build-module/font-library/font-card.mjs
  var import_jsx_runtime137 = __toESM(require_jsx_runtime(), 1);
  function FontCard({
    font: font2,
    onClick,
    variantsText,
    navigatorPath
  }) {
    const variantsCount = font2.fontFace?.length || 1;
    const style = {
      cursor: !!onClick ? "pointer" : "default"
    };
    const navigator = (0, import_components51.useNavigator)();
    return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
      import_components51.Button,
      {
        __next40pxDefaultSize: true,
        onClick: () => {
          onClick();
          if (navigatorPath) {
            navigator.goTo(navigatorPath);
          }
        },
        style,
        className: "font-library__font-card",
        children: /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_components51.Flex, { justify: "space-between", wrap: false, children: [
          /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(font_demo_default, { font: font2 }),
          /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_components51.Flex, { justify: "flex-end", children: [
            /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_components51.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_components51.__experimentalText, { className: "font-library__font-card__count", children: variantsText || (0, import_i18n72.sprintf)(
              /* translators: %d: Number of font variants. */
              (0, import_i18n72._n)(
                "%d variant",
                "%d variants",
                variantsCount
              ),
              variantsCount
            ) }) }),
            /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_components51.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(icon_default, { icon: (0, import_i18n72.isRTL)() ? chevron_left_default : chevron_right_default }) })
          ] })
        ] })
      }
    );
  }
  var font_card_default = FontCard;

  // packages/global-styles-ui/build-module/font-library/library-font-variant.mjs
  var import_element49 = __toESM(require_element(), 1);
  var import_components52 = __toESM(require_components(), 1);
  var import_jsx_runtime138 = __toESM(require_jsx_runtime(), 1);
  function LibraryFontVariant({
    face,
    font: font2
  }) {
    const { isFontActivated, toggleActivateFont } = (0, import_element49.useContext)(FontLibraryContext);
    const isInstalled = (font2?.fontFace?.length ?? 0) > 0 ? isFontActivated(
      font2.slug,
      face.fontStyle,
      face.fontWeight,
      font2.source
    ) : isFontActivated(font2.slug, void 0, void 0, font2.source);
    const handleToggleActivation = () => {
      if ((font2?.fontFace?.length ?? 0) > 0) {
        toggleActivateFont(font2, face);
        return;
      }
      toggleActivateFont(font2);
    };
    const displayName = font2.name + " " + getFontFaceVariantName(face);
    const checkboxId = (0, import_element49.useId)();
    return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { className: "font-library__font-card", children: /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_components52.Flex, { justify: "flex-start", align: "center", gap: "1rem", children: [
      /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
        import_components52.CheckboxControl,
        {
          checked: isInstalled,
          onChange: handleToggleActivation,
          id: checkboxId
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("label", { htmlFor: checkboxId, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
        font_demo_default,
        {
          font: face,
          text: displayName,
          onClick: handleToggleActivation
        }
      ) })
    ] }) });
  }
  var library_font_variant_default = LibraryFontVariant;

  // packages/global-styles-ui/build-module/font-library/utils/sort-font-faces.mjs
  function getNumericFontWeight(value) {
    switch (value) {
      case "normal":
        return 400;
      case "bold":
        return 700;
      case "bolder":
        return 500;
      case "lighter":
        return 300;
      default:
        return parseInt(value, 10);
    }
  }
  function sortFontFaces(faces) {
    return faces.sort((a3, b3) => {
      if (a3.fontStyle === "normal" && b3.fontStyle !== "normal") {
        return -1;
      }
      if (b3.fontStyle === "normal" && a3.fontStyle !== "normal") {
        return 1;
      }
      if (a3.fontStyle === b3.fontStyle) {
        return getNumericFontWeight(a3.fontWeight?.toString() ?? "normal") - getNumericFontWeight(b3.fontWeight?.toString() ?? "normal");
      }
      if (!a3.fontStyle || !b3.fontStyle) {
        return !a3.fontStyle ? 1 : -1;
      }
      return a3.fontStyle.localeCompare(b3.fontStyle);
    });
  }

  // packages/global-styles-ui/build-module/font-library/installed-fonts.mjs
  var import_jsx_runtime139 = __toESM(require_jsx_runtime(), 1);
  function InstalledFonts() {
    const {
      baseCustomFonts,
      libraryFontSelected,
      handleSetLibraryFontSelected,
      uninstallFontFamily,
      isResolvingLibrary,
      isInstalling,
      saveFontFamilies,
      getFontFacesActivated
    } = (0, import_element50.useContext)(FontLibraryContext);
    const [fontFamilies, setFontFamilies] = useSetting("typography.fontFamilies");
    const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = (0, import_element50.useState)(false);
    const [notice, setNotice] = (0, import_element50.useState)(null);
    const [baseFontFamilies] = useSetting("typography.fontFamilies", void 0, "base");
    const globalStylesId = (0, import_data55.useSelect)((select5) => {
      const { __experimentalGetCurrentGlobalStylesId } = select5(import_core_data36.store);
      return __experimentalGetCurrentGlobalStylesId();
    }, []);
    const globalStyles = (0, import_core_data36.useEntityRecord)(
      "root",
      "globalStyles",
      globalStylesId
    );
    const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies;
    const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f3) => setUIValuesNeeded(f3, { source: "theme" })).sort((a3, b3) => a3.name.localeCompare(b3.name)) : [];
    const themeFontsSlugs = new Set(themeFonts.map((f3) => f3.slug));
    const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat(
      baseFontFamilies.theme.filter((f3) => !themeFontsSlugs.has(f3.slug)).map((f3) => setUIValuesNeeded(f3, { source: "theme" })).sort((a3, b3) => a3.name.localeCompare(b3.name))
    ) : [];
    const customFontFamilyId = libraryFontSelected?.source === "custom" && libraryFontSelected?.id;
    const canUserDelete = (0, import_data55.useSelect)(
      (select5) => {
        const { canUser } = select5(import_core_data36.store);
        return customFontFamilyId && canUser("delete", {
          kind: "postType",
          name: "wp_font_family",
          id: customFontFamilyId
        });
      },
      [customFontFamilyId]
    );
    const shouldDisplayDeleteButton = !!libraryFontSelected && libraryFontSelected?.source !== "theme" && canUserDelete;
    const handleUninstallClick = () => {
      setIsConfirmDeleteOpen(true);
    };
    const handleUpdate = async () => {
      setNotice(null);
      try {
        await saveFontFamilies(fontFamilies);
        setNotice({
          type: "success",
          message: (0, import_i18n73.__)("Font family updated successfully.")
        });
      } catch (error) {
        setNotice({
          type: "error",
          message: (0, import_i18n73.sprintf)(
            /* translators: %s: error message */
            (0, import_i18n73.__)("There was an error updating the font family. %s"),
            error.message
          )
        });
      }
    };
    const getFontFacesToDisplay = (font2) => {
      if (!font2) {
        return [];
      }
      if (!font2.fontFace || !font2.fontFace.length) {
        return [
          {
            fontFamily: font2.fontFamily,
            fontStyle: "normal",
            fontWeight: "400"
          }
        ];
      }
      return sortFontFaces(font2.fontFace);
    };
    const getFontCardVariantsText = (font2) => {
      const variantsInstalled = font2?.fontFace && (font2?.fontFace?.length ?? 0) > 0 ? font2.fontFace.length : 1;
      const variantsActive = getFontFacesActivated(
        font2.slug,
        font2.source
      ).length;
      return (0, import_i18n73.sprintf)(
        /* translators: 1: Active font variants, 2: Total font variants. */
        (0, import_i18n73.__)("%1$d/%2$d variants active"),
        variantsActive,
        variantsInstalled
      );
    };
    (0, import_element50.useEffect)(() => {
      handleSetLibraryFontSelected(libraryFontSelected);
    }, []);
    const activeFontsCount = libraryFontSelected ? getFontFacesActivated(
      libraryFontSelected.slug,
      libraryFontSelected.source
    ).length : 0;
    const selectedFontsCount = libraryFontSelected?.fontFace?.length ?? (libraryFontSelected?.fontFamily ? 1 : 0);
    const isIndeterminate = activeFontsCount > 0 && activeFontsCount !== selectedFontsCount;
    const isSelectAllChecked = activeFontsCount === selectedFontsCount;
    const toggleSelectAll = () => {
      if (!libraryFontSelected || !libraryFontSelected?.source) {
        return;
      }
      const initialFonts = fontFamilies?.[libraryFontSelected.source]?.filter(
        (f3) => f3.slug !== libraryFontSelected.slug
      ) ?? [];
      const newFonts = isSelectAllChecked ? initialFonts : [...initialFonts, libraryFontSelected];
      setFontFamilies({
        ...fontFamilies,
        [libraryFontSelected.source]: newFonts
      });
      if (libraryFontSelected.fontFace) {
        libraryFontSelected.fontFace.forEach((face) => {
          if (isSelectAllChecked) {
            unloadFontFaceInBrowser(face, "all");
          } else {
            const displaySrc = getDisplaySrcFromFontFace(
              face?.src ?? ""
            );
            if (displaySrc) {
              loadFontFaceInBrowser(face, displaySrc, "all");
            }
          }
        });
      }
    };
    const hasFonts = baseThemeFonts.length > 0 || baseCustomFonts.length > 0;
    return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "font-library__tabpanel-layout", children: [
      isResolvingLibrary && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { className: "font-library__loading", children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components53.ProgressBar, {}) }),
      !isResolvingLibrary && /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_jsx_runtime139.Fragment, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
          import_components53.Navigator,
          {
            initialPath: libraryFontSelected ? "/fontFamily" : "/",
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components53.Navigator.Screen, { path: "/", children: /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_components53.__experimentalVStack, { spacing: "8", children: [
                notice && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                  import_components53.Notice,
                  {
                    status: notice.type,
                    onRemove: () => setNotice(null),
                    children: notice.message
                  }
                ),
                !hasFonts && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components53.__experimentalText, { as: "p", children: (0, import_i18n73.__)("No fonts installed.") }),
                baseThemeFonts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_components53.__experimentalVStack, { children: [
                  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("h2", {
                    className: "font-library__fonts-title",
                    /* translators: Heading for a list of fonts provided by the theme. */
                    children: (0, import_i18n73._x)("Theme", "font source")
                  }),
                  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                    "ul",
                    {
                      role: "list",
                      className: "font-library__fonts-list",
                      children: baseThemeFonts.map((font2) => /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                        "li",
                        {
                          className: "font-library__fonts-list-item",
                          children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                            font_card_default,
                            {
                              font: font2,
                              navigatorPath: "/fontFamily",
                              variantsText: getFontCardVariantsText(
                                font2
                              ),
                              onClick: () => {
                                setNotice(null);
                                handleSetLibraryFontSelected(
                                  font2
                                );
                              }
                            }
                          )
                        },
                        font2.slug
                      ))
                    }
                  )
                ] }),
                baseCustomFonts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_components53.__experimentalVStack, { children: [
                  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("h2", {
                    className: "font-library__fonts-title",
                    /* translators: Heading for a list of fonts installed by the user. */
                    children: (0, import_i18n73._x)("Custom", "font source")
                  }),
                  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                    "ul",
                    {
                      role: "list",
                      className: "font-library__fonts-list",
                      children: baseCustomFonts.map((font2) => /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                        "li",
                        {
                          className: "font-library__fonts-list-item",
                          children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                            font_card_default,
                            {
                              font: font2,
                              navigatorPath: "/fontFamily",
                              variantsText: getFontCardVariantsText(
                                font2
                              ),
                              onClick: () => {
                                setNotice(null);
                                handleSetLibraryFontSelected(
                                  font2
                                );
                              }
                            }
                          )
                        },
                        font2.slug
                      ))
                    }
                  )
                ] })
              ] }) }),
              /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_components53.Navigator.Screen, { path: "/fontFamily", children: [
                libraryFontSelected && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                  ConfirmDeleteDialog,
                  {
                    font: libraryFontSelected,
                    isOpen: isConfirmDeleteOpen,
                    setIsOpen: setIsConfirmDeleteOpen,
                    setNotice,
                    uninstallFontFamily,
                    handleSetLibraryFontSelected
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_components53.Flex, { justify: "flex-start", children: [
                  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                    import_components53.Navigator.BackButton,
                    {
                      icon: (0, import_i18n73.isRTL)() ? chevron_right_default : chevron_left_default,
                      size: "small",
                      onClick: () => {
                        handleSetLibraryFontSelected(
                          void 0
                        );
                        setNotice(null);
                      },
                      label: (0, import_i18n73.__)("Back")
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                    import_components53.__experimentalHeading,
                    {
                      level: 2,
                      size: 13,
                      className: "global-styles-ui-header",
                      children: libraryFontSelected?.name
                    }
                  )
                ] }),
                notice && /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_jsx_runtime139.Fragment, { children: [
                  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components53.__experimentalSpacer, { margin: 1 }),
                  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                    import_components53.Notice,
                    {
                      status: notice.type,
                      onRemove: () => setNotice(null),
                      children: notice.message
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components53.__experimentalSpacer, { margin: 1 })
                ] }),
                /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components53.__experimentalSpacer, { margin: 4 }),
                /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components53.__experimentalText, { children: (0, import_i18n73.__)(
                  "Choose font variants. Keep in mind that too many variants could make your site slower."
                ) }),
                /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components53.__experimentalSpacer, { margin: 4 }),
                /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_components53.__experimentalVStack, { spacing: 0, children: [
                  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                    import_components53.CheckboxControl,
                    {
                      className: "font-library__select-all",
                      label: (0, import_i18n73.__)("Select all"),
                      checked: isSelectAllChecked,
                      onChange: toggleSelectAll,
                      indeterminate: isIndeterminate
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components53.__experimentalSpacer, { margin: 8 }),
                  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                    "ul",
                    {
                      role: "list",
                      className: "font-library__fonts-list",
                      children: libraryFontSelected && getFontFacesToDisplay(
                        libraryFontSelected
                      ).map((face, i3) => /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                        "li",
                        {
                          className: "font-library__fonts-list-item",
                          children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
                            library_font_variant_default,
                            {
                              font: libraryFontSelected,
                              face
                            },
                            `face${i3}`
                          )
                        },
                        `face${i3}`
                      ))
                    }
                  )
                ] })
              ] })
            ]
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_components53.__experimentalHStack, { justify: "flex-end", className: "font-library__footer", children: [
          isInstalling && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components53.ProgressBar, {}),
          shouldDisplayDeleteButton && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
            import_components53.Button,
            {
              __next40pxDefaultSize: true,
              isDestructive: true,
              variant: "tertiary",
              onClick: handleUninstallClick,
              children: (0, import_i18n73.__)("Delete")
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
            import_components53.Button,
            {
              __next40pxDefaultSize: true,
              variant: "primary",
              onClick: handleUpdate,
              disabled: !fontFamiliesHasChanges,
              accessibleWhenDisabled: true,
              children: (0, import_i18n73.__)("Update")
            }
          )
        ] })
      ] })
    ] });
  }
  function ConfirmDeleteDialog({
    font: font2,
    isOpen,
    setIsOpen,
    setNotice,
    uninstallFontFamily,
    handleSetLibraryFontSelected
  }) {
    const navigator = (0, import_components53.useNavigator)();
    const handleConfirmUninstall = async () => {
      setNotice(null);
      setIsOpen(false);
      try {
        await uninstallFontFamily(font2);
        navigator.goBack();
        handleSetLibraryFontSelected(void 0);
        setNotice({
          type: "success",
          message: (0, import_i18n73.__)("Font family uninstalled successfully.")
        });
      } catch (error) {
        setNotice({
          type: "error",
          message: (0, import_i18n73.__)("There was an error uninstalling the font family.") + error.message
        });
      }
    };
    const handleCancelUninstall = () => {
      setIsOpen(false);
    };
    return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
      import_components53.__experimentalConfirmDialog,
      {
        isOpen,
        cancelButtonText: (0, import_i18n73.__)("Cancel"),
        confirmButtonText: (0, import_i18n73.__)("Delete"),
        onCancel: handleCancelUninstall,
        onConfirm: handleConfirmUninstall,
        size: "medium",
        children: font2 && (0, import_i18n73.sprintf)(
          /* translators: %s: Name of the font. */
          (0, import_i18n73.__)(
            'Are you sure you want to delete "%s" font and all its variants and assets?'
          ),
          font2.name
        )
      }
    );
  }
  var installed_fonts_default = InstalledFonts;

  // packages/global-styles-ui/build-module/font-library/font-collection.mjs
  var import_element52 = __toESM(require_element(), 1);
  var import_components56 = __toESM(require_components(), 1);
  var import_compose11 = __toESM(require_compose(), 1);
  var import_i18n75 = __toESM(require_i18n(), 1);
  var import_core_data37 = __toESM(require_core_data(), 1);

  // packages/global-styles-ui/build-module/font-library/utils/filter-fonts.mjs
  function filterFonts(fonts, filters) {
    const { category, search } = filters;
    let filteredFonts = fonts || [];
    if (category && category !== "all") {
      filteredFonts = filteredFonts.filter(
        (font2) => font2.categories && font2.categories.indexOf(category) !== -1
      );
    }
    if (search) {
      filteredFonts = filteredFonts.filter(
        (font2) => font2.font_family_settings && font2.font_family_settings.name.toLowerCase().includes(search.toLowerCase())
      );
    }
    return filteredFonts;
  }

  // packages/global-styles-ui/build-module/font-library/utils/fonts-outline.mjs
  function getFontsOutline(fonts) {
    return fonts.reduce(
      (acc, font2) => ({
        ...acc,
        [font2.slug]: (font2?.fontFace || []).reduce(
          (faces, face) => ({
            ...faces,
            [`${face.fontStyle}-${face.fontWeight}`]: true
          }),
          {}
        )
      }),
      {}
    );
  }
  function isFontFontFaceInOutline(slug, face, outline) {
    if (!face) {
      return !!outline[slug];
    }
    return !!outline[slug]?.[`${face.fontStyle}-${face.fontWeight}`];
  }

  // packages/global-styles-ui/build-module/font-library/google-fonts-confirm-dialog.mjs
  var import_i18n74 = __toESM(require_i18n(), 1);
  var import_components54 = __toESM(require_components(), 1);
  var import_jsx_runtime140 = __toESM(require_jsx_runtime(), 1);
  function GoogleFontsConfirmDialog() {
    const handleConfirm = () => {
      window.localStorage.setItem(
        "wp-font-library-google-fonts-permission",
        "true"
      );
      window.dispatchEvent(new Event("storage"));
    };
    return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "font-library__google-fonts-confirm", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components54.Card, { children: /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_components54.CardBody, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components54.__experimentalHeading, { level: 2, children: (0, import_i18n74.__)("Connect to Google Fonts") }),
      /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components54.__experimentalSpacer, { margin: 6 }),
      /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components54.__experimentalText, { as: "p", children: (0, import_i18n74.__)(
        "To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts."
      ) }),
      /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components54.__experimentalSpacer, { margin: 3 }),
      /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components54.__experimentalText, { as: "p", children: (0, import_i18n74.__)(
        "You can alternatively upload files directly on the Upload tab."
      ) }),
      /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components54.__experimentalSpacer, { margin: 6 }),
      /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
        import_components54.Button,
        {
          __next40pxDefaultSize: true,
          variant: "primary",
          onClick: handleConfirm,
          children: (0, import_i18n74.__)("Allow access to Google Fonts")
        }
      )
    ] }) }) });
  }
  var google_fonts_confirm_dialog_default = GoogleFontsConfirmDialog;

  // packages/global-styles-ui/build-module/font-library/collection-font-variant.mjs
  var import_element51 = __toESM(require_element(), 1);
  var import_components55 = __toESM(require_components(), 1);
  var import_jsx_runtime141 = __toESM(require_jsx_runtime(), 1);
  function CollectionFontVariant({
    face,
    font: font2,
    handleToggleVariant,
    selected
  }) {
    const handleToggleActivation = () => {
      if (font2?.fontFace) {
        handleToggleVariant(font2, face);
        return;
      }
      handleToggleVariant(font2);
    };
    const displayName = font2.name + " " + getFontFaceVariantName(face);
    const checkboxId = (0, import_element51.useId)();
    return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("div", { className: "font-library__font-card", children: /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(import_components55.Flex, { justify: "flex-start", align: "center", gap: "1rem", children: [
      /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
        import_components55.CheckboxControl,
        {
          checked: selected,
          onChange: handleToggleActivation,
          id: checkboxId
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("label", { htmlFor: checkboxId, children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
        font_demo_default,
        {
          font: face,
          text: displayName,
          onClick: handleToggleActivation
        }
      ) })
    ] }) });
  }
  var collection_font_variant_default = CollectionFontVariant;

  // packages/global-styles-ui/build-module/font-library/font-collection.mjs
  var import_jsx_runtime142 = __toESM(require_jsx_runtime(), 1);
  var DEFAULT_CATEGORY = {
    slug: "all",
    name: (0, import_i18n75._x)("All", "font categories")
  };
  var LOCAL_STORAGE_ITEM = "wp-font-library-google-fonts-permission";
  var MIN_WINDOW_HEIGHT = 500;
  function FontCollection({ slug }) {
    const requiresPermission = slug === "google-fonts";
    const getGoogleFontsPermissionFromStorage = () => {
      return window.localStorage.getItem(LOCAL_STORAGE_ITEM) === "true";
    };
    const [selectedFont, setSelectedFont] = (0, import_element52.useState)(
      null
    );
    const [notice, setNotice] = (0, import_element52.useState)(null);
    const [fontsToInstall, setFontsToInstall] = (0, import_element52.useState)(
      []
    );
    const [page, setPage] = (0, import_element52.useState)(1);
    const [filters, setFilters] = (0, import_element52.useState)({});
    const [renderConfirmDialog, setRenderConfirmDialog] = (0, import_element52.useState)(
      requiresPermission && !getGoogleFontsPermissionFromStorage()
    );
    const { installFonts, isInstalling } = (0, import_element52.useContext)(FontLibraryContext);
    const { record: selectedCollection, isResolving: isLoading } = (0, import_core_data37.useEntityRecord)("root", "fontCollection", slug);
    (0, import_element52.useEffect)(() => {
      const handleStorage = () => {
        setRenderConfirmDialog(
          requiresPermission && !getGoogleFontsPermissionFromStorage()
        );
      };
      handleStorage();
      window.addEventListener("storage", handleStorage);
      return () => window.removeEventListener("storage", handleStorage);
    }, [slug, requiresPermission]);
    const revokeAccess = () => {
      window.localStorage.setItem(LOCAL_STORAGE_ITEM, "false");
      window.dispatchEvent(new Event("storage"));
    };
    (0, import_element52.useEffect)(() => {
      setSelectedFont(null);
    }, [slug]);
    (0, import_element52.useEffect)(() => {
      setFontsToInstall([]);
    }, [selectedFont]);
    const collectionFonts = (0, import_element52.useMemo)(
      () => selectedCollection?.font_families ?? [],
      [selectedCollection]
    );
    const collectionCategories = selectedCollection?.categories ?? [];
    const categories = [DEFAULT_CATEGORY, ...collectionCategories];
    const fonts = (0, import_element52.useMemo)(
      () => filterFonts(collectionFonts, filters),
      [collectionFonts, filters]
    );
    const windowHeight = Math.max(window.innerHeight, MIN_WINDOW_HEIGHT);
    const pageSize = Math.floor((windowHeight - 417) / 61);
    const totalPages = Math.ceil(fonts.length / pageSize);
    const itemsStart = (page - 1) * pageSize;
    const itemsLimit = page * pageSize;
    const items = fonts.slice(itemsStart, itemsLimit);
    const handleCategoryFilter = (category) => {
      setFilters({ ...filters, category });
      setPage(1);
    };
    const handleUpdateSearchInput = (value) => {
      setFilters({ ...filters, search: value });
      setPage(1);
    };
    const debouncedUpdateSearchInput = (0, import_compose11.debounce)(handleUpdateSearchInput, 300);
    const handleToggleVariant = (font2, face) => {
      const newFontsToInstall = toggleFont(font2, face, fontsToInstall);
      setFontsToInstall(newFontsToInstall);
    };
    const fontToInstallOutline = getFontsOutline(fontsToInstall);
    const resetFontsToInstall = () => {
      setFontsToInstall([]);
    };
    const selectFontCount = fontsToInstall.length > 0 ? fontsToInstall[0]?.fontFace?.length ?? 0 : 0;
    const isIndeterminate = selectFontCount > 0 && selectFontCount !== selectedFont?.fontFace?.length;
    const isSelectAllChecked = selectFontCount === selectedFont?.fontFace?.length;
    const toggleSelectAll = () => {
      const newFonts = [];
      if (!isSelectAllChecked && selectedFont) {
        newFonts.push(selectedFont);
      }
      setFontsToInstall(newFonts);
    };
    const handleInstall = async () => {
      setNotice(null);
      const fontFamily = fontsToInstall[0];
      try {
        if (fontFamily?.fontFace) {
          await Promise.all(
            fontFamily.fontFace.map(async (fontFace) => {
              if (fontFace.src) {
                fontFace.file = await downloadFontFaceAssets(
                  fontFace.src
                );
              }
            })
          );
        }
      } catch (error) {
        setNotice({
          type: "error",
          message: (0, import_i18n75.__)(
            "Error installing the fonts, could not be downloaded."
          )
        });
        return;
      }
      try {
        await installFonts([fontFamily]);
        setNotice({
          type: "success",
          message: (0, import_i18n75.__)("Fonts were installed successfully.")
        });
      } catch (error) {
        setNotice({
          type: "error",
          message: error.message
        });
      }
      resetFontsToInstall();
    };
    const getSortedFontFaces = (fontFamily) => {
      if (!fontFamily) {
        return [];
      }
      if (!fontFamily.fontFace || !fontFamily.fontFace.length) {
        return [
          {
            fontFamily: fontFamily.fontFamily,
            fontStyle: "normal",
            fontWeight: "400"
          }
        ];
      }
      return sortFontFaces(fontFamily.fontFace);
    };
    if (renderConfirmDialog) {
      return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(google_fonts_confirm_dialog_default, {});
    }
    const ActionsComponent = () => {
      if (slug !== "google-fonts" || renderConfirmDialog || selectedFont) {
        return null;
      }
      return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
        import_components56.DropdownMenu,
        {
          icon: more_vertical_default,
          label: (0, import_i18n75.__)("Actions"),
          popoverProps: {
            position: "bottom left"
          },
          controls: [
            {
              title: (0, import_i18n75.__)("Revoke access to Google Fonts"),
              onClick: revokeAccess
            }
          ]
        }
      );
    };
    return /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)("div", { className: "font-library__tabpanel-layout", children: [
      isLoading && /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: "font-library__loading", children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.ProgressBar, {}) }),
      !isLoading && selectedCollection && /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_jsx_runtime142.Fragment, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(
          import_components56.Navigator,
          {
            initialPath: "/",
            className: "font-library__tabpanel-layout",
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_components56.Navigator.Screen, { path: "/", children: [
                /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_components56.__experimentalHStack, { justify: "space-between", children: [
                  /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_components56.__experimentalVStack, { children: [
                    /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.__experimentalHeading, { level: 2, size: 13, children: selectedCollection.name }),
                    /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.__experimentalText, { children: selectedCollection.description })
                  ] }),
                  /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(ActionsComponent, {})
                ] }),
                /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.__experimentalSpacer, { margin: 4 }),
                /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_components56.__experimentalHStack, { spacing: 4, justify: "space-between", children: [
                  /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                    import_components56.SearchControl,
                    {
                      value: filters.search,
                      placeholder: (0, import_i18n75.__)("Font name\u2026"),
                      label: (0, import_i18n75.__)("Search"),
                      onChange: debouncedUpdateSearchInput,
                      hideLabelFromVision: false
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                    import_components56.SelectControl,
                    {
                      __next40pxDefaultSize: true,
                      label: (0, import_i18n75.__)("Category"),
                      value: filters.category,
                      onChange: handleCategoryFilter,
                      children: categories && categories.map((category) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                        "option",
                        {
                          value: category.slug,
                          children: category.name
                        },
                        category.slug
                      ))
                    }
                  )
                ] }),
                /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.__experimentalSpacer, { margin: 4 }),
                !!selectedCollection?.font_families?.length && !fonts.length && /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.__experimentalText, { children: (0, import_i18n75.__)(
                  "No fonts found. Try with a different search term."
                ) }),
                /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: "font-library__fonts-grid__main", children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                  "ul",
                  {
                    role: "list",
                    className: "font-library__fonts-list",
                    children: items.map((font2) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                      "li",
                      {
                        className: "font-library__fonts-list-item",
                        children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                          font_card_default,
                          {
                            font: font2.font_family_settings,
                            navigatorPath: "/fontFamily",
                            onClick: () => {
                              setSelectedFont(
                                font2.font_family_settings
                              );
                            }
                          }
                        )
                      },
                      font2.font_family_settings.slug
                    ))
                  }
                ) })
              ] }),
              /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_components56.Navigator.Screen, { path: "/fontFamily", children: [
                /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_components56.Flex, { justify: "flex-start", children: [
                  /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                    import_components56.Navigator.BackButton,
                    {
                      icon: (0, import_i18n75.isRTL)() ? chevron_right_default : chevron_left_default,
                      size: "small",
                      onClick: () => {
                        setSelectedFont(null);
                        setNotice(null);
                      },
                      label: (0, import_i18n75.__)("Back")
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                    import_components56.__experimentalHeading,
                    {
                      level: 2,
                      size: 13,
                      className: "global-styles-ui-header",
                      children: selectedFont?.name
                    }
                  )
                ] }),
                notice && /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_jsx_runtime142.Fragment, { children: [
                  /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.__experimentalSpacer, { margin: 1 }),
                  /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                    import_components56.Notice,
                    {
                      status: notice.type,
                      onRemove: () => setNotice(null),
                      children: notice.message
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.__experimentalSpacer, { margin: 1 })
                ] }),
                /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.__experimentalSpacer, { margin: 4 }),
                /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.__experimentalText, { children: (0, import_i18n75.__)("Select font variants to install.") }),
                /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.__experimentalSpacer, { margin: 4 }),
                /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                  import_components56.CheckboxControl,
                  {
                    className: "font-library__select-all",
                    label: (0, import_i18n75.__)("Select all"),
                    checked: isSelectAllChecked,
                    onChange: toggleSelectAll,
                    indeterminate: isIndeterminate
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.__experimentalVStack, { spacing: 0, children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                  "ul",
                  {
                    role: "list",
                    className: "font-library__fonts-list",
                    children: selectedFont && getSortedFontFaces(selectedFont).map(
                      (face, i3) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                        "li",
                        {
                          className: "font-library__fonts-list-item",
                          children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                            collection_font_variant_default,
                            {
                              font: selectedFont,
                              face,
                              handleToggleVariant,
                              selected: isFontFontFaceInOutline(
                                selectedFont.slug,
                                selectedFont.fontFace ? face : null,
                                // If the font has no fontFace, we want to check if the font is in the outline
                                fontToInstallOutline
                              )
                            }
                          )
                        },
                        `face${i3}`
                      )
                    )
                  }
                ) }),
                /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components56.__experimentalSpacer, { margin: 16 })
              ] })
            ]
          }
        ),
        selectedFont && /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
          import_components56.Flex,
          {
            justify: "flex-end",
            className: "font-library__footer",
            children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
              import_components56.Button,
              {
                __next40pxDefaultSize: true,
                variant: "primary",
                onClick: handleInstall,
                isBusy: isInstalling,
                disabled: fontsToInstall.length === 0 || isInstalling,
                accessibleWhenDisabled: true,
                children: (0, import_i18n75.__)("Install")
              }
            )
          }
        ),
        !selectedFont && /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(
          import_components56.__experimentalHStack,
          {
            expanded: false,
            className: "font-library__footer",
            justify: "end",
            spacing: 6,
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                import_components56.__experimentalHStack,
                {
                  justify: "flex-start",
                  expanded: false,
                  spacing: 1,
                  className: "font-library__page-selection",
                  children: (0, import_element52.createInterpolateElement)(
                    (0, import_i18n75.sprintf)(
                      // translators: 1: Current page number, 2: Total number of pages.
                      (0, import_i18n75._x)(
                        "<div>Page</div>%1$s<div>of %2$d</div>",
                        "paging"
                      ),
                      "<CurrentPage />",
                      totalPages
                    ),
                    {
                      div: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { "aria-hidden": true }),
                      CurrentPage: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                        import_components56.SelectControl,
                        {
                          "aria-label": (0, import_i18n75.__)(
                            "Current page"
                          ),
                          value: page.toString(),
                          options: [
                            ...Array(totalPages)
                          ].map((e3, i3) => {
                            return {
                              label: (i3 + 1).toString(),
                              value: (i3 + 1).toString()
                            };
                          }),
                          onChange: (newPage) => setPage(
                            parseInt(newPage)
                          ),
                          size: "small",
                          variant: "minimal"
                        }
                      )
                    }
                  )
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_components56.__experimentalHStack, { expanded: false, spacing: 1, children: [
                /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                  import_components56.Button,
                  {
                    onClick: () => setPage(page - 1),
                    disabled: page === 1,
                    accessibleWhenDisabled: true,
                    label: (0, import_i18n75.__)("Previous page"),
                    icon: (0, import_i18n75.isRTL)() ? next_default : previous_default,
                    showTooltip: true,
                    size: "compact",
                    tooltipPosition: "top"
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                  import_components56.Button,
                  {
                    onClick: () => setPage(page + 1),
                    disabled: page === totalPages,
                    accessibleWhenDisabled: true,
                    label: (0, import_i18n75.__)("Next page"),
                    icon: (0, import_i18n75.isRTL)() ? previous_default : next_default,
                    showTooltip: true,
                    size: "compact",
                    tooltipPosition: "top"
                  }
                )
              ] })
            ]
          }
        )
      ] })
    ] });
  }
  var font_collection_default = FontCollection;

  // packages/global-styles-ui/build-module/font-library/upload-fonts.mjs
  var import_i18n76 = __toESM(require_i18n(), 1);
  var import_components58 = __toESM(require_components(), 1);
  var import_element53 = __toESM(require_element(), 1);

  // packages/global-styles-ui/build-module/font-library/lib/unbrotli.mjs
  var __require2 = /* @__PURE__ */ ((x2) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x2, {
    get: (a3, b3) => (typeof __require !== "undefined" ? __require : a3)[b3]
  }) : x2)(function(x2) {
    if (typeof __require !== "undefined") return __require.apply(this, arguments);
    throw Error('Dynamic require of "' + x2 + '" is not supported');
  });
  var unbrotli_default = (function() {
    var define2, module, exports;
    return (/* @__PURE__ */ (function() {
      function r4(e3, n3, t4) {
        function o4(i22, f3) {
          if (!n3[i22]) {
            if (!e3[i22]) {
              var c2 = "function" == typeof __require2 && __require2;
              if (!f3 && c2) return c2(i22, true);
              if (u3) return u3(i22, true);
              var a3 = new Error("Cannot find module '" + i22 + "'");
              throw a3.code = "MODULE_NOT_FOUND", a3;
            }
            var p4 = n3[i22] = { exports: {} };
            e3[i22][0].call(
              p4.exports,
              function(r22) {
                var n22 = e3[i22][1][r22];
                return o4(n22 || r22);
              },
              p4,
              p4.exports,
              r4,
              e3,
              n3,
              t4
            );
          }
          return n3[i22].exports;
        }
        for (var u3 = "function" == typeof __require2 && __require2, i3 = 0; i3 < t4.length; i3++)
          o4(t4[i3]);
        return o4;
      }
      return r4;
    })())(
      {
        1: [
          function(require2, module2, exports2) {
            var BROTLI_READ_SIZE = 4096;
            var BROTLI_IBUF_SIZE = 2 * BROTLI_READ_SIZE + 32;
            var BROTLI_IBUF_MASK = 2 * BROTLI_READ_SIZE - 1;
            var kBitMask = new Uint32Array([
              0,
              1,
              3,
              7,
              15,
              31,
              63,
              127,
              255,
              511,
              1023,
              2047,
              4095,
              8191,
              16383,
              32767,
              65535,
              131071,
              262143,
              524287,
              1048575,
              2097151,
              4194303,
              8388607,
              16777215
            ]);
            function BrotliBitReader(input) {
              this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE);
              this.input_ = input;
              this.reset();
            }
            BrotliBitReader.READ_SIZE = BROTLI_READ_SIZE;
            BrotliBitReader.IBUF_MASK = BROTLI_IBUF_MASK;
            BrotliBitReader.prototype.reset = function() {
              this.buf_ptr_ = 0;
              this.val_ = 0;
              this.pos_ = 0;
              this.bit_pos_ = 0;
              this.bit_end_pos_ = 0;
              this.eos_ = 0;
              this.readMoreInput();
              for (var i3 = 0; i3 < 4; i3++) {
                this.val_ |= this.buf_[this.pos_] << 8 * i3;
                ++this.pos_;
              }
              return this.bit_end_pos_ > 0;
            };
            BrotliBitReader.prototype.readMoreInput = function() {
              if (this.bit_end_pos_ > 256) {
                return;
              } else if (this.eos_) {
                if (this.bit_pos_ > this.bit_end_pos_)
                  throw new Error(
                    "Unexpected end of input " + this.bit_pos_ + " " + this.bit_end_pos_
                  );
              } else {
                var dst = this.buf_ptr_;
                var bytes_read = this.input_.read(
                  this.buf_,
                  dst,
                  BROTLI_READ_SIZE
                );
                if (bytes_read < 0) {
                  throw new Error("Unexpected end of input");
                }
                if (bytes_read < BROTLI_READ_SIZE) {
                  this.eos_ = 1;
                  for (var p4 = 0; p4 < 32; p4++)
                    this.buf_[dst + bytes_read + p4] = 0;
                }
                if (dst === 0) {
                  for (var p4 = 0; p4 < 32; p4++)
                    this.buf_[(BROTLI_READ_SIZE << 1) + p4] = this.buf_[p4];
                  this.buf_ptr_ = BROTLI_READ_SIZE;
                } else {
                  this.buf_ptr_ = 0;
                }
                this.bit_end_pos_ += bytes_read << 3;
              }
            };
            BrotliBitReader.prototype.fillBitWindow = function() {
              while (this.bit_pos_ >= 8) {
                this.val_ >>>= 8;
                this.val_ |= this.buf_[this.pos_ & BROTLI_IBUF_MASK] << 24;
                ++this.pos_;
                this.bit_pos_ = this.bit_pos_ - 8 >>> 0;
                this.bit_end_pos_ = this.bit_end_pos_ - 8 >>> 0;
              }
            };
            BrotliBitReader.prototype.readBits = function(n_bits) {
              if (32 - this.bit_pos_ < n_bits) {
                this.fillBitWindow();
              }
              var val = this.val_ >>> this.bit_pos_ & kBitMask[n_bits];
              this.bit_pos_ += n_bits;
              return val;
            };
            module2.exports = BrotliBitReader;
          },
          {}
        ],
        2: [
          function(require2, module2, exports2) {
            var CONTEXT_LSB6 = 0;
            var CONTEXT_MSB6 = 1;
            var CONTEXT_UTF8 = 2;
            var CONTEXT_SIGNED = 3;
            exports2.lookup = new Uint8Array([
              /* CONTEXT_UTF8, last byte. */
              /* ASCII range. */
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              4,
              4,
              0,
              0,
              4,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              8,
              12,
              16,
              12,
              12,
              20,
              12,
              16,
              24,
              28,
              12,
              12,
              32,
              12,
              36,
              12,
              44,
              44,
              44,
              44,
              44,
              44,
              44,
              44,
              44,
              44,
              32,
              32,
              24,
              40,
              28,
              12,
              12,
              48,
              52,
              52,
              52,
              48,
              52,
              52,
              52,
              48,
              52,
              52,
              52,
              52,
              52,
              48,
              52,
              52,
              52,
              52,
              52,
              48,
              52,
              52,
              52,
              52,
              52,
              24,
              12,
              28,
              12,
              12,
              12,
              56,
              60,
              60,
              60,
              56,
              60,
              60,
              60,
              56,
              60,
              60,
              60,
              60,
              60,
              56,
              60,
              60,
              60,
              60,
              60,
              56,
              60,
              60,
              60,
              60,
              60,
              24,
              12,
              28,
              12,
              0,
              /* UTF8 continuation byte range. */
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              0,
              1,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              2,
              3,
              /* ASCII range. */
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              1,
              1,
              1,
              1,
              1,
              1,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              1,
              1,
              1,
              1,
              0,
              /* UTF8 continuation byte range. */
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              0,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              2,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              3,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              4,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              5,
              6,
              6,
              6,
              6,
              6,
              6,
              6,
              6,
              6,
              6,
              6,
              6,
              6,
              6,
              6,
              7,
              /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */
              0,
              8,
              8,
              8,
              8,
              8,
              8,
              8,
              8,
              8,
              8,
              8,
              8,
              8,
              8,
              8,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              24,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              32,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              40,
              48,
              48,
              48,
              48,
              48,
              48,
              48,
              48,
              48,
              48,
              48,
              48,
              48,
              48,
              48,
              56,
              /* CONTEXT_LSB6, last byte. */
              0,
              1,
              2,
              3,
              4,
              5,
              6,
              7,
              8,
              9,
              10,
              11,
              12,
              13,
              14,
              15,
              16,
              17,
              18,
              19,
              20,
              21,
              22,
              23,
              24,
              25,
              26,
              27,
              28,
              29,
              30,
              31,
              32,
              33,
              34,
              35,
              36,
              37,
              38,
              39,
              40,
              41,
              42,
              43,
              44,
              45,
              46,
              47,
              48,
              49,
              50,
              51,
              52,
              53,
              54,
              55,
              56,
              57,
              58,
              59,
              60,
              61,
              62,
              63,
              0,
              1,
              2,
              3,
              4,
              5,
              6,
              7,
              8,
              9,
              10,
              11,
              12,
              13,
              14,
              15,
              16,
              17,
              18,
              19,
              20,
              21,
              22,
              23,
              24,
              25,
              26,
              27,
              28,
              29,
              30,
              31,
              32,
              33,
              34,
              35,
              36,
              37,
              38,
              39,
              40,
              41,
              42,
              43,
              44,
              45,
              46,
              47,
              48,
              49,
              50,
              51,
              52,
              53,
              54,
              55,
              56,
              57,
              58,
              59,
              60,
              61,
              62,
              63,
              0,
              1,
              2,
              3,
              4,
              5,
              6,
              7,
              8,
              9,
              10,
              11,
              12,
              13,
              14,
              15,
              16,
              17,
              18,
              19,
              20,
              21,
              22,
              23,
              24,
              25,
              26,
              27,
              28,
              29,
              30,
              31,
              32,
              33,
              34,
              35,
              36,
              37,
              38,
              39,
              40,
              41,
              42,
              43,
              44,
              45,
              46,
              47,
              48,
              49,
              50,
              51,
              52,
              53,
              54,
              55,
              56,
              57,
              58,
              59,
              60,
              61,
              62,
              63,
              0,
              1,
              2,
              3,
              4,
              5,
              6,
              7,
              8,
              9,
              10,
              11,
              12,
              13,
              14,
              15,
              16,
              17,
              18,
              19,
              20,
              21,
              22,
              23,
              24,
              25,
              26,
              27,
              28,
              29,
              30,
              31,
              32,
              33,
              34,
              35,
              36,
              37,
              38,
              39,
              40,
              41,
              42,
              43,
              44,
              45,
              46,
              47,
              48,
              49,
              50,
              51,
              52,
              53,
              54,
              55,
              56,
              57,
              58,
              59,
              60,
              61,
              62,
              63,
              /* CONTEXT_MSB6, last byte. */
              0,
              0,
              0,
              0,
              1,
              1,
              1,
              1,
              2,
              2,
              2,
              2,
              3,
              3,
              3,
              3,
              4,
              4,
              4,
              4,
              5,
              5,
              5,
              5,
              6,
              6,
              6,
              6,
              7,
              7,
              7,
              7,
              8,
              8,
              8,
              8,
              9,
              9,
              9,
              9,
              10,
              10,
              10,
              10,
              11,
              11,
              11,
              11,
              12,
              12,
              12,
              12,
              13,
              13,
              13,
              13,
              14,
              14,
              14,
              14,
              15,
              15,
              15,
              15,
              16,
              16,
              16,
              16,
              17,
              17,
              17,
              17,
              18,
              18,
              18,
              18,
              19,
              19,
              19,
              19,
              20,
              20,
              20,
              20,
              21,
              21,
              21,
              21,
              22,
              22,
              22,
              22,
              23,
              23,
              23,
              23,
              24,
              24,
              24,
              24,
              25,
              25,
              25,
              25,
              26,
              26,
              26,
              26,
              27,
              27,
              27,
              27,
              28,
              28,
              28,
              28,
              29,
              29,
              29,
              29,
              30,
              30,
              30,
              30,
              31,
              31,
              31,
              31,
              32,
              32,
              32,
              32,
              33,
              33,
              33,
              33,
              34,
              34,
              34,
              34,
              35,
              35,
              35,
              35,
              36,
              36,
              36,
              36,
              37,
              37,
              37,
              37,
              38,
              38,
              38,
              38,
              39,
              39,
              39,
              39,
              40,
              40,
              40,
              40,
              41,
              41,
              41,
              41,
              42,
              42,
              42,
              42,
              43,
              43,
              43,
              43,
              44,
              44,
              44,
              44,
              45,
              45,
              45,
              45,
              46,
              46,
              46,
              46,
              47,
              47,
              47,
              47,
              48,
              48,
              48,
              48,
              49,
              49,
              49,
              49,
              50,
              50,
              50,
              50,
              51,
              51,
              51,
              51,
              52,
              52,
              52,
              52,
              53,
              53,
              53,
              53,
              54,
              54,
              54,
              54,
              55,
              55,
              55,
              55,
              56,
              56,
              56,
              56,
              57,
              57,
              57,
              57,
              58,
              58,
              58,
              58,
              59,
              59,
              59,
              59,
              60,
              60,
              60,
              60,
              61,
              61,
              61,
              61,
              62,
              62,
              62,
              62,
              63,
              63,
              63,
              63,
              /* CONTEXT_{M,L}SB6, second last byte, */
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0
            ]);
            exports2.lookupOffsets = new Uint16Array([
              /* CONTEXT_LSB6 */
              1024,
              1536,
              1280,
              1536,
              0,
              256,
              768,
              512
            ]);
          },
          {}
        ],
        3: [
          function(require2, module2, exports2) {
            var BrotliInput = require2("./streams").BrotliInput;
            var BrotliOutput = require2("./streams").BrotliOutput;
            var BrotliBitReader = require2("./bit_reader");
            var BrotliDictionary = require2("./dictionary");
            var HuffmanCode = require2("./huffman").HuffmanCode;
            var BrotliBuildHuffmanTable = require2("./huffman").BrotliBuildHuffmanTable;
            var Context = require2("./context");
            var Prefix = require2("./prefix");
            var Transform = require2("./transform");
            var kDefaultCodeLength = 8;
            var kCodeLengthRepeatCode = 16;
            var kNumLiteralCodes = 256;
            var kNumInsertAndCopyCodes = 704;
            var kNumBlockLengthCodes = 26;
            var kLiteralContextBits = 6;
            var kDistanceContextBits = 2;
            var HUFFMAN_TABLE_BITS = 8;
            var HUFFMAN_TABLE_MASK = 255;
            var HUFFMAN_MAX_TABLE_SIZE = 1080;
            var CODE_LENGTH_CODES = 18;
            var kCodeLengthCodeOrder = new Uint8Array([
              1,
              2,
              3,
              4,
              0,
              5,
              17,
              6,
              16,
              7,
              8,
              9,
              10,
              11,
              12,
              13,
              14,
              15
            ]);
            var NUM_DISTANCE_SHORT_CODES = 16;
            var kDistanceShortCodeIndexOffset = new Uint8Array([
              3,
              2,
              1,
              0,
              3,
              3,
              3,
              3,
              3,
              3,
              2,
              2,
              2,
              2,
              2,
              2
            ]);
            var kDistanceShortCodeValueOffset = new Int8Array([
              0,
              0,
              0,
              0,
              -1,
              1,
              -2,
              2,
              -3,
              3,
              -1,
              1,
              -2,
              2,
              -3,
              3
            ]);
            var kMaxHuffmanTableSize = new Uint16Array([
              256,
              402,
              436,
              468,
              500,
              534,
              566,
              598,
              630,
              662,
              694,
              726,
              758,
              790,
              822,
              854,
              886,
              920,
              952,
              984,
              1016,
              1048,
              1080
            ]);
            function DecodeWindowBits(br) {
              var n3;
              if (br.readBits(1) === 0) {
                return 16;
              }
              n3 = br.readBits(3);
              if (n3 > 0) {
                return 17 + n3;
              }
              n3 = br.readBits(3);
              if (n3 > 0) {
                return 8 + n3;
              }
              return 17;
            }
            function DecodeVarLenUint8(br) {
              if (br.readBits(1)) {
                var nbits = br.readBits(3);
                if (nbits === 0) {
                  return 1;
                } else {
                  return br.readBits(nbits) + (1 << nbits);
                }
              }
              return 0;
            }
            function MetaBlockLength() {
              this.meta_block_length = 0;
              this.input_end = 0;
              this.is_uncompressed = 0;
              this.is_metadata = false;
            }
            function DecodeMetaBlockLength(br) {
              var out = new MetaBlockLength();
              var size_nibbles;
              var size_bytes;
              var i3;
              out.input_end = br.readBits(1);
              if (out.input_end && br.readBits(1)) {
                return out;
              }
              size_nibbles = br.readBits(2) + 4;
              if (size_nibbles === 7) {
                out.is_metadata = true;
                if (br.readBits(1) !== 0)
                  throw new Error("Invalid reserved bit");
                size_bytes = br.readBits(2);
                if (size_bytes === 0) return out;
                for (i3 = 0; i3 < size_bytes; i3++) {
                  var next_byte = br.readBits(8);
                  if (i3 + 1 === size_bytes && size_bytes > 1 && next_byte === 0)
                    throw new Error("Invalid size byte");
                  out.meta_block_length |= next_byte << i3 * 8;
                }
              } else {
                for (i3 = 0; i3 < size_nibbles; ++i3) {
                  var next_nibble = br.readBits(4);
                  if (i3 + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0)
                    throw new Error("Invalid size nibble");
                  out.meta_block_length |= next_nibble << i3 * 4;
                }
              }
              ++out.meta_block_length;
              if (!out.input_end && !out.is_metadata) {
                out.is_uncompressed = br.readBits(1);
              }
              return out;
            }
            function ReadSymbol(table, index2, br) {
              var start_index = index2;
              var nbits;
              br.fillBitWindow();
              index2 += br.val_ >>> br.bit_pos_ & HUFFMAN_TABLE_MASK;
              nbits = table[index2].bits - HUFFMAN_TABLE_BITS;
              if (nbits > 0) {
                br.bit_pos_ += HUFFMAN_TABLE_BITS;
                index2 += table[index2].value;
                index2 += br.val_ >>> br.bit_pos_ & (1 << nbits) - 1;
              }
              br.bit_pos_ += table[index2].bits;
              return table[index2].value;
            }
            function ReadHuffmanCodeLengths(code_length_code_lengths, num_symbols, code_lengths, br) {
              var symbol = 0;
              var prev_code_len = kDefaultCodeLength;
              var repeat = 0;
              var repeat_code_len = 0;
              var space = 32768;
              var table = [];
              for (var i3 = 0; i3 < 32; i3++)
                table.push(new HuffmanCode(0, 0));
              BrotliBuildHuffmanTable(
                table,
                0,
                5,
                code_length_code_lengths,
                CODE_LENGTH_CODES
              );
              while (symbol < num_symbols && space > 0) {
                var p4 = 0;
                var code_len;
                br.readMoreInput();
                br.fillBitWindow();
                p4 += br.val_ >>> br.bit_pos_ & 31;
                br.bit_pos_ += table[p4].bits;
                code_len = table[p4].value & 255;
                if (code_len < kCodeLengthRepeatCode) {
                  repeat = 0;
                  code_lengths[symbol++] = code_len;
                  if (code_len !== 0) {
                    prev_code_len = code_len;
                    space -= 32768 >> code_len;
                  }
                } else {
                  var extra_bits = code_len - 14;
                  var old_repeat;
                  var repeat_delta;
                  var new_len = 0;
                  if (code_len === kCodeLengthRepeatCode) {
                    new_len = prev_code_len;
                  }
                  if (repeat_code_len !== new_len) {
                    repeat = 0;
                    repeat_code_len = new_len;
                  }
                  old_repeat = repeat;
                  if (repeat > 0) {
                    repeat -= 2;
                    repeat <<= extra_bits;
                  }
                  repeat += br.readBits(extra_bits) + 3;
                  repeat_delta = repeat - old_repeat;
                  if (symbol + repeat_delta > num_symbols) {
                    throw new Error(
                      "[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols"
                    );
                  }
                  for (var x2 = 0; x2 < repeat_delta; x2++)
                    code_lengths[symbol + x2] = repeat_code_len;
                  symbol += repeat_delta;
                  if (repeat_code_len !== 0) {
                    space -= repeat_delta << 15 - repeat_code_len;
                  }
                }
              }
              if (space !== 0) {
                throw new Error(
                  "[ReadHuffmanCodeLengths] space = " + space
                );
              }
              for (; symbol < num_symbols; symbol++)
                code_lengths[symbol] = 0;
            }
            function ReadHuffmanCode(alphabet_size, tables, table, br) {
              var table_size = 0;
              var simple_code_or_skip;
              var code_lengths = new Uint8Array(alphabet_size);
              br.readMoreInput();
              simple_code_or_skip = br.readBits(2);
              if (simple_code_or_skip === 1) {
                var i3;
                var max_bits_counter = alphabet_size - 1;
                var max_bits = 0;
                var symbols = new Int32Array(4);
                var num_symbols = br.readBits(2) + 1;
                while (max_bits_counter) {
                  max_bits_counter >>= 1;
                  ++max_bits;
                }
                for (i3 = 0; i3 < num_symbols; ++i3) {
                  symbols[i3] = br.readBits(max_bits) % alphabet_size;
                  code_lengths[symbols[i3]] = 2;
                }
                code_lengths[symbols[0]] = 1;
                switch (num_symbols) {
                  case 1:
                    break;
                  case 3:
                    if (symbols[0] === symbols[1] || symbols[0] === symbols[2] || symbols[1] === symbols[2]) {
                      throw new Error(
                        "[ReadHuffmanCode] invalid symbols"
                      );
                    }
                    break;
                  case 2:
                    if (symbols[0] === symbols[1]) {
                      throw new Error(
                        "[ReadHuffmanCode] invalid symbols"
                      );
                    }
                    code_lengths[symbols[1]] = 1;
                    break;
                  case 4:
                    if (symbols[0] === symbols[1] || symbols[0] === symbols[2] || symbols[0] === symbols[3] || symbols[1] === symbols[2] || symbols[1] === symbols[3] || symbols[2] === symbols[3]) {
                      throw new Error(
                        "[ReadHuffmanCode] invalid symbols"
                      );
                    }
                    if (br.readBits(1)) {
                      code_lengths[symbols[2]] = 3;
                      code_lengths[symbols[3]] = 3;
                    } else {
                      code_lengths[symbols[0]] = 2;
                    }
                    break;
                }
              } else {
                var i3;
                var code_length_code_lengths = new Uint8Array(
                  CODE_LENGTH_CODES
                );
                var space = 32;
                var num_codes = 0;
                var huff = [
                  new HuffmanCode(2, 0),
                  new HuffmanCode(2, 4),
                  new HuffmanCode(2, 3),
                  new HuffmanCode(3, 2),
                  new HuffmanCode(2, 0),
                  new HuffmanCode(2, 4),
                  new HuffmanCode(2, 3),
                  new HuffmanCode(4, 1),
                  new HuffmanCode(2, 0),
                  new HuffmanCode(2, 4),
                  new HuffmanCode(2, 3),
                  new HuffmanCode(3, 2),
                  new HuffmanCode(2, 0),
                  new HuffmanCode(2, 4),
                  new HuffmanCode(2, 3),
                  new HuffmanCode(4, 5)
                ];
                for (i3 = simple_code_or_skip; i3 < CODE_LENGTH_CODES && space > 0; ++i3) {
                  var code_len_idx = kCodeLengthCodeOrder[i3];
                  var p4 = 0;
                  var v3;
                  br.fillBitWindow();
                  p4 += br.val_ >>> br.bit_pos_ & 15;
                  br.bit_pos_ += huff[p4].bits;
                  v3 = huff[p4].value;
                  code_length_code_lengths[code_len_idx] = v3;
                  if (v3 !== 0) {
                    space -= 32 >> v3;
                    ++num_codes;
                  }
                }
                if (!(num_codes === 1 || space === 0))
                  throw new Error(
                    "[ReadHuffmanCode] invalid num_codes or space"
                  );
                ReadHuffmanCodeLengths(
                  code_length_code_lengths,
                  alphabet_size,
                  code_lengths,
                  br
                );
              }
              table_size = BrotliBuildHuffmanTable(
                tables,
                table,
                HUFFMAN_TABLE_BITS,
                code_lengths,
                alphabet_size
              );
              if (table_size === 0) {
                throw new Error(
                  "[ReadHuffmanCode] BuildHuffmanTable failed: "
                );
              }
              return table_size;
            }
            function ReadBlockLength(table, index2, br) {
              var code;
              var nbits;
              code = ReadSymbol(table, index2, br);
              nbits = Prefix.kBlockLengthPrefixCode[code].nbits;
              return Prefix.kBlockLengthPrefixCode[code].offset + br.readBits(nbits);
            }
            function TranslateShortCodes(code, ringbuffer, index2) {
              var val;
              if (code < NUM_DISTANCE_SHORT_CODES) {
                index2 += kDistanceShortCodeIndexOffset[code];
                index2 &= 3;
                val = ringbuffer[index2] + kDistanceShortCodeValueOffset[code];
              } else {
                val = code - NUM_DISTANCE_SHORT_CODES + 1;
              }
              return val;
            }
            function MoveToFront(v3, index2) {
              var value = v3[index2];
              var i3 = index2;
              for (; i3; --i3) v3[i3] = v3[i3 - 1];
              v3[0] = value;
            }
            function InverseMoveToFrontTransform(v3, v_len) {
              var mtf = new Uint8Array(256);
              var i3;
              for (i3 = 0; i3 < 256; ++i3) {
                mtf[i3] = i3;
              }
              for (i3 = 0; i3 < v_len; ++i3) {
                var index2 = v3[i3];
                v3[i3] = mtf[index2];
                if (index2) MoveToFront(mtf, index2);
              }
            }
            function HuffmanTreeGroup(alphabet_size, num_htrees) {
              this.alphabet_size = alphabet_size;
              this.num_htrees = num_htrees;
              this.codes = new Array(
                num_htrees + num_htrees * kMaxHuffmanTableSize[alphabet_size + 31 >>> 5]
              );
              this.htrees = new Uint32Array(num_htrees);
            }
            HuffmanTreeGroup.prototype.decode = function(br) {
              var i3;
              var table_size;
              var next = 0;
              for (i3 = 0; i3 < this.num_htrees; ++i3) {
                this.htrees[i3] = next;
                table_size = ReadHuffmanCode(
                  this.alphabet_size,
                  this.codes,
                  next,
                  br
                );
                next += table_size;
              }
            };
            function DecodeContextMap(context_map_size, br) {
              var out = { num_htrees: null, context_map: null };
              var use_rle_for_zeros;
              var max_run_length_prefix = 0;
              var table;
              var i3;
              br.readMoreInput();
              var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1;
              var context_map = out.context_map = new Uint8Array(
                context_map_size
              );
              if (num_htrees <= 1) {
                return out;
              }
              use_rle_for_zeros = br.readBits(1);
              if (use_rle_for_zeros) {
                max_run_length_prefix = br.readBits(4) + 1;
              }
              table = [];
              for (i3 = 0; i3 < HUFFMAN_MAX_TABLE_SIZE; i3++) {
                table[i3] = new HuffmanCode(0, 0);
              }
              ReadHuffmanCode(
                num_htrees + max_run_length_prefix,
                table,
                0,
                br
              );
              for (i3 = 0; i3 < context_map_size; ) {
                var code;
                br.readMoreInput();
                code = ReadSymbol(table, 0, br);
                if (code === 0) {
                  context_map[i3] = 0;
                  ++i3;
                } else if (code <= max_run_length_prefix) {
                  var reps = 1 + (1 << code) + br.readBits(code);
                  while (--reps) {
                    if (i3 >= context_map_size) {
                      throw new Error(
                        "[DecodeContextMap] i >= context_map_size"
                      );
                    }
                    context_map[i3] = 0;
                    ++i3;
                  }
                } else {
                  context_map[i3] = code - max_run_length_prefix;
                  ++i3;
                }
              }
              if (br.readBits(1)) {
                InverseMoveToFrontTransform(
                  context_map,
                  context_map_size
                );
              }
              return out;
            }
            function DecodeBlockType(max_block_type, trees, tree_type, block_types, ringbuffers, indexes, br) {
              var ringbuffer = tree_type * 2;
              var index2 = tree_type;
              var type_code = ReadSymbol(
                trees,
                tree_type * HUFFMAN_MAX_TABLE_SIZE,
                br
              );
              var block_type;
              if (type_code === 0) {
                block_type = ringbuffers[ringbuffer + (indexes[index2] & 1)];
              } else if (type_code === 1) {
                block_type = ringbuffers[ringbuffer + (indexes[index2] - 1 & 1)] + 1;
              } else {
                block_type = type_code - 2;
              }
              if (block_type >= max_block_type) {
                block_type -= max_block_type;
              }
              block_types[tree_type] = block_type;
              ringbuffers[ringbuffer + (indexes[index2] & 1)] = block_type;
              ++indexes[index2];
            }
            function CopyUncompressedBlockToOutput(output, len, pos, ringbuffer, ringbuffer_mask, br) {
              var rb_size = ringbuffer_mask + 1;
              var rb_pos = pos & ringbuffer_mask;
              var br_pos = br.pos_ & BrotliBitReader.IBUF_MASK;
              var nbytes;
              if (len < 8 || br.bit_pos_ + (len << 3) < br.bit_end_pos_) {
                while (len-- > 0) {
                  br.readMoreInput();
                  ringbuffer[rb_pos++] = br.readBits(8);
                  if (rb_pos === rb_size) {
                    output.write(ringbuffer, rb_size);
                    rb_pos = 0;
                  }
                }
                return;
              }
              if (br.bit_end_pos_ < 32) {
                throw new Error(
                  "[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32"
                );
              }
              while (br.bit_pos_ < 32) {
                ringbuffer[rb_pos] = br.val_ >>> br.bit_pos_;
                br.bit_pos_ += 8;
                ++rb_pos;
                --len;
              }
              nbytes = br.bit_end_pos_ - br.bit_pos_ >> 3;
              if (br_pos + nbytes > BrotliBitReader.IBUF_MASK) {
                var tail = BrotliBitReader.IBUF_MASK + 1 - br_pos;
                for (var x2 = 0; x2 < tail; x2++)
                  ringbuffer[rb_pos + x2] = br.buf_[br_pos + x2];
                nbytes -= tail;
                rb_pos += tail;
                len -= tail;
                br_pos = 0;
              }
              for (var x2 = 0; x2 < nbytes; x2++)
                ringbuffer[rb_pos + x2] = br.buf_[br_pos + x2];
              rb_pos += nbytes;
              len -= nbytes;
              if (rb_pos >= rb_size) {
                output.write(ringbuffer, rb_size);
                rb_pos -= rb_size;
                for (var x2 = 0; x2 < rb_pos; x2++)
                  ringbuffer[x2] = ringbuffer[rb_size + x2];
              }
              while (rb_pos + len >= rb_size) {
                nbytes = rb_size - rb_pos;
                if (br.input_.read(ringbuffer, rb_pos, nbytes) < nbytes) {
                  throw new Error(
                    "[CopyUncompressedBlockToOutput] not enough bytes"
                  );
                }
                output.write(ringbuffer, rb_size);
                len -= nbytes;
                rb_pos = 0;
              }
              if (br.input_.read(ringbuffer, rb_pos, len) < len) {
                throw new Error(
                  "[CopyUncompressedBlockToOutput] not enough bytes"
                );
              }
              br.reset();
            }
            function JumpToByteBoundary(br) {
              var new_bit_pos = br.bit_pos_ + 7 & ~7;
              var pad_bits = br.readBits(new_bit_pos - br.bit_pos_);
              return pad_bits == 0;
            }
            function BrotliDecompressedSize(buffer) {
              var input = new BrotliInput(buffer);
              var br = new BrotliBitReader(input);
              DecodeWindowBits(br);
              var out = DecodeMetaBlockLength(br);
              return out.meta_block_length;
            }
            exports2.BrotliDecompressedSize = BrotliDecompressedSize;
            function BrotliDecompressBuffer(buffer, output_size) {
              var input = new BrotliInput(buffer);
              if (output_size == null) {
                output_size = BrotliDecompressedSize(buffer);
              }
              var output_buffer = new Uint8Array(output_size);
              var output = new BrotliOutput(output_buffer);
              BrotliDecompress(input, output);
              if (output.pos < output.buffer.length) {
                output.buffer = output.buffer.subarray(
                  0,
                  output.pos
                );
              }
              return output.buffer;
            }
            exports2.BrotliDecompressBuffer = BrotliDecompressBuffer;
            function BrotliDecompress(input, output) {
              var i3;
              var pos = 0;
              var input_end = 0;
              var window_bits = 0;
              var max_backward_distance;
              var max_distance = 0;
              var ringbuffer_size;
              var ringbuffer_mask;
              var ringbuffer;
              var ringbuffer_end;
              var dist_rb = [16, 15, 11, 4];
              var dist_rb_idx = 0;
              var prev_byte1 = 0;
              var prev_byte2 = 0;
              var hgroup = [
                new HuffmanTreeGroup(0, 0),
                new HuffmanTreeGroup(0, 0),
                new HuffmanTreeGroup(0, 0)
              ];
              var block_type_trees;
              var block_len_trees;
              var br;
              var kRingBufferWriteAheadSlack = 128 + BrotliBitReader.READ_SIZE;
              br = new BrotliBitReader(input);
              window_bits = DecodeWindowBits(br);
              max_backward_distance = (1 << window_bits) - 16;
              ringbuffer_size = 1 << window_bits;
              ringbuffer_mask = ringbuffer_size - 1;
              ringbuffer = new Uint8Array(
                ringbuffer_size + kRingBufferWriteAheadSlack + BrotliDictionary.maxDictionaryWordLength
              );
              ringbuffer_end = ringbuffer_size;
              block_type_trees = [];
              block_len_trees = [];
              for (var x2 = 0; x2 < 3 * HUFFMAN_MAX_TABLE_SIZE; x2++) {
                block_type_trees[x2] = new HuffmanCode(0, 0);
                block_len_trees[x2] = new HuffmanCode(0, 0);
              }
              while (!input_end) {
                var meta_block_remaining_len = 0;
                var is_uncompressed;
                var block_length = [1 << 28, 1 << 28, 1 << 28];
                var block_type = [0];
                var num_block_types = [1, 1, 1];
                var block_type_rb = [0, 1, 0, 1, 0, 1];
                var block_type_rb_index = [0];
                var distance_postfix_bits;
                var num_direct_distance_codes;
                var distance_postfix_mask;
                var num_distance_codes;
                var context_map = null;
                var context_modes = null;
                var num_literal_htrees;
                var dist_context_map = null;
                var num_dist_htrees;
                var context_offset = 0;
                var context_map_slice = null;
                var literal_htree_index = 0;
                var dist_context_offset = 0;
                var dist_context_map_slice = null;
                var dist_htree_index = 0;
                var context_lookup_offset1 = 0;
                var context_lookup_offset2 = 0;
                var context_mode;
                var htree_command;
                for (i3 = 0; i3 < 3; ++i3) {
                  hgroup[i3].codes = null;
                  hgroup[i3].htrees = null;
                }
                br.readMoreInput();
                var _out = DecodeMetaBlockLength(br);
                meta_block_remaining_len = _out.meta_block_length;
                if (pos + meta_block_remaining_len > output.buffer.length) {
                  var tmp = new Uint8Array(
                    pos + meta_block_remaining_len
                  );
                  tmp.set(output.buffer);
                  output.buffer = tmp;
                }
                input_end = _out.input_end;
                is_uncompressed = _out.is_uncompressed;
                if (_out.is_metadata) {
                  JumpToByteBoundary(br);
                  for (; meta_block_remaining_len > 0; --meta_block_remaining_len) {
                    br.readMoreInput();
                    br.readBits(8);
                  }
                  continue;
                }
                if (meta_block_remaining_len === 0) {
                  continue;
                }
                if (is_uncompressed) {
                  br.bit_pos_ = br.bit_pos_ + 7 & ~7;
                  CopyUncompressedBlockToOutput(
                    output,
                    meta_block_remaining_len,
                    pos,
                    ringbuffer,
                    ringbuffer_mask,
                    br
                  );
                  pos += meta_block_remaining_len;
                  continue;
                }
                for (i3 = 0; i3 < 3; ++i3) {
                  num_block_types[i3] = DecodeVarLenUint8(br) + 1;
                  if (num_block_types[i3] >= 2) {
                    ReadHuffmanCode(
                      num_block_types[i3] + 2,
                      block_type_trees,
                      i3 * HUFFMAN_MAX_TABLE_SIZE,
                      br
                    );
                    ReadHuffmanCode(
                      kNumBlockLengthCodes,
                      block_len_trees,
                      i3 * HUFFMAN_MAX_TABLE_SIZE,
                      br
                    );
                    block_length[i3] = ReadBlockLength(
                      block_len_trees,
                      i3 * HUFFMAN_MAX_TABLE_SIZE,
                      br
                    );
                    block_type_rb_index[i3] = 1;
                  }
                }
                br.readMoreInput();
                distance_postfix_bits = br.readBits(2);
                num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits);
                distance_postfix_mask = (1 << distance_postfix_bits) - 1;
                num_distance_codes = num_direct_distance_codes + (48 << distance_postfix_bits);
                context_modes = new Uint8Array(
                  num_block_types[0]
                );
                for (i3 = 0; i3 < num_block_types[0]; ++i3) {
                  br.readMoreInput();
                  context_modes[i3] = br.readBits(2) << 1;
                }
                var _o1 = DecodeContextMap(
                  num_block_types[0] << kLiteralContextBits,
                  br
                );
                num_literal_htrees = _o1.num_htrees;
                context_map = _o1.context_map;
                var _o2 = DecodeContextMap(
                  num_block_types[2] << kDistanceContextBits,
                  br
                );
                num_dist_htrees = _o2.num_htrees;
                dist_context_map = _o2.context_map;
                hgroup[0] = new HuffmanTreeGroup(
                  kNumLiteralCodes,
                  num_literal_htrees
                );
                hgroup[1] = new HuffmanTreeGroup(
                  kNumInsertAndCopyCodes,
                  num_block_types[1]
                );
                hgroup[2] = new HuffmanTreeGroup(
                  num_distance_codes,
                  num_dist_htrees
                );
                for (i3 = 0; i3 < 3; ++i3) {
                  hgroup[i3].decode(br);
                }
                context_map_slice = 0;
                dist_context_map_slice = 0;
                context_mode = context_modes[block_type[0]];
                context_lookup_offset1 = Context.lookupOffsets[context_mode];
                context_lookup_offset2 = Context.lookupOffsets[context_mode + 1];
                htree_command = hgroup[1].htrees[0];
                while (meta_block_remaining_len > 0) {
                  var cmd_code;
                  var range_idx;
                  var insert_code;
                  var copy_code;
                  var insert_length;
                  var copy_length;
                  var distance_code;
                  var distance;
                  var context;
                  var j2;
                  var copy_dst;
                  br.readMoreInput();
                  if (block_length[1] === 0) {
                    DecodeBlockType(
                      num_block_types[1],
                      block_type_trees,
                      1,
                      block_type,
                      block_type_rb,
                      block_type_rb_index,
                      br
                    );
                    block_length[1] = ReadBlockLength(
                      block_len_trees,
                      HUFFMAN_MAX_TABLE_SIZE,
                      br
                    );
                    htree_command = hgroup[1].htrees[block_type[1]];
                  }
                  --block_length[1];
                  cmd_code = ReadSymbol(
                    hgroup[1].codes,
                    htree_command,
                    br
                  );
                  range_idx = cmd_code >> 6;
                  if (range_idx >= 2) {
                    range_idx -= 2;
                    distance_code = -1;
                  } else {
                    distance_code = 0;
                  }
                  insert_code = Prefix.kInsertRangeLut[range_idx] + (cmd_code >> 3 & 7);
                  copy_code = Prefix.kCopyRangeLut[range_idx] + (cmd_code & 7);
                  insert_length = Prefix.kInsertLengthPrefixCode[insert_code].offset + br.readBits(
                    Prefix.kInsertLengthPrefixCode[insert_code].nbits
                  );
                  copy_length = Prefix.kCopyLengthPrefixCode[copy_code].offset + br.readBits(
                    Prefix.kCopyLengthPrefixCode[copy_code].nbits
                  );
                  prev_byte1 = ringbuffer[pos - 1 & ringbuffer_mask];
                  prev_byte2 = ringbuffer[pos - 2 & ringbuffer_mask];
                  for (j2 = 0; j2 < insert_length; ++j2) {
                    br.readMoreInput();
                    if (block_length[0] === 0) {
                      DecodeBlockType(
                        num_block_types[0],
                        block_type_trees,
                        0,
                        block_type,
                        block_type_rb,
                        block_type_rb_index,
                        br
                      );
                      block_length[0] = ReadBlockLength(
                        block_len_trees,
                        0,
                        br
                      );
                      context_offset = block_type[0] << kLiteralContextBits;
                      context_map_slice = context_offset;
                      context_mode = context_modes[block_type[0]];
                      context_lookup_offset1 = Context.lookupOffsets[context_mode];
                      context_lookup_offset2 = Context.lookupOffsets[context_mode + 1];
                    }
                    context = Context.lookup[context_lookup_offset1 + prev_byte1] | Context.lookup[context_lookup_offset2 + prev_byte2];
                    literal_htree_index = context_map[context_map_slice + context];
                    --block_length[0];
                    prev_byte2 = prev_byte1;
                    prev_byte1 = ReadSymbol(
                      hgroup[0].codes,
                      hgroup[0].htrees[literal_htree_index],
                      br
                    );
                    ringbuffer[pos & ringbuffer_mask] = prev_byte1;
                    if ((pos & ringbuffer_mask) === ringbuffer_mask) {
                      output.write(
                        ringbuffer,
                        ringbuffer_size
                      );
                    }
                    ++pos;
                  }
                  meta_block_remaining_len -= insert_length;
                  if (meta_block_remaining_len <= 0) break;
                  if (distance_code < 0) {
                    var context;
                    br.readMoreInput();
                    if (block_length[2] === 0) {
                      DecodeBlockType(
                        num_block_types[2],
                        block_type_trees,
                        2,
                        block_type,
                        block_type_rb,
                        block_type_rb_index,
                        br
                      );
                      block_length[2] = ReadBlockLength(
                        block_len_trees,
                        2 * HUFFMAN_MAX_TABLE_SIZE,
                        br
                      );
                      dist_context_offset = block_type[2] << kDistanceContextBits;
                      dist_context_map_slice = dist_context_offset;
                    }
                    --block_length[2];
                    context = (copy_length > 4 ? 3 : copy_length - 2) & 255;
                    dist_htree_index = dist_context_map[dist_context_map_slice + context];
                    distance_code = ReadSymbol(
                      hgroup[2].codes,
                      hgroup[2].htrees[dist_htree_index],
                      br
                    );
                    if (distance_code >= num_direct_distance_codes) {
                      var nbits;
                      var postfix;
                      var offset3;
                      distance_code -= num_direct_distance_codes;
                      postfix = distance_code & distance_postfix_mask;
                      distance_code >>= distance_postfix_bits;
                      nbits = (distance_code >> 1) + 1;
                      offset3 = (2 + (distance_code & 1) << nbits) - 4;
                      distance_code = num_direct_distance_codes + (offset3 + br.readBits(nbits) << distance_postfix_bits) + postfix;
                    }
                  }
                  distance = TranslateShortCodes(
                    distance_code,
                    dist_rb,
                    dist_rb_idx
                  );
                  if (distance < 0) {
                    throw new Error(
                      "[BrotliDecompress] invalid distance"
                    );
                  }
                  if (pos < max_backward_distance && max_distance !== max_backward_distance) {
                    max_distance = pos;
                  } else {
                    max_distance = max_backward_distance;
                  }
                  copy_dst = pos & ringbuffer_mask;
                  if (distance > max_distance) {
                    if (copy_length >= BrotliDictionary.minDictionaryWordLength && copy_length <= BrotliDictionary.maxDictionaryWordLength) {
                      var offset3 = BrotliDictionary.offsetsByLength[copy_length];
                      var word_id = distance - max_distance - 1;
                      var shift3 = BrotliDictionary.sizeBitsByLength[copy_length];
                      var mask = (1 << shift3) - 1;
                      var word_idx = word_id & mask;
                      var transform_idx = word_id >> shift3;
                      offset3 += word_idx * copy_length;
                      if (transform_idx < Transform.kNumTransforms) {
                        var len = Transform.transformDictionaryWord(
                          ringbuffer,
                          copy_dst,
                          offset3,
                          copy_length,
                          transform_idx
                        );
                        copy_dst += len;
                        pos += len;
                        meta_block_remaining_len -= len;
                        if (copy_dst >= ringbuffer_end) {
                          output.write(
                            ringbuffer,
                            ringbuffer_size
                          );
                          for (var _x40 = 0; _x40 < copy_dst - ringbuffer_end; _x40++)
                            ringbuffer[_x40] = ringbuffer[ringbuffer_end + _x40];
                        }
                      } else {
                        throw new Error(
                          "Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len
                        );
                      }
                    } else {
                      throw new Error(
                        "Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len
                      );
                    }
                  } else {
                    if (distance_code > 0) {
                      dist_rb[dist_rb_idx & 3] = distance;
                      ++dist_rb_idx;
                    }
                    if (copy_length > meta_block_remaining_len) {
                      throw new Error(
                        "Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len
                      );
                    }
                    for (j2 = 0; j2 < copy_length; ++j2) {
                      ringbuffer[pos & ringbuffer_mask] = ringbuffer[pos - distance & ringbuffer_mask];
                      if ((pos & ringbuffer_mask) === ringbuffer_mask) {
                        output.write(
                          ringbuffer,
                          ringbuffer_size
                        );
                      }
                      ++pos;
                      --meta_block_remaining_len;
                    }
                  }
                  prev_byte1 = ringbuffer[pos - 1 & ringbuffer_mask];
                  prev_byte2 = ringbuffer[pos - 2 & ringbuffer_mask];
                }
                pos &= 1073741823;
              }
              output.write(ringbuffer, pos & ringbuffer_mask);
            }
            exports2.BrotliDecompress = BrotliDecompress;
            BrotliDictionary.init();
          },
          {
            "./bit_reader": 1,
            "./context": 2,
            "./dictionary": 6,
            "./huffman": 7,
            "./prefix": 9,
            "./streams": 10,
            "./transform": 11
          }
        ],
        4: [
          function(require2, module2, exports2) {
            var base64 = require2("base64-js");
            exports2.init = function() {
              var BrotliDecompressBuffer = require2("./decode").BrotliDecompressBuffer;
              var compressed = base64.toByteArray(
                require2("./dictionary.bin.js")
              );
              return BrotliDecompressBuffer(compressed);
            };
          },
          { "./decode": 3, "./dictionary.bin.js": 5, "base64-js": 8 }
        ],
        5: [
          function(require2, module2, exports2) {
            module2.exports = "W5/fcQLn5gKf2XUbAiQ1XULX+TZz6ADToDsgqk6qVfeC0e4m6OO2wcQ1J76ZBVRV1fRkEsdu//62zQsFEZWSTCnMhcsQKlS2qOhuVYYMGCkV0fXWEoMFbESXrKEZ9wdUEsyw9g4bJlEt1Y6oVMxMRTEVbCIwZzJzboK5j8m4YH02qgXYhv1V+PM435sLVxyHJihaJREEhZGqL03txGFQLm76caGO/ovxKvzCby/3vMTtX/459f0igi7WutnKiMQ6wODSoRh/8Lx1V3Q99MvKtwB6bHdERYRY0hStJoMjNeTsNX7bn+Y7e4EQ3bf8xBc7L0BsyfFPK43dGSXpL6clYC/I328h54/VYrQ5i0648FgbGtl837svJ35L3Mot/+nPlNpWgKx1gGXQYqX6n+bbZ7wuyCHKcUok12Xjqub7NXZGzqBx0SD+uziNf87t7ve42jxSKQoW3nyxVrWIGlFShhCKxjpZZ5MeGna0+lBkk+kaN8F9qFBAFgEogyMBdcX/T1W/WnMOi/7ycWUQloEBKGeC48MkiwqJkJO+12eQiOFHMmck6q/IjWW3RZlany23TBm+cNr/84/oi5GGmGBZWrZ6j+zykVozz5fT/QH/Da6WTbZYYPynVNO7kxzuNN2kxKKWche5WveitPKAecB8YcAHz/+zXLjcLzkdDSktNIDwZE9J9X+tto43oJy65wApM3mDzYtCwX9lM+N5VR3kXYo0Z3t0TtXfgBFg7gU8oN0Dgl7fZlUbhNll+0uuohRVKjrEd8egrSndy5/Tgd2gqjA4CAVuC7ESUmL3DZoGnfhQV8uwnpi8EGvAVVsowNRxPudck7+oqAUDkwZopWqFnW1riss0t1z6iCISVKreYGNvQcXv+1L9+jbP8cd/dPUiqBso2q+7ZyFBvENCkkVr44iyPbtOoOoCecWsiuqMSML5lv+vN5MzUr+Dnh73G7Q1YnRYJVYXHRJaNAOByiaK6CusgFdBPE40r0rvqXV7tksKO2DrHYXBTv8P5ysqxEx8VDXUDDqkPH6NNOV/a2WH8zlkXRELSa8P+heNyJBBP7PgsG1EtWtNef6/i+lcayzQwQCsduidpbKfhWUDgAEmyhGu/zVTacI6RS0zTABrOYueemnVa19u9fT23N/Ta6RvTpof5DWygqreCqrDAgM4LID1+1T/taU6yTFVLqXOv+/MuQOFnaF8vLMKD7tKWDoBdALgxF33zQccCcdHx8fKIVdW69O7qHtXpeGr9jbbpFA+qRMWr5hp0s67FPc7HAiLV0g0/peZlW7hJPYEhZyhpSwahnf93/tZgfqZWXFdmdXBzqxGHLrQKxoAY6fRoBhgCRPmmGueYZ5JexTVDKUIXzkG/fqp/0U3hAgQdJ9zumutK6nqWbaqvm1pgu03IYR+G+8s0jDBBz8cApZFSBeuWasyqo2OMDKAZCozS+GWSvL/HsE9rHxooe17U3s/lTE+VZAk4j3dp6uIGaC0JMiqR5CUsabPyM0dOYDR7Ea7ip4USZlya38YfPtvrX/tBlhHilj55nZ1nfN24AOAi9BVtz/Mbn8AEDJCqJgsVUa6nQnSxv2Fs7l/NlCzpfYEjmPrNyib/+t0ei2eEMjvNhLkHCZlci4WhBe7ePZTmzYqlY9+1pxtS4GB+5lM1BHT9tS270EWUDYFq1I0yY/fNiAk4bk9yBgmef/f2k6AlYQZHsNFnW8wBQxCd68iWv7/35bXfz3JZmfGligWAKRjIs3IpzxQ27vAglHSiOzCYzJ9L9A1CdiyFvyR66ucA4jKifu5ehwER26yV7HjKqn5Mfozo7Coxxt8LWWPT47BeMxX8p0Pjb7hZn+6bw7z3Lw+7653j5sI8CLu5kThpMlj1m4c2ch3jGcP1FsT13vuK3qjecKTZk2kHcOZY40UX+qdaxstZqsqQqgXz+QGF99ZJLqr3VYu4aecl1Ab5GmqS8k/GV5b95zxQ5d4EfXUJ6kTS/CXF/aiqKDOT1T7Jz5z0PwDUcwr9clLN1OJGCiKfqvah+h3XzrBOiLOW8wvn8gW6qE8vPxi+Efv+UH55T7PQFVMh6cZ1pZQlzJpKZ7P7uWvwPGJ6DTlR6wbyj3Iv2HyefnRo/dv7dNx+qaa0N38iBsR++Uil7Wd4afwDNsrzDAK4fXZwvEY/jdKuIKXlfrQd2C39dW7ntnRbIp9OtGy9pPBn/V2ASoi/2UJZfS+xuGLH8bnLuPlzdTNS6zdyk8Dt/h6sfOW5myxh1f+zf3zZ3MX/mO9cQPp5pOx967ZA6/pqHvclNfnUFF+rq+Vd7alKr6KWPcIDhpn6v2K6NlUu6LrKo8b/pYpU/Gazfvtwhn7tEOUuXht5rUJdSf6sLjYf0VTYDgwJ81yaqKTUYej/tbHckSRb/HZicwGJqh1mAHB/IuNs9dc9yuvF3D5Xocm3elWFdq5oEy70dYFit79yaLiNjPj5UUcVmZUVhQEhW5V2Z6Cm4HVH/R8qlamRYwBileuh07CbEce3TXa2JmXWBf+ozt319psboobeZhVnwhMZzOeQJzhpTDbP71Tv8HuZxxUI/+ma3XW6DFDDs4+qmpERwHGBd2edxwUKlODRdUWZ/g0GOezrbzOZauFMai4QU6GVHV6aPNBiBndHSsV4IzpvUiiYyg6OyyrL4Dj5q/Lw3N5kAwftEVl9rNd7Jk5PDij2hTH6wIXnsyXkKePxbmHYgC8A6an5Fob/KH5GtC0l4eFso+VpxedtJHdHpNm+Bvy4C79yVOkrZsLrQ3OHCeB0Ra+kBIRldUGlDCEmq2RwXnfyh6Dz+alk6eftI2n6sastRrGwbwszBeDRS/Fa/KwRJkCzTsLr/JCs5hOPE/MPLYdZ1F1fv7D+VmysX6NpOC8aU9F4Qs6HvDyUy9PvFGDKZ/P5101TYHFl8pjj6wm/qyS75etZhhfg0UEL4OYmHk6m6dO192AzoIyPSV9QedDA4Ml23rRbqxMPMxf7FJnDc5FTElVS/PyqgePzmwVZ26NWhRDQ+oaT7ly7ell4s3DypS1s0g+tOr7XHrrkZj9+x/mJBttrLx98lFIaRZzHz4aC7r52/JQ4VjHahY2/YVXZn/QC2ztQb/sY3uRlyc5vQS8nLPGT/n27495i8HPA152z7Fh5aFpyn1GPJKHuPL8Iw94DuW3KjkURAWZXn4EQy89xiKEHN1mk/tkM4gYDBxwNoYvRfE6LFqsxWJtPrDGbsnLMap3Ka3MUoytW0cvieozOmdERmhcqzG+3HmZv2yZeiIeQTKGdRT4HHNxekm1tY+/n06rGmFleqLscSERzctTKM6G9P0Pc1RmVvrascIxaO1CQCiYPE15bD7c3xSeW7gXxYjgxcrUlcbIvO0r+Yplhx0kTt3qafDOmFyMjgGxXu73rddMHpV1wMubyAGcf/v5dLr5P72Ta9lBF+fzMJrMycwv+9vnU3ANIl1cH9tfW7af8u0/HG0vV47jNFXzFTtaha1xvze/s8KMtCYucXc1nzfd/MQydUXn/b72RBt5wO/3jRcMH9BdhC/yctKBIveRYPrNpDWqBsO8VMmP+WvRaOcA4zRMR1PvSoO92rS7pYEv+fZfEfTMzEdM+6X5tLlyxExhqLRkms5EuLovLfx66de5fL2/yX02H52FPVwahrPqmN/E0oVXnsCKhbi/yRxX83nRbUKWhzYceXOntfuXn51NszJ6MO73pQf5Pl4in3ec4JU8hF7ppV34+mm9r1LY0ee/i1O1wpd8+zfLztE0cqBxggiBi5Bu95v9l3r9r/U5hweLn+TbfxowrWDqdJauKd8+q/dH8sbPkc9ttuyO94f7/XK/nHX46MPFLEb5qQlNPvhJ50/59t9ft3LXu7uVaWaO2bDrDCnRSzZyWvFKxO1+vT8MwwunR3bX0CkfPjqb4K9O19tn5X50PvmYpEwHtiW9WtzuV/s76B1zvLLNkViNd8ySxIl/3orfqP90TyTGaf7/rx8jQzeHJXdmh/N6YDvbvmTBwCdxfEQ1NcL6wNMdSIXNq7b1EUzRy1/Axsyk5p22GMG1b+GxFgbHErZh92wuvco0AuOLXct9hvw2nw/LqIcDRRmJmmZzcgUa7JpM/WV/S9IUfbF56TL2orzqwebdRD8nIYNJ41D/hz37Fo11p2Y21wzPcn713qVGhqtevStYfGH4n69OEJtPvbbLYWvscDqc3Hgnu166+tAyLnxrX0Y5zoYjV++1sI7t5kMr02KT/+uwtkc+rZLOf/qn/s3nYCf13Dg8/sB2diJgjGqjQ+TLhxbzyue2Ob7X6/9lUwW7a+lbznHzOYy8LKW1C/uRPbQY3KW/0gO9LXunHLvPL97afba9bFtc9hmz7GAttjVYlCvQAiOwAk/gC5+hkLEs6tr3AZKxLJtOEwk2dLxTYWsIB/j/ToWtIWzo906FrSG8iaqqqqqqiIiIiAgzMzMzNz+AyK+01/zi8n8S+Y1MjoRaQ80WU/G8MBlO+53VPXANrWm4wzGUVZUjjBJZVdhpcfkjsmcWaO+UEldXi1e+zq+HOsCpknYshuh8pOLISJun7TN0EIGW2xTnlOImeecnoGW4raxe2G1T3HEvfYUYMhG+gAFOAwh5nK8mZhwJMmN7r224QVsNFvZ87Z0qatvknklyPDK3Hy45PgVKXji52Wen4d4PlFVVYGnNap+fSpFbK90rYnhUc6n91Q3AY9E0tJOFrcfZtm/491XbcG/jsViUPPX76qmeuiz+qY1Hk7/1VPM405zWVuoheLUimpWYdVzCmUdKHebMdzgrYrb8mL2eeLSnRWHdonfZa8RsOU9F37w+591l5FLYHiOqWeHtE/lWrBHcRKp3uhtr8yXm8LU/5ms+NM6ZKsqu90cFZ4o58+k4rdrtB97NADFbwmEG7lXqvirhOTOqU14xuUF2myIjURcPHrPOQ4lmM3PeMg7bUuk0nnZi67bXsU6H8lhqIo8TaOrEafCO1ARK9PjC0QOoq2BxmMdgYB9G/lIb9++fqNJ2s7BHGFyBNmZAR8J3KCo012ikaSP8BCrf6VI0X5xdnbhHIO+B5rbOyB54zXkzfObyJ4ecwxfqBJMLFc7m59rNcw7hoHnFZ0b00zee+gTqvjm61Pb4xn0kcDX4jvHM0rBXZypG3DCKnD/Waa/ZtHmtFPgO5eETx+k7RrVg3aSwm2YoNXnCs3XPQDhNn+Fia6IlOOuIG6VJH7TP6ava26ehKHQa2T4N0tcZ9dPCGo3ZdnNltsHQbeYt5vPnJezV/cAeNypdml1vCHI8M81nSRP5Qi2+mI8v/sxiZru9187nRtp3f/42NemcONa+4eVC3PCZzc88aZh851CqSsshe70uPxeN/dmYwlwb3trwMrN1Gq8jbnApcVDx/yDPeYs5/7r62tsQ6lLg+DiFXTEhzR9dHqv0iT4tgj825W+H3XiRUNUZT2kR9Ri0+lp+UM3iQtS8uOE23Ly4KYtvqH13jghUntJRAewuzNLDXp8RxdcaA3cMY6TO2IeSFRXezeWIjCqyhsUdMYuCgYTZSKpBype1zRfq8FshvfBPc6BAQWl7/QxIDp3VGo1J3vn42OEs3qznws+YLRXbymyB19a9XBx6n/owcyxlEYyFWCi+kG9F+EyD/4yn80+agaZ9P7ay2Dny99aK2o91FkfEOY8hBwyfi5uwx2y5SaHmG+oq/zl1FX/8irOf8Y3vAcX/6uLP6A6nvMO24edSGPjQc827Rw2atX+z2bKq0CmW9mOtYnr5/AfDa1ZfPaXnKtlWborup7QYx+Or2uWb+N3N//2+yDcXMqIJdf55xl7/vsj4WoPPlxLxtVrkJ4w/tTe3mLdATOOYwxcq52w5Wxz5MbPdVs5O8/lhfE7dPj0bIiPQ3QV0iqm4m3YX8hRfc6jQ3fWepevMqUDJd86Z4vwM40CWHnn+WphsGHfieF02D3tmZvpWD+kBpNCFcLnZhcmmrhpGzzbdA+sQ1ar18OJD87IOKOFoRNznaHPNHUfUNhvY1iU+uhvEvpKHaUn3qK3exVVyX4joipp3um7FmYJWmA+WbIDshRpbVRx5/nqstCgy87FGbfVB8yDGCqS+2qCsnRwnSAN6zgzxfdB2nBT/vZ4/6uxb6oH8b4VBRxiIB93wLa47hG3w2SL/2Z27yOXJFwZpSJaBYyvajA7vRRYNKqljXKpt/CFD/tSMr18DKKbwB0xggBePatl1nki0yvqW5zchlyZmJ0OTxJ3D+fsYJs/mxYN5+Le5oagtcl+YsVvy8kSjI2YGvGjvmpkRS9W2dtXqWnVuxUhURm1lKtou/hdEq19VBp9OjGvHEQSmrpuf2R24mXGheil8KeiANY8fW1VERUfBImb64j12caBZmRViZHbeVMjCrPDg9A90IXrtnsYCuZtRQ0PyrKDjBNOsPfKsg1pA02gHlVr0OXiFhtp6nJqXVzcbfM0KnzC3ggOENPE9VBdmHKN6LYaijb4wXxJn5A0FSDF5j+h1ooZx885Jt3ZKzO5n7Z5WfNEOtyyPqQEnn7WLv5Fis3PdgMshjF1FRydbNyeBbyKI1oN1TRVrVK7kgsb/zjX4NDPIRMctVeaxVB38Vh1x5KbeJbU138AM5KzmZu3uny0ErygxiJF7GVXUrPzFxrlx1uFdAaZFDN9cvIb74qD9tzBMo7L7WIEYK+sla1DVMHpF0F7b3+Y6S+zjvLeDMCpapmJo1weBWuxKF3rOocih1gun4BoJh1kWnV/Jmiq6uOhK3VfKxEHEkafjLgK3oujaPzY6SXg8phhL4TNR1xvJd1Wa0aYFfPUMLrNBDCh4AuGRTbtKMc6Z1Udj8evY/ZpCuMAUefdo69DZUngoqE1P9A3PJfOf7WixCEj+Y6t7fYeHbbxUAoFV3M89cCKfma3fc1+jKRe7MFWEbQqEfyzO2x/wrO2VYH7iYdQ9BkPyI8/3kXBpLaCpU7eC0Yv/am/tEDu7HZpqg0EvHo0nf/R/gRzUWy33/HXMJQeu1GylKmOkXzlCfGFruAcPPhaGqZOtu19zsJ1SO2Jz4Ztth5cBX6mRQwWmDwryG9FUMlZzNckMdK+IoMJv1rOWnBamS2w2KHiaPMPLC15hCZm4KTpoZyj4E2TqC/P6r7/EhnDMhKicZZ1ZwxuC7DPzDGs53q8gXaI9kFTK+2LTq7bhwsTbrMV8Rsfua5lMS0FwbTitUVnVa1yTb5IX51mmYnUcP9wPr8Ji1tiYJeJV9GZTrQhF7vvdU2OTU42ogJ9FDwhmycI2LIg++03C6scYhUyUuMV5tkw6kGUoL+mjNC38+wMdWNljn6tGPpRES7veqrSn5TRuv+dh6JVL/iDHU1db4c9WK3++OrH3PqziF916UMUKn8G67nN60GfWiHrXYhUG3yVWmyYak59NHj8t1smG4UDiWz2rPHNrKnN4Zo1LBbr2/eF9YZ0n0blx2nG4X+EKFxvS3W28JESD+FWk61VCD3z/URGHiJl++7TdBwkCj6tGOH3qDb0QqcOF9Kzpj0HUb/KyFW3Yhj2VMKJqGZleFBH7vqvf7WqLC3XMuHV8q8a4sTFuxUtkD/6JIBvKaVjv96ndgruKZ1k/BHzqf2K9fLk7HGXANyLDd1vxkK/i055pnzl+zw6zLnwXlVYVtfmacJgEpRP1hbGgrYPVN6v2lG+idQNGmwcKXu/8xEj/P6qe/sB2WmwNp6pp8jaISMkwdleFXYK55NHWLTTbutSUqjBfDGWo/Yg918qQ+8BRZSAHZbfuNZz2O0sov1Ue4CWlVg3rFhM3Kljj9ksGd/NUhk4nH+a5UN2+1i8+NM3vRNp7uQ6sqexSCukEVlVZriHNqFi5rLm9TMWa4qm3idJqppQACol2l4VSuvWLfta4JcXy3bROPNbXOgdOhG47LC0CwW/dMlSx4Jf17aEU3yA1x9p+Yc0jupXgcMuYNku64iYOkGToVDuJvlbEKlJqsmiHbvNrIVZEH+yFdF8DbleZ6iNiWwMqvtMp/mSpwx5KxRrT9p3MAPTHGtMbfvdFhyj9vhaKcn3At8Lc16Ai+vBcSp1ztXi7rCJZx/ql7TXcclq6Q76UeKWDy9boS0WHIjUuWhPG8LBmW5y2rhuTpM5vsLt+HOLh1Yf0DqXa9tsfC+kaKt2htA0ai/L2i7RKoNjEwztkmRU0GfgW1TxUvPFhg0V7DdfWJk5gfrccpYv+MA9M0dkGTLECeYwUixRzjRFdmjG7zdZIl3XKB9YliNKI31lfa7i2JG5C8Ss+rHe0D7Z696/V3DEAOWHnQ9yNahMUl5kENWS6pHKKp2D1BaSrrHdE1w2qNxIztpXgUIrF0bm15YML4b6V1k+GpNysTahKMVrrS85lTVo9OGJ96I47eAy5rYWpRf/mIzeoYU1DKaQCTUVwrhHeyNoDqHel+lLxr9WKzhSYw7vrR6+V5q0pfi2k3L1zqkubY6rrd9ZLvSuWNf0uqnkY+FpTvFzSW9Fp0b9l8JA7THV9eCi/PY/SCZIUYx3BU2alj7Cm3VV6eYpios4b6WuNOJdYXUK3zTqj5CVG2FqYM4Z7CuIU0qO05XR0d71FHM0YhZmJmTRfLlXEumN82BGtzdX0S19t1e+bUieK8zRmqpa4Qc5TSjifmaQsY2ETLjhI36gMR1+7qpjdXXHiceUekfBaucHShAOiFXmv3sNmGQyU5iVgnoocuonQXEPTFwslHtS8R+A47StI9wj0iSrtbi5rMysczFiImsQ+bdFClnFjjpXXwMy6O7qfjOr8Fb0a7ODItisjnn3EQO16+ypd1cwyaAW5Yzxz5QknfMO7643fXW/I9y3U2xH27Oapqr56Z/tEzglj6IbT6HEHjopiXqeRbe5mQQvxtcbDOVverN0ZgMdzqRYRjaXtMRd56Q4cZSmdPvZJdSrhJ1D9zNXPqAEqPIavPdfubt5oke2kmv0dztIszSv2VYuoyf1UuopbsYb+uX9h6WpwjpgtZ6fNNawNJ4q8O3CFoSbioAaOSZMx2GYaPYB+rEb6qjQiNRFQ76TvwNFVKD+BhH9VhcKGsXzmMI7BptU/CNWolM7YzROvpFAntsiWJp6eR2d3GarcYShVYSUqhmYOWj5E96NK2WvmYNTeY7Zs4RUEdv9h9QT4EseKt6LzLrqEOs3hxAY1MaNWpSa6zZx8F3YOVeCYMS88W+CYHDuWe4yoc6YK+djDuEOrBR5lvh0r+Q9uM88lrjx9x9AtgpQVNE8r+3O6Gvw59D+kBF/UMXyhliYUtPjmvXGY6Dk3x+kEOW+GtdMVC4EZTqoS/jmR0P0LS75DOc/w2vnri97M4SdbZ8qeU7gg8DVbERkU5geaMQO3mYrSYyAngeUQqrN0C0/vsFmcgWNXNeidsTAj7/4MncJR0caaBUpbLK1yBCBNRjEv6KvuVSdpPnEMJdsRRtqJ+U8tN1gXA4ePHc6ZT0eviI73UOJF0fEZ8YaneAQqQdGphNvwM4nIqPnXxV0xA0fnCT+oAhJuyw/q8jO0y8CjSteZExwBpIN6SvNp6A5G/abi6egeND/1GTguhuNjaUbbnSbGd4L8937Ezm34Eyi6n1maeOBxh3PI0jzJDf5mh/BsLD7F2GOKvlA/5gtvxI3/eV4sLfKW5Wy+oio+es/u6T8UU+nsofy57Icb/JlZHPFtCgd/x+bwt3ZT+xXTtTtTrGAb4QehC6X9G+8YT+ozcLxDsdCjsuOqwPFnrdLYaFc92Ui0m4fr39lYmlCaqTit7G6O/3kWDkgtXjNH4BiEm/+jegQnihOtfffn33WxsFjhfMd48HT+f6o6X65j7XR8WLSHMFkxbvOYsrRsF1bowDuSQ18Mkxk4qz2zoGPL5fu9h2Hqmt1asl3Q3Yu3szOc+spiCmX4AETBM3pLoTYSp3sVxahyhL8eC4mPN9k2x3o0xkiixIzM3CZFzf5oR4mecQ5+ax2wCah3/crmnHoqR0+KMaOPxRif1oEFRFOO/kTPPmtww+NfMXxEK6gn6iU32U6fFruIz8Q4WgljtnaCVTBgWx7diUdshC9ZEa5yKpRBBeW12r/iNc/+EgNqmhswNB8SBoihHXeDF7rrWDLcmt3V8GYYN7pXRy4DZjj4DJuUBL5iC3DQAaoo4vkftqVTYRGLS3mHZ7gdmdTTqbgNN/PTdTCOTgXolc88MhXAEUMdX0iy1JMuk5wLsgeu0QUYlz2S4skTWwJz6pOm/8ihrmgGfFgri+ZWUK2gAPHgbWa8jaocdSuM4FJYoKicYX/ZSENkg9Q1ZzJfwScfVnR2DegOGwCvmogaWJCLQepv9WNlU6QgsmOwICquU28Mlk3d9W5E81lU/5Ez0LcX6lwKMWDNluNKfBDUy/phJgBcMnfkh9iRxrdOzgs08JdPB85Lwo+GUSb4t3nC+0byqMZtO2fQJ4U2zGIr49t/28qmmGv2RanDD7a3FEcdtutkW8twwwlUSpb8QalodddbBfNHKDQ828BdE7OBgFdiKYohLawFYqpybQoxATZrheLhdI7+0Zlu9Q1myRcd15r9UIm8K2LGJxqTegntqNVMKnf1a8zQiyUR1rxoqjiFxeHxqFcYUTHfDu7rhbWng6qOxOsI+5A1p9mRyEPdVkTlE24vY54W7bWc6jMgZvNXdfC9/9q7408KDsbdL7Utz7QFSDetz2picArzrdpL8OaCHC9V26RroemtDZ5yNM/KGkWMyTmfnInEvwtSD23UcFcjhaE3VKzkoaEMKGBft4XbIO6forTY1lmGQwVmKicBCiArDzE+1oIxE08fWeviIOD5TznqH+OoHadvoOP20drMPe5Irg3XBQziW2XDuHYzjqQQ4wySssjXUs5H+t3FWYMHppUnBHMx/nYIT5d7OmjDbgD9F6na3m4l7KdkeSO3kTEPXafiWinogag7b52taiZhL1TSvBFmEZafFq2H8khQaZXuitCewT5FBgVtPK0j4xUHPfUz3Q28eac1Z139DAP23dgki94EC8vbDPTQC97HPPSWjUNG5tWKMsaxAEMKC0665Xvo1Ntd07wCLNf8Q56mrEPVpCxlIMVlQlWRxM3oAfpgIc+8KC3rEXUog5g06vt7zgXY8grH7hhwVSaeuvC06YYRAwpbyk/Unzj9hLEZNs2oxPQB9yc+GnL6zTgq7rI++KDJwX2SP8Sd6YzTuw5lV/kU6eQxRD12omfQAW6caTR4LikYkBB1CMOrvgRr/VY75+NSB40Cni6bADAtaK+vyxVWpf9NeKJxN2KYQ8Q2xPB3K1s7fuhvWbr2XpgW044VD6DRs0qXoqKf1NFsaGvKJc47leUV3pppP/5VTKFhaGuol4Esfjf5zyCyUHmHthChcYh4hYLQF+AFWsuq4t0wJyWgdwQVOZiV0efRHPoK5+E1vjz9wTJmVkITC9oEstAsyZSgE/dbicwKr89YUxKZI+owD205Tm5lnnmDRuP/JnzxX3gMtlrcX0UesZdxyQqYQuEW4R51vmQ5xOZteUd8SJruMlTUzhtVw/Nq7eUBcqN2/HVotgfngif60yKEtoUx3WYOZlVJuJOh8u59fzSDPFYtQgqDUAGyGhQOAvKroXMcOYY0qjnStJR/G3aP+Jt1sLVlGV8POwr/6OGsqetnyF3TmTqZjENfnXh51oxe9qVUw2M78EzAJ+IM8lZ1MBPQ9ZWSVc4J3mWSrLKrMHReA5qdGoz0ODRsaA+vwxXA2cAM4qlfzBJA6581m4hzxItQw5dxrrBL3Y6kCbUcFxo1S8jyV44q//+7ASNNudZ6xeaNOSIUffqMn4A9lIjFctYn2gpEPAb3f7p3iIBN8H14FUGQ9ct2hPsL+cEsTgUrR47uJVN4n4wt/wgfwwHuOnLd4yobkofy8JvxSQTA7rMpDIc608SlZFJfZYcmbT0tAHpPE8MrtQ42siTUNWxqvWZOmvu9f0JPoQmg+6l7sZWwyfi6PXkxJnwBraUG0MYG4zYHQz3igy/XsFkx5tNQxw43qvI9dU3f0DdhOUlHKjmi1VAr2Kiy0HZwD8VeEbhh0OiDdMYspolQsYdSwjCcjeowIXNZVUPmL2wwIkYhmXKhGozdCJ4lRKbsf4NBh/XnQoS92NJEWOVOFs2YhN8c5QZFeK0pRdAG40hqvLbmoSA8xQmzOOEc7wLcme9JOsjPCEgpCwUs9E2DohMHRhUeyGIN6TFvrbny8nDuilsDpzrH5mS76APoIEJmItS67sQJ+nfwddzmjPxcBEBBCw0kWDwd0EZCkNeOD7NNQhtBm7KHL9mRxj6U1yWU2puzlIDtpYxdH4ZPeXBJkTGAJfUr/oTCz/iypY6uXaR2V1doPxJYlrw2ghH0D5gbrhFcIxzYwi4a/4hqVdf2DdxBp6vGYDjavxMAAoy+1+3aiO6S3W/QAKNVXagDtvsNtx7Ks+HKgo6U21B+QSZgIogV5Bt+BnXisdVfy9VyXV+2P5fMuvdpAjM1o/K9Z+XnE4EOCrue+kcdYHqAQ0/Y/OmNlQ6OI33jH/uD1RalPaHpJAm2av0/xtpqdXVKNDrc9F2izo23Wu7firgbURFDNX9eGGeYBhiypyXZft2j3hTvzE6PMWKsod//rEILDkzBXfi7xh0eFkfb3/1zzPK/PI5Nk3FbZyTl4mq5BfBoVoqiPHO4Q4QKZAlrQ3MdNfi3oxIjvsM3kAFv3fdufurqYR3PSwX/mpGy/GFI/B2MNPiNdOppWVbs/gjF3YH+QA9jMhlAbhvasAHstB0IJew09iAkmXHl1/TEj+jvHOpOGrPRQXbPADM+Ig2/OEcUcpgPTItMtW4DdqgfYVI/+4hAFWYjUGpOP/UwNuB7+BbKOcALbjobdgzeBQfjgNSp2GOpxzGLj70Vvq5cw2AoYENwKLUtJUX8sGRox4dVa/TN4xKwaKcl9XawQR/uNus700Hf17pyNnezrUgaY9e4MADhEDBpsJT6y1gDJs1q6wlwGhuUzGR7C8kgpjPyHWwsvrf3yn1zJEIRa5eSxoLAZOCR9xbuztxFRJW9ZmMYfCFJ0evm9F2fVnuje92Rc4Pl6A8bluN8MZyyJGZ0+sNSb//DvAFxC2BqlEsFwccWeAl6CyBcQV1bx4mQMBP1Jxqk1EUADNLeieS2dUFbQ/c/kvwItbZ7tx0st16viqd53WsRmPTKv2AD8CUnhtPWg5aUegNpsYgasaw2+EVooeNKmrW3MFtj76bYHJm5K9gpAXZXsE5U8DM8XmVOSJ1F1WnLy6nQup+jx52bAb+rCq6y9WXl2B2oZDhfDkW7H3oYfT/4xx5VncBuxMXP2lNfhUVQjSSzSRbuZFE4vFawlzveXxaYKVs8LpvAb8IRYF3ZHiRnm0ADeNPWocwxSzNseG7NrSEVZoHdKWqaGEBz1N8Pt7kFbqh3LYmAbm9i1IChIpLpM5AS6mr6OAPHMwwznVy61YpBYX8xZDN/a+lt7n+x5j4bNOVteZ8lj3hpAHSx1VR8vZHec4AHO9XFCdjZ9eRkSV65ljMmZVzaej2qFn/qt1lvWzNZEfHxK3qOJrHL6crr0CRzMox5f2e8ALBB4UGFZKA3tN6F6IXd32GTJXGQ7DTi9j/dNcLF9jCbDcWGKxoKTYblIwbLDReL00LRcDPMcQuXLMh5YzgtfjkFK1DP1iDzzYYVZz5M/kWYRlRpig1htVRjVCknm+h1M5LiEDXOyHREhvzCGpFZjHS0RsK27o2avgdilrJkalWqPW3D9gmwV37HKmfM3F8YZj2ar+vHFvf3B8CRoH4kDHIK9mrAg+owiEwNjjd9V+FsQKYR8czJrUkf7Qoi2YaW6EVDZp5zYlqiYtuXOTHk4fAcZ7qBbdLDiJq0WNV1l2+Hntk1mMWvxrYmc8kIx8G3rW36J6Ra4lLrTOCgiOihmow+YnzUT19jbV2B3RWqSHyxkhmgsBqMYWvOcUom1jDQ436+fcbu3xf2bbeqU/ca+C4DOKE+e3qvmeMqW3AxejfzBRFVcwVYPq4L0APSWWoJu+5UYX4qg5U6YTioqQGPG9XrnuZ/BkxuYpe6Li87+18EskyQW/uA+uk2rpHpr6hut2TlVbKgWkFpx+AZffweiw2+VittkEyf/ifinS/0ItRL2Jq3tQOcxPaWO2xrG68GdFoUpZgFXaP2wYVtRc6xYCfI1CaBqyWpg4bx8OHBQwsV4XWMibZZ0LYjWEy2IxQ1mZrf1/UNbYCJplWu3nZ4WpodIGVA05d+RWSS+ET9tH3RfGGmNI1cIY7evZZq7o+a0bjjygpmR3mVfalkT/SZGT27Q8QGalwGlDOS9VHCyFAIL0a1Q7JiW3saz9gqY8lqKynFrPCzxkU4SIfLc9VfCI5edgRhDXs0edO992nhTKHriREP1NJC6SROMgQ0xO5kNNZOhMOIT99AUElbxqeZF8A3xrfDJsWtDnUenAHdYWSwAbYjFqQZ+D5gi3hNK8CSxU9i6f6ClL9IGlj1OPMQAsr84YG6ijsJpCaGWj75c3yOZKBB9mNpQNPUKkK0D6wgLH8MGoyRxTX6Y05Q4AnYNXMZwXM4eij/9WpsM/9CoRnFQXGR6MEaY+FXvXEO3RO0JaStk6OXuHVATHJE+1W+TU3bSZ2ksMtqjO0zfSJCdBv7y2d8DMx6TfVme3q0ZpTKMMu4YL/t7ciTNtdDkwPogh3Cnjx7qk08SHwf+dksZ7M2vCOlfsF0hQ6J4ehPCaHTNrM/zBSOqD83dBEBCW/F/LEmeh0nOHd7oVl3/Qo/9GUDkkbj7yz+9cvvu+dDAtx8NzCDTP4iKdZvk9MWiizvtILLepysflSvTLFBZ37RLwiriqyRxYv/zrgFd/9XVHh/OmzBvDX4mitMR/lUavs2Vx6cR94lzAkplm3IRNy4TFfu47tuYs9EQPIPVta4P64tV+sZ7n3ued3cgEx2YK+QL5+xms6osk8qQbTyuKVGdaX9FQqk6qfDnT5ykxk0VK7KZ62b6DNDUfQlqGHxSMKv1P0XN5BqMeKG1P4Wp5QfZDUCEldppoX0U6ss2jIko2XpURKCIhfaOqLPfShdtS37ZrT+jFRSH2xYVV1rmT/MBtRQhxiO4MQ3iAGlaZi+9PWBEIXOVnu9jN1f921lWLZky9bqbM3J2MAAI9jmuAx3gyoEUa6P2ivs0EeNv/OR+AX6q5SW6l5HaoFuS6jr6yg9limu+P0KYKzfMXWcQSfTXzpOzKEKpwI3YGXZpSSy2LTlMgfmFA3CF6R5c9xWEtRuCg2ZPUQ2Nb6dRFTNd4TfGHrnEWSKHPuRyiJSDAZ+KX0VxmSHjGPbQTLVpqixia2uyhQ394gBMt7C3ZAmxn/DJS+l1fBsAo2Eir/C0jG9csd4+/tp12pPc/BVJGaK9mfvr7M/CeztrmCO5qY06Edi4xAGtiEhnWAbzLy2VEyazE1J5nPmgU4RpW4Sa0TnOT6w5lgt3/tMpROigHHmexBGAMY0mdcDbDxWIz41NgdD6oxgHsJRgr5RnT6wZAkTOcStU4NMOQNemSO7gxGahdEsC+NRVGxMUhQmmM0llWRbbmFGHzEqLM4Iw0H7577Kyo+Zf+2cUFIOw93gEY171vQaM0HLwpjpdRR6Jz7V0ckE7XzYJ0TmY9znLdzkva0vNrAGGT5SUZ5uaHDkcGvI0ySpwkasEgZPMseYcu85w8HPdSNi+4T6A83iAwDbxgeFcB1ZM2iGXzFcEOUlYVrEckaOyodfvaYSQ7GuB4ISE0nYJc15X/1ciDTPbPCgYJK55VkEor4LvzL9S2WDy4xj+6FOqVyTAC2ZNowheeeSI5hA/02l8UYkv4nk9iaVn+kCVEUstgk5Hyq+gJm6R9vG3rhuM904he/hFmNQaUIATB1y3vw+OmxP4X5Yi6A5I5jJufHCjF9+AGNwnEllZjUco6XhsO5T5+R3yxz5yLVOnAn0zuS+6zdj0nTJbEZCbXJdtpfYZfCeCOqJHoE2vPPFS6eRLjIJlG69X93nfR0mxSFXzp1Zc0lt/VafDaImhUMtbnqWVb9M4nGNQLN68BHP7AR8Il9dkcxzmBv8PCZlw9guY0lurbBsmNYlwJZsA/B15/HfkbjbwPddaVecls/elmDHNW2r4crAx43feNkfRwsaNq/yyJ0d/p5hZ6AZajz7DBfUok0ZU62gCzz7x8eVfJTKA8IWn45vINLSM1q+HF9CV9qF3zP6Ml21kPPL3CXzkuYUlnSqT+Ij4tI/od5KwIs+tDajDs64owN7tOAd6eucGz+KfO26iNcBFpbWA5732bBNWO4kHNpr9D955L61bvHCF/mwSrz6eQaDjfDEANqGMkFc+NGxpKZzCD2sj/JrHd+zlPQ8Iz7Q+2JVIiVCuCKoK/hlAEHzvk/Piq3mRL1rT/fEh9hoT5GJmeYswg1otiKydizJ/fS2SeKHVu6Z3JEHjiW8NaTQgP5xdBli8nC57XiN9hrquBu99hn9zqwo92+PM2JXtpeVZS0PdqR5mDyDreMMtEws+CpwaRyyzoYtfcvt9PJIW0fJVNNi/FFyRsea7peLvJrL+5b4GOXJ8tAr+ATk9f8KmiIsRhqRy0vFzwRV3Z5dZ3QqIU8JQ/uQpkJbjMUMFj2F9sCFeaBjI4+fL/oN3+LQgjI4zuAfQ+3IPIPFQBccf0clJpsfpnBxD84atwtupkGqKvrH7cGNl/QcWcSi6wcVDML6ljOgYbo+2BOAWNNjlUBPiyitUAwbnhFvLbnqw42kR3Yp2kv2dMeDdcGOX5kT4S6M44KHEB/SpCfl7xgsUvs+JNY9G3O2X/6FEt9FyAn57lrbiu+tl83sCymSvq9eZbe9mchL7MTf/Ta78e80zSf0hYY5eUU7+ff14jv7Xy8qjzfzzzvaJnrIdvFb5BLWKcWGy5/w7+vV2cvIfwHqdTB+RuJK5oj9mbt0Hy94AmjMjjwYNZlNS6uiyxNnwNyt3gdreLb64p/3+08nXkb92LTkkRgFOwk1oGEVllcOj5lv1hfAZywDows0944U8vUFw+A/nuVq/UCygsrmWIBnHyU01d0XJPwriEOvx/ISK6Pk4y2w0gmojZs7lU8TtakBAdne4v/aNxmMpK4VcGMp7si0yqsiolXRuOi1Z1P7SqD3Zmp0CWcyK4Ubmp2SXiXuI5nGLCieFHKHNRIlcY3Pys2dwMTYCaqlyWSITwr2oGXvyU3h1Pf8eQ3w1bnD7ilocVjYDkcXR3Oo1BXgMLTUjNw2xMVwjtp99NhSVc5aIWrDQT5DHPKtCtheBP4zHcw4dz2eRdTMamhlHhtfgqJJHI7NGDUw1XL8vsSeSHyKqDtqoAmrQqsYwvwi7HW3ojWyhIa5oz5xJTaq14NAzFLjVLR12rRNUQ6xohDnrWFb5bG9yf8aCD8d5phoackcNJp+Dw3Due3RM+5Rid7EuIgsnwgpX0rUWh/nqPtByMhMZZ69NpgvRTKZ62ViZ+Q7Dp5r4K0d7EfJuiy06KuIYauRh5Ecrhdt2QpTS1k1AscEHvapNbU3HL1F2TFyR33Wxb5MvH5iZsrn3SDcsxlnnshO8PLwmdGN+paWnQuORtZGX37uhFT64SeuPsx8UOokY6ON85WdQ1dki5zErsJGazcBOddWJEKqNPiJpsMD1GrVLrVY+AOdPWQneTyyP1hRX/lMM4ZogGGOhYuAdr7F/DOiAoc++cn5vlf0zkMUJ40Z1rlgv9BelPqVOpxKeOpzKdF8maK+1Vv23MO9k/8+qpLoxrIGH2EDQlnGmH8CD31G8QqlyQIcpmR5bwmSVw9/Ns6IHgulCRehvZ/+VrM60Cu/r3AontFfrljew74skYe2uyn7JKQtFQBQRJ9ryGic/zQOsbS4scUBctA8cPToQ3x6ZBQu6DPu5m1bnCtP8TllLYA0UTQNVqza5nfew3Mopy1GPUwG5jsl0OVXniPmAcmLqO5HG8Hv3nSLecE9oOjPDXcsTxoCBxYyzBdj4wmnyEV4kvFDunipS8SSkvdaMnTBN9brHUR8xdmmEAp/Pdqk9uextp1t+JrtXwpN/MG2w/qhRMpSNxQ1uhg/kKO30eQ/FyHUDkWHT8V6gGRU4DhDMxZu7xXij9Ui6jlpWmQCqJg3FkOTq3WKneCRYZxBXMNAVLQgHXSCGSqNdjebY94oyIpVjMYehAiFx/tqzBXFHZaL5PeeD74rW5OysFoUXY8sebUZleFTUa/+zBKVTFDopTReXNuZq47QjkWnxjirCommO4L/GrFtVV21EpMyw8wyThL5Y59d88xtlx1g1ttSICDwnof6lt/6zliPzgVUL8jWBjC0o2D6Kg+jNuThkAlaDJsq/AG2aKA//A76avw2KNqtv223P+Wq3StRDDNKFFgtsFukYt1GFDWooFVXitaNhb3RCyJi4cMeNjROiPEDb4k+G3+hD8tsg+5hhmSc/8t2JTSwYoCzAI75doq8QTHe+E/Tw0RQSUDlU+6uBeNN3h6jJGX/mH8oj0i3caCNsjvTnoh73BtyZpsflHLq6AfwJNCDX4S98h4+pCOhGKDhV3rtkKHMa3EG4J9y8zFWI4UsfNzC/Rl5midNn7gwoN9j23HGCQQ+OAZpTTPMdiVow740gIyuEtd0qVxMyNXhHcnuXRKdw5wDUSL358ktjMXmAkvIB73BLa1vfF9BAUZInPYJiwxqFWQQBVk7gQH4ojfUQ/KEjn+A/WR6EEe4CtbpoLe1mzHkajgTIoE0SLDHVauKhrq12zrAXBGbPPWKCt4DGedq3JyGRbmPFW32bE7T20+73BatV/qQhhBWfWBFHfhYWXjALts38FemnoT+9bn1jDBMcUMmYgSc0e7GQjv2MUBwLU8ionCpgV+Qrhg7iUIfUY6JFxR0Y+ZTCPM+rVuq0GNLyJXX6nrUTt8HzFBRY1E/FIm2EeVA9NcXrj7S6YYIChVQCWr/m2fYUjC4j0XLkzZ8GCSLfmkW3PB/xq+nlXsKVBOj7vTvqKCOMq7Ztqr3cQ+N8gBnPaAps+oGwWOkbuxnRYj/x/WjiDclVrs22xMK4qArE1Ztk1456kiJriw6abkNeRHogaPRBgbgF9Z8i/tbzWELN4CvbqtrqV9TtGSnmPS2F9kqOIBaazHYaJ9bi3AoDBvlZasMluxt0BDXfhp02Jn411aVt6S4TUB8ZgFDkI6TP6gwPY85w+oUQSsjIeXVminrwIdK2ZAawb8Se6XOJbOaliQxHSrnAeONDLuCnFejIbp4YDtBcQCwMsYiRZfHefuEJqJcwKTTJ8sx5hjHmJI1sPFHOr6W9AhZ2NAod38mnLQk1gOz2LCAohoQbgMbUK9RMEA3LkiF7Sr9tLZp6lkciIGhE2V546w3Mam53VtVkGbB9w0Yk2XiRnCmbpxmHr2k4eSC0RuNbjNsUfDIfc8DZvRvgUDe1IlKdZTzcT4ZGEb53dp8VtsoZlyXzLHOdAbsp1LPTVaHvLA0GYDFMbAW/WUBfUAdHwqLFAV+3uHvYWrCfhUOR2i89qvCBoOb48usAGdcF2M4aKn79k/43WzBZ+xR1L0uZfia70XP9soQReeuhZiUnXFDG1T8/OXNmssTSnYO+3kVLAgeiY719uDwL9FQycgLPessNihMZbAKG7qwPZyG11G1+ZA3jAX2yddpYfmaKBlmfcK/V0mwIRUDC0nJSOPUl2KB8h13F4dlVZiRhdGY5farwN+f9hEb1cRi41ZcGDn6Xe9MMSTOY81ULJyXIHSWFIQHstVYLiJEiUjktlHiGjntN5/btB8Fu+vp28zl2fZXN+dJDyN6EXhS+0yzqpl/LSJNEUVxmu7BsNdjAY0jVsAhkNuuY0E1G48ej25mSt+00yPbQ4SRCVkIwb6ISvYtmJRPz9Zt5dk76blf+lJwAPH5KDF+vHAmACLoCdG2Adii6dOHnNJnTmZtoOGO8Q1jy1veMw6gbLFToQmfJa7nT7Al89mRbRkZZQxJTKgK5Kc9INzmTJFp0tpAPzNmyL/F08bX3nhCumM/cR/2RPn9emZ3VljokttZD1zVWXlUIqEU7SLk5I0lFRU0AcENXBYazNaVzsVHA/sD3o9hm42wbHIRb/BBQTKzAi8s3+bMtpOOZgLdQzCYPfX3UUxKd1WYVkGH7lh/RBBgMZZwXzU9+GYxdBqlGs0LP+DZ5g2BWNh6FAcR944B+K/JTWI3t9YyVyRhlP4CCoUk/mmF7+r2pilVBjxXBHFaBfBtr9hbVn2zDuI0kEOG3kBx8CGdPOjX1ph1POOZJUO1JEGG0jzUy2tK4X0CgVNYhmkqqQysRNtKuPdCJqK3WW57kaV17vXgiyPrl4KEEWgiGF1euI4QkSFHFf0TDroQiLNKJiLbdhH0YBhriRNCHPxSqJmNNoketaioohqMglh6wLtEGWSM1EZbQg72h0UJAIPVFCAJOThpQGGdKfFovcwEeiBuZHN2Ob4uVM7+gwZLz1D9E7ta4RmMZ24OBBAg7Eh6dLXGofZ4U2TFOCQMKjwhVckjrydRS+YaqCw1kYt6UexuzbNEDyYLTZnrY1PzsHZJT4U+awO2xlqTSYu6n/U29O2wPXgGOEKDMSq+zTUtyc8+6iLp0ivav4FKx+xxVy4FxhIF/pucVDqpsVe2jFOfdZhTzLz2QjtzvsTCvDPU7bzDH2eXVKUV9TZ+qFtaSSxnYgYdXKwVreIgvWhT9eGDB2OvnWyPLfIIIfNnfIxU8nW7MbcH05nhlsYtaW9EZRsxWcKdEqInq1DiZPKCz7iGmAU9/ccnnQud2pNgIGFYOTAWjhIrd63aPDgfj8/sdlD4l+UTlcxTI9jbaMqqN0gQxSHs60IAcW3cH4p3V1aSciTKB29L1tz2eUQhRiTgTvmqc+sGtBNh4ky0mQJGsdycBREP+fAaSs1EREDVo5gvgi5+aCN7NECw30owbCc1mSpjiahyNVwJd1jiGgzSwfTpzf2c5XJvG/g1n0fH88KHNnf+u7ZiRMlXueSIsloJBUtW9ezvsx9grfsX/FNxnbxU1Lvg0hLxixypHKGFAaPu0xCD8oDTeFSyfRT6s8109GMUZL8m2xXp8X2dpPCWWdX84iga4BrTlOfqox4shqEgh/Ht4qRst52cA1xOIUuOxgfUivp6v5f8IVyaryEdpVk72ERAwdT4aoY1usBgmP+0m06Q216H/nubtNYxHaOIYjcach3A8Ez/zc0KcShhel0HCYjFsA0FjYqyJ5ZUH1aZw3+zWC0hLpM6GDfcAdn9fq2orPmZbW6XXrf+Krc9RtvII5jeD3dFoT1KwZJwxfUMvc5KLfn8rROW23Jw89sJ2a5dpB3qWDUBWF2iX8OCuKprHosJ2mflBR+Wqs86VvgI/XMnsqb97+VlKdPVysczPj8Jhzf+WCvGBHijAqYlavbF60soMWlHbvKT+ScvhprgeTln51xX0sF+Eadc/l2s2a5BgkVbHYyz0E85p0LstqH+gEGiR84nBRRFIn8hLSZrGwqjZ3E29cuGi+5Z5bp7EM8MWFa9ssS/vy4VrDfECSv7DSU84DaP0sXI3Ap4lWznQ65nQoTKRWU30gd7Nn8ZowUvGIx4aqyXGwmA/PB4qN8msJUODezUHEl0VP9uo+cZ8vPFodSIB4C7lQYjEFj8yu49C2KIV3qxMFYTevG8KqAr0TPlkbzHHnTpDpvpzziAiNFh8xiT7C/TiyH0EguUw4vxAgpnE27WIypV+uFN2zW7xniF/n75trs9IJ5amB1zXXZ1LFkJ6GbS/dFokzl4cc2mamVwhL4XU0Av5gDWAl+aEWhAP7t2VIwU+EpvfOPDcLASX7H7lZpXA2XQfbSlD4qU18NffNPoAKMNSccBfO9YVVgmlW4RydBqfHAV7+hrZ84WJGho6bNT0YMhxxLdOx/dwGj0oyak9aAkNJ8lRJzUuA8sR+fPyiyTgUHio5+Pp+YaKlHrhR41jY5NESPS3x+zTMe0S2HnLOKCOQPpdxKyviBvdHrCDRqO+l96HhhNBLXWv4yEMuEUYo8kXnYJM8oIgVM4XJ+xXOev4YbWeqsvgq0lmw4/PiYr9sYLt+W5EAuYSFnJEan8CwJwbtASBfLBBpJZiRPor/aCJBZsM+MhvS7ZepyHvU8m5WSmaZnxuLts8ojl6KkS8oSAHkq5GWlCB/NgJ5W3rO2Cj1MK7ahxsCrbTT3a0V/QQH+sErxV4XUWDHx0kkFy25bPmBMBQ6BU3HoHhhYcJB9JhP6NXUWKxnE0raXHB6U9KHpWdQCQI72qevp5fMzcm+AvC85rsynVQhruDA9fp9COe7N56cg1UKGSas89vrN+WlGLYTwi5W+0xYdKEGtGCeNJwXKDU0XqU5uQYnWsMwTENLGtbQMvoGjIFIEMzCRal4rnBAg7D/CSn8MsCvS+FDJJAzoiioJEhZJgAp9n2+1Yznr7H+6eT4YkJ9Mpj60ImcW4i4iHDLn9RydB8dx3QYm3rsX6n4VRrZDsYK6DCGwkwd5n3/INFEpk16fYpP6JtMQpqEMzcOfQGAHXBTEGzuLJ03GYQL9bmV2/7ExDlRf+Uvf1sM2frRtCWmal12pMgtonvSCtR4n1CLUZRdTHDHP1Otwqd+rcdlavnKjUB/OYXQHUJzpNyFoKpQK+2OgrEKpGyIgIBgn2y9QHnTJihZOpEvOKIoHAMGAXHmj21Lym39Mbiow4IF+77xNuewziNVBxr6KD5e+9HzZSBIlUa/AmsDFJFXeyrQakR3FwowTGcADJHcEfhGkXYNGSYo4dh4bxwLM+28xjiqkdn0/3R4UEkvcBrBfn/SzBc1XhKM2VPlJgKSorjDac96V2UnQYXl1/yZPT4DVelgO+soMjexXwYO58VLl5xInQUZI8jc3H2CPnCNb9X05nOxIy4MlecasTqGK6s2az4RjpF2cQP2G28R+7wDPsZDZC/kWtjdoHC7SpdPmqQrUAhMwKVuxCmYTiD9q/O7GHtZvPSN0CAUQN/rymXZNniYLlJDE70bsk6Xxsh4kDOdxe7A2wo7P9F5YvqqRDI6brf79yPCSp4I0jVoO4YnLYtX5nzspR5WB4AKOYtR1ujXbOQpPyYDvfRE3FN5zw0i7reehdi7yV0YDRKRllGCGRk5Yz+Uv1fYl2ZwrnGsqsjgAVo0xEUba8ohjaNMJNwTwZA/wBDWFSCpg1eUH8MYL2zdioxRTqgGQrDZxQyNzyBJPXZF0+oxITJAbj7oNC5JwgDMUJaM5GqlGCWc//KCIrI+aclEe4IA0uzv7cuj6GCdaJONpi13O544vbtIHBF+A+JeDFUQNy61Gki3rtyQ4aUywn6ru314/dkGiP8Iwjo0J/2Txs49ZkwEl4mx+iYUUO55I6pJzU4P+7RRs+DXZkyKUYZqVWrPF4I94m4Wx1tXeE74o9GuX977yvJ/jkdak8+AmoHVjI15V+WwBdARFV2IPirJgVMdsg1Pez2VNHqa7EHWdTkl3XTcyjG9BiueWFvQfXI8aWSkuuRmqi/HUuzqyvLJfNfs0txMqldYYflWB1BS31WkuPJGGwXUCpjiQSktkuBMWwHjSkQxeehqw1Kgz0Trzm7QbtgxiEPDVmWCNCAeCfROTphd1ZNOhzLy6XfJyG6Xgd5MCAZw4xie0Sj5AnY1/akDgNS9YFl3Y06vd6FAsg2gVQJtzG7LVq1OH2frbXNHWH/NY89NNZ4QUSJqL2yEcGADbT38X0bGdukqYlSoliKOcsSTuqhcaemUeYLLoI8+MZor2RxXTRThF1LrHfqf/5LcLAjdl4EERgUysYS2geE+yFdasU91UgUDsc2cSQ1ZoT9+uLOwdgAmifwQqF028INc2IQEDfTmUw3eZxvz7Ud1z3xc1PQfeCvfKsB9jOhRj7rFyb9XcDWLcYj0bByosychMezMLVkFiYcdBBQtvI6K0KRuOZQH2kBsYHJaXTkup8F0eIhO1/GcIwWKpr2mouB7g5TUDJNvORXPXa/mU8bh27TAZYBe2sKx4NSv5OjnHIWD2RuysCzBlUfeNXhDd2jxnHoUlheJ3jBApzURy0fwm2FwwsSU0caQGl0Kv8hopRQE211NnvtLRsmCNrhhpEDoNiZEzD2QdJWKbRRWnaFedXHAELSN0t0bfsCsMf0ktfBoXBoNA+nZN9+pSlmuzspFevmsqqcMllzzvkyXrzoA+Ryo1ePXpdGOoJvhyru+EBRsmOp7MXZ0vNUMUqHLUoKglg1p73sWeZmPc+KAw0pE2zIsFFE5H4192KwDvDxdxEYoDBDNZjbg2bmADTeUKK57IPD4fTYF4c6EnXx/teYMORBDtIhPJneiZny7Nv/zG+YmekIKCoxr6kauE2bZtBLufetNG0BtBY7f+/ImUypMBvdWu/Q7vTMRzw5aQGZWuc1V0HEsItFYMIBnoKGZ0xcarba/TYZq50kCaflFysYjA4EDKHqGdpYWdKYmm+a7TADmW35yfnOYpZYrkpVEtiqF0EujI00aeplNs2k+qyFZNeE3CDPL9P6b4PQ/kataHkVpLSEVGK7EX6rAa7IVNrvZtFvOA6okKvBgMtFDAGZOx88MeBcJ8AR3AgUUeIznAN6tjCUipGDZONm1FjWJp4A3QIzSaIOmZ7DvF/ysYYbM/fFDOV0jntAjRdapxJxL0eThpEhKOjCDDq2ks+3GrwxqIFKLe1WdOzII8XIOPGnwy6LKXVfpSDOTEfaRsGujhpS4hBIsMOqHbl16PJxc4EkaVu9wpEYlF/84NSv5Zum4drMfp9yXbzzAOJqqS4YkI4cBrFrC7bMPiCfgI3nNZAqkk3QOZqR+yyqx+nDQKBBBZ7QKrfGMCL+XpqFaBJU0wpkBdAhbR4hJsmT5aynlvkouoxm/NjD5oe6BzVIO9uktM+/5dEC5P7vZvarmuO/lKXz4sBabVPIATuKTrwbJP8XUkdM6uEctHKXICUJGjaZIWRbZp8czquQYfY6ynBUCfIU+gG6wqSIBmYIm9pZpXdaL121V7q0VjDjmQnXvMe7ysoEZnZL15B0SpxS1jjd83uNIOKZwu5MPzg2NhOx3xMOPYwEn2CUzbSrwAs5OAtrz3GAaUkJOU74XwjaYUmGJdZBS1NJVkGYrToINLKDjxcuIlyfVsKQSG/G4DyiO2SlQvJ0d0Ot1uOG5IFSAkq+PRVMgVMDvOIJMdqjeCFKUGRWBW9wigYvcbU7CQL/7meF2KZAaWl+4y9uhowAX7elogAvItAAxo2+SFxGRsHGEW9BnhlTuWigYxRcnVUBRQHV41LV+Fr5CJYV7sHfeywswx4XMtUx6EkBhR+q8AXXUA8uPJ73Pb49i9KG9fOljvXeyFj9ixgbo6CcbAJ7WHWqKHy/h+YjBwp6VcN7M89FGzQ04qbrQtgrOFybg3gQRTYG5xn73ArkfQWjCJROwy3J38Dx/D7jOa6BBNsitEw1wGq780EEioOeD+ZGp2J66ADiVGMayiHYucMk8nTK2zzT9CnEraAk95kQjy4k0GRElLL5YAKLQErJ5rp1eay9O4Fb6yJGm9U4FaMwPGxtKD6odIIHKoWnhKo1U8KIpFC+MVn59ZXmc7ZTBZfsg6FQ8W10YfTr4u0nYrpHZbZ1jXiLmooF0cOm0+mPnJBXQtepc7n0BqOipNCqI6yyloTeRShNKH04FIo0gcMk0H/xThyN4pPAWjDDkEp3lNNPRNVfpMI44CWRlRgViP64eK0JSRp0WUvCWYumlW/c58Vcz/yMwVcW5oYb9+26TEhwvbxiNg48hl1VI1UXTU//Eta+BMKnGUivctfL5wINDD0giQL1ipt6U7C9cd4+lgqY2lMUZ02Uv6Prs+ZEZer7ZfWBXVghlfOOrClwsoOFKzWEfz6RZu1eCs+K8fLvkts5+BX0gyrFYve0C3qHrn5U/Oh6D/CihmWIrY7HUZRhJaxde+tldu6adYJ+LeXupQw0XExC36RETdNFxcq9glMu4cNQSX9cqR/GQYp+IxUkIcNGWVU7ZtGa6P3XAyodRt0XeS3Tp01AnCh0ZbUh4VrSZeV9RWfSoWyxnY3hzcZ30G/InDq4wxRrEejreBxnhIQbkxenxkaxl+k7eLUQkUR6vKJ2iDFNGX3WmVA1yaOH+mvhBd+sE6vacQzFobwY5BqEAFmejwW5ne7HtVNolOUgJc8CsUxmc/LBi8N5mu9VsIA5HyErnS6zeCz7VLI9+n/hbT6hTokMXTVyXJRKSG2hd2labXTbtmK4fNH3IZBPreSA4FMeVouVN3zG5x9CiGpLw/3pceo4qGqp+rVp+z+7yQ98oEf+nyH4F3+J9IheDBa94Wi63zJbLBCIZm7P0asHGpIJt3PzE3m0S4YIWyXBCVXGikj8MudDPB/6Nm2v4IxJ5gU0ii0guy5SUHqGUYzTP0jIJU5E82RHUXtX4lDdrihBLdP1YaG1AGUC12rQKuIaGvCpMjZC9bWSCYnjDlvpWbkdXMTNeBHLKiuoozMGIvkczmP0aRJSJ8PYnLCVNhKHXBNckH79e8Z8Kc2wUej4sQZoH8qDRGkg86maW/ZQWGNnLcXmq3FlXM6ssR/3P6E/bHMvm6HLrv1yRixit25JsH3/IOr2UV4BWJhxXW5BJ6Xdr07n9kF3ZNAk6/Xpc5MSFmYJ2R7bdL8Kk7q1OU9Elg/tCxJ8giT27wSTySF0GOxg4PbYJdi/Nyia9Nn89CGDulfJemm1aiEr/eleGSN+5MRrVJ4K6lgyTTIW3i9cQ0dAi6FHt0YMbH3wDSAtGLSAccezzxHitt1QdhW36CQgPcA8vIIBh3/JNjf/Obmc2yzpk8edSlS4lVdwgW5vzbYEyFoF4GCBBby1keVNueHAH+evi+H7oOVfS3XuPQSNTXOONAbzJeSb5stwdQHl1ZjrGoE49I8+A9j3t+ahhQj74FCSWpZrj7wRSFJJnnwi1T9HL5qrCFW/JZq6P62XkMWTb+u4lGpKfmmwiJWx178GOG7KbrZGqyWwmuyKWPkNswkZ1q8uptUlviIi+AXh2bOOTOLsrtNkfqbQJeh24reebkINLkjut5r4d9GR/r8CBa9SU0UQhsnZp5cP+RqWCixRm7i4YRFbtZ4EAkhtNa6jHb6gPYQv7MKqkPLRmX3dFsK8XsRLVZ6IEVrCbmNDc8o5mqsogjAQfoC9Bc7R6gfw03m+lQpv6kTfhxscDIX6s0w+fBxtkhjXAXr10UouWCx3C/p/FYwJRS/AXRKkjOb5CLmK4XRe0+xeDDwVkJPZau52bzLEDHCqV0f44pPgKOkYKgTZJ33fmk3Tu8SdxJ02SHM8Fem5SMsWqRyi2F1ynfRJszcFKykdWlNqgDA/L9lKYBmc7Zu/q9ii1FPF47VJkqhirUob53zoiJtVVRVwMR34gV9iqcBaHbRu9kkvqk3yMpfRFG49pKKjIiq7h/VpRwPGTHoY4cg05X5028iHsLvUW/uz+kjPyIEhhcKUwCkJAwbR9pIEGOn8z6svAO8i89sJ3dL5qDWFYbS+HGPRMxYwJItFQN86YESeJQhn2urGiLRffQeLptDl8dAgb+Tp47UQPxWOw17OeChLN1WnzlkPL1T5O+O3Menpn4C3IY5LEepHpnPeZHbvuWfeVtPlkH4LZjPbBrkJT3NoRJzBt86CO0Xq59oQ+8dsm0ymRcmQyn8w71mhmcuEI5byuF+C88VPYly2sEzjlzAQ3vdn/1+Hzguw6qFNNbqenhZGbdiG6RwZaTG7jTA2X9RdXjDN9yj1uQpyO4Lx8KRAcZcbZMafp4wPOd5MdXoFY52V1A8M9hi3sso93+uprE0qYNMjkE22CvK4HuUxqN7oIz5pWuETq1lQAjqlSlqdD2Rnr/ggp/TVkQYjn9lMfYelk2sH5HPdopYo7MHwlV1or9Bxf+QCyLzm92vzG2wjiIjC/ZHEJzeroJl6bdFPTpZho5MV2U86fLQqxNlGIMqCGy+9WYhJ8ob1r0+Whxde9L2PdysETv97O+xVw+VNN1TZSQN5I6l9m5Ip6pLIqLm4a1B1ffH6gHyqT9p82NOjntRWGIofO3bJz5GhkvSWbsXueTAMaJDou99kGLqDlhwBZNEQ4mKPuDvVwSK4WmLluHyhA97pZiVe8g+JxmnJF8IkV/tCs4Jq/HgOoAEGR9tCDsDbDmi3OviUQpG5D8XmKcSAUaFLRXb2lmJTNYdhtYyfjBYZQmN5qT5CNuaD3BVnlkCk7bsMW3AtXkNMMTuW4HjUERSJnVQ0vsBGa1wo3Qh7115XGeTF3NTz8w0440AgU7c3bSXO/KMINaIWXd0oLpoq/0/QJxCQSJ9XnYy1W7TYLBJpHsVWD1ahsA7FjNvRd6mxCiHsm8g6Z0pnzqIpF1dHUtP2ITU5Z1hZHbu+L3BEEStBbL9XYvGfEakv1bmf+bOZGnoiuHEdlBnaChxYKNzB23b8sw8YyT7Ajxfk49eJIAvdbVkdFCe2J0gMefhQ0bIZxhx3fzMIysQNiN8PgOUKxOMur10LduigREDRMZyP4oGWrP1GFY4t6groASsZ421os48wAdnrbovNhLt7ScNULkwZ5AIZJTrbaKYTLjA1oJ3sIuN/aYocm/9uoQHEIlacF1s/TM1fLcPTL38O9fOsjMEIwoPKfvt7opuI9G2Hf/PR4aCLDQ7wNmIdEuXJ/QNL72k5q4NejAldPfe3UVVqzkys8YZ/jYOGOp6c+YzRCrCuq0M11y7TiN6qk7YXRMn/gukxrEimbMQjr3jwRM6dKVZ4RUfWQr8noPXLJq6yh5R3EH1IVOHESst/LItbG2D2vRsZRkAObzvQAAD3mb3/G4NzopI0FAiHfbpq0X72adg6SRj+8OHMShtFxxLZlf/nLgRLbClwl5WmaYSs+yEjkq48tY7Z2bE0N91mJwt+ua0NlRJIDh0HikF4UvSVorFj2YVu9YeS5tfvlVjPSoNu/Zu6dEUfBOT555hahBdN3Sa5Xuj2Rvau1lQNIaC944y0RWj9UiNDskAK1WoL+EfXcC6IbBXFRyVfX/WKXxPAwUyIAGW8ggZ08hcijKTt1YKnUO6QPvcrmDVAb0FCLIXn5id4fD/Jx4tw/gbXs7WF9b2RgXtPhLBG9vF5FEkdHAKrQHZAJC/HWvk7nvzzDzIXZlfFTJoC3JpGgLPBY7SQTjGlUvG577yNutZ1hTfs9/1nkSXK9zzKLRZ3VODeKUovJe0WCq1zVMYxCJMenmNzPIU2S8TA4E7wWmbNkxq9rI2dd6v0VpcAPVMxnDsvWTWFayyqvKZO7Z08a62i/oH2/jxf8rpmfO64in3FLiL1GX8IGtVE9M23yGsIqJbxDTy+LtaMWDaPqkymb5VrQdzOvqldeU0SUi6IirG8UZ3jcpRbwHa1C0Dww9G/SFX3gPvTJQE+kyz+g1BeMILKKO+olcHzctOWgzxYHnOD7dpCRtuZEXACjgqesZMasoPgnuDC4nUviAAxDc5pngjoAITIkvhKwg5d608pdrZcA+qn5TMT6Uo/QzBaOxBCLTJX3Mgk85rMfsnWx86oLxf7p2PX5ONqieTa/qM3tPw4ZXvlAp83NSD8F7+ZgctK1TpoYwtiU2h02HCGioH5tkVCqNVTMH5p00sRy2JU1qyDBP2CII/Dg4WDsIl+zgeX7589srx6YORRQMBfKbodbB743Tl4WLKOEnwWUVBsm94SOlCracU72MSyj068wdpYjyz1FwC2bjQnxnB6Mp/pZ+yyZXtguEaYB+kqhjQ6UUmwSFazOb+rhYjLaoiM+aN9/8KKn0zaCTFpN9eKwWy7/u4EHzO46TdFSNjMfn2iPSJwDPCFHc0I1+vjdAZw5ZjqR/uzi9Zn20oAa5JnLEk/EA3VRWE7J/XrupfFJPtCUuqHPpnlL7ISJtRpSVcB8qsZCm2QEkWoROtCKKxUh3yEcMbWYJwk6DlEBG0bZP6eg06FL3v6RPb7odGuwm7FN8fG4woqtB8e7M5klPpo97GoObNwt+ludTAmxyC5hmcFx+dIvEZKI6igFKHqLH01iY1o7903VzG9QGetyVx5RNmBYUU+zIuSva/yIcECUi4pRmE3VkF2avqulQEUY4yZ/wmNboBzPmAPey3+dSYtBZUjeWWT0pPwCz4Vozxp9xeClIU60qvEFMQCaPvPaA70WlOP9f/ey39macvpGCVa+zfa8gO44wbxpJUlC8GN/pRMTQtzY8Z8/hiNrU+Zq64ZfFGIkdj7m7abcK1EBtws1X4J/hnqvasPvvDSDYWN+QcQVGMqXalkDtTad5rYY0TIR1Eqox3czwPMjKPvF5sFv17Thujr1IZ1Ytl4VX1J0vjXKmLY4lmXipRAro0qVGEcXxEVMMEl54jQMd4J7RjgomU0j1ptjyxY+cLiSyXPfiEcIS2lWDK3ISAy6UZ3Hb5vnPncA94411jcy75ay6B6DSTzK6UTCZR9uDANtPBrvIDgjsfarMiwoax2OlLxaSoYn4iRgkpEGqEkwox5tyI8aKkLlfZ12lO11TxsqRMY89j5JaO55XfPJPDL1LGSnC88Re9Ai+Nu5bZjtwRrvFITUFHPR4ZmxGslQMecgbZO7nHk32qHxYkdvWpup07ojcMCaVrpFAyFZJJbNvBpZfdf39Hdo2kPtT7v0/f8R/B5Nz4f1t9/3zNM/7n6SUHfcWk5dfQFJvcJMgPolGCpOFb/WC0FGWU2asuQyT+rm88ZKZ78Cei/CAh939CH0JYbpZIPtxc2ufXqjS3pHH9lnWK4iJ7OjR/EESpCo2R3MYKyE7rHfhTvWho4cL1QdN4jFTyR6syMwFm124TVDDRXMNveI1Dp/ntwdz8k8kxw7iFSx6+Yx6O+1LzMVrN0BBzziZi9kneZSzgollBnVwBh6oSOPHXrglrOj+QmR/AESrhDpKrWT+8/AiMDxS/5wwRNuGQPLlJ9ovomhJWn8sMLVItQ8N/7IXvtD8kdOoHaw+vBSbFImQsv/OCAIui99E+YSIOMlMvBXkAt+NAZK8wB9Jf8CPtB+TOUOR+z71d/AFXpPBT6+A5FLjxMjLIEoJzrQfquvxEIi+WoUzGR1IzQFNvbYOnxb2PyQ0kGdyXKzW2axQL8lNAXPk6NEjqrRD1oZtKLlFoofrXw0dCNWASHzy+7PSzOUJ3XtaPZsxLDjr+o41fKuKWNmjiZtfkOzItvlV2MDGSheGF0ma04qE3TUEfqJMrXFm7DpK+27DSvCUVf7rbNoljPhha5W7KBqVq0ShUSTbRmuqPtQreVWH4JET5yMhuqMoSd4r/N8sDmeQiQQvi1tcZv7Moc7dT5X5AtCD6kNEGZOzVcNYlpX4AbTsLgSYYliiPyVoniuYYySxsBy5cgb3pD+EK0Gpb0wJg031dPgaL8JZt6sIvzNPEHfVPOjXmaXj4bd4voXzpZ5GApMhILgMbCEWZ2zwgdeQgjNHLbPIt+KqxRwWPLTN6HwZ0Ouijj4UF+Sg0Au8XuIKW0WxlexdrFrDcZJ8Shauat3X0XmHygqgL1nAu2hrJFb4wZXkcS+i36KMyU1yFvYv23bQUJi/3yQpqr/naUOoiEWOxckyq/gq43dFou1DVDaYMZK9tho7+IXXokBCs5GRfOcBK7g3A+jXQ39K4YA8PBRW4m5+yR0ZAxWJncjRVbITvIAPHYRt1EJ3YLiUbqIvoKHtzHKtUy1ddRUQ0AUO41vonZDUOW+mrszw+SW/6Q/IUgNpcXFjkM7F4CSSQ2ExZg85otsMs7kqsQD4OxYeBNDcSpifjMoLb7GEbGWTwasVObmB/bfPcUlq0wYhXCYEDWRW02TP5bBrYsKTGWjnWDDJ1F7zWai0zW/2XsCuvBQjPFcTYaQX3tSXRSm8hsAoDdjArK/OFp6vcWYOE7lizP0Yc+8p16i7/NiXIiiQTp7c7Xus925VEtlKAjUdFhyaiLT7VxDagprMFwix4wZ05u0qj7cDWFd0W9OYHIu3JbJKMXRJ1aYNovugg+QqRN7fNHSi26VSgBpn+JfMuPo3aeqPWik/wI5Rz3BWarPQX4i5+dM0npwVOsX+KsOhC7vDg+OJsz4Q5zlnIeflUWL6QYMbf9WDfLmosLF4Qev3mJiOuHjoor/dMeBpA9iKDkMjYBNbRo414HCxjsHrB4EXNbHzNMDHCLuNBG6Sf+J4MZ/ElVsDSLxjIiGsTPhw8BPjxbfQtskj+dyNMKOOcUYIRBEIqbazz3lmjlRQhplxq673VklMMY6597vu+d89ec/zq7Mi4gQvh87ehYbpOuZEXj5g/Q7S7BFDAAB9DzG35SC853xtWVcnZQoH54jeOqYLR9NDuwxsVthTV7V99n/B7HSbAytbEyVTz/5NhJ8gGIjG0E5j3griULUd5Rg7tQR+90hJgNQKQH2btbSfPcaTOfIexc1db1BxUOhM1vWCpLaYuKr3FdNTt/T3PWCpEUWDKEtzYrjpzlL/wri3MITKsFvtF8QVV/NhVo97aKIBgdliNc10dWdXVDpVtsNn+2UIolrgqdWA4EY8so0YvB4a+aLzMXiMAuOHQrXY0tr+CL10JbvZzgjJJuB1cRkdT7DUqTvnswVUp5kkUSFVtIIFYK05+tQxT6992HHNWVhWxUsD1PkceIrlXuUVRogwmfdhyrf6zzaL8+c0L7GXMZOteAhAVQVwdJh+7nrX7x4LaIIfz2F2v7Dg/uDfz2Fa+4gFm2zHAor8UqimJG3VTJtZEoFXhnDYXvxMJFc6ku2bhbCxzij2z5UNuK0jmp1mnvkVNUfR+SEmj1Lr94Lym75PO7Fs0MIr3GdsWXRXSfgLTVY0FLqba97u1In8NAcY7IC6TjWLigwKEIm43NxTdaVTv9mcKkzuzBkKd8x/xt1p/9BbP7Wyb4bpo1K1gnOpbLvKz58pWl3B55RJ/Z5mRDLPtNQg14jdOEs9+h/V5UVpwrAI8kGbX8KPVPDIMfIqKDjJD9UyDOPhjZ3vFAyecwyq4akUE9mDOtJEK1hpDyi6Ae87sWAClXGTiwPwN7PXWwjxaR79ArHRIPeYKTunVW24sPr/3HPz2IwH8oKH4OlWEmt4BLM6W5g4kMcYbLwj2usodD1088stZA7VOsUSpEVl4w7NMb1EUHMRxAxLF0CIV+0L3iZb+ekB1vSDSFjAZ3hfLJf7gFaXrOKn+mhR+rWw/eTXIcAgl4HvFuBg1LOmOAwJH3eoVEjjwheKA4icbrQCmvAtpQ0mXG0agYp5mj4Rb6mdQ+RV4QBPbxMqh9C7o8nP0Wko2ocnCHeRGhN1XVyT2b9ACsL+6ylUy+yC3QEnaKRIJK91YtaoSrcWZMMwxuM0E9J68Z+YyjA0g8p1PfHAAIROy6Sa04VXOuT6A351FOWhKfTGsFJ3RTJGWYPoLk5FVK4OaYR9hkJvezwF9vQN1126r6isMGXWTqFW+3HL3I/jurlIdDWIVvYY+s6yq7lrFSPAGRdnU7PVwY/SvWbZGpXzy3BQ2LmAJlrONUsZs4oGkly0V267xbD5KMY8woNNsmWG1VVgLCra8aQBBcI4DP2BlNwxhiCtHlaz6OWFoCW0vMR3ErrG7JyMjTSCnvRcsEHgmPnwA6iNpJ2DrFb4gLlhKJyZGaWkA97H6FFdwEcLT6DRQQL++fOkVC4cYGW1TG/3iK5dShRSuiBulmihqgjR45Vi03o2RbQbP3sxt90VxQ6vzdlGfkXmmKmjOi080JSHkLntjvsBJnv7gKscOaTOkEaRQqAnCA4HWtB4XnMtOhpRmH2FH8tTXrIjAGNWEmudQLCkcVlGTQ965Kh0H6ixXbgImQP6b42B49sO5C8pc7iRlgyvSYvcnH9FgQ3azLbQG2cUW96SDojTQStxkOJyOuDGTHAnnWkz29aEwN9FT8EJ4yhXOg+jLTrCPKeEoJ9a7lDXOjEr8AgX4BmnMQ668oW0zYPyQiVMPxKRHtpfnEEyaKhdzNVThlxxDQNdrHeZiUFb6NoY2KwvSb7BnRcpJy+/g/zAYx3fYSN5QEaVD2Y1VsNWxB0BSO12MRsRY8JLfAezRMz5lURuLUnG1ToKk6Q30FughqWN6gBNcFxP/nY/iv+iaUQOa+2Nuym46wtI/DvSfzSp1jEi4SdYBE7YhTiVV5cX9gwboVDMVgZp5YBQlHOQvaDNfcCoCJuYhf5kz5kwiIKPjzgpcRJHPbOhJajeoeRL53cuMahhV8Z7IRr6M4hW0JzT7mzaMUzQpm866zwM7Cs07fJYXuWvjAMkbe5O6V4bu71sOG6JQ4oL8zIeXHheFVavzxmlIyBkgc9IZlEDplMPr8xlcyss4pVUdwK1e7CK2kTsSdq7g5SHRAl3pYUB9Ko4fsh4qleOyJv1z3KFSTSvwEcRO/Ew8ozEDYZSqpfoVW9uhJfYrNAXR0Z3VmeoAD+rVWtwP/13sE/3ICX3HhDG3CMc476dEEC0K3umSAD4j+ZQLVdFOsWL2C1TH5+4KiSWH+lMibo+B55hR3Gq40G1n25sGcN0mEcoU2wN9FCVyQLBhYOu9aHVLWjEKx2JIUZi5ySoHUAI9b8hGzaLMxCZDMLhv8MkcpTqEwz9KFDpCpqQhVmsGQN8m24wyB82FAKNmjgfKRsXRmsSESovAwXjBIoMKSG51p6Um8b3i7GISs7kjTq/PZoioCfJzfKdJTN0Q45kQEQuh9H88M3yEs3DbtRTKALraM0YC8laiMiOOe6ADmTcCiREeAWZelBaEXRaSuj2lx0xHaRYqF65O0Lo5OCFU18A8cMDE4MLYm9w2QSr9NgQAIcRxZsNpA7UJR0e71JL+VU+ISWFk5I97lra8uGg7GlQYhGd4Gc6rxsLFRiIeGO4abP4S4ekQ1fiqDCy87GZHd52fn5aaDGuvOmIofrzpVwMvtbreZ/855OaXTRcNiNE0wzGZSxbjg26v8ko8L537v/XCCWP2MFaArJpvnkep0pA+O86MWjRAZPQRfznZiSIaTppy6m3p6HrNSsY7fDtz7Cl4V/DJAjQDoyiL2uwf1UHVd2AIrzBUSlJaTj4k6NL97a/GqhWKU9RUmjnYKpm2r+JYUcrkCuZKvcYvrg8pDoUKQywY9GDWg03DUFSirlUXBS5SWn/KAntnf0IdHGL/7mwXqDG+LZYjbEdQmqUqq4y54TNmWUP7IgcAw5816YBzwiNIJiE9M4lPCzeI/FGBeYy3p6IAmH4AjXXmvQ4Iy0Y82NTobcAggT2Cdqz6Mx4TdGoq9fn2etrWKUNFyatAHydQTVUQ2S5OWVUlugcNvoUrlA8cJJz9MqOa/W3iVno4zDHfE7zhoY5f5lRTVZDhrQbR8LS4eRLz8iPMyBL6o4PiLlp89FjdokQLaSBmKHUwWp0na5fE3v9zny2YcDXG/jfI9sctulHRbdkI5a4GOPJx4oAJQzVZ/yYAado8KNZUdEFs9ZPiBsausotXMNebEgr0dyopuqfScFJ3ODNPHgclACPdccwv0YJGQdsN2lhoV4HVGBxcEUeUX/alr4nqpcc1CCR3vR7g40zteQg/JvWmFlUE4mAiTpHlYGrB7w+U2KdSwQz2QJKBe/5eiixWipmfP15AFWrK8Sh1GBBYLgzki1wTMhGQmagXqJ2+FuqJ8f0XzXCVJFHQdMAw8xco11HhM347alrAu+wmX3pDFABOvkC+WPX0Uhg1Z5MVHKNROxaR84YV3s12UcM+70cJ460SzEaKLyh472vOMD3XnaK7zxZcXlWqenEvcjmgGNR2OKbI1s8U+iwiW+HotHalp3e1MGDy6BMVIvajnAzkFHbeVsgjmJUkrP9OAwnEHYXVBqYx3q7LvXjoVR0mY8h+ZaOnh053pdsGkmbqhyryN01eVHySr+CkDYkSMeZ1xjPNVM+gVLTDKu2VGsMUJqWO4TwPDP0VOg2/8ITbAUaMGb4LjL7L+Pi11lEVMXTYIlAZ/QHmTENjyx3kDkBdfcvvQt6tKk6jYFM4EG5UXDTaF5+1ZjRz6W7MdJPC+wTkbDUim4p5QQH3b9kGk2Bkilyeur8Bc20wm5uJSBO95GfYDI1EZipoRaH7uVveneqz43tlTZGRQ4a7CNmMHgXyOQQOL6WQkgMUTQDT8vh21aSdz7ERiZT1jK9F+v6wgFvuEmGngSvIUR2CJkc5tx1QygfZnAruONobB1idCLB1FCfO7N1ZdRocT8/Wye+EnDiO9pzqIpnLDl4bkaRKW+ekBVwHn46Shw1X0tclt/0ROijuUB4kIInrVJU4buWf4YITJtjOJ6iKdr1u+flgQeFH70GxKjhdgt/MrwfB4K/sXczQ+9zYcrD4dhY6qZhZ010rrxggWA8JaZyg2pYij8ieYEg1aZJkZK9O1Re7sB0iouf60rK0Gd+AYlp7soqCBCDGwfKeUQhCBn0E0o0GS6PdmjLi0TtCYZeqazqwN+yNINIA8Lk3iPDnWUiIPLGNcHmZDxfeK0iAdxm/T7LnN+gemRL61hHIc0NCAZaiYJR+OHnLWSe8sLrK905B5eEJHNlWq4RmEXIaFTmo49f8w61+NwfEUyuJAwVqZCLFcyHBKAcIVj3sNzfEOXzVKIndxHw+AR93owhbCxUZf6Gs8cz6/1VdrFEPrv330+9s6BtMVPJ3zl/Uf9rUi0Z/opexfdL3ykF76e999GPfVv8fJv/Y/+/5hEMon1tqNFyVRevV9y9/uIvsG3dbB8GRRrgaEXfhx+2xeOFt+cEn3RZanNxdEe2+B6MHpNbrRE53PlDifPvFcp4kO78ILR0T4xyW/WGPyBsqGdoA7zJJCu1TKbGfhnqgnRbxbB2B3UZoeQ2bz2sTVnUwokTcTU21RxN1PYPS3Sar7T0eRIsyCNowr9amwoMU/od9s2APtiKNL6ENOlyKADstAEWKA+sdKDhrJ6BOhRJmZ+QJbAaZ3/5Fq0/lumCgEzGEbu3yi0Y4I4EgVAjqxh4HbuQn0GrRhOWyAfsglQJAVL1y/6yezS2k8RE2MstJLh92NOB3GCYgFXznF4d25qiP4ZCyI4RYGesut6FXK6GwPpKK8WHEkhYui0AyEmr5Ml3uBFtPFdnioI8RiCooa7Z1G1WuyIi3nSNglutc+xY8BkeW3JJXPK6jd2VIMpaSxpVtFq+R+ySK9J6WG5Qvt+C+QH1hyYUOVK7857nFmyDBYgZ/o+AnibzNVqyYCJQvyDXDTK+iXdkA71bY7TL3bvuLxLBQ8kbTvTEY9aqkQ3+MiLWbEgjLzOH+lXgco1ERgzd80rDCymlpaRQbOYnKG/ODoFl46lzT0cjM5FYVvv0qLUbD5lyJtMUaC1pFlTkNONx6lliaX9o0i/1vws5bNKn5OuENQEKmLlcP4o2ZmJjD4zzd3Fk32uQ4uRWkPSUqb4LBe3EXHdORNB2BWsws5daRnMfNVX7isPSb1hMQdAJi1/qmDMfRUlCU74pmnzjbXfL8PVG8NsW6IQM2Ne23iCPIpryJjYbVnm5hCvKpMa7HLViNiNc+xTfDIaKm3jctViD8A1M9YPJNk003VVr4Zo2MuGW8vil8SLaGpPXqG7I4DLdtl8a4Rbx1Lt4w5Huqaa1XzZBtj208EJVGcmKYEuaeN27zT9EE6a09JerXdEbpaNgNqYJdhP1NdqiPKsbDRUi86XvvNC7rME5mrSQtrzAZVndtSjCMqd8BmaeGR4l4YFULGRBeXIV9Y4yxLFdyoUNpiy2IhePSWzBofYPP0eIa2q5JP4j9G8at/AqoSsLAUuRXtvgsqX/zYwsE+of6oSDbUOo4RMJw+DOUTJq+hnqwKim9Yy/napyZNTc2rCq6V9jHtJbxGPDwlzWj/Sk3zF/BHOlT/fSjSq7FqlPI1q6J+ru8Aku008SFINXZfOfnZNOvGPMtEmn2gLPt+H4QLA+/SYe4j398auzhKIp2Pok3mPC5q1IN1HgR+mnEfc4NeeHYwd2/kpszR3cBn7ni9NbIqhtSWFW8xbUJuUPVOeeXu3j0IGZmFNiwaNZ6rH4/zQ2ODz6tFxRLsUYZu1bfd1uIvfQDt4YD/efKYv8VF8bHGDgK22w2Wqwpi43vNCOXFJZCGMqWiPbL8mil6tsmOTXAWCyMCw73e2rADZj2IK6rqksM3EXF2cbLb4vjB14wa/yXK5vwU+05MzERJ5nXsXsW21o7M+gO0js2OyKciP5uF2iXyb2DiptwQeHeqygkrNsqVCSlldxBMpwHi1vfc8RKpP/4L3Lmpq6DZcvhDDfxTCE3splacTcOtXdK2g303dIWBVe2wD/Gvja1cClFQ67gw0t1ZUttsUgQ1Veky8oOpS6ksYEc4bqseCbZy766SvL3FodmnahlWJRgVCNjPxhL/fk2wyvlKhITH/VQCipOI0dNcRa5B1M5HmOBjTLeZQJy237e2mobwmDyJNHePhdDmiknvLKaDbShL+Is1XTCJuLQd2wmdJL7+mKvs294whXQD+vtd88KKk0DXP8B1Xu9J+xo69VOuFgexgTrcvI6SyltuLix9OPuE6/iRJYoBMEXxU4shQMf4Fjqwf1PtnJ/wWSZd29rhZjRmTGgiGTAUQqRz+nCdjeMfYhsBD5Lv60KILWEvNEHfmsDs2L0A252351eUoYxAysVaCJVLdH9QFWAmqJDCODUcdoo12+gd6bW2boY0pBVHWL6LQDK5bYWh1V8vFvi0cRpfwv7cJiMX3AZNJuTddHehTIdU0YQ/sQ1dLoF2xQPcCuHKiuCWOY30DHe1OwcClLAhqAKyqlnIbH/8u9ScJpcS4kgp6HKDUdiOgRaRGSiUCRBjzI5gSksMZKqy7Sd51aeg0tgJ+x0TH9YH2Mgsap9N7ENZdEB0bey2DMTrBA1hn56SErNHf3tKtqyL9b6yXEP97/rc+jgD2N1LNUH6RM9AzP3kSipr06RkKOolR7HO768jjWiH1X92jA7dkg7gcNcjqsZCgfqWw0tPXdLg20cF6vnQypg7gLtkazrHAodyYfENPQZsdfnjMZiNu4nJO97D1/sQE+3vNFzrSDOKw+keLECYf7RJwVHeP/j79833oZ0egonYB2FlFE5qj02B/LVOMJQlsB8uNg3Leg4qtZwntsOSNidR0abbZmAK4sCzvt8Yiuz2yrNCJoH5O8XvX/vLeR/BBYTWj0sOPYM/jyxRd5+/JziKAABaPcw/34UA3aj/gLZxZgRCWN6m4m3demanNgsx0P237/Q+Ew5VYnJPkyCY0cIVHoFn2Ay/e7U4P19APbPFXEHX94N6KhEMPG7iwB3+I+O1jd5n6VSgHegxgaSawO6iQCYFgDsPSMsNOcUj4q3sF6KzGaH/0u5PQoAj/8zq6Uc9MoNrGqhYeb2jQo0WlGlXjxtanZLS24/OIN5Gx/2g684BPDQpwlqnkFcxpmP/osnOXrFuu4PqifouQH0eF5qCkvITQbJw/Zvy5mAHWC9oU+cTiYhJmSfKsCyt1cGVxisKu+NymEQIAyaCgud/V09qT3nk/9s/SWsYtha7yNpzBIMM40rCSGaJ9u6lEkl00vXBiEt7p9P5IBCiavynEOv7FgLqPdeqxRiCwuFVMolSIUBcoyfUC2e2FJSAUgYdVGFf0b0Kn2EZlK97yyxrT2MVgvtRikfdaAW8RwEEfN+B7/eK8bBdp7URpbqn1xcrC6d2UjdsKbzCjBFqkKkoZt7Mrhg6YagE7spkqj0jOrWM+UGQ0MUlG2evP1uE1p2xSv4dMK0dna6ENcNUF+xkaJ7B764NdxLCpuvhblltVRAf7vK5qPttJ/9RYFUUSGcLdibnz6mf7WkPO3MkUUhR2mAOuGv8IWw5XG1ZvoVMnjSAZe6T7WYA99GENxoHkMiKxHlCuK5Gd0INrISImHQrQmv6F4mqU/TTQ8nHMDzCRivKySQ8dqkpQgnUMnwIkaAuc6/FGq1hw3b2Sba398BhUwUZSAIO8XZvnuLdY2n6hOXws+gq9BHUKcKFA6kz6FDnpxLPICa3qGhnc97bo1FT/XJk48LrkHJ2CAtBv0RtN97N21plfpXHvZ8gMJb7Zc4cfI6MbPwsW7AilCSXMFIEUEmir8XLEklA0ztYbGpTTGqttp5hpFTTIqUyaAIqvMT9A/x+Ji5ejA4Bhxb/cl1pUdOD6epd3yilIdO6j297xInoiBPuEDW2/UfslDyhGkQs7Wy253bVnlT+SWg89zYIK/9KXFl5fe+jow2rd5FXv8zDPrmfMXiUPt9QBO/iK4QGbX5j/7Rx1c1vzsY8ONbP3lVIaPrhL4+1QrECTN3nyKavGG0gBBtHvTKhGoBHgMXHStFowN+HKrPriYu+OZ05Frn8okQrPaaxoKP1ULCS/cmKFN3gcH7HQlVjraCeQmtjg1pSQxeuqXiSKgLpxc/1OiZsU4+n4lz4hpahGyWBURLi4642n1gn9qz9bIsaCeEPJ0uJmenMWp2tJmIwLQ6VSgDYErOeBCfSj9P4G/vI7oIF+l/n5fp956QgxGvur77ynawAu3G9MdFbJbu49NZnWnnFcQHjxRuhUYvg1U/e84N4JTecciDAKb/KYIFXzloyuE1eYXf54MmhjTq7B/yBToDzzpx3tJCTo3HCmVPYfmtBRe3mPYEE/6RlTIxbf4fSOcaKFGk4gbaUWe44hVk9SZzhW80yfW5QWBHxmtUzvMhfVQli4gZTktIOZd9mjJ5hsbmzttaHQB29Am3dZkmx3g/qvYocyhZ2PXAWsNQiIaf+Q8W/MWPIK7/TjvCx5q2XRp4lVWydMc2wIQkhadDB0xsnw/kSEyGjLKjI4coVIwtubTF3E7MJ6LS6UOsJKj82XVAVPJJcepfewbzE91ivXZvOvYfsmMevwtPpfMzGmC7WJlyW2j0jh7AF1JLmwEJSKYwIvu6DHc3YnyLH9ZdIBnQ+nOVDRiP+REpqv++typYHIvoJyICGA40d8bR7HR2k7do6UQTHF4oriYeIQbxKe4Th6+/l1BjUtS9hqORh3MbgvYrStXTfSwaBOmAVQZzpYNqsAmQyjY56MUqty3c/xH6GuhNvNaG9vGbG6cPtBM8UA3e8r51D0AR9kozKuGGSMgLz3nAHxDNnc7GTwpLj7/6HeWp1iksDeTjwCLpxejuMtpMnGJgsiku1sOACwQ9ukzESiDRN77YNESxR5LphOlcASXA5uIts1LnBIcn1J7BLWs49DMALSnuz95gdOrTZr0u1SeYHinno/pE58xYoXbVO/S+FEMMs5qyWkMnp8Q3ClyTlZP52Y9nq7b8fITPuVXUk9ohG5EFHw4gAEcjFxfKb3xuAsEjx2z1wxNbSZMcgS9GKyW3R6KwJONgtA64LTyxWm8Bvudp0M1FdJPEGopM4Fvg7G/hsptkhCfHFegv4ENwxPeXmYhxwZy7js+BeM27t9ODBMynVCLJ7RWcBMteZJtvjOYHb5lOnCLYWNEMKC59BA7covu1cANa2PXL05iGdufOzkgFqqHBOrgQVUmLEc+Mkz4Rq8O6WkNr7atNkH4M8d+SD1t/tSzt3oFql+neVs+AwEI5JaBJaxARtY2Z4mKoUqxds4UpZ0sv3zIbNoo0J4fihldQTX3XNcuNcZmcrB5LTWMdzeRuAtBk3cZHYQF6gTi3PNuDJ0nmR+4LPLoHvxQIxRgJ9iNNXqf2SYJhcvCtJiVWo85TsyFOuq7EyBPJrAdhEgE0cTq16FQXhYPJFqSfiVn0IQnPOy0LbU4BeG94QjdYNB0CiQ3QaxQqD2ebSMiNjaVaw8WaM4Z5WnzcVDsr4eGweSLa2DE3BWViaxhZFIcSTjgxNCAfelg+hznVOYoe5VqTYs1g7WtfTm3e4/WduC6p+qqAM8H4ZyrJCGpewThTDPe6H7CzX/zQ8Tm+r65HeZn+MsmxUciEWPlAVaK/VBaQBWfoG/aRL/jSZIQfep/89GjasWmbaWzeEZ2R1FOjvyJT37O9B8046SRSKVEnXWlBqbkb5XCS3qFeuE9xb9+frEknxWB5h1D/hruz2iVDEAS7+qkEz5Ot5agHJc7WCdY94Ws61sURcX5nG8UELGBAHZ3i+3VulAyT0nKNNz4K2LBHBWJcTBX1wzf+//u/j/9+//v87+9/l9Lbh/L/uyNYiTsWV2LwsjaA6MxTuzFMqmxW8Jw/+IppdX8t/Clgi1rI1SN0UC/r6tX/4lUc2VV1OQReSeCsjUpKZchw4XUcjHfw6ryCV3R8s6VXm67vp4n+lcPV9gJwmbKQEsmrJi9c2vkwrm8HFbVYNTaRGq8D91t9n5+U+aD/hNtN3HjC/nC/vUoGFSCkXP+NlRcmLUqLbiUBl4LYf1U/CCvwtd3ryCH8gUmGITAxiH1O5rnGTz7y1LuFjmnFGQ1UWuM7HwfXtWl2fPFKklYwNUpF2IL/TmaRETjQiM5SJacI+3Gv5MBU8lP5Io6gWkawpyzNEVGqOdx4YlO1dCvjbWFZWbCmeiFKPSlMKtKcMFLs/KQxtgAHi7NZNCQ32bBAW2mbHflVZ8wXKi1JKVHkW20bnYnl3dKWJeWJOiX3oKPBD6Zbi0ZvSIuWktUHB8qDR8DMMh1ZfkBL9FS9x5r0hBGLJ8pUCJv3NYH+Ae8p40mZWd5m5fhobFjQeQvqTT4VKWIYfRL0tfaXKiVl75hHReuTJEcqVlug+eOIIc4bdIydtn2K0iNZPsYWQvQio2qbO3OqAlPHDDOB7DfjGEfVF51FqqNacd6QmgFKJpMfLp5DHTv4wXlONKVXF9zTJpDV4m1sYZqJPhotcsliZM8yksKkCkzpiXt+EcRQvSQqmBS9WdWkxMTJXPSw94jqI3varCjQxTazjlMH8jTS8ilaW8014/vwA/LNa+YiFoyyx3s/KswP3O8QW1jtq45yTM/DX9a8M4voTVaO2ebvw1EooDw/yg6Y1faY+WwrdVs5Yt0hQ5EwRfYXSFxray1YvSM+kYmlpLG2/9mm1MfmbKHXr44Ih8nVKb1M537ZANUkCtdsPZ80JVKVKabVHCadaLXg+IV8i5GSwpZti0h6diTaKs9sdpUKEpd7jDUpYmHtiX33SKiO3tuydkaxA7pEc9XIQEOfWJlszj5YpL5bKeQyT7aZSBOamvSHl8xsWvgo26IP/bqk+0EJUz+gkkcvlUlyPp2kdKFtt7y5aCdks9ZJJcFp5ZWeaWKgtnXMN3ORwGLBE0PtkEIek5FY2aVssUZHtsWIvnljMVJtuVIjpZup/5VL1yPOHWWHkOMc6YySWMckczD5jUj2mlLVquFaMU8leGVaqeXis+aRRL8zm4WuBk6cyWfGMxgtr8useQEx7k/PvRoZyd9nde1GUCV84gMX8Ogu/BWezYPSR27llzQnA97oo0pYyxobYUJfsj+ysTm9zJ+S4pk0TGo9VTG0KjqYhTmALfoDZVKla2b5yhv241PxFaLJs3i05K0AAIdcGxCJZmT3ZdT7CliR7q+kur7WdQjygYtOWRL9B8E4s4LI8KpAj7bE0dg7DLOaX+MGeAi0hMMSSWZEz+RudXbZCsGYS0QqiXjH9XQbd8sCB+nIVTq7/T/FDS+zWY9q7Z2fdq1tdLb6v3hKKVDAw5gjj6o9r1wHFROdHc18MJp4SJ2Ucvu+iQ9EgkekW8VCM+psM6y+/2SBy8tNN4a3L1MzP+OLsyvESo5gS7IQOnIqMmviJBVc6zbVG1n8eXiA3j46kmvvtJlewwNDrxk4SbJOtP/TV/lIVK9ueShNbbMHfwnLTLLhbZuO79ec5XvfgRwLFK+w1r5ZWW15rVFZrE+wKqNRv5KqsLNfpGgnoUU6Y71NxEmN7MyqwqAQqoIULOw/LbuUB2+uE75gJt+kq1qY4LoxV+qR/zalupea3D5+WMeaRIn0sAI6DDWDh158fqUb4YhAxhREbUN0qyyJYkBU4V2KARXDT65gW3gRsiv7xSPYEKLwzgriWcWgPr0sbZnv7m1XHNFW6xPdGNZUdxFiUYlmXNjDVWuu7LCkX/nVkrXaJhiYktBISC2xgBXQnNEP+cptWl1eG62a7CPXrnrkTQ5BQASbEqUZWMDiZUisKyHDeLFOaJILUo5f6iDt4ZO8MlqaKLto0AmTHVVbkGuyPa1R/ywZsWRoRDoRdNMMHwYTsklMVnlAd2S0282bgMI8fiJpDh69OSL6K3qbo20KfpNMurnYGQSr/stFqZ7hYsxKlLnKAKhsmB8AIpEQ4bd/NrTLTXefsE6ChRmKWjXKVgpGoPs8GAicgKVw4K0qgDgy1A6hFq1WRat3fHF+FkU+b6H4NWpOU3KXTxrIb2qSHAb+qhm8hiSROi/9ofapjxhyKxxntPpge6KL5Z4+WBMYkAcE6+0Hd3Yh2zBsK2MV3iW0Y6cvOCroXlRb2MMJtdWx+3dkFzGh2Pe3DZ9QpSqpaR/rE1ImOrHqYYyccpiLC22amJIjRWVAherTfpQLmo6/K2pna85GrDuQPlH1Tsar8isAJbXLafSwOof4gg9RkAGm/oYpBQQiPUoyDk2BCQ1k+KILq48ErFo4WSRhHLq/y7mgw3+L85PpP6xWr6cgp9sOjYjKagOrxF148uhuaWtjet953fh1IQiEzgC+d2IgBCcUZqgTAICm2bR8oCjDLBsmg+ThyhfD+zBalsKBY1Ce54Y/t9cwfbLu9SFwEgphfopNA3yNxgyDafUM3mYTovZNgPGdd4ZFFOj1vtfFW3u7N+iHEN1HkeesDMXKPyoCDCGVMo4GCCD6PBhQ3dRZIHy0Y/3MaE5zU9mTCrwwnZojtE+qNpMSkJSpmGe0EzLyFelMJqhfFQ7a50uXxZ8pCc2wxtAKWgHoeamR2O7R+bq7IbPYItO0esdRgoTaY38hZLJ5y02oIVwoPokGIzxAMDuanQ1vn2WDQ00Rh6o5QOaCRu99fwDbQcN0XAuqkFpxT/cfz3slGRVokrNU0iqiMAJFEbKScZdmSkTUznC0U+MfwFOGdLgsewRyPKwBZYSmy6U325iUhBQNxbAC3FLKDV9VSOuQpOOukJ/GAmu/tyEbX9DgEp6dv1zoU0IqzpG6gssSjIYRVPGgU1QAQYRgIT8gEV0EXr1sqeh2I6rXjtmoCYyEDCe/PkFEi/Q48FuT29p557iN+LCwk5CK/CZ2WdAdfQZh2Z9QGrzPLSNRj5igUWzl9Vi0rCqH8G1Kp4QMLkuwMCAypdviDXyOIk0AHTM8HBYKh3b0/F+DxoNj4ZdoZfCpQVdnZarqoMaHWnMLNVcyevytGsrXQEoIbubqWYNo7NRHzdc0zvT21fWVirj7g36iy6pxogfvgHp1xH1Turbz8QyyHnXeBJicpYUctbzApwzZ1HT+FPEXMAgUZetgeGMwt4G+DHiDT2Lu+PT21fjJCAfV16a/Wu1PqOkUHSTKYhWW6PhhHUlNtWzFnA7MbY+r64vkwdpfNB2JfWgWXAvkzd42K4lN9x7Wrg4kIKgXCb4mcW595MCPJ/cTfPAMQMFWwnqwde4w8HZYJFpQwcSMhjVz4B8p6ncSCN1X4klxoIH4BN2J6taBMj6lHkAOs8JJAmXq5xsQtrPIPIIp/HG6i21xMGcFgqDXSRF0xQg14d2uy6HgKE13LSvQe52oShF5Jx1R6avyL4thhXQZHfC94oZzuPUBKFYf1VvDaxIrtV6dNGSx7DO0i1p6CzBkuAmEqyWceQY7F9+U0ObYDzoa1iKao/cOD/v6Q9gHrrr1uCeOk8fST9MG23Ul0KmM3r+Wn6Hi6WAcL7gEeaykicvgjzkjSwFsAXIR81Zx4QJ6oosVyJkCcT+4xAldCcihqvTf94HHUPXYp3REIaR4dhpQF6+FK1H0i9i7Pvh8owu3lO4PT1iuqu+DkL2Bj9+kdfGAg2TXw03iNHyobxofLE2ibjsYDPgeEQlRMR7afXbSGQcnPjI2D+sdtmuQ771dbASUsDndU7t58jrrNGRzISvwioAlHs5FA+cBE5Ccznkd8NMV6BR6ksnKLPZnMUawRDU1MZ/ib3xCdkTblHKu4blNiylH5n213yM0zubEie0o4JhzcfAy3H5qh2l17uLooBNLaO+gzonTH2uF8PQu9EyH+pjGsACTMy4cHzsPdymUSXYJOMP3yTkXqvO/lpvt0cX5ekDEu9PUfBeZODkFuAjXCaGdi6ew4qxJ8PmFfwmPpkgQjQlWqomFY6UkjmcnAtJG75EVR+NpzGpP1Ef5qUUbfowrC3zcSLX3BxgWEgEx/v9cP8H8u1Mvt9/rMDYf6sjwU1xSOPBgzFEeJLMRVFtKo5QHsUYT8ZRLCah27599EuqoC9PYjYO6aoAMHB8X1OHwEAYouHfHB3nyb2B+SnZxM/vw/bCtORjLMSy5aZoEpvgdGvlJfNPFUu/p7Z4VVK1hiI0/UTuB3ZPq4ohEbm7Mntgc1evEtknaosgZSwnDC2BdMmibpeg48X8Ixl+/8+xXdbshQXUPPvx8jT3fkELivHSmqbhblfNFShWAyQnJ3WBU6SMYSIpTDmHjdLVAdlADdz9gCplZw6mTiHqDwIsxbm9ErGusiVpg2w8Q3khKV/R9Oj8PFeF43hmW/nSd99nZzhyjCX3QOZkkB6BsH4H866WGyv9E0hVAzPYah2tkRfQZMmP2rinfOeQalge0ovhduBjJs9a1GBwReerceify49ctOh5/65ATYuMsAkVltmvTLBk4oHpdl6i+p8DoNj4Fb2vhdFYer2JSEilEwPd5n5zNoGBXEjreg/wh2NFnNRaIUHSOXa4eJRwygZoX6vnWnqVdCRT1ARxeFrNBJ+tsdooMwqnYhE7zIxnD8pZH+P0Nu1wWxCPTADfNWmqx626IBJJq6NeapcGeOmbtXvl0TeWG0Y7OGGV4+EHTtNBIT5Wd0Bujl7inXgZgfXTM5efD3qDTJ54O9v3Bkv+tdIRlq1kXcVD0BEMirmFxglNPt5pedb1AnxuCYMChUykwsTIWqT23XDpvTiKEru1cTcEMeniB+HQDehxPXNmkotFdwUPnilB/u4Nx5Xc6l8J9jH1EgKZUUt8t8cyoZleDBEt8oibDmJRAoMKJ5Oe9CSWS5ZMEJvacsGVdXDWjp/Ype5x0p9PXB2PAwt2LRD3d+ftNgpuyvxlP8pB84oB1i73vAVpwyrmXW72hfW6Dzn9Jkj4++0VQ4d0KSx1AsDA4OtXXDo63/w+GD+zC7w5SJaxsmnlYRQ4dgdjA7tTl2KNLnpJ+mvkoDxtt1a4oPaX3EVqj96o9sRKBQqU7ZOiupeAIyLMD+Y3YwHx30XWHB5CQiw7q3mj1EDlP2eBsZbz79ayUMbyHQ7s8gu4Lgip1LiGJj7NQj905/+rgUYKAA5qdrlHKIknWmqfuR+PB8RdBkDg/NgnlT89G72h2NvySnj7UyBwD+mi/IWs1xWbxuVwUIVXun5cMqBtFbrccI+DILjsVQg6eeq0itiRfedn89CvyFtpkxaauEvSANuZmB1p8FGPbU94J9medwsZ9HkUYjmI7OH5HuxendLbxTaYrPuIfE2ffXFKhoNBUp33HsFAXmCV/Vxpq5AYgFoRr5Ay93ZLRlgaIPjhZjXZZChT+aE5iWAXMX0oSFQEtwjiuhQQItTQX5IYrKfKB+queTNplR1Hoflo5/I6aPPmACwQCE2jTOYo5Dz1cs7Sod0KTG/3kEDGk3kUaUCON19xSJCab3kNpWZhSWkO8l+SpW70Wn3g0ciOIJO5JXma6dbos6jyisuxXwUUhj2+1uGhcvuliKtWwsUTw4gi1c/diEEpZHoKoxTBeMDmhPhKTx7TXWRakV8imJR355DcIHkR9IREHxohP4TbyR5LtFU24umRPRmEYHbpe1LghyxPx7YgUHjNbbQFRQhh4KeU1EabXx8FS3JAxp2rwRDoeWkJgWRUSKw6gGP5U2PuO9V4ZuiKXGGzFQuRuf+tkSSsbBtRJKhCi3ENuLlXhPbjTKD4djXVnfXFds6Zb+1XiUrRfyayGxJq1+SYBEfbKlgjiSmk0orgTqzSS+DZ5rTqsJbttiNtp+KMqGE2AHGFw6jQqM5vD6vMptmXV9OAjq49Uf/Lx9Opam+Hn5O9p8qoBBAQixzQZ4eNVkO9sPzJAMyR1y4/RCQQ1s0pV5KAU5sKLw3tkcFbI/JqrjCsK4Mw+W8aod4lioYuawUiCyVWBE/qPaFi5bnkgpfu/ae47174rI1fqQoTbW0HrU6FAejq7ByM0V4zkZTg02/YJK2N7hUQRCeZ4BIgSEqgD8XsjzG6LIsSbuHoIdz/LhFzbNn1clci1NHWJ0/6/O8HJMdIpEZbqi1RrrFfoo/rI/7ufm2MPG5lUI0IYJ4MAiHRTSOFJ2oTverFHYXThkYFIoyFx6rMYFgaOKM4xNWdlOnIcKb/suptptgTOTdVIf4YgdaAjJnIAm4qNNHNQqqAzvi53GkyRCEoseUBrHohZsjUbkR8gfKtc/+Oa72lwxJ8Mq6HDfDATbfbJhzeIuFQJSiw1uZprHlzUf90WgqG76zO0eCB1WdPv1IT6sNxxh91GEL2YpgC97ikFHyoaH92ndwduqZ6IYjkg20DX33MWdoZk7QkcKUCgisIYslOaaLyvIIqRKWQj16jE1DlQWJJaPopWTJjXfixEjRJJo8g4++wuQjbq+WVYjsqCuNIQW3YjnxKe2M5ZKEqq+cX7ZVgnkbsU3RWIyXA1rxv4kGersYJjD//auldXGmcEbcfTeF16Y1708FB1HIfmWv6dSFi6oD4E+RIjCsEZ+kY7dKnwReJJw3xCjKvi3kGN42rvyhUlIz0Bp+fNSV5xwFiuBzG296e5s/oHoFtUyUplmPulIPl+e1CQIQVtjlzLzzzbV+D/OVQtYzo5ixtMi5BmHuG4N/uKfJk5UIREp7+12oZlKtPBomXSzAY0KgtbPzzZoHQxujnREUgBU+O/jKKhgxVhRPtbqyHiUaRwRpHv7pgRPyUrnE7fYkVblGmfTY28tFCvlILC04Tz3ivkNWVazA+OsYrxvRM/hiNn8Fc4bQBeUZABGx5S/xFf9Lbbmk298X7iFg2yeimvsQqqJ+hYbt6uq+Zf9jC+Jcwiccd61NKQtFvGWrgJiHB5lwi6fR8KzYS7EaEHf/ka9EC7H8D+WEa3TEACHBkNSj/cXxFeq4RllC+fUFm2xtstYLL2nos1DfzsC9vqDDdRVcPA3Ho95aEQHvExVThXPqym65llkKlfRXbPTRiDepdylHjmV9YTWAEjlD9DdQnCem7Aj/ml58On366392214B5zrmQz/9ySG2mFqEwjq5sFl5tYJPw5hNz8lyZPUTsr5E0F2C9VMPnZckWP7+mbwp/BiN7f4kf7vtGnZF2JGvjK/sDX1RtcFY5oPQnE4lIAYV49U3C9SP0LCY/9i/WIFK9ORjzM9kG/KGrAuwFmgdEpdLaiqQNpCTGZVuAO65afkY1h33hrqyLjZy92JK3/twdj9pafFcwfXONmPQWldPlMe7jlP24Js0v9m8bIJ9TgS2IuRvE9ZVRaCwSJYOtAfL5H/YS4FfzKWKbek+GFulheyKtDNlBtrdmr+KU+ibHTdalzFUmMfxw3f36x+3cQbJLItSilW9cuvZEMjKw987jykZRlsH/UI+HlKfo2tLwemBEeBFtmxF2xmItA/dAIfQ+rXnm88dqvXa+GapOYVt/2waFimXFx3TC2MUiOi5/Ml+3rj/YU6Ihx2hXgiDXFsUeQkRAD6wF3SCPi2flk7XwKAA4zboqynuELD312EJ88lmDEVOMa1W/K/a8tGylZRMrMoILyoMQzzbDJHNZrhH77L9qSC42HVmKiZ5S0016UTp83gOhCwz9XItK9fgXfK3F5d7nZCBUekoLxrutQaPHa16Rjsa0gTrzyjqTnmcIcrxg6X6dkKiucudc0DD5W4pJPf0vuDW8r5/uw24YfMuxFRpD2ovT2mFX79xH6Jf+MVdv2TYqR6/955QgVPe3JCD/WjAYcLA9tpXgFiEjge2J5ljeI/iUzg91KQuHkII4mmHZxC3XQORLAC6G7uFn5LOmlnXkjFdoO976moNTxElS8HdxWoPAkjjocDR136m2l+f5t6xaaNgdodOvTu0rievnhNAB79WNrVs6EsPgkgfahF9gSFzzAd+rJSraw5Mllit7vUP5YxA843lUpu6/5jAR0RvH4rRXkSg3nE+O5GFyfe+L0s5r3k05FyghSFnKo4TTgs07qj4nTLqOYj6qaW9knJTDkF5OFMYbmCP+8H16Ty482OjvERV6OFyw043L9w3hoJi408sR+SGo1WviXUu8d7qS+ehKjpKwxeCthsm2LBFSFeetx0x4AaKPxtp3CxdWqCsLrB1s/j5TAhc1jNZsXWl6tjo/WDoewxzg8T8NnhZ1niUwL/nhfygLanCnRwaFGDyLw+sfZhyZ1UtYTp8TYB6dE7R3VsKKH95CUxJ8u8N+9u2/9HUNKHW3x3w5GQrfOPafk2w5qZq8MaHT0ebeY3wIsp3rN9lrpIsW9c1ws3VNV+JwNz0Lo9+V7zZr6GD56We6gWVIvtmam5GPPkVAbr74r6SwhuL+TRXtW/0pgyX16VNl4/EAD50TnUPuwrW6OcUO2VlWXS0inq872kk7GUlW6o/ozFKq+Sip6LcTtSDfDrPTcCHhx75H8BeRon+KG2wRwzfDgWhALmiWOMO6h3pm1UCZEPEjScyk7tdLx6WrdA2N1QTPENvNnhCQjW6kl057/qv7IwRryHrZBCwVSbLLnFRiHdTwk8mlYixFt1slEcPD7FVht13HyqVeyD55HOXrh2ElAxJyinGeoFzwKA91zfrdLvDxJSjzmImfvTisreI25EDcVfGsmxLVbfU8PGe/7NmWWKjXcdTJ11jAlVIY/Bv/mcxg/Q10vCHwKG1GW/XbJq5nxDhyLqiorn7Wd7VEVL8UgVzpHMjQ+Z8DUgSukiVwWAKkeTlVVeZ7t1DGnCgJVIdBPZAEK5f8CDyDNo7tK4/5DBjdD5MPV86TaEhGsLVFPQSI68KlBYy84FievdU9gWh6XZrugvtCZmi9vfd6db6V7FmoEcRHnG36VZH8N4aZaldq9zZawt1uBFgxYYx+Gs/qW1jwANeFy+LCoymyM6zgG7j8bGzUyLhvrbJkTYAEdICEb4kMKusKT9V3eIwMLsjdUdgijMc+7iKrr+TxrVWG0U+W95SGrxnxGrE4eaJFfgvAjUM4SAy8UaRwE9j6ZQH5qYAWGtXByvDiLSDfOD0yFA3UCMKSyQ30fyy1mIRg4ZcgZHLNHWl+c9SeijOvbOJxoQy7lTN2r3Y8p6ovxvUY74aOYbuVezryqXA6U+fcp6wSV9X5/OZKP18tB56Ua0gMyxJI7XyNT7IrqN8GsB9rL/kP5KMrjXxgqKLDa+V5OCH6a5hmOWemMUsea9vQl9t5Oce76PrTyTv50ExOqngE3PHPfSL//AItPdB7kGnyTRhVUUFNdJJ2z7RtktZwgmQzhBG/G7QsjZmJfCE7k75EmdIKH7xlnmDrNM/XbTT6FzldcH/rcRGxlPrv4qDScqE7JSmQABJWqRT/TUcJSwoQM+1jvDigvrjjH8oeK2in1S+/yO1j8xAws/T5u0VnIvAPqaE1atNuN0cuRliLcH2j0nTL4JpcR7w9Qya0JoaHgsOiALLCCzRkl1UUESz+ze/gIXHGtDwgYrK6pCFKJ1webSDog4zTlPkgXZqxlQDiYMjhDpwTtBW2WxthWbov9dt2X9XFLFmcF+eEc1UaQ74gqZiZsdj63pH1qcv3Vy8JYciogIVKsJ8Yy3J9w/GhjWVSQAmrS0BPOWK+RKV+0lWqXgYMnIFwpcZVD7zPSp547i9HlflB8gVnSTGmmq1ClO081OW/UH11pEQMfkEdDFzjLC1Cdo/BdL3s7cXb8J++Hzz1rhOUVZFIPehRiZ8VYu6+7Er7j5PSZu9g/GBdmNzJmyCD9wiswj9BZw+T3iBrg81re36ihMLjoVLoWc+62a1U/7qVX5CpvTVF7rocSAKwv4cBVqZm7lLDS/qoXs4fMs/VQi6BtVbNA3uSzKpQfjH1o3x4LrvkOn40zhm6hjduDglzJUwA0POabgdXIndp9fzhOo23Pe+Rk9GSLX0d71Poqry8NQDTzNlsa+JTNG9+UrEf+ngxCjGEsDCc0bz+udVRyHQI1jmEO3S+IOQycEq7XwB6z3wfMfa73m8PVRp+iOgtZfeSBl01xn03vMaQJkyj7vnhGCklsCWVRUl4y+5oNUzQ63B2dbjDF3vikd/3RUMifPYnX5Glfuk2FsV/7RqjI9yKTbE8wJY+74p7qXO8+dIYgjtLD/N8TJtRh04N9tXJA4H59IkMmLElgvr0Q5OCeVfdAt+5hkh4pQgfRMHpL74XatLQpPiOyHRs/OdmHtBf8nOZcxVKzdGclIN16lE7kJ+pVMjspOI+5+TqLRO6m0ZpNXJoZRv9MPDRcAfJUtNZHyig/s2wwReakFgPPJwCQmu1I30/tcBbji+Na53i1W1N+BqoY7Zxo+U/M9XyJ4Ok2SSkBtoOrwuhAY3a03Eu6l8wFdIG1cN+e8hopTkiKF093KuH/BcB39rMiGDLn6XVhGKEaaT/vqb/lufuAdpGExevF1+J9itkFhCfymWr9vGb3BTK4j598zRH7+e+MU9maruZqb0pkGxRDRE1CD4Z8LV4vhgPidk5w2Bq816g3nHw1//j3JStz7NR9HIWELO8TMn3QrP/zZp//+Dv9p429/ogv+GATR+n/UdF+ns9xNkXZQJXY4t9jMkJNUFygAtzndXwjss+yWH9HAnLQQfhAskdZS2l01HLWv7L7us5uTH409pqitvfSOQg/c+Zt7k879P3K9+WV68n7+3cZfuRd/dDPP/03rn+d+/nBvWfgDlt8+LzjqJ/vx3CnNOwiXhho778C96iD+1TBvRZYeP+EH81LE0vVwOOrmCLB3iKzI1x+vJEsrPH4uF0UB4TJ4X3uDfOCo3PYpYe0MF4bouh0DQ/l43fxUF7Y+dpWuvTSffB0yO2UQUETI/LwCZE3BvnevJ7c9zUlY3H58xzke6DNFDQG8n0WtDN4LAYN4nogKav1ezOfK/z+t6tsCTp+dhx4ymjWuCJk1dEUifDP+HyS4iP/Vg9B2jTo9L4NbiBuDS4nuuHW6H+JDQn2JtqRKGkEQPEYE7uzazXIkcxIAqUq1esasZBETlEZY7y7Jo+RoV/IsjY9eIMkUvr42Hc0xqtsavZvhz1OLwSxMOTuqzlhb0WbdOwBH9EYiyBjatz40bUxTHbiWxqJ0uma19qhPruvcWJlbiSSH48OLDDpaHPszvyct41ZfTu10+vjox6kOqK6v0K/gEPphEvMl/vwSv+A4Hhm36JSP9IXTyCZDm4kKsqD5ay8b1Sad/vaiyO5N/sDfEV6Z4q95E+yfjxpqBoBETW2C7xl4pIO2bDODDFurUPwE7EWC2Uplq+AHmBHvir2PSgkR12/Ry65O0aZtQPeXi9mTlF/Wj5GQ+vFkYyhXsLTjrBSP9hwk4GPqDP5rBn5/l8b0mLRAvRSzXHc293bs3s8EsdE3m2exxidWVB4joHR+S+dz5/W+v00K3TqN14CDBth8eWcsTbiwXPsygHdGid0PEdy6HHm2v/IUuV5RVapYmzGsX90mpnIdNGcOOq64Dbc5GUbYpD9M7S+6cLY//QmjxFLP5cuTFRm3vA5rkFZroFnO3bjHF35uU3s8mvL7Tp9nyTc4mymTJ5sLIp7umSnGkO23faehtz3mmTS7fbVx5rP7x3HXIjRNeq/A3xCs9JNB08c9S9BF2O3bOur0ItslFxXgRPdaapBIi4dRpKGxVz7ir69t/bc9qTxjvtOyGOfiLGDhR4fYywHv1WdOplxIV87TpLBy3Wc0QP0P9s4G7FBNOdITS/tep3o3h1TEa5XDDii7fWtqRzUEReP2fbxz7bHWWJdbIOxOUJZtItNZpTFRfj6vm9sYjRxQVO+WTdiOhdPeTJ+8YirPvoeL88l5iLYOHd3b/Imkq+1ZN1El3UikhftuteEYxf1Wujof8Pr4ICTu5ezZyZ4tHQMxlzUHLYO2VMOoNMGL/20S5i2o2obfk+8qqdR7xzbRDbgU0lnuIgz4LelQ5XS7xbLuSQtNS95v3ZUOdaUx/Qd8qxCt6xf2E62yb/HukLO6RyorV8KgYl5YNc75y+KvefrxY+lc/64y9kvWP0a0bDz/rojq+RWjO06WeruWqNFU7r3HPIcLWRql8ICZsz2Ls/qOm/CLn6++X+Qf7mGspYCrZod/lpl6Rw4xN/yuq8gqV4B6aHk1hVE1SfILxWu5gvXqbfARYQpspcxKp1F/c8XOPzkZvmoSw+vEqBLdrq1fr3wAPv5NnM9i8F+jdAuxkP5Z71c6uhK3enlnGymr7UsWZKC12qgUiG8XXGQ9mxnqz4GSIlybF9eXmbqj2sHX+a1jf0gRoONHRdRSrIq03Ty89eQ1GbV/Bk+du4+V15zls+vvERvZ4E7ZbnxWTVjDjb4o/k8jlw44pTIrUGxxuJvBeO+heuhOjpFsO6lVJ/aXnJDa/bM0Ql1cLbXE/Pbv3EZ3vj3iVrB5irjupZTzlnv677NrI9UNYNqbPgp/HZXS+lJmk87wec+7YOxTDo2aw2l3NfDr34VNlvqWJBknuK7oSlZ6/T10zuOoPZOeoIk81N+sL843WJ2Q4Z0fZ3scsqC/JV2fuhWi1jGURSKZV637lf53Xnnx16/vKEXY89aVJ0fv91jGdfG+G4+sniwHes4hS+udOr4RfhFhG/F5gUG35QaU+McuLmclb5ZWmR+sG5V6nf+PxYzlrnFGxpZaK8eqqVo0NfmAWoGfXDiT/FnUbWvzGDOTr8aktOZWg4BYvz5YH12ZbfCcGtNk+dDAZNGWvHov+PIOnY9Prjg8h/wLRrT69suaMVZ5bNuK00lSVpnqSX1NON/81FoP92rYndionwgOiA8WMf4vc8l15KqEEG4yAm2+WAN5Brfu1sq9suWYqgoajgOYt/JCk1gC8wPkK+XKCtRX6TAtgvrnuBgNRmn6I8lVDipOVB9kX6Oxkp4ZKyd1M6Gj8/v2U7k+YQBL95Kb9PQENucJb0JlW3b5tObN7m/Z1j1ev388d7o15zgXsI9CikAGAViR6lkJv7nb4Ak40M2G8TJ447kN+pvfHiOFjSUSP6PM+QfbAywKJCBaxSVxpizHseZUyUBhq59vFwrkyGoRiHbo0apweEZeSLuNiQ+HAekOnarFg00dZNXaPeoHPTRR0FmEyqYExOVaaaO8c0uFUh7U4e/UxdBmthlBDgg257Q33j1hA7HTxSeTTSuVnPZbgW1nodwmG16aKBDKxEetv7D9OjO0JhrbJTnoe+kcGoDJazFSO8/fUN9Jy/g4XK5PUkw2dgPDGpJqBfhe7GA+cjzfE/EGsMM+FV9nj9IAhrSfT/J3QE5TEIYyk5UjsI6ZZcCPr6A8FZUF4g9nnpVmjX90MLSQysIPD0nFzqwCcSJmIb5mYv2Cmk+C1MDFkZQyCBq4c/Yai9LJ6xYkGS/x2s5/frIW2vmG2Wrv0APpCdgCA9snFvfpe8uc0OwdRs4G9973PGEBnQB5qKrCQ6m6X/H7NInZ7y/1674/ZXOVp7OeuCRk8JFS516VHrnH1HkIUIlTIljjHaQtEtkJtosYul77cVwjk3gW1Ajaa6zWeyHGLlpk3VHE2VFzT2yI/EvlGUSz2H9zYE1s4nsKMtMqNyKNtL/59CpFJki5Fou6VXGm8vWATEPwrUVOLvoA8jLuwOzVBCgHB2Cr5V6OwEWtJEKokJkfc87h+sNHTvMb0KVTp5284QTPupoWvQVUwUeogZR3kBMESYo0mfukewRVPKh5+rzLQb7HKjFFIgWhj1w3yN/qCNoPI8XFiUgBNT1hCHBsAz8L7Oyt8wQWUFj92ONn/APyJFg8hzueqoJdNj57ROrFbffuS/XxrSXLTRgj5uxZjpgQYceeMc2wJrahReSKpm3QjHfqExTLAB2ipVumE8pqcZv8LYXQiPHHsgb5BMW8zM5pvQit+mQx8XGaVDcfVbLyMTlY8xcfmm/RSAT/H09UQol5gIz7rESDmnrQ4bURIB4iRXMDQwxgex1GgtDxKp2HayIkR+E/aDmCttNm2C6lytWdfOVzD6X2SpDWjQDlMRvAp1symWv4my1bPCD+E1EmGnMGWhNwmycJnDV2WrQNxO45ukEb08AAffizYKVULp15I4vbNK5DzWwCSUADfmKhfGSUqii1L2UsE8rB7mLuHuUJZOx4+WiizHBJ/hwboaBzhpNOVvgFTf5cJsHef7L1HCI9dOUUbb+YxUJWn6dYOLz+THi91kzY5dtO5c+grX7v0jEbsuoOGnoIreDIg/sFMyG+TyCLIcAWd1IZ1UNFxE8Uie13ucm40U2fcxC0u3WLvLOxwu+F7MWUsHsdtFQZ7W+nlfCASiAKyh8rnP3EyDByvtJb6Kax6/HkLzT9SyEyTMVM1zPtM0MJY14DmsWh4MgD15Ea9Hd00AdkTZ0EiG5NAGuIBzQJJ0JR0na+OB7lQA6UKxMfihIQ7GCCnVz694QvykWXTxpS2soDu+smru1UdIxSvAszBFD1c8c6ZOobA8bJiJIvuycgIXBQIXWwhyTgZDQxJTRXgEwRNAawGSXO0a1DKjdihLVNp/taE/xYhsgwe+VpKEEB4LlraQyE84gEihxCnbfoyOuJIEXy2FIYw+JjRusybKlU2g/vhTSGTydvCvXhYBdtAXtS2v7LkHtmXh/8fly1do8FI/D0f8UbzVb5h+KRhMGSAmR2mhi0YG/uj7wgxcfzCrMvdjitUIpXDX8ae2JcF/36qUWIMwN6JsjaRGNj+jEteGDcFyTUb8X/NHSucKMJp7pduxtD6KuxVlyxxwaeiC1FbGBESO84lbyrAugYxdl+2N8/6AgWpo/IeoAOcsG35IA/b3AuSyoa55L7llBLlaWlEWvuCFd8f8NfcTUgzJv6CbB+6ohWwodlk9nGWFpBAOaz5uEW5xBvmjnHFeDsb0mXwayj3mdYq5gxxNf3H3/tnCgHwjSrpSgVxLmiTtuszdRUFIsn6LiMPjL808vL1uQhDbM7aA43mISXReqjSskynIRcHCJ9qeFopJfx9tqyUoGbSwJex/0aDE3plBPGtNBYgWbdLom3+Q/bjdizR2/AS/c/dH/d3G7pyl1qDXgtOFtEqidwLqxPYtrNEveasWq3vPUUtqTeu8gpov4bdOQRI2kneFvRNMrShyVeEupK1PoLDPMSfWMIJcs267mGB8X9CehQCF0gIyhpP10mbyM7lwW1e6TGvHBV1sg/UyTghHPGRqMyaebC6pbB1WKNCQtlai1GGvmq9zUKaUzLaXsXEBYtHxmFbEZ2kJhR164LhWW2Tlp1dhsGE7ZgIWRBOx3Zcu2DxgH+G83WTPceKG0TgQKKiiNNOlWgvqNEbnrk6fVD+AqRam2OguZb0YWSTX88N+i/ELSxbaUUpPx4vJUzYg/WonSeA8xUK6u7DPHgpqWpEe6D4cXg5uK9FIYVba47V/nb+wyOtk+zG8RrS4EA0ouwa04iByRLSvoJA2FzaobbZtXnq8GdbfqEp5I2dpfpj59TCVif6+E75p665faiX8gS213RqBxTZqfHP46nF6NSenOneuT+vgbLUbdTH2/t0REFXZJOEB6DHvx6N6g9956CYrY/AYcm9gELJXYkrSi+0F0geKDZgOCIYkLU/+GOW5aGj8mvLFgtFH5+XC8hvAE3CvHRfl4ofM/Qwk4x2A+R+nyc9gNu/9Tem7XW4XRnyRymf52z09cTOdr+PG6+P/Vb4QiXlwauc5WB1z3o+IJjlbxI8MyWtSzT+k4sKVbhF3xa+vDts3NxXa87iiu+xRH9cAprnOL2h6vV54iQRXuOAj1s8nLFK8gZ70ThIQcWdF19/2xaJmT0efrkNDkWbpAQPdo92Z8+Hn/aLjbOzB9AI/k12fPs9HhUNDJ1u6ax2VxD3R6PywN7BrLJ26z6s3QoMp76qzzwetrDABKSGkfW5PwS1GvYNUbK6uRqxfyVGNyFB0E+OugMM8kKwmJmupuRWO8XkXXXQECyRVw9UyIrtCtcc4oNqXqr7AURBmKn6Khz3eBN96LwIJrAGP9mr/59uTOSx631suyT+QujDd4beUFpZ0kJEEnjlP+X/Kr2kCKhnENTg4BsMTOmMqlj2WMFLRUlVG0fzdCBgUta9odrJfpVdFomTi6ak0tFjXTcdqqvWBAzjY6hVrH9sbt3Z9gn+AVDpTcQImefbB4edirjzrsNievve4ZT4EUZWV3TxEsIW+9MT/RJoKfZZYSRGfC1CwPG/9rdMOM8qR/LUYvw5f/emUSoD7YSFuOoqchdUg2UePd1eCtFSKgxLSZ764oy4lvRCIH6bowPxZWwxNFctksLeil47pfevcBipkkBIc4ngZG+kxGZ71a72KQ7VaZ6MZOZkQJZXM6kb/Ac0/XkJx8dvyfJcWbI3zONEaEPIW8GbkYjsZcwy+eMoKrYjDmvEEixHzkCSCRPRzhOfJZuLdcbx19EL23MA8rnjTZZ787FGMnkqnpuzB5/90w1gtUSRaWcb0eta8198VEeZMUSfIhyuc4/nywFQ9uqn7jdqXh+5wwv+RK9XouNPbYdoEelNGo34KyySwigsrfCe0v/PlWPvQvQg8R0KgHO18mTVThhQrlbEQ0Kp/JxPdjHyR7E1QPw/ut0r+HDDG7BwZFm9IqEUZRpv2WpzlMkOemeLcAt5CsrzskLGaVOAxyySzZV/D2EY7ydNZMf8e8VhHcKGHAWNszf1EOq8fNstijMY4JXyATwTdncFFqcNDfDo+mWFvxJJpc4sEZtjXyBdoFcxbUmniCoKq5jydUHNjYJxMqN1KzYV62MugcELVhS3Bnd+TLLOh7dws/zSXWzxEb4Nj4aFun5x4kDWLK5TUF/yCXB/cZYvI9kPgVsG2jShtXkxfgT+xzjJofXqPEnIXIQ1lnIdmVzBOM90EXvJUW6a0nZ/7XjJGl8ToO3H/fdxnxmTNKBZxnkpXLVgLXCZywGT3YyS75w/PAH5I/jMuRspej8xZObU9kREbRA+kqjmKRFaKGWAmFQspC+QLbKPf0RaK3OXvBSWqo46p70ws/eZpu6jCtZUgQy6r4tHMPUdAgWGGUYNbuv/1a6K+MVFsd3T183+T8capSo6m0+Sh57fEeG/95dykGJBQMj09DSW2bY0mUonDy9a8trLnnL5B5LW3Nl8rJZNysO8Zb+80zXxqUGFpud3Qzwb7bf+8mq6x0TAnJU9pDQR9YQmZhlna2xuxJt0aCO/f1SU8gblOrbIyMsxTlVUW69VJPzYU2HlRXcqE2lLLxnObZuz2tT9CivfTAUYfmzJlt/lOPgsR6VN64/xQd4Jlk/RV7UKVv2Gx/AWsmTAuCWKhdwC+4HmKEKYZh2Xis4KsUR1BeObs1c13wqFRnocdmuheaTV30gvVXZcouzHKK5zwrN52jXJEuX6dGx3BCpV/++4f3hyaW/cQJLFKqasjsMuO3B3WlMq2gyYfdK1e7L2pO/tRye2mwzwZPfdUMrl5wdLqdd2Kv/wVtnpyWYhd49L6rsOV+8HXPrWH2Kup89l2tz6bf80iYSd+V4LROSOHeamvexR524q4r43rTmtFzQvArpvWfLYFZrbFspBsXNUqqenjxNNsFXatZvlIhk7teUPfK+YL32F8McTnjv0BZNppb+vshoCrtLXjIWq3EJXpVXIlG6ZNL0dh6qEm2WMwDjD3LfOfkGh1/czYc/0qhiD2ozNnH4882MVVt3JbVFkbwowNCO3KL5IoYW5wlVeGCViOuv1svZx7FbzxKzA4zGqBlRRaRWCobXaVq4yYCWbZf8eiJwt3OY+MFiSJengcFP2t0JMfzOiJ7cECvpx7neg1Rc5x+7myPJOXt2FohVRyXtD+/rDoTOyGYInJelZMjolecVHUhUNqvdZWg2J2t0jPmiLFeRD/8fOT4o+NGILb+TufCo9ceBBm3JLVn+MO2675n7qiEX/6W+188cYg3Zn5NSTjgOKfWFSAANa6raCxSoVU851oJLY11WIoYK0du0ec5E4tCnAPoKh71riTsjVIp3gKvBbEYQiNYrmH22oLQWA2AdwMnID6PX9b58dR2QKo4qag1D1Z+L/FwEKTR7osOZPWECPJIHQqPUsM5i/CH5YupVPfFA5pHUBcsesh8eO5YhyWnaVRPZn/BmdXVumZWPxMP5e28zm2uqHgFoT9CymHYNNrzrrjlXZM06HnzDxYNlI5b/QosxLmmrqDFqmogQdqk0WLkUceoAvQxHgkIyvWU69BPFr24VB6+lx75Rna6dGtrmOxDnvBojvi1/4dHjVeg8owofPe1cOnxU1ioh016s/Vudv9mhV9f35At+Sh28h1bpp8xhr09+vf47Elx3Ms6hyp6QvB3t0vnLbOhwo660cp7K0vvepabK7YJfxEWWfrC2YzJfYOjygPwfwd/1amTqa0hZ5ueebhWYVMubRTwIjj+0Oq0ohU3zfRfuL8gt59XsHdwKtxTQQ4Y2qz6gisxnm2UdlmpEkgOsZz7iEk6QOt8BuPwr+NR01LTqXmJo1C76o1N274twJvl+I069TiLpenK/miRxhyY8jvYV6W1WuSwhH9q7kuwnJMtm7IWcqs7HsnyHSqWXLSpYtZGaR1V3t0gauninFPZGtWskF65rtti48UV9uV9KM8kfDYs0pgB00S+TlzTXV6P8mxq15b9En8sz3jWSszcifZa/NuufPNnNTb031pptt0+sRSH/7UG8pzbsgtt3OG3ut7B9JzDMt2mTZuyRNIV8D54TuTrpNcHtgmMlYJeiY9XS83NYJicjRjtJSf9BZLsQv629QdDsKQhTK5CnXhpk7vMNkHzPhm0ExW/VCGApHfPyBagtZQTQmPHx7g5IXXsrQDPzIVhv2LB6Ih138iSDww1JNHrDvzUxvp73MsQBVhW8EbrReaVUcLB1R3PUXyaYG4HpJUcLVxMgDxcPkVRQpL7VTAGabDzbKcvg12t5P8TSGQkrj/gOrpnbiDHwluA73xbXts/L7u468cRWSWRtgTwlQnA47EKg0OiZDgFxAKQQUcsbGomITgeXUAAyKe03eA7Mp4gnyKQmm0LXJtEk6ddksMJCuxDmmHzmVhO+XaN2A54MIh3niw5CF7PwiXFZrnA8wOdeHLvvhdoqIDG9PDI7UnWWHq526T8y6ixJPhkuVKZnoUruOpUgOOp3iIKBjk+yi1vHo5cItHXb1PIKzGaZlRS0g5d3MV2pD8FQdGYLZ73aae/eEIUePMc4NFz8pIUfLCrrF4jVWH5gQneN3S8vANBmUXrEcKGn6hIUN95y1vpsvLwbGpzV9L0ZKTan6TDXM05236uLJcIEMKVAxKNT0K8WljuwNny3BNQRfzovA85beI9zr1AGNYnYCVkR1aGngWURUrgqR+gRrQhxW81l3CHevjvGEPzPMTxdsIfB9dfGRbZU0cg/1mcubtECX4tvaedmNAvTxCJtc2QaoUalGfENCGK7IS/O8CRpdOVca8EWCRwv2sSWE8CJPW5PCugjCXPd3h6U60cPD+bdhtXZuYB6stcoveE7Sm5MM2yvfUHXFSW7KzLmi7/EeEWL0wqcOH9MOSKjhCHHmw+JGLcYE/7SBZQCRggox0ZZTAxrlzNNXYXL5fNIjkdT4YMqVUz6p8YDt049v4OXGdg3qTrtLBUXOZf7ahPlZAY/O+7Sp0bvGSHdyQ8B1LOsplqMb9Se8VAE7gIdSZvxbRSrfl+Lk5Qaqi5QJceqjitdErcHXg/3MryljPSIAMaaloFm1cVwBJ8DNmkDqoGROSHFetrgjQ5CahuKkdH5pRPigMrgTtlFI8ufJPJSUlGgTjbBSvpRc0zypiUn6U5KZqcRoyrtzhmJ7/caeZkmVRwJQeLOG8LY6vP5ChpKhc8Js0El+n6FXqbx9ItdtLtYP92kKfaTLtCi8StLZdENJa9Ex1nOoz1kQ7qxoiZFKRyLf4O4CHRT0T/0W9F8epNKVoeyxUXhy3sQMMsJjQJEyMOjmOhMFgOmmlscV4eFi1CldU92yjwleirEKPW3bPAuEhRZV7JsKV3Lr5cETAiFuX5Nw5UlF7d2HZ96Bh0sgFIL5KGaKSoVYVlvdKpZJVP5+NZ7xDEkQhmDgsDKciazJCXJ6ZN2B3FY2f6VZyGl/t4aunGIAk/BHaS+i+SpdRfnB/OktOvyjinWNfM9Ksr6WwtCa1hCmeRI6icpFM4o8quCLsikU0tMoZI/9EqXRMpKGaWzofl4nQuVQm17d5fU5qXCQeCDqVaL9XJ9qJ08n3G3EFZS28SHEb3cdRBdtO0YcTzil3QknNKEe/smQ1fTb0XbpyNB5xAeuIlf+5KWlEY0DqJbsnzJlQxJPOVyHiKMx5Xu9FcEv1Fbg6Fhm4t+Jyy5JC1W3YO8dYLsO0PXPbxodBgttTbH3rt9Cp1lJIk2r3O1Zqu94eRbnIz2f50lWolYzuKsj4PMok4abHLO8NAC884hiXx5Fy5pWKO0bWL7uEGXaJCtznhP67SlQ4xjWIfgq6EpZ28QMtuZK7JC0RGbl9nA4XtFLug/NLMoH1pGt9IonAJqcEDLyH6TDROcbsmGPaGIxMo41IUAnQVPMPGByp4mOmh9ZQMkBAcksUK55LsZj7E5z5XuZoyWCKu6nHmDq22xI/9Z8YdxJy4kWpD16jLVrpwGLWfyOD0Wd+cBzFBxVaGv7S5k9qwh/5t/LQEXsRqI3Q9Rm3QIoaZW9GlsDaKOUyykyWuhNOprSEi0s1G4rgoiX1V743EELti+pJu5og6X0g6oTynUqlhH9k6ezyRi05NGZHz0nvp3HOJr7ebrAUFrDjbkFBObEvdQWkkUbL0pEvMU46X58vF9j9F3j6kpyetNUBItrEubW9ZvMPM4qNqLlsSBJqOH3XbNwv/cXDXNxN8iFLzUhteisYY+RlHYOuP29/Cb+L+xv+35Rv7xudnZ6ohK4cMPfCG8KI7dNmjNk/H4e84pOxn/sZHK9psfvj8ncA8qJz7O8xqbxESDivGJOZzF7o5PJLQ7g34qAWoyuA+x3btU98LT6ZyGyceIXjrqob2CAVql4VOTQPUQYvHV/g4zAuCZGvYQBtf0wmd5lilrvuEn1BXLny01B4h4SMDlYsnNpm9d7m9h578ufpef9Z4WplqWQvqo52fyUA7J24eZD5av6SyGIV9kpmHNqyvdfzcpEMw97BvknV2fq+MFHun9BT3Lsf8pbzvisWiIQvYkng+8Vxk1V+dli1u56kY50LRjaPdotvT5BwqtwyF+emo/z9J3yVUVGfKrxQtJMOAQWoQii/4dp9wgybSa5mkucmRLtEQZ/pz0tL/NVcgWAd95nEQ3Tg6tNbuyn3Iepz65L3huMUUBntllWuu4DbtOFSMSbpILV4fy6wlM0SOvi6CpLh81c1LreIvKd61uEWBcDw1lUBUW1I0Z+m/PaRlX+PQ/oxg0Ye6KUiIiTF4ADNk59Ydpt5/rkxmq9tV5Kcp/eQLUVVmBzQNVuytQCP6Ezd0G8eLxWyHpmZWJ3bAzkWTtg4lZlw42SQezEmiUPaJUuR/qklVA/87S4ArFCpALdY3QRdUw3G3XbWUp6aq9z0zUizcPa7351p9JXOZyfdZBFnqt90VzQndXB/mwf8LC9STj5kenVpNuqOQQP3mIRJj7eV21FxG8VAxKrEn3c+XfmZ800EPb9/5lIlijscUbB6da0RQaMook0zug1G0tKi/JBC4rw7/D3m4ARzAkzMcVrDcT2SyFtUdWAsFlsPDFqV3N+EjyXaoEePwroaZCiLqEzb8MW+PNE9TmTC01EzWli51PzZvUqkmyuROU+V6ik+Le/9qT6nwzUzf9tP68tYei0YaDGx6kAd7jn1cKqOCuYbiELH9zYqcc4MnRJjkeGiqaGwLImhyeKs+xKJMBlOJ05ow9gGCKZ1VpnMKoSCTbMS+X+23y042zOb5MtcY/6oBeAo1Vy89OTyhpavFP78jXCcFH0t7Gx24hMEOm2gsEfGabVpQgvFqbQKMsknFRRmuPHcZu0Su/WMFphZvB2r/EGbG72rpGGho3h+Msz0uGzJ7hNK2uqQiE1qmn0zgacKYYZBCqsxV+sjbpoVdSilW/b94n2xNb648VmNIoizqEWhBnsen+d0kbCPmRItfWqSBeOd9Wne3c6bcd6uvXOJ6WdiSsuXq0ndhqrQ4QoWUjCjYtZ0EAhnSOP1m44xkf0O7jXghrzSJWxP4a/t72jU29Vu2rvu4n7HfHkkmQOMGSS+NPeLGO5I73mC2B7+lMiBQQZRM9/9liLIfowupUFAbPBbR+lxDM6M8Ptgh1paJq5Rvs7yEuLQv/7d1oU2woFSb3FMPWQOKMuCuJ7pDDjpIclus5TeEoMBy2YdVB4fxmesaCeMNsEgTHKS5WDSGyNUOoEpcC2OFWtIRf0w27ck34/DjxRTVIcc9+kqZE6iMSiVDsiKdP/Xz5XfEhm/sBhO50p1rvJDlkyyxuJ9SPgs7YeUJBjXdeAkE+P9OQJm6SZnn1svcduI78dYmbkE2mtziPrcjVisXG78spLvbZaSFx/Rks9zP4LKn0Cdz/3JsetkT06A8f/yCgMO6Mb1Hme0JJ7b2wZz1qleqTuKBGokhPVUZ0dVu+tnQYNEY1fmkZSz6+EGZ5EzL7657mreZGR3jUfaEk458PDniBzsSmBKhDRzfXameryJv9/D5m6HIqZ0R+ouCE54Dzp4IJuuD1e4Dc5i+PpSORJfG23uVgqixAMDvchMR0nZdH5brclYwRoJRWv/rlxGRI5ffD5NPGmIDt7vDE1434pYdVZIFh89Bs94HGGJbTwrN8T6lh1HZFTOB4lWzWj6EVqxSMvC0/ljWBQ3F2kc/mO2b6tWonT2JEqEwFts8rz2h+oWNds9ceR2cb7zZvJTDppHaEhK5avWqsseWa2Dt5BBhabdWSktS80oMQrL4TvAM9b5HMmyDnO+OkkbMXfUJG7eXqTIG6lqSOEbqVR+qYdP7uWb57WEJqzyh411GAVsDinPs7KvUeXItlcMdOUWzXBH6zscymV1LLVCtc8IePojzXHF9m5b5zGwBRdzcyUJkiu938ApmAayRdJrX1PmVguWUvt2ThQ62czItTyWJMW2An/hdDfMK7SiFQlGIdAbltHz3ycoh7j9V7GxNWBpbtcSdqm4XxRwTawc3cbZ+xfSv9qQfEkDKfZTwCkqWGI/ur250ItXlMlh6vUNWEYIg9A3GzbgmbqvTN8js2YMo87CU5y6nZ4dbJLDQJj9fc7yM7tZzJDZFtqOcU8+mZjYlq4VmifI23iHb1ZoT9E+kT2dolnP1AfiOkt7PQCSykBiXy5mv637IegWSKj9IKrYZf4Lu9+I7ub+mkRdlvYzehh/jaJ9n7HUH5b2IbgeNdkY7wx1yVzxS7pbvky6+nmVUtRllEFfweUQ0/nG017WoUYSxs+j2B4FV/F62EtHlMWZXYrjGHpthnNb1x66LKZ0Qe92INWHdfR/vqp02wMS8r1G4dJqHok8KmQ7947G13a4YXbsGgHcBvRuVu1eAi4/A5+ZixmdSXM73LupB/LH7O9yxLTVXJTyBbI1S49TIROrfVCOb/czZ9pM4JsZx8kUz8dQGv7gUWKxXvTH7QM/3J2OuXXgciUhqY+cgtaOliQQVOYthBLV3xpESZT3rmfEYNZxmpBbb24CRao86prn+i9TNOh8VxRJGXJfXHATJHs1T5txgc/opYrY8XjlGQQbRcoxIBcnVsMjmU1ymmIUL4dviJXndMAJ0Yet+c7O52/p98ytlmAsGBaTAmMhimAnvp1TWNGM9BpuitGj+t810CU2UhorrjPKGtThVC8WaXw04WFnT5fTjqmPyrQ0tN3CkLsctVy2xr0ZWgiWVZ1OrlFjjxJYsOiZv2cAoOvE+7sY0I/TwWcZqMoyIKNOftwP7w++Rfg67ljfovKYa50if3fzE/8aPYVey/Nq35+nH2sLPh/fP5TsylSKGOZ4k69d2PnH43+kq++sRXHQqGArWdwhx+hpwQC6JgT2uxehYU4Zbw7oNb6/HLikPyJROGK2ouyr+vzseESp9G50T4AyFrSqOQ0rroCYP4sMDFBrHn342EyZTMlSyk47rHSq89Y9/nI3zG5lX16Z5lxphguLOcZUndL8wNcrkyjH82jqg8Bo8OYkynrxZvbFno5lUS3OPr8Ko3mX9NoRPdYOKKjD07bvgFgpZ/RF+YzkWvJ/Hs/tUbfeGzGWLxNAjfDzHHMVSDwB5SabQLsIZHiBp43FjGkaienYoDd18hu2BGwOK7U3o70K/WY/kuuKdmdrykIBUdG2mvE91L1JtTbh20mOLbk1vCAamu7utlXeGU2ooVikbU/actcgmsC1FKk2qmj3GWeIWbj4tGIxE7BLcBWUvvcnd/lYxsMV4F917fWeFB/XbINN3qGvIyTpCalz1lVewdIGqeAS/gB8Mi+sA+BqDiX3VGD2eUunTRbSY+AuDy4E3Qx3hAhwnSXX+B0zuj3eQ1miS8Vux2z/l6/BkWtjKGU72aJkOCWhGcSf3+kFkkB15vGOsQrSdFr6qTj0gBYiOlnBO41170gOWHSUoBVRU2JjwppYdhIFDfu7tIRHccSNM5KZOFDPz0TGMAjzzEpeLwTWp+kn201kU6NjbiMQJx83+LX1e1tZ10kuChJZ/XBUQ1dwaBHjTDJDqOympEk8X2M3VtVw21JksChA8w1tTefO3RJ1FMbqZ01bHHkudDB/OhLfe7P5GOHaI28ZXKTMuqo0hLWQ4HabBsGG7NbP1RiXtETz074er6w/OerJWEqjmkq2y51q1BVI+JUudnVa3ogBpzdhFE7fC7kybrAt2Z6RqDjATAUEYeYK45WMupBKQRtQlU+uNsjnzj6ZmGrezA+ASrWxQ6LMkHRXqXwNq7ftv28dUx/ZSJciDXP2SWJsWaN0FjPX9Yko6LobZ7aYW/IdUktI9apTLyHS8DyWPyuoZyxN1TK/vtfxk3HwWh6JczZC8Ftn0bIJay2g+n5wd7lm9rEsKO+svqVmi+c1j88hSCxbzrg4+HEP0Nt1/B6YW1XVm09T1CpAKjc9n18hjqsaFGdfyva1ZG0Xu3ip6N6JGpyTSqY5h4BOlpLPaOnyw45PdXTN+DtAKg7DLrLFTnWusoSBHk3s0d7YouJHq85/R09Tfc37ENXZF48eAYLnq9GLioNcwDZrC6FW6godB8JnqYUPvn0pWLfQz0lM0Yy8Mybgn84Ds3Q9bDP10bLyOV+qzxa4Rd9Dhu7cju8mMaONXK3UqmBQ9qIg7etIwEqM/kECk/Dzja4Bs1xR+Q/tCbc8IKrSGsTdJJ0vge7IG20W687uVmK6icWQ6cD3lwFzgNMGtFvO5qyJeKflGLAAcQZOrkxVwy3cWvqlGpvjmf9Qe6Ap20MPbV92DPV0OhFM4kz8Yr0ffC2zLWSQ1kqY6QdQrttR3kh1YLtQd1kCEv5hVoPIRWl5ERcUTttBIrWp6Xs5Ehh5OUUwI5aEBvuiDmUoENmnVw1FohCrbRp1A1E+XSlWVOTi7ADW+5Ohb9z1vK4qx5R5lPdGCPBJZ00mC+Ssp8VUbgpGAvXWMuWQQRbCqI6Rr2jtxZxtfP7W/8onz+yz0Gs76LaT5HX9ecyiZCB/ZR/gFtMxPsDwohoeCRtiuLxE1GM1vUEUgBv86+eehL58/P56QFGQ/MqOe/vC76L63jzmeax4exd/OKTUvkXg+fOJUHych9xt/9goJMrapSgvXrj8+8vk/N80f22Sewj6cyGqt1B6mztoeklVHHraouhvHJaG/OuBz6DHKMpFmQULU1bRWlyYE0RPXYYkUycIemN7TLtgNCJX6BqdyxDKkegO7nJK5xQ7OVYDZTMf9bVHidtk6DQX9Et+V9M7esgbsYBdEeUpsB0Xvw2kd9+rI7V+m47u+O/tq7mw7262HU1WlS9uFzsV6JxIHNmUCy0QS9e077JGRFbG65z3/dOKB/Zk+yDdKpUmdXjn/aS3N5nv4fK7bMHHmPlHd4E2+iTbV5rpzScRnxk6KARuDTJ8Q1LpK2mP8gj1EbuJ9RIyY+EWK4hCiIDBAS1Tm2IEXAFfgKPgdL9O6mAa06wjCcUAL6EsxPQWO9VNegBPm/0GgkZbDxCynxujX/92vmGcjZRMAY45puak2sFLCLSwXpEsyy5fnF0jGJBhm+fNSHKKUUfy+276A7/feLOFxxUuHRNJI2Osenxyvf8DAGObT60pfTTlhEg9u/KKkhJqm5U1/+BEcSkpFDA5XeCqxwXmPac1jcuZ3JWQ+p0NdWzb/5v1ZvF8GtMTFFEdQjpLO0bwPb0BHNWnip3liDXI2fXf05jjvfJ0NpjLCUgfTh9CMFYVFKEd4Z/OG/2C+N435mnK+9t1gvCiVcaaH7rK4+PjCvpVNiz+t2QyqH1O8x3JKZVl6Q+Lp/XK8wMjVMslOq9FdSw5FtUs/CptXH9PW+wbWHgrV17R5jTVOtGtKFu3nb80T+E0tv9QkzW3J2dbaw/8ddAKZ0pxIaEqLjlPrji3VgJ3GvdFvlqD8075woxh4fVt0JZE0KVFsAvqhe0dqN9b35jtSpnYMXkU+vZq+IAHad3IHc2s/LYrnD1anfG46IFiMIr9oNbZDWvwthqYNqOigaKd/XlLU4XHfk/PXIjPsLy/9/kAtQ+/wKH+hI/IROWj5FPvTZAT9f7j4ZXQyG4M0TujMAFXYkKvEHv1xhySekgXGGqNxWeWKlf8dDAlLuB1cb/qOD+rk7cmwt+1yKpk9cudqBanTi6zTbXRtV8qylNtjyOVKy1HTz0GW9rjt6sSjAZcT5R+KdtyYb0zyqG9pSLuCw5WBwAn7fjBjKLLoxLXMI+52L9cLwIR2B6OllJZLHJ8vDxmWdtF+QJnmt1rsHPIWY20lftk8fYePkAIg6Hgn532QoIpegMxiWgAOfe5/U44APR8Ac0NeZrVh3gEhs12W+tVSiWiUQekf/YBECUy5fdYbA08dd7VzPAP9aiVcIB9k6tY7WdJ1wNV+bHeydNtmC6G5ICtFC1ZwmJU/j8hf0I8TRVKSiz5oYIa93EpUI78X8GYIAZabx47/n8LDAAJ0nNtP1rpROprqKMBRecShca6qXuTSI3jZBLOB3Vp381B5rCGhjSvh/NSVkYp2qIdP/Bg=";
          },
          {}
        ],
        6: [
          function(require2, module2, exports2) {
            var data = require2("./dictionary-browser");
            exports2.init = function() {
              exports2.dictionary = data.init();
            };
            exports2.offsetsByLength = new Uint32Array([
              0,
              0,
              0,
              0,
              0,
              4096,
              9216,
              21504,
              35840,
              44032,
              53248,
              63488,
              74752,
              87040,
              93696,
              100864,
              104704,
              106752,
              108928,
              113536,
              115968,
              118528,
              119872,
              121280,
              122016
            ]);
            exports2.sizeBitsByLength = new Uint8Array([
              0,
              0,
              0,
              0,
              10,
              10,
              11,
              11,
              10,
              10,
              10,
              10,
              10,
              9,
              9,
              8,
              7,
              7,
              8,
              7,
              7,
              6,
              6,
              5,
              5
            ]);
            exports2.minDictionaryWordLength = 4;
            exports2.maxDictionaryWordLength = 24;
          },
          { "./dictionary-browser": 4 }
        ],
        7: [
          function(require2, module2, exports2) {
            function HuffmanCode(bits, value) {
              this.bits = bits;
              this.value = value;
            }
            exports2.HuffmanCode = HuffmanCode;
            var MAX_LENGTH = 15;
            function GetNextKey(key, len) {
              var step = 1 << len - 1;
              while (key & step) {
                step >>= 1;
              }
              return (key & step - 1) + step;
            }
            function ReplicateValue(table, i3, step, end, code) {
              do {
                end -= step;
                table[i3 + end] = new HuffmanCode(
                  code.bits,
                  code.value
                );
              } while (end > 0);
            }
            function NextTableBitSize(count, len, root_bits) {
              var left = 1 << len - root_bits;
              while (len < MAX_LENGTH) {
                left -= count[len];
                if (left <= 0) break;
                ++len;
                left <<= 1;
              }
              return len - root_bits;
            }
            exports2.BrotliBuildHuffmanTable = function(root_table, table, root_bits, code_lengths, code_lengths_size) {
              var start_table = table;
              var code;
              var len;
              var symbol;
              var key;
              var step;
              var low;
              var mask;
              var table_bits;
              var table_size;
              var total_size;
              var sorted;
              var count = new Int32Array(
                MAX_LENGTH + 1
              );
              var offset3 = new Int32Array(
                MAX_LENGTH + 1
              );
              sorted = new Int32Array(code_lengths_size);
              for (symbol = 0; symbol < code_lengths_size; symbol++) {
                count[code_lengths[symbol]]++;
              }
              offset3[1] = 0;
              for (len = 1; len < MAX_LENGTH; len++) {
                offset3[len + 1] = offset3[len] + count[len];
              }
              for (symbol = 0; symbol < code_lengths_size; symbol++) {
                if (code_lengths[symbol] !== 0) {
                  sorted[offset3[code_lengths[symbol]]++] = symbol;
                }
              }
              table_bits = root_bits;
              table_size = 1 << table_bits;
              total_size = table_size;
              if (offset3[MAX_LENGTH] === 1) {
                for (key = 0; key < total_size; ++key) {
                  root_table[table + key] = new HuffmanCode(
                    0,
                    sorted[0] & 65535
                  );
                }
                return total_size;
              }
              key = 0;
              symbol = 0;
              for (len = 1, step = 2; len <= root_bits; ++len, step <<= 1) {
                for (; count[len] > 0; --count[len]) {
                  code = new HuffmanCode(
                    len & 255,
                    sorted[symbol++] & 65535
                  );
                  ReplicateValue(
                    root_table,
                    table + key,
                    step,
                    table_size,
                    code
                  );
                  key = GetNextKey(key, len);
                }
              }
              mask = total_size - 1;
              low = -1;
              for (len = root_bits + 1, step = 2; len <= MAX_LENGTH; ++len, step <<= 1) {
                for (; count[len] > 0; --count[len]) {
                  if ((key & mask) !== low) {
                    table += table_size;
                    table_bits = NextTableBitSize(
                      count,
                      len,
                      root_bits
                    );
                    table_size = 1 << table_bits;
                    total_size += table_size;
                    low = key & mask;
                    root_table[start_table + low] = new HuffmanCode(
                      table_bits + root_bits & 255,
                      table - start_table - low & 65535
                    );
                  }
                  code = new HuffmanCode(
                    len - root_bits & 255,
                    sorted[symbol++] & 65535
                  );
                  ReplicateValue(
                    root_table,
                    table + (key >> root_bits),
                    step,
                    table_size,
                    code
                  );
                  key = GetNextKey(key, len);
                }
              }
              return total_size;
            };
          },
          {}
        ],
        8: [
          function(require2, module2, exports2) {
            "use strict";
            exports2.byteLength = byteLength;
            exports2.toByteArray = toByteArray;
            exports2.fromByteArray = fromByteArray;
            var lookup = [];
            var revLookup = [];
            var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
            var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
            for (var i3 = 0, len = code.length; i3 < len; ++i3) {
              lookup[i3] = code[i3];
              revLookup[code.charCodeAt(i3)] = i3;
            }
            revLookup["-".charCodeAt(0)] = 62;
            revLookup["_".charCodeAt(0)] = 63;
            function getLens(b64) {
              var len2 = b64.length;
              if (len2 % 4 > 0) {
                throw new Error(
                  "Invalid string. Length must be a multiple of 4"
                );
              }
              var validLen = b64.indexOf("=");
              if (validLen === -1) validLen = len2;
              var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
              return [validLen, placeHoldersLen];
            }
            function byteLength(b64) {
              var lens = getLens(b64);
              var validLen = lens[0];
              var placeHoldersLen = lens[1];
              return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
            }
            function _byteLength(b64, validLen, placeHoldersLen) {
              return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
            }
            function toByteArray(b64) {
              var tmp;
              var lens = getLens(b64);
              var validLen = lens[0];
              var placeHoldersLen = lens[1];
              var arr = new Arr(
                _byteLength(b64, validLen, placeHoldersLen)
              );
              var curByte = 0;
              var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;
              for (var i22 = 0; i22 < len2; i22 += 4) {
                tmp = revLookup[b64.charCodeAt(i22)] << 18 | revLookup[b64.charCodeAt(i22 + 1)] << 12 | revLookup[b64.charCodeAt(i22 + 2)] << 6 | revLookup[b64.charCodeAt(i22 + 3)];
                arr[curByte++] = tmp >> 16 & 255;
                arr[curByte++] = tmp >> 8 & 255;
                arr[curByte++] = tmp & 255;
              }
              if (placeHoldersLen === 2) {
                tmp = revLookup[b64.charCodeAt(i22)] << 2 | revLookup[b64.charCodeAt(i22 + 1)] >> 4;
                arr[curByte++] = tmp & 255;
              }
              if (placeHoldersLen === 1) {
                tmp = revLookup[b64.charCodeAt(i22)] << 10 | revLookup[b64.charCodeAt(i22 + 1)] << 4 | revLookup[b64.charCodeAt(i22 + 2)] >> 2;
                arr[curByte++] = tmp >> 8 & 255;
                arr[curByte++] = tmp & 255;
              }
              return arr;
            }
            function tripletToBase64(num) {
              return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
            }
            function encodeChunk(uint8, start, end) {
              var tmp;
              var output = [];
              for (var i22 = start; i22 < end; i22 += 3) {
                tmp = (uint8[i22] << 16 & 16711680) + (uint8[i22 + 1] << 8 & 65280) + (uint8[i22 + 2] & 255);
                output.push(tripletToBase64(tmp));
              }
              return output.join("");
            }
            function fromByteArray(uint8) {
              var tmp;
              var len2 = uint8.length;
              var extraBytes = len2 % 3;
              var parts = [];
              var maxChunkLength = 16383;
              for (var i22 = 0, len22 = len2 - extraBytes; i22 < len22; i22 += maxChunkLength) {
                parts.push(
                  encodeChunk(
                    uint8,
                    i22,
                    i22 + maxChunkLength > len22 ? len22 : i22 + maxChunkLength
                  )
                );
              }
              if (extraBytes === 1) {
                tmp = uint8[len2 - 1];
                parts.push(
                  lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "=="
                );
              } else if (extraBytes === 2) {
                tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];
                parts.push(
                  lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "="
                );
              }
              return parts.join("");
            }
          },
          {}
        ],
        9: [
          function(require2, module2, exports2) {
            function PrefixCodeRange(offset3, nbits) {
              this.offset = offset3;
              this.nbits = nbits;
            }
            exports2.kBlockLengthPrefixCode = [
              new PrefixCodeRange(1, 2),
              new PrefixCodeRange(5, 2),
              new PrefixCodeRange(9, 2),
              new PrefixCodeRange(13, 2),
              new PrefixCodeRange(17, 3),
              new PrefixCodeRange(25, 3),
              new PrefixCodeRange(33, 3),
              new PrefixCodeRange(41, 3),
              new PrefixCodeRange(49, 4),
              new PrefixCodeRange(65, 4),
              new PrefixCodeRange(81, 4),
              new PrefixCodeRange(97, 4),
              new PrefixCodeRange(113, 5),
              new PrefixCodeRange(145, 5),
              new PrefixCodeRange(177, 5),
              new PrefixCodeRange(209, 5),
              new PrefixCodeRange(241, 6),
              new PrefixCodeRange(305, 6),
              new PrefixCodeRange(369, 7),
              new PrefixCodeRange(497, 8),
              new PrefixCodeRange(753, 9),
              new PrefixCodeRange(1265, 10),
              new PrefixCodeRange(2289, 11),
              new PrefixCodeRange(4337, 12),
              new PrefixCodeRange(8433, 13),
              new PrefixCodeRange(16625, 24)
            ];
            exports2.kInsertLengthPrefixCode = [
              new PrefixCodeRange(0, 0),
              new PrefixCodeRange(1, 0),
              new PrefixCodeRange(2, 0),
              new PrefixCodeRange(3, 0),
              new PrefixCodeRange(4, 0),
              new PrefixCodeRange(5, 0),
              new PrefixCodeRange(6, 1),
              new PrefixCodeRange(8, 1),
              new PrefixCodeRange(10, 2),
              new PrefixCodeRange(14, 2),
              new PrefixCodeRange(18, 3),
              new PrefixCodeRange(26, 3),
              new PrefixCodeRange(34, 4),
              new PrefixCodeRange(50, 4),
              new PrefixCodeRange(66, 5),
              new PrefixCodeRange(98, 5),
              new PrefixCodeRange(130, 6),
              new PrefixCodeRange(194, 7),
              new PrefixCodeRange(322, 8),
              new PrefixCodeRange(578, 9),
              new PrefixCodeRange(1090, 10),
              new PrefixCodeRange(2114, 12),
              new PrefixCodeRange(6210, 14),
              new PrefixCodeRange(22594, 24)
            ];
            exports2.kCopyLengthPrefixCode = [
              new PrefixCodeRange(2, 0),
              new PrefixCodeRange(3, 0),
              new PrefixCodeRange(4, 0),
              new PrefixCodeRange(5, 0),
              new PrefixCodeRange(6, 0),
              new PrefixCodeRange(7, 0),
              new PrefixCodeRange(8, 0),
              new PrefixCodeRange(9, 0),
              new PrefixCodeRange(10, 1),
              new PrefixCodeRange(12, 1),
              new PrefixCodeRange(14, 2),
              new PrefixCodeRange(18, 2),
              new PrefixCodeRange(22, 3),
              new PrefixCodeRange(30, 3),
              new PrefixCodeRange(38, 4),
              new PrefixCodeRange(54, 4),
              new PrefixCodeRange(70, 5),
              new PrefixCodeRange(102, 5),
              new PrefixCodeRange(134, 6),
              new PrefixCodeRange(198, 7),
              new PrefixCodeRange(326, 8),
              new PrefixCodeRange(582, 9),
              new PrefixCodeRange(1094, 10),
              new PrefixCodeRange(2118, 24)
            ];
            exports2.kInsertRangeLut = [0, 0, 8, 8, 0, 16, 8, 16, 16];
            exports2.kCopyRangeLut = [0, 8, 0, 8, 16, 0, 16, 8, 16];
          },
          {}
        ],
        10: [
          function(require2, module2, exports2) {
            function BrotliInput(buffer) {
              this.buffer = buffer;
              this.pos = 0;
            }
            BrotliInput.prototype.read = function(buf, i3, count) {
              if (this.pos + count > this.buffer.length) {
                count = this.buffer.length - this.pos;
              }
              for (var p4 = 0; p4 < count; p4++)
                buf[i3 + p4] = this.buffer[this.pos + p4];
              this.pos += count;
              return count;
            };
            exports2.BrotliInput = BrotliInput;
            function BrotliOutput(buf) {
              this.buffer = buf;
              this.pos = 0;
            }
            BrotliOutput.prototype.write = function(buf, count) {
              if (this.pos + count > this.buffer.length)
                throw new Error(
                  "Output buffer is not large enough"
                );
              this.buffer.set(buf.subarray(0, count), this.pos);
              this.pos += count;
              return count;
            };
            exports2.BrotliOutput = BrotliOutput;
          },
          {}
        ],
        11: [
          function(require2, module2, exports2) {
            var BrotliDictionary = require2("./dictionary");
            var kIdentity = 0;
            var kOmitLast1 = 1;
            var kOmitLast2 = 2;
            var kOmitLast3 = 3;
            var kOmitLast4 = 4;
            var kOmitLast5 = 5;
            var kOmitLast6 = 6;
            var kOmitLast7 = 7;
            var kOmitLast8 = 8;
            var kOmitLast9 = 9;
            var kUppercaseFirst = 10;
            var kUppercaseAll = 11;
            var kOmitFirst1 = 12;
            var kOmitFirst2 = 13;
            var kOmitFirst3 = 14;
            var kOmitFirst4 = 15;
            var kOmitFirst5 = 16;
            var kOmitFirst6 = 17;
            var kOmitFirst7 = 18;
            var kOmitFirst8 = 19;
            var kOmitFirst9 = 20;
            function Transform(prefix, transform, suffix) {
              this.prefix = new Uint8Array(prefix.length);
              this.transform = transform;
              this.suffix = new Uint8Array(suffix.length);
              for (var i3 = 0; i3 < prefix.length; i3++)
                this.prefix[i3] = prefix.charCodeAt(i3);
              for (var i3 = 0; i3 < suffix.length; i3++)
                this.suffix[i3] = suffix.charCodeAt(i3);
            }
            var kTransforms = [
              new Transform("", kIdentity, ""),
              new Transform("", kIdentity, " "),
              new Transform(" ", kIdentity, " "),
              new Transform("", kOmitFirst1, ""),
              new Transform("", kUppercaseFirst, " "),
              new Transform("", kIdentity, " the "),
              new Transform(" ", kIdentity, ""),
              new Transform("s ", kIdentity, " "),
              new Transform("", kIdentity, " of "),
              new Transform("", kUppercaseFirst, ""),
              new Transform("", kIdentity, " and "),
              new Transform("", kOmitFirst2, ""),
              new Transform("", kOmitLast1, ""),
              new Transform(", ", kIdentity, " "),
              new Transform("", kIdentity, ", "),
              new Transform(" ", kUppercaseFirst, " "),
              new Transform("", kIdentity, " in "),
              new Transform("", kIdentity, " to "),
              new Transform("e ", kIdentity, " "),
              new Transform("", kIdentity, '"'),
              new Transform("", kIdentity, "."),
              new Transform("", kIdentity, '">'),
              new Transform("", kIdentity, "\n"),
              new Transform("", kOmitLast3, ""),
              new Transform("", kIdentity, "]"),
              new Transform("", kIdentity, " for "),
              new Transform("", kOmitFirst3, ""),
              new Transform("", kOmitLast2, ""),
              new Transform("", kIdentity, " a "),
              new Transform("", kIdentity, " that "),
              new Transform(" ", kUppercaseFirst, ""),
              new Transform("", kIdentity, ". "),
              new Transform(".", kIdentity, ""),
              new Transform(" ", kIdentity, ", "),
              new Transform("", kOmitFirst4, ""),
              new Transform("", kIdentity, " with "),
              new Transform("", kIdentity, "'"),
              new Transform("", kIdentity, " from "),
              new Transform("", kIdentity, " by "),
              new Transform("", kOmitFirst5, ""),
              new Transform("", kOmitFirst6, ""),
              new Transform(" the ", kIdentity, ""),
              new Transform("", kOmitLast4, ""),
              new Transform("", kIdentity, ". The "),
              new Transform("", kUppercaseAll, ""),
              new Transform("", kIdentity, " on "),
              new Transform("", kIdentity, " as "),
              new Transform("", kIdentity, " is "),
              new Transform("", kOmitLast7, ""),
              new Transform("", kOmitLast1, "ing "),
              new Transform("", kIdentity, "\n	"),
              new Transform("", kIdentity, ":"),
              new Transform(" ", kIdentity, ". "),
              new Transform("", kIdentity, "ed "),
              new Transform("", kOmitFirst9, ""),
              new Transform("", kOmitFirst7, ""),
              new Transform("", kOmitLast6, ""),
              new Transform("", kIdentity, "("),
              new Transform("", kUppercaseFirst, ", "),
              new Transform("", kOmitLast8, ""),
              new Transform("", kIdentity, " at "),
              new Transform("", kIdentity, "ly "),
              new Transform(" the ", kIdentity, " of "),
              new Transform("", kOmitLast5, ""),
              new Transform("", kOmitLast9, ""),
              new Transform(" ", kUppercaseFirst, ", "),
              new Transform("", kUppercaseFirst, '"'),
              new Transform(".", kIdentity, "("),
              new Transform("", kUppercaseAll, " "),
              new Transform("", kUppercaseFirst, '">'),
              new Transform("", kIdentity, '="'),
              new Transform(" ", kIdentity, "."),
              new Transform(".com/", kIdentity, ""),
              new Transform(" the ", kIdentity, " of the "),
              new Transform("", kUppercaseFirst, "'"),
              new Transform("", kIdentity, ". This "),
              new Transform("", kIdentity, ","),
              new Transform(".", kIdentity, " "),
              new Transform("", kUppercaseFirst, "("),
              new Transform("", kUppercaseFirst, "."),
              new Transform("", kIdentity, " not "),
              new Transform(" ", kIdentity, '="'),
              new Transform("", kIdentity, "er "),
              new Transform(" ", kUppercaseAll, " "),
              new Transform("", kIdentity, "al "),
              new Transform(" ", kUppercaseAll, ""),
              new Transform("", kIdentity, "='"),
              new Transform("", kUppercaseAll, '"'),
              new Transform("", kUppercaseFirst, ". "),
              new Transform(" ", kIdentity, "("),
              new Transform("", kIdentity, "ful "),
              new Transform(" ", kUppercaseFirst, ". "),
              new Transform("", kIdentity, "ive "),
              new Transform("", kIdentity, "less "),
              new Transform("", kUppercaseAll, "'"),
              new Transform("", kIdentity, "est "),
              new Transform(" ", kUppercaseFirst, "."),
              new Transform("", kUppercaseAll, '">'),
              new Transform(" ", kIdentity, "='"),
              new Transform("", kUppercaseFirst, ","),
              new Transform("", kIdentity, "ize "),
              new Transform("", kUppercaseAll, "."),
              new Transform("\xC2\xA0", kIdentity, ""),
              new Transform(" ", kIdentity, ","),
              new Transform("", kUppercaseFirst, '="'),
              new Transform("", kUppercaseAll, '="'),
              new Transform("", kIdentity, "ous "),
              new Transform("", kUppercaseAll, ", "),
              new Transform("", kUppercaseFirst, "='"),
              new Transform(" ", kUppercaseFirst, ","),
              new Transform(" ", kUppercaseAll, '="'),
              new Transform(" ", kUppercaseAll, ", "),
              new Transform("", kUppercaseAll, ","),
              new Transform("", kUppercaseAll, "("),
              new Transform("", kUppercaseAll, ". "),
              new Transform(" ", kUppercaseAll, "."),
              new Transform("", kUppercaseAll, "='"),
              new Transform(" ", kUppercaseAll, ". "),
              new Transform(" ", kUppercaseFirst, '="'),
              new Transform(" ", kUppercaseAll, "='"),
              new Transform(" ", kUppercaseFirst, "='")
            ];
            exports2.kTransforms = kTransforms;
            exports2.kNumTransforms = kTransforms.length;
            function ToUpperCase(p4, i3) {
              if (p4[i3] < 192) {
                if (p4[i3] >= 97 && p4[i3] <= 122) {
                  p4[i3] ^= 32;
                }
                return 1;
              }
              if (p4[i3] < 224) {
                p4[i3 + 1] ^= 32;
                return 2;
              }
              p4[i3 + 2] ^= 5;
              return 3;
            }
            exports2.transformDictionaryWord = function(dst, idx, word, len, transform) {
              var prefix = kTransforms[transform].prefix;
              var suffix = kTransforms[transform].suffix;
              var t4 = kTransforms[transform].transform;
              var skip = t4 < kOmitFirst1 ? 0 : t4 - (kOmitFirst1 - 1);
              var i3 = 0;
              var start_idx = idx;
              var uppercase;
              if (skip > len) {
                skip = len;
              }
              var prefix_pos = 0;
              while (prefix_pos < prefix.length) {
                dst[idx++] = prefix[prefix_pos++];
              }
              word += skip;
              len -= skip;
              if (t4 <= kOmitLast9) {
                len -= t4;
              }
              for (i3 = 0; i3 < len; i3++) {
                dst[idx++] = BrotliDictionary.dictionary[word + i3];
              }
              uppercase = idx - len;
              if (t4 === kUppercaseFirst) {
                ToUpperCase(dst, uppercase);
              } else if (t4 === kUppercaseAll) {
                while (len > 0) {
                  var step = ToUpperCase(dst, uppercase);
                  uppercase += step;
                  len -= step;
                }
              }
              var suffix_pos = 0;
              while (suffix_pos < suffix.length) {
                dst[idx++] = suffix[suffix_pos++];
              }
              return idx - start_idx;
            };
          },
          { "./dictionary": 6 }
        ],
        12: [
          function(require2, module2, exports2) {
            module2.exports = require2("./dec/decode").BrotliDecompressBuffer;
          },
          { "./dec/decode": 3 }
        ]
      },
      {},
      [12]
    )(12);
  })();

  // packages/global-styles-ui/build-module/font-library/lib/inflate.mjs
  var __require3 = /* @__PURE__ */ ((x2) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x2, {
    get: (a3, b3) => (typeof __require !== "undefined" ? __require : a3)[b3]
  }) : x2)(function(x2) {
    if (typeof __require !== "undefined") return __require.apply(this, arguments);
    throw Error('Dynamic require of "' + x2 + '" is not supported');
  });
  var inflate_default = (function() {
    var define2, module, exports;
    return (/* @__PURE__ */ (function() {
      function r4(e3, n3, t4) {
        function o4(i22, f3) {
          if (!n3[i22]) {
            if (!e3[i22]) {
              var c2 = "function" == typeof __require3 && __require3;
              if (!f3 && c2) return c2(i22, true);
              if (u3) return u3(i22, true);
              var a3 = new Error("Cannot find module '" + i22 + "'");
              throw a3.code = "MODULE_NOT_FOUND", a3;
            }
            var p4 = n3[i22] = { exports: {} };
            e3[i22][0].call(
              p4.exports,
              function(r22) {
                var n22 = e3[i22][1][r22];
                return o4(n22 || r22);
              },
              p4,
              p4.exports,
              r4,
              e3,
              n3,
              t4
            );
          }
          return n3[i22].exports;
        }
        for (var u3 = "function" == typeof __require3 && __require3, i3 = 0; i3 < t4.length; i3++)
          o4(t4[i3]);
        return o4;
      }
      return r4;
    })())(
      {
        1: [
          function(require2, module2, exports2) {
            "use strict";
            var TYPED_OK = typeof Uint8Array !== "undefined" && typeof Uint16Array !== "undefined" && typeof Int32Array !== "undefined";
            function _has(obj, key) {
              return Object.prototype.hasOwnProperty.call(obj, key);
            }
            exports2.assign = function(obj) {
              var sources = Array.prototype.slice.call(
                arguments,
                1
              );
              while (sources.length) {
                var source = sources.shift();
                if (!source) {
                  continue;
                }
                if (typeof source !== "object") {
                  throw new TypeError(
                    source + "must be non-object"
                  );
                }
                for (var p4 in source) {
                  if (_has(source, p4)) {
                    obj[p4] = source[p4];
                  }
                }
              }
              return obj;
            };
            exports2.shrinkBuf = function(buf, size3) {
              if (buf.length === size3) {
                return buf;
              }
              if (buf.subarray) {
                return buf.subarray(0, size3);
              }
              buf.length = size3;
              return buf;
            };
            var fnTyped = {
              arraySet: function(dest, src, src_offs, len, dest_offs) {
                if (src.subarray && dest.subarray) {
                  dest.set(
                    src.subarray(src_offs, src_offs + len),
                    dest_offs
                  );
                  return;
                }
                for (var i3 = 0; i3 < len; i3++) {
                  dest[dest_offs + i3] = src[src_offs + i3];
                }
              },
              // Join array of chunks to single array.
              flattenChunks: function(chunks) {
                var i3, l3, len, pos, chunk, result;
                len = 0;
                for (i3 = 0, l3 = chunks.length; i3 < l3; i3++) {
                  len += chunks[i3].length;
                }
                result = new Uint8Array(len);
                pos = 0;
                for (i3 = 0, l3 = chunks.length; i3 < l3; i3++) {
                  chunk = chunks[i3];
                  result.set(chunk, pos);
                  pos += chunk.length;
                }
                return result;
              }
            };
            var fnUntyped = {
              arraySet: function(dest, src, src_offs, len, dest_offs) {
                for (var i3 = 0; i3 < len; i3++) {
                  dest[dest_offs + i3] = src[src_offs + i3];
                }
              },
              // Join array of chunks to single array.
              flattenChunks: function(chunks) {
                return [].concat.apply([], chunks);
              }
            };
            exports2.setTyped = function(on) {
              if (on) {
                exports2.Buf8 = Uint8Array;
                exports2.Buf16 = Uint16Array;
                exports2.Buf32 = Int32Array;
                exports2.assign(exports2, fnTyped);
              } else {
                exports2.Buf8 = Array;
                exports2.Buf16 = Array;
                exports2.Buf32 = Array;
                exports2.assign(exports2, fnUntyped);
              }
            };
            exports2.setTyped(TYPED_OK);
          },
          {}
        ],
        2: [
          function(require2, module2, exports2) {
            "use strict";
            var utils = require2("./common");
            var STR_APPLY_OK = true;
            var STR_APPLY_UIA_OK = true;
            try {
              String.fromCharCode.apply(null, [0]);
            } catch (__218) {
              STR_APPLY_OK = false;
            }
            try {
              String.fromCharCode.apply(null, new Uint8Array(1));
            } catch (__218) {
              STR_APPLY_UIA_OK = false;
            }
            var _utf8len = new utils.Buf8(256);
            for (var q = 0; q < 256; q++) {
              _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1;
            }
            _utf8len[254] = _utf8len[254] = 1;
            exports2.string2buf = function(str) {
              var buf, c2, c22, m_pos, i3, str_len = str.length, buf_len = 0;
              for (m_pos = 0; m_pos < str_len; m_pos++) {
                c2 = str.charCodeAt(m_pos);
                if ((c2 & 64512) === 55296 && m_pos + 1 < str_len) {
                  c22 = str.charCodeAt(m_pos + 1);
                  if ((c22 & 64512) === 56320) {
                    c2 = 65536 + (c2 - 55296 << 10) + (c22 - 56320);
                    m_pos++;
                  }
                }
                buf_len += c2 < 128 ? 1 : c2 < 2048 ? 2 : c2 < 65536 ? 3 : 4;
              }
              buf = new utils.Buf8(buf_len);
              for (i3 = 0, m_pos = 0; i3 < buf_len; m_pos++) {
                c2 = str.charCodeAt(m_pos);
                if ((c2 & 64512) === 55296 && m_pos + 1 < str_len) {
                  c22 = str.charCodeAt(m_pos + 1);
                  if ((c22 & 64512) === 56320) {
                    c2 = 65536 + (c2 - 55296 << 10) + (c22 - 56320);
                    m_pos++;
                  }
                }
                if (c2 < 128) {
                  buf[i3++] = c2;
                } else if (c2 < 2048) {
                  buf[i3++] = 192 | c2 >>> 6;
                  buf[i3++] = 128 | c2 & 63;
                } else if (c2 < 65536) {
                  buf[i3++] = 224 | c2 >>> 12;
                  buf[i3++] = 128 | c2 >>> 6 & 63;
                  buf[i3++] = 128 | c2 & 63;
                } else {
                  buf[i3++] = 240 | c2 >>> 18;
                  buf[i3++] = 128 | c2 >>> 12 & 63;
                  buf[i3++] = 128 | c2 >>> 6 & 63;
                  buf[i3++] = 128 | c2 & 63;
                }
              }
              return buf;
            };
            function buf2binstring(buf, len) {
              if (len < 65534) {
                if (buf.subarray && STR_APPLY_UIA_OK || !buf.subarray && STR_APPLY_OK) {
                  return String.fromCharCode.apply(
                    null,
                    utils.shrinkBuf(buf, len)
                  );
                }
              }
              var result = "";
              for (var i3 = 0; i3 < len; i3++) {
                result += String.fromCharCode(buf[i3]);
              }
              return result;
            }
            exports2.buf2binstring = function(buf) {
              return buf2binstring(buf, buf.length);
            };
            exports2.binstring2buf = function(str) {
              var buf = new utils.Buf8(str.length);
              for (var i3 = 0, len = buf.length; i3 < len; i3++) {
                buf[i3] = str.charCodeAt(i3);
              }
              return buf;
            };
            exports2.buf2string = function(buf, max2) {
              var i3, out, c2, c_len;
              var len = max2 || buf.length;
              var utf16buf = new Array(len * 2);
              for (out = 0, i3 = 0; i3 < len; ) {
                c2 = buf[i3++];
                if (c2 < 128) {
                  utf16buf[out++] = c2;
                  continue;
                }
                c_len = _utf8len[c2];
                if (c_len > 4) {
                  utf16buf[out++] = 65533;
                  i3 += c_len - 1;
                  continue;
                }
                c2 &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7;
                while (c_len > 1 && i3 < len) {
                  c2 = c2 << 6 | buf[i3++] & 63;
                  c_len--;
                }
                if (c_len > 1) {
                  utf16buf[out++] = 65533;
                  continue;
                }
                if (c2 < 65536) {
                  utf16buf[out++] = c2;
                } else {
                  c2 -= 65536;
                  utf16buf[out++] = 55296 | c2 >> 10 & 1023;
                  utf16buf[out++] = 56320 | c2 & 1023;
                }
              }
              return buf2binstring(utf16buf, out);
            };
            exports2.utf8border = function(buf, max2) {
              var pos;
              max2 = max2 || buf.length;
              if (max2 > buf.length) {
                max2 = buf.length;
              }
              pos = max2 - 1;
              while (pos >= 0 && (buf[pos] & 192) === 128) {
                pos--;
              }
              if (pos < 0) {
                return max2;
              }
              if (pos === 0) {
                return max2;
              }
              return pos + _utf8len[buf[pos]] > max2 ? pos : max2;
            };
          },
          { "./common": 1 }
        ],
        3: [
          function(require2, module2, exports2) {
            "use strict";
            function adler32(adler, buf, len, pos) {
              var s1 = adler & 65535 | 0, s22 = adler >>> 16 & 65535 | 0, n3 = 0;
              while (len !== 0) {
                n3 = len > 2e3 ? 2e3 : len;
                len -= n3;
                do {
                  s1 = s1 + buf[pos++] | 0;
                  s22 = s22 + s1 | 0;
                } while (--n3);
                s1 %= 65521;
                s22 %= 65521;
              }
              return s1 | s22 << 16 | 0;
            }
            module2.exports = adler32;
          },
          {}
        ],
        4: [
          function(require2, module2, exports2) {
            "use strict";
            module2.exports = {
              /* Allowed flush values; see deflate() and inflate() below for details */
              Z_NO_FLUSH: 0,
              Z_PARTIAL_FLUSH: 1,
              Z_SYNC_FLUSH: 2,
              Z_FULL_FLUSH: 3,
              Z_FINISH: 4,
              Z_BLOCK: 5,
              Z_TREES: 6,
              /* Return codes for the compression/decompression functions. Negative values
               * are errors, positive values are used for special but normal events.
               */
              Z_OK: 0,
              Z_STREAM_END: 1,
              Z_NEED_DICT: 2,
              Z_ERRNO: -1,
              Z_STREAM_ERROR: -2,
              Z_DATA_ERROR: -3,
              //Z_MEM_ERROR:     -4,
              Z_BUF_ERROR: -5,
              //Z_VERSION_ERROR: -6,
              /* compression levels */
              Z_NO_COMPRESSION: 0,
              Z_BEST_SPEED: 1,
              Z_BEST_COMPRESSION: 9,
              Z_DEFAULT_COMPRESSION: -1,
              Z_FILTERED: 1,
              Z_HUFFMAN_ONLY: 2,
              Z_RLE: 3,
              Z_FIXED: 4,
              Z_DEFAULT_STRATEGY: 0,
              /* Possible values of the data_type field (though see inflate()) */
              Z_BINARY: 0,
              Z_TEXT: 1,
              //Z_ASCII:                1, // = Z_TEXT (deprecated)
              Z_UNKNOWN: 2,
              /* The deflate compression method */
              Z_DEFLATED: 8
              //Z_NULL:                 null // Use -1 or null inline, depending on var type
            };
          },
          {}
        ],
        5: [
          function(require2, module2, exports2) {
            "use strict";
            function makeTable() {
              var c2, table = [];
              for (var n3 = 0; n3 < 256; n3++) {
                c2 = n3;
                for (var k2 = 0; k2 < 8; k2++) {
                  c2 = c2 & 1 ? 3988292384 ^ c2 >>> 1 : c2 >>> 1;
                }
                table[n3] = c2;
              }
              return table;
            }
            var crcTable = makeTable();
            function crc32(crc, buf, len, pos) {
              var t4 = crcTable, end = pos + len;
              crc ^= -1;
              for (var i3 = pos; i3 < end; i3++) {
                crc = crc >>> 8 ^ t4[(crc ^ buf[i3]) & 255];
              }
              return crc ^ -1;
            }
            module2.exports = crc32;
          },
          {}
        ],
        6: [
          function(require2, module2, exports2) {
            "use strict";
            function GZheader() {
              this.text = 0;
              this.time = 0;
              this.xflags = 0;
              this.os = 0;
              this.extra = null;
              this.extra_len = 0;
              this.name = "";
              this.comment = "";
              this.hcrc = 0;
              this.done = false;
            }
            module2.exports = GZheader;
          },
          {}
        ],
        7: [
          function(require2, module2, exports2) {
            "use strict";
            var BAD = 30;
            var TYPE = 12;
            module2.exports = function inflate_fast(strm, start) {
              var state;
              var _in;
              var last;
              var _out;
              var beg;
              var end;
              var dmax;
              var wsize;
              var whave;
              var wnext;
              var s_window;
              var hold;
              var bits;
              var lcode;
              var dcode;
              var lmask;
              var dmask;
              var here;
              var op;
              var len;
              var dist;
              var from;
              var from_source;
              var input, output;
              state = strm.state;
              _in = strm.next_in;
              input = strm.input;
              last = _in + (strm.avail_in - 5);
              _out = strm.next_out;
              output = strm.output;
              beg = _out - (start - strm.avail_out);
              end = _out + (strm.avail_out - 257);
              dmax = state.dmax;
              wsize = state.wsize;
              whave = state.whave;
              wnext = state.wnext;
              s_window = state.window;
              hold = state.hold;
              bits = state.bits;
              lcode = state.lencode;
              dcode = state.distcode;
              lmask = (1 << state.lenbits) - 1;
              dmask = (1 << state.distbits) - 1;
              top: do {
                if (bits < 15) {
                  hold += input[_in++] << bits;
                  bits += 8;
                  hold += input[_in++] << bits;
                  bits += 8;
                }
                here = lcode[hold & lmask];
                dolen: for (; ; ) {
                  op = here >>> 24;
                  hold >>>= op;
                  bits -= op;
                  op = here >>> 16 & 255;
                  if (op === 0) {
                    output[_out++] = here & 65535;
                  } else if (op & 16) {
                    len = here & 65535;
                    op &= 15;
                    if (op) {
                      if (bits < op) {
                        hold += input[_in++] << bits;
                        bits += 8;
                      }
                      len += hold & (1 << op) - 1;
                      hold >>>= op;
                      bits -= op;
                    }
                    if (bits < 15) {
                      hold += input[_in++] << bits;
                      bits += 8;
                      hold += input[_in++] << bits;
                      bits += 8;
                    }
                    here = dcode[hold & dmask];
                    dodist: for (; ; ) {
                      op = here >>> 24;
                      hold >>>= op;
                      bits -= op;
                      op = here >>> 16 & 255;
                      if (op & 16) {
                        dist = here & 65535;
                        op &= 15;
                        if (bits < op) {
                          hold += input[_in++] << bits;
                          bits += 8;
                          if (bits < op) {
                            hold += input[_in++] << bits;
                            bits += 8;
                          }
                        }
                        dist += hold & (1 << op) - 1;
                        if (dist > dmax) {
                          strm.msg = "invalid distance too far back";
                          state.mode = BAD;
                          break top;
                        }
                        hold >>>= op;
                        bits -= op;
                        op = _out - beg;
                        if (dist > op) {
                          op = dist - op;
                          if (op > whave) {
                            if (state.sane) {
                              strm.msg = "invalid distance too far back";
                              state.mode = BAD;
                              break top;
                            }
                          }
                          from = 0;
                          from_source = s_window;
                          if (wnext === 0) {
                            from += wsize - op;
                            if (op < len) {
                              len -= op;
                              do {
                                output[_out++] = s_window[from++];
                              } while (--op);
                              from = _out - dist;
                              from_source = output;
                            }
                          } else if (wnext < op) {
                            from += wsize + wnext - op;
                            op -= wnext;
                            if (op < len) {
                              len -= op;
                              do {
                                output[_out++] = s_window[from++];
                              } while (--op);
                              from = 0;
                              if (wnext < len) {
                                op = wnext;
                                len -= op;
                                do {
                                  output[_out++] = s_window[from++];
                                } while (--op);
                                from = _out - dist;
                                from_source = output;
                              }
                            }
                          } else {
                            from += wnext - op;
                            if (op < len) {
                              len -= op;
                              do {
                                output[_out++] = s_window[from++];
                              } while (--op);
                              from = _out - dist;
                              from_source = output;
                            }
                          }
                          while (len > 2) {
                            output[_out++] = from_source[from++];
                            output[_out++] = from_source[from++];
                            output[_out++] = from_source[from++];
                            len -= 3;
                          }
                          if (len) {
                            output[_out++] = from_source[from++];
                            if (len > 1) {
                              output[_out++] = from_source[from++];
                            }
                          }
                        } else {
                          from = _out - dist;
                          do {
                            output[_out++] = output[from++];
                            output[_out++] = output[from++];
                            output[_out++] = output[from++];
                            len -= 3;
                          } while (len > 2);
                          if (len) {
                            output[_out++] = output[from++];
                            if (len > 1) {
                              output[_out++] = output[from++];
                            }
                          }
                        }
                      } else if ((op & 64) === 0) {
                        here = dcode[(here & 65535) + (hold & (1 << op) - 1)];
                        continue dodist;
                      } else {
                        strm.msg = "invalid distance code";
                        state.mode = BAD;
                        break top;
                      }
                      break;
                    }
                  } else if ((op & 64) === 0) {
                    here = lcode[(here & 65535) + (hold & (1 << op) - 1)];
                    continue dolen;
                  } else if (op & 32) {
                    state.mode = TYPE;
                    break top;
                  } else {
                    strm.msg = "invalid literal/length code";
                    state.mode = BAD;
                    break top;
                  }
                  break;
                }
              } while (_in < last && _out < end);
              len = bits >> 3;
              _in -= len;
              bits -= len << 3;
              hold &= (1 << bits) - 1;
              strm.next_in = _in;
              strm.next_out = _out;
              strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last);
              strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end);
              state.hold = hold;
              state.bits = bits;
              return;
            };
          },
          {}
        ],
        8: [
          function(require2, module2, exports2) {
            "use strict";
            var utils = require2("../utils/common");
            var adler32 = require2("./adler32");
            var crc32 = require2("./crc32");
            var inflate_fast = require2("./inffast");
            var inflate_table = require2("./inftrees");
            var CODES = 0;
            var LENS = 1;
            var DISTS = 2;
            var Z_FINISH = 4;
            var Z_BLOCK = 5;
            var Z_TREES = 6;
            var Z_OK = 0;
            var Z_STREAM_END = 1;
            var Z_NEED_DICT = 2;
            var Z_STREAM_ERROR = -2;
            var Z_DATA_ERROR = -3;
            var Z_MEM_ERROR = -4;
            var Z_BUF_ERROR = -5;
            var Z_DEFLATED = 8;
            var HEAD = 1;
            var FLAGS = 2;
            var TIME = 3;
            var OS = 4;
            var EXLEN = 5;
            var EXTRA = 6;
            var NAME = 7;
            var COMMENT = 8;
            var HCRC = 9;
            var DICTID = 10;
            var DICT = 11;
            var TYPE = 12;
            var TYPEDO = 13;
            var STORED = 14;
            var COPY_ = 15;
            var COPY = 16;
            var TABLE = 17;
            var LENLENS = 18;
            var CODELENS = 19;
            var LEN_ = 20;
            var LEN = 21;
            var LENEXT = 22;
            var DIST = 23;
            var DISTEXT = 24;
            var MATCH = 25;
            var LIT = 26;
            var CHECK = 27;
            var LENGTH = 28;
            var DONE = 29;
            var BAD = 30;
            var MEM = 31;
            var SYNC = 32;
            var ENOUGH_LENS = 852;
            var ENOUGH_DISTS = 592;
            var MAX_WBITS = 15;
            var DEF_WBITS = MAX_WBITS;
            function zswap32(q) {
              return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24);
            }
            function InflateState() {
              this.mode = 0;
              this.last = false;
              this.wrap = 0;
              this.havedict = false;
              this.flags = 0;
              this.dmax = 0;
              this.check = 0;
              this.total = 0;
              this.head = null;
              this.wbits = 0;
              this.wsize = 0;
              this.whave = 0;
              this.wnext = 0;
              this.window = null;
              this.hold = 0;
              this.bits = 0;
              this.length = 0;
              this.offset = 0;
              this.extra = 0;
              this.lencode = null;
              this.distcode = null;
              this.lenbits = 0;
              this.distbits = 0;
              this.ncode = 0;
              this.nlen = 0;
              this.ndist = 0;
              this.have = 0;
              this.next = null;
              this.lens = new utils.Buf16(
                320
              );
              this.work = new utils.Buf16(
                288
              );
              this.lendyn = null;
              this.distdyn = null;
              this.sane = 0;
              this.back = 0;
              this.was = 0;
            }
            function inflateResetKeep(strm) {
              var state;
              if (!strm || !strm.state) {
                return Z_STREAM_ERROR;
              }
              state = strm.state;
              strm.total_in = strm.total_out = state.total = 0;
              strm.msg = "";
              if (state.wrap) {
                strm.adler = state.wrap & 1;
              }
              state.mode = HEAD;
              state.last = 0;
              state.havedict = 0;
              state.dmax = 32768;
              state.head = null;
              state.hold = 0;
              state.bits = 0;
              state.lencode = state.lendyn = new utils.Buf32(
                ENOUGH_LENS
              );
              state.distcode = state.distdyn = new utils.Buf32(
                ENOUGH_DISTS
              );
              state.sane = 1;
              state.back = -1;
              return Z_OK;
            }
            function inflateReset(strm) {
              var state;
              if (!strm || !strm.state) {
                return Z_STREAM_ERROR;
              }
              state = strm.state;
              state.wsize = 0;
              state.whave = 0;
              state.wnext = 0;
              return inflateResetKeep(strm);
            }
            function inflateReset2(strm, windowBits) {
              var wrap;
              var state;
              if (!strm || !strm.state) {
                return Z_STREAM_ERROR;
              }
              state = strm.state;
              if (windowBits < 0) {
                wrap = 0;
                windowBits = -windowBits;
              } else {
                wrap = (windowBits >> 4) + 1;
                if (windowBits < 48) {
                  windowBits &= 15;
                }
              }
              if (windowBits && (windowBits < 8 || windowBits > 15)) {
                return Z_STREAM_ERROR;
              }
              if (state.window !== null && state.wbits !== windowBits) {
                state.window = null;
              }
              state.wrap = wrap;
              state.wbits = windowBits;
              return inflateReset(strm);
            }
            function inflateInit2(strm, windowBits) {
              var ret;
              var state;
              if (!strm) {
                return Z_STREAM_ERROR;
              }
              state = new InflateState();
              strm.state = state;
              state.window = null;
              ret = inflateReset2(strm, windowBits);
              if (ret !== Z_OK) {
                strm.state = null;
              }
              return ret;
            }
            function inflateInit(strm) {
              return inflateInit2(strm, DEF_WBITS);
            }
            var virgin = true;
            var lenfix, distfix;
            function fixedtables(state) {
              if (virgin) {
                var sym;
                lenfix = new utils.Buf32(512);
                distfix = new utils.Buf32(32);
                sym = 0;
                while (sym < 144) {
                  state.lens[sym++] = 8;
                }
                while (sym < 256) {
                  state.lens[sym++] = 9;
                }
                while (sym < 280) {
                  state.lens[sym++] = 7;
                }
                while (sym < 288) {
                  state.lens[sym++] = 8;
                }
                inflate_table(
                  LENS,
                  state.lens,
                  0,
                  288,
                  lenfix,
                  0,
                  state.work,
                  { bits: 9 }
                );
                sym = 0;
                while (sym < 32) {
                  state.lens[sym++] = 5;
                }
                inflate_table(
                  DISTS,
                  state.lens,
                  0,
                  32,
                  distfix,
                  0,
                  state.work,
                  { bits: 5 }
                );
                virgin = false;
              }
              state.lencode = lenfix;
              state.lenbits = 9;
              state.distcode = distfix;
              state.distbits = 5;
            }
            function updatewindow(strm, src, end, copy) {
              var dist;
              var state = strm.state;
              if (state.window === null) {
                state.wsize = 1 << state.wbits;
                state.wnext = 0;
                state.whave = 0;
                state.window = new utils.Buf8(state.wsize);
              }
              if (copy >= state.wsize) {
                utils.arraySet(
                  state.window,
                  src,
                  end - state.wsize,
                  state.wsize,
                  0
                );
                state.wnext = 0;
                state.whave = state.wsize;
              } else {
                dist = state.wsize - state.wnext;
                if (dist > copy) {
                  dist = copy;
                }
                utils.arraySet(
                  state.window,
                  src,
                  end - copy,
                  dist,
                  state.wnext
                );
                copy -= dist;
                if (copy) {
                  utils.arraySet(
                    state.window,
                    src,
                    end - copy,
                    copy,
                    0
                  );
                  state.wnext = copy;
                  state.whave = state.wsize;
                } else {
                  state.wnext += dist;
                  if (state.wnext === state.wsize) {
                    state.wnext = 0;
                  }
                  if (state.whave < state.wsize) {
                    state.whave += dist;
                  }
                }
              }
              return 0;
            }
            function inflate(strm, flush) {
              var state;
              var input, output;
              var next;
              var put;
              var have, left;
              var hold;
              var bits;
              var _in, _out;
              var copy;
              var from;
              var from_source;
              var here = 0;
              var here_bits, here_op, here_val;
              var last_bits, last_op, last_val;
              var len;
              var ret;
              var hbuf = new utils.Buf8(
                4
              );
              var opts;
              var n3;
              var order = (
                /* permutation of code lengths */
                [
                  16,
                  17,
                  18,
                  0,
                  8,
                  7,
                  9,
                  6,
                  10,
                  5,
                  11,
                  4,
                  12,
                  3,
                  13,
                  2,
                  14,
                  1,
                  15
                ]
              );
              if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0) {
                return Z_STREAM_ERROR;
              }
              state = strm.state;
              if (state.mode === TYPE) {
                state.mode = TYPEDO;
              }
              put = strm.next_out;
              output = strm.output;
              left = strm.avail_out;
              next = strm.next_in;
              input = strm.input;
              have = strm.avail_in;
              hold = state.hold;
              bits = state.bits;
              _in = have;
              _out = left;
              ret = Z_OK;
              inf_leave: for (; ; ) {
                switch (state.mode) {
                  case HEAD:
                    if (state.wrap === 0) {
                      state.mode = TYPEDO;
                      break;
                    }
                    while (bits < 16) {
                      if (have === 0) {
                        break inf_leave;
                      }
                      have--;
                      hold += input[next++] << bits;
                      bits += 8;
                    }
                    if (state.wrap & 2 && hold === 35615) {
                      state.check = 0;
                      hbuf[0] = hold & 255;
                      hbuf[1] = hold >>> 8 & 255;
                      state.check = crc32(
                        state.check,
                        hbuf,
                        2,
                        0
                      );
                      hold = 0;
                      bits = 0;
                      state.mode = FLAGS;
                      break;
                    }
                    state.flags = 0;
                    if (state.head) {
                      state.head.done = false;
                    }
                    if (!(state.wrap & 1) || (((hold & 255) << 8) + (hold >> 8)) % 31) {
                      strm.msg = "incorrect header check";
                      state.mode = BAD;
                      break;
                    }
                    if ((hold & 15) !== Z_DEFLATED) {
                      strm.msg = "unknown compression method";
                      state.mode = BAD;
                      break;
                    }
                    hold >>>= 4;
                    bits -= 4;
                    len = (hold & 15) + 8;
                    if (state.wbits === 0) {
                      state.wbits = len;
                    } else if (len > state.wbits) {
                      strm.msg = "invalid window size";
                      state.mode = BAD;
                      break;
                    }
                    state.dmax = 1 << len;
                    strm.adler = state.check = 1;
                    state.mode = hold & 512 ? DICTID : TYPE;
                    hold = 0;
                    bits = 0;
                    break;
                  case FLAGS:
                    while (bits < 16) {
                      if (have === 0) {
                        break inf_leave;
                      }
                      have--;
                      hold += input[next++] << bits;
                      bits += 8;
                    }
                    state.flags = hold;
                    if ((state.flags & 255) !== Z_DEFLATED) {
                      strm.msg = "unknown compression method";
                      state.mode = BAD;
                      break;
                    }
                    if (state.flags & 57344) {
                      strm.msg = "unknown header flags set";
                      state.mode = BAD;
                      break;
                    }
                    if (state.head) {
                      state.head.text = hold >> 8 & 1;
                    }
                    if (state.flags & 512) {
                      hbuf[0] = hold & 255;
                      hbuf[1] = hold >>> 8 & 255;
                      state.check = crc32(
                        state.check,
                        hbuf,
                        2,
                        0
                      );
                    }
                    hold = 0;
                    bits = 0;
                    state.mode = TIME;
                  /* falls through */
                  case TIME:
                    while (bits < 32) {
                      if (have === 0) {
                        break inf_leave;
                      }
                      have--;
                      hold += input[next++] << bits;
                      bits += 8;
                    }
                    if (state.head) {
                      state.head.time = hold;
                    }
                    if (state.flags & 512) {
                      hbuf[0] = hold & 255;
                      hbuf[1] = hold >>> 8 & 255;
                      hbuf[2] = hold >>> 16 & 255;
                      hbuf[3] = hold >>> 24 & 255;
                      state.check = crc32(
                        state.check,
                        hbuf,
                        4,
                        0
                      );
                    }
                    hold = 0;
                    bits = 0;
                    state.mode = OS;
                  /* falls through */
                  case OS:
                    while (bits < 16) {
                      if (have === 0) {
                        break inf_leave;
                      }
                      have--;
                      hold += input[next++] << bits;
                      bits += 8;
                    }
                    if (state.head) {
                      state.head.xflags = hold & 255;
                      state.head.os = hold >> 8;
                    }
                    if (state.flags & 512) {
                      hbuf[0] = hold & 255;
                      hbuf[1] = hold >>> 8 & 255;
                      state.check = crc32(
                        state.check,
                        hbuf,
                        2,
                        0
                      );
                    }
                    hold = 0;
                    bits = 0;
                    state.mode = EXLEN;
                  /* falls through */
                  case EXLEN:
                    if (state.flags & 1024) {
                      while (bits < 16) {
                        if (have === 0) {
                          break inf_leave;
                        }
                        have--;
                        hold += input[next++] << bits;
                        bits += 8;
                      }
                      state.length = hold;
                      if (state.head) {
                        state.head.extra_len = hold;
                      }
                      if (state.flags & 512) {
                        hbuf[0] = hold & 255;
                        hbuf[1] = hold >>> 8 & 255;
                        state.check = crc32(
                          state.check,
                          hbuf,
                          2,
                          0
                        );
                      }
                      hold = 0;
                      bits = 0;
                    } else if (state.head) {
                      state.head.extra = null;
                    }
                    state.mode = EXTRA;
                  /* falls through */
                  case EXTRA:
                    if (state.flags & 1024) {
                      copy = state.length;
                      if (copy > have) {
                        copy = have;
                      }
                      if (copy) {
                        if (state.head) {
                          len = state.head.extra_len - state.length;
                          if (!state.head.extra) {
                            state.head.extra = new Array(
                              state.head.extra_len
                            );
                          }
                          utils.arraySet(
                            state.head.extra,
                            input,
                            next,
                            // extra field is limited to 65536 bytes
                            // - no need for additional size check
                            copy,
                            /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
                            len
                          );
                        }
                        if (state.flags & 512) {
                          state.check = crc32(
                            state.check,
                            input,
                            copy,
                            next
                          );
                        }
                        have -= copy;
                        next += copy;
                        state.length -= copy;
                      }
                      if (state.length) {
                        break inf_leave;
                      }
                    }
                    state.length = 0;
                    state.mode = NAME;
                  /* falls through */
                  case NAME:
                    if (state.flags & 2048) {
                      if (have === 0) {
                        break inf_leave;
                      }
                      copy = 0;
                      do {
                        len = input[next + copy++];
                        if (state.head && len && state.length < 65536) {
                          state.head.name += String.fromCharCode(len);
                        }
                      } while (len && copy < have);
                      if (state.flags & 512) {
                        state.check = crc32(
                          state.check,
                          input,
                          copy,
                          next
                        );
                      }
                      have -= copy;
                      next += copy;
                      if (len) {
                        break inf_leave;
                      }
                    } else if (state.head) {
                      state.head.name = null;
                    }
                    state.length = 0;
                    state.mode = COMMENT;
                  /* falls through */
                  case COMMENT:
                    if (state.flags & 4096) {
                      if (have === 0) {
                        break inf_leave;
                      }
                      copy = 0;
                      do {
                        len = input[next + copy++];
                        if (state.head && len && state.length < 65536) {
                          state.head.comment += String.fromCharCode(len);
                        }
                      } while (len && copy < have);
                      if (state.flags & 512) {
                        state.check = crc32(
                          state.check,
                          input,
                          copy,
                          next
                        );
                      }
                      have -= copy;
                      next += copy;
                      if (len) {
                        break inf_leave;
                      }
                    } else if (state.head) {
                      state.head.comment = null;
                    }
                    state.mode = HCRC;
                  /* falls through */
                  case HCRC:
                    if (state.flags & 512) {
                      while (bits < 16) {
                        if (have === 0) {
                          break inf_leave;
                        }
                        have--;
                        hold += input[next++] << bits;
                        bits += 8;
                      }
                      if (hold !== (state.check & 65535)) {
                        strm.msg = "header crc mismatch";
                        state.mode = BAD;
                        break;
                      }
                      hold = 0;
                      bits = 0;
                    }
                    if (state.head) {
                      state.head.hcrc = state.flags >> 9 & 1;
                      state.head.done = true;
                    }
                    strm.adler = state.check = 0;
                    state.mode = TYPE;
                    break;
                  case DICTID:
                    while (bits < 32) {
                      if (have === 0) {
                        break inf_leave;
                      }
                      have--;
                      hold += input[next++] << bits;
                      bits += 8;
                    }
                    strm.adler = state.check = zswap32(hold);
                    hold = 0;
                    bits = 0;
                    state.mode = DICT;
                  /* falls through */
                  case DICT:
                    if (state.havedict === 0) {
                      strm.next_out = put;
                      strm.avail_out = left;
                      strm.next_in = next;
                      strm.avail_in = have;
                      state.hold = hold;
                      state.bits = bits;
                      return Z_NEED_DICT;
                    }
                    strm.adler = state.check = 1;
                    state.mode = TYPE;
                  /* falls through */
                  case TYPE:
                    if (flush === Z_BLOCK || flush === Z_TREES) {
                      break inf_leave;
                    }
                  /* falls through */
                  case TYPEDO:
                    if (state.last) {
                      hold >>>= bits & 7;
                      bits -= bits & 7;
                      state.mode = CHECK;
                      break;
                    }
                    while (bits < 3) {
                      if (have === 0) {
                        break inf_leave;
                      }
                      have--;
                      hold += input[next++] << bits;
                      bits += 8;
                    }
                    state.last = hold & 1;
                    hold >>>= 1;
                    bits -= 1;
                    switch (hold & 3) {
                      case 0:
                        state.mode = STORED;
                        break;
                      case 1:
                        fixedtables(state);
                        state.mode = LEN_;
                        if (flush === Z_TREES) {
                          hold >>>= 2;
                          bits -= 2;
                          break inf_leave;
                        }
                        break;
                      case 2:
                        state.mode = TABLE;
                        break;
                      case 3:
                        strm.msg = "invalid block type";
                        state.mode = BAD;
                    }
                    hold >>>= 2;
                    bits -= 2;
                    break;
                  case STORED:
                    hold >>>= bits & 7;
                    bits -= bits & 7;
                    while (bits < 32) {
                      if (have === 0) {
                        break inf_leave;
                      }
                      have--;
                      hold += input[next++] << bits;
                      bits += 8;
                    }
                    if ((hold & 65535) !== (hold >>> 16 ^ 65535)) {
                      strm.msg = "invalid stored block lengths";
                      state.mode = BAD;
                      break;
                    }
                    state.length = hold & 65535;
                    hold = 0;
                    bits = 0;
                    state.mode = COPY_;
                    if (flush === Z_TREES) {
                      break inf_leave;
                    }
                  /* falls through */
                  case COPY_:
                    state.mode = COPY;
                  /* falls through */
                  case COPY:
                    copy = state.length;
                    if (copy) {
                      if (copy > have) {
                        copy = have;
                      }
                      if (copy > left) {
                        copy = left;
                      }
                      if (copy === 0) {
                        break inf_leave;
                      }
                      utils.arraySet(
                        output,
                        input,
                        next,
                        copy,
                        put
                      );
                      have -= copy;
                      next += copy;
                      left -= copy;
                      put += copy;
                      state.length -= copy;
                      break;
                    }
                    state.mode = TYPE;
                    break;
                  case TABLE:
                    while (bits < 14) {
                      if (have === 0) {
                        break inf_leave;
                      }
                      have--;
                      hold += input[next++] << bits;
                      bits += 8;
                    }
                    state.nlen = (hold & 31) + 257;
                    hold >>>= 5;
                    bits -= 5;
                    state.ndist = (hold & 31) + 1;
                    hold >>>= 5;
                    bits -= 5;
                    state.ncode = (hold & 15) + 4;
                    hold >>>= 4;
                    bits -= 4;
                    if (state.nlen > 286 || state.ndist > 30) {
                      strm.msg = "too many length or distance symbols";
                      state.mode = BAD;
                      break;
                    }
                    state.have = 0;
                    state.mode = LENLENS;
                  /* falls through */
                  case LENLENS:
                    while (state.have < state.ncode) {
                      while (bits < 3) {
                        if (have === 0) {
                          break inf_leave;
                        }
                        have--;
                        hold += input[next++] << bits;
                        bits += 8;
                      }
                      state.lens[order[state.have++]] = hold & 7;
                      hold >>>= 3;
                      bits -= 3;
                    }
                    while (state.have < 19) {
                      state.lens[order[state.have++]] = 0;
                    }
                    state.lencode = state.lendyn;
                    state.lenbits = 7;
                    opts = { bits: state.lenbits };
                    ret = inflate_table(
                      CODES,
                      state.lens,
                      0,
                      19,
                      state.lencode,
                      0,
                      state.work,
                      opts
                    );
                    state.lenbits = opts.bits;
                    if (ret) {
                      strm.msg = "invalid code lengths set";
                      state.mode = BAD;
                      break;
                    }
                    state.have = 0;
                    state.mode = CODELENS;
                  /* falls through */
                  case CODELENS:
                    while (state.have < state.nlen + state.ndist) {
                      for (; ; ) {
                        here = state.lencode[hold & (1 << state.lenbits) - 1];
                        here_bits = here >>> 24;
                        here_op = here >>> 16 & 255;
                        here_val = here & 65535;
                        if (here_bits <= bits) {
                          break;
                        }
                        if (have === 0) {
                          break inf_leave;
                        }
                        have--;
                        hold += input[next++] << bits;
                        bits += 8;
                      }
                      if (here_val < 16) {
                        hold >>>= here_bits;
                        bits -= here_bits;
                        state.lens[state.have++] = here_val;
                      } else {
                        if (here_val === 16) {
                          n3 = here_bits + 2;
                          while (bits < n3) {
                            if (have === 0) {
                              break inf_leave;
                            }
                            have--;
                            hold += input[next++] << bits;
                            bits += 8;
                          }
                          hold >>>= here_bits;
                          bits -= here_bits;
                          if (state.have === 0) {
                            strm.msg = "invalid bit length repeat";
                            state.mode = BAD;
                            break;
                          }
                          len = state.lens[state.have - 1];
                          copy = 3 + (hold & 3);
                          hold >>>= 2;
                          bits -= 2;
                        } else if (here_val === 17) {
                          n3 = here_bits + 3;
                          while (bits < n3) {
                            if (have === 0) {
                              break inf_leave;
                            }
                            have--;
                            hold += input[next++] << bits;
                            bits += 8;
                          }
                          hold >>>= here_bits;
                          bits -= here_bits;
                          len = 0;
                          copy = 3 + (hold & 7);
                          hold >>>= 3;
                          bits -= 3;
                        } else {
                          n3 = here_bits + 7;
                          while (bits < n3) {
                            if (have === 0) {
                              break inf_leave;
                            }
                            have--;
                            hold += input[next++] << bits;
                            bits += 8;
                          }
                          hold >>>= here_bits;
                          bits -= here_bits;
                          len = 0;
                          copy = 11 + (hold & 127);
                          hold >>>= 7;
                          bits -= 7;
                        }
                        if (state.have + copy > state.nlen + state.ndist) {
                          strm.msg = "invalid bit length repeat";
                          state.mode = BAD;
                          break;
                        }
                        while (copy--) {
                          state.lens[state.have++] = len;
                        }
                      }
                    }
                    if (state.mode === BAD) {
                      break;
                    }
                    if (state.lens[256] === 0) {
                      strm.msg = "invalid code -- missing end-of-block";
                      state.mode = BAD;
                      break;
                    }
                    state.lenbits = 9;
                    opts = { bits: state.lenbits };
                    ret = inflate_table(
                      LENS,
                      state.lens,
                      0,
                      state.nlen,
                      state.lencode,
                      0,
                      state.work,
                      opts
                    );
                    state.lenbits = opts.bits;
                    if (ret) {
                      strm.msg = "invalid literal/lengths set";
                      state.mode = BAD;
                      break;
                    }
                    state.distbits = 6;
                    state.distcode = state.distdyn;
                    opts = { bits: state.distbits };
                    ret = inflate_table(
                      DISTS,
                      state.lens,
                      state.nlen,
                      state.ndist,
                      state.distcode,
                      0,
                      state.work,
                      opts
                    );
                    state.distbits = opts.bits;
                    if (ret) {
                      strm.msg = "invalid distances set";
                      state.mode = BAD;
                      break;
                    }
                    state.mode = LEN_;
                    if (flush === Z_TREES) {
                      break inf_leave;
                    }
                  /* falls through */
                  case LEN_:
                    state.mode = LEN;
                  /* falls through */
                  case LEN:
                    if (have >= 6 && left >= 258) {
                      strm.next_out = put;
                      strm.avail_out = left;
                      strm.next_in = next;
                      strm.avail_in = have;
                      state.hold = hold;
                      state.bits = bits;
                      inflate_fast(strm, _out);
                      put = strm.next_out;
                      output = strm.output;
                      left = strm.avail_out;
                      next = strm.next_in;
                      input = strm.input;
                      have = strm.avail_in;
                      hold = state.hold;
                      bits = state.bits;
                      if (state.mode === TYPE) {
                        state.back = -1;
                      }
                      break;
                    }
                    state.back = 0;
                    for (; ; ) {
                      here = state.lencode[hold & (1 << state.lenbits) - 1];
                      here_bits = here >>> 24;
                      here_op = here >>> 16 & 255;
                      here_val = here & 65535;
                      if (here_bits <= bits) {
                        break;
                      }
                      if (have === 0) {
                        break inf_leave;
                      }
                      have--;
                      hold += input[next++] << bits;
                      bits += 8;
                    }
                    if (here_op && (here_op & 240) === 0) {
                      last_bits = here_bits;
                      last_op = here_op;
                      last_val = here_val;
                      for (; ; ) {
                        here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)];
                        here_bits = here >>> 24;
                        here_op = here >>> 16 & 255;
                        here_val = here & 65535;
                        if (last_bits + here_bits <= bits) {
                          break;
                        }
                        if (have === 0) {
                          break inf_leave;
                        }
                        have--;
                        hold += input[next++] << bits;
                        bits += 8;
                      }
                      hold >>>= last_bits;
                      bits -= last_bits;
                      state.back += last_bits;
                    }
                    hold >>>= here_bits;
                    bits -= here_bits;
                    state.back += here_bits;
                    state.length = here_val;
                    if (here_op === 0) {
                      state.mode = LIT;
                      break;
                    }
                    if (here_op & 32) {
                      state.back = -1;
                      state.mode = TYPE;
                      break;
                    }
                    if (here_op & 64) {
                      strm.msg = "invalid literal/length code";
                      state.mode = BAD;
                      break;
                    }
                    state.extra = here_op & 15;
                    state.mode = LENEXT;
                  /* falls through */
                  case LENEXT:
                    if (state.extra) {
                      n3 = state.extra;
                      while (bits < n3) {
                        if (have === 0) {
                          break inf_leave;
                        }
                        have--;
                        hold += input[next++] << bits;
                        bits += 8;
                      }
                      state.length += hold & (1 << state.extra) - 1;
                      hold >>>= state.extra;
                      bits -= state.extra;
                      state.back += state.extra;
                    }
                    state.was = state.length;
                    state.mode = DIST;
                  /* falls through */
                  case DIST:
                    for (; ; ) {
                      here = state.distcode[hold & (1 << state.distbits) - 1];
                      here_bits = here >>> 24;
                      here_op = here >>> 16 & 255;
                      here_val = here & 65535;
                      if (here_bits <= bits) {
                        break;
                      }
                      if (have === 0) {
                        break inf_leave;
                      }
                      have--;
                      hold += input[next++] << bits;
                      bits += 8;
                    }
                    if ((here_op & 240) === 0) {
                      last_bits = here_bits;
                      last_op = here_op;
                      last_val = here_val;
                      for (; ; ) {
                        here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)];
                        here_bits = here >>> 24;
                        here_op = here >>> 16 & 255;
                        here_val = here & 65535;
                        if (last_bits + here_bits <= bits) {
                          break;
                        }
                        if (have === 0) {
                          break inf_leave;
                        }
                        have--;
                        hold += input[next++] << bits;
                        bits += 8;
                      }
                      hold >>>= last_bits;
                      bits -= last_bits;
                      state.back += last_bits;
                    }
                    hold >>>= here_bits;
                    bits -= here_bits;
                    state.back += here_bits;
                    if (here_op & 64) {
                      strm.msg = "invalid distance code";
                      state.mode = BAD;
                      break;
                    }
                    state.offset = here_val;
                    state.extra = here_op & 15;
                    state.mode = DISTEXT;
                  /* falls through */
                  case DISTEXT:
                    if (state.extra) {
                      n3 = state.extra;
                      while (bits < n3) {
                        if (have === 0) {
                          break inf_leave;
                        }
                        have--;
                        hold += input[next++] << bits;
                        bits += 8;
                      }
                      state.offset += hold & (1 << state.extra) - 1;
                      hold >>>= state.extra;
                      bits -= state.extra;
                      state.back += state.extra;
                    }
                    if (state.offset > state.dmax) {
                      strm.msg = "invalid distance too far back";
                      state.mode = BAD;
                      break;
                    }
                    state.mode = MATCH;
                  /* falls through */
                  case MATCH:
                    if (left === 0) {
                      break inf_leave;
                    }
                    copy = _out - left;
                    if (state.offset > copy) {
                      copy = state.offset - copy;
                      if (copy > state.whave) {
                        if (state.sane) {
                          strm.msg = "invalid distance too far back";
                          state.mode = BAD;
                          break;
                        }
                      }
                      if (copy > state.wnext) {
                        copy -= state.wnext;
                        from = state.wsize - copy;
                      } else {
                        from = state.wnext - copy;
                      }
                      if (copy > state.length) {
                        copy = state.length;
                      }
                      from_source = state.window;
                    } else {
                      from_source = output;
                      from = put - state.offset;
                      copy = state.length;
                    }
                    if (copy > left) {
                      copy = left;
                    }
                    left -= copy;
                    state.length -= copy;
                    do {
                      output[put++] = from_source[from++];
                    } while (--copy);
                    if (state.length === 0) {
                      state.mode = LEN;
                    }
                    break;
                  case LIT:
                    if (left === 0) {
                      break inf_leave;
                    }
                    output[put++] = state.length;
                    left--;
                    state.mode = LEN;
                    break;
                  case CHECK:
                    if (state.wrap) {
                      while (bits < 32) {
                        if (have === 0) {
                          break inf_leave;
                        }
                        have--;
                        hold |= input[next++] << bits;
                        bits += 8;
                      }
                      _out -= left;
                      strm.total_out += _out;
                      state.total += _out;
                      if (_out) {
                        strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/
                        state.flags ? crc32(
                          state.check,
                          output,
                          _out,
                          put - _out
                        ) : adler32(
                          state.check,
                          output,
                          _out,
                          put - _out
                        );
                      }
                      _out = left;
                      if ((state.flags ? hold : zswap32(hold)) !== state.check) {
                        strm.msg = "incorrect data check";
                        state.mode = BAD;
                        break;
                      }
                      hold = 0;
                      bits = 0;
                    }
                    state.mode = LENGTH;
                  /* falls through */
                  case LENGTH:
                    if (state.wrap && state.flags) {
                      while (bits < 32) {
                        if (have === 0) {
                          break inf_leave;
                        }
                        have--;
                        hold += input[next++] << bits;
                        bits += 8;
                      }
                      if (hold !== (state.total & 4294967295)) {
                        strm.msg = "incorrect length check";
                        state.mode = BAD;
                        break;
                      }
                      hold = 0;
                      bits = 0;
                    }
                    state.mode = DONE;
                  /* falls through */
                  case DONE:
                    ret = Z_STREAM_END;
                    break inf_leave;
                  case BAD:
                    ret = Z_DATA_ERROR;
                    break inf_leave;
                  case MEM:
                    return Z_MEM_ERROR;
                  case SYNC:
                  /* falls through */
                  default:
                    return Z_STREAM_ERROR;
                }
              }
              strm.next_out = put;
              strm.avail_out = left;
              strm.next_in = next;
              strm.avail_in = have;
              state.hold = hold;
              state.bits = bits;
              if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH)) {
                if (updatewindow(
                  strm,
                  strm.output,
                  strm.next_out,
                  _out - strm.avail_out
                )) {
                  state.mode = MEM;
                  return Z_MEM_ERROR;
                }
              }
              _in -= strm.avail_in;
              _out -= strm.avail_out;
              strm.total_in += _in;
              strm.total_out += _out;
              state.total += _out;
              if (state.wrap && _out) {
                strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
                state.flags ? crc32(
                  state.check,
                  output,
                  _out,
                  strm.next_out - _out
                ) : adler32(
                  state.check,
                  output,
                  _out,
                  strm.next_out - _out
                );
              }
              strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
              if ((_in === 0 && _out === 0 || flush === Z_FINISH) && ret === Z_OK) {
                ret = Z_BUF_ERROR;
              }
              return ret;
            }
            function inflateEnd(strm) {
              if (!strm || !strm.state) {
                return Z_STREAM_ERROR;
              }
              var state = strm.state;
              if (state.window) {
                state.window = null;
              }
              strm.state = null;
              return Z_OK;
            }
            function inflateGetHeader(strm, head2) {
              var state;
              if (!strm || !strm.state) {
                return Z_STREAM_ERROR;
              }
              state = strm.state;
              if ((state.wrap & 2) === 0) {
                return Z_STREAM_ERROR;
              }
              state.head = head2;
              head2.done = false;
              return Z_OK;
            }
            function inflateSetDictionary(strm, dictionary) {
              var dictLength = dictionary.length;
              var state;
              var dictid;
              var ret;
              if (!strm || !strm.state) {
                return Z_STREAM_ERROR;
              }
              state = strm.state;
              if (state.wrap !== 0 && state.mode !== DICT) {
                return Z_STREAM_ERROR;
              }
              if (state.mode === DICT) {
                dictid = 1;
                dictid = adler32(
                  dictid,
                  dictionary,
                  dictLength,
                  0
                );
                if (dictid !== state.check) {
                  return Z_DATA_ERROR;
                }
              }
              ret = updatewindow(
                strm,
                dictionary,
                dictLength,
                dictLength
              );
              if (ret) {
                state.mode = MEM;
                return Z_MEM_ERROR;
              }
              state.havedict = 1;
              return Z_OK;
            }
            exports2.inflateReset = inflateReset;
            exports2.inflateReset2 = inflateReset2;
            exports2.inflateResetKeep = inflateResetKeep;
            exports2.inflateInit = inflateInit;
            exports2.inflateInit2 = inflateInit2;
            exports2.inflate = inflate;
            exports2.inflateEnd = inflateEnd;
            exports2.inflateGetHeader = inflateGetHeader;
            exports2.inflateSetDictionary = inflateSetDictionary;
            exports2.inflateInfo = "pako inflate (from Nodeca project)";
          },
          {
            "../utils/common": 1,
            "./adler32": 3,
            "./crc32": 5,
            "./inffast": 7,
            "./inftrees": 9
          }
        ],
        9: [
          function(require2, module2, exports2) {
            "use strict";
            var utils = require2("../utils/common");
            var MAXBITS = 15;
            var ENOUGH_LENS = 852;
            var ENOUGH_DISTS = 592;
            var CODES = 0;
            var LENS = 1;
            var DISTS = 2;
            var lbase = [
              /* Length codes 257..285 base */
              3,
              4,
              5,
              6,
              7,
              8,
              9,
              10,
              11,
              13,
              15,
              17,
              19,
              23,
              27,
              31,
              35,
              43,
              51,
              59,
              67,
              83,
              99,
              115,
              131,
              163,
              195,
              227,
              258,
              0,
              0
            ];
            var lext = [
              /* Length codes 257..285 extra */
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              17,
              17,
              17,
              17,
              18,
              18,
              18,
              18,
              19,
              19,
              19,
              19,
              20,
              20,
              20,
              20,
              21,
              21,
              21,
              21,
              16,
              72,
              78
            ];
            var dbase = [
              /* Distance codes 0..29 base */
              1,
              2,
              3,
              4,
              5,
              7,
              9,
              13,
              17,
              25,
              33,
              49,
              65,
              97,
              129,
              193,
              257,
              385,
              513,
              769,
              1025,
              1537,
              2049,
              3073,
              4097,
              6145,
              8193,
              12289,
              16385,
              24577,
              0,
              0
            ];
            var dext = [
              /* Distance codes 0..29 extra */
              16,
              16,
              16,
              16,
              17,
              17,
              18,
              18,
              19,
              19,
              20,
              20,
              21,
              21,
              22,
              22,
              23,
              23,
              24,
              24,
              25,
              25,
              26,
              26,
              27,
              27,
              28,
              28,
              29,
              29,
              64,
              64
            ];
            module2.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) {
              var bits = opts.bits;
              var len = 0;
              var sym = 0;
              var min2 = 0, max2 = 0;
              var root = 0;
              var curr = 0;
              var drop = 0;
              var left = 0;
              var used = 0;
              var huff = 0;
              var incr;
              var fill;
              var low;
              var mask;
              var next;
              var base = null;
              var base_index = 0;
              var end;
              var count = new utils.Buf16(MAXBITS + 1);
              var offs = new utils.Buf16(MAXBITS + 1);
              var extra = null;
              var extra_index = 0;
              var here_bits, here_op, here_val;
              for (len = 0; len <= MAXBITS; len++) {
                count[len] = 0;
              }
              for (sym = 0; sym < codes; sym++) {
                count[lens[lens_index + sym]]++;
              }
              root = bits;
              for (max2 = MAXBITS; max2 >= 1; max2--) {
                if (count[max2] !== 0) {
                  break;
                }
              }
              if (root > max2) {
                root = max2;
              }
              if (max2 === 0) {
                table[table_index++] = 1 << 24 | 64 << 16 | 0;
                table[table_index++] = 1 << 24 | 64 << 16 | 0;
                opts.bits = 1;
                return 0;
              }
              for (min2 = 1; min2 < max2; min2++) {
                if (count[min2] !== 0) {
                  break;
                }
              }
              if (root < min2) {
                root = min2;
              }
              left = 1;
              for (len = 1; len <= MAXBITS; len++) {
                left <<= 1;
                left -= count[len];
                if (left < 0) {
                  return -1;
                }
              }
              if (left > 0 && (type === CODES || max2 !== 1)) {
                return -1;
              }
              offs[1] = 0;
              for (len = 1; len < MAXBITS; len++) {
                offs[len + 1] = offs[len] + count[len];
              }
              for (sym = 0; sym < codes; sym++) {
                if (lens[lens_index + sym] !== 0) {
                  work[offs[lens[lens_index + sym]]++] = sym;
                }
              }
              if (type === CODES) {
                base = extra = work;
                end = 19;
              } else if (type === LENS) {
                base = lbase;
                base_index -= 257;
                extra = lext;
                extra_index -= 257;
                end = 256;
              } else {
                base = dbase;
                extra = dext;
                end = -1;
              }
              huff = 0;
              sym = 0;
              len = min2;
              next = table_index;
              curr = root;
              drop = 0;
              low = -1;
              used = 1 << root;
              mask = used - 1;
              if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {
                return 1;
              }
              for (; ; ) {
                here_bits = len - drop;
                if (work[sym] < end) {
                  here_op = 0;
                  here_val = work[sym];
                } else if (work[sym] > end) {
                  here_op = extra[extra_index + work[sym]];
                  here_val = base[base_index + work[sym]];
                } else {
                  here_op = 32 + 64;
                  here_val = 0;
                }
                incr = 1 << len - drop;
                fill = 1 << curr;
                min2 = fill;
                do {
                  fill -= incr;
                  table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
                } while (fill !== 0);
                incr = 1 << len - 1;
                while (huff & incr) {
                  incr >>= 1;
                }
                if (incr !== 0) {
                  huff &= incr - 1;
                  huff += incr;
                } else {
                  huff = 0;
                }
                sym++;
                if (--count[len] === 0) {
                  if (len === max2) {
                    break;
                  }
                  len = lens[lens_index + work[sym]];
                }
                if (len > root && (huff & mask) !== low) {
                  if (drop === 0) {
                    drop = root;
                  }
                  next += min2;
                  curr = len - drop;
                  left = 1 << curr;
                  while (curr + drop < max2) {
                    left -= count[curr + drop];
                    if (left <= 0) {
                      break;
                    }
                    curr++;
                    left <<= 1;
                  }
                  used += 1 << curr;
                  if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {
                    return 1;
                  }
                  low = huff & mask;
                  table[low] = root << 24 | curr << 16 | next - table_index | 0;
                }
              }
              if (huff !== 0) {
                table[next + huff] = len - drop << 24 | 64 << 16 | 0;
              }
              opts.bits = root;
              return 0;
            };
          },
          { "../utils/common": 1 }
        ],
        10: [
          function(require2, module2, exports2) {
            "use strict";
            module2.exports = {
              2: "need dictionary",
              1: "stream end",
              0: "",
              "-1": "file error",
              "-2": "stream error",
              "-3": "data error",
              "-4": "insufficient memory",
              "-5": "buffer error",
              "-6": "incompatible version"
            };
          },
          {}
        ],
        11: [
          function(require2, module2, exports2) {
            "use strict";
            function ZStream() {
              this.input = null;
              this.next_in = 0;
              this.avail_in = 0;
              this.total_in = 0;
              this.output = null;
              this.next_out = 0;
              this.avail_out = 0;
              this.total_out = 0;
              this.msg = "";
              this.state = null;
              this.data_type = 2;
              this.adler = 0;
            }
            module2.exports = ZStream;
          },
          {}
        ],
        "/lib/inflate.js": [
          function(require2, module2, exports2) {
            "use strict";
            var zlib_inflate = require2("./zlib/inflate");
            var utils = require2("./utils/common");
            var strings = require2("./utils/strings");
            var c2 = require2("./zlib/constants");
            var msg = require2("./zlib/messages");
            var ZStream = require2("./zlib/zstream");
            var GZheader = require2("./zlib/gzheader");
            var toString = Object.prototype.toString;
            function Inflate(options) {
              if (!(this instanceof Inflate))
                return new Inflate(options);
              this.options = utils.assign(
                {
                  chunkSize: 16384,
                  windowBits: 0,
                  to: ""
                },
                options || {}
              );
              var opt = this.options;
              if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) {
                opt.windowBits = -opt.windowBits;
                if (opt.windowBits === 0) {
                  opt.windowBits = -15;
                }
              }
              if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) {
                opt.windowBits += 32;
              }
              if (opt.windowBits > 15 && opt.windowBits < 48) {
                if ((opt.windowBits & 15) === 0) {
                  opt.windowBits |= 15;
                }
              }
              this.err = 0;
              this.msg = "";
              this.ended = false;
              this.chunks = [];
              this.strm = new ZStream();
              this.strm.avail_out = 0;
              var status = zlib_inflate.inflateInit2(
                this.strm,
                opt.windowBits
              );
              if (status !== c2.Z_OK) {
                throw new Error(msg[status]);
              }
              this.header = new GZheader();
              zlib_inflate.inflateGetHeader(this.strm, this.header);
              if (opt.dictionary) {
                if (typeof opt.dictionary === "string") {
                  opt.dictionary = strings.string2buf(
                    opt.dictionary
                  );
                } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") {
                  opt.dictionary = new Uint8Array(
                    opt.dictionary
                  );
                }
                if (opt.raw) {
                  status = zlib_inflate.inflateSetDictionary(
                    this.strm,
                    opt.dictionary
                  );
                  if (status !== c2.Z_OK) {
                    throw new Error(msg[status]);
                  }
                }
              }
            }
            Inflate.prototype.push = function(data, mode) {
              var strm = this.strm;
              var chunkSize = this.options.chunkSize;
              var dictionary = this.options.dictionary;
              var status, _mode;
              var next_out_utf8, tail, utf8str;
              var allowBufError = false;
              if (this.ended) {
                return false;
              }
              _mode = mode === ~~mode ? mode : mode === true ? c2.Z_FINISH : c2.Z_NO_FLUSH;
              if (typeof data === "string") {
                strm.input = strings.binstring2buf(data);
              } else if (toString.call(data) === "[object ArrayBuffer]") {
                strm.input = new Uint8Array(data);
              } else {
                strm.input = data;
              }
              strm.next_in = 0;
              strm.avail_in = strm.input.length;
              do {
                if (strm.avail_out === 0) {
                  strm.output = new utils.Buf8(chunkSize);
                  strm.next_out = 0;
                  strm.avail_out = chunkSize;
                }
                status = zlib_inflate.inflate(
                  strm,
                  c2.Z_NO_FLUSH
                );
                if (status === c2.Z_NEED_DICT && dictionary) {
                  status = zlib_inflate.inflateSetDictionary(
                    this.strm,
                    dictionary
                  );
                }
                if (status === c2.Z_BUF_ERROR && allowBufError === true) {
                  status = c2.Z_OK;
                  allowBufError = false;
                }
                if (status !== c2.Z_STREAM_END && status !== c2.Z_OK) {
                  this.onEnd(status);
                  this.ended = true;
                  return false;
                }
                if (strm.next_out) {
                  if (strm.avail_out === 0 || status === c2.Z_STREAM_END || strm.avail_in === 0 && (_mode === c2.Z_FINISH || _mode === c2.Z_SYNC_FLUSH)) {
                    if (this.options.to === "string") {
                      next_out_utf8 = strings.utf8border(
                        strm.output,
                        strm.next_out
                      );
                      tail = strm.next_out - next_out_utf8;
                      utf8str = strings.buf2string(
                        strm.output,
                        next_out_utf8
                      );
                      strm.next_out = tail;
                      strm.avail_out = chunkSize - tail;
                      if (tail) {
                        utils.arraySet(
                          strm.output,
                          strm.output,
                          next_out_utf8,
                          tail,
                          0
                        );
                      }
                      this.onData(utf8str);
                    } else {
                      this.onData(
                        utils.shrinkBuf(
                          strm.output,
                          strm.next_out
                        )
                      );
                    }
                  }
                }
                if (strm.avail_in === 0 && strm.avail_out === 0) {
                  allowBufError = true;
                }
              } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c2.Z_STREAM_END);
              if (status === c2.Z_STREAM_END) {
                _mode = c2.Z_FINISH;
              }
              if (_mode === c2.Z_FINISH) {
                status = zlib_inflate.inflateEnd(this.strm);
                this.onEnd(status);
                this.ended = true;
                return status === c2.Z_OK;
              }
              if (_mode === c2.Z_SYNC_FLUSH) {
                this.onEnd(c2.Z_OK);
                strm.avail_out = 0;
                return true;
              }
              return true;
            };
            Inflate.prototype.onData = function(chunk) {
              this.chunks.push(chunk);
            };
            Inflate.prototype.onEnd = function(status) {
              if (status === c2.Z_OK) {
                if (this.options.to === "string") {
                  this.result = this.chunks.join("");
                } else {
                  this.result = utils.flattenChunks(
                    this.chunks
                  );
                }
              }
              this.chunks = [];
              this.err = status;
              this.msg = this.strm.msg;
            };
            function inflate(input, options) {
              var inflator = new Inflate(options);
              inflator.push(input, true);
              if (inflator.err) {
                throw inflator.msg || msg[inflator.err];
              }
              return inflator.result;
            }
            function inflateRaw(input, options) {
              options = options || {};
              options.raw = true;
              return inflate(input, options);
            }
            exports2.Inflate = Inflate;
            exports2.inflate = inflate;
            exports2.inflateRaw = inflateRaw;
            exports2.ungzip = inflate;
          },
          {
            "./utils/common": 1,
            "./utils/strings": 2,
            "./zlib/constants": 4,
            "./zlib/gzheader": 6,
            "./zlib/inflate": 8,
            "./zlib/messages": 10,
            "./zlib/zstream": 11
          }
        ]
      },
      {},
      []
    )("/lib/inflate.js");
  })();

  // packages/global-styles-ui/build-module/font-library/lib/lib-font.browser.mjs
  var fetchFunction = globalThis.fetch;
  var Event2 = class {
    constructor(type, detail = {}, msg) {
      this.type = type;
      this.detail = detail;
      this.msg = msg;
      Object.defineProperty(this, `__mayPropagate`, {
        enumerable: false,
        writable: true
      });
      this.__mayPropagate = true;
    }
    preventDefault() {
    }
    stopPropagation() {
      this.__mayPropagate = false;
    }
    valueOf() {
      return this;
    }
    toString() {
      return this.msg ? `[${this.type} event]: ${this.msg}` : `[${this.type} event]`;
    }
  };
  var EventManager = class {
    constructor() {
      this.listeners = {};
    }
    addEventListener(type, listener, useCapture) {
      let bin = this.listeners[type] || [];
      if (useCapture) bin.unshift(listener);
      else bin.push(listener);
      this.listeners[type] = bin;
    }
    removeEventListener(type, listener) {
      let bin = this.listeners[type] || [];
      let pos = bin.findIndex((e3) => e3 === listener);
      if (pos > -1) {
        bin.splice(pos, 1);
        this.listeners[type] = bin;
      }
    }
    dispatch(event) {
      let bin = this.listeners[event.type];
      if (bin) {
        for (let l3 = 0, e3 = bin.length; l3 < e3; l3++) {
          if (!event.__mayPropagate) break;
          bin[l3](event);
        }
      }
    }
  };
  var startDate = (/* @__PURE__ */ new Date(`1904-01-01T00:00:00+0000`)).getTime();
  function asText(data) {
    return Array.from(data).map((v3) => String.fromCharCode(v3)).join(``);
  }
  var Parser = class {
    constructor(dict, dataview, name2) {
      this.name = (name2 || dict.tag || ``).trim();
      this.length = dict.length;
      this.start = dict.offset;
      this.offset = 0;
      this.data = dataview;
      [
        `getInt8`,
        `getUint8`,
        `getInt16`,
        `getUint16`,
        `getInt32`,
        `getUint32`,
        `getBigInt64`,
        `getBigUint64`
      ].forEach((name3) => {
        let fn = name3.replace(/get(Big)?/, "").toLowerCase();
        let increment = parseInt(name3.replace(/[^\d]/g, "")) / 8;
        Object.defineProperty(this, fn, {
          get: () => this.getValue(name3, increment)
        });
      });
    }
    get currentPosition() {
      return this.start + this.offset;
    }
    set currentPosition(position) {
      this.start = position;
      this.offset = 0;
    }
    skip(n3 = 0, bits = 8) {
      this.offset += n3 * bits / 8;
    }
    getValue(type, increment) {
      let pos = this.start + this.offset;
      this.offset += increment;
      try {
        return this.data[type](pos);
      } catch (e3) {
        console.error(`parser`, type, increment, this);
        console.error(`parser`, this.start, this.offset);
        throw e3;
      }
    }
    flags(n3) {
      if (n3 === 8 || n3 === 16 || n3 === 32 || n3 === 64) {
        return this[`uint${n3}`].toString(2).padStart(n3, 0).split(``).map((v3) => v3 === "1");
      }
      console.error(
        `Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long`
      );
      console.trace();
    }
    get tag() {
      const t4 = this.uint32;
      return asText([
        t4 >> 24 & 255,
        t4 >> 16 & 255,
        t4 >> 8 & 255,
        t4 & 255
      ]);
    }
    get fixed() {
      let major = this.int16;
      let minor = Math.round(1e3 * this.uint16 / 65356);
      return major + minor / 1e3;
    }
    get legacyFixed() {
      let major = this.uint16;
      let minor = this.uint16.toString(16).padStart(4, 0);
      return parseFloat(`${major}.${minor}`);
    }
    get uint24() {
      return (this.uint8 << 16) + (this.uint8 << 8) + this.uint8;
    }
    get uint128() {
      let value = 0;
      for (let i3 = 0; i3 < 5; i3++) {
        let byte = this.uint8;
        value = value * 128 + (byte & 127);
        if (byte < 128) break;
      }
      return value;
    }
    get longdatetime() {
      return new Date(startDate + 1e3 * parseInt(this.int64.toString()));
    }
    get fword() {
      return this.int16;
    }
    get ufword() {
      return this.uint16;
    }
    get Offset16() {
      return this.uint16;
    }
    get Offset32() {
      return this.uint32;
    }
    get F2DOT14() {
      const bits = p.uint16;
      const integer = [0, 1, -2, -1][bits >> 14];
      const fraction = bits & 16383;
      return integer + fraction / 16384;
    }
    verifyLength() {
      if (this.offset != this.length) {
        console.error(
          `unexpected parsed table size (${this.offset}) for "${this.name}" (expected ${this.length})`
        );
      }
    }
    readBytes(n3 = 0, position = 0, bits = 8, signed = false) {
      n3 = n3 || this.length;
      if (n3 === 0) return [];
      if (position) this.currentPosition = position;
      const fn = `${signed ? `` : `u`}int${bits}`, slice = [];
      while (n3--) slice.push(this[fn]);
      return slice;
    }
  };
  var ParsedData = class {
    constructor(parser) {
      const pGetter = { enumerable: false, get: () => parser };
      Object.defineProperty(this, `parser`, pGetter);
      const start = parser.currentPosition;
      const startGetter = { enumerable: false, get: () => start };
      Object.defineProperty(this, `start`, startGetter);
    }
    load(struct) {
      Object.keys(struct).forEach((p22) => {
        let props = Object.getOwnPropertyDescriptor(struct, p22);
        if (props.get) {
          this[p22] = props.get.bind(this);
        } else if (props.value !== void 0) {
          this[p22] = props.value;
        }
      });
      if (this.parser.length) {
        this.parser.verifyLength();
      }
    }
  };
  var SimpleTable = class extends ParsedData {
    constructor(dict, dataview, name2) {
      const { parser, start } = super(
        new Parser(dict, dataview, name2)
      );
      const pGetter = { enumerable: false, get: () => parser };
      Object.defineProperty(this, `p`, pGetter);
      const startGetter = { enumerable: false, get: () => start };
      Object.defineProperty(this, `tableStart`, startGetter);
    }
  };
  function lazy$1(object, property, getter) {
    let val;
    Object.defineProperty(object, property, {
      get: () => {
        if (val) return val;
        val = getter();
        return val;
      },
      enumerable: true
    });
  }
  var SFNT = class extends SimpleTable {
    constructor(font2, dataview, createTable2) {
      const { p: p22 } = super({ offset: 0, length: 12 }, dataview, `sfnt`);
      this.version = p22.uint32;
      this.numTables = p22.uint16;
      this.searchRange = p22.uint16;
      this.entrySelector = p22.uint16;
      this.rangeShift = p22.uint16;
      p22.verifyLength();
      this.directory = [...new Array(this.numTables)].map(
        (_) => new TableRecord(p22)
      );
      this.tables = {};
      this.directory.forEach((entry) => {
        const getter = () => createTable2(
          this.tables,
          {
            tag: entry.tag,
            offset: entry.offset,
            length: entry.length
          },
          dataview
        );
        lazy$1(this.tables, entry.tag.trim(), getter);
      });
    }
  };
  var TableRecord = class {
    constructor(p22) {
      this.tag = p22.tag;
      this.checksum = p22.uint32;
      this.offset = p22.uint32;
      this.length = p22.uint32;
    }
  };
  var gzipDecode = inflate_default.inflate || void 0;
  var nativeGzipDecode = void 0;
  var WOFF$1 = class extends SimpleTable {
    constructor(font2, dataview, createTable2) {
      const { p: p22 } = super({ offset: 0, length: 44 }, dataview, `woff`);
      this.signature = p22.tag;
      this.flavor = p22.uint32;
      this.length = p22.uint32;
      this.numTables = p22.uint16;
      p22.uint16;
      this.totalSfntSize = p22.uint32;
      this.majorVersion = p22.uint16;
      this.minorVersion = p22.uint16;
      this.metaOffset = p22.uint32;
      this.metaLength = p22.uint32;
      this.metaOrigLength = p22.uint32;
      this.privOffset = p22.uint32;
      this.privLength = p22.uint32;
      p22.verifyLength();
      this.directory = [...new Array(this.numTables)].map(
        (_) => new WoffTableDirectoryEntry(p22)
      );
      buildWoffLazyLookups(this, dataview, createTable2);
    }
  };
  var WoffTableDirectoryEntry = class {
    constructor(p22) {
      this.tag = p22.tag;
      this.offset = p22.uint32;
      this.compLength = p22.uint32;
      this.origLength = p22.uint32;
      this.origChecksum = p22.uint32;
    }
  };
  function buildWoffLazyLookups(woff, dataview, createTable2) {
    woff.tables = {};
    woff.directory.forEach((entry) => {
      lazy$1(woff.tables, entry.tag.trim(), () => {
        let offset3 = 0;
        let view = dataview;
        if (entry.compLength !== entry.origLength) {
          const data = dataview.buffer.slice(
            entry.offset,
            entry.offset + entry.compLength
          );
          let unpacked;
          if (gzipDecode) {
            unpacked = gzipDecode(new Uint8Array(data));
          } else if (nativeGzipDecode) {
            unpacked = nativeGzipDecode(new Uint8Array(data));
          } else {
            const msg = `no brotli decoder available to decode WOFF2 font`;
            if (font.onerror) font.onerror(msg);
            throw new Error(msg);
          }
          view = new DataView(unpacked.buffer);
        } else {
          offset3 = entry.offset;
        }
        return createTable2(
          woff.tables,
          { tag: entry.tag, offset: offset3, length: entry.origLength },
          view
        );
      });
    });
  }
  var brotliDecode = unbrotli_default;
  var nativeBrotliDecode = void 0;
  var WOFF2$1 = class extends SimpleTable {
    constructor(font2, dataview, createTable2) {
      const { p: p22 } = super({ offset: 0, length: 48 }, dataview, `woff2`);
      this.signature = p22.tag;
      this.flavor = p22.uint32;
      this.length = p22.uint32;
      this.numTables = p22.uint16;
      p22.uint16;
      this.totalSfntSize = p22.uint32;
      this.totalCompressedSize = p22.uint32;
      this.majorVersion = p22.uint16;
      this.minorVersion = p22.uint16;
      this.metaOffset = p22.uint32;
      this.metaLength = p22.uint32;
      this.metaOrigLength = p22.uint32;
      this.privOffset = p22.uint32;
      this.privLength = p22.uint32;
      p22.verifyLength();
      this.directory = [...new Array(this.numTables)].map(
        (_) => new Woff2TableDirectoryEntry(p22)
      );
      let dictOffset = p22.currentPosition;
      this.directory[0].offset = 0;
      this.directory.forEach((e3, i3) => {
        let next = this.directory[i3 + 1];
        if (next) {
          next.offset = e3.offset + (e3.transformLength !== void 0 ? e3.transformLength : e3.origLength);
        }
      });
      let decoded;
      let buffer = dataview.buffer.slice(dictOffset);
      if (brotliDecode) {
        decoded = brotliDecode(new Uint8Array(buffer));
      } else if (nativeBrotliDecode) {
        decoded = new Uint8Array(nativeBrotliDecode(buffer));
      } else {
        const msg = `no brotli decoder available to decode WOFF2 font`;
        if (font2.onerror) font2.onerror(msg);
        throw new Error(msg);
      }
      buildWoff2LazyLookups(this, decoded, createTable2);
    }
  };
  var Woff2TableDirectoryEntry = class {
    constructor(p22) {
      this.flags = p22.uint8;
      const tagNumber = this.tagNumber = this.flags & 63;
      if (tagNumber === 63) {
        this.tag = p22.tag;
      } else {
        this.tag = getWOFF2Tag(tagNumber);
      }
      const transformVersion = this.transformVersion = (this.flags & 192) >> 6;
      let hasTransforms = transformVersion !== 0;
      if (this.tag === `glyf` || this.tag === `loca`) {
        hasTransforms = this.transformVersion !== 3;
      }
      this.origLength = p22.uint128;
      if (hasTransforms) {
        this.transformLength = p22.uint128;
      }
    }
  };
  function buildWoff2LazyLookups(woff2, decoded, createTable2) {
    woff2.tables = {};
    woff2.directory.forEach((entry) => {
      lazy$1(woff2.tables, entry.tag.trim(), () => {
        const start = entry.offset;
        const end = start + (entry.transformLength ? entry.transformLength : entry.origLength);
        const data = new DataView(decoded.slice(start, end).buffer);
        try {
          return createTable2(
            woff2.tables,
            { tag: entry.tag, offset: 0, length: entry.origLength },
            data
          );
        } catch (e3) {
          console.error(e3);
        }
      });
    });
  }
  function getWOFF2Tag(flag) {
    return [
      `cmap`,
      `head`,
      `hhea`,
      `hmtx`,
      `maxp`,
      `name`,
      `OS/2`,
      `post`,
      `cvt `,
      `fpgm`,
      `glyf`,
      `loca`,
      `prep`,
      `CFF `,
      `VORG`,
      `EBDT`,
      `EBLC`,
      `gasp`,
      `hdmx`,
      `kern`,
      `LTSH`,
      `PCLT`,
      `VDMX`,
      `vhea`,
      `vmtx`,
      `BASE`,
      `GDEF`,
      `GPOS`,
      `GSUB`,
      `EBSC`,
      `JSTF`,
      `MATH`,
      `CBDT`,
      `CBLC`,
      `COLR`,
      `CPAL`,
      `SVG `,
      `sbix`,
      `acnt`,
      `avar`,
      `bdat`,
      `bloc`,
      `bsln`,
      `cvar`,
      `fdsc`,
      `feat`,
      `fmtx`,
      `fvar`,
      `gvar`,
      `hsty`,
      `just`,
      `lcar`,
      `mort`,
      `morx`,
      `opbd`,
      `prop`,
      `trak`,
      `Zapf`,
      `Silf`,
      `Glat`,
      `Gloc`,
      `Feat`,
      `Sill`
    ][flag & 63];
  }
  var tableClasses = {};
  var tableClassesLoaded = false;
  Promise.all([
    Promise.resolve().then(function() {
      return cmap$1;
    }),
    Promise.resolve().then(function() {
      return head$1;
    }),
    Promise.resolve().then(function() {
      return hhea$1;
    }),
    Promise.resolve().then(function() {
      return hmtx$1;
    }),
    Promise.resolve().then(function() {
      return maxp$1;
    }),
    Promise.resolve().then(function() {
      return name$1;
    }),
    Promise.resolve().then(function() {
      return OS2$1;
    }),
    Promise.resolve().then(function() {
      return post$1;
    }),
    Promise.resolve().then(function() {
      return BASE$1;
    }),
    Promise.resolve().then(function() {
      return GDEF$1;
    }),
    Promise.resolve().then(function() {
      return GSUB$1;
    }),
    Promise.resolve().then(function() {
      return GPOS$1;
    }),
    Promise.resolve().then(function() {
      return SVG$1;
    }),
    Promise.resolve().then(function() {
      return fvar$1;
    }),
    Promise.resolve().then(function() {
      return cvt$1;
    }),
    Promise.resolve().then(function() {
      return fpgm$1;
    }),
    Promise.resolve().then(function() {
      return gasp$1;
    }),
    Promise.resolve().then(function() {
      return glyf$1;
    }),
    Promise.resolve().then(function() {
      return loca$1;
    }),
    Promise.resolve().then(function() {
      return prep$1;
    }),
    Promise.resolve().then(function() {
      return CFF$1;
    }),
    Promise.resolve().then(function() {
      return CFF2$1;
    }),
    Promise.resolve().then(function() {
      return VORG$1;
    }),
    Promise.resolve().then(function() {
      return EBLC$1;
    }),
    Promise.resolve().then(function() {
      return EBDT$1;
    }),
    Promise.resolve().then(function() {
      return EBSC$1;
    }),
    Promise.resolve().then(function() {
      return CBLC$1;
    }),
    Promise.resolve().then(function() {
      return CBDT$1;
    }),
    Promise.resolve().then(function() {
      return sbix$1;
    }),
    Promise.resolve().then(function() {
      return COLR$1;
    }),
    Promise.resolve().then(function() {
      return CPAL$1;
    }),
    Promise.resolve().then(function() {
      return DSIG$1;
    }),
    Promise.resolve().then(function() {
      return hdmx$1;
    }),
    Promise.resolve().then(function() {
      return kern$1;
    }),
    Promise.resolve().then(function() {
      return LTSH$1;
    }),
    Promise.resolve().then(function() {
      return MERG$1;
    }),
    Promise.resolve().then(function() {
      return meta$1;
    }),
    Promise.resolve().then(function() {
      return PCLT$1;
    }),
    Promise.resolve().then(function() {
      return VDMX$1;
    }),
    Promise.resolve().then(function() {
      return vhea$1;
    }),
    Promise.resolve().then(function() {
      return vmtx$1;
    })
  ]).then((data) => {
    data.forEach((e3) => {
      let name2 = Object.keys(e3)[0];
      tableClasses[name2] = e3[name2];
    });
    tableClassesLoaded = true;
  });
  function createTable(tables, dict, dataview) {
    let name2 = dict.tag.replace(/[^\w\d]/g, ``);
    let Type = tableClasses[name2];
    if (Type) return new Type(dict, dataview, tables);
    console.warn(
      `lib-font has no definition for ${name2}. The table was skipped.`
    );
    return {};
  }
  function loadTableClasses() {
    let count = 0;
    function checkLoaded(resolve, reject) {
      if (!tableClassesLoaded) {
        if (count > 10) {
          return reject(new Error(`loading took too long`));
        }
        count++;
        return setTimeout(() => checkLoaded(resolve), 250);
      }
      resolve(createTable);
    }
    return new Promise((resolve, reject) => checkLoaded(resolve));
  }
  function getFontCSSFormat(path, errorOnStyle) {
    let pos = path.lastIndexOf(`.`);
    let ext = (path.substring(pos + 1) || ``).toLowerCase();
    let format = {
      ttf: `truetype`,
      otf: `opentype`,
      woff: `woff`,
      woff2: `woff2`
    }[ext];
    if (format) return format;
    let msg = {
      eot: `The .eot format is not supported: it died in January 12, 2016, when Microsoft retired all versions of IE that didn't already support WOFF.`,
      svg: `The .svg format is not supported: SVG fonts (not to be confused with OpenType with embedded SVG) were so bad we took the entire fonts chapter out of the SVG specification again.`,
      fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`,
      ttc: `Based on the current CSS specification, font collections are not (yet?) supported.`
    }[ext];
    if (!msg) msg = `${path} is not a known webfont format.`;
    if (errorOnStyle) {
      throw new Error(msg);
    } else {
      console.warn(`Could not load font: ${msg}`);
    }
  }
  async function setupFontFace(name2, url, options = {}) {
    if (!globalThis.document) return;
    let format = getFontCSSFormat(url, options.errorOnStyle);
    if (!format) return;
    let style = document.createElement(`style`);
    style.className = `injected-by-Font-js`;
    let rules = [];
    if (options.styleRules) {
      rules = Object.entries(options.styleRules).map(
        ([key, value]) => `${key}: ${value};`
      );
    }
    style.textContent = `
@font-face {
    font-family: "${name2}";
    ${rules.join(
      `
	`
    )}
    src: url("${url}") format("${format}");
}`;
    globalThis.document.head.appendChild(style);
    return style;
  }
  var TTF = [0, 1, 0, 0];
  var OTF = [79, 84, 84, 79];
  var WOFF = [119, 79, 70, 70];
  var WOFF2 = [119, 79, 70, 50];
  function match(ar1, ar2) {
    if (ar1.length !== ar2.length) return;
    for (let i3 = 0; i3 < ar1.length; i3++) {
      if (ar1[i3] !== ar2[i3]) return;
    }
    return true;
  }
  function validFontFormat(dataview) {
    const LEAD_BYTES = [
      dataview.getUint8(0),
      dataview.getUint8(1),
      dataview.getUint8(2),
      dataview.getUint8(3)
    ];
    if (match(LEAD_BYTES, TTF) || match(LEAD_BYTES, OTF)) return `SFNT`;
    if (match(LEAD_BYTES, WOFF)) return `WOFF`;
    if (match(LEAD_BYTES, WOFF2)) return `WOFF2`;
  }
  function checkFetchResponseStatus(response) {
    if (!response.ok) {
      throw new Error(
        `HTTP ${response.status} - ${response.statusText}`
      );
    }
    return response;
  }
  var Font = class extends EventManager {
    constructor(name2, options = {}) {
      super();
      this.name = name2;
      this.options = options;
      this.metrics = false;
    }
    get src() {
      return this.__src;
    }
    set src(src) {
      this.__src = src;
      (async () => {
        if (globalThis.document && !this.options.skipStyleSheet) {
          await setupFontFace(this.name, src, this.options);
        }
        this.loadFont(src);
      })();
    }
    async loadFont(url, filename) {
      fetch(url).then(
        (response) => checkFetchResponseStatus(response) && response.arrayBuffer()
      ).then(
        (buffer) => this.fromDataBuffer(buffer, filename || url)
      ).catch((err) => {
        const evt = new Event2(
          `error`,
          err,
          `Failed to load font at ${filename || url}`
        );
        this.dispatch(evt);
        if (this.onerror) this.onerror(evt);
      });
    }
    async fromDataBuffer(buffer, filenameOrUrL) {
      this.fontData = new DataView(buffer);
      let type = validFontFormat(this.fontData);
      if (!type) {
        throw new Error(
          `${filenameOrUrL} is either an unsupported font format, or not a font at all.`
        );
      }
      await this.parseBasicData(type);
      const evt = new Event2("load", { font: this });
      this.dispatch(evt);
      if (this.onload) this.onload(evt);
    }
    async parseBasicData(type) {
      return loadTableClasses().then((createTable2) => {
        if (type === `SFNT`) {
          this.opentype = new SFNT(this, this.fontData, createTable2);
        }
        if (type === `WOFF`) {
          this.opentype = new WOFF$1(this, this.fontData, createTable2);
        }
        if (type === `WOFF2`) {
          this.opentype = new WOFF2$1(this, this.fontData, createTable2);
        }
        return this.opentype;
      });
    }
    getGlyphId(char) {
      return this.opentype.tables.cmap.getGlyphId(char);
    }
    reverse(glyphid) {
      return this.opentype.tables.cmap.reverse(glyphid);
    }
    supports(char) {
      return this.getGlyphId(char) !== 0;
    }
    supportsVariation(variation) {
      return this.opentype.tables.cmap.supportsVariation(variation) !== false;
    }
    measureText(text, size3 = 16) {
      if (this.__unloaded)
        throw new Error(
          "Cannot measure text: font was unloaded. Please reload before calling measureText()"
        );
      let d3 = document.createElement("div");
      d3.textContent = text;
      d3.style.fontFamily = this.name;
      d3.style.fontSize = `${size3}px`;
      d3.style.color = `transparent`;
      d3.style.background = `transparent`;
      d3.style.top = `0`;
      d3.style.left = `0`;
      d3.style.position = `absolute`;
      document.body.appendChild(d3);
      let bbox = d3.getBoundingClientRect();
      document.body.removeChild(d3);
      const OS22 = this.opentype.tables["OS/2"];
      bbox.fontSize = size3;
      bbox.ascender = OS22.sTypoAscender;
      bbox.descender = OS22.sTypoDescender;
      return bbox;
    }
    unload() {
      if (this.styleElement.parentNode) {
        this.styleElement.parentNode.removeElement(this.styleElement);
        const evt = new Event2("unload", { font: this });
        this.dispatch(evt);
        if (this.onunload) this.onunload(evt);
      }
      this._unloaded = true;
    }
    load() {
      if (this.__unloaded) {
        delete this.__unloaded;
        document.head.appendChild(this.styleElement);
        const evt = new Event2("load", { font: this });
        this.dispatch(evt);
        if (this.onload) this.onload(evt);
      }
    }
  };
  globalThis.Font = Font;
  var Subtable = class extends ParsedData {
    constructor(p22, plaformID, encodingID) {
      super(p22);
      this.plaformID = plaformID;
      this.encodingID = encodingID;
    }
  };
  var Format0 = class extends Subtable {
    constructor(p22, platformID, encodingID) {
      super(p22, platformID, encodingID);
      this.format = 0;
      this.length = p22.uint16;
      this.language = p22.uint16;
      this.glyphIdArray = [...new Array(256)].map((_) => p22.uint8);
    }
    supports(charCode) {
      if (charCode.charCodeAt) {
        charCode = -1;
        console.warn(
          `supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.`
        );
      }
      return 0 <= charCode && charCode <= 255;
    }
    reverse(glyphID) {
      console.warn(`reverse not implemented for cmap subtable format 0`);
      return {};
    }
    getSupportedCharCodes() {
      return [{ start: 1, end: 256 }];
    }
  };
  var Format2 = class extends Subtable {
    constructor(p22, platformID, encodingID) {
      super(p22, platformID, encodingID);
      this.format = 2;
      this.length = p22.uint16;
      this.language = p22.uint16;
      this.subHeaderKeys = [...new Array(256)].map((_) => p22.uint16);
      const subHeaderCount = Math.max(...this.subHeaderKeys);
      const subHeaderOffset = p22.currentPosition;
      lazy$1(this, `subHeaders`, () => {
        p22.currentPosition = subHeaderOffset;
        return [...new Array(subHeaderCount)].map(
          (_) => new SubHeader(p22)
        );
      });
      const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8;
      lazy$1(this, `glyphIndexArray`, () => {
        p22.currentPosition = glyphIndexOffset;
        return [...new Array(subHeaderCount)].map((_) => p22.uint16);
      });
    }
    supports(charCode) {
      if (charCode.charCodeAt) {
        charCode = -1;
        console.warn(
          `supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.`
        );
      }
      const low = charCode && 255;
      const high = charCode && 65280;
      const subHeaderKey = this.subHeaders[high];
      const subheader = this.subHeaders[subHeaderKey];
      const first = subheader.firstCode;
      const last = first + subheader.entryCount;
      return first <= low && low <= last;
    }
    reverse(glyphID) {
      console.warn(`reverse not implemented for cmap subtable format 2`);
      return {};
    }
    getSupportedCharCodes(preservePropNames = false) {
      if (preservePropNames) {
        return this.subHeaders.map((h3) => ({
          firstCode: h3.firstCode,
          lastCode: h3.lastCode
        }));
      }
      return this.subHeaders.map((h3) => ({
        start: h3.firstCode,
        end: h3.lastCode
      }));
    }
  };
  var SubHeader = class {
    constructor(p22) {
      this.firstCode = p22.uint16;
      this.entryCount = p22.uint16;
      this.lastCode = this.first + this.entryCount;
      this.idDelta = p22.int16;
      this.idRangeOffset = p22.uint16;
    }
  };
  var Format4 = class extends Subtable {
    constructor(p22, platformID, encodingID) {
      super(p22, platformID, encodingID);
      this.format = 4;
      this.length = p22.uint16;
      this.language = p22.uint16;
      this.segCountX2 = p22.uint16;
      this.segCount = this.segCountX2 / 2;
      this.searchRange = p22.uint16;
      this.entrySelector = p22.uint16;
      this.rangeShift = p22.uint16;
      const endCodePosition = p22.currentPosition;
      lazy$1(
        this,
        `endCode`,
        () => p22.readBytes(this.segCount, endCodePosition, 16)
      );
      const startCodePosition = endCodePosition + 2 + this.segCountX2;
      lazy$1(
        this,
        `startCode`,
        () => p22.readBytes(this.segCount, startCodePosition, 16)
      );
      const idDeltaPosition = startCodePosition + this.segCountX2;
      lazy$1(
        this,
        `idDelta`,
        () => p22.readBytes(this.segCount, idDeltaPosition, 16, true)
      );
      const idRangePosition = idDeltaPosition + this.segCountX2;
      lazy$1(
        this,
        `idRangeOffset`,
        () => p22.readBytes(this.segCount, idRangePosition, 16)
      );
      const glyphIdArrayPosition = idRangePosition + this.segCountX2;
      const glyphIdArrayLength = this.length - (glyphIdArrayPosition - this.tableStart);
      lazy$1(
        this,
        `glyphIdArray`,
        () => p22.readBytes(glyphIdArrayLength, glyphIdArrayPosition, 16)
      );
      lazy$1(
        this,
        `segments`,
        () => this.buildSegments(idRangePosition, glyphIdArrayPosition, p22)
      );
    }
    buildSegments(idRangePosition, glyphIdArrayPosition, p22) {
      const build = (_, i3) => {
        let startCode = this.startCode[i3], endCode = this.endCode[i3], idDelta = this.idDelta[i3], idRangeOffset = this.idRangeOffset[i3], idRangeOffsetPointer = idRangePosition + 2 * i3, glyphIDs = [];
        if (idRangeOffset === 0) {
          for (let i22 = startCode + idDelta, e3 = endCode + idDelta; i22 <= e3; i22++) {
            glyphIDs.push(i22);
          }
        } else {
          for (let i22 = 0, e3 = endCode - startCode; i22 <= e3; i22++) {
            p22.currentPosition = idRangeOffsetPointer + idRangeOffset + i22 * 2;
            glyphIDs.push(p22.uint16);
          }
        }
        return {
          startCode,
          endCode,
          idDelta,
          idRangeOffset,
          glyphIDs
        };
      };
      return [...new Array(this.segCount)].map(build);
    }
    reverse(glyphID) {
      let s3 = this.segments.find((v3) => v3.glyphIDs.includes(glyphID));
      if (!s3) return {};
      const code = s3.startCode + s3.glyphIDs.indexOf(glyphID);
      return { code, unicode: String.fromCodePoint(code) };
    }
    getGlyphId(charCode) {
      if (charCode.charCodeAt) charCode = charCode.charCodeAt(0);
      if (55296 <= charCode && charCode <= 57343) return 0;
      if ((charCode & 65534) === 65534 || (charCode & 65535) === 65535)
        return 0;
      let segment = this.segments.find(
        (s3) => s3.startCode <= charCode && charCode <= s3.endCode
      );
      if (!segment) return 0;
      return segment.glyphIDs[charCode - segment.startCode];
    }
    supports(charCode) {
      return this.getGlyphId(charCode) !== 0;
    }
    getSupportedCharCodes(preservePropNames = false) {
      if (preservePropNames) return this.segments;
      return this.segments.map((v3) => ({
        start: v3.startCode,
        end: v3.endCode
      }));
    }
  };
  var Format6 = class extends Subtable {
    constructor(p22, platformID, encodingID) {
      super(p22, platformID, encodingID);
      this.format = 6;
      this.length = p22.uint16;
      this.language = p22.uint16;
      this.firstCode = p22.uint16;
      this.entryCount = p22.uint16;
      this.lastCode = this.firstCode + this.entryCount - 1;
      const getter = () => [...new Array(this.entryCount)].map((_) => p22.uint16);
      lazy$1(this, `glyphIdArray`, getter);
    }
    supports(charCode) {
      if (charCode.charCodeAt) {
        charCode = -1;
        console.warn(
          `supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.`
        );
      }
      if (charCode < this.firstCode) return {};
      if (charCode > this.firstCode + this.entryCount) return {};
      const code = charCode - this.firstCode;
      return { code, unicode: String.fromCodePoint(code) };
    }
    reverse(glyphID) {
      let pos = this.glyphIdArray.indexOf(glyphID);
      if (pos > -1) return this.firstCode + pos;
    }
    getSupportedCharCodes(preservePropNames = false) {
      if (preservePropNames) {
        return [{ firstCode: this.firstCode, lastCode: this.lastCode }];
      }
      return [{ start: this.firstCode, end: this.lastCode }];
    }
  };
  var Format8 = class extends Subtable {
    constructor(p22, platformID, encodingID) {
      super(p22, platformID, encodingID);
      this.format = 8;
      p22.uint16;
      this.length = p22.uint32;
      this.language = p22.uint32;
      this.is32 = [...new Array(8192)].map((_) => p22.uint8);
      this.numGroups = p22.uint32;
      const getter = () => [...new Array(this.numGroups)].map(
        (_) => new SequentialMapGroup$1(p22)
      );
      lazy$1(this, `groups`, getter);
    }
    supports(charCode) {
      if (charCode.charCodeAt) {
        charCode = -1;
        console.warn(
          `supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.`
        );
      }
      return this.groups.findIndex(
        (s3) => s3.startcharCode <= charCode && charCode <= s3.endcharCode
      ) !== -1;
    }
    reverse(glyphID) {
      console.warn(`reverse not implemented for cmap subtable format 8`);
      return {};
    }
    getSupportedCharCodes(preservePropNames = false) {
      if (preservePropNames) return this.groups;
      return this.groups.map((v3) => ({
        start: v3.startcharCode,
        end: v3.endcharCode
      }));
    }
  };
  var SequentialMapGroup$1 = class {
    constructor(p22) {
      this.startcharCode = p22.uint32;
      this.endcharCode = p22.uint32;
      this.startGlyphID = p22.uint32;
    }
  };
  var Format10 = class extends Subtable {
    constructor(p22, platformID, encodingID) {
      super(p22, platformID, encodingID);
      this.format = 10;
      p22.uint16;
      this.length = p22.uint32;
      this.language = p22.uint32;
      this.startCharCode = p22.uint32;
      this.numChars = p22.uint32;
      this.endCharCode = this.startCharCode + this.numChars;
      const getter = () => [...new Array(this.numChars)].map((_) => p22.uint16);
      lazy$1(this, `glyphs`, getter);
    }
    supports(charCode) {
      if (charCode.charCodeAt) {
        charCode = -1;
        console.warn(
          `supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.`
        );
      }
      if (charCode < this.startCharCode) return false;
      if (charCode > this.startCharCode + this.numChars) return false;
      return charCode - this.startCharCode;
    }
    reverse(glyphID) {
      console.warn(`reverse not implemented for cmap subtable format 10`);
      return {};
    }
    getSupportedCharCodes(preservePropNames = false) {
      if (preservePropNames) {
        return [
          {
            startCharCode: this.startCharCode,
            endCharCode: this.endCharCode
          }
        ];
      }
      return [{ start: this.startCharCode, end: this.endCharCode }];
    }
  };
  var Format12 = class extends Subtable {
    constructor(p22, platformID, encodingID) {
      super(p22, platformID, encodingID);
      this.format = 12;
      p22.uint16;
      this.length = p22.uint32;
      this.language = p22.uint32;
      this.numGroups = p22.uint32;
      const getter = () => [...new Array(this.numGroups)].map(
        (_) => new SequentialMapGroup(p22)
      );
      lazy$1(this, `groups`, getter);
    }
    supports(charCode) {
      if (charCode.charCodeAt) charCode = charCode.charCodeAt(0);
      if (55296 <= charCode && charCode <= 57343) return 0;
      if ((charCode & 65534) === 65534 || (charCode & 65535) === 65535)
        return 0;
      return this.groups.findIndex(
        (s3) => s3.startCharCode <= charCode && charCode <= s3.endCharCode
      ) !== -1;
    }
    reverse(glyphID) {
      for (let group of this.groups) {
        let start = group.startGlyphID;
        if (start > glyphID) continue;
        if (start === glyphID) return group.startCharCode;
        let end = start + (group.endCharCode - group.startCharCode);
        if (end < glyphID) continue;
        const code = group.startCharCode + (glyphID - start);
        return { code, unicode: String.fromCodePoint(code) };
      }
      return {};
    }
    getSupportedCharCodes(preservePropNames = false) {
      if (preservePropNames) return this.groups;
      return this.groups.map((v3) => ({
        start: v3.startCharCode,
        end: v3.endCharCode
      }));
    }
  };
  var SequentialMapGroup = class {
    constructor(p22) {
      this.startCharCode = p22.uint32;
      this.endCharCode = p22.uint32;
      this.startGlyphID = p22.uint32;
    }
  };
  var Format13 = class extends Subtable {
    constructor(p22, platformID, encodingID) {
      super(p22, platformID, encodingID);
      this.format = 13;
      p22.uint16;
      this.length = p22.uint32;
      this.language = p22.uint32;
      this.numGroups = p22.uint32;
      const getter = [...new Array(this.numGroups)].map(
        (_) => new ConstantMapGroup(p22)
      );
      lazy$1(this, `groups`, getter);
    }
    supports(charCode) {
      if (charCode.charCodeAt) charCode = charCode.charCodeAt(0);
      return this.groups.findIndex(
        (s3) => s3.startCharCode <= charCode && charCode <= s3.endCharCode
      ) !== -1;
    }
    reverse(glyphID) {
      console.warn(`reverse not implemented for cmap subtable format 13`);
      return {};
    }
    getSupportedCharCodes(preservePropNames = false) {
      if (preservePropNames) return this.groups;
      return this.groups.map((v3) => ({
        start: v3.startCharCode,
        end: v3.endCharCode
      }));
    }
  };
  var ConstantMapGroup = class {
    constructor(p22) {
      this.startCharCode = p22.uint32;
      this.endCharCode = p22.uint32;
      this.glyphID = p22.uint32;
    }
  };
  var Format14 = class extends Subtable {
    constructor(p22, platformID, encodingID) {
      super(p22, platformID, encodingID);
      this.subTableStart = p22.currentPosition;
      this.format = 14;
      this.length = p22.uint32;
      this.numVarSelectorRecords = p22.uint32;
      lazy$1(
        this,
        `varSelectors`,
        () => [...new Array(this.numVarSelectorRecords)].map(
          (_) => new VariationSelector(p22)
        )
      );
    }
    supports() {
      console.warn(`supports not implemented for cmap subtable format 14`);
      return 0;
    }
    getSupportedCharCodes() {
      console.warn(
        `getSupportedCharCodes not implemented for cmap subtable format 14`
      );
      return [];
    }
    reverse(glyphID) {
      console.warn(`reverse not implemented for cmap subtable format 14`);
      return {};
    }
    supportsVariation(variation) {
      let v3 = this.varSelector.find(
        (uvs) => uvs.varSelector === variation
      );
      return v3 ? v3 : false;
    }
    getSupportedVariations() {
      return this.varSelectors.map((v3) => v3.varSelector);
    }
  };
  var VariationSelector = class {
    constructor(p22) {
      this.varSelector = p22.uint24;
      this.defaultUVSOffset = p22.Offset32;
      this.nonDefaultUVSOffset = p22.Offset32;
    }
  };
  function createSubTable(parser, platformID, encodingID) {
    const format = parser.uint16;
    if (format === 0) return new Format0(parser, platformID, encodingID);
    if (format === 2) return new Format2(parser, platformID, encodingID);
    if (format === 4) return new Format4(parser, platformID, encodingID);
    if (format === 6) return new Format6(parser, platformID, encodingID);
    if (format === 8) return new Format8(parser, platformID, encodingID);
    if (format === 10) return new Format10(parser, platformID, encodingID);
    if (format === 12) return new Format12(parser, platformID, encodingID);
    if (format === 13) return new Format13(parser, platformID, encodingID);
    if (format === 14) return new Format14(parser, platformID, encodingID);
    return {};
  }
  var cmap = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint16;
      this.numTables = p22.uint16;
      this.encodingRecords = [...new Array(this.numTables)].map(
        (_) => new EncodingRecord(p22, this.tableStart)
      );
    }
    getSubTable(tableID) {
      return this.encodingRecords[tableID].table;
    }
    getSupportedEncodings() {
      return this.encodingRecords.map((r4) => ({
        platformID: r4.platformID,
        encodingId: r4.encodingID
      }));
    }
    getSupportedCharCodes(platformID, encodingID) {
      const recordID = this.encodingRecords.findIndex(
        (r4) => r4.platformID === platformID && r4.encodingID === encodingID
      );
      if (recordID === -1) return false;
      const subtable = this.getSubTable(recordID);
      return subtable.getSupportedCharCodes();
    }
    reverse(glyphid) {
      for (let i3 = 0; i3 < this.numTables; i3++) {
        let code = this.getSubTable(i3).reverse(glyphid);
        if (code) return code;
      }
    }
    getGlyphId(char) {
      let last = 0;
      this.encodingRecords.some((_, tableID) => {
        let t4 = this.getSubTable(tableID);
        if (!t4.getGlyphId) return false;
        last = t4.getGlyphId(char);
        return last !== 0;
      });
      return last;
    }
    supports(char) {
      return this.encodingRecords.some((_, tableID) => {
        const t4 = this.getSubTable(tableID);
        return t4.supports && t4.supports(char) !== false;
      });
    }
    supportsVariation(variation) {
      return this.encodingRecords.some((_, tableID) => {
        const t4 = this.getSubTable(tableID);
        return t4.supportsVariation && t4.supportsVariation(variation) !== false;
      });
    }
  };
  var EncodingRecord = class {
    constructor(p22, tableStart) {
      const platformID = this.platformID = p22.uint16;
      const encodingID = this.encodingID = p22.uint16;
      const offset3 = this.offset = p22.Offset32;
      lazy$1(this, `table`, () => {
        p22.currentPosition = tableStart + offset3;
        return createSubTable(p22, platformID, encodingID);
      });
    }
  };
  var cmap$1 = Object.freeze({ __proto__: null, cmap });
  var head = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.load({
        majorVersion: p22.uint16,
        minorVersion: p22.uint16,
        fontRevision: p22.fixed,
        checkSumAdjustment: p22.uint32,
        magicNumber: p22.uint32,
        flags: p22.flags(16),
        unitsPerEm: p22.uint16,
        created: p22.longdatetime,
        modified: p22.longdatetime,
        xMin: p22.int16,
        yMin: p22.int16,
        xMax: p22.int16,
        yMax: p22.int16,
        macStyle: p22.flags(16),
        lowestRecPPEM: p22.uint16,
        fontDirectionHint: p22.uint16,
        indexToLocFormat: p22.uint16,
        glyphDataFormat: p22.uint16
      });
    }
  };
  var head$1 = Object.freeze({ __proto__: null, head });
  var hhea = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.majorVersion = p22.uint16;
      this.minorVersion = p22.uint16;
      this.ascender = p22.fword;
      this.descender = p22.fword;
      this.lineGap = p22.fword;
      this.advanceWidthMax = p22.ufword;
      this.minLeftSideBearing = p22.fword;
      this.minRightSideBearing = p22.fword;
      this.xMaxExtent = p22.fword;
      this.caretSlopeRise = p22.int16;
      this.caretSlopeRun = p22.int16;
      this.caretOffset = p22.int16;
      p22.int16;
      p22.int16;
      p22.int16;
      p22.int16;
      this.metricDataFormat = p22.int16;
      this.numberOfHMetrics = p22.uint16;
      p22.verifyLength();
    }
  };
  var hhea$1 = Object.freeze({ __proto__: null, hhea });
  var hmtx = class extends SimpleTable {
    constructor(dict, dataview, tables) {
      const { p: p22 } = super(dict, dataview);
      const numberOfHMetrics = tables.hhea.numberOfHMetrics;
      const numGlyphs = tables.maxp.numGlyphs;
      const metricsStart = p22.currentPosition;
      lazy$1(this, `hMetrics`, () => {
        p22.currentPosition = metricsStart;
        return [...new Array(numberOfHMetrics)].map(
          (_) => new LongHorMetric(p22.uint16, p22.int16)
        );
      });
      if (numberOfHMetrics < numGlyphs) {
        const lsbStart = metricsStart + numberOfHMetrics * 4;
        lazy$1(this, `leftSideBearings`, () => {
          p22.currentPosition = lsbStart;
          return [...new Array(numGlyphs - numberOfHMetrics)].map(
            (_) => p22.int16
          );
        });
      }
    }
  };
  var LongHorMetric = class {
    constructor(w3, b3) {
      this.advanceWidth = w3;
      this.lsb = b3;
    }
  };
  var hmtx$1 = Object.freeze({ __proto__: null, hmtx });
  var maxp = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.legacyFixed;
      this.numGlyphs = p22.uint16;
      if (this.version === 1) {
        this.maxPoints = p22.uint16;
        this.maxContours = p22.uint16;
        this.maxCompositePoints = p22.uint16;
        this.maxCompositeContours = p22.uint16;
        this.maxZones = p22.uint16;
        this.maxTwilightPoints = p22.uint16;
        this.maxStorage = p22.uint16;
        this.maxFunctionDefs = p22.uint16;
        this.maxInstructionDefs = p22.uint16;
        this.maxStackElements = p22.uint16;
        this.maxSizeOfInstructions = p22.uint16;
        this.maxComponentElements = p22.uint16;
        this.maxComponentDepth = p22.uint16;
      }
      p22.verifyLength();
    }
  };
  var maxp$1 = Object.freeze({ __proto__: null, maxp });
  var name = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.format = p22.uint16;
      this.count = p22.uint16;
      this.stringOffset = p22.Offset16;
      this.nameRecords = [...new Array(this.count)].map(
        (_) => new NameRecord(p22, this)
      );
      if (this.format === 1) {
        this.langTagCount = p22.uint16;
        this.langTagRecords = [...new Array(this.langTagCount)].map(
          (_) => new LangTagRecord(p22.uint16, p22.Offset16)
        );
      }
      this.stringStart = this.tableStart + this.stringOffset;
    }
    get(nameID) {
      let record = this.nameRecords.find(
        (record2) => record2.nameID === nameID
      );
      if (record) return record.string;
    }
  };
  var LangTagRecord = class {
    constructor(length, offset3) {
      this.length = length;
      this.offset = offset3;
    }
  };
  var NameRecord = class {
    constructor(p22, nameTable) {
      this.platformID = p22.uint16;
      this.encodingID = p22.uint16;
      this.languageID = p22.uint16;
      this.nameID = p22.uint16;
      this.length = p22.uint16;
      this.offset = p22.Offset16;
      lazy$1(this, `string`, () => {
        p22.currentPosition = nameTable.stringStart + this.offset;
        return decodeString(p22, this);
      });
    }
  };
  function decodeString(p22, record) {
    const { platformID, length } = record;
    if (length === 0) return ``;
    if (platformID === 0 || platformID === 3) {
      const str2 = [];
      for (let i3 = 0, e3 = length / 2; i3 < e3; i3++)
        str2[i3] = String.fromCharCode(p22.uint16);
      return str2.join(``);
    }
    const bytes = p22.readBytes(length);
    const str = [];
    bytes.forEach(function(b3, i3) {
      str[i3] = String.fromCharCode(b3);
    });
    return str.join(``);
  }
  var name$1 = Object.freeze({ __proto__: null, name });
  var OS2 = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint16;
      this.xAvgCharWidth = p22.int16;
      this.usWeightClass = p22.uint16;
      this.usWidthClass = p22.uint16;
      this.fsType = p22.uint16;
      this.ySubscriptXSize = p22.int16;
      this.ySubscriptYSize = p22.int16;
      this.ySubscriptXOffset = p22.int16;
      this.ySubscriptYOffset = p22.int16;
      this.ySuperscriptXSize = p22.int16;
      this.ySuperscriptYSize = p22.int16;
      this.ySuperscriptXOffset = p22.int16;
      this.ySuperscriptYOffset = p22.int16;
      this.yStrikeoutSize = p22.int16;
      this.yStrikeoutPosition = p22.int16;
      this.sFamilyClass = p22.int16;
      this.panose = [...new Array(10)].map((_) => p22.uint8);
      this.ulUnicodeRange1 = p22.flags(32);
      this.ulUnicodeRange2 = p22.flags(32);
      this.ulUnicodeRange3 = p22.flags(32);
      this.ulUnicodeRange4 = p22.flags(32);
      this.achVendID = p22.tag;
      this.fsSelection = p22.uint16;
      this.usFirstCharIndex = p22.uint16;
      this.usLastCharIndex = p22.uint16;
      this.sTypoAscender = p22.int16;
      this.sTypoDescender = p22.int16;
      this.sTypoLineGap = p22.int16;
      this.usWinAscent = p22.uint16;
      this.usWinDescent = p22.uint16;
      if (this.version === 0) return p22.verifyLength();
      this.ulCodePageRange1 = p22.flags(32);
      this.ulCodePageRange2 = p22.flags(32);
      if (this.version === 1) return p22.verifyLength();
      this.sxHeight = p22.int16;
      this.sCapHeight = p22.int16;
      this.usDefaultChar = p22.uint16;
      this.usBreakChar = p22.uint16;
      this.usMaxContext = p22.uint16;
      if (this.version <= 4) return p22.verifyLength();
      this.usLowerOpticalPointSize = p22.uint16;
      this.usUpperOpticalPointSize = p22.uint16;
      if (this.version === 5) return p22.verifyLength();
    }
  };
  var OS2$1 = Object.freeze({ __proto__: null, OS2 });
  var post = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.legacyFixed;
      this.italicAngle = p22.fixed;
      this.underlinePosition = p22.fword;
      this.underlineThickness = p22.fword;
      this.isFixedPitch = p22.uint32;
      this.minMemType42 = p22.uint32;
      this.maxMemType42 = p22.uint32;
      this.minMemType1 = p22.uint32;
      this.maxMemType1 = p22.uint32;
      if (this.version === 1 || this.version === 3) return p22.verifyLength();
      this.numGlyphs = p22.uint16;
      if (this.version === 2) {
        this.glyphNameIndex = [...new Array(this.numGlyphs)].map(
          (_) => p22.uint16
        );
        this.namesOffset = p22.currentPosition;
        this.glyphNameOffsets = [1];
        for (let i3 = 0; i3 < this.numGlyphs; i3++) {
          let index2 = this.glyphNameIndex[i3];
          if (index2 < macStrings.length) {
            this.glyphNameOffsets.push(this.glyphNameOffsets[i3]);
            continue;
          }
          let bytelength = p22.int8;
          p22.skip(bytelength);
          this.glyphNameOffsets.push(
            this.glyphNameOffsets[i3] + bytelength + 1
          );
        }
      }
      if (this.version === 2.5) {
        this.offset = [...new Array(this.numGlyphs)].map(
          (_) => p22.int8
        );
      }
    }
    getGlyphName(glyphid) {
      if (this.version !== 2) {
        console.warn(
          `post table version ${this.version} does not support glyph name lookups`
        );
        return ``;
      }
      let index2 = this.glyphNameIndex[glyphid];
      if (index2 < 258) return macStrings[index2];
      let offset3 = this.glyphNameOffsets[glyphid];
      let next = this.glyphNameOffsets[glyphid + 1];
      let len = next - offset3 - 1;
      if (len === 0) return `.notdef.`;
      this.parser.currentPosition = this.namesOffset + offset3;
      const data = this.parser.readBytes(
        len,
        this.namesOffset + offset3,
        8,
        true
      );
      return data.map((b3) => String.fromCharCode(b3)).join(``);
    }
  };
  var macStrings = [
    `.notdef`,
    `.null`,
    `nonmarkingreturn`,
    `space`,
    `exclam`,
    `quotedbl`,
    `numbersign`,
    `dollar`,
    `percent`,
    `ampersand`,
    `quotesingle`,
    `parenleft`,
    `parenright`,
    `asterisk`,
    `plus`,
    `comma`,
    `hyphen`,
    `period`,
    `slash`,
    `zero`,
    `one`,
    `two`,
    `three`,
    `four`,
    `five`,
    `six`,
    `seven`,
    `eight`,
    `nine`,
    `colon`,
    `semicolon`,
    `less`,
    `equal`,
    `greater`,
    `question`,
    `at`,
    `A`,
    `B`,
    `C`,
    `D`,
    `E`,
    `F`,
    `G`,
    `H`,
    `I`,
    `J`,
    `K`,
    `L`,
    `M`,
    `N`,
    `O`,
    `P`,
    `Q`,
    `R`,
    `S`,
    `T`,
    `U`,
    `V`,
    `W`,
    `X`,
    `Y`,
    `Z`,
    `bracketleft`,
    `backslash`,
    `bracketright`,
    `asciicircum`,
    `underscore`,
    `grave`,
    `a`,
    `b`,
    `c`,
    `d`,
    `e`,
    `f`,
    `g`,
    `h`,
    `i`,
    `j`,
    `k`,
    `l`,
    `m`,
    `n`,
    `o`,
    `p`,
    `q`,
    `r`,
    `s`,
    `t`,
    `u`,
    `v`,
    `w`,
    `x`,
    `y`,
    `z`,
    `braceleft`,
    `bar`,
    `braceright`,
    `asciitilde`,
    `Adieresis`,
    `Aring`,
    `Ccedilla`,
    `Eacute`,
    `Ntilde`,
    `Odieresis`,
    `Udieresis`,
    `aacute`,
    `agrave`,
    `acircumflex`,
    `adieresis`,
    `atilde`,
    `aring`,
    `ccedilla`,
    `eacute`,
    `egrave`,
    `ecircumflex`,
    `edieresis`,
    `iacute`,
    `igrave`,
    `icircumflex`,
    `idieresis`,
    `ntilde`,
    `oacute`,
    `ograve`,
    `ocircumflex`,
    `odieresis`,
    `otilde`,
    `uacute`,
    `ugrave`,
    `ucircumflex`,
    `udieresis`,
    `dagger`,
    `degree`,
    `cent`,
    `sterling`,
    `section`,
    `bullet`,
    `paragraph`,
    `germandbls`,
    `registered`,
    `copyright`,
    `trademark`,
    `acute`,
    `dieresis`,
    `notequal`,
    `AE`,
    `Oslash`,
    `infinity`,
    `plusminus`,
    `lessequal`,
    `greaterequal`,
    `yen`,
    `mu`,
    `partialdiff`,
    `summation`,
    `product`,
    `pi`,
    `integral`,
    `ordfeminine`,
    `ordmasculine`,
    `Omega`,
    `ae`,
    `oslash`,
    `questiondown`,
    `exclamdown`,
    `logicalnot`,
    `radical`,
    `florin`,
    `approxequal`,
    `Delta`,
    `guillemotleft`,
    `guillemotright`,
    `ellipsis`,
    `nonbreakingspace`,
    `Agrave`,
    `Atilde`,
    `Otilde`,
    `OE`,
    `oe`,
    `endash`,
    `emdash`,
    `quotedblleft`,
    `quotedblright`,
    `quoteleft`,
    `quoteright`,
    `divide`,
    `lozenge`,
    `ydieresis`,
    `Ydieresis`,
    `fraction`,
    `currency`,
    `guilsinglleft`,
    `guilsinglright`,
    `fi`,
    `fl`,
    `daggerdbl`,
    `periodcentered`,
    `quotesinglbase`,
    `quotedblbase`,
    `perthousand`,
    `Acircumflex`,
    `Ecircumflex`,
    `Aacute`,
    `Edieresis`,
    `Egrave`,
    `Iacute`,
    `Icircumflex`,
    `Idieresis`,
    `Igrave`,
    `Oacute`,
    `Ocircumflex`,
    `apple`,
    `Ograve`,
    `Uacute`,
    `Ucircumflex`,
    `Ugrave`,
    `dotlessi`,
    `circumflex`,
    `tilde`,
    `macron`,
    `breve`,
    `dotaccent`,
    `ring`,
    `cedilla`,
    `hungarumlaut`,
    `ogonek`,
    `caron`,
    `Lslash`,
    `lslash`,
    `Scaron`,
    `scaron`,
    `Zcaron`,
    `zcaron`,
    `brokenbar`,
    `Eth`,
    `eth`,
    `Yacute`,
    `yacute`,
    `Thorn`,
    `thorn`,
    `minus`,
    `multiply`,
    `onesuperior`,
    `twosuperior`,
    `threesuperior`,
    `onehalf`,
    `onequarter`,
    `threequarters`,
    `franc`,
    `Gbreve`,
    `gbreve`,
    `Idotaccent`,
    `Scedilla`,
    `scedilla`,
    `Cacute`,
    `cacute`,
    `Ccaron`,
    `ccaron`,
    `dcroat`
  ];
  var post$1 = Object.freeze({ __proto__: null, post });
  var BASE = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.majorVersion = p22.uint16;
      this.minorVersion = p22.uint16;
      this.horizAxisOffset = p22.Offset16;
      this.vertAxisOffset = p22.Offset16;
      lazy$1(
        this,
        `horizAxis`,
        () => new AxisTable(
          { offset: dict.offset + this.horizAxisOffset },
          dataview
        )
      );
      lazy$1(
        this,
        `vertAxis`,
        () => new AxisTable(
          { offset: dict.offset + this.vertAxisOffset },
          dataview
        )
      );
      if (this.majorVersion === 1 && this.minorVersion === 1) {
        this.itemVarStoreOffset = p22.Offset32;
        lazy$1(
          this,
          `itemVarStore`,
          () => new AxisTable(
            { offset: dict.offset + this.itemVarStoreOffset },
            dataview
          )
        );
      }
    }
  };
  var AxisTable = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview, `AxisTable`);
      this.baseTagListOffset = p22.Offset16;
      this.baseScriptListOffset = p22.Offset16;
      lazy$1(
        this,
        `baseTagList`,
        () => new BaseTagListTable(
          { offset: dict.offset + this.baseTagListOffset },
          dataview
        )
      );
      lazy$1(
        this,
        `baseScriptList`,
        () => new BaseScriptListTable(
          { offset: dict.offset + this.baseScriptListOffset },
          dataview
        )
      );
    }
  };
  var BaseTagListTable = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview, `BaseTagListTable`);
      this.baseTagCount = p22.uint16;
      this.baselineTags = [...new Array(this.baseTagCount)].map(
        (_) => p22.tag
      );
    }
  };
  var BaseScriptListTable = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview, `BaseScriptListTable`);
      this.baseScriptCount = p22.uint16;
      const recordStart = p22.currentPosition;
      lazy$1(this, `baseScriptRecords`, () => {
        p22.currentPosition = recordStart;
        return [...new Array(this.baseScriptCount)].map(
          (_) => new BaseScriptRecord(this.start, p22)
        );
      });
    }
  };
  var BaseScriptRecord = class {
    constructor(baseScriptListTableStart, p22) {
      this.baseScriptTag = p22.tag;
      this.baseScriptOffset = p22.Offset16;
      lazy$1(this, `baseScriptTable`, () => {
        p22.currentPosition = baseScriptListTableStart + this.baseScriptOffset;
        return new BaseScriptTable(p22);
      });
    }
  };
  var BaseScriptTable = class {
    constructor(p22) {
      this.start = p22.currentPosition;
      this.baseValuesOffset = p22.Offset16;
      this.defaultMinMaxOffset = p22.Offset16;
      this.baseLangSysCount = p22.uint16;
      this.baseLangSysRecords = [...new Array(this.baseLangSysCount)].map(
        (_) => new BaseLangSysRecord(this.start, p22)
      );
      lazy$1(this, `baseValues`, () => {
        p22.currentPosition = this.start + this.baseValuesOffset;
        return new BaseValuesTable(p22);
      });
      lazy$1(this, `defaultMinMax`, () => {
        p22.currentPosition = this.start + this.defaultMinMaxOffset;
        return new MinMaxTable(p22);
      });
    }
  };
  var BaseLangSysRecord = class {
    constructor(baseScriptTableStart, p22) {
      this.baseLangSysTag = p22.tag;
      this.minMaxOffset = p22.Offset16;
      lazy$1(this, `minMax`, () => {
        p22.currentPosition = baseScriptTableStart + this.minMaxOffset;
        return new MinMaxTable(p22);
      });
    }
  };
  var BaseValuesTable = class {
    constructor(p22) {
      this.parser = p22;
      this.start = p22.currentPosition;
      this.defaultBaselineIndex = p22.uint16;
      this.baseCoordCount = p22.uint16;
      this.baseCoords = [...new Array(this.baseCoordCount)].map(
        (_) => p22.Offset16
      );
    }
    getTable(id) {
      this.parser.currentPosition = this.start + this.baseCoords[id];
      return new BaseCoordTable(this.parser);
    }
  };
  var MinMaxTable = class {
    constructor(p22) {
      this.minCoord = p22.Offset16;
      this.maxCoord = p22.Offset16;
      this.featMinMaxCount = p22.uint16;
      const recordStart = p22.currentPosition;
      lazy$1(this, `featMinMaxRecords`, () => {
        p22.currentPosition = recordStart;
        return [...new Array(this.featMinMaxCount)].map(
          (_) => new FeatMinMaxRecord(p22)
        );
      });
    }
  };
  var FeatMinMaxRecord = class {
    constructor(p22) {
      this.featureTableTag = p22.tag;
      this.minCoord = p22.Offset16;
      this.maxCoord = p22.Offset16;
    }
  };
  var BaseCoordTable = class {
    constructor(p22) {
      this.baseCoordFormat = p22.uint16;
      this.coordinate = p22.int16;
      if (this.baseCoordFormat === 2) {
        this.referenceGlyph = p22.uint16;
        this.baseCoordPoint = p22.uint16;
      }
      if (this.baseCoordFormat === 3) {
        this.deviceTable = p22.Offset16;
      }
    }
  };
  var BASE$1 = Object.freeze({ __proto__: null, BASE });
  var ClassDefinition = class {
    constructor(p22) {
      this.classFormat = p22.uint16;
      if (this.classFormat === 1) {
        this.startGlyphID = p22.uint16;
        this.glyphCount = p22.uint16;
        this.classValueArray = [...new Array(this.glyphCount)].map(
          (_) => p22.uint16
        );
      }
      if (this.classFormat === 2) {
        this.classRangeCount = p22.uint16;
        this.classRangeRecords = [
          ...new Array(this.classRangeCount)
        ].map((_) => new ClassRangeRecord(p22));
      }
    }
  };
  var ClassRangeRecord = class {
    constructor(p22) {
      this.startGlyphID = p22.uint16;
      this.endGlyphID = p22.uint16;
      this.class = p22.uint16;
    }
  };
  var CoverageTable = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.coverageFormat = p22.uint16;
      if (this.coverageFormat === 1) {
        this.glyphCount = p22.uint16;
        this.glyphArray = [...new Array(this.glyphCount)].map(
          (_) => p22.uint16
        );
      }
      if (this.coverageFormat === 2) {
        this.rangeCount = p22.uint16;
        this.rangeRecords = [...new Array(this.rangeCount)].map(
          (_) => new CoverageRangeRecord(p22)
        );
      }
    }
  };
  var CoverageRangeRecord = class {
    constructor(p22) {
      this.startGlyphID = p22.uint16;
      this.endGlyphID = p22.uint16;
      this.startCoverageIndex = p22.uint16;
    }
  };
  var ItemVariationStoreTable = class {
    constructor(table, p22) {
      this.table = table;
      this.parser = p22;
      this.start = p22.currentPosition;
      this.format = p22.uint16;
      this.variationRegionListOffset = p22.Offset32;
      this.itemVariationDataCount = p22.uint16;
      this.itemVariationDataOffsets = [
        ...new Array(this.itemVariationDataCount)
      ].map((_) => p22.Offset32);
    }
  };
  var GDEF = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.majorVersion = p22.uint16;
      this.minorVersion = p22.uint16;
      this.glyphClassDefOffset = p22.Offset16;
      lazy$1(this, `glyphClassDefs`, () => {
        if (this.glyphClassDefOffset === 0) return void 0;
        p22.currentPosition = this.tableStart + this.glyphClassDefOffset;
        return new ClassDefinition(p22);
      });
      this.attachListOffset = p22.Offset16;
      lazy$1(this, `attachList`, () => {
        if (this.attachListOffset === 0) return void 0;
        p22.currentPosition = this.tableStart + this.attachListOffset;
        return new AttachList(p22);
      });
      this.ligCaretListOffset = p22.Offset16;
      lazy$1(this, `ligCaretList`, () => {
        if (this.ligCaretListOffset === 0) return void 0;
        p22.currentPosition = this.tableStart + this.ligCaretListOffset;
        return new LigCaretList(p22);
      });
      this.markAttachClassDefOffset = p22.Offset16;
      lazy$1(this, `markAttachClassDef`, () => {
        if (this.markAttachClassDefOffset === 0) return void 0;
        p22.currentPosition = this.tableStart + this.markAttachClassDefOffset;
        return new ClassDefinition(p22);
      });
      if (this.minorVersion >= 2) {
        this.markGlyphSetsDefOffset = p22.Offset16;
        lazy$1(this, `markGlyphSetsDef`, () => {
          if (this.markGlyphSetsDefOffset === 0) return void 0;
          p22.currentPosition = this.tableStart + this.markGlyphSetsDefOffset;
          return new MarkGlyphSetsTable(p22);
        });
      }
      if (this.minorVersion === 3) {
        this.itemVarStoreOffset = p22.Offset32;
        lazy$1(this, `itemVarStore`, () => {
          if (this.itemVarStoreOffset === 0) return void 0;
          p22.currentPosition = this.tableStart + this.itemVarStoreOffset;
          return new ItemVariationStoreTable(p22);
        });
      }
    }
  };
  var AttachList = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.coverageOffset = p22.Offset16;
      this.glyphCount = p22.uint16;
      this.attachPointOffsets = [...new Array(this.glyphCount)].map(
        (_) => p22.Offset16
      );
    }
    getPoint(pointID) {
      this.parser.currentPosition = this.start + this.attachPointOffsets[pointID];
      return new AttachPoint(this.parser);
    }
  };
  var AttachPoint = class {
    constructor(p22) {
      this.pointCount = p22.uint16;
      this.pointIndices = [...new Array(this.pointCount)].map(
        (_) => p22.uint16
      );
    }
  };
  var LigCaretList = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.coverageOffset = p22.Offset16;
      lazy$1(this, `coverage`, () => {
        p22.currentPosition = this.start + this.coverageOffset;
        return new CoverageTable(p22);
      });
      this.ligGlyphCount = p22.uint16;
      this.ligGlyphOffsets = [...new Array(this.ligGlyphCount)].map(
        (_) => p22.Offset16
      );
    }
    getLigGlyph(ligGlyphID) {
      this.parser.currentPosition = this.start + this.ligGlyphOffsets[ligGlyphID];
      return new LigGlyph(this.parser);
    }
  };
  var LigGlyph = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.caretCount = p22.uint16;
      this.caretValueOffsets = [...new Array(this.caretCount)].map(
        (_) => p22.Offset16
      );
    }
    getCaretValue(caretID) {
      this.parser.currentPosition = this.start + this.caretValueOffsets[caretID];
      return new CaretValue(this.parser);
    }
  };
  var CaretValue = class {
    constructor(p22) {
      this.caretValueFormat = p22.uint16;
      if (this.caretValueFormat === 1) {
        this.coordinate = p22.int16;
      }
      if (this.caretValueFormat === 2) {
        this.caretValuePointIndex = p22.uint16;
      }
      if (this.caretValueFormat === 3) {
        this.coordinate = p22.int16;
        this.deviceOffset = p22.Offset16;
      }
    }
  };
  var MarkGlyphSetsTable = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.markGlyphSetTableFormat = p22.uint16;
      this.markGlyphSetCount = p22.uint16;
      this.coverageOffsets = [...new Array(this.markGlyphSetCount)].map(
        (_) => p22.Offset32
      );
    }
    getMarkGlyphSet(markGlyphSetID) {
      this.parser.currentPosition = this.start + this.coverageOffsets[markGlyphSetID];
      return new CoverageTable(this.parser);
    }
  };
  var GDEF$1 = Object.freeze({ __proto__: null, GDEF });
  var ScriptList = class extends ParsedData {
    static EMPTY = { scriptCount: 0, scriptRecords: [] };
    constructor(p22) {
      super(p22);
      this.scriptCount = p22.uint16;
      this.scriptRecords = [...new Array(this.scriptCount)].map(
        (_) => new ScriptRecord(p22)
      );
    }
  };
  var ScriptRecord = class {
    constructor(p22) {
      this.scriptTag = p22.tag;
      this.scriptOffset = p22.Offset16;
    }
  };
  var ScriptTable = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.defaultLangSys = p22.Offset16;
      this.langSysCount = p22.uint16;
      this.langSysRecords = [...new Array(this.langSysCount)].map(
        (_) => new LangSysRecord(p22)
      );
    }
  };
  var LangSysRecord = class {
    constructor(p22) {
      this.langSysTag = p22.tag;
      this.langSysOffset = p22.Offset16;
    }
  };
  var LangSysTable = class {
    constructor(p22) {
      this.lookupOrder = p22.Offset16;
      this.requiredFeatureIndex = p22.uint16;
      this.featureIndexCount = p22.uint16;
      this.featureIndices = [...new Array(this.featureIndexCount)].map(
        (_) => p22.uint16
      );
    }
  };
  var FeatureList = class extends ParsedData {
    static EMPTY = { featureCount: 0, featureRecords: [] };
    constructor(p22) {
      super(p22);
      this.featureCount = p22.uint16;
      this.featureRecords = [...new Array(this.featureCount)].map(
        (_) => new FeatureRecord(p22)
      );
    }
  };
  var FeatureRecord = class {
    constructor(p22) {
      this.featureTag = p22.tag;
      this.featureOffset = p22.Offset16;
    }
  };
  var FeatureTable = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.featureParams = p22.Offset16;
      this.lookupIndexCount = p22.uint16;
      this.lookupListIndices = [...new Array(this.lookupIndexCount)].map(
        (_) => p22.uint16
      );
    }
    getFeatureParams() {
      if (this.featureParams > 0) {
        const p22 = this.parser;
        p22.currentPosition = this.start + this.featureParams;
        const tag = this.featureTag;
        if (tag === `size`) return new Size(p22);
        if (tag.startsWith(`cc`)) return new CharacterVariant(p22);
        if (tag.startsWith(`ss`)) return new StylisticSet(p22);
      }
    }
  };
  var CharacterVariant = class {
    constructor(p22) {
      this.format = p22.uint16;
      this.featUiLabelNameId = p22.uint16;
      this.featUiTooltipTextNameId = p22.uint16;
      this.sampleTextNameId = p22.uint16;
      this.numNamedParameters = p22.uint16;
      this.firstParamUiLabelNameId = p22.uint16;
      this.charCount = p22.uint16;
      this.character = [...new Array(this.charCount)].map(
        (_) => p22.uint24
      );
    }
  };
  var Size = class {
    constructor(p22) {
      this.designSize = p22.uint16;
      this.subfamilyIdentifier = p22.uint16;
      this.subfamilyNameID = p22.uint16;
      this.smallEnd = p22.uint16;
      this.largeEnd = p22.uint16;
    }
  };
  var StylisticSet = class {
    constructor(p22) {
      this.version = p22.uint16;
      this.UINameID = p22.uint16;
    }
  };
  function undoCoverageOffsetParsing(instance) {
    instance.parser.currentPosition -= 2;
    delete instance.coverageOffset;
    delete instance.getCoverageTable;
  }
  var LookupType$1 = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.substFormat = p22.uint16;
      this.coverageOffset = p22.Offset16;
    }
    getCoverageTable() {
      let p22 = this.parser;
      p22.currentPosition = this.start + this.coverageOffset;
      return new CoverageTable(p22);
    }
  };
  var SubstLookupRecord = class {
    constructor(p22) {
      this.glyphSequenceIndex = p22.uint16;
      this.lookupListIndex = p22.uint16;
    }
  };
  var LookupType1$1 = class extends LookupType$1 {
    constructor(p22) {
      super(p22);
      this.deltaGlyphID = p22.int16;
    }
  };
  var LookupType2$1 = class extends LookupType$1 {
    constructor(p22) {
      super(p22);
      this.sequenceCount = p22.uint16;
      this.sequenceOffsets = [...new Array(this.sequenceCount)].map(
        (_) => p22.Offset16
      );
    }
    getSequence(index2) {
      let p22 = this.parser;
      p22.currentPosition = this.start + this.sequenceOffsets[index2];
      return new SequenceTable(p22);
    }
  };
  var SequenceTable = class {
    constructor(p22) {
      this.glyphCount = p22.uint16;
      this.substituteGlyphIDs = [...new Array(this.glyphCount)].map(
        (_) => p22.uint16
      );
    }
  };
  var LookupType3$1 = class extends LookupType$1 {
    constructor(p22) {
      super(p22);
      this.alternateSetCount = p22.uint16;
      this.alternateSetOffsets = [
        ...new Array(this.alternateSetCount)
      ].map((_) => p22.Offset16);
    }
    getAlternateSet(index2) {
      let p22 = this.parser;
      p22.currentPosition = this.start + this.alternateSetOffsets[index2];
      return new AlternateSetTable(p22);
    }
  };
  var AlternateSetTable = class {
    constructor(p22) {
      this.glyphCount = p22.uint16;
      this.alternateGlyphIDs = [...new Array(this.glyphCount)].map(
        (_) => p22.uint16
      );
    }
  };
  var LookupType4$1 = class extends LookupType$1 {
    constructor(p22) {
      super(p22);
      this.ligatureSetCount = p22.uint16;
      this.ligatureSetOffsets = [...new Array(this.ligatureSetCount)].map(
        (_) => p22.Offset16
      );
    }
    getLigatureSet(index2) {
      let p22 = this.parser;
      p22.currentPosition = this.start + this.ligatureSetOffsets[index2];
      return new LigatureSetTable(p22);
    }
  };
  var LigatureSetTable = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.ligatureCount = p22.uint16;
      this.ligatureOffsets = [...new Array(this.ligatureCount)].map(
        (_) => p22.Offset16
      );
    }
    getLigature(index2) {
      let p22 = this.parser;
      p22.currentPosition = this.start + this.ligatureOffsets[index2];
      return new LigatureTable(p22);
    }
  };
  var LigatureTable = class {
    constructor(p22) {
      this.ligatureGlyph = p22.uint16;
      this.componentCount = p22.uint16;
      this.componentGlyphIDs = [
        ...new Array(this.componentCount - 1)
      ].map((_) => p22.uint16);
    }
  };
  var LookupType5$1 = class extends LookupType$1 {
    constructor(p22) {
      super(p22);
      if (this.substFormat === 1) {
        this.subRuleSetCount = p22.uint16;
        this.subRuleSetOffsets = [
          ...new Array(this.subRuleSetCount)
        ].map((_) => p22.Offset16);
      }
      if (this.substFormat === 2) {
        this.classDefOffset = p22.Offset16;
        this.subClassSetCount = p22.uint16;
        this.subClassSetOffsets = [
          ...new Array(this.subClassSetCount)
        ].map((_) => p22.Offset16);
      }
      if (this.substFormat === 3) {
        undoCoverageOffsetParsing(this);
        this.glyphCount = p22.uint16;
        this.substitutionCount = p22.uint16;
        this.coverageOffsets = [...new Array(this.glyphCount)].map(
          (_) => p22.Offset16
        );
        this.substLookupRecords = [
          ...new Array(this.substitutionCount)
        ].map((_) => new SubstLookupRecord(p22));
      }
    }
    getSubRuleSet(index2) {
      if (this.substFormat !== 1)
        throw new Error(
          `lookup type 5.${this.substFormat} has no subrule sets.`
        );
      let p22 = this.parser;
      p22.currentPosition = this.start + this.subRuleSetOffsets[index2];
      return new SubRuleSetTable(p22);
    }
    getSubClassSet(index2) {
      if (this.substFormat !== 2)
        throw new Error(
          `lookup type 5.${this.substFormat} has no subclass sets.`
        );
      let p22 = this.parser;
      p22.currentPosition = this.start + this.subClassSetOffsets[index2];
      return new SubClassSetTable(p22);
    }
    getCoverageTable(index2) {
      if (this.substFormat !== 3 && !index2)
        return super.getCoverageTable();
      if (!index2)
        throw new Error(
          `lookup type 5.${this.substFormat} requires an coverage table index.`
        );
      let p22 = this.parser;
      p22.currentPosition = this.start + this.coverageOffsets[index2];
      return new CoverageTable(p22);
    }
  };
  var SubRuleSetTable = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.subRuleCount = p22.uint16;
      this.subRuleOffsets = [...new Array(this.subRuleCount)].map(
        (_) => p22.Offset16
      );
    }
    getSubRule(index2) {
      let p22 = this.parser;
      p22.currentPosition = this.start + this.subRuleOffsets[index2];
      return new SubRuleTable(p22);
    }
  };
  var SubRuleTable = class {
    constructor(p22) {
      this.glyphCount = p22.uint16;
      this.substitutionCount = p22.uint16;
      this.inputSequence = [...new Array(this.glyphCount - 1)].map(
        (_) => p22.uint16
      );
      this.substLookupRecords = [
        ...new Array(this.substitutionCount)
      ].map((_) => new SubstLookupRecord(p22));
    }
  };
  var SubClassSetTable = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.subClassRuleCount = p22.uint16;
      this.subClassRuleOffsets = [
        ...new Array(this.subClassRuleCount)
      ].map((_) => p22.Offset16);
    }
    getSubClass(index2) {
      let p22 = this.parser;
      p22.currentPosition = this.start + this.subClassRuleOffsets[index2];
      return new SubClassRuleTable(p22);
    }
  };
  var SubClassRuleTable = class extends SubRuleTable {
    constructor(p22) {
      super(p22);
    }
  };
  var LookupType6$1 = class extends LookupType$1 {
    constructor(p22) {
      super(p22);
      if (this.substFormat === 1) {
        this.chainSubRuleSetCount = p22.uint16;
        this.chainSubRuleSetOffsets = [
          ...new Array(this.chainSubRuleSetCount)
        ].map((_) => p22.Offset16);
      }
      if (this.substFormat === 2) {
        this.backtrackClassDefOffset = p22.Offset16;
        this.inputClassDefOffset = p22.Offset16;
        this.lookaheadClassDefOffset = p22.Offset16;
        this.chainSubClassSetCount = p22.uint16;
        this.chainSubClassSetOffsets = [
          ...new Array(this.chainSubClassSetCount)
        ].map((_) => p22.Offset16);
      }
      if (this.substFormat === 3) {
        undoCoverageOffsetParsing(this);
        this.backtrackGlyphCount = p22.uint16;
        this.backtrackCoverageOffsets = [
          ...new Array(this.backtrackGlyphCount)
        ].map((_) => p22.Offset16);
        this.inputGlyphCount = p22.uint16;
        this.inputCoverageOffsets = [
          ...new Array(this.inputGlyphCount)
        ].map((_) => p22.Offset16);
        this.lookaheadGlyphCount = p22.uint16;
        this.lookaheadCoverageOffsets = [
          ...new Array(this.lookaheadGlyphCount)
        ].map((_) => p22.Offset16);
        this.seqLookupCount = p22.uint16;
        this.seqLookupRecords = [
          ...new Array(this.substitutionCount)
        ].map((_) => new SequenceLookupRecord(p22));
      }
    }
    getChainSubRuleSet(index2) {
      if (this.substFormat !== 1)
        throw new Error(
          `lookup type 6.${this.substFormat} has no chainsubrule sets.`
        );
      let p22 = this.parser;
      p22.currentPosition = this.start + this.chainSubRuleSetOffsets[index2];
      return new ChainSubRuleSetTable(p22);
    }
    getChainSubClassSet(index2) {
      if (this.substFormat !== 2)
        throw new Error(
          `lookup type 6.${this.substFormat} has no chainsubclass sets.`
        );
      let p22 = this.parser;
      p22.currentPosition = this.start + this.chainSubClassSetOffsets[index2];
      return new ChainSubClassSetTable(p22);
    }
    getCoverageFromOffset(offset3) {
      if (this.substFormat !== 3)
        throw new Error(
          `lookup type 6.${this.substFormat} does not use contextual coverage offsets.`
        );
      let p22 = this.parser;
      p22.currentPosition = this.start + offset3;
      return new CoverageTable(p22);
    }
  };
  var ChainSubRuleSetTable = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.chainSubRuleCount = p22.uint16;
      this.chainSubRuleOffsets = [
        ...new Array(this.chainSubRuleCount)
      ].map((_) => p22.Offset16);
    }
    getSubRule(index2) {
      let p22 = this.parser;
      p22.currentPosition = this.start + this.chainSubRuleOffsets[index2];
      return new ChainSubRuleTable(p22);
    }
  };
  var ChainSubRuleTable = class {
    constructor(p22) {
      this.backtrackGlyphCount = p22.uint16;
      this.backtrackSequence = [
        ...new Array(this.backtrackGlyphCount)
      ].map((_) => p22.uint16);
      this.inputGlyphCount = p22.uint16;
      this.inputSequence = [...new Array(this.inputGlyphCount - 1)].map(
        (_) => p22.uint16
      );
      this.lookaheadGlyphCount = p22.uint16;
      this.lookAheadSequence = [
        ...new Array(this.lookAheadGlyphCount)
      ].map((_) => p22.uint16);
      this.substitutionCount = p22.uint16;
      this.substLookupRecords = [...new Array(this.SubstCount)].map(
        (_) => new SubstLookupRecord(p22)
      );
    }
  };
  var ChainSubClassSetTable = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.chainSubClassRuleCount = p22.uint16;
      this.chainSubClassRuleOffsets = [
        ...new Array(this.chainSubClassRuleCount)
      ].map((_) => p22.Offset16);
    }
    getSubClass(index2) {
      let p22 = this.parser;
      p22.currentPosition = this.start + this.chainSubRuleOffsets[index2];
      return new ChainSubClassRuleTable(p22);
    }
  };
  var ChainSubClassRuleTable = class {
    constructor(p22) {
      this.backtrackGlyphCount = p22.uint16;
      this.backtrackSequence = [
        ...new Array(this.backtrackGlyphCount)
      ].map((_) => p22.uint16);
      this.inputGlyphCount = p22.uint16;
      this.inputSequence = [...new Array(this.inputGlyphCount - 1)].map(
        (_) => p22.uint16
      );
      this.lookaheadGlyphCount = p22.uint16;
      this.lookAheadSequence = [
        ...new Array(this.lookAheadGlyphCount)
      ].map((_) => p22.uint16);
      this.substitutionCount = p22.uint16;
      this.substLookupRecords = [
        ...new Array(this.substitutionCount)
      ].map((_) => new SequenceLookupRecord(p22));
    }
  };
  var SequenceLookupRecord = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.sequenceIndex = p22.uint16;
      this.lookupListIndex = p22.uint16;
    }
  };
  var LookupType7$1 = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.substFormat = p22.uint16;
      this.extensionLookupType = p22.uint16;
      this.extensionOffset = p22.Offset32;
    }
  };
  var LookupType8$1 = class extends LookupType$1 {
    constructor(p22) {
      super(p22);
      this.backtrackGlyphCount = p22.uint16;
      this.backtrackCoverageOffsets = [
        ...new Array(this.backtrackGlyphCount)
      ].map((_) => p22.Offset16);
      this.lookaheadGlyphCount = p22.uint16;
      this.lookaheadCoverageOffsets = [
        new Array(this.lookaheadGlyphCount)
      ].map((_) => p22.Offset16);
      this.glyphCount = p22.uint16;
      this.substituteGlyphIDs = [...new Array(this.glyphCount)].map(
        (_) => p22.uint16
      );
    }
  };
  var GSUBtables = {
    buildSubtable: function(type, p22) {
      const subtable = new [
        void 0,
        LookupType1$1,
        LookupType2$1,
        LookupType3$1,
        LookupType4$1,
        LookupType5$1,
        LookupType6$1,
        LookupType7$1,
        LookupType8$1
      ][type](p22);
      subtable.type = type;
      return subtable;
    }
  };
  var LookupType = class extends ParsedData {
    constructor(p22) {
      super(p22);
    }
  };
  var LookupType1 = class extends LookupType {
    constructor(p22) {
      super(p22);
      console.log(`lookup type 1`);
    }
  };
  var LookupType2 = class extends LookupType {
    constructor(p22) {
      super(p22);
      console.log(`lookup type 2`);
    }
  };
  var LookupType3 = class extends LookupType {
    constructor(p22) {
      super(p22);
      console.log(`lookup type 3`);
    }
  };
  var LookupType4 = class extends LookupType {
    constructor(p22) {
      super(p22);
      console.log(`lookup type 4`);
    }
  };
  var LookupType5 = class extends LookupType {
    constructor(p22) {
      super(p22);
      console.log(`lookup type 5`);
    }
  };
  var LookupType6 = class extends LookupType {
    constructor(p22) {
      super(p22);
      console.log(`lookup type 6`);
    }
  };
  var LookupType7 = class extends LookupType {
    constructor(p22) {
      super(p22);
      console.log(`lookup type 7`);
    }
  };
  var LookupType8 = class extends LookupType {
    constructor(p22) {
      super(p22);
      console.log(`lookup type 8`);
    }
  };
  var LookupType9 = class extends LookupType {
    constructor(p22) {
      super(p22);
      console.log(`lookup type 9`);
    }
  };
  var GPOStables = {
    buildSubtable: function(type, p22) {
      const subtable = new [
        void 0,
        LookupType1,
        LookupType2,
        LookupType3,
        LookupType4,
        LookupType5,
        LookupType6,
        LookupType7,
        LookupType8,
        LookupType9
      ][type](p22);
      subtable.type = type;
      return subtable;
    }
  };
  var LookupList = class extends ParsedData {
    static EMPTY = { lookupCount: 0, lookups: [] };
    constructor(p22) {
      super(p22);
      this.lookupCount = p22.uint16;
      this.lookups = [...new Array(this.lookupCount)].map(
        (_) => p22.Offset16
      );
    }
  };
  var LookupTable = class extends ParsedData {
    constructor(p22, type) {
      super(p22);
      this.ctType = type;
      this.lookupType = p22.uint16;
      this.lookupFlag = p22.uint16;
      this.subTableCount = p22.uint16;
      this.subtableOffsets = [...new Array(this.subTableCount)].map(
        (_) => p22.Offset16
      );
      this.markFilteringSet = p22.uint16;
    }
    get rightToLeft() {
      return this.lookupFlag & true;
    }
    get ignoreBaseGlyphs() {
      return this.lookupFlag & true;
    }
    get ignoreLigatures() {
      return this.lookupFlag & true;
    }
    get ignoreMarks() {
      return this.lookupFlag & true;
    }
    get useMarkFilteringSet() {
      return this.lookupFlag & true;
    }
    get markAttachmentType() {
      return this.lookupFlag & true;
    }
    getSubTable(index2) {
      const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables;
      this.parser.currentPosition = this.start + this.subtableOffsets[index2];
      return builder.buildSubtable(this.lookupType, this.parser);
    }
  };
  var CommonLayoutTable = class extends SimpleTable {
    constructor(dict, dataview, name2) {
      const { p: p22, tableStart } = super(dict, dataview, name2);
      this.majorVersion = p22.uint16;
      this.minorVersion = p22.uint16;
      this.scriptListOffset = p22.Offset16;
      this.featureListOffset = p22.Offset16;
      this.lookupListOffset = p22.Offset16;
      if (this.majorVersion === 1 && this.minorVersion === 1) {
        this.featureVariationsOffset = p22.Offset32;
      }
      const no_content = !(this.scriptListOffset || this.featureListOffset || this.lookupListOffset);
      lazy$1(this, `scriptList`, () => {
        if (no_content) return ScriptList.EMPTY;
        p22.currentPosition = tableStart + this.scriptListOffset;
        return new ScriptList(p22);
      });
      lazy$1(this, `featureList`, () => {
        if (no_content) return FeatureList.EMPTY;
        p22.currentPosition = tableStart + this.featureListOffset;
        return new FeatureList(p22);
      });
      lazy$1(this, `lookupList`, () => {
        if (no_content) return LookupList.EMPTY;
        p22.currentPosition = tableStart + this.lookupListOffset;
        return new LookupList(p22);
      });
      if (this.featureVariationsOffset) {
        lazy$1(this, `featureVariations`, () => {
          if (no_content) return FeatureVariations.EMPTY;
          p22.currentPosition = tableStart + this.featureVariationsOffset;
          return new FeatureVariations(p22);
        });
      }
    }
    getSupportedScripts() {
      return this.scriptList.scriptRecords.map((r4) => r4.scriptTag);
    }
    getScriptTable(scriptTag) {
      let record = this.scriptList.scriptRecords.find(
        (r4) => r4.scriptTag === scriptTag
      );
      this.parser.currentPosition = this.scriptList.start + record.scriptOffset;
      let table = new ScriptTable(this.parser);
      table.scriptTag = scriptTag;
      return table;
    }
    ensureScriptTable(arg) {
      if (typeof arg === "string") {
        return this.getScriptTable(arg);
      }
      return arg;
    }
    getSupportedLangSys(scriptTable) {
      scriptTable = this.ensureScriptTable(scriptTable);
      const hasDefault = scriptTable.defaultLangSys !== 0;
      const supported = scriptTable.langSysRecords.map(
        (l3) => l3.langSysTag
      );
      if (hasDefault) supported.unshift(`dflt`);
      return supported;
    }
    getDefaultLangSysTable(scriptTable) {
      scriptTable = this.ensureScriptTable(scriptTable);
      let offset3 = scriptTable.defaultLangSys;
      if (offset3 !== 0) {
        this.parser.currentPosition = scriptTable.start + offset3;
        let table = new LangSysTable(this.parser);
        table.langSysTag = ``;
        table.defaultForScript = scriptTable.scriptTag;
        return table;
      }
    }
    getLangSysTable(scriptTable, langSysTag = `dflt`) {
      if (langSysTag === `dflt`)
        return this.getDefaultLangSysTable(scriptTable);
      scriptTable = this.ensureScriptTable(scriptTable);
      let record = scriptTable.langSysRecords.find(
        (l3) => l3.langSysTag === langSysTag
      );
      this.parser.currentPosition = scriptTable.start + record.langSysOffset;
      let table = new LangSysTable(this.parser);
      table.langSysTag = langSysTag;
      return table;
    }
    getFeatures(langSysTable) {
      return langSysTable.featureIndices.map(
        (index2) => this.getFeature(index2)
      );
    }
    getFeature(indexOrTag) {
      let record;
      if (parseInt(indexOrTag) == indexOrTag) {
        record = this.featureList.featureRecords[indexOrTag];
      } else {
        record = this.featureList.featureRecords.find(
          (f3) => f3.featureTag === indexOrTag
        );
      }
      if (!record) return;
      this.parser.currentPosition = this.featureList.start + record.featureOffset;
      let table = new FeatureTable(this.parser);
      table.featureTag = record.featureTag;
      return table;
    }
    getLookups(featureTable) {
      return featureTable.lookupListIndices.map(
        (index2) => this.getLookup(index2)
      );
    }
    getLookup(lookupIndex, type) {
      let lookupOffset = this.lookupList.lookups[lookupIndex];
      this.parser.currentPosition = this.lookupList.start + lookupOffset;
      return new LookupTable(this.parser, type);
    }
  };
  var GSUB = class extends CommonLayoutTable {
    constructor(dict, dataview) {
      super(dict, dataview, `GSUB`);
    }
    getLookup(lookupIndex) {
      return super.getLookup(lookupIndex, `GSUB`);
    }
  };
  var GSUB$1 = Object.freeze({ __proto__: null, GSUB });
  var GPOS = class extends CommonLayoutTable {
    constructor(dict, dataview) {
      super(dict, dataview, `GPOS`);
    }
    getLookup(lookupIndex) {
      return super.getLookup(lookupIndex, `GPOS`);
    }
  };
  var GPOS$1 = Object.freeze({ __proto__: null, GPOS });
  var SVG70 = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint16;
      this.offsetToSVGDocumentList = p22.Offset32;
      p22.currentPosition = this.tableStart + this.offsetToSVGDocumentList;
      this.documentList = new SVGDocumentList(p22);
    }
  };
  var SVGDocumentList = class extends ParsedData {
    constructor(p22) {
      super(p22);
      this.numEntries = p22.uint16;
      this.documentRecords = [...new Array(this.numEntries)].map(
        (_) => new SVGDocumentRecord(p22)
      );
    }
    getDocument(documentID) {
      let record = this.documentRecords[documentID];
      if (!record) return "";
      let offset3 = this.start + record.svgDocOffset;
      this.parser.currentPosition = offset3;
      return this.parser.readBytes(record.svgDocLength);
    }
    getDocumentForGlyph(glyphID) {
      let id = this.documentRecords.findIndex(
        (d3) => d3.startGlyphID <= glyphID && glyphID <= d3.endGlyphID
      );
      if (id === -1) return "";
      return this.getDocument(id);
    }
  };
  var SVGDocumentRecord = class {
    constructor(p22) {
      this.startGlyphID = p22.uint16;
      this.endGlyphID = p22.uint16;
      this.svgDocOffset = p22.Offset32;
      this.svgDocLength = p22.uint32;
    }
  };
  var SVG$1 = Object.freeze({ __proto__: null, SVG: SVG70 });
  var fvar = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.majorVersion = p22.uint16;
      this.minorVersion = p22.uint16;
      this.axesArrayOffset = p22.Offset16;
      p22.uint16;
      this.axisCount = p22.uint16;
      this.axisSize = p22.uint16;
      this.instanceCount = p22.uint16;
      this.instanceSize = p22.uint16;
      const axisStart = this.tableStart + this.axesArrayOffset;
      lazy$1(this, `axes`, () => {
        p22.currentPosition = axisStart;
        return [...new Array(this.axisCount)].map(
          (_) => new VariationAxisRecord(p22)
        );
      });
      const instanceStart = axisStart + this.axisCount * this.axisSize;
      lazy$1(this, `instances`, () => {
        let instances = [];
        for (let i3 = 0; i3 < this.instanceCount; i3++) {
          p22.currentPosition = instanceStart + i3 * this.instanceSize;
          instances.push(
            new InstanceRecord(p22, this.axisCount, this.instanceSize)
          );
        }
        return instances;
      });
    }
    getSupportedAxes() {
      return this.axes.map((a3) => a3.tag);
    }
    getAxis(name2) {
      return this.axes.find((a3) => a3.tag === name2);
    }
  };
  var VariationAxisRecord = class {
    constructor(p22) {
      this.tag = p22.tag;
      this.minValue = p22.fixed;
      this.defaultValue = p22.fixed;
      this.maxValue = p22.fixed;
      this.flags = p22.flags(16);
      this.axisNameID = p22.uint16;
    }
  };
  var InstanceRecord = class {
    constructor(p22, axisCount, size3) {
      let start = p22.currentPosition;
      this.subfamilyNameID = p22.uint16;
      p22.uint16;
      this.coordinates = [...new Array(axisCount)].map(
        (_) => p22.fixed
      );
      if (p22.currentPosition - start < size3) {
        this.postScriptNameID = p22.uint16;
      }
    }
  };
  var fvar$1 = Object.freeze({ __proto__: null, fvar });
  var cvt = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      const n3 = dict.length / 2;
      lazy$1(
        this,
        `items`,
        () => [...new Array(n3)].map((_) => p22.fword)
      );
    }
  };
  var cvt$1 = Object.freeze({ __proto__: null, cvt });
  var fpgm = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      lazy$1(
        this,
        `instructions`,
        () => [...new Array(dict.length)].map((_) => p22.uint8)
      );
    }
  };
  var fpgm$1 = Object.freeze({ __proto__: null, fpgm });
  var gasp = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint16;
      this.numRanges = p22.uint16;
      const getter = () => [...new Array(this.numRanges)].map(
        (_) => new GASPRange(p22)
      );
      lazy$1(this, `gaspRanges`, getter);
    }
  };
  var GASPRange = class {
    constructor(p22) {
      this.rangeMaxPPEM = p22.uint16;
      this.rangeGaspBehavior = p22.uint16;
    }
  };
  var gasp$1 = Object.freeze({ __proto__: null, gasp });
  var glyf = class extends SimpleTable {
    constructor(dict, dataview) {
      super(dict, dataview);
    }
    getGlyphData(offset3, length) {
      this.parser.currentPosition = this.tableStart + offset3;
      return this.parser.readBytes(length);
    }
  };
  var glyf$1 = Object.freeze({ __proto__: null, glyf });
  var loca = class extends SimpleTable {
    constructor(dict, dataview, tables) {
      const { p: p22 } = super(dict, dataview);
      const n3 = tables.maxp.numGlyphs + 1;
      if (tables.head.indexToLocFormat === 0) {
        this.x2 = true;
        lazy$1(
          this,
          `offsets`,
          () => [...new Array(n3)].map((_) => p22.Offset16)
        );
      } else {
        lazy$1(
          this,
          `offsets`,
          () => [...new Array(n3)].map((_) => p22.Offset32)
        );
      }
    }
    getGlyphDataOffsetAndLength(glyphID) {
      let offset3 = this.offsets[glyphID] * this.x2 ? 2 : 1;
      let nextOffset = this.offsets[glyphID + 1] * this.x2 ? 2 : 1;
      return { offset: offset3, length: nextOffset - offset3 };
    }
  };
  var loca$1 = Object.freeze({ __proto__: null, loca });
  var prep = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      lazy$1(
        this,
        `instructions`,
        () => [...new Array(dict.length)].map((_) => p22.uint8)
      );
    }
  };
  var prep$1 = Object.freeze({ __proto__: null, prep });
  var CFF = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      lazy$1(this, `data`, () => p22.readBytes());
    }
  };
  var CFF$1 = Object.freeze({ __proto__: null, CFF });
  var CFF2 = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      lazy$1(this, `data`, () => p22.readBytes());
    }
  };
  var CFF2$1 = Object.freeze({ __proto__: null, CFF2 });
  var VORG = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.majorVersion = p22.uint16;
      this.minorVersion = p22.uint16;
      this.defaultVertOriginY = p22.int16;
      this.numVertOriginYMetrics = p22.uint16;
      lazy$1(
        this,
        `vertORiginYMetrics`,
        () => [...new Array(this.numVertOriginYMetrics)].map(
          (_) => new VertOriginYMetric(p22)
        )
      );
    }
  };
  var VertOriginYMetric = class {
    constructor(p22) {
      this.glyphIndex = p22.uint16;
      this.vertOriginY = p22.int16;
    }
  };
  var VORG$1 = Object.freeze({ __proto__: null, VORG });
  var BitmapSize = class {
    constructor(p22) {
      this.indexSubTableArrayOffset = p22.Offset32;
      this.indexTablesSize = p22.uint32;
      this.numberofIndexSubTables = p22.uint32;
      this.colorRef = p22.uint32;
      this.hori = new SbitLineMetrics(p22);
      this.vert = new SbitLineMetrics(p22);
      this.startGlyphIndex = p22.uint16;
      this.endGlyphIndex = p22.uint16;
      this.ppemX = p22.uint8;
      this.ppemY = p22.uint8;
      this.bitDepth = p22.uint8;
      this.flags = p22.int8;
    }
  };
  var BitmapScale = class {
    constructor(p22) {
      this.hori = new SbitLineMetrics(p22);
      this.vert = new SbitLineMetrics(p22);
      this.ppemX = p22.uint8;
      this.ppemY = p22.uint8;
      this.substitutePpemX = p22.uint8;
      this.substitutePpemY = p22.uint8;
    }
  };
  var SbitLineMetrics = class {
    constructor(p22) {
      this.ascender = p22.int8;
      this.descender = p22.int8;
      this.widthMax = p22.uint8;
      this.caretSlopeNumerator = p22.int8;
      this.caretSlopeDenominator = p22.int8;
      this.caretOffset = p22.int8;
      this.minOriginSB = p22.int8;
      this.minAdvanceSB = p22.int8;
      this.maxBeforeBL = p22.int8;
      this.minAfterBL = p22.int8;
      this.pad1 = p22.int8;
      this.pad2 = p22.int8;
    }
  };
  var EBLC = class extends SimpleTable {
    constructor(dict, dataview, name2) {
      const { p: p22 } = super(dict, dataview, name2);
      this.majorVersion = p22.uint16;
      this.minorVersion = p22.uint16;
      this.numSizes = p22.uint32;
      lazy$1(
        this,
        `bitMapSizes`,
        () => [...new Array(this.numSizes)].map(
          (_) => new BitmapSize(p22)
        )
      );
    }
  };
  var EBLC$1 = Object.freeze({ __proto__: null, EBLC });
  var EBDT = class extends SimpleTable {
    constructor(dict, dataview, name2) {
      const { p: p22 } = super(dict, dataview, name2);
      this.majorVersion = p22.uint16;
      this.minorVersion = p22.uint16;
    }
  };
  var EBDT$1 = Object.freeze({ __proto__: null, EBDT });
  var EBSC = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.majorVersion = p22.uint16;
      this.minorVersion = p22.uint16;
      this.numSizes = p22.uint32;
      lazy$1(
        this,
        `bitmapScales`,
        () => [...new Array(this.numSizes)].map(
          (_) => new BitmapScale(p22)
        )
      );
    }
  };
  var EBSC$1 = Object.freeze({ __proto__: null, EBSC });
  var CBLC = class extends EBLC {
    constructor(dict, dataview) {
      super(dict, dataview, `CBLC`);
    }
  };
  var CBLC$1 = Object.freeze({ __proto__: null, CBLC });
  var CBDT = class extends EBDT {
    constructor(dict, dataview) {
      super(dict, dataview, `CBDT`);
    }
  };
  var CBDT$1 = Object.freeze({ __proto__: null, CBDT });
  var sbix = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint16;
      this.flags = p22.flags(16);
      this.numStrikes = p22.uint32;
      lazy$1(
        this,
        `strikeOffsets`,
        () => [...new Array(this.numStrikes)].map((_) => p22.Offset32)
      );
    }
  };
  var sbix$1 = Object.freeze({ __proto__: null, sbix });
  var COLR = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint16;
      this.numBaseGlyphRecords = p22.uint16;
      this.baseGlyphRecordsOffset = p22.Offset32;
      this.layerRecordsOffset = p22.Offset32;
      this.numLayerRecords = p22.uint16;
    }
    getBaseGlyphRecord(glyphID) {
      let start = this.tableStart + this.baseGlyphRecordsOffset;
      this.parser.currentPosition = start;
      let first = new BaseGlyphRecord(this.parser);
      let firstID = first.gID;
      let end = this.tableStart + this.layerRecordsOffset - 6;
      this.parser.currentPosition = end;
      let last = new BaseGlyphRecord(this.parser);
      let lastID = last.gID;
      if (firstID === glyphID) return first;
      if (lastID === glyphID) return last;
      while (true) {
        if (start === end) break;
        let mid = start + (end - start) / 12;
        this.parser.currentPosition = mid;
        let middle = new BaseGlyphRecord(this.parser);
        let midID = middle.gID;
        if (midID === glyphID) return middle;
        else if (midID > glyphID) {
          end = mid;
        } else if (midID < glyphID) {
          start = mid;
        }
      }
      return false;
    }
    getLayers(glyphID) {
      let record = this.getBaseGlyphRecord(glyphID);
      this.parser.currentPosition = this.tableStart + this.layerRecordsOffset + 4 * record.firstLayerIndex;
      return [...new Array(record.numLayers)].map(
        (_) => new LayerRecord(p)
      );
    }
  };
  var BaseGlyphRecord = class {
    constructor(p22) {
      this.gID = p22.uint16;
      this.firstLayerIndex = p22.uint16;
      this.numLayers = p22.uint16;
    }
  };
  var LayerRecord = class {
    constructor(p22) {
      this.gID = p22.uint16;
      this.paletteIndex = p22.uint16;
    }
  };
  var COLR$1 = Object.freeze({ __proto__: null, COLR });
  var CPAL = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint16;
      this.numPaletteEntries = p22.uint16;
      const numPalettes = this.numPalettes = p22.uint16;
      this.numColorRecords = p22.uint16;
      this.offsetFirstColorRecord = p22.Offset32;
      this.colorRecordIndices = [...new Array(this.numPalettes)].map(
        (_) => p22.uint16
      );
      lazy$1(this, `colorRecords`, () => {
        p22.currentPosition = this.tableStart + this.offsetFirstColorRecord;
        return [...new Array(this.numColorRecords)].map(
          (_) => new ColorRecord(p22)
        );
      });
      if (this.version === 1) {
        this.offsetPaletteTypeArray = p22.Offset32;
        this.offsetPaletteLabelArray = p22.Offset32;
        this.offsetPaletteEntryLabelArray = p22.Offset32;
        lazy$1(this, `paletteTypeArray`, () => {
          p22.currentPosition = this.tableStart + this.offsetPaletteTypeArray;
          return new PaletteTypeArray(p22, numPalettes);
        });
        lazy$1(this, `paletteLabelArray`, () => {
          p22.currentPosition = this.tableStart + this.offsetPaletteLabelArray;
          return new PaletteLabelsArray(p22, numPalettes);
        });
        lazy$1(this, `paletteEntryLabelArray`, () => {
          p22.currentPosition = this.tableStart + this.offsetPaletteEntryLabelArray;
          return new PaletteEntryLabelArray(p22, numPalettes);
        });
      }
    }
  };
  var ColorRecord = class {
    constructor(p22) {
      this.blue = p22.uint8;
      this.green = p22.uint8;
      this.red = p22.uint8;
      this.alpha = p22.uint8;
    }
  };
  var PaletteTypeArray = class {
    constructor(p22, numPalettes) {
      this.paletteTypes = [...new Array(numPalettes)].map(
        (_) => p22.uint32
      );
    }
  };
  var PaletteLabelsArray = class {
    constructor(p22, numPalettes) {
      this.paletteLabels = [...new Array(numPalettes)].map(
        (_) => p22.uint16
      );
    }
  };
  var PaletteEntryLabelArray = class {
    constructor(p22, numPalettes) {
      this.paletteEntryLabels = [...new Array(numPalettes)].map(
        (_) => p22.uint16
      );
    }
  };
  var CPAL$1 = Object.freeze({ __proto__: null, CPAL });
  var DSIG = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint32;
      this.numSignatures = p22.uint16;
      this.flags = p22.uint16;
      this.signatureRecords = [...new Array(this.numSignatures)].map(
        (_) => new SignatureRecord(p22)
      );
    }
    getData(signatureID) {
      const record = this.signatureRecords[signatureID];
      this.parser.currentPosition = this.tableStart + record.offset;
      return new SignatureBlockFormat1(this.parser);
    }
  };
  var SignatureRecord = class {
    constructor(p22) {
      this.format = p22.uint32;
      this.length = p22.uint32;
      this.offset = p22.Offset32;
    }
  };
  var SignatureBlockFormat1 = class {
    constructor(p22) {
      p22.uint16;
      p22.uint16;
      this.signatureLength = p22.uint32;
      this.signature = p22.readBytes(this.signatureLength);
    }
  };
  var DSIG$1 = Object.freeze({ __proto__: null, DSIG });
  var hdmx = class extends SimpleTable {
    constructor(dict, dataview, tables) {
      const { p: p22 } = super(dict, dataview);
      const numGlyphs = tables.hmtx.numGlyphs;
      this.version = p22.uint16;
      this.numRecords = p22.int16;
      this.sizeDeviceRecord = p22.int32;
      this.records = [...new Array(numRecords)].map(
        (_) => new DeviceRecord(p22, numGlyphs)
      );
    }
  };
  var DeviceRecord = class {
    constructor(p22, numGlyphs) {
      this.pixelSize = p22.uint8;
      this.maxWidth = p22.uint8;
      this.widths = p22.readBytes(numGlyphs);
    }
  };
  var hdmx$1 = Object.freeze({ __proto__: null, hdmx });
  var kern = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint16;
      this.nTables = p22.uint16;
      lazy$1(this, `tables`, () => {
        let offset3 = this.tableStart + 4;
        const tables = [];
        for (let i3 = 0; i3 < this.nTables; i3++) {
          p22.currentPosition = offset3;
          let subtable = new KernSubTable(p22);
          tables.push(subtable);
          offset3 += subtable;
        }
        return tables;
      });
    }
  };
  var KernSubTable = class {
    constructor(p22) {
      this.version = p22.uint16;
      this.length = p22.uint16;
      this.coverage = p22.flags(8);
      this.format = p22.uint8;
      if (this.format === 0) {
        this.nPairs = p22.uint16;
        this.searchRange = p22.uint16;
        this.entrySelector = p22.uint16;
        this.rangeShift = p22.uint16;
        lazy$1(
          this,
          `pairs`,
          () => [...new Array(this.nPairs)].map((_) => new Pair(p22))
        );
      }
      if (this.format === 2) {
        console.warn(
          `Kern subtable format 2 is not supported: this parser currently only parses universal table data.`
        );
      }
    }
    get horizontal() {
      return this.coverage[0];
    }
    get minimum() {
      return this.coverage[1];
    }
    get crossstream() {
      return this.coverage[2];
    }
    get override() {
      return this.coverage[3];
    }
  };
  var Pair = class {
    constructor(p22) {
      this.left = p22.uint16;
      this.right = p22.uint16;
      this.value = p22.fword;
    }
  };
  var kern$1 = Object.freeze({ __proto__: null, kern });
  var LTSH = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint16;
      this.numGlyphs = p22.uint16;
      this.yPels = p22.readBytes(this.numGlyphs);
    }
  };
  var LTSH$1 = Object.freeze({ __proto__: null, LTSH });
  var MERG = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint16;
      this.mergeClassCount = p22.uint16;
      this.mergeDataOffset = p22.Offset16;
      this.classDefCount = p22.uint16;
      this.offsetToClassDefOffsets = p22.Offset16;
      lazy$1(
        this,
        `mergeEntryMatrix`,
        () => [...new Array(this.mergeClassCount)].map(
          (_) => p22.readBytes(this.mergeClassCount)
        )
      );
      console.warn(`Full MERG parsing is currently not supported.`);
      console.warn(
        `If you need this table parsed, please file an issue, or better yet, a PR.`
      );
    }
  };
  var MERG$1 = Object.freeze({ __proto__: null, MERG });
  var meta = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint32;
      this.flags = p22.uint32;
      p22.uint32;
      this.dataMapsCount = p22.uint32;
      this.dataMaps = [...new Array(this.dataMapsCount)].map(
        (_) => new DataMap(this.tableStart, p22)
      );
    }
  };
  var DataMap = class {
    constructor(tableStart, p22) {
      this.tableStart = tableStart;
      this.parser = p22;
      this.tag = p22.tag;
      this.dataOffset = p22.Offset32;
      this.dataLength = p22.uint32;
    }
    getData() {
      this.parser.currentField = this.tableStart + this.dataOffset;
      return this.parser.readBytes(this.dataLength);
    }
  };
  var meta$1 = Object.freeze({ __proto__: null, meta });
  var PCLT = class extends SimpleTable {
    constructor(dict, dataview) {
      super(dict, dataview);
      console.warn(
        `This font uses a PCLT table, which is currently not supported by this parser.`
      );
      console.warn(
        `If you need this table parsed, please file an issue, or better yet, a PR.`
      );
    }
  };
  var PCLT$1 = Object.freeze({ __proto__: null, PCLT });
  var VDMX = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.uint16;
      this.numRecs = p22.uint16;
      this.numRatios = p22.uint16;
      this.ratRanges = [...new Array(this.numRatios)].map(
        (_) => new RatioRange(p22)
      );
      this.offsets = [...new Array(this.numRatios)].map(
        (_) => p22.Offset16
      );
      this.VDMXGroups = [...new Array(this.numRecs)].map(
        (_) => new VDMXGroup(p22)
      );
    }
  };
  var RatioRange = class {
    constructor(p22) {
      this.bCharSet = p22.uint8;
      this.xRatio = p22.uint8;
      this.yStartRatio = p22.uint8;
      this.yEndRatio = p22.uint8;
    }
  };
  var VDMXGroup = class {
    constructor(p22) {
      this.recs = p22.uint16;
      this.startsz = p22.uint8;
      this.endsz = p22.uint8;
      this.records = [...new Array(this.recs)].map(
        (_) => new vTable(p22)
      );
    }
  };
  var vTable = class {
    constructor(p22) {
      this.yPelHeight = p22.uint16;
      this.yMax = p22.int16;
      this.yMin = p22.int16;
    }
  };
  var VDMX$1 = Object.freeze({ __proto__: null, VDMX });
  var vhea = class extends SimpleTable {
    constructor(dict, dataview) {
      const { p: p22 } = super(dict, dataview);
      this.version = p22.fixed;
      this.ascent = this.vertTypoAscender = p22.int16;
      this.descent = this.vertTypoDescender = p22.int16;
      this.lineGap = this.vertTypoLineGap = p22.int16;
      this.advanceHeightMax = p22.int16;
      this.minTopSideBearing = p22.int16;
      this.minBottomSideBearing = p22.int16;
      this.yMaxExtent = p22.int16;
      this.caretSlopeRise = p22.int16;
      this.caretSlopeRun = p22.int16;
      this.caretOffset = p22.int16;
      this.reserved = p22.int16;
      this.reserved = p22.int16;
      this.reserved = p22.int16;
      this.reserved = p22.int16;
      this.metricDataFormat = p22.int16;
      this.numOfLongVerMetrics = p22.uint16;
      p22.verifyLength();
    }
  };
  var vhea$1 = Object.freeze({ __proto__: null, vhea });
  var vmtx = class extends SimpleTable {
    constructor(dict, dataview, tables) {
      super(dict, dataview);
      const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics;
      const numGlyphs = tables.maxp.numGlyphs;
      const metricsStart = p.currentPosition;
      lazy(this, `vMetrics`, () => {
        p.currentPosition = metricsStart;
        return [...new Array(numOfLongVerMetrics)].map(
          (_) => new LongVertMetric(p.uint16, p.int16)
        );
      });
      if (numOfLongVerMetrics < numGlyphs) {
        const tsbStart = metricsStart + numOfLongVerMetrics * 4;
        lazy(this, `topSideBearings`, () => {
          p.currentPosition = tsbStart;
          return [...new Array(numGlyphs - numOfLongVerMetrics)].map(
            (_) => p.int16
          );
        });
      }
    }
  };
  var LongVertMetric = class {
    constructor(h3, b3) {
      this.advanceHeight = h3;
      this.topSideBearing = b3;
    }
  };
  var vmtx$1 = Object.freeze({ __proto__: null, vmtx });

  // packages/global-styles-ui/build-module/font-library/utils/make-families-from-faces.mjs
  var import_components57 = __toESM(require_components(), 1);
  var { kebabCase: kebabCase3 } = unlock3(import_components57.privateApis);
  function makeFamiliesFromFaces(fontFaces) {
    const fontFamiliesObject = fontFaces.reduce(
      (acc, item) => {
        if (!acc[item.fontFamily]) {
          acc[item.fontFamily] = {
            name: item.fontFamily,
            fontFamily: item.fontFamily,
            slug: kebabCase3(item.fontFamily.toLowerCase()),
            fontFace: []
          };
        }
        acc[item.fontFamily].fontFace.push(item);
        return acc;
      },
      {}
    );
    return Object.values(fontFamiliesObject);
  }

  // packages/global-styles-ui/build-module/font-library/upload-fonts.mjs
  var import_jsx_runtime143 = __toESM(require_jsx_runtime(), 1);
  function UploadFonts() {
    const { installFonts } = (0, import_element53.useContext)(FontLibraryContext);
    const [isUploading, setIsUploading] = (0, import_element53.useState)(false);
    const [notice, setNotice] = (0, import_element53.useState)(null);
    const handleDropZone = (files) => {
      handleFilesUpload(files);
    };
    const onFilesUpload = (event) => {
      handleFilesUpload(event.target.files);
    };
    const handleFilesUpload = async (files) => {
      if (!files) {
        return;
      }
      setNotice(null);
      setIsUploading(true);
      const uniqueFilenames = /* @__PURE__ */ new Set();
      const selectedFiles = [...files];
      let hasInvalidFiles = false;
      const checkFilesPromises = selectedFiles.map(async (file) => {
        const isFont = await isFontFile(file);
        if (!isFont) {
          hasInvalidFiles = true;
          return null;
        }
        if (uniqueFilenames.has(file.name)) {
          return null;
        }
        const fileExtension = (((file.name ?? "").split(".") ?? []).pop() ?? "").toLowerCase();
        if (ALLOWED_FILE_EXTENSIONS.includes(fileExtension)) {
          uniqueFilenames.add(file.name);
          return file;
        }
        return null;
      });
      const allowedFiles = (await Promise.all(checkFilesPromises)).filter((file) => null !== file);
      if (allowedFiles.length > 0) {
        loadFiles(allowedFiles);
      } else {
        const message = hasInvalidFiles ? (0, import_i18n76.__)("Sorry, you are not allowed to upload this file type.") : (0, import_i18n76.__)("No fonts found to install.");
        setNotice({
          type: "error",
          message
        });
        setIsUploading(false);
      }
    };
    const loadFiles = async (files) => {
      const fontFacesLoaded = await Promise.all(
        files.map(async (fontFile) => {
          const fontFaceData = await getFontFaceMetadata(fontFile);
          await loadFontFaceInBrowser(
            fontFaceData,
            fontFaceData.file,
            "all"
          );
          return fontFaceData;
        })
      );
      handleInstall(fontFacesLoaded);
    };
    async function isFontFile(file) {
      const font2 = new Font("Uploaded Font");
      try {
        const buffer = await readFileAsArrayBuffer(file);
        await font2.fromDataBuffer(buffer, "font");
        return true;
      } catch (error) {
        return false;
      }
    }
    async function readFileAsArrayBuffer(file) {
      return new Promise((resolve, reject) => {
        const reader = new window.FileReader();
        reader.readAsArrayBuffer(file);
        reader.onload = () => resolve(reader.result);
        reader.onerror = reject;
      });
    }
    const getFontFaceMetadata = async (fontFile) => {
      const buffer = await readFileAsArrayBuffer(fontFile);
      const fontObj = new Font("Uploaded Font");
      fontObj.fromDataBuffer(buffer, fontFile.name);
      const onloadEvent = await new Promise(
        (resolve) => fontObj.onload = resolve
      );
      const font2 = onloadEvent.detail.font;
      const { name: name2 } = font2.opentype.tables;
      const fontName = name2.get(16) || name2.get(1);
      const isItalic = name2.get(2).toLowerCase().includes("italic");
      const fontWeight = font2.opentype.tables["OS/2"].usWeightClass || "normal";
      const isVariable = !!font2.opentype.tables.fvar;
      const weightAxis = isVariable && font2.opentype.tables.fvar.axes.find(
        ({ tag }) => tag === "wght"
      );
      const weightRange = weightAxis ? `${weightAxis.minValue} ${weightAxis.maxValue}` : null;
      return {
        file: fontFile,
        fontFamily: fontName,
        fontStyle: isItalic ? "italic" : "normal",
        fontWeight: weightRange || fontWeight
      };
    };
    const handleInstall = async (fontFaces) => {
      const fontFamilies = makeFamiliesFromFaces(fontFaces);
      try {
        await installFonts(fontFamilies);
        setNotice({
          type: "success",
          message: (0, import_i18n76.__)("Fonts were installed successfully.")
        });
      } catch (error) {
        const typedError = error;
        setNotice({
          type: "error",
          message: typedError.message,
          errors: typedError?.installationErrors
        });
      }
      setIsUploading(false);
    };
    return /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)("div", { className: "font-library__tabpanel-layout", children: [
      /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_components58.DropZone, { onFilesDrop: handleDropZone }),
      /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(import_components58.__experimentalVStack, { className: "font-library__local-fonts", justify: "start", children: [
        notice && /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(
          import_components58.Notice,
          {
            status: notice.type,
            __unstableHTML: true,
            onRemove: () => setNotice(null),
            children: [
              notice.message,
              notice.errors && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("ul", { children: notice.errors.map((error, index2) => /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("li", { children: error }, index2)) })
            ]
          }
        ),
        isUploading && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_components58.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("div", { className: "font-library__upload-area", children: /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_components58.ProgressBar, {}) }) }),
        !isUploading && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
          import_components58.FormFileUpload,
          {
            accept: ALLOWED_FILE_EXTENSIONS.map(
              (ext) => `.${ext}`
            ).join(","),
            multiple: true,
            onChange: onFilesUpload,
            render: ({ openFileDialog }) => /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
              import_components58.Button,
              {
                __next40pxDefaultSize: true,
                className: "font-library__upload-area",
                onClick: openFileDialog,
                children: (0, import_i18n76.__)("Upload font")
              }
            )
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_components58.__experimentalText, { className: "font-library__upload-area__text", children: (0, import_i18n76.__)(
          "Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2."
        ) })
      ] })
    ] });
  }
  var upload_fonts_default = UploadFonts;

  // packages/global-styles-ui/build-module/font-library/modal.mjs
  var import_jsx_runtime144 = __toESM(require_jsx_runtime(), 1);
  var { Tabs } = unlock3(import_components59.privateApis);
  var DEFAULT_TAB = {
    id: "installed-fonts",
    title: (0, import_i18n77._x)("Library", "Font library")
  };
  var UPLOAD_TAB = {
    id: "upload-fonts",
    title: (0, import_i18n77._x)("Upload", "noun")
  };
  var tabsFromCollections = (collections) => collections.map(({ slug, name: name2 }) => ({
    id: slug,
    title: collections.length === 1 && slug === "google-fonts" ? (0, import_i18n77.__)("Install Fonts") : name2
  }));
  function FontLibraryModal({
    onRequestClose,
    defaultTabId = "installed-fonts"
  }) {
    const { records: collections = [] } = (0, import_core_data38.useEntityRecords)("root", "fontCollection", {
      _fields: "slug,name,description"
    });
    const canUserCreate = (0, import_data56.useSelect)((select5) => {
      return select5(import_core_data38.store).canUser("create", {
        kind: "postType",
        name: "wp_font_family"
      });
    }, []);
    const tabs = [DEFAULT_TAB];
    if (canUserCreate) {
      tabs.push(UPLOAD_TAB);
      tabs.push(...tabsFromCollections(collections || []));
    }
    return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
      import_components59.Modal,
      {
        title: (0, import_i18n77.__)("Fonts"),
        onRequestClose,
        isFullScreen: true,
        className: "font-library-modal",
        children: /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(Tabs, { defaultTabId, children: [
          /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("div", { className: "font-library-modal__tablist-container", children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Tabs.TabList, { children: tabs.map(({ id, title }) => /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Tabs.Tab, { tabId: id, children: title }, id)) }) }),
          tabs.map(({ id }) => {
            let contents;
            switch (id) {
              case "upload-fonts":
                contents = /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(upload_fonts_default, {});
                break;
              case "installed-fonts":
                contents = /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(installed_fonts_default, {});
                break;
              default:
                contents = /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(font_collection_default, { slug: id });
            }
            return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
              Tabs.TabPanel,
              {
                tabId: id,
                focusable: false,
                className: "font-library-modal__tab-panel",
                children: contents
              },
              id
            );
          })
        ] })
      }
    );
  }
  var modal_default = FontLibraryModal;

  // packages/global-styles-ui/build-module/font-family-item.mjs
  var import_i18n78 = __toESM(require_i18n(), 1);
  var import_components60 = __toESM(require_components(), 1);
  var import_element54 = __toESM(require_element(), 1);
  var import_jsx_runtime145 = __toESM(require_jsx_runtime(), 1);
  function FontFamilyItem({ font: font2 }) {
    const { handleSetLibraryFontSelected, setModalTabOpen } = (0, import_element54.useContext)(FontLibraryContext);
    const variantsCount = font2?.fontFace?.length || 1;
    const handleClick = () => {
      handleSetLibraryFontSelected?.(font2);
      setModalTabOpen?.("installed-fonts");
    };
    const previewStyle = getFamilyPreviewStyle(font2);
    return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(import_components60.__experimentalItem, { onClick: handleClick, children: /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(import_components60.__experimentalHStack, { justify: "space-between", children: [
      /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(import_components60.FlexItem, { style: previewStyle, children: font2.name }),
      /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(import_components60.FlexItem, { className: "global-styles-ui-screen-typography__font-variants-count", children: (0, import_i18n78.sprintf)(
        /* translators: %d: Number of font variants. */
        (0, import_i18n78._n)("%d variant", "%d variants", variantsCount),
        variantsCount
      ) })
    ] }) });
  }
  var font_family_item_default = FontFamilyItem;

  // packages/global-styles-ui/build-module/font-families.mjs
  var import_jsx_runtime146 = __toESM(require_jsx_runtime(), 1);
  function mapFontsWithSource(fonts, source) {
    return fonts ? fonts.map((f3) => setUIValuesNeeded(f3, { source })) : [];
  }
  function FontFamiliesInner() {
    const { baseCustomFonts, modalTabOpen, setModalTabOpen } = (0, import_element55.useContext)(FontLibraryContext);
    const [fontFamilies] = useSetting("typography.fontFamilies");
    const [baseFontFamilies] = useSetting(
      "typography.fontFamilies",
      void 0,
      "base"
    );
    const themeFonts = mapFontsWithSource(fontFamilies?.theme, "theme");
    const customFonts = mapFontsWithSource(fontFamilies?.custom, "custom");
    const activeFonts = [...themeFonts, ...customFonts].sort(
      (a3, b3) => a3.name.localeCompare(b3.name)
    );
    const hasFonts = 0 < activeFonts.length;
    const hasInstalledFonts = hasFonts || baseFontFamilies?.theme?.length > 0 || (baseCustomFonts?.length ?? 0) > 0;
    return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(import_jsx_runtime146.Fragment, { children: [
      !!modalTabOpen && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
        modal_default,
        {
          onRequestClose: () => setModalTabOpen?.(""),
          defaultTabId: modalTabOpen
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(import_components61.__experimentalVStack, { spacing: 2, children: [
        /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(import_components61.__experimentalHStack, { justify: "space-between", children: [
          /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Subtitle, { level: 3, children: (0, import_i18n79.__)("Fonts") }),
          /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
            import_components61.Button,
            {
              onClick: () => setModalTabOpen?.("installed-fonts"),
              label: (0, import_i18n79.__)("Manage fonts"),
              icon: settings_default,
              size: "small"
            }
          )
        ] }),
        activeFonts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(import_jsx_runtime146.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(import_components61.__experimentalItemGroup, { size: "large", isBordered: true, isSeparated: true, children: activeFonts.map((font2) => /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
          font_family_item_default,
          {
            font: font2
          },
          font2.slug
        )) }) }),
        !hasFonts && /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(import_jsx_runtime146.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(import_components61.__experimentalText, { as: "p", children: hasInstalledFonts ? (0, import_i18n79.__)("No fonts activated.") : (0, import_i18n79.__)("No fonts installed.") }),
          /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
            import_components61.Button,
            {
              className: "global-styles-ui-font-families__manage-fonts",
              variant: "secondary",
              __next40pxDefaultSize: true,
              onClick: () => {
                setModalTabOpen?.(
                  hasInstalledFonts ? "installed-fonts" : "upload-fonts"
                );
              },
              children: hasInstalledFonts ? (0, import_i18n79.__)("Manage fonts") : (0, import_i18n79.__)("Add fonts")
            }
          )
        ] })
      ] })
    ] });
  }
  function FontFamilies({ ...props }) {
    return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(context_default, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(FontFamiliesInner, { ...props }) });
  }

  // packages/global-styles-ui/build-module/font-sizes/font-sizes-count.mjs
  var import_i18n80 = __toESM(require_i18n(), 1);
  var import_components62 = __toESM(require_components(), 1);
  var import_jsx_runtime147 = __toESM(require_jsx_runtime(), 1);
  function FontSizes() {
    return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(import_components62.__experimentalVStack, { spacing: 2, children: [
      /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(import_components62.__experimentalHStack, { justify: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(Subtitle, { level: 3, children: (0, import_i18n80.__)("Font Sizes") }) }),
      /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(import_components62.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(NavigationButtonAsItem, { path: "/typography/font-sizes", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(import_components62.__experimentalHStack, { direction: "row", children: [
        /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(import_components62.FlexItem, { children: (0, import_i18n80.__)("Font size presets") }),
        /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(icon_default, { icon: (0, import_i18n80.isRTL)() ? chevron_left_default : chevron_right_default })
      ] }) }) })
    ] });
  }
  var font_sizes_count_default = FontSizes;

  // packages/global-styles-ui/build-module/screen-typography.mjs
  var import_jsx_runtime148 = __toESM(require_jsx_runtime(), 1);
  function ScreenTypography() {
    const { fontLibraryEnabled } = (0, import_element56.useContext)(GlobalStylesContext);
    return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(import_jsx_runtime148.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
        ScreenHeader,
        {
          title: (0, import_i18n81.__)("Typography"),
          description: (0, import_i18n81.__)(
            "Available fonts, typographic styles, and the application of those styles."
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(ScreenBody, { children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(import_components63.__experimentalVStack, { spacing: 7, children: [
        /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(TypographyVariations, { title: (0, import_i18n81.__)("Typesets") }),
        fontLibraryEnabled && /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(FontFamilies, {}),
        /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(typography_elements_default, {}),
        /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(font_sizes_count_default, {})
      ] }) })
    ] });
  }
  var screen_typography_default = ScreenTypography;

  // packages/global-styles-ui/build-module/screen-typography-element.mjs
  var import_i18n82 = __toESM(require_i18n(), 1);
  var import_components64 = __toESM(require_components(), 1);
  var import_element57 = __toESM(require_element(), 1);

  // packages/global-styles-ui/build-module/typography-panel.mjs
  var import_block_editor23 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime149 = __toESM(require_jsx_runtime(), 1);
  var { useSettingsForBlockElement: useSettingsForBlockElement4, TypographyPanel: StylesTypographyPanel2 } = unlock3(import_block_editor23.privateApis);
  function TypographyPanel({
    element,
    headingLevel
  }) {
    let prefixParts = [];
    if (element === "heading") {
      prefixParts = prefixParts.concat(["elements", headingLevel]);
    } else if (element && element !== "text") {
      prefixParts = prefixParts.concat(["elements", element]);
    }
    const prefix = prefixParts.join(".");
    const [style] = useStyle(prefix, "", "user", false);
    const [inheritedStyle, setStyle2] = useStyle(
      prefix,
      "",
      "merged",
      false
    );
    const [rawSettings] = useSetting("");
    const usedElement = element === "heading" ? headingLevel : element;
    const settings = useSettingsForBlockElement4(
      rawSettings,
      void 0,
      usedElement
    );
    return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
      StylesTypographyPanel2,
      {
        inheritedValue: inheritedStyle,
        value: style,
        onChange: setStyle2,
        settings
      }
    );
  }

  // packages/global-styles-ui/build-module/typography-preview.mjs
  var import_jsx_runtime150 = __toESM(require_jsx_runtime(), 1);
  function TypographyPreview({
    name: name2,
    element,
    headingLevel
  }) {
    let prefix = "";
    if (element === "heading") {
      prefix = `elements.${headingLevel}.`;
    } else if (element && element !== "text") {
      prefix = `elements.${element}.`;
    }
    const [fontFamily] = useStyle(prefix + "typography.fontFamily", name2);
    const [gradientValue] = useStyle(prefix + "color.gradient", name2);
    const [backgroundColor] = useStyle(prefix + "color.background", name2);
    const [fallbackBackgroundColor] = useStyle("color.background");
    const [color] = useStyle(prefix + "color.text", name2);
    const [fontSize] = useStyle(prefix + "typography.fontSize", name2);
    const [fontStyle] = useStyle(prefix + "typography.fontStyle", name2);
    const [fontWeight] = useStyle(prefix + "typography.fontWeight", name2);
    const [letterSpacing] = useStyle(
      prefix + "typography.letterSpacing",
      name2
    );
    const extraStyles = element === "link" ? {
      textDecoration: "underline"
    } : {};
    return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
      "div",
      {
        className: "global-styles-ui-typography-preview",
        style: {
          fontFamily: fontFamily ?? "serif",
          background: gradientValue ?? backgroundColor ?? fallbackBackgroundColor,
          color,
          fontSize,
          fontStyle,
          fontWeight,
          letterSpacing,
          ...extraStyles
        },
        children: "Aa"
      }
    );
  }

  // packages/global-styles-ui/build-module/screen-typography-element.mjs
  var import_jsx_runtime151 = __toESM(require_jsx_runtime(), 1);
  var elements = {
    text: {
      description: (0, import_i18n82.__)("Manage the fonts used on the site."),
      title: (0, import_i18n82.__)("Text")
    },
    link: {
      description: (0, import_i18n82.__)("Manage the fonts and typography used on the links."),
      title: (0, import_i18n82.__)("Links")
    },
    heading: {
      description: (0, import_i18n82.__)("Manage the fonts and typography used on headings."),
      title: (0, import_i18n82.__)("Headings")
    },
    caption: {
      description: (0, import_i18n82.__)("Manage the fonts and typography used on captions."),
      title: (0, import_i18n82.__)("Captions")
    },
    button: {
      description: (0, import_i18n82.__)("Manage the fonts and typography used on buttons."),
      title: (0, import_i18n82.__)("Buttons")
    }
  };
  function ScreenTypographyElement({ element }) {
    const [headingLevel, setHeadingLevel] = (0, import_element57.useState)("heading");
    return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(import_jsx_runtime151.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
        ScreenHeader,
        {
          title: elements[element].title,
          description: elements[element].description
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(import_components64.__experimentalSpacer, { marginX: 4, children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
        TypographyPreview,
        {
          element,
          headingLevel
        }
      ) }),
      element === "heading" && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(import_components64.__experimentalSpacer, { marginX: 4, marginBottom: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(
        import_components64.__experimentalToggleGroupControl,
        {
          label: (0, import_i18n82.__)("Select heading level"),
          hideLabelFromVision: true,
          value: headingLevel,
          onChange: (value) => setHeadingLevel(value),
          isBlock: true,
          size: "__unstable-large",
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
              import_components64.__experimentalToggleGroupControlOption,
              {
                value: "heading",
                showTooltip: true,
                "aria-label": (0, import_i18n82.__)("All headings"),
                label: (0, import_i18n82._x)("All", "heading levels")
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
              import_components64.__experimentalToggleGroupControlOption,
              {
                value: "h1",
                showTooltip: true,
                "aria-label": (0, import_i18n82.__)("Heading 1"),
                label: (0, import_i18n82.__)("H1")
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
              import_components64.__experimentalToggleGroupControlOption,
              {
                value: "h2",
                showTooltip: true,
                "aria-label": (0, import_i18n82.__)("Heading 2"),
                label: (0, import_i18n82.__)("H2")
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
              import_components64.__experimentalToggleGroupControlOption,
              {
                value: "h3",
                showTooltip: true,
                "aria-label": (0, import_i18n82.__)("Heading 3"),
                label: (0, import_i18n82.__)("H3")
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
              import_components64.__experimentalToggleGroupControlOption,
              {
                value: "h4",
                showTooltip: true,
                "aria-label": (0, import_i18n82.__)("Heading 4"),
                label: (0, import_i18n82.__)("H4")
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
              import_components64.__experimentalToggleGroupControlOption,
              {
                value: "h5",
                showTooltip: true,
                "aria-label": (0, import_i18n82.__)("Heading 5"),
                label: (0, import_i18n82.__)("H5")
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
              import_components64.__experimentalToggleGroupControlOption,
              {
                value: "h6",
                showTooltip: true,
                "aria-label": (0, import_i18n82.__)("Heading 6"),
                label: (0, import_i18n82.__)("H6")
              }
            )
          ]
        }
      ) }),
      /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
        TypographyPanel,
        {
          element,
          headingLevel
        }
      )
    ] });
  }
  var screen_typography_element_default = ScreenTypographyElement;

  // packages/global-styles-ui/build-module/screen-colors.mjs
  var import_i18n84 = __toESM(require_i18n(), 1);
  var import_components67 = __toESM(require_components(), 1);
  var import_block_editor24 = __toESM(require_block_editor(), 1);

  // packages/global-styles-ui/build-module/palette.mjs
  var import_components66 = __toESM(require_components(), 1);
  var import_i18n83 = __toESM(require_i18n(), 1);
  var import_element58 = __toESM(require_element(), 1);

  // packages/global-styles-ui/build-module/color-indicator-wrapper.mjs
  var import_components65 = __toESM(require_components(), 1);
  var import_jsx_runtime152 = __toESM(require_jsx_runtime(), 1);
  function ColorIndicatorWrapper({
    className,
    children,
    ...props
  }) {
    return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
      import_components65.Flex,
      {
        className: clsx_default(
          "global-styles-ui__color-indicator-wrapper",
          className
        ),
        ...props,
        children
      }
    );
  }
  var color_indicator_wrapper_default = ColorIndicatorWrapper;

  // packages/global-styles-ui/build-module/palette.mjs
  var import_jsx_runtime153 = __toESM(require_jsx_runtime(), 1);
  var EMPTY_COLORS = [];
  function Palette({ name: name2 }) {
    const [customColors] = useSetting("color.palette.custom");
    const [themeColors] = useSetting("color.palette.theme");
    const [defaultColors] = useSetting("color.palette.default");
    const [defaultPaletteEnabled] = useSetting(
      "color.defaultPalette",
      name2
    );
    const safeCustomColors = customColors || EMPTY_COLORS;
    const safeThemeColors = themeColors || EMPTY_COLORS;
    const safeDefaultColors = defaultColors || EMPTY_COLORS;
    const safeDefaultPaletteEnabled = defaultPaletteEnabled ?? true;
    const colors = (0, import_element58.useMemo)(
      () => [
        ...safeCustomColors,
        ...safeThemeColors,
        ...safeDefaultColors && safeDefaultPaletteEnabled ? safeDefaultColors : EMPTY_COLORS
      ],
      [
        safeCustomColors,
        safeThemeColors,
        safeDefaultColors,
        safeDefaultPaletteEnabled
      ]
    );
    const screenPath = !name2 ? "/colors/palette" : "/blocks/" + encodeURIComponent(name2) + "/colors/palette";
    return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(import_components66.__experimentalVStack, { spacing: 3, children: [
      /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Subtitle, { level: 3, children: (0, import_i18n83.__)("Palette") }),
      /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_components66.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(NavigationButtonAsItem, { path: screenPath, children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(import_components66.__experimentalHStack, { direction: "row", children: [
        colors.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(import_jsx_runtime153.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_components66.__experimentalZStack, { isLayered: false, offset: -8, children: colors.slice(0, 5).map(({ color }, index2) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
            color_indicator_wrapper_default,
            {
              children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
                import_components66.ColorIndicator,
                {
                  colorValue: color
                }
              )
            },
            `${color}-${index2}`
          )) }),
          /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_components66.FlexItem, { isBlock: true, children: (0, import_i18n83.__)("Edit palette") })
        ] }) : /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_components66.FlexItem, { children: (0, import_i18n83.__)("Add colors") }),
        /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(icon_default, { icon: (0, import_i18n83.isRTL)() ? chevron_left_default : chevron_right_default })
      ] }) }) })
    ] });
  }
  var palette_default = Palette;

  // packages/global-styles-ui/build-module/screen-colors.mjs
  var import_jsx_runtime154 = __toESM(require_jsx_runtime(), 1);
  var { useSettingsForBlockElement: useSettingsForBlockElement5, ColorPanel: StylesColorPanel2 } = unlock3(
    import_block_editor24.privateApis
  );
  function ScreenColors() {
    const [style, setStyle2] = useStyle(
      "",
      void 0,
      "user",
      false
    );
    const [inheritedStyle] = useStyle(
      "",
      void 0,
      "merged",
      false
    );
    const [rawSettings] = useSetting("");
    const settings = useSettingsForBlockElement5(rawSettings);
    return /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(import_jsx_runtime154.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
        ScreenHeader,
        {
          title: (0, import_i18n84.__)("Colors"),
          description: (0, import_i18n84.__)(
            "Palette colors and the application of those colors on site elements."
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(ScreenBody, { children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(import_components67.__experimentalVStack, { spacing: 7, children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(palette_default, {}) }) }),
      /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
        StylesColorPanel2,
        {
          inheritedValue: inheritedStyle,
          value: style,
          onChange: setStyle2,
          settings
        }
      )
    ] });
  }
  var screen_colors_default = ScreenColors;

  // packages/global-styles-ui/build-module/screen-color-palette.mjs
  var import_i18n87 = __toESM(require_i18n(), 1);
  var import_components72 = __toESM(require_components(), 1);

  // packages/global-styles-ui/build-module/color-palette-panel.mjs
  var import_compose12 = __toESM(require_compose(), 1);
  var import_components70 = __toESM(require_components(), 1);
  var import_i18n85 = __toESM(require_i18n(), 1);

  // packages/global-styles-ui/build-module/variations/variations-color.mjs
  var import_components69 = __toESM(require_components(), 1);

  // packages/global-styles-ui/build-module/preview-colors.mjs
  var import_components68 = __toESM(require_components(), 1);

  // packages/global-styles-ui/build-module/preset-colors.mjs
  var import_jsx_runtime155 = __toESM(require_jsx_runtime(), 1);
  function PresetColors() {
    const { paletteColors } = useStylesPreviewColors();
    return paletteColors.slice(0, 4).map(({ slug, color }, index2) => /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
      "div",
      {
        style: {
          flexGrow: 1,
          height: "100%",
          background: color
        }
      },
      `${slug}-${index2}`
    ));
  }

  // packages/global-styles-ui/build-module/preview-colors.mjs
  var import_jsx_runtime156 = __toESM(require_jsx_runtime(), 1);
  var firstFrameVariants2 = {
    start: {
      scale: 1,
      opacity: 1
    },
    hover: {
      scale: 0,
      opacity: 0
    }
  };
  var StylesPreviewColors = ({
    label,
    isFocused,
    withHoverView
  }) => {
    return /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
      preview_wrapper_default,
      {
        label,
        isFocused,
        withHoverView,
        children: ({ key }) => /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
          import_components68.__unstableMotion.div,
          {
            variants: firstFrameVariants2,
            style: {
              height: "100%",
              overflow: "hidden"
            },
            children: /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
              import_components68.__experimentalHStack,
              {
                spacing: 0,
                justify: "center",
                style: {
                  height: "100%",
                  overflow: "hidden"
                },
                children: /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(PresetColors, {})
              }
            )
          },
          key
        )
      }
    );
  };
  var preview_colors_default = StylesPreviewColors;

  // packages/global-styles-ui/build-module/variations/variations-color.mjs
  var import_jsx_runtime157 = __toESM(require_jsx_runtime(), 1);
  var propertiesToFilter2 = ["color"];
  function ColorVariations({
    title,
    gap = 2
  }) {
    const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter2);
    if (colorVariations?.length <= 1) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)(import_components69.__experimentalVStack, { spacing: 3, children: [
      title && /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Subtitle, { level: 3, children: title }),
      /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(import_components69.__experimentalGrid, { gap, children: colorVariations.map((variation, index2) => /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
        Variation,
        {
          variation,
          isPill: true,
          properties: propertiesToFilter2,
          showTooltip: true,
          children: () => /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(preview_colors_default, {})
        },
        index2
      )) })
    ] });
  }

  // packages/global-styles-ui/build-module/color-palette-panel.mjs
  var import_jsx_runtime158 = __toESM(require_jsx_runtime(), 1);
  var mobilePopoverProps = { placement: "bottom-start", offset: 8 };
  function ColorPalettePanel({ name: name2 }) {
    const [themeColors, setThemeColors] = useSetting(
      "color.palette.theme",
      name2
    );
    const [baseThemeColors] = useSetting(
      "color.palette.theme",
      name2,
      "base"
    );
    const [defaultColors, setDefaultColors] = useSetting(
      "color.palette.default",
      name2
    );
    const [baseDefaultColors] = useSetting(
      "color.palette.default",
      name2,
      "base"
    );
    const [customColors, setCustomColors] = useSetting(
      "color.palette.custom",
      name2
    );
    const [defaultPaletteEnabled] = useSetting(
      "color.defaultPalette",
      name2
    );
    const isMobileViewport = (0, import_compose12.useViewportMatch)("small", "<");
    const popoverProps = isMobileViewport ? mobilePopoverProps : void 0;
    const [randomizeThemeColors] = useColorRandomizer(name2);
    return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_components70.__experimentalVStack, { className: "global-styles-ui-color-palette-panel", spacing: 8, children: [
      /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_components70.__experimentalVStack, { spacing: 4, children: [
        !!themeColors && !!themeColors.length && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
          import_components70.__experimentalPaletteEdit,
          {
            canReset: themeColors !== baseThemeColors,
            canOnlyChangeValues: true,
            colors: themeColors,
            onChange: setThemeColors,
            paletteLabel: (0, import_i18n85.__)("Theme"),
            paletteLabelHeadingLevel: 3,
            popoverProps
          }
        ),
        window.__experimentalEnableColorRandomizer && themeColors?.length > 0 && randomizeThemeColors && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
          import_components70.Button,
          {
            __next40pxDefaultSize: true,
            variant: "secondary",
            icon: shuffle_default,
            onClick: randomizeThemeColors,
            children: (0, import_i18n85.__)("Randomize colors")
          }
        )
      ] }),
      !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
        import_components70.__experimentalPaletteEdit,
        {
          canReset: defaultColors !== baseDefaultColors,
          canOnlyChangeValues: true,
          colors: defaultColors,
          onChange: setDefaultColors,
          paletteLabel: (0, import_i18n85.__)("Default"),
          paletteLabelHeadingLevel: 3,
          popoverProps
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
        import_components70.__experimentalPaletteEdit,
        {
          colors: customColors,
          onChange: setCustomColors,
          paletteLabel: (0, import_i18n85.__)("Custom"),
          paletteLabelHeadingLevel: 3,
          slugPrefix: "custom-",
          popoverProps
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(ColorVariations, { title: (0, import_i18n85.__)("Palettes") })
    ] });
  }

  // packages/global-styles-ui/build-module/gradients-palette-panel.mjs
  var import_compose13 = __toESM(require_compose(), 1);
  var import_components71 = __toESM(require_components(), 1);
  var import_i18n86 = __toESM(require_i18n(), 1);
  var import_jsx_runtime159 = __toESM(require_jsx_runtime(), 1);
  var mobilePopoverProps2 = { placement: "bottom-start", offset: 8 };
  var noop4 = () => {
  };
  function GradientPalettePanel({
    name: name2
  }) {
    const [themeGradients, setThemeGradients] = useSetting(
      "color.gradients.theme",
      name2
    );
    const [baseThemeGradients] = useSetting(
      "color.gradients.theme",
      name2,
      "base"
    );
    const [defaultGradients, setDefaultGradients] = useSetting(
      "color.gradients.default",
      name2
    );
    const [baseDefaultGradients] = useSetting(
      "color.gradients.default",
      name2,
      "base"
    );
    const [customGradients, setCustomGradients] = useSetting(
      "color.gradients.custom",
      name2
    );
    const [defaultPaletteEnabled] = useSetting(
      "color.defaultGradients",
      name2
    );
    const [customDuotone] = useSetting("color.duotone.custom") || [];
    const [defaultDuotone] = useSetting("color.duotone.default") || [];
    const [themeDuotone] = useSetting("color.duotone.theme") || [];
    const [defaultDuotoneEnabled] = useSetting("color.defaultDuotone");
    const duotonePalette = [
      ...customDuotone || [],
      ...themeDuotone || [],
      ...defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : []
    ];
    const isMobileViewport = (0, import_compose13.useViewportMatch)("small", "<");
    const popoverProps = isMobileViewport ? mobilePopoverProps2 : void 0;
    return /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)(
      import_components71.__experimentalVStack,
      {
        className: "global-styles-ui-gradient-palette-panel",
        spacing: 8,
        children: [
          !!themeGradients && !!themeGradients.length && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
            import_components71.__experimentalPaletteEdit,
            {
              canReset: themeGradients !== baseThemeGradients,
              canOnlyChangeValues: true,
              gradients: themeGradients,
              onChange: setThemeGradients,
              paletteLabel: (0, import_i18n86.__)("Theme"),
              paletteLabelHeadingLevel: 3,
              popoverProps
            }
          ),
          !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
            import_components71.__experimentalPaletteEdit,
            {
              canReset: defaultGradients !== baseDefaultGradients,
              canOnlyChangeValues: true,
              gradients: defaultGradients,
              onChange: setDefaultGradients,
              paletteLabel: (0, import_i18n86.__)("Default"),
              paletteLabelHeadingLevel: 3,
              popoverProps
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
            import_components71.__experimentalPaletteEdit,
            {
              gradients: customGradients,
              onChange: setCustomGradients,
              paletteLabel: (0, import_i18n86.__)("Custom"),
              paletteLabelHeadingLevel: 3,
              slugPrefix: "custom-",
              popoverProps
            }
          ),
          !!duotonePalette && !!duotonePalette.length && /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)("div", { children: [
            /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(Subtitle, { level: 3, children: (0, import_i18n86.__)("Duotone") }),
            /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(import_components71.__experimentalSpacer, { margin: 3 }),
            /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
              import_components71.DuotonePicker,
              {
                duotonePalette,
                disableCustomDuotone: true,
                disableCustomColors: true,
                clearable: false,
                onChange: noop4,
                colorPalette: []
              }
            )
          ] })
        ]
      }
    );
  }

  // packages/global-styles-ui/build-module/screen-color-palette.mjs
  var import_jsx_runtime160 = __toESM(require_jsx_runtime(), 1);
  var { Tabs: Tabs2 } = unlock3(import_components72.privateApis);
  function ScreenColorPalette({ name: name2 }) {
    return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(import_jsx_runtime160.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
        ScreenHeader,
        {
          title: (0, import_i18n87.__)("Edit palette"),
          description: (0, import_i18n87.__)(
            "The combination of colors used across the site and in color pickers."
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(Tabs2, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(Tabs2.TabList, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Tabs2.Tab, { tabId: "color", children: (0, import_i18n87.__)("Color") }),
          /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Tabs2.Tab, { tabId: "gradient", children: (0, import_i18n87.__)("Gradient") })
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Tabs2.TabPanel, { tabId: "color", focusable: false, children: /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(ColorPalettePanel, { name: name2 }) }),
        /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Tabs2.TabPanel, { tabId: "gradient", focusable: false, children: /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(GradientPalettePanel, { name: name2 }) })
      ] })
    ] });
  }
  var screen_color_palette_default = ScreenColorPalette;

  // packages/global-styles-ui/build-module/screen-background.mjs
  var import_i18n88 = __toESM(require_i18n(), 1);
  var import_block_editor26 = __toESM(require_block_editor(), 1);
  var import_components73 = __toESM(require_components(), 1);

  // packages/global-styles-ui/build-module/background-panel.mjs
  var import_block_editor25 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime161 = __toESM(require_jsx_runtime(), 1);
  var BACKGROUND_DEFAULT_VALUES = {
    backgroundSize: "auto"
  };
  var { BackgroundPanel: StylesBackgroundPanel2 } = unlock3(
    import_block_editor25.privateApis
  );
  function BackgroundPanel() {
    const [style] = useStyle("", void 0, "user", false);
    const [inheritedStyle, setStyle2] = useStyle(
      "",
      void 0,
      "merged",
      false
    );
    const [settings] = useSetting("");
    return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
      StylesBackgroundPanel2,
      {
        inheritedValue: inheritedStyle,
        value: style,
        onChange: setStyle2,
        settings,
        defaultValues: BACKGROUND_DEFAULT_VALUES
      }
    );
  }

  // packages/global-styles-ui/build-module/screen-background.mjs
  var import_jsx_runtime162 = __toESM(require_jsx_runtime(), 1);
  var { useHasBackgroundPanel: useHasBackgroundPanel3 } = unlock3(import_block_editor26.privateApis);
  function ScreenBackground() {
    const [settings] = useSetting("");
    const hasBackgroundPanel = useHasBackgroundPanel3(settings);
    return /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(import_jsx_runtime162.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
        ScreenHeader,
        {
          title: (0, import_i18n88.__)("Background"),
          description: /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(import_components73.__experimentalText, { children: (0, import_i18n88.__)("Set styles for the site's background.") })
        }
      ),
      hasBackgroundPanel && /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(BackgroundPanel, {})
    ] });
  }
  var screen_background_default = ScreenBackground;

  // packages/global-styles-ui/build-module/shadows-panel.mjs
  var import_components75 = __toESM(require_components(), 1);
  var import_i18n90 = __toESM(require_i18n(), 1);
  var import_element59 = __toESM(require_element(), 1);

  // packages/global-styles-ui/build-module/confirm-reset-shadow-dialog.mjs
  var import_components74 = __toESM(require_components(), 1);
  var import_i18n89 = __toESM(require_i18n(), 1);
  var import_jsx_runtime163 = __toESM(require_jsx_runtime(), 1);
  function ConfirmResetShadowDialog({
    text,
    confirmButtonText,
    isOpen,
    toggleOpen,
    onConfirm
  }) {
    const handleConfirm = async () => {
      toggleOpen();
      onConfirm();
    };
    const handleCancel = () => {
      toggleOpen();
    };
    return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
      import_components74.__experimentalConfirmDialog,
      {
        isOpen,
        cancelButtonText: (0, import_i18n89.__)("Cancel"),
        confirmButtonText,
        onCancel: handleCancel,
        onConfirm: handleConfirm,
        size: "medium",
        children: text
      }
    );
  }
  var confirm_reset_shadow_dialog_default = ConfirmResetShadowDialog;

  // packages/global-styles-ui/build-module/shadows-panel.mjs
  var import_jsx_runtime164 = __toESM(require_jsx_runtime(), 1);
  var { Menu } = unlock3(import_components75.privateApis);
  var defaultShadow = "6px 6px 9px rgba(0, 0, 0, 0.2)";
  function ShadowsPanel() {
    const [defaultShadows] = useSetting("shadow.presets.default");
    const [defaultShadowsEnabled] = useSetting("shadow.defaultPresets");
    const [themeShadows] = useSetting("shadow.presets.theme");
    const [customShadows, setCustomShadows] = useSetting(
      "shadow.presets.custom"
    );
    const onCreateShadow = (shadow) => {
      setCustomShadows([...customShadows || [], shadow]);
    };
    const handleResetShadows = () => {
      setCustomShadows([]);
    };
    const [isResetDialogOpen, setIsResetDialogOpen] = (0, import_element59.useState)(false);
    const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen);
    return /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(import_jsx_runtime164.Fragment, { children: [
      isResetDialogOpen && /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
        confirm_reset_shadow_dialog_default,
        {
          text: (0, import_i18n90.__)(
            "Are you sure you want to remove all custom shadows?"
          ),
          confirmButtonText: (0, import_i18n90.__)("Remove"),
          isOpen: isResetDialogOpen,
          toggleOpen: toggleResetDialog,
          onConfirm: handleResetShadows
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
        ScreenHeader,
        {
          title: (0, import_i18n90.__)("Shadows"),
          description: (0, import_i18n90.__)(
            "Manage and create shadow styles for use across the site."
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(ScreenBody, { children: /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(
        import_components75.__experimentalVStack,
        {
          className: "global-styles-ui__shadows-panel",
          spacing: 7,
          children: [
            defaultShadowsEnabled && /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
              ShadowList,
              {
                label: (0, import_i18n90.__)("Default"),
                shadows: defaultShadows || [],
                category: "default"
              }
            ),
            themeShadows && themeShadows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
              ShadowList,
              {
                label: (0, import_i18n90.__)("Theme"),
                shadows: themeShadows || [],
                category: "theme"
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
              ShadowList,
              {
                label: (0, import_i18n90.__)("Custom"),
                shadows: customShadows || [],
                category: "custom",
                canCreate: true,
                onCreate: onCreateShadow,
                onReset: toggleResetDialog
              }
            )
          ]
        }
      ) })
    ] });
  }
  function ShadowList({
    label,
    shadows,
    category,
    canCreate,
    onCreate,
    onReset
  }) {
    const handleAddShadow = () => {
      const newIndex = getNewIndexFromPresets(shadows, "shadow-");
      onCreate?.({
        name: (0, import_i18n90.sprintf)(
          /* translators: %d: is an index for a preset */
          (0, import_i18n90.__)("Shadow %d"),
          newIndex
        ),
        shadow: defaultShadow,
        slug: `shadow-${newIndex}`
      });
    };
    return /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(import_components75.__experimentalVStack, { spacing: 2, children: [
      /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(import_components75.__experimentalHStack, { justify: "space-between", children: [
        /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(Subtitle, { level: 3, children: label }),
        /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(import_components75.FlexItem, { className: "global-styles-ui__shadows-panel__options-container", children: [
          canCreate && /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
            import_components75.Button,
            {
              size: "small",
              icon: plus_default,
              label: (0, import_i18n90.__)("Add shadow"),
              onClick: () => {
                handleAddShadow();
              }
            }
          ),
          !!shadows?.length && category === "custom" && /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(Menu, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
              Menu.TriggerButton,
              {
                render: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
                  import_components75.Button,
                  {
                    size: "small",
                    icon: more_vertical_default,
                    label: (0, import_i18n90.__)("Shadow options")
                  }
                )
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(Menu.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(Menu.Item, { onClick: onReset, children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(Menu.ItemLabel, { children: (0, import_i18n90.__)("Remove all custom shadows") }) }) })
          ] })
        ] })
      ] }),
      shadows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(import_components75.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: shadows.map((shadow) => /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
        ShadowItem,
        {
          shadow,
          category
        },
        shadow.slug
      )) })
    ] });
  }
  function ShadowItem({ shadow, category }) {
    return /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
      NavigationButtonAsItem,
      {
        path: `/shadows/edit/${category}/${shadow.slug}`,
        children: /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(import_components75.__experimentalHStack, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(import_components75.FlexItem, { children: shadow.name }),
          /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(icon_default, { icon: (0, import_i18n90.isRTL)() ? chevron_left_default : chevron_right_default })
        ] })
      }
    );
  }

  // packages/global-styles-ui/build-module/shadows-edit-panel.mjs
  var import_components76 = __toESM(require_components(), 1);
  var import_i18n91 = __toESM(require_i18n(), 1);
  var import_element60 = __toESM(require_element(), 1);

  // packages/global-styles-ui/build-module/shadow-utils.mjs
  function getShadowParts(shadow) {
    const shadowValues = shadow.match(/(?:[^,(]|\([^)]*\))+/g) || [];
    return shadowValues.map((value) => value.trim());
  }
  function shadowStringToObject(shadowValue) {
    const defaultShadow2 = {
      x: "0",
      y: "0",
      blur: "0",
      spread: "0",
      color: "#000",
      inset: false
    };
    if (!shadowValue) {
      return defaultShadow2;
    }
    if (shadowValue.includes("none")) {
      return defaultShadow2;
    }
    const lengthsRegex = /((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g;
    const matches = shadowValue.match(lengthsRegex) || [];
    if (matches.length !== 1) {
      return defaultShadow2;
    }
    const lengths = matches[0].split(" ").map((value) => value.trim()).filter((value) => value);
    if (lengths.length < 2) {
      return defaultShadow2;
    }
    const insets = shadowValue.match(/inset/gi) || [];
    if (insets.length > 1) {
      return defaultShadow2;
    }
    const hasInset = insets.length === 1;
    let colorString = shadowValue.replace(lengthsRegex, "").trim();
    if (hasInset) {
      colorString = colorString.replace("inset", "").replace("INSET", "").trim();
    }
    const colorRegex = /^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi;
    let colorMatches = (colorString.match(colorRegex) || []).map((value) => value?.trim()).filter((value) => value);
    if (colorMatches.length > 1) {
      return defaultShadow2;
    } else if (colorMatches.length === 0) {
      colorMatches = colorString.trim().split(" ").filter((value) => value);
      if (colorMatches.length > 1) {
        return defaultShadow2;
      }
    }
    const [x2, y3, blur, spread] = lengths;
    return {
      x: x2,
      y: y3,
      blur: blur || defaultShadow2.blur,
      spread: spread || defaultShadow2.spread,
      inset: hasInset,
      color: colorString || defaultShadow2.color
    };
  }
  function shadowObjectToString(shadowObj) {
    const shadowString = `${shadowObj.x || "0px"} ${shadowObj.y || "0px"} ${shadowObj.blur || "0px"} ${shadowObj.spread || "0px"}`;
    return `${shadowObj.inset ? "inset" : ""} ${shadowString} ${shadowObj.color || ""}`.trim();
  }

  // packages/global-styles-ui/build-module/shadows-edit-panel.mjs
  var import_jsx_runtime165 = __toESM(require_jsx_runtime(), 1);
  var { Menu: Menu2 } = unlock3(import_components76.privateApis);
  var customShadowMenuItems = [
    {
      label: (0, import_i18n91.__)("Rename"),
      action: "rename"
    },
    {
      label: (0, import_i18n91.__)("Delete"),
      action: "delete"
    }
  ];
  var presetShadowMenuItems = [
    {
      label: (0, import_i18n91.__)("Reset"),
      action: "reset"
    }
  ];
  function ShadowsEditPanel() {
    const { goBack, params } = (0, import_components76.useNavigator)();
    const { category, slug } = params;
    const [shadows, setShadows] = useSetting(
      `shadow.presets.${category}`
    );
    (0, import_element60.useEffect)(() => {
      const hasCurrentShadow = shadows?.some(
        (shadow) => shadow.slug === slug
      );
      if (!!slug && !hasCurrentShadow) {
        goBack();
      }
    }, [shadows, slug, goBack]);
    const [baseShadows] = useSetting(
      `shadow.presets.${category}`,
      void 0,
      "base"
    );
    const [selectedShadow, setSelectedShadow] = (0, import_element60.useState)(
      () => (shadows || []).find((shadow) => shadow.slug === slug)
    );
    const baseSelectedShadow = (0, import_element60.useMemo)(
      () => (baseShadows || []).find((b3) => b3.slug === slug),
      [baseShadows, slug]
    );
    const [isConfirmDialogVisible, setIsConfirmDialogVisible] = (0, import_element60.useState)(false);
    const [isRenameModalVisible, setIsRenameModalVisible] = (0, import_element60.useState)(false);
    const [shadowName, setShadowName] = (0, import_element60.useState)(
      selectedShadow?.name
    );
    if (!category || !slug) {
      return null;
    }
    const onShadowChange = (shadow) => {
      setSelectedShadow({ ...selectedShadow, shadow });
      const updatedShadows = shadows.map(
        (s3) => s3.slug === slug ? { ...selectedShadow, shadow } : s3
      );
      setShadows(updatedShadows);
    };
    const onMenuClick = (action) => {
      if (action === "reset") {
        const updatedShadows = shadows.map(
          (s3) => s3.slug === slug ? baseSelectedShadow : s3
        );
        setSelectedShadow(baseSelectedShadow);
        setShadows(updatedShadows);
      } else if (action === "delete") {
        setIsConfirmDialogVisible(true);
      } else if (action === "rename") {
        setIsRenameModalVisible(true);
      }
    };
    const handleShadowDelete = () => {
      setShadows(shadows.filter((s3) => s3.slug !== slug));
    };
    const handleShadowRename = (newName) => {
      if (!newName) {
        return;
      }
      const updatedShadows = shadows.map(
        (s3) => s3.slug === slug ? { ...selectedShadow, name: newName } : s3
      );
      setSelectedShadow({ ...selectedShadow, name: newName });
      setShadows(updatedShadows);
    };
    return !selectedShadow ? /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(ScreenHeader, { title: "" }) : /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(import_jsx_runtime165.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(import_components76.__experimentalHStack, { justify: "space-between", children: [
        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(ScreenHeader, { title: selectedShadow.name }),
        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_components76.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_components76.__experimentalSpacer, { marginTop: 2, marginBottom: 0, paddingX: 4, children: /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(Menu2, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
            Menu2.TriggerButton,
            {
              render: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
                import_components76.Button,
                {
                  size: "small",
                  icon: more_vertical_default,
                  label: (0, import_i18n91.__)("Menu")
                }
              )
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(Menu2.Popover, { children: (category === "custom" ? customShadowMenuItems : presetShadowMenuItems).map((item) => /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
            Menu2.Item,
            {
              onClick: () => onMenuClick(item.action),
              disabled: item.action === "reset" && selectedShadow.shadow === baseSelectedShadow?.shadow,
              children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(Menu2.ItemLabel, { children: item.label })
            },
            item.action
          )) })
        ] }) }) })
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(ScreenBody, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(ShadowsPreview, { shadow: selectedShadow.shadow }),
        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
          ShadowEditor,
          {
            shadow: selectedShadow.shadow,
            onChange: onShadowChange
          }
        )
      ] }),
      isConfirmDialogVisible && /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
        import_components76.__experimentalConfirmDialog,
        {
          isOpen: true,
          onConfirm: () => {
            handleShadowDelete();
            setIsConfirmDialogVisible(false);
          },
          onCancel: () => {
            setIsConfirmDialogVisible(false);
          },
          confirmButtonText: (0, import_i18n91.__)("Delete"),
          size: "medium",
          children: (0, import_i18n91.sprintf)(
            /* translators: %s: Name of the shadow preset. */
            (0, import_i18n91.__)(
              'Are you sure you want to delete "%s" shadow preset?'
            ),
            selectedShadow.name
          )
        }
      ),
      isRenameModalVisible && /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
        import_components76.Modal,
        {
          title: (0, import_i18n91.__)("Rename"),
          onRequestClose: () => setIsRenameModalVisible(false),
          size: "small",
          children: /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(
            "form",
            {
              onSubmit: (event) => {
                event.preventDefault();
                handleShadowRename(shadowName);
                setIsRenameModalVisible(false);
              },
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
                  import_components76.__experimentalInputControl,
                  {
                    __next40pxDefaultSize: true,
                    autoComplete: "off",
                    label: (0, import_i18n91.__)("Name"),
                    placeholder: (0, import_i18n91.__)("Shadow name"),
                    value: shadowName ?? "",
                    onChange: setShadowName
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_components76.__experimentalSpacer, { marginBottom: 6 }),
                /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(
                  import_components76.Flex,
                  {
                    className: "block-editor-shadow-edit-modal__actions",
                    justify: "flex-end",
                    expanded: false,
                    children: [
                      /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_components76.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
                        import_components76.Button,
                        {
                          __next40pxDefaultSize: true,
                          variant: "tertiary",
                          onClick: () => setIsRenameModalVisible(false),
                          children: (0, import_i18n91.__)("Cancel")
                        }
                      ) }),
                      /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_components76.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
                        import_components76.Button,
                        {
                          __next40pxDefaultSize: true,
                          variant: "primary",
                          type: "submit",
                          children: (0, import_i18n91.__)("Save")
                        }
                      ) })
                    ]
                  }
                )
              ]
            }
          )
        }
      )
    ] });
  }
  function ShadowsPreview({ shadow }) {
    const shadowStyle = {
      boxShadow: shadow
    };
    return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_components76.__experimentalSpacer, { marginBottom: 4, marginTop: -2, children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
      import_components76.__experimentalHStack,
      {
        alignment: "center",
        justify: "center",
        className: "global-styles-ui__shadow-preview-panel",
        children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
          "div",
          {
            className: "global-styles-ui__shadow-preview-block",
            style: shadowStyle
          }
        )
      }
    ) });
  }
  function ShadowEditor({ shadow, onChange }) {
    const addShadowButtonRef = (0, import_element60.useRef)(null);
    const shadowParts = (0, import_element60.useMemo)(() => getShadowParts(shadow), [shadow]);
    const onChangeShadowPart = (index2, part) => {
      const newShadowParts = [...shadowParts];
      newShadowParts[index2] = part;
      onChange(newShadowParts.join(", "));
    };
    const onAddShadowPart = () => {
      onChange([...shadowParts, defaultShadow].join(", "));
    };
    const onRemoveShadowPart = (index2) => {
      onChange(shadowParts.filter((p4, i3) => i3 !== index2).join(", "));
      addShadowButtonRef.current?.focus();
    };
    return /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(import_jsx_runtime165.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_components76.__experimentalVStack, { spacing: 2, children: /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(import_components76.__experimentalHStack, { justify: "space-between", children: [
        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(Subtitle, { level: 3, children: (0, import_i18n91.__)("Shadows") }),
        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_components76.FlexItem, { className: "global-styles-ui__shadows-panel__options-container", children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
          import_components76.Button,
          {
            size: "small",
            icon: plus_default,
            label: (0, import_i18n91.__)("Add shadow"),
            onClick: () => {
              onAddShadowPart();
            },
            ref: addShadowButtonRef
          }
        ) })
      ] }) }),
      /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_components76.__experimentalSpacer, {}),
      /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_components76.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: shadowParts.map((part, index2) => /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
        ShadowItem2,
        {
          shadow: part,
          onChange: (value) => onChangeShadowPart(index2, value),
          canRemove: shadowParts.length > 1,
          onRemove: () => onRemoveShadowPart(index2)
        },
        index2
      )) })
    ] });
  }
  function ShadowItem2({
    shadow,
    onChange,
    canRemove,
    onRemove
  }) {
    const popoverProps = {
      placement: "left-start",
      offset: 36,
      shift: true
    };
    const shadowObj = (0, import_element60.useMemo)(
      () => shadowStringToObject(shadow),
      [shadow]
    );
    const onShadowChange = (newShadow) => {
      onChange(shadowObjectToString(newShadow));
    };
    return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
      import_components76.Dropdown,
      {
        popoverProps,
        className: "global-styles-ui__shadow-editor__dropdown",
        renderToggle: ({ onToggle, isOpen }) => {
          const toggleProps = {
            onClick: onToggle,
            className: clsx_default(
              "global-styles-ui__shadow-editor__dropdown-toggle",
              { "is-open": isOpen }
            ),
            "aria-expanded": isOpen
          };
          const removeButtonProps = {
            onClick: () => {
              if (isOpen) {
                onToggle();
              }
              onRemove();
            },
            className: clsx_default(
              "global-styles-ui__shadow-editor__remove-button",
              { "is-open": isOpen }
            ),
            label: (0, import_i18n91.__)("Remove shadow")
          };
          return /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(import_jsx_runtime165.Fragment, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
              import_components76.Button,
              {
                __next40pxDefaultSize: true,
                icon: shadow_default,
                ...toggleProps,
                children: shadowObj.inset ? (0, import_i18n91.__)("Inner shadow") : (0, import_i18n91.__)("Drop shadow")
              }
            ),
            canRemove && /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
              import_components76.Button,
              {
                size: "small",
                icon: reset_default,
                ...removeButtonProps
              }
            )
          ] });
        },
        renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
          import_components76.__experimentalDropdownContentWrapper,
          {
            paddingSize: "medium",
            className: "global-styles-ui__shadow-editor__dropdown-content",
            children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
              ShadowPopover,
              {
                shadowObj,
                onChange: onShadowChange
              }
            )
          }
        )
      }
    );
  }
  function ShadowPopover({ shadowObj, onChange }) {
    const __experimentalIsRenderedInSidebar = true;
    const enableAlpha = true;
    const onShadowChange = (key, value) => {
      const newShadow = {
        ...shadowObj,
        [key]: value
      };
      onChange(newShadow);
    };
    return /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(import_components76.__experimentalVStack, { spacing: 4, className: "global-styles-ui__shadow-editor-panel", children: [
      /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
        import_components76.ColorPalette,
        {
          clearable: false,
          enableAlpha,
          __experimentalIsRenderedInSidebar,
          value: shadowObj.color,
          onChange: (value) => onShadowChange("color", value)
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(
        import_components76.__experimentalToggleGroupControl,
        {
          label: (0, import_i18n91.__)("Shadow Type"),
          value: shadowObj.inset ? "inset" : "outset",
          isBlock: true,
          onChange: (value) => onShadowChange("inset", value === "inset"),
          hideLabelFromVision: true,
          __next40pxDefaultSize: true,
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
              import_components76.__experimentalToggleGroupControlOption,
              {
                value: "outset",
                label: (0, import_i18n91.__)("Outset")
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
              import_components76.__experimentalToggleGroupControlOption,
              {
                value: "inset",
                label: (0, import_i18n91.__)("Inset")
              }
            )
          ]
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(import_components76.__experimentalGrid, { columns: 2, gap: 4, children: [
        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
          ShadowInputControl,
          {
            label: (0, import_i18n91.__)("X Position"),
            value: shadowObj.x,
            onChange: (value) => onShadowChange("x", value)
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
          ShadowInputControl,
          {
            label: (0, import_i18n91.__)("Y Position"),
            value: shadowObj.y,
            onChange: (value) => onShadowChange("y", value)
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
          ShadowInputControl,
          {
            label: (0, import_i18n91.__)("Blur"),
            value: shadowObj.blur,
            onChange: (value) => onShadowChange("blur", value)
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
          ShadowInputControl,
          {
            label: (0, import_i18n91.__)("Spread"),
            value: shadowObj.spread,
            onChange: (value) => onShadowChange("spread", value)
          }
        )
      ] })
    ] });
  }
  function ShadowInputControl({
    label,
    value,
    onChange
  }) {
    const onValueChange = (next) => {
      const isNumeric = next !== void 0 && !isNaN(parseFloat(next));
      const nextValue = isNumeric ? next : "0px";
      onChange(nextValue);
    };
    return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
      import_components76.__experimentalUnitControl,
      {
        label,
        __next40pxDefaultSize: true,
        value,
        onChange: onValueChange
      }
    );
  }

  // packages/global-styles-ui/build-module/screen-shadows.mjs
  var import_jsx_runtime166 = __toESM(require_jsx_runtime(), 1);
  function ScreenShadows() {
    return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(ShadowsPanel, {});
  }
  function ScreenShadowsEdit() {
    return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(ShadowsEditPanel, {});
  }

  // packages/global-styles-ui/build-module/screen-layout.mjs
  var import_i18n92 = __toESM(require_i18n(), 1);
  var import_block_editor28 = __toESM(require_block_editor(), 1);

  // packages/global-styles-ui/build-module/dimensions-panel.mjs
  var import_block_editor27 = __toESM(require_block_editor(), 1);
  var import_element61 = __toESM(require_element(), 1);
  var import_jsx_runtime167 = __toESM(require_jsx_runtime(), 1);
  var { useSettingsForBlockElement: useSettingsForBlockElement6, DimensionsPanel: StylesDimensionsPanel2 } = unlock3(import_block_editor27.privateApis);
  var DEFAULT_CONTROLS = {
    contentSize: true,
    wideSize: true,
    padding: true,
    margin: true,
    blockGap: true,
    height: true,
    minHeight: true,
    width: true,
    childLayout: false
  };
  function DimensionsPanel() {
    const [style] = useStyle("", void 0, "user", false);
    const [inheritedStyle, setStyle2] = useStyle(
      "",
      void 0,
      "merged",
      false
    );
    const [userSettings] = useSetting("", void 0, "user");
    const [rawSettings, setSettings] = useSetting("");
    const settings = useSettingsForBlockElement6(rawSettings);
    const inheritedStyleWithLayout = (0, import_element61.useMemo)(() => {
      return {
        ...inheritedStyle,
        layout: settings.layout
      };
    }, [inheritedStyle, settings.layout]);
    const styleWithLayout = (0, import_element61.useMemo)(() => {
      return {
        ...style,
        layout: userSettings.layout
      };
    }, [style, userSettings.layout]);
    const onChange = (newStyle) => {
      const updatedStyle = { ...newStyle };
      delete updatedStyle.layout;
      setStyle2(updatedStyle);
      if (newStyle.layout !== userSettings.layout) {
        const updatedSettings = {
          ...userSettings,
          layout: newStyle.layout
        };
        if (updatedSettings.layout?.definitions) {
          delete updatedSettings.layout.definitions;
        }
        setSettings(updatedSettings);
      }
    };
    return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
      StylesDimensionsPanel2,
      {
        inheritedValue: inheritedStyleWithLayout,
        value: styleWithLayout,
        onChange,
        settings,
        includeLayoutControls: true,
        defaultControls: DEFAULT_CONTROLS
      }
    );
  }

  // packages/global-styles-ui/build-module/screen-layout.mjs
  var import_jsx_runtime168 = __toESM(require_jsx_runtime(), 1);
  var { useHasDimensionsPanel: useHasDimensionsPanel4, useSettingsForBlockElement: useSettingsForBlockElement7 } = unlock3(
    import_block_editor28.privateApis
  );
  function ScreenLayout() {
    const [rawSettings] = useSetting("");
    const settings = useSettingsForBlockElement7(rawSettings);
    const hasDimensionsPanel = useHasDimensionsPanel4(settings);
    return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(import_jsx_runtime168.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(ScreenHeader, { title: (0, import_i18n92.__)("Layout") }),
      hasDimensionsPanel && /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(DimensionsPanel, {})
    ] });
  }
  var screen_layout_default = ScreenLayout;

  // packages/global-styles-ui/build-module/screen-style-variations.mjs
  var import_components79 = __toESM(require_components(), 1);
  var import_i18n95 = __toESM(require_i18n(), 1);

  // packages/global-styles-ui/build-module/style-variations-content.mjs
  var import_i18n94 = __toESM(require_i18n(), 1);
  var import_components78 = __toESM(require_components(), 1);

  // packages/global-styles-ui/build-module/style-variations-container.mjs
  var import_core_data39 = __toESM(require_core_data(), 1);
  var import_data57 = __toESM(require_data(), 1);
  var import_element62 = __toESM(require_element(), 1);
  var import_components77 = __toESM(require_components(), 1);
  var import_i18n93 = __toESM(require_i18n(), 1);
  var import_jsx_runtime169 = __toESM(require_jsx_runtime(), 1);
  function StyleVariationsContainer({
    gap = 2
  }) {
    const { user } = (0, import_element62.useContext)(GlobalStylesContext);
    const userStyles = user?.styles;
    const variations = (0, import_data57.useSelect)((select5) => {
      const result = select5(
        import_core_data39.store
      ).__experimentalGetCurrentThemeGlobalStylesVariations();
      return Array.isArray(result) ? result : void 0;
    }, []);
    const fullStyleVariations = variations?.filter(
      (variation) => {
        return !isVariationWithProperties(variation, ["color"]) && !isVariationWithProperties(variation, [
          "typography",
          "spacing"
        ]);
      }
    );
    const themeVariations = (0, import_element62.useMemo)(() => {
      const withEmptyVariation = [
        {
          title: (0, import_i18n93.__)("Default"),
          settings: {},
          styles: {}
        },
        ...fullStyleVariations ?? []
      ];
      return [
        ...withEmptyVariation.map((variation) => {
          const blockStyles = variation?.styles?.blocks ? { ...variation.styles.blocks } : {};
          if (userStyles?.blocks) {
            Object.keys(userStyles.blocks).forEach((blockName) => {
              if (userStyles.blocks?.[blockName]?.css) {
                const variationBlockStyles = blockStyles[blockName] || {};
                const customCSS = {
                  css: `${blockStyles[blockName]?.css || ""} ${userStyles.blocks?.[blockName]?.css?.trim() || ""}`
                };
                blockStyles[blockName] = {
                  ...variationBlockStyles,
                  ...customCSS
                };
              }
            });
          }
          const css = userStyles?.css || variation.styles?.css ? {
            css: `${variation.styles?.css || ""} ${userStyles?.css || ""}`
          } : {};
          const blocks = Object.keys(blockStyles).length > 0 ? { blocks: blockStyles } : {};
          const styles = {
            ...variation.styles,
            ...css,
            ...blocks
          };
          return {
            ...variation,
            settings: variation.settings ?? {},
            styles
          };
        })
      ];
    }, [fullStyleVariations, userStyles?.blocks, userStyles?.css]);
    if (!fullStyleVariations || fullStyleVariations.length < 1) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
      import_components77.__experimentalGrid,
      {
        columns: 2,
        className: "global-styles-ui-style-variations-container",
        gap,
        children: themeVariations.map(
          (variation, index2) => /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(Variation, { variation, children: (isFocused) => /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
            preview_styles_default,
            {
              label: variation?.title,
              withHoverView: true,
              isFocused,
              variation
            }
          ) }, index2)
        )
      }
    );
  }
  var style_variations_container_default = StyleVariationsContainer;

  // packages/global-styles-ui/build-module/style-variations-content.mjs
  var import_jsx_runtime170 = __toESM(require_jsx_runtime(), 1);
  function StyleVariationsContent() {
    const gap = 3;
    return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)(import_components78.__experimentalVStack, { spacing: 10, className: "global-styles-ui-variation-container", children: [
      /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(style_variations_container_default, { gap }),
      /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(ColorVariations, { title: (0, import_i18n94.__)("Color Variations"), gap }),
      /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(TypographyVariations, { title: (0, import_i18n94.__)("Typography"), gap })
    ] });
  }

  // packages/global-styles-ui/build-module/screen-style-variations.mjs
  var import_jsx_runtime171 = __toESM(require_jsx_runtime(), 1);
  function ScreenStyleVariations() {
    return /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(import_jsx_runtime171.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
        ScreenHeader,
        {
          title: (0, import_i18n95.__)("Browse styles"),
          description: (0, import_i18n95.__)(
            "Choose a variation to change the look of the site."
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
        import_components79.Card,
        {
          size: "small",
          isBorderless: true,
          className: "global-styles-ui-screen-style-variations",
          children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(import_components79.CardBody, { children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(StyleVariationsContent, {}) })
        }
      )
    ] });
  }
  var screen_style_variations_default = ScreenStyleVariations;

  // packages/global-styles-ui/build-module/screen-css.mjs
  var import_i18n96 = __toESM(require_i18n(), 1);
  var import_components80 = __toESM(require_components(), 1);
  var import_block_editor29 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime172 = __toESM(require_jsx_runtime(), 1);
  var { AdvancedPanel: StylesAdvancedPanel2 } = unlock3(import_block_editor29.privateApis);
  function ScreenCSS() {
    const [style] = useStyle("", void 0, "user", false);
    const [inheritedStyle, setStyle2] = useStyle(
      "",
      void 0,
      "merged",
      false
    );
    return /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(import_jsx_runtime172.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
        ScreenHeader,
        {
          title: (0, import_i18n96.__)("Additional CSS"),
          description: /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(import_jsx_runtime172.Fragment, { children: [
            (0, import_i18n96.__)(
              "You can add custom CSS to further customize the appearance and layout of your site."
            ),
            /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("br", {}),
            /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
              import_components80.ExternalLink,
              {
                href: (0, import_i18n96.__)(
                  "https://developer.wordpress.org/advanced-administration/wordpress/css/"
                ),
                className: "global-styles-ui-screen-css-help-link",
                children: (0, import_i18n96.__)("Learn more about CSS")
              }
            )
          ] })
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "global-styles-ui-screen-css", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
        StylesAdvancedPanel2,
        {
          value: style,
          onChange: setStyle2,
          inheritedValue: inheritedStyle
        }
      ) })
    ] });
  }
  var screen_css_default = ScreenCSS;

  // packages/global-styles-ui/build-module/screen-revisions/index.mjs
  var import_i18n99 = __toESM(require_i18n(), 1);
  var import_components83 = __toESM(require_components(), 1);
  var import_element64 = __toESM(require_element(), 1);

  // packages/global-styles-ui/build-module/screen-revisions/use-global-styles-revisions.mjs
  var import_data58 = __toESM(require_data(), 1);
  var import_core_data40 = __toESM(require_core_data(), 1);
  var import_element63 = __toESM(require_element(), 1);
  var SITE_EDITOR_AUTHORS_QUERY = {
    per_page: -1,
    _fields: "id,name,avatar_urls",
    context: "view",
    capabilities: ["edit_theme_options"]
  };
  var DEFAULT_QUERY = { per_page: 100, page: 1 };
  var EMPTY_ARRAY4 = [];
  function useGlobalStylesRevisions({
    query
  } = {}) {
    const { user: userConfig } = (0, import_element63.useContext)(GlobalStylesContext);
    const _query = (0, import_element63.useMemo)(
      () => ({ ...DEFAULT_QUERY, ...query }),
      [query]
    );
    const {
      authors,
      currentUser,
      isDirty,
      revisions,
      isLoadingGlobalStylesRevisions,
      revisionsCount
    } = (0, import_data58.useSelect)(
      (select5) => {
        const {
          __experimentalGetDirtyEntityRecords,
          getCurrentUser,
          getUsers,
          getRevisions,
          __experimentalGetCurrentGlobalStylesId,
          getEntityRecord,
          // @ts-expect-error
          isResolving
        } = select5(import_core_data40.store);
        const dirtyEntityRecords = __experimentalGetDirtyEntityRecords() || [];
        const _currentUser = getCurrentUser();
        const _isDirty = dirtyEntityRecords.length > 0;
        const globalStylesId = __experimentalGetCurrentGlobalStylesId();
        const globalStyles = globalStylesId ? getEntityRecord(
          "root",
          "globalStyles",
          globalStylesId
        ) : void 0;
        const _revisionsCount = (
          // @ts-expect-error - _links is not typed in GlobalStylesRevision
          globalStyles?._links?.["version-history"]?.[0]?.count ?? 0
        );
        const globalStylesRevisions = globalStylesId ? getRevisions(
          "root",
          "globalStyles",
          globalStylesId,
          _query
        ) || EMPTY_ARRAY4 : EMPTY_ARRAY4;
        const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || EMPTY_ARRAY4;
        const _isResolving = globalStylesId ? isResolving("getRevisions", [
          "root",
          "globalStyles",
          globalStylesId,
          _query
        ]) : false;
        return {
          authors: _authors,
          currentUser: _currentUser,
          isDirty: _isDirty,
          revisions: globalStylesRevisions,
          isLoadingGlobalStylesRevisions: _isResolving,
          revisionsCount: _revisionsCount
        };
      },
      [_query]
    );
    return (0, import_element63.useMemo)(() => {
      if (!authors.length || isLoadingGlobalStylesRevisions) {
        return {
          revisions: EMPTY_ARRAY4,
          hasUnsavedChanges: isDirty,
          isLoading: true,
          revisionsCount
        };
      }
      const _modifiedRevisions = revisions.map((revision) => {
        return {
          ...revision,
          author: authors.find(
            (author) => author.id === revision.author
          )
        };
      });
      const fetchedRevisionsCount = revisions.length;
      if (fetchedRevisionsCount) {
        if (_modifiedRevisions[0].id !== "unsaved" && _query.page === 1) {
          _modifiedRevisions[0].isLatest = true;
        }
        if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) {
          const unsavedRevision = {
            id: "unsaved",
            styles: userConfig?.styles,
            settings: userConfig?.settings,
            _links: userConfig?._links,
            author: {
              name: currentUser?.name || "",
              // @ts-expect-error - avatar_urls is not typed in User
              avatar_urls: currentUser?.avatar_urls || {}
            },
            modified: /* @__PURE__ */ new Date()
          };
          _modifiedRevisions.unshift(unsavedRevision);
        }
        if (_query.per_page && _query.page === Math.ceil(revisionsCount / _query.per_page)) {
          _modifiedRevisions.push({
            id: "parent",
            styles: {},
            settings: {}
          });
        }
      }
      return {
        revisions: _modifiedRevisions,
        hasUnsavedChanges: isDirty,
        isLoading: false,
        revisionsCount
      };
    }, [
      isDirty,
      revisions,
      currentUser,
      authors,
      userConfig,
      isLoadingGlobalStylesRevisions,
      revisionsCount,
      _query.page,
      _query.per_page
    ]);
  }

  // packages/global-styles-ui/build-module/screen-revisions/revisions-buttons.mjs
  var import_i18n97 = __toESM(require_i18n(), 1);
  var import_components81 = __toESM(require_components(), 1);
  var import_date4 = __toESM(require_date(), 1);
  var import_core_data41 = __toESM(require_core_data(), 1);
  var import_data59 = __toESM(require_data(), 1);
  var import_keycodes3 = __toESM(require_keycodes(), 1);
  var import_jsx_runtime173 = __toESM(require_jsx_runtime(), 1);
  var DAY_IN_MILLISECONDS = 60 * 60 * 1e3 * 24;
  function ChangesSummary({ revision, previousRevision }) {
    const changes = getGlobalStylesChanges(
      revision,
      previousRevision,
      {
        maxResults: 7
      }
    );
    if (!changes.length) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
      "ul",
      {
        "data-testid": "global-styles-revision-changes",
        className: "global-styles-ui-screen-revisions__changes",
        children: changes.map((change) => /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("li", { children: change }, change))
      }
    );
  }
  function getRevisionLabel(id, authorDisplayName, formattedModifiedDate, areStylesEqual) {
    if ("parent" === id) {
      return (0, import_i18n97.__)("Reset the styles to the theme defaults");
    }
    if ("unsaved" === id) {
      return (0, import_i18n97.sprintf)(
        /* translators: %s: author display name */
        (0, import_i18n97.__)("Unsaved changes by %s"),
        authorDisplayName
      );
    }
    return areStylesEqual ? (0, import_i18n97.sprintf)(
      // translators: 1: author display name. 2: revision creation date.
      (0, import_i18n97.__)(
        "Changes saved by %1$s on %2$s. This revision matches current editor styles."
      ),
      authorDisplayName,
      formattedModifiedDate
    ) : (0, import_i18n97.sprintf)(
      // translators: 1: author display name. 2: revision creation date.
      (0, import_i18n97.__)("Changes saved by %1$s on %2$s"),
      authorDisplayName,
      formattedModifiedDate
    );
  }
  function RevisionsButtons({
    userRevisions,
    selectedRevisionId,
    onChange,
    canApplyRevision,
    onApplyRevision
  }) {
    const { currentThemeName, currentUser } = (0, import_data59.useSelect)((select5) => {
      const { getCurrentTheme, getCurrentUser } = select5(import_core_data41.store);
      const currentTheme = getCurrentTheme();
      return {
        currentThemeName: currentTheme?.name?.rendered || currentTheme?.stylesheet,
        currentUser: getCurrentUser()
      };
    }, []);
    const dateNowInMs = (0, import_date4.getDate)(null).getTime();
    const { datetimeAbbreviated } = (0, import_date4.getSettings)().formats;
    return /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
      import_components81.Composite,
      {
        orientation: "vertical",
        className: "global-styles-ui-screen-revisions__revisions-list",
        "aria-label": (0, import_i18n97.__)("Global styles revisions list"),
        role: "listbox",
        children: userRevisions.map((revision, index2) => {
          const { id, author, modified } = revision;
          const isUnsaved = "unsaved" === id;
          const revisionAuthor = isUnsaved ? currentUser : author;
          const authorDisplayName = revisionAuthor?.name || (0, import_i18n97.__)("User");
          const authorAvatar = revisionAuthor?.avatar_urls?.["48"];
          const isFirstItem = index2 === 0;
          const isSelected = selectedRevisionId ? selectedRevisionId === id : isFirstItem;
          const areStylesEqual = !canApplyRevision && isSelected;
          const isReset = "parent" === id;
          const modifiedString = modified instanceof Date ? modified.toISOString() : modified;
          const modifiedDate = (0, import_date4.getDate)(modifiedString ?? null);
          const displayDate = modifiedString && dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS ? (0, import_date4.dateI18n)(datetimeAbbreviated, modifiedDate) : (0, import_date4.humanTimeDiff)(
            modifiedString ?? modifiedDate,
            void 0
          );
          const revisionLabel = getRevisionLabel(
            id,
            authorDisplayName,
            (0, import_date4.dateI18n)(datetimeAbbreviated, modifiedDate),
            areStylesEqual
          );
          return /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(
            import_components81.Composite.Item,
            {
              className: "global-styles-ui-screen-revisions__revision-item",
              "aria-current": isSelected,
              role: "option",
              onKeyDown: (event) => {
                const { keyCode } = event;
                if (keyCode === import_keycodes3.ENTER || keyCode === import_keycodes3.SPACE) {
                  onChange(revision);
                }
              },
              onClick: (event) => {
                event.preventDefault();
                onChange(revision);
              },
              "aria-selected": isSelected,
              "aria-label": revisionLabel,
              render: /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", {}),
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("span", { className: "global-styles-ui-screen-revisions__revision-item-wrapper", children: isReset ? /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("span", { className: "global-styles-ui-screen-revisions__description", children: [
                  (0, import_i18n97.__)("Default styles"),
                  /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("span", { className: "global-styles-ui-screen-revisions__meta", children: currentThemeName })
                ] }) : /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("span", { className: "global-styles-ui-screen-revisions__description", children: [
                  isUnsaved ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("span", { className: "global-styles-ui-screen-revisions__date", children: (0, import_i18n97.__)("(Unsaved)") }) : /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
                    "time",
                    {
                      className: "global-styles-ui-screen-revisions__date",
                      dateTime: modifiedString,
                      children: displayDate
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("span", { className: "global-styles-ui-screen-revisions__meta", children: [
                    /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
                      "img",
                      {
                        alt: authorDisplayName,
                        src: authorAvatar
                      }
                    ),
                    authorDisplayName
                  ] }),
                  isSelected && /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
                    ChangesSummary,
                    {
                      revision,
                      previousRevision: index2 < userRevisions.length ? userRevisions[index2 + 1] : void 0
                    }
                  )
                ] }) }),
                isSelected && (areStylesEqual ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "global-styles-ui-screen-revisions__applied-text", children: (0, import_i18n97.__)(
                  "These styles are already applied to your site."
                ) }) : /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
                  import_components81.Button,
                  {
                    size: "compact",
                    variant: "primary",
                    className: "global-styles-ui-screen-revisions__apply-button",
                    onClick: onApplyRevision,
                    "aria-label": (0, import_i18n97.__)(
                      "Apply the selected revision to your site."
                    ),
                    children: isReset ? (0, import_i18n97.__)("Reset to defaults") : (0, import_i18n97.__)("Apply")
                  }
                ))
              ]
            },
            id
          );
        })
      }
    );
  }
  var revisions_buttons_default = RevisionsButtons;

  // packages/global-styles-ui/build-module/pagination/index.mjs
  var import_components82 = __toESM(require_components(), 1);
  var import_i18n98 = __toESM(require_i18n(), 1);
  var import_jsx_runtime174 = __toESM(require_jsx_runtime(), 1);
  function Pagination({
    currentPage,
    numPages,
    changePage,
    totalItems,
    className,
    disabled = false,
    buttonVariant = "tertiary",
    label = (0, import_i18n98.__)("Pagination")
  }) {
    return /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(
      import_components82.__experimentalHStack,
      {
        expanded: false,
        as: "nav",
        "aria-label": label,
        spacing: 3,
        justify: "flex-start",
        className: clsx_default("global-styles-ui-pagination", className),
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
            import_components82.__experimentalText,
            {
              variant: "muted",
              className: "global-styles-ui-pagination__total",
              children: (0, import_i18n98.sprintf)(
                // translators: %d: Total number of patterns.
                (0, import_i18n98._n)("%d item", "%d items", totalItems),
                totalItems
              )
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(import_components82.__experimentalHStack, { expanded: false, spacing: 1, children: [
            /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
              import_components82.Button,
              {
                variant: buttonVariant,
                onClick: () => changePage(1),
                accessibleWhenDisabled: true,
                disabled: disabled || currentPage === 1,
                label: (0, import_i18n98.__)("First page"),
                icon: (0, import_i18n98.isRTL)() ? next_default : previous_default,
                size: "compact"
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
              import_components82.Button,
              {
                variant: buttonVariant,
                onClick: () => changePage(currentPage - 1),
                accessibleWhenDisabled: true,
                disabled: disabled || currentPage === 1,
                label: (0, import_i18n98.__)("Previous page"),
                icon: (0, import_i18n98.isRTL)() ? chevron_right_default : chevron_left_default,
                size: "compact"
              }
            )
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(import_components82.__experimentalText, { variant: "muted", children: (0, import_i18n98.sprintf)(
            // translators: 1: Current page number. 2: Total number of pages.
            (0, import_i18n98._x)("%1$d of %2$d", "paging"),
            currentPage,
            numPages
          ) }),
          /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(import_components82.__experimentalHStack, { expanded: false, spacing: 1, children: [
            /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
              import_components82.Button,
              {
                variant: buttonVariant,
                onClick: () => changePage(currentPage + 1),
                accessibleWhenDisabled: true,
                disabled: disabled || currentPage === numPages,
                label: (0, import_i18n98.__)("Next page"),
                icon: (0, import_i18n98.isRTL)() ? chevron_left_default : chevron_right_default,
                size: "compact"
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
              import_components82.Button,
              {
                variant: buttonVariant,
                onClick: () => changePage(numPages),
                accessibleWhenDisabled: true,
                disabled: disabled || currentPage === numPages,
                label: (0, import_i18n98.__)("Last page"),
                icon: (0, import_i18n98.isRTL)() ? previous_default : next_default,
                size: "compact"
              }
            )
          ] })
        ]
      }
    );
  }

  // packages/global-styles-ui/build-module/screen-revisions/index.mjs
  var import_jsx_runtime175 = __toESM(require_jsx_runtime(), 1);
  var PAGE_SIZE = 10;
  function ScreenRevisions({ onClose } = {}) {
    const { user: currentEditorGlobalStyles, onChange: setUserConfig } = (0, import_element64.useContext)(GlobalStylesContext);
    const { params, goTo } = (0, import_components83.useNavigator)();
    const { revisionId } = params;
    const [currentPage, setCurrentPage] = (0, import_element64.useState)(1);
    const { revisions, isLoading, hasUnsavedChanges, revisionsCount } = useGlobalStylesRevisions({
      query: {
        per_page: PAGE_SIZE,
        page: currentPage
      }
    });
    const numPages = Math.ceil(revisionsCount / PAGE_SIZE);
    const [
      isLoadingRevisionWithUnsavedChanges,
      setIsLoadingRevisionWithUnsavedChanges
    ] = (0, import_element64.useState)(false);
    const currentlySelectedRevision = (0, import_element64.useMemo)(() => {
      if (!revisionId) {
        return currentEditorGlobalStyles;
      }
      const revision = revisions.find(
        (rev) => String(rev.id) === String(revisionId)
      );
      return revision || currentEditorGlobalStyles;
    }, [revisionId, revisions, currentEditorGlobalStyles]);
    const selectedRevisionMatchesEditorStyles = areGlobalStylesEqual(
      currentlySelectedRevision,
      currentEditorGlobalStyles
    );
    const onCloseRevisions = () => {
      if (onClose) {
        onClose();
      }
    };
    const restoreRevision = (revision) => {
      setUserConfig(revision);
      setIsLoadingRevisionWithUnsavedChanges(false);
      onCloseRevisions();
    };
    const handleRevisionSelect = (revision) => {
      goTo(`/revisions/${revision.id}`);
    };
    const currentlySelectedRevisionId = (
      // @ts-expect-error: revision id is not present in the fallback (default object).
      currentlySelectedRevision?.id ?? revisions[0]?.id
    );
    const isLoadButtonEnabled = !!currentlySelectedRevisionId && currentlySelectedRevisionId !== "unsaved" && !selectedRevisionMatchesEditorStyles;
    const hasRevisions = !!revisions.length;
    return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(import_jsx_runtime175.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
        ScreenHeader,
        {
          title: revisionsCount ? (0, import_i18n99.sprintf)(
            // translators: %d: number of revisions.
            (0, import_i18n99.__)("Revisions (%d)"),
            revisionsCount
          ) : (0, import_i18n99.__)("Revisions"),
          description: (0, import_i18n99.__)(
            `Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you're ready, use the Save button to save your changes.`
          ),
          onBack: onCloseRevisions
        }
      ),
      !hasRevisions && /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(import_components83.Spinner, { className: "global-styles-ui-screen-revisions__loading" }),
      /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
        revisions_buttons_default,
        {
          onChange: handleRevisionSelect,
          selectedRevisionId: currentlySelectedRevisionId,
          userRevisions: revisions,
          canApplyRevision: isLoadButtonEnabled,
          onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision)
        }
      ),
      numPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("div", { className: "global-styles-ui-screen-revisions__footer", children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
        Pagination,
        {
          className: "global-styles-ui-screen-revisions__pagination",
          currentPage,
          numPages,
          changePage: setCurrentPage,
          totalItems: revisionsCount,
          disabled: isLoading,
          label: (0, import_i18n99.__)("Global Styles pagination")
        }
      ) }),
      isLoadingRevisionWithUnsavedChanges && /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
        import_components83.__experimentalConfirmDialog,
        {
          isOpen: isLoadingRevisionWithUnsavedChanges,
          confirmButtonText: (0, import_i18n99.__)("Apply"),
          onConfirm: () => restoreRevision(currentlySelectedRevision),
          onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false),
          size: "medium",
          children: (0, import_i18n99.__)(
            "Are you sure you want to apply this revision? Any unsaved changes will be lost."
          )
        }
      )
    ] });
  }
  var screen_revisions_default = ScreenRevisions;

  // packages/global-styles-ui/build-module/font-sizes/font-sizes.mjs
  var import_i18n101 = __toESM(require_i18n(), 1);
  var import_components85 = __toESM(require_components(), 1);
  var import_element65 = __toESM(require_element(), 1);

  // packages/global-styles-ui/build-module/font-sizes/confirm-reset-font-sizes-dialog.mjs
  var import_components84 = __toESM(require_components(), 1);
  var import_i18n100 = __toESM(require_i18n(), 1);
  var import_jsx_runtime176 = __toESM(require_jsx_runtime(), 1);
  function ConfirmResetFontSizesDialog({
    text,
    confirmButtonText,
    isOpen,
    toggleOpen,
    onConfirm
  }) {
    const handleConfirm = async () => {
      toggleOpen();
      onConfirm();
    };
    const handleCancel = () => {
      toggleOpen();
    };
    return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
      import_components84.__experimentalConfirmDialog,
      {
        isOpen,
        cancelButtonText: (0, import_i18n100.__)("Cancel"),
        confirmButtonText,
        onCancel: handleCancel,
        onConfirm: handleConfirm,
        size: "medium",
        children: text
      }
    );
  }
  var confirm_reset_font_sizes_dialog_default = ConfirmResetFontSizesDialog;

  // packages/global-styles-ui/build-module/font-sizes/font-sizes.mjs
  var import_jsx_runtime177 = __toESM(require_jsx_runtime(), 1);
  var { Menu: Menu3 } = unlock3(import_components85.privateApis);
  function FontSizeGroup({
    label,
    origin,
    sizes,
    handleAddFontSize,
    handleResetFontSizes
  }) {
    const [isResetDialogOpen, setIsResetDialogOpen] = (0, import_element65.useState)(false);
    const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen);
    const resetDialogText = origin === "custom" ? (0, import_i18n101.__)(
      "Are you sure you want to remove all custom font size presets?"
    ) : (0, import_i18n101.__)(
      "Are you sure you want to reset all font size presets to their default values?"
    );
    return /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_jsx_runtime177.Fragment, { children: [
      handleResetFontSizes && isResetDialogOpen && /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
        confirm_reset_font_sizes_dialog_default,
        {
          text: resetDialogText,
          confirmButtonText: origin === "custom" ? (0, import_i18n101.__)("Remove") : (0, import_i18n101.__)("Reset"),
          isOpen: isResetDialogOpen,
          toggleOpen: toggleResetDialog,
          onConfirm: handleResetFontSizes
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_components85.__experimentalVStack, { spacing: 4, children: [
        /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_components85.__experimentalHStack, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(Subtitle, { level: 3, children: label }),
          /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_components85.FlexItem, { className: "global-styles-ui__typography-panel__options-container", children: [
            origin === "custom" && /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
              import_components85.Button,
              {
                label: (0, import_i18n101.__)("Add font size"),
                icon: plus_default,
                size: "small",
                onClick: handleAddFontSize
              }
            ),
            !!handleResetFontSizes && /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(Menu3, { children: [
              /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
                Menu3.TriggerButton,
                {
                  render: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
                    import_components85.Button,
                    {
                      size: "small",
                      icon: more_vertical_default,
                      label: (0, import_i18n101.__)(
                        "Font size presets options"
                      )
                    }
                  )
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(Menu3.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(Menu3.Item, { onClick: toggleResetDialog, children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(Menu3.ItemLabel, { children: origin === "custom" ? (0, import_i18n101.__)(
                "Remove font size presets"
              ) : (0, import_i18n101.__)(
                "Reset font size presets"
              ) }) }) })
            ] })
          ] })
        ] }),
        !!sizes.length && /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_components85.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: sizes.map((size3) => /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
          NavigationButtonAsItem,
          {
            path: `/typography/font-sizes/${origin}/${size3.slug}`,
            children: /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_components85.__experimentalHStack, { children: [
              /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_components85.FlexItem, { className: "global-styles-ui-font-size__item", children: size3.name }),
              /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_components85.FlexItem, { display: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
                icon_default,
                {
                  icon: (0, import_i18n101.isRTL)() ? chevron_left_default : chevron_right_default
                }
              ) })
            ] })
          },
          size3.slug
        )) })
      ] })
    ] });
  }
  function FontSizes2() {
    const [themeFontSizes, setThemeFontSizes] = useSetting(
      "typography.fontSizes.theme"
    );
    const [baseThemeFontSizes] = useSetting(
      "typography.fontSizes.theme",
      "base"
    );
    const [defaultFontSizes, setDefaultFontSizes] = useSetting(
      "typography.fontSizes.default"
    );
    const [baseDefaultFontSizes] = useSetting(
      "typography.fontSizes.default",
      "base"
    );
    const [customFontSizes = [], setCustomFontSizes] = useSetting(
      "typography.fontSizes.custom"
    );
    const [defaultFontSizesEnabled] = useSetting(
      "typography.defaultFontSizes"
    );
    const handleAddFontSize = () => {
      const index2 = getNewIndexFromPresets(customFontSizes, "custom-");
      const newFontSize = {
        /* translators: %d: font size index */
        name: (0, import_i18n101.sprintf)((0, import_i18n101.__)("New Font Size %d"), index2),
        size: "16px",
        slug: `custom-${index2}`
      };
      setCustomFontSizes([...customFontSizes, newFontSize]);
    };
    const hasSameSizeValues = (arr1, arr2) => arr1.map((item) => item.size).join("") === arr2.map((item) => item.size).join("");
    return /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_components85.__experimentalVStack, { spacing: 2, children: [
      /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
        ScreenHeader,
        {
          title: (0, import_i18n101.__)("Font size presets"),
          description: (0, import_i18n101.__)(
            "Create and edit the presets used for font sizes across the site."
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_components85.__experimentalView, { children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_components85.__experimentalSpacer, { paddingX: 4, children: /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_components85.__experimentalVStack, { spacing: 8, children: [
        !!themeFontSizes?.length && /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
          FontSizeGroup,
          {
            label: (0, import_i18n101.__)("Theme"),
            origin: "theme",
            sizes: themeFontSizes,
            handleAddFontSize,
            handleResetFontSizes: hasSameSizeValues(
              themeFontSizes,
              baseThemeFontSizes
            ) ? void 0 : () => setThemeFontSizes(
              baseThemeFontSizes
            )
          }
        ),
        defaultFontSizesEnabled && !!defaultFontSizes?.length && /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
          FontSizeGroup,
          {
            label: (0, import_i18n101.__)("Default"),
            origin: "default",
            sizes: defaultFontSizes,
            handleAddFontSize,
            handleResetFontSizes: hasSameSizeValues(
              defaultFontSizes,
              baseDefaultFontSizes
            ) ? void 0 : () => setDefaultFontSizes(
              baseDefaultFontSizes
            )
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
          FontSizeGroup,
          {
            label: (0, import_i18n101.__)("Custom"),
            origin: "custom",
            sizes: customFontSizes,
            handleAddFontSize,
            handleResetFontSizes: customFontSizes.length > 0 ? () => setCustomFontSizes([]) : void 0
          }
        )
      ] }) }) })
    ] });
  }
  var font_sizes_default = FontSizes2;

  // packages/global-styles-ui/build-module/font-sizes/font-size.mjs
  var import_i18n105 = __toESM(require_i18n(), 1);
  var import_components89 = __toESM(require_components(), 1);
  var import_element67 = __toESM(require_element(), 1);

  // packages/global-styles-ui/build-module/font-sizes/font-size-preview.mjs
  var import_block_editor30 = __toESM(require_block_editor(), 1);
  var import_i18n102 = __toESM(require_i18n(), 1);
  var import_jsx_runtime178 = __toESM(require_jsx_runtime(), 1);
  function FontSizePreview({ fontSize }) {
    const [font2] = useStyle("typography");
    const input = typeof fontSize?.fluid === "object" && fontSize?.fluid?.min && fontSize?.fluid?.max ? {
      minimumFontSize: fontSize.fluid.min,
      maximumFontSize: fontSize.fluid.max
    } : {
      fontSize: fontSize.size
    };
    const computedFontSize = (0, import_block_editor30.getComputedFluidTypographyValue)(input);
    return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
      "div",
      {
        className: "global-styles-ui-typography-preview",
        style: {
          fontSize: computedFontSize,
          fontFamily: font2?.fontFamily ?? "serif"
        },
        children: (0, import_i18n102.__)("Aa")
      }
    );
  }
  var font_size_preview_default = FontSizePreview;

  // packages/global-styles-ui/build-module/font-sizes/confirm-delete-font-size-dialog.mjs
  var import_components86 = __toESM(require_components(), 1);
  var import_i18n103 = __toESM(require_i18n(), 1);
  var import_jsx_runtime179 = __toESM(require_jsx_runtime(), 1);
  function ConfirmDeleteFontSizeDialog({
    fontSize,
    isOpen,
    toggleOpen,
    handleRemoveFontSize
  }) {
    const handleConfirm = async () => {
      toggleOpen();
      handleRemoveFontSize(fontSize);
    };
    const handleCancel = () => {
      toggleOpen();
    };
    return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
      import_components86.__experimentalConfirmDialog,
      {
        isOpen,
        cancelButtonText: (0, import_i18n103.__)("Cancel"),
        confirmButtonText: (0, import_i18n103.__)("Delete"),
        onCancel: handleCancel,
        onConfirm: handleConfirm,
        size: "medium",
        children: fontSize && (0, import_i18n103.sprintf)(
          /* translators: %s: Name of the font size preset. */
          (0, import_i18n103.__)(
            'Are you sure you want to delete "%s" font size preset?'
          ),
          fontSize.name
        )
      }
    );
  }
  var confirm_delete_font_size_dialog_default = ConfirmDeleteFontSizeDialog;

  // packages/global-styles-ui/build-module/font-sizes/rename-font-size-dialog.mjs
  var import_components87 = __toESM(require_components(), 1);
  var import_i18n104 = __toESM(require_i18n(), 1);
  var import_element66 = __toESM(require_element(), 1);
  var import_jsx_runtime180 = __toESM(require_jsx_runtime(), 1);
  function RenameFontSizeDialog({
    fontSize,
    toggleOpen,
    handleRename
  }) {
    const [newName, setNewName] = (0, import_element66.useState)(
      fontSize.name
    );
    const handleConfirm = () => {
      if (newName && newName.trim()) {
        handleRename(newName);
      }
      toggleOpen();
    };
    return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
      import_components87.Modal,
      {
        onRequestClose: toggleOpen,
        focusOnMount: "firstContentElement",
        title: (0, import_i18n104.__)("Rename"),
        size: "small",
        children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
          "form",
          {
            onSubmit: (event) => {
              event.preventDefault();
              handleConfirm();
              toggleOpen();
            },
            children: /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(import_components87.__experimentalVStack, { spacing: "3", children: [
              /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
                import_components87.__experimentalInputControl,
                {
                  __next40pxDefaultSize: true,
                  autoComplete: "off",
                  value: newName,
                  onChange: setNewName,
                  label: (0, import_i18n104.__)("Name"),
                  placeholder: (0, import_i18n104.__)("Font size preset name")
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(import_components87.__experimentalHStack, { justify: "right", children: [
                /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
                  import_components87.Button,
                  {
                    __next40pxDefaultSize: true,
                    variant: "tertiary",
                    onClick: toggleOpen,
                    children: (0, import_i18n104.__)("Cancel")
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
                  import_components87.Button,
                  {
                    __next40pxDefaultSize: true,
                    variant: "primary",
                    type: "submit",
                    children: (0, import_i18n104.__)("Save")
                  }
                )
              ] })
            ] })
          }
        )
      }
    );
  }
  var rename_font_size_dialog_default = RenameFontSizeDialog;

  // packages/global-styles-ui/build-module/size-control/index.mjs
  var import_components88 = __toESM(require_components(), 1);
  var import_jsx_runtime181 = __toESM(require_jsx_runtime(), 1);
  var DEFAULT_UNITS = ["px", "em", "rem", "vw", "vh"];
  function SizeControl(props) {
    const { baseControlProps } = (0, import_components88.useBaseControlProps)(props);
    const { value, onChange, fallbackValue, disabled, label } = props;
    const units = (0, import_components88.__experimentalUseCustomUnits)({
      availableUnits: DEFAULT_UNITS
    });
    const [valueQuantity, valueUnit = "px"] = (0, import_components88.__experimentalParseQuantityAndUnitFromRawValue)(value, units);
    const isValueUnitRelative = !!valueUnit && ["em", "rem", "vw", "vh"].includes(valueUnit);
    const handleUnitControlChange = (newValue) => {
      onChange?.(newValue);
    };
    const handleRangeControlChange = (newValue) => {
      if (newValue !== void 0) {
        onChange?.(newValue + valueUnit);
      } else {
        onChange?.(void 0);
      }
    };
    return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(import_components88.BaseControl, { ...baseControlProps, children: /* @__PURE__ */ (0, import_jsx_runtime181.jsxs)(import_components88.Flex, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(import_components88.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
        import_components88.__experimentalUnitControl,
        {
          __next40pxDefaultSize: true,
          label,
          hideLabelFromVision: true,
          value,
          onChange: handleUnitControlChange,
          units,
          min: 0,
          disabled
        }
      ) }),
      /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(import_components88.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(import_components88.__experimentalSpacer, { marginX: 2, marginBottom: 0, children: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
        import_components88.RangeControl,
        {
          __next40pxDefaultSize: true,
          label,
          hideLabelFromVision: true,
          value: valueQuantity,
          initialPosition: fallbackValue,
          withInputField: false,
          onChange: handleRangeControlChange,
          min: 0,
          max: isValueUnitRelative ? 10 : 100,
          step: isValueUnitRelative ? 0.1 : 1,
          disabled
        }
      ) }) })
    ] }) });
  }

  // packages/global-styles-ui/build-module/font-sizes/font-size.mjs
  var import_jsx_runtime182 = __toESM(require_jsx_runtime(), 1);
  var { Menu: Menu4 } = unlock3(import_components89.privateApis);
  function FontSize() {
    const [isDeleteConfirmOpen, setIsDeleteConfirmOpen] = (0, import_element67.useState)(false);
    const [isRenameDialogOpen, setIsRenameDialogOpen] = (0, import_element67.useState)(false);
    const {
      params: { origin, slug },
      goBack
    } = (0, import_components89.useNavigator)();
    const [fontSizes, setFontSizes] = useSetting("typography.fontSizes");
    const [globalFluid] = useSetting("typography.fluid");
    const sizes = fontSizes?.[origin] ?? [];
    const fontSize = sizes.find(
      (size3) => size3.slug === slug
    );
    (0, import_element67.useEffect)(() => {
      if (!!slug && !fontSize) {
        goBack();
      }
    }, [slug, fontSize, goBack]);
    if (!origin || !slug || !fontSize) {
      return null;
    }
    const isFluid = fontSize?.fluid !== void 0 ? !!fontSize.fluid : !!globalFluid;
    const isCustomFluid = typeof fontSize?.fluid === "object";
    const handleNameChange = (value) => {
      updateFontSize("name", value);
    };
    const handleFontSizeChange = (value) => {
      updateFontSize("size", value);
    };
    const handleFluidChange = (value) => {
      updateFontSize("fluid", value);
    };
    const handleCustomFluidValues = (value) => {
      if (value) {
        updateFontSize("fluid", {
          min: fontSize.size,
          max: fontSize.size
        });
      } else {
        updateFontSize("fluid", true);
      }
    };
    const handleMinChange = (value) => {
      const fluid = typeof fontSize.fluid === "object" ? fontSize.fluid : {};
      updateFontSize("fluid", { ...fluid, min: value });
    };
    const handleMaxChange = (value) => {
      const fluid = typeof fontSize.fluid === "object" ? fontSize.fluid : {};
      updateFontSize("fluid", { ...fluid, max: value });
    };
    const updateFontSize = (key, value) => {
      const newFontSizes = sizes.map((size3) => {
        if (size3.slug === slug) {
          return { ...size3, [key]: value };
        }
        return size3;
      });
      setFontSizes({
        ...fontSizes,
        [origin]: newFontSizes
      });
    };
    const handleRemoveFontSize = () => {
      const newFontSizes = sizes.filter((size3) => size3.slug !== slug);
      setFontSizes({
        ...fontSizes,
        [origin]: newFontSizes
      });
    };
    const toggleDeleteConfirm = () => {
      setIsDeleteConfirmOpen(!isDeleteConfirmOpen);
    };
    const toggleRenameDialog = () => {
      setIsRenameDialogOpen(!isRenameDialogOpen);
    };
    return /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)(import_jsx_runtime182.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
        confirm_delete_font_size_dialog_default,
        {
          fontSize,
          isOpen: isDeleteConfirmOpen,
          toggleOpen: toggleDeleteConfirm,
          handleRemoveFontSize
        }
      ),
      isRenameDialogOpen && /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
        rename_font_size_dialog_default,
        {
          fontSize,
          toggleOpen: toggleRenameDialog,
          handleRename: handleNameChange
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)(import_components89.__experimentalVStack, { spacing: 4, children: [
        /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)(import_components89.__experimentalHStack, { justify: "space-between", alignment: "flex-start", children: [
          /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
            ScreenHeader,
            {
              title: fontSize.name,
              description: (0, import_i18n105.sprintf)(
                /* translators: %s: font size preset name. */
                (0, import_i18n105.__)("Manage the font size %s."),
                fontSize.name
              )
            }
          ),
          origin === "custom" && /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(import_components89.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
            import_components89.__experimentalSpacer,
            {
              marginTop: 3,
              marginBottom: 0,
              paddingX: 4,
              children: /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)(Menu4, { children: [
                /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
                  Menu4.TriggerButton,
                  {
                    render: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
                      import_components89.Button,
                      {
                        size: "small",
                        icon: more_vertical_default,
                        label: (0, import_i18n105.__)(
                          "Font size options"
                        )
                      }
                    )
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)(Menu4.Popover, { children: [
                  /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
                    Menu4.Item,
                    {
                      onClick: toggleRenameDialog,
                      children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(Menu4.ItemLabel, { children: (0, import_i18n105.__)("Rename") })
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
                    Menu4.Item,
                    {
                      onClick: toggleDeleteConfirm,
                      children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(Menu4.ItemLabel, { children: (0, import_i18n105.__)("Delete") })
                    }
                  )
                ] })
              ] })
            }
          ) })
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(import_components89.__experimentalView, { children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
          import_components89.__experimentalSpacer,
          {
            paddingX: 4,
            marginBottom: 0,
            paddingBottom: 6,
            children: /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)(import_components89.__experimentalVStack, { spacing: 4, children: [
              /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(import_components89.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(font_size_preview_default, { fontSize }) }),
              /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
                SizeControl,
                {
                  label: (0, import_i18n105.__)("Size"),
                  value: !isCustomFluid && fontSize.size ? String(fontSize.size) : "",
                  onChange: handleFontSizeChange,
                  disabled: isCustomFluid
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
                import_components89.ToggleControl,
                {
                  label: (0, import_i18n105.__)("Fluid typography"),
                  help: (0, import_i18n105.__)(
                    "Scale the font size dynamically to fit the screen or viewport."
                  ),
                  checked: isFluid,
                  onChange: handleFluidChange
                }
              ),
              isFluid && /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
                import_components89.ToggleControl,
                {
                  label: (0, import_i18n105.__)("Custom fluid values"),
                  help: (0, import_i18n105.__)(
                    "Set custom min and max values for the fluid font size."
                  ),
                  checked: isCustomFluid,
                  onChange: handleCustomFluidValues
                }
              ),
              isCustomFluid && /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)(import_jsx_runtime182.Fragment, { children: [
                /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
                  SizeControl,
                  {
                    label: (0, import_i18n105.__)("Minimum"),
                    value: typeof fontSize?.fluid === "object" ? fontSize.fluid?.min : void 0,
                    onChange: handleMinChange
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
                  SizeControl,
                  {
                    label: (0, import_i18n105.__)("Maximum"),
                    value: typeof fontSize?.fluid === "object" ? fontSize.fluid?.max : void 0,
                    onChange: handleMaxChange
                  }
                )
              ] })
            ] })
          }
        ) })
      ] })
    ] });
  }
  var font_size_default = FontSize;

  // packages/global-styles-ui/build-module/global-styles-ui.mjs
  var import_jsx_runtime183 = __toESM(require_jsx_runtime(), 1);
  function BlockStylesNavigationScreens({
    parentMenu,
    blockStyles,
    blockName
  }) {
    return /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(import_jsx_runtime183.Fragment, { children: blockStyles.map((style, index2) => /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
      import_components90.Navigator.Screen,
      {
        path: parentMenu + "/variations/" + style.name,
        children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_block_default, { name: blockName, variation: style.name })
      },
      index2
    )) });
  }
  function ContextScreens({ name: name2, parentMenu = "" }) {
    const blockStyleVariations = (0, import_data60.useSelect)(
      (select5) => {
        if (!name2) {
          return [];
        }
        const { getBlockStyles } = select5(import_blocks18.store);
        return getBlockStyles(name2);
      },
      [name2]
    );
    if (!blockStyleVariations?.length) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
      BlockStylesNavigationScreens,
      {
        parentMenu,
        blockStyles: blockStyleVariations,
        blockName: name2 || ""
      }
    );
  }
  function GlobalStylesUI({
    value,
    baseValue,
    onChange,
    path,
    onPathChange,
    fontLibraryEnabled = false,
    serverCSS,
    serverSettings
  }) {
    const blocks = (0, import_blocks18.getBlockTypes)();
    const mergedValue = (0, import_element68.useMemo)(() => {
      return mergeGlobalStyles(baseValue, value);
    }, [baseValue, value]);
    const [globalStylesCSS, globalSettings] = generateGlobalStyles(
      mergedValue,
      [],
      {
        styleOptions: { variationStyles: true }
      }
    );
    const styles = (0, import_element68.useMemo)(
      () => [...serverCSS ?? [], ...globalStylesCSS ?? []],
      [serverCSS, globalStylesCSS]
    );
    const settings = (0, import_element68.useMemo)(() => {
      return {
        ...serverSettings,
        __experimentalFeatures: globalSettings,
        styles
      };
    }, [globalSettings, serverSettings, styles]);
    return /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
      GlobalStylesProvider,
      {
        value,
        baseValue,
        onChange,
        fontLibraryEnabled,
        children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(import_block_editor31.BlockEditorProvider, { settings, children: /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(
          import_components90.Navigator,
          {
            className: "global-styles-ui-sidebar__navigator-provider",
            initialPath: path || "/",
            children: [
              (path || onPathChange) && /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
                PathSynchronizer,
                {
                  path,
                  onPathChange
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_root_default, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/colors", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_colors_default, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/typography", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_typography_default, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/typography/font-sizes", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(font_sizes_default, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/typography/font-sizes/:origin/:slug", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(font_size_default, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/layout", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_layout_default, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/colors/palette", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_color_palette_default, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/variations", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_style_variations_default, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/css", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_css_default, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/revisions/:revisionId?", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_revisions_default, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/shadows", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(ScreenShadows, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/shadows/edit/:category/:slug", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(ScreenShadowsEdit, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/background", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_background_default, {}) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/typography/text", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_typography_element_default, { element: "text" }) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/typography/link", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_typography_element_default, { element: "link" }) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/typography/heading", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_typography_element_default, { element: "heading" }) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/typography/caption", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_typography_element_default, { element: "caption" }) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/typography/button", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_typography_element_default, { element: "button" }) }),
              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(GlobalStylesNavigationScreen, { path: "/blocks", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_block_list_default, {}) }),
              blocks.map((block) => /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(import_element68.Fragment, { children: [
                /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
                  GlobalStylesNavigationScreen,
                  {
                    path: "/blocks/" + encodeURIComponent(block.name),
                    children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(screen_block_default, { name: block.name })
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
                  ContextScreens,
                  {
                    name: block.name,
                    parentMenu: "/blocks/" + encodeURIComponent(block.name)
                  }
                )
              ] }, block.name))
            ]
          }
        ) })
      }
    );
  }
  function GlobalStylesNavigationScreen({
    path,
    children
  }) {
    return /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
      import_components90.Navigator.Screen,
      {
        className: "global-styles-ui-sidebar__navigator-screen",
        path,
        children
      }
    );
  }
  function PathSynchronizer({
    path,
    onPathChange
  }) {
    const navigator = (0, import_components90.useNavigator)();
    const { path: childPath } = navigator.location;
    const previousParentPath = (0, import_compose14.usePrevious)(path);
    const previousChildPath = (0, import_compose14.usePrevious)(childPath);
    (0, import_element68.useEffect)(() => {
      if (path && path !== childPath) {
        if (path !== previousParentPath) {
          navigator.goTo(path);
        } else if (childPath !== previousChildPath && onPathChange) {
          onPathChange(childPath ?? "/");
        }
      }
    }, [
      onPathChange,
      path,
      previousChildPath,
      previousParentPath,
      childPath,
      navigator
    ]);
    return null;
  }

  // packages/global-styles-ui/build-module/with-global-styles-provider.mjs
  var import_jsx_runtime184 = __toESM(require_jsx_runtime(), 1);
  function withGlobalStylesProvider(Component6) {
    return function WrappedComponent({
      value,
      baseValue,
      onChange,
      ...props
    }) {
      return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
        GlobalStylesProvider,
        {
          value,
          baseValue,
          onChange,
          children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(Component6, { ...props })
        }
      );
    };
  }

  // packages/global-styles-ui/build-module/style-variations.mjs
  var StyleVariations = withGlobalStylesProvider(style_variations_container_default);

  // packages/global-styles-ui/build-module/color-variations.mjs
  var ColorVariations2 = withGlobalStylesProvider(ColorVariations);

  // packages/global-styles-ui/build-module/typography-variations.mjs
  var TypographyVariations2 = withGlobalStylesProvider(TypographyVariations);

  // packages/global-styles-ui/build-module/font-library/font-library.mjs
  var import_jsx_runtime185 = __toESM(require_jsx_runtime(), 1);

  // packages/editor/build-module/components/global-styles/index.mjs
  var import_media_utils4 = __toESM(require_media_utils(), 1);

  // packages/editor/build-module/components/global-styles/block-link.mjs
  var import_data61 = __toESM(require_data(), 1);
  var import_element69 = __toESM(require_element(), 1);
  var import_block_editor32 = __toESM(require_block_editor(), 1);
  var import_compose15 = __toESM(require_compose(), 1);
  function GlobalStylesBlockLink({ path, onPathChange }) {
    const { selectedBlockName, selectedBlockClientId } = (0, import_data61.useSelect)(
      (select5) => {
        const { getSelectedBlockClientId: getSelectedBlockClientId2, getBlockName: getBlockName2 } = select5(import_block_editor32.store);
        const clientId = getSelectedBlockClientId2();
        return {
          selectedBlockName: getBlockName2(clientId),
          selectedBlockClientId: clientId
        };
      },
      []
    );
    const blockHasGlobalStyles = true;
    const previousBlockClientId = (0, import_compose15.usePrevious)(selectedBlockClientId);
    (0, import_element69.useEffect)(() => {
      if (selectedBlockClientId === previousBlockClientId) {
        return;
      }
      if (!selectedBlockClientId || !blockHasGlobalStyles) {
        return;
      }
      if (!path || path !== "/blocks" && !path.startsWith("/blocks/")) {
        return;
      }
      const newPath = "/blocks/" + encodeURIComponent(selectedBlockName);
      if (newPath !== path) {
        onPathChange?.(newPath);
      }
    }, [
      selectedBlockClientId,
      previousBlockClientId,
      selectedBlockName,
      blockHasGlobalStyles,
      path,
      onPathChange
    ]);
    return null;
  }

  // packages/editor/build-module/components/global-styles/hooks.mjs
  var import_element70 = __toESM(require_element(), 1);
  var import_core_data42 = __toESM(require_core_data(), 1);
  var import_data62 = __toESM(require_data(), 1);
  var import_block_editor33 = __toESM(require_block_editor(), 1);
  var { cleanEmptyObject: cleanEmptyObject2 } = unlock(import_block_editor33.privateApis);
  function useGlobalStylesUserConfig2() {
    const { globalStylesId, isReady: isReady2, settings, styles, _links } = (0, import_data62.useSelect)(
      (select5) => {
        const {
          getEntityRecord,
          getEditedEntityRecord: getEditedEntityRecord2,
          hasFinishedResolution,
          canUser
        } = select5(import_core_data42.store);
        const _globalStylesId = select5(import_core_data42.store).__experimentalGetCurrentGlobalStylesId();
        let record;
        const userCanEditGlobalStyles = _globalStylesId ? canUser("update", {
          kind: "root",
          name: "globalStyles",
          id: _globalStylesId
        }) : null;
        if (_globalStylesId && typeof userCanEditGlobalStyles === "boolean") {
          if (userCanEditGlobalStyles) {
            record = getEditedEntityRecord2(
              "root",
              "globalStyles",
              _globalStylesId
            );
          } else {
            record = getEntityRecord(
              "root",
              "globalStyles",
              _globalStylesId,
              { context: "view" }
            );
          }
        }
        let hasResolved = false;
        if (hasFinishedResolution(
          "__experimentalGetCurrentGlobalStylesId"
        )) {
          if (_globalStylesId) {
            hasResolved = userCanEditGlobalStyles ? hasFinishedResolution("getEditedEntityRecord", [
              "root",
              "globalStyles",
              _globalStylesId
            ]) : hasFinishedResolution("getEntityRecord", [
              "root",
              "globalStyles",
              _globalStylesId,
              { context: "view" }
            ]);
          } else {
            hasResolved = true;
          }
        }
        return {
          globalStylesId: _globalStylesId,
          isReady: hasResolved,
          settings: record?.settings,
          styles: record?.styles,
          _links: record?._links
        };
      },
      []
    );
    const { getEditedEntityRecord } = (0, import_data62.useSelect)(import_core_data42.store);
    const { editEntityRecord } = (0, import_data62.useDispatch)(import_core_data42.store);
    const config = (0, import_element70.useMemo)(() => {
      return {
        settings: settings ?? {},
        styles: styles ?? {},
        _links: _links ?? {}
      };
    }, [settings, styles, _links]);
    const setConfig = (0, import_element70.useCallback)(
      (callbackOrObject, options = {}) => {
        const record = getEditedEntityRecord(
          "root",
          "globalStyles",
          globalStylesId
        );
        const currentConfig = {
          styles: record?.styles ?? {},
          settings: record?.settings ?? {},
          _links: record?._links ?? {}
        };
        const updatedConfig = typeof callbackOrObject === "function" ? callbackOrObject(currentConfig) : callbackOrObject;
        editEntityRecord(
          "root",
          "globalStyles",
          globalStylesId,
          {
            styles: cleanEmptyObject2(updatedConfig.styles) || {},
            settings: cleanEmptyObject2(updatedConfig.settings) || {},
            _links: cleanEmptyObject2(updatedConfig._links) || {}
          },
          options
        );
      },
      [globalStylesId, editEntityRecord, getEditedEntityRecord]
    );
    return [isReady2, config, setConfig];
  }
  function useGlobalStylesBaseConfig2() {
    const baseConfig = (0, import_data62.useSelect)(
      (select5) => select5(import_core_data42.store).__experimentalGetCurrentThemeBaseGlobalStyles(),
      []
    );
    return [!!baseConfig, baseConfig];
  }
  function useGlobalStyles() {
    const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig2();
    const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig2();
    const merged = (0, import_element70.useMemo)(() => {
      if (!isUserConfigReady || !isBaseConfigReady) {
        return {};
      }
      return mergeGlobalStyles(baseConfig || {}, userConfig);
    }, [isUserConfigReady, isBaseConfigReady, baseConfig, userConfig]);
    return {
      merged,
      base: baseConfig || {},
      user: userConfig,
      setUser: setUserConfig,
      isReady: isUserConfigReady && isBaseConfigReady
    };
  }
  function useStyle2(path, blockName) {
    const { merged } = useGlobalStyles();
    return (0, import_element70.useMemo)(
      () => getStyle(merged, path, blockName),
      [merged, path, blockName]
    );
  }
  function useSetting2(path, blockName) {
    const { merged } = useGlobalStyles();
    return (0, import_element70.useMemo)(
      () => getSetting(merged, path, blockName),
      [merged, path, blockName]
    );
  }

  // packages/editor/build-module/components/global-styles/index.mjs
  var import_jsx_runtime186 = __toESM(require_jsx_runtime(), 1);
  function useServerData() {
    const {
      styles,
      __unstableResolvedAssets,
      colors,
      gradients,
      __experimentalDiscussionSettings,
      mediaUploadHandler,
      fontLibraryEnabled
    } = (0, import_data63.useSelect)((select5) => {
      const { getEditorSettings: getEditorSettings2 } = select5(store);
      const { canUser } = select5(import_core_data43.store);
      const editorSettings2 = getEditorSettings2();
      const canUserUploadMedia = canUser("create", {
        kind: "postType",
        name: "attachment"
      });
      return {
        styles: editorSettings2?.styles,
        __unstableResolvedAssets: editorSettings2?.__unstableResolvedAssets,
        colors: editorSettings2?.colors,
        gradients: editorSettings2?.gradients,
        __experimentalDiscussionSettings: editorSettings2?.__experimentalDiscussionSettings,
        mediaUploadHandler: canUserUploadMedia ? import_media_utils4.uploadMedia : void 0,
        fontLibraryEnabled: editorSettings2?.fontLibraryEnabled ?? true
      };
    }, []);
    const serverCSS = (0, import_element71.useMemo)(() => {
      if (!styles) {
        return [];
      }
      return styles.filter((style) => !style.isGlobalStyles);
    }, [styles]);
    const serverSettings = (0, import_element71.useMemo)(() => {
      return {
        __unstableResolvedAssets,
        settings: {
          color: {
            palette: {
              theme: colors ?? []
            },
            gradients: {
              theme: gradients ?? []
            },
            duotone: {
              theme: []
            }
          }
        },
        __experimentalDiscussionSettings,
        mediaUpload: mediaUploadHandler
      };
    }, [
      __unstableResolvedAssets,
      colors,
      gradients,
      __experimentalDiscussionSettings,
      mediaUploadHandler
    ]);
    return { serverCSS, serverSettings, fontLibraryEnabled };
  }
  function GlobalStylesUIWrapper({ path, onPathChange }) {
    const {
      user: userConfig,
      base: baseConfig,
      setUser: setUserConfig,
      isReady: isReady2
    } = useGlobalStyles();
    const { serverCSS, serverSettings, fontLibraryEnabled } = useServerData();
    if (!isReady2) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)(import_jsx_runtime186.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
        GlobalStylesUI,
        {
          value: userConfig,
          baseValue: baseConfig || {},
          onChange: setUserConfig,
          path,
          onPathChange,
          fontLibraryEnabled,
          serverCSS,
          serverSettings
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
        GlobalStylesBlockLink,
        {
          path,
          onPathChange
        }
      )
    ] });
  }

  // packages/editor/build-module/dataviews/fields/content-preview/content-preview-view.mjs
  var import_jsx_runtime187 = __toESM(require_jsx_runtime(), 1);
  function PostPreviewContainer({
    template: template2,
    post: post2
  }) {
    const [backgroundColor = "white"] = useStyle2("color.background");
    const [postBlocks] = (0, import_core_data44.useEntityBlockEditor)("postType", post2.type, {
      id: post2.id
    });
    const [templateBlocks] = (0, import_core_data44.useEntityBlockEditor)(
      "postType",
      template2?.type,
      {
        id: template2?.id
      }
    );
    const blocks = template2 && templateBlocks ? templateBlocks : postBlocks;
    const isEmpty = !blocks?.length;
    return /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(
      "div",
      {
        className: "editor-fields-content-preview",
        style: {
          backgroundColor
        },
        children: [
          isEmpty && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("span", { className: "editor-fields-content-preview__empty", children: (0, import_i18n106.__)("Empty content") }),
          !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_block_editor34.BlockPreview.Async, { children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_block_editor34.BlockPreview, { blocks }) })
        ]
      }
    );
  }
  function PostPreviewView({ item }) {
    const { settings, template: template2 } = (0, import_data64.useSelect)(
      (select5) => {
        const { canUser, getPostType, getTemplateId, getEntityRecord } = unlock(select5(import_core_data44.store));
        const canViewTemplate = canUser("read", {
          kind: "postType",
          name: "wp_template"
        });
        const _settings = select5(store).getEditorSettings();
        const supportsTemplateMode = _settings.supportsTemplateMode;
        const isViewable = getPostType(item.type)?.viewable ?? false;
        const templateId2 = supportsTemplateMode && isViewable && canViewTemplate ? getTemplateId(item.type, item.id) : null;
        return {
          settings: _settings,
          template: templateId2 ? getEntityRecord("postType", "wp_template", templateId2) : void 0
        };
      },
      [item.type, item.id]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
      EditorProvider,
      {
        post: item,
        settings,
        __unstableTemplate: template2,
        children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(PostPreviewContainer, { template: template2, post: item })
      }
    );
  }

  // packages/editor/build-module/dataviews/fields/content-preview/index.mjs
  var postPreviewField = {
    type: "media",
    id: "content-preview",
    label: (0, import_i18n107.__)("Content preview"),
    render: PostPreviewView,
    enableSorting: false
  };
  var content_preview_default = postPreviewField;

  // packages/editor/build-module/dataviews/store/private-actions.mjs
  function hasEditorNotesSupport(supports) {
    const editor = supports?.editor;
    if (Array.isArray(editor)) {
      return !!editor[0]?.notes;
    }
    return false;
  }
  function registerEntityAction(kind, name2, config) {
    return {
      type: "REGISTER_ENTITY_ACTION",
      kind,
      name: name2,
      config
    };
  }
  function unregisterEntityAction(kind, name2, actionId) {
    return {
      type: "UNREGISTER_ENTITY_ACTION",
      kind,
      name: name2,
      actionId
    };
  }
  function registerEntityField(kind, name2, config) {
    return {
      type: "REGISTER_ENTITY_FIELD",
      kind,
      name: name2,
      config
    };
  }
  function unregisterEntityField(kind, name2, fieldId) {
    return {
      type: "UNREGISTER_ENTITY_FIELD",
      kind,
      name: name2,
      fieldId
    };
  }
  function setIsReady(kind, name2) {
    return {
      type: "SET_IS_READY",
      kind,
      name: name2
    };
  }
  var registerPostTypeSchema = (postType2) => async ({ registry }) => {
    const isReady2 = unlock(registry.select(store)).isEntityReady(
      "postType",
      postType2
    );
    if (isReady2) {
      return;
    }
    unlock(registry.dispatch(store)).setIsReady(
      "postType",
      postType2
    );
    const postTypeConfig = await registry.resolveSelect(import_core_data45.store).getPostType(postType2);
    const canCreate = await registry.resolveSelect(import_core_data45.store).canUser("create", {
      kind: "postType",
      name: postType2
    });
    const currentTheme = await registry.resolveSelect(import_core_data45.store).getCurrentTheme();
    let canDuplicate = !["wp_block", "wp_template_part"].includes(
      postTypeConfig.slug
    ) && canCreate && duplicate_post_default;
    if (false) {
      if ("wp_template" !== postTypeConfig.slug) {
        canDuplicate = void 0;
      }
    }
    if (postTypeConfig.slug === "wp_template" && !window?.__experimentalTemplateActivate) {
      canDuplicate = void 0;
    }
    const actions2 = [
      postTypeConfig.viewable ? view_post_default : void 0,
      !!postTypeConfig.supports?.revisions ? view_post_revisions_default : void 0,
      // @ts-ignore
      canDuplicate,
      postTypeConfig.slug === "wp_template_part" && canCreate && currentTheme?.is_block_theme ? duplicate_template_part_default : void 0,
      canCreate && postTypeConfig.slug === "wp_block" ? duplicate_pattern_default : void 0,
      postTypeConfig.supports?.title ? rename_post_default : void 0,
      postTypeConfig.supports?.["page-attributes"] ? reorder_page_default : void 0,
      postTypeConfig.slug === "wp_block" ? export_pattern_default : void 0,
      restore_post_default,
      reset_post_default,
      delete_post_default,
      trash_post_default,
      permanently_delete_post_default
    ].filter(Boolean);
    const fields2 = [
      postTypeConfig.supports?.thumbnail && currentTheme?.theme_supports?.["post-thumbnails"] && featured_image_default,
      postTypeConfig.supports?.author && author_default,
      status_default,
      !DESIGN_POST_TYPES.includes(postTypeConfig.slug) && date_default,
      slug_default,
      postTypeConfig.supports?.["page-attributes"] && parent_default,
      postTypeConfig.supports?.comments && comment_status_default,
      postTypeConfig.supports?.trackbacks && ping_status_default,
      (postTypeConfig.supports?.comments || postTypeConfig.supports?.trackbacks) && discussion_default,
      template_default,
      password_default,
      postTypeConfig.supports?.editor && postTypeConfig.viewable && content_preview_default,
      hasEditorNotesSupport(postTypeConfig.supports) && notes_default
    ].filter(Boolean);
    if (postTypeConfig.supports?.title) {
      let _titleField;
      if (postType2 === "page") {
        _titleField = page_title_default;
      } else if (postType2 === "wp_template") {
        _titleField = template_title_default;
      } else if (postType2 === "wp_block") {
        _titleField = pattern_title_default;
      } else {
        _titleField = title_default;
      }
      fields2.push(_titleField);
    }
    registry.batch(() => {
      actions2.forEach((action) => {
        unlock(registry.dispatch(store)).registerEntityAction(
          "postType",
          postType2,
          action
        );
      });
      fields2.forEach((field) => {
        unlock(registry.dispatch(store)).registerEntityField(
          "postType",
          postType2,
          field
        );
      });
    });
    (0, import_hooks36.doAction)("core.registerPostTypeSchema", postType2);
  };

  // packages/editor/build-module/store/private-actions.mjs
  function setCurrentTemplateId(id) {
    return {
      type: "SET_CURRENT_TEMPLATE_ID",
      id
    };
  }
  var createTemplate = (template2) => async ({ select: select5, dispatch: dispatch6, registry }) => {
    const savedTemplate = await registry.dispatch(import_core_data46.store).saveEntityRecord("postType", "wp_template", template2);
    registry.dispatch(import_core_data46.store).editEntityRecord(
      "postType",
      select5.getCurrentPostType(),
      select5.getCurrentPostId(),
      {
        template: savedTemplate.slug
      }
    );
    registry.dispatch(import_notices17.store).createSuccessNotice(
      (0, import_i18n108.__)("Custom template created. You're in template mode now."),
      {
        type: "snackbar",
        actions: [
          {
            label: (0, import_i18n108.__)("Go back"),
            onClick: () => dispatch6.setRenderingMode(
              select5.getEditorSettings().defaultRenderingMode
            )
          }
        ]
      }
    );
    return savedTemplate;
  };
  var showBlockTypes = (blockNames) => ({ registry }) => {
    const existingBlockNames = registry.select(import_preferences9.store).get("core", "hiddenBlockTypes") ?? [];
    const newBlockNames = existingBlockNames.filter(
      (type) => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type)
    );
    registry.dispatch(import_preferences9.store).set("core", "hiddenBlockTypes", newBlockNames);
  };
  var hideBlockTypes = (blockNames) => ({ registry }) => {
    const existingBlockNames = registry.select(import_preferences9.store).get("core", "hiddenBlockTypes") ?? [];
    const mergedBlockNames = /* @__PURE__ */ new Set([
      ...existingBlockNames,
      ...Array.isArray(blockNames) ? blockNames : [blockNames]
    ]);
    registry.dispatch(import_preferences9.store).set("core", "hiddenBlockTypes", [...mergedBlockNames]);
  };
  var saveDirtyEntities = ({ onSave, dirtyEntityRecords = [], entitiesToSkip = [], close } = {}) => ({ registry }) => {
    const PUBLISH_ON_SAVE_ENTITIES = [
      { kind: "postType", name: "wp_navigation" }
    ];
    const saveNoticeId = "site-editor-save-success";
    const homeUrl = registry.select(import_core_data46.store).getEntityRecord("root", "__unstableBase")?.home;
    registry.dispatch(import_notices17.store).removeNotice(saveNoticeId);
    const entitiesToSave = dirtyEntityRecords.filter(
      ({ kind, name: name2, key, property }) => {
        return !entitiesToSkip.some(
          (elt) => elt.kind === kind && elt.name === name2 && elt.key === key && elt.property === property
        );
      }
    );
    close?.(entitiesToSave);
    const siteItemsToSave = [];
    const pendingSavedRecords = [];
    entitiesToSave.forEach(({ kind, name: name2, key, property }) => {
      if ("root" === kind && "site" === name2) {
        siteItemsToSave.push(property);
      } else {
        if (PUBLISH_ON_SAVE_ENTITIES.some(
          (typeToPublish) => typeToPublish.kind === kind && typeToPublish.name === name2
        )) {
          registry.dispatch(import_core_data46.store).editEntityRecord(kind, name2, key, {
            status: "publish"
          });
        }
        pendingSavedRecords.push(
          registry.dispatch(import_core_data46.store).saveEditedEntityRecord(kind, name2, key)
        );
      }
    });
    if (siteItemsToSave.length) {
      pendingSavedRecords.push(
        registry.dispatch(import_core_data46.store).__experimentalSaveSpecifiedEntityEdits(
          "root",
          "site",
          void 0,
          siteItemsToSave
        )
      );
    }
    registry.dispatch(import_block_editor35.store).__unstableMarkLastChangeAsPersistent();
    Promise.all(pendingSavedRecords).then((values) => {
      return onSave ? onSave(values) : values;
    }).then((values) => {
      if (values.some((value) => typeof value === "undefined")) {
        registry.dispatch(import_notices17.store).createErrorNotice((0, import_i18n108.__)("Saving failed."));
      } else {
        registry.dispatch(import_notices17.store).createSuccessNotice((0, import_i18n108.__)("Site updated."), {
          type: "snackbar",
          id: saveNoticeId,
          actions: [
            {
              label: (0, import_i18n108.__)("View site"),
              url: homeUrl,
              openInNewTab: true
            }
          ]
        });
      }
    }).catch(
      (error) => registry.dispatch(import_notices17.store).createErrorNotice(
        `${(0, import_i18n108.__)("Saving failed.")} ${error}`
      )
    );
  };
  var revertTemplate2 = (template2, { allowUndo = true } = {}) => async ({ registry }) => {
    const noticeId = "edit-site-template-reverted";
    registry.dispatch(import_notices17.store).removeNotice(noticeId);
    if (!isTemplateRevertable(template2)) {
      registry.dispatch(import_notices17.store).createErrorNotice((0, import_i18n108.__)("This template is not revertable."), {
        type: "snackbar"
      });
      return;
    }
    try {
      const templateEntityConfig = registry.select(import_core_data46.store).getEntityConfig("postType", template2.type);
      if (!templateEntityConfig) {
        registry.dispatch(import_notices17.store).createErrorNotice(
          (0, import_i18n108.__)(
            "The editor has encountered an unexpected error. Please reload."
          ),
          { type: "snackbar" }
        );
        return;
      }
      const fileTemplatePath = (0, import_url9.addQueryArgs)(
        `${templateEntityConfig.baseURL}/${template2.id}`,
        { context: "edit", source: template2.origin }
      );
      const fileTemplate = await (0, import_api_fetch4.default)({ path: fileTemplatePath });
      if (!fileTemplate) {
        registry.dispatch(import_notices17.store).createErrorNotice(
          (0, import_i18n108.__)(
            "The editor has encountered an unexpected error. Please reload."
          ),
          { type: "snackbar" }
        );
        return;
      }
      const serializeBlocks = ({
        blocks: blocksForSerialization = []
      }) => (0, import_blocks19.__unstableSerializeAndClean)(blocksForSerialization);
      const edited = registry.select(import_core_data46.store).getEditedEntityRecord(
        "postType",
        template2.type,
        template2.id
      );
      registry.dispatch(import_core_data46.store).editEntityRecord(
        "postType",
        template2.type,
        template2.id,
        {
          content: serializeBlocks,
          // Required to make the `undo` behave correctly.
          blocks: edited.blocks,
          // Required to revert the blocks in the editor.
          source: "custom"
          // required to avoid turning the editor into a dirty state
        },
        {
          undoIgnore: true
          // Required to merge this edit with the last undo level.
        }
      );
      const blocks = (0, import_blocks19.parse)(fileTemplate?.content?.raw);
      registry.dispatch(import_core_data46.store).editEntityRecord("postType", template2.type, fileTemplate.id, {
        content: serializeBlocks,
        blocks,
        source: "theme"
      });
      if (allowUndo) {
        const undoRevert = () => {
          registry.dispatch(import_core_data46.store).editEntityRecord(
            "postType",
            template2.type,
            edited.id,
            {
              content: serializeBlocks,
              blocks: edited.blocks,
              source: "custom"
            }
          );
        };
        registry.dispatch(import_notices17.store).createSuccessNotice((0, import_i18n108.__)("Template reset."), {
          type: "snackbar",
          id: noticeId,
          actions: [
            {
              label: (0, import_i18n108.__)("Undo"),
              onClick: undoRevert
            }
          ]
        });
      }
    } catch (error) {
      const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n108.__)("Template revert failed. Please reload.");
      registry.dispatch(import_notices17.store).createErrorNotice(errorMessage, { type: "snackbar" });
    }
  };
  var removeTemplates = (items) => async ({ registry }) => {
    const isResetting = items.every((item) => item?.has_theme_file);
    const promiseResult = await Promise.allSettled(
      items.map((item) => {
        return registry.dispatch(import_core_data46.store).deleteEntityRecord(
          "postType",
          item.type,
          item.id,
          { force: true },
          { throwOnError: true }
        );
      })
    );
    if (promiseResult.every(({ status }) => status === "fulfilled")) {
      let successMessage;
      if (items.length === 1) {
        let title;
        if (typeof items[0].title === "string") {
          title = items[0].title;
        } else if (typeof items[0].title?.rendered === "string") {
          title = items[0].title?.rendered;
        } else if (typeof items[0].title?.raw === "string") {
          title = items[0].title?.raw;
        }
        successMessage = isResetting ? (0, import_i18n108.sprintf)(
          /* translators: %s: The template/part's name. */
          (0, import_i18n108.__)('"%s" reset.'),
          (0, import_html_entities9.decodeEntities)(title)
        ) : (0, import_i18n108.sprintf)(
          /* translators: %s: The template/part's name. */
          (0, import_i18n108._x)('"%s" deleted.', "template part"),
          (0, import_html_entities9.decodeEntities)(title)
        );
      } else {
        successMessage = isResetting ? (0, import_i18n108.__)("Items reset.") : (0, import_i18n108.__)("Items deleted.");
      }
      registry.dispatch(import_notices17.store).createSuccessNotice(successMessage, {
        type: "snackbar",
        id: "editor-template-deleted-success"
      });
    } else {
      let errorMessage;
      if (promiseResult.length === 1) {
        if (promiseResult[0].reason?.message) {
          errorMessage = promiseResult[0].reason.message;
        } else {
          errorMessage = isResetting ? (0, import_i18n108.__)("An error occurred while reverting the item.") : (0, import_i18n108.__)("An error occurred while deleting the item.");
        }
      } else {
        const errorMessages = /* @__PURE__ */ new Set();
        const failedPromises = promiseResult.filter(
          ({ status }) => status === "rejected"
        );
        for (const failedPromise of failedPromises) {
          if (failedPromise.reason?.message) {
            errorMessages.add(failedPromise.reason.message);
          }
        }
        if (errorMessages.size === 0) {
          errorMessage = (0, import_i18n108.__)(
            "An error occurred while deleting the items."
          );
        } else if (errorMessages.size === 1) {
          errorMessage = isResetting ? (0, import_i18n108.sprintf)(
            /* translators: %s: an error message */
            (0, import_i18n108.__)(
              "An error occurred while reverting the items: %s"
            ),
            [...errorMessages][0]
          ) : (0, import_i18n108.sprintf)(
            /* translators: %s: an error message */
            (0, import_i18n108.__)(
              "An error occurred while deleting the items: %s"
            ),
            [...errorMessages][0]
          );
        } else {
          errorMessage = isResetting ? (0, import_i18n108.sprintf)(
            /* translators: %s: a list of comma separated error messages */
            (0, import_i18n108.__)(
              "Some errors occurred while reverting the items: %s"
            ),
            [...errorMessages].join(",")
          ) : (0, import_i18n108.sprintf)(
            /* translators: %s: a list of comma separated error messages */
            (0, import_i18n108.__)(
              "Some errors occurred while deleting the items: %s"
            ),
            [...errorMessages].join(",")
          );
        }
      }
      registry.dispatch(import_notices17.store).createErrorNotice(errorMessage, { type: "snackbar" });
    }
  };
  var setDefaultRenderingMode = (mode) => ({ select: select5, registry }) => {
    const postType2 = select5.getCurrentPostType();
    const theme = registry.select(import_core_data46.store).getCurrentTheme()?.stylesheet;
    const renderingModes = registry.select(import_preferences9.store).get("core", "renderingModes")?.[theme] ?? {};
    if (renderingModes[postType2] === mode) {
      return;
    }
    const newModes = {
      [theme]: {
        ...renderingModes,
        [postType2]: mode
      }
    };
    registry.dispatch(import_preferences9.store).set("core", "renderingModes", newModes);
  };
  function setStylesPath(path) {
    return {
      type: "SET_STYLES_PATH",
      path
    };
  }
  function setShowStylebook(show) {
    return {
      type: "SET_SHOW_STYLEBOOK",
      show
    };
  }
  function resetStylesNavigation() {
    return {
      type: "RESET_STYLES_NAVIGATION"
    };
  }
  function setCanvasMinHeight(minHeight) {
    return {
      type: "SET_CANVAS_MIN_HEIGHT",
      minHeight
    };
  }

  // packages/editor/build-module/store/private-selectors.mjs
  var private_selectors_exports = {};
  __export(private_selectors_exports, {
    getCanvasMinHeight: () => getCanvasMinHeight,
    getDefaultRenderingMode: () => getDefaultRenderingMode,
    getEntityActions: () => getEntityActions2,
    getEntityFields: () => getEntityFields2,
    getInserter: () => getInserter,
    getInserterSidebarToggleRef: () => getInserterSidebarToggleRef,
    getListViewToggleRef: () => getListViewToggleRef,
    getPostBlocksByName: () => getPostBlocksByName,
    getPostIcon: () => getPostIcon,
    getShowStylebook: () => getShowStylebook,
    getStylesPath: () => getStylesPath,
    hasPostMetaChanges: () => hasPostMetaChanges,
    isEntityReady: () => isEntityReady2
  });
  var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1);
  var import_block_editor36 = __toESM(require_block_editor(), 1);
  var import_data65 = __toESM(require_data(), 1);
  var import_core_data47 = __toESM(require_core_data(), 1);
  var import_preferences10 = __toESM(require_preferences(), 1);

  // packages/editor/build-module/dataviews/store/private-selectors.mjs
  var EMPTY_ARRAY5 = [];
  function getEntityActions(state, kind, name2) {
    return state.actions[kind]?.[name2] ?? EMPTY_ARRAY5;
  }
  function getEntityFields(state, kind, name2) {
    return state.fields[kind]?.[name2] ?? EMPTY_ARRAY5;
  }
  function isEntityReady(state, kind, name2) {
    return state.isReady[kind]?.[name2];
  }

  // packages/editor/build-module/store/private-selectors.mjs
  var EMPTY_INSERTION_POINT = {
    rootClientId: void 0,
    insertionIndex: void 0,
    filterValue: void 0
  };
  var RENDERING_MODES = ["post-only", "template-locked"];
  var getInserter = (0, import_data65.createRegistrySelector)(
    (select5) => (0, import_data65.createSelector)(
      (state) => {
        if (typeof state.blockInserterPanel === "object") {
          return state.blockInserterPanel;
        }
        if (getRenderingMode(state) === "template-locked") {
          const [postContentClientId] = select5(import_block_editor36.store).getBlocksByName(
            "core/post-content"
          );
          if (postContentClientId) {
            return {
              rootClientId: postContentClientId,
              insertionIndex: void 0,
              filterValue: void 0
            };
          }
        }
        return EMPTY_INSERTION_POINT;
      },
      (state) => {
        const [postContentClientId] = select5(import_block_editor36.store).getBlocksByName(
          "core/post-content"
        );
        return [
          state.blockInserterPanel,
          getRenderingMode(state),
          postContentClientId
        ];
      }
    )
  );
  function getListViewToggleRef(state) {
    return state.listViewToggleRef;
  }
  function getInserterSidebarToggleRef(state) {
    return state.inserterSidebarToggleRef;
  }
  var CARD_ICONS = {
    wp_block: symbol_default,
    wp_navigation: navigation_default,
    page: page_default,
    post: verse_default
  };
  var getPostIcon = (0, import_data65.createRegistrySelector)(
    (select5) => (state, postType2, options) => {
      {
        if (postType2 === "wp_template_part" || postType2 === "wp_template") {
          const templateAreas = select5(import_core_data47.store).getCurrentTheme()?.default_template_part_areas || [];
          const areaData = templateAreas.find(
            (item) => options.area === item.area
          );
          if (areaData?.icon) {
            return getTemplatePartIcon(areaData.icon);
          }
          return layout_default;
        }
        if (CARD_ICONS[postType2]) {
          return CARD_ICONS[postType2];
        }
        const postTypeEntity = select5(import_core_data47.store).getPostType(postType2);
        if (typeof postTypeEntity?.icon === "string" && postTypeEntity.icon.startsWith("dashicons-")) {
          return postTypeEntity.icon.slice(10);
        }
        return page_default;
      }
    }
  );
  var hasPostMetaChanges = (0, import_data65.createRegistrySelector)(
    (select5) => (state, postType2, postId2) => {
      const { type: currentPostType, id: currentPostId } = getCurrentPost(state);
      const edits = select5(import_core_data47.store).getEntityRecordNonTransientEdits(
        "postType",
        postType2 || currentPostType,
        postId2 || currentPostId
      );
      if (!edits?.meta) {
        return false;
      }
      const originalPostMeta = select5(import_core_data47.store).getEntityRecord(
        "postType",
        postType2 || currentPostType,
        postId2 || currentPostId
      )?.meta;
      return !(0, import_fast_deep_equal.default)(
        { ...originalPostMeta, footnotes: void 0 },
        { ...edits.meta, footnotes: void 0 }
      );
    }
  );
  function getEntityActions2(state, ...args) {
    return getEntityActions(state.dataviews, ...args);
  }
  function isEntityReady2(state, ...args) {
    return isEntityReady(state.dataviews, ...args);
  }
  function getEntityFields2(state, ...args) {
    return getEntityFields(state.dataviews, ...args);
  }
  var getPostBlocksByName = (0, import_data65.createRegistrySelector)(
    (select5) => (0, import_data65.createSelector)(
      (state, blockNames) => {
        blockNames = Array.isArray(blockNames) ? blockNames : [blockNames];
        const { getBlocksByName, getBlockParents, getBlockName: getBlockName2 } = select5(import_block_editor36.store);
        return getBlocksByName(blockNames).filter(
          (clientId) => getBlockParents(clientId).every((parentClientId) => {
            const parentBlockName = getBlockName2(parentClientId);
            return (
              // Ignore descendents of the query block.
              parentBlockName !== "core/query" && // Enable only the top-most block.
              !blockNames.includes(parentBlockName)
            );
          })
        );
      },
      () => [select5(import_block_editor36.store).getBlocks()]
    )
  );
  var getDefaultRenderingMode = (0, import_data65.createRegistrySelector)(
    (select5) => (state, postType2) => {
      const { getPostType, getCurrentTheme, hasFinishedResolution } = select5(import_core_data47.store);
      const currentTheme = getCurrentTheme();
      const postTypeEntity = getPostType(postType2);
      if (!hasFinishedResolution("getPostType", [postType2]) || !hasFinishedResolution("getCurrentTheme")) {
        return void 0;
      }
      const theme = currentTheme?.stylesheet;
      const defaultModePreference = select5(import_preferences10.store).get(
        "core",
        "renderingModes"
      )?.[theme]?.[postType2];
      const postTypeDefaultMode = Array.isArray(
        postTypeEntity?.supports?.editor
      ) ? postTypeEntity.supports.editor.find(
        (features) => "default-mode" in features
      )?.["default-mode"] : void 0;
      const defaultMode = defaultModePreference || postTypeDefaultMode;
      if (!RENDERING_MODES.includes(defaultMode)) {
        return "post-only";
      }
      return defaultMode;
    }
  );
  function getStylesPath(state) {
    return state.stylesPath ?? "/";
  }
  function getShowStylebook(state) {
    return state.showStylebook ?? false;
  }
  function getCanvasMinHeight(state) {
    return state.canvasMinHeight;
  }

  // packages/editor/build-module/store/index.mjs
  var storeConfig = {
    reducer: reducer_default2,
    selectors: selectors_exports,
    actions: actions_exports
  };
  var store = (0, import_data66.createReduxStore)(STORE_NAME, {
    ...storeConfig
  });
  (0, import_data66.register)(store);
  unlock(store).registerPrivateActions(private_actions_exports);
  unlock(store).registerPrivateSelectors(private_selectors_exports);

  // packages/editor/build-module/hooks/custom-sources-backwards-compatibility.mjs
  var import_jsx_runtime188 = __toESM(require_jsx_runtime(), 1);
  var createWithMetaAttributeSource = (metaAttributes) => (0, import_compose16.createHigherOrderComponent)(
    (BlockEdit2) => ({ attributes, setAttributes, ...props }) => {
      const postType2 = (0, import_data67.useSelect)(
        (select5) => select5(store).getCurrentPostType(),
        []
      );
      const [meta2, setMeta] = (0, import_core_data48.useEntityProp)(
        "postType",
        postType2,
        "meta"
      );
      const mergedAttributes = (0, import_element72.useMemo)(
        () => ({
          ...attributes,
          ...Object.fromEntries(
            Object.entries(metaAttributes).map(
              ([attributeKey, metaKey]) => [
                attributeKey,
                meta2[metaKey]
              ]
            )
          )
        }),
        [attributes, meta2]
      );
      return /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(
        BlockEdit2,
        {
          attributes: mergedAttributes,
          setAttributes: (nextAttributes) => {
            const nextMeta = Object.fromEntries(
              Object.entries(nextAttributes ?? {}).filter(
                // Filter to intersection of keys between the updated
                // attributes and those with an associated meta key.
                ([key]) => key in metaAttributes
              ).map(([attributeKey, value]) => [
                // Rename the keys to the expected meta key name.
                metaAttributes[attributeKey],
                value
              ])
            );
            if (Object.entries(nextMeta).length) {
              setMeta(nextMeta);
            }
            setAttributes(nextAttributes);
          },
          ...props
        }
      );
    },
    "withMetaAttributeSource"
  );
  function shimAttributeSource(settings) {
    const metaAttributes = Object.fromEntries(
      Object.entries(settings.attributes ?? {}).filter(([, { source }]) => source === "meta").map(([attributeKey, { meta: meta2 }]) => [attributeKey, meta2])
    );
    if (Object.entries(metaAttributes).length) {
      settings.edit = createWithMetaAttributeSource(metaAttributes)(
        settings.edit
      );
    }
    return settings;
  }
  (0, import_hooks37.addFilter)(
    "blocks.registerBlockType",
    "core/editor/custom-sources-backwards-compatibility/shim-attribute-source",
    shimAttributeSource
  );

  // packages/editor/build-module/hooks/default-autocompleters.mjs
  var import_hooks47 = __toESM(require_hooks(), 1);

  // packages/editor/build-module/components/autocompleters/user.mjs
  var import_element73 = __toESM(require_element(), 1);
  var import_data68 = __toESM(require_data(), 1);
  var import_core_data49 = __toESM(require_core_data(), 1);
  var import_jsx_runtime189 = __toESM(require_jsx_runtime(), 1);
  function getUserLabel(user) {
    const avatar = user.avatar_urls && user.avatar_urls[24] ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(
      "img",
      {
        className: "editor-autocompleters__user-avatar",
        alt: "",
        src: user.avatar_urls[24]
      }
    ) : /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("span", { className: "editor-autocompleters__no-avatar" });
    return /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(import_jsx_runtime189.Fragment, { children: [
      avatar,
      /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("span", { className: "editor-autocompleters__user-name", children: user.name }),
      /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("span", { className: "editor-autocompleters__user-slug", children: user.slug })
    ] });
  }
  var user_default = {
    name: "users",
    className: "editor-autocompleters__user",
    triggerPrefix: "@",
    useItems(filterValue) {
      const users = (0, import_data68.useSelect)(
        (select5) => {
          const { getUsers } = select5(import_core_data49.store);
          return getUsers({
            context: "view",
            search: encodeURIComponent(filterValue)
          });
        },
        [filterValue]
      );
      const options = (0, import_element73.useMemo)(
        () => users ? users.map((user) => ({
          key: `user-${user.slug}`,
          value: user,
          label: getUserLabel(user)
        })) : [],
        [users]
      );
      return [options];
    },
    getOptionCompletion(user) {
      return `@${user.slug}`;
    }
  };

  // packages/editor/build-module/components/autosave-monitor/index.mjs
  var import_element74 = __toESM(require_element(), 1);
  var import_compose17 = __toESM(require_compose(), 1);
  var import_data69 = __toESM(require_data(), 1);
  var import_core_data50 = __toESM(require_core_data(), 1);
  var AutosaveMonitor = class extends import_element74.Component {
    constructor(props) {
      super(props);
      this.needsAutosave = !!(props.isDirty && props.isAutosaveable);
    }
    componentDidMount() {
      if (!this.props.disableIntervalChecks) {
        this.setAutosaveTimer();
      }
    }
    componentDidUpdate(prevProps) {
      if (this.props.disableIntervalChecks) {
        if (this.props.editsReference !== prevProps.editsReference) {
          this.props.autosave();
        }
        return;
      }
      if (this.props.interval !== prevProps.interval) {
        clearTimeout(this.timerId);
        this.setAutosaveTimer();
      }
      if (!this.props.isDirty) {
        this.needsAutosave = false;
        return;
      }
      if (this.props.isAutosaving && !prevProps.isAutosaving) {
        this.needsAutosave = false;
        return;
      }
      if (this.props.editsReference !== prevProps.editsReference) {
        this.needsAutosave = true;
      }
    }
    componentWillUnmount() {
      clearTimeout(this.timerId);
    }
    setAutosaveTimer(timeout = this.props.interval * 1e3) {
      this.timerId = setTimeout(() => {
        this.autosaveTimerHandler();
      }, timeout);
    }
    autosaveTimerHandler() {
      if (!this.props.isAutosaveable) {
        this.setAutosaveTimer(1e3);
        return;
      }
      if (this.needsAutosave) {
        this.needsAutosave = false;
        this.props.autosave();
      }
      this.setAutosaveTimer();
    }
    render() {
      return null;
    }
  };
  var autosave_monitor_default = (0, import_compose17.compose)([
    (0, import_data69.withSelect)((select5, ownProps) => {
      const { getReferenceByDistinctEdits } = select5(import_core_data50.store);
      const {
        isEditedPostDirty: isEditedPostDirty2,
        isEditedPostAutosaveable: isEditedPostAutosaveable2,
        isAutosavingPost: isAutosavingPost2,
        getEditorSettings: getEditorSettings2
      } = select5(store);
      const { interval = getEditorSettings2().autosaveInterval } = ownProps;
      return {
        editsReference: getReferenceByDistinctEdits(),
        isDirty: isEditedPostDirty2(),
        isAutosaveable: isEditedPostAutosaveable2(),
        isAutosaving: isAutosavingPost2(),
        interval
      };
    }),
    (0, import_data69.withDispatch)((dispatch6, ownProps) => ({
      autosave() {
        const { autosave: autosave2 = dispatch6(store).autosave } = ownProps;
        autosave2();
      }
    }))
  ])(AutosaveMonitor);

  // packages/editor/build-module/components/document-bar/index.mjs
  var import_i18n115 = __toESM(require_i18n(), 1);
  var import_data77 = __toESM(require_data(), 1);
  var import_components98 = __toESM(require_components(), 1);
  var import_block_editor41 = __toESM(require_block_editor(), 1);
  var import_keycodes7 = __toESM(require_keycodes(), 1);
  var import_core_data54 = __toESM(require_core_data(), 1);
  var import_commands3 = __toESM(require_commands(), 1);
  var import_element81 = __toESM(require_element(), 1);
  var import_compose19 = __toESM(require_compose(), 1);
  var import_html_entities11 = __toESM(require_html_entities(), 1);
  var import_dom = __toESM(require_dom(), 1);

  // packages/editor/build-module/utils/pageTypeBadge.mjs
  var import_i18n109 = __toESM(require_i18n(), 1);
  var import_data70 = __toESM(require_data(), 1);
  var import_core_data51 = __toESM(require_core_data(), 1);
  function usePageTypeBadge(postId2) {
    const { isFrontPage, isPostsPage } = (0, import_data70.useSelect)((select5) => {
      const { canUser, getEditedEntityRecord } = select5(import_core_data51.store);
      const siteSettings = canUser("read", {
        kind: "root",
        name: "site"
      }) ? getEditedEntityRecord("root", "site") : void 0;
      const _postId = parseInt(postId2, 10);
      return {
        isFrontPage: siteSettings?.page_on_front === _postId,
        isPostsPage: siteSettings?.page_for_posts === _postId
      };
    });
    if (isFrontPage) {
      return (0, import_i18n109.__)("Homepage");
    } else if (isPostsPage) {
      return (0, import_i18n109.__)("Posts Page");
    }
    return false;
  }

  // packages/editor/build-module/components/styles-canvas/index.mjs
  var import_components97 = __toESM(require_components(), 1);
  var import_keycodes6 = __toESM(require_keycodes(), 1);
  var import_i18n114 = __toESM(require_i18n(), 1);
  var import_data75 = __toESM(require_data(), 1);
  var import_compose18 = __toESM(require_compose(), 1);
  var import_preferences11 = __toESM(require_preferences(), 1);

  // packages/editor/build-module/components/styles-canvas/style-book.mjs
  var import_element78 = __toESM(require_element(), 1);

  // packages/editor/build-module/components/style-book/index.mjs
  var import_components93 = __toESM(require_components(), 1);
  var import_i18n112 = __toESM(require_i18n(), 1);
  var import_block_editor38 = __toESM(require_block_editor(), 1);
  var import_data73 = __toESM(require_data(), 1);
  var import_element77 = __toESM(require_element(), 1);
  var import_keycodes4 = __toESM(require_keycodes(), 1);
  var import_media_utils5 = __toESM(require_media_utils(), 1);
  var import_core_data52 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/style-book/constants.mjs
  var import_i18n110 = __toESM(require_i18n(), 1);
  var STYLE_BOOK_COLOR_GROUPS = [
    {
      slug: "theme-colors",
      title: (0, import_i18n110.__)("Theme Colors"),
      origin: "theme",
      type: "colors"
    },
    {
      slug: "theme-gradients",
      title: (0, import_i18n110.__)("Theme Gradients"),
      origin: "theme",
      type: "gradients"
    },
    {
      slug: "custom-colors",
      title: (0, import_i18n110.__)("Custom Colors"),
      origin: "custom",
      type: "colors"
    },
    {
      slug: "custom-gradients",
      title: (0, import_i18n110.__)("Custom Gradients"),
      origin: "custom",
      // User.
      type: "gradients"
    },
    {
      slug: "duotones",
      title: (0, import_i18n110.__)("Duotones"),
      origin: "theme",
      type: "duotones"
    },
    {
      slug: "default-colors",
      title: (0, import_i18n110.__)("Default Colors"),
      origin: "default",
      type: "colors"
    },
    {
      slug: "default-gradients",
      title: (0, import_i18n110.__)("Default Gradients"),
      origin: "default",
      type: "gradients"
    }
  ];
  var STYLE_BOOK_THEME_SUBCATEGORIES = [
    {
      slug: "site-identity",
      title: (0, import_i18n110.__)("Site Identity"),
      blocks: ["core/site-logo", "core/site-title", "core/site-tagline"]
    },
    {
      slug: "design",
      title: (0, import_i18n110.__)("Design"),
      blocks: ["core/navigation", "core/avatar", "core/post-time-to-read"],
      exclude: ["core/home-link", "core/navigation-link"]
    },
    {
      slug: "posts",
      title: (0, import_i18n110.__)("Posts"),
      blocks: [
        "core/post-title",
        "core/post-excerpt",
        "core/post-author",
        "core/post-author-name",
        "core/post-author-biography",
        "core/post-date",
        "core/post-terms",
        "core/term-description",
        "core/query-title",
        "core/query-no-results",
        "core/query-pagination",
        "core/query-numbers"
      ]
    },
    {
      slug: "comments",
      title: (0, import_i18n110.__)("Comments"),
      blocks: [
        "core/comments-title",
        "core/comments-pagination",
        "core/comments-pagination-numbers",
        "core/comments",
        "core/comments-author-name",
        "core/comment-content",
        "core/comment-date",
        "core/comment-edit-link",
        "core/comment-reply-link",
        "core/comment-template",
        "core/post-comments-count",
        "core/post-comments-link"
      ]
    }
  ];
  var STYLE_BOOK_CATEGORIES = [
    {
      slug: "overview",
      title: (0, import_i18n110.__)("Overview"),
      blocks: []
    },
    {
      slug: "text",
      title: (0, import_i18n110.__)("Text"),
      blocks: [
        "core/post-content",
        "core/home-link",
        "core/navigation-link"
      ]
    },
    {
      slug: "colors",
      title: (0, import_i18n110.__)("Colors"),
      blocks: []
    },
    {
      slug: "theme",
      title: (0, import_i18n110.__)("Theme"),
      subcategories: STYLE_BOOK_THEME_SUBCATEGORIES
    },
    {
      slug: "media",
      title: (0, import_i18n110.__)("Media"),
      blocks: ["core/post-featured-image"]
    },
    {
      slug: "widgets",
      title: (0, import_i18n110.__)("Widgets"),
      blocks: []
    },
    {
      slug: "embed",
      title: (0, import_i18n110.__)("Embeds"),
      include: []
    }
  ];
  var STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES = [
    ...STYLE_BOOK_THEME_SUBCATEGORIES,
    {
      slug: "media",
      title: (0, import_i18n110.__)("Media"),
      blocks: ["core/post-featured-image"]
    },
    {
      slug: "widgets",
      title: (0, import_i18n110.__)("Widgets"),
      blocks: []
    },
    {
      slug: "embed",
      title: (0, import_i18n110.__)("Embeds"),
      include: []
    }
  ];
  var STYLE_BOOK_PREVIEW_CATEGORIES = [
    {
      slug: "overview",
      title: (0, import_i18n110.__)("Overview"),
      blocks: []
    },
    {
      slug: "text",
      title: (0, import_i18n110.__)("Text"),
      blocks: [
        "core/post-content",
        "core/home-link",
        "core/navigation-link"
      ]
    },
    {
      slug: "colors",
      title: (0, import_i18n110.__)("Colors"),
      blocks: []
    },
    {
      slug: "blocks",
      title: (0, import_i18n110.__)("All Blocks"),
      blocks: [],
      subcategories: STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES
    }
  ];
  var ROOT_CONTAINER = `
	.is-root-container {
		display: flow-root;
	}
`;
  var STYLE_BOOK_IFRAME_STYLES = `
	body {
		position: relative;
		padding: 32px !important;
	}

	${ROOT_CONTAINER}

	.editor-style-book__examples {
		max-width: 1200px;
		margin: 0 auto;
	}

	.editor-style-book__example {
	    max-width: 900px;
		border-radius: 2px;
		cursor: pointer;
		display: flex;
		flex-direction: column;
		gap: 40px;
		padding: 16px;
		width: 100%;
		box-sizing: border-box;
		scroll-margin-top: 32px;
		scroll-margin-bottom: 32px;
		margin: 0 auto 40px auto;
	}

	.editor-style-book__example.is-selected {
		box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
	}

	.editor-style-book__example.is-disabled-example {
		pointer-events: none;
	}

	.editor-style-book__example:focus:not(:disabled) {
		box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
		outline: 3px solid transparent;
	}

	.editor-style-book__duotone-example > div:first-child {
		display: flex;
		aspect-ratio: 16 / 9;
		grid-row: span 1;
		grid-column: span 2;
	}
	.editor-style-book__duotone-example img {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}
	.editor-style-book__duotone-example > div:not(:first-child) {
		height: 20px;
		border: 1px solid color-mix( in srgb, currentColor 10%, transparent );
	}

	.editor-style-book__color-example {
		border: 1px solid color-mix( in srgb, currentColor 10%, transparent );
	}

	.editor-style-book__subcategory-title,
	.editor-style-book__example-title {
		font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
		font-size: 13px;
		font-weight: normal;
		line-height: normal;
		margin: 0;
		text-align: left;
		padding-top: 8px;
		border-top: 1px solid color-mix( in srgb, currentColor 10%, transparent );
		color: color-mix( in srgb, currentColor 60%, transparent );
	}

	.editor-style-book__subcategory-title {
		font-size: 16px;
		margin-bottom: 40px;
    	padding-bottom: 8px;
	}

	.editor-style-book__example-preview {
		width: 100%;
	}

	.editor-style-book__example-preview .block-editor-block-list__insertion-point,
	.editor-style-book__example-preview .block-list-appender {
		display: none;
	}
	:where(.is-root-container > .wp-block:first-child) {
		margin-top: 0;
	}
	:where(.is-root-container > .wp-block:last-child) {
		margin-bottom: 0;
	}
`;

  // packages/editor/build-module/components/style-book/categories.mjs
  var import_blocks20 = __toESM(require_blocks(), 1);
  function getExamplesByCategory(categoryDefinition, examples) {
    if (!categoryDefinition?.slug || !examples?.length) {
      return;
    }
    const categories = categoryDefinition?.subcategories ?? [];
    if (categories.length) {
      return categories.reduce(
        (acc, subcategoryDefinition) => {
          const subcategoryExamples = getExamplesByCategory(
            subcategoryDefinition,
            examples
          );
          if (subcategoryExamples) {
            if (!acc.subcategories) {
              acc.subcategories = [];
            }
            acc.subcategories = [
              ...acc.subcategories,
              subcategoryExamples
            ];
          }
          return acc;
        },
        {
          title: categoryDefinition.title,
          slug: categoryDefinition.slug
        }
      );
    }
    const blocksToInclude = categoryDefinition?.blocks || [];
    const blocksToExclude = categoryDefinition?.exclude || [];
    const categoryExamples = examples.filter((example) => {
      return !blocksToExclude.includes(example.name) && (example.category === categoryDefinition.slug || blocksToInclude.includes(example.name));
    });
    if (!categoryExamples.length) {
      return;
    }
    return {
      title: categoryDefinition.title,
      slug: categoryDefinition.slug,
      examples: categoryExamples
    };
  }
  function getTopLevelStyleBookCategories() {
    const reservedCategories = [
      ...STYLE_BOOK_THEME_SUBCATEGORIES,
      ...STYLE_BOOK_CATEGORIES
    ].map(({ slug }) => slug);
    const extraCategories = (0, import_blocks20.getCategories)();
    const extraCategoriesFiltered = extraCategories.filter(
      ({ slug }) => !reservedCategories.includes(slug)
    );
    return [...STYLE_BOOK_CATEGORIES, ...extraCategoriesFiltered];
  }

  // packages/editor/build-module/components/style-book/examples.mjs
  var import_i18n111 = __toESM(require_i18n(), 1);
  var import_blocks21 = __toESM(require_blocks(), 1);

  // packages/editor/build-module/components/style-book/color-examples.mjs
  var import_components91 = __toESM(require_components(), 1);
  var import_block_editor37 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime190 = __toESM(require_jsx_runtime(), 1);
  var ColorExamples = ({
    colors,
    type,
    templateColumns = "1fr 1fr",
    itemHeight = "52px"
  }) => {
    if (!colors) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_components91.__experimentalGrid, { templateColumns, rowGap: 8, columnGap: 16, children: colors.map((color) => {
      const className = type === "gradients" ? (0, import_block_editor37.__experimentalGetGradientClass)(color.slug) : (0, import_block_editor37.getColorClassName)("background-color", color.slug);
      const classes = clsx_default(
        "editor-style-book__color-example",
        className
      );
      return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
        "div",
        {
          className: classes,
          style: { height: itemHeight }
        },
        color.slug
      );
    }) });
  };
  var color_examples_default = ColorExamples;

  // packages/editor/build-module/components/style-book/duotone-examples.mjs
  var import_components92 = __toESM(require_components(), 1);
  var import_jsx_runtime191 = __toESM(require_jsx_runtime(), 1);
  var DuotoneExamples = ({
    duotones
  }) => {
    if (!duotones) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_components92.__experimentalGrid, { columns: 2, rowGap: 16, columnGap: 16, children: duotones.map((duotone) => {
      return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
        import_components92.__experimentalGrid,
        {
          className: "editor-style-book__duotone-example",
          columns: 2,
          rowGap: 8,
          columnGap: 8,
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
              "img",
              {
                alt: `Duotone example: ${duotone.slug}`,
                src: "https://s.w.org/images/core/5.3/MtBlanc1.jpg",
                style: {
                  filter: `url(#wp-duotone-${duotone.slug})`
                }
              }
            ) }),
            duotone.colors.map((color) => {
              return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
                "div",
                {
                  className: "editor-style-book__color-example",
                  style: { backgroundColor: color }
                },
                color
              );
            })
          ]
        },
        duotone.slug
      );
    }) });
  };
  var duotone_examples_default = DuotoneExamples;

  // packages/editor/build-module/components/style-book/examples.mjs
  var import_jsx_runtime192 = __toESM(require_jsx_runtime(), 1);
  function getColorExamples(colors) {
    if (!colors) {
      return [];
    }
    const examples = [];
    STYLE_BOOK_COLOR_GROUPS.forEach((group) => {
      const palette = colors[group.type];
      const paletteFiltered = Array.isArray(palette) ? palette.find(
        (origin) => origin.slug === group.origin
      ) : void 0;
      if (paletteFiltered?.[group.type]) {
        const example = {
          name: group.slug,
          title: group.title,
          category: "colors"
        };
        if (group.type === "duotones") {
          example.content = /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
            duotone_examples_default,
            {
              duotones: paletteFiltered[group.type]
            }
          );
          examples.push(example);
        } else {
          example.content = /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
            color_examples_default,
            {
              colors: paletteFiltered[group.type],
              type: group.type
            }
          );
          examples.push(example);
        }
      }
    });
    return examples;
  }
  function getOverviewBlockExamples(colors) {
    const examples = [];
    const themePalette = Array.isArray(colors?.colors) ? colors.colors.find(
      (origin) => origin.slug === "theme"
    ) : void 0;
    if (themePalette) {
      const themeColorexample = {
        name: "theme-colors",
        title: (0, import_i18n111.__)("Colors"),
        category: "overview",
        content: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
          color_examples_default,
          {
            colors: themePalette.colors,
            type: "colors",
            templateColumns: "repeat(auto-fill, minmax( 200px, 1fr ))",
            itemHeight: "32px"
          }
        )
      };
      examples.push(themeColorexample);
    }
    const typographyBlockExamples = [];
    if ((0, import_blocks21.getBlockType)("core/heading")) {
      const headingBlock = (0, import_blocks21.createBlock)("core/heading", {
        // translators: Typography example. Your local alphabet, numbers and some common special characters.
        content: (0, import_i18n111.__)(
          `AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789X{(\u2026)},.-<>?!*&:/A@HELFO\u2122\xA9`
        ),
        level: 1
      });
      typographyBlockExamples.push(headingBlock);
    }
    if ((0, import_blocks21.getBlockType)("core/paragraph")) {
      const firstParagraphBlock = (0, import_blocks21.createBlock)("core/paragraph", {
        content: (0, import_i18n111.__)(
          `A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.`
        )
      });
      const secondParagraphBlock = (0, import_blocks21.createBlock)("core/paragraph", {
        content: (0, import_i18n111.__)(
          `Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.`
        )
      });
      if ((0, import_blocks21.getBlockType)("core/group")) {
        const groupBlock = (0, import_blocks21.createBlock)(
          "core/group",
          {
            layout: {
              type: "grid",
              columnCount: 2,
              minimumColumnWidth: "12rem"
            },
            style: {
              spacing: {
                blockGap: "1.5rem"
              }
            }
          },
          [firstParagraphBlock, secondParagraphBlock]
        );
        typographyBlockExamples.push(groupBlock);
      } else {
        typographyBlockExamples.push(firstParagraphBlock);
      }
    }
    if (!!typographyBlockExamples.length) {
      examples.push({
        name: "typography",
        title: (0, import_i18n111.__)("Typography"),
        category: "overview",
        blocks: typographyBlockExamples
      });
    }
    const otherBlockExamples = [
      "core/image",
      "core/separator",
      "core/buttons",
      "core/quote",
      "core/search"
    ];
    otherBlockExamples.forEach((blockName) => {
      const blockType = (0, import_blocks21.getBlockType)(blockName);
      if (blockType && blockType.example) {
        const blockExample = {
          name: blockName,
          title: blockType.title,
          category: "overview",
          /*
           * CSS generated from style attributes will take precedence over global styles CSS,
           * so remove the style attribute from the example to ensure the example
           * demonstrates changes to global styles.
           */
          blocks: (0, import_blocks21.getBlockFromExample)(blockName, {
            ...blockType.example,
            attributes: {
              ...blockType.example.attributes,
              style: void 0
            }
          })
        };
        examples.push(blockExample);
      }
    });
    return examples;
  }
  function getExamples(colors) {
    const nonHeadingBlockExamples = (0, import_blocks21.getBlockTypes)().filter((blockType) => {
      const { name: name2, example, supports } = blockType;
      return name2 !== "core/heading" && !!example && supports?.inserter !== false;
    }).map((blockType) => ({
      name: blockType.name,
      title: blockType.title,
      category: blockType.category,
      /*
       * CSS generated from style attributes will take precedence over global styles CSS,
       * so remove the style attribute from the example to ensure the example
       * demonstrates changes to global styles.
       */
      blocks: (0, import_blocks21.getBlockFromExample)(blockType.name, {
        ...blockType.example,
        attributes: {
          ...blockType.example.attributes,
          style: void 0
        }
      })
    }));
    const isHeadingBlockRegistered = !!(0, import_blocks21.getBlockType)("core/heading");
    if (!isHeadingBlockRegistered) {
      return nonHeadingBlockExamples;
    }
    const headingsExample = {
      name: "core/heading",
      title: (0, import_i18n111.__)("Headings"),
      category: "text",
      blocks: [1, 2, 3, 4, 5, 6].map((level) => {
        return (0, import_blocks21.createBlock)("core/heading", {
          content: (0, import_i18n111.sprintf)(
            // translators: %d: heading level e.g: "1", "2", "3"
            (0, import_i18n111.__)("Heading %d"),
            level
          ),
          level
        });
      })
    };
    const colorExamples = getColorExamples(colors);
    const overviewBlockExamples = getOverviewBlockExamples(colors);
    return [
      headingsExample,
      ...colorExamples,
      ...nonHeadingBlockExamples,
      ...overviewBlockExamples
    ];
  }

  // packages/editor/build-module/components/global-styles-renderer/index.mjs
  var import_element76 = __toESM(require_element(), 1);
  var import_data72 = __toESM(require_data(), 1);

  // packages/editor/build-module/hooks/use-global-styles-output.mjs
  var import_blocks22 = __toESM(require_blocks(), 1);
  var import_data71 = __toESM(require_data(), 1);
  var import_element75 = __toESM(require_element(), 1);
  function useGlobalStylesOutputWithConfig(mergedConfig = {}, disableRootPadding = false) {
    const blockGap = useSetting2("spacing.blockGap");
    const hasBlockGapSupport = blockGap !== null;
    const hasFallbackGapSupport = !hasBlockGapSupport;
    const { disableLayoutStyles, getBlockStyles } = (0, import_data71.useSelect)((select5) => {
      const { getEditorSettings: getEditorSettings2 } = select5(store);
      const { getBlockStyles: getBlockStylesSelector } = select5(import_blocks22.store);
      const settings = getEditorSettings2();
      return {
        disableLayoutStyles: !!settings?.disableLayoutStyles,
        getBlockStyles: getBlockStylesSelector
      };
    }, []);
    return (0, import_element75.useMemo)(() => {
      if (!mergedConfig?.styles || !mergedConfig?.settings) {
        return [[], {}];
      }
      const blockTypes = (0, import_blocks22.getBlockTypes)();
      return generateGlobalStyles(mergedConfig, blockTypes, {
        hasBlockGapSupport,
        hasFallbackGapSupport,
        disableLayoutStyles,
        disableRootPadding,
        getBlockStyles
      });
    }, [
      hasBlockGapSupport,
      hasFallbackGapSupport,
      mergedConfig,
      disableLayoutStyles,
      disableRootPadding,
      getBlockStyles
    ]);
  }
  function useGlobalStylesOutput(disableRootPadding = false) {
    const { merged: mergedConfig } = useGlobalStyles();
    return useGlobalStylesOutputWithConfig(mergedConfig, disableRootPadding);
  }

  // packages/editor/build-module/components/global-styles-renderer/index.mjs
  function useGlobalStylesRenderer(disableRootPadding) {
    const [styles, settings] = useGlobalStylesOutput(disableRootPadding);
    const { getEditorSettings: getEditorSettings2 } = (0, import_data72.useSelect)(store);
    const { updateEditorSettings: updateEditorSettings2 } = (0, import_data72.useDispatch)(store);
    (0, import_element76.useEffect)(() => {
      if (!styles || !settings) {
        return;
      }
      const currentStoreSettings = getEditorSettings2();
      const nonGlobalStyles = Object.values(
        currentStoreSettings.styles ?? []
      ).filter((style) => !style.isGlobalStyles);
      updateEditorSettings2({
        ...currentStoreSettings,
        styles: [...nonGlobalStyles, ...styles],
        __experimentalFeatures: settings
      });
    }, [styles, settings, updateEditorSettings2, getEditorSettings2]);
  }
  function GlobalStylesRenderer({ disableRootPadding }) {
    useGlobalStylesRenderer(disableRootPadding);
    return null;
  }

  // packages/editor/build-module/components/style-book/index.mjs
  var import_jsx_runtime193 = __toESM(require_jsx_runtime(), 1);
  var { ExperimentalBlockEditorProvider: ExperimentalBlockEditorProvider2 } = unlock(import_block_editor38.privateApis);
  var { Tabs: Tabs3 } = unlock(import_components93.privateApis);
  function isObjectEmpty(object) {
    return !object || Object.keys(object).length === 0;
  }
  var scrollToSection = (anchorId, iframe) => {
    if (!anchorId || !iframe || !iframe?.contentDocument) {
      return;
    }
    const element = anchorId === "top" ? iframe.contentDocument.body : iframe.contentDocument.getElementById(anchorId);
    if (element) {
      element.scrollIntoView({
        behavior: "smooth"
      });
    }
  };
  var getStyleBookNavigationFromPath = (path) => {
    if (path && typeof path === "string") {
      if (path === "/" || path.startsWith("/typography") || path.startsWith("/colors") || path.startsWith("/blocks")) {
        return {
          top: true
        };
      }
    }
    return null;
  };
  function useMultiOriginPalettes() {
    const { colors, gradients } = (0, import_block_editor38.__experimentalUseMultipleOriginColorsAndGradients)();
    const [
      shouldDisplayDefaultDuotones,
      customDuotones,
      themeDuotones,
      defaultDuotones
    ] = (0, import_block_editor38.useSettings)(
      "color.defaultDuotone",
      "color.duotone.custom",
      "color.duotone.theme",
      "color.duotone.default"
    );
    const palettes = (0, import_element77.useMemo)(() => {
      const result = { colors, gradients, duotones: [] };
      if (themeDuotones && themeDuotones.length) {
        result.duotones.push({
          name: (0, import_i18n112._x)(
            "Theme",
            "Indicates these duotone filters come from the theme."
          ),
          slug: "theme",
          duotones: themeDuotones
        });
      }
      if (shouldDisplayDefaultDuotones && defaultDuotones && defaultDuotones.length) {
        result.duotones.push({
          name: (0, import_i18n112._x)(
            "Default",
            "Indicates these duotone filters come from WordPress."
          ),
          slug: "default",
          duotones: defaultDuotones
        });
      }
      if (customDuotones && customDuotones.length) {
        result.duotones.push({
          name: (0, import_i18n112._x)(
            "Custom",
            "Indicates these doutone filters are created by the user."
          ),
          slug: "custom",
          duotones: customDuotones
        });
      }
      return result;
    }, [
      colors,
      gradients,
      customDuotones,
      themeDuotones,
      defaultDuotones,
      shouldDisplayDefaultDuotones
    ]);
    return palettes;
  }
  function getExamplesForSinglePageUse(examples) {
    const examplesForSinglePageUse = [];
    const overviewCategoryExamples = getExamplesByCategory(
      { slug: "overview" },
      examples
    );
    examplesForSinglePageUse.push(...overviewCategoryExamples.examples);
    const otherExamples = examples.filter((example) => {
      return example.category !== "overview" && !overviewCategoryExamples.examples.find(
        (overviewExample) => overviewExample.name === example.name
      );
    });
    examplesForSinglePageUse.push(...otherExamples);
    return examplesForSinglePageUse;
  }
  function applyBlockVariationsToExamples(examples, variation) {
    if (!variation) {
      return examples;
    }
    return examples.map((example) => {
      return {
        ...example,
        variation,
        blocks: Array.isArray(example.blocks) ? example.blocks.map((block) => ({
          ...block,
          attributes: {
            ...block.attributes,
            style: void 0,
            className: `is-style-${variation}`
          }
        })) : {
          ...example.blocks,
          attributes: {
            ...example.blocks.attributes,
            style: void 0,
            className: `is-style-${variation}`
          }
        }
      };
    });
  }
  function StyleBook({
    isSelected,
    onClick,
    onSelect,
    showTabs = true,
    userConfig = {},
    path = ""
  }, ref) {
    const textColor = useStyle2("color.text");
    const backgroundColor = useStyle2("color.background");
    const colors = useMultiOriginPalettes();
    const examples = (0, import_element77.useMemo)(() => getExamples(colors), [colors]);
    const tabs = (0, import_element77.useMemo)(
      () => getTopLevelStyleBookCategories().filter(
        (category) => examples.some(
          (example) => example.category === category.slug
        )
      ),
      [examples]
    );
    const examplesForSinglePageUse = getExamplesForSinglePageUse(examples);
    const { base: baseConfig } = useGlobalStyles();
    const goTo = getStyleBookNavigationFromPath(path);
    const mergedConfig = (0, import_element77.useMemo)(() => {
      if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) {
        return mergeGlobalStyles(baseConfig, userConfig);
      }
      return {};
    }, [baseConfig, userConfig]);
    const originalSettings = (0, import_data73.useSelect)(
      (select5) => select5(import_block_editor38.store).getSettings(),
      []
    );
    const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
    const settings = (0, import_element77.useMemo)(
      () => ({
        ...originalSettings,
        styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : originalSettings.styles,
        isPreviewMode: true
      }),
      [globalStyles, originalSettings, userConfig]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
      "div",
      {
        ref,
        className: clsx_default("editor-style-book", {
          "is-button": !!onClick
        }),
        style: {
          color: textColor,
          background: backgroundColor
        },
        children: showTabs ? /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(Tabs3, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { className: "editor-style-book__tablist-container", children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(Tabs3.TabList, { children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(Tabs3.Tab, { tabId: tab.slug, children: tab.title }, tab.slug)) }) }),
          tabs.map((tab) => {
            const categoryDefinition = tab.slug ? getTopLevelStyleBookCategories().find(
              (_category) => _category.slug === tab.slug
            ) : null;
            const filteredExamples = categoryDefinition ? getExamplesByCategory(
              categoryDefinition,
              examples
            ) : { examples };
            return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
              Tabs3.TabPanel,
              {
                tabId: tab.slug,
                focusable: false,
                className: "editor-style-book__tabpanel",
                children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
                  StyleBookBody,
                  {
                    category: tab.slug,
                    examples: filteredExamples,
                    isSelected,
                    onSelect,
                    settings,
                    title: tab.title,
                    goTo
                  }
                )
              },
              tab.slug
            );
          })
        ] }) : /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
          StyleBookBody,
          {
            examples: { examples: examplesForSinglePageUse },
            isSelected,
            onClick,
            onSelect,
            settings,
            goTo
          }
        )
      }
    );
  }
  var StyleBookPreview = ({
    userConfig = {},
    isStatic = false,
    path,
    onPathChange
  }) => {
    const editorSettings2 = (0, import_data73.useSelect)(
      (select5) => select5(store).getEditorSettings(),
      []
    );
    const canUserUploadMedia = (0, import_data73.useSelect)(
      (select5) => select5(import_core_data52.store).canUser("create", {
        kind: "postType",
        name: "attachment"
      }),
      []
    );
    (0, import_element77.useEffect)(() => {
      (0, import_data73.dispatch)(import_block_editor38.store).updateSettings({
        ...editorSettings2,
        mediaUpload: canUserUploadMedia ? import_media_utils5.uploadMedia : void 0
      });
    }, [editorSettings2, canUserUploadMedia]);
    const [internalPath, setInternalPath] = (0, import_element77.useState)("/");
    const section = path ?? internalPath;
    const onChangeSection = onPathChange ?? setInternalPath;
    const isSelected = (blockName) => {
      return section === `/blocks/${encodeURIComponent(blockName)}` || section.startsWith(
        `/blocks/${encodeURIComponent(blockName)}/`
      );
    };
    const onSelect = (blockName, isBlockVariation = false) => {
      if (STYLE_BOOK_COLOR_GROUPS.find(
        (group) => group.slug === blockName
      )) {
        onChangeSection("/colors/palette");
        return;
      }
      if (blockName === "typography") {
        onChangeSection("/typography");
        return;
      }
      if (isBlockVariation) {
        return;
      }
      onChangeSection(`/blocks/${encodeURIComponent(blockName)}`);
    };
    const colors = useMultiOriginPalettes();
    const examples = getExamples(colors);
    const examplesForSinglePageUse = getExamplesForSinglePageUse(examples);
    let previewCategory = null;
    let blockVariation = null;
    if (section.includes("/colors")) {
      previewCategory = "colors";
    } else if (section.includes("/typography")) {
      previewCategory = "text";
    } else if (section.includes("/blocks")) {
      previewCategory = "blocks";
      let blockName = decodeURIComponent(section).split("/blocks/")[1];
      if (blockName?.includes("/variations")) {
        [blockName, blockVariation] = blockName.split("/variations/");
      }
      if (blockName && examples.find((example) => example.name === blockName)) {
        previewCategory = blockName;
      }
    } else if (!isStatic) {
      previewCategory = "overview";
    }
    const categoryDefinition = STYLE_BOOK_PREVIEW_CATEGORIES.find(
      (category) => category.slug === previewCategory
    );
    const filteredExamples = (0, import_element77.useMemo)(() => {
      if (!categoryDefinition) {
        return {
          examples: [
            examples.find(
              (example) => example.name === previewCategory
            )
          ]
        };
      }
      return getExamplesByCategory(categoryDefinition, examples);
    }, [categoryDefinition, examples, previewCategory]);
    const displayedExamples = (0, import_element77.useMemo)(() => {
      if (!previewCategory) {
        return { examples: examplesForSinglePageUse };
      }
      if (blockVariation) {
        return {
          examples: applyBlockVariationsToExamples(
            filteredExamples.examples,
            blockVariation
          )
        };
      }
      return filteredExamples;
    }, [
      previewCategory,
      examplesForSinglePageUse,
      blockVariation,
      filteredExamples
    ]);
    const { base: baseConfig } = useGlobalStyles();
    const goTo = getStyleBookNavigationFromPath(section);
    const mergedConfig = (0, import_element77.useMemo)(() => {
      if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) {
        return mergeGlobalStyles(baseConfig, userConfig);
      }
      return {};
    }, [baseConfig, userConfig]);
    const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
    const settings = (0, import_element77.useMemo)(
      () => ({
        ...editorSettings2,
        styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : editorSettings2.styles,
        isPreviewMode: true
      }),
      [globalStyles, editorSettings2, userConfig]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { className: "editor-style-book", children: /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(import_block_editor38.BlockEditorProvider, { settings, children: [
      /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(GlobalStylesRenderer, { disableRootPadding: true }),
      /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
        StyleBookBody,
        {
          examples: displayedExamples,
          settings,
          goTo,
          isSelected: !isStatic ? isSelected : null,
          onSelect: !isStatic ? onSelect : null
        }
      )
    ] }) });
  };
  var StyleBookBody = ({
    examples,
    isSelected,
    onClick,
    onSelect,
    settings,
    title,
    goTo
  }) => {
    const [isFocused, setIsFocused] = (0, import_element77.useState)(false);
    const [hasIframeLoaded, setHasIframeLoaded] = (0, import_element77.useState)(false);
    const iframeRef = (0, import_element77.useRef)(null);
    const buttonModeProps = {
      role: "button",
      onFocus: () => setIsFocused(true),
      onBlur: () => setIsFocused(false),
      onKeyDown: (event) => {
        if (event.defaultPrevented) {
          return;
        }
        const { keyCode } = event;
        if (onClick && (keyCode === import_keycodes4.ENTER || keyCode === import_keycodes4.SPACE)) {
          event.preventDefault();
          onClick(event);
        }
      },
      onClick: (event) => {
        if (event.defaultPrevented) {
          return;
        }
        if (onClick) {
          event.preventDefault();
          onClick(event);
        }
      },
      readonly: true
    };
    const handleLoad = () => setHasIframeLoaded(true);
    (0, import_element77.useLayoutEffect)(() => {
      if (hasIframeLoaded && iframeRef.current && goTo?.top) {
        scrollToSection("top", iframeRef.current);
      }
    }, [goTo?.top, hasIframeLoaded]);
    return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
      import_block_editor38.__unstableIframe,
      {
        onLoad: handleLoad,
        ref: iframeRef,
        className: clsx_default("editor-style-book__iframe", {
          "is-focused": isFocused && !!onClick,
          "is-button": !!onClick
        }),
        name: "style-book-canvas",
        tabIndex: 0,
        ...onClick ? buttonModeProps : {},
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(import_block_editor38.__unstableEditorStyles, { styles: settings.styles }),
          /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("style", { children: [
            STYLE_BOOK_IFRAME_STYLES,
            !!onClick && "body { cursor: pointer; } body * { pointer-events: none; }"
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
            Examples,
            {
              className: "editor-style-book__examples",
              filteredExamples: examples,
              label: title ? (0, import_i18n112.sprintf)(
                // translators: %s: Category of blocks, e.g. Text.
                (0, import_i18n112.__)("Examples of blocks in the %s category"),
                title
              ) : (0, import_i18n112.__)("Examples of blocks"),
              isSelected,
              onSelect
            },
            title
          )
        ]
      }
    );
  };
  var Examples = (0, import_element77.memo)(
    ({ className, filteredExamples, label, isSelected, onSelect }) => {
      return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
        import_components93.Composite,
        {
          orientation: "vertical",
          className,
          "aria-label": label,
          role: "grid",
          children: [
            !!filteredExamples?.examples?.length && filteredExamples.examples.map((example) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
              Example,
              {
                id: `example-${example.name}`,
                title: example.title,
                content: example.content,
                blocks: example.blocks,
                isSelected: isSelected?.(example.name),
                onClick: !!onSelect ? () => onSelect(
                  example.name,
                  !!example.variation
                ) : null
              },
              example.name
            )),
            !!filteredExamples?.subcategories?.length && filteredExamples.subcategories.map((subcategory) => /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
              import_components93.Composite.Group,
              {
                className: "editor-style-book__subcategory",
                children: [
                  /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(import_components93.Composite.GroupLabel, { children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("h2", { className: "editor-style-book__subcategory-title", children: subcategory.title }) }),
                  /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
                    Subcategory,
                    {
                      examples: subcategory.examples,
                      isSelected,
                      onSelect
                    }
                  )
                ]
              },
              `subcategory-${subcategory.slug}`
            ))
          ]
        }
      );
    }
  );
  var Subcategory = ({ examples, isSelected, onSelect }) => {
    return !!examples?.length && examples.map((example) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
      Example,
      {
        id: `example-${example.name}`,
        title: example.title,
        content: example.content,
        blocks: example.blocks,
        isSelected: isSelected?.(example.name),
        onClick: !!onSelect ? () => onSelect(example.name) : null
      },
      example.name
    ));
  };
  var disabledExamples = ["example-duotones"];
  var Example = ({ id, title, blocks, isSelected, onClick, content }) => {
    const originalSettings = (0, import_data73.useSelect)(
      (select5) => select5(import_block_editor38.store).getSettings(),
      []
    );
    const settings = (0, import_element77.useMemo)(
      () => ({
        ...originalSettings,
        focusMode: false,
        // Disable "Spotlight mode".
        isPreviewMode: true
      }),
      [originalSettings]
    );
    const renderedBlocks = (0, import_element77.useMemo)(
      () => Array.isArray(blocks) ? blocks : [blocks],
      [blocks]
    );
    const disabledProps = disabledExamples.includes(id) || !onClick ? {
      disabled: true,
      accessibleWhenDisabled: !!onClick
    } : {};
    return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { role: "row", children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
      import_components93.Composite.Item,
      {
        className: clsx_default("editor-style-book__example", {
          "is-selected": isSelected,
          "is-disabled-example": !!disabledProps?.disabled
        }),
        id,
        "aria-label": !!onClick ? (0, import_i18n112.sprintf)(
          // translators: %s: Title of a block, e.g. Heading.
          (0, import_i18n112.__)("Open %s styles in Styles panel"),
          title
        ) : void 0,
        render: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", {}),
        role: !!onClick ? "button" : null,
        onClick,
        ...disabledProps,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("span", { className: "editor-style-book__example-title", children: title }),
          /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
            "div",
            {
              className: "editor-style-book__example-preview",
              "aria-hidden": true,
              children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(import_components93.Disabled, { className: "editor-style-book__example-preview__content", children: content ? content : /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
                ExperimentalBlockEditorProvider2,
                {
                  value: renderedBlocks,
                  settings,
                  children: [
                    /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(import_block_editor38.__unstableEditorStyles, {}),
                    /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(import_block_editor38.BlockList, { renderAppender: false })
                  ]
                }
              ) })
            }
          )
        ]
      }
    ) }) });
  };
  var style_book_default = (0, import_element77.forwardRef)(StyleBook);

  // packages/editor/build-module/components/styles-canvas/style-book.mjs
  var import_jsx_runtime194 = __toESM(require_jsx_runtime(), 1);
  function StylesCanvasStyleBook({ path, onPathChange }, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
      style_book_default,
      {
        ref,
        isSelected: (blockName) => (
          // Match '/blocks/core%2Fbutton' and
          // '/blocks/core%2Fbutton/typography', but not
          // '/blocks/core%2Fbuttons'.
          path === `/blocks/${encodeURIComponent(blockName)}` || path?.startsWith(
            `/blocks/${encodeURIComponent(blockName)}/`
          )
        ),
        onSelect: (blockName) => {
          if (STYLE_BOOK_COLOR_GROUPS.find(
            (group) => group.slug === blockName
          )) {
            onPathChange?.("/colors/palette");
            return;
          }
          if (blockName === "typography") {
            onPathChange?.("/typography");
            return;
          }
          onPathChange?.("/blocks/" + encodeURIComponent(blockName));
        }
      }
    );
  }
  var style_book_default2 = (0, import_element78.forwardRef)(StylesCanvasStyleBook);

  // packages/editor/build-module/components/styles-canvas/revisions.mjs
  var import_components94 = __toESM(require_components(), 1);
  var import_block_editor39 = __toESM(require_block_editor(), 1);
  var import_data74 = __toESM(require_data(), 1);
  var import_element79 = __toESM(require_element(), 1);
  var import_jsx_runtime195 = __toESM(require_jsx_runtime(), 1);
  var {
    ExperimentalBlockEditorProvider: ExperimentalBlockEditorProvider3,
    __unstableBlockStyleVariationOverridesWithConfig
  } = unlock(import_block_editor39.privateApis);
  function isObjectEmpty2(object) {
    return !object || Object.keys(object).length === 0;
  }
  function StylesCanvasRevisions({ path }, ref) {
    const blocks = (0, import_data74.useSelect)((select5) => {
      return select5(import_block_editor39.store).getBlocks();
    }, []);
    const { user: userConfig, base: baseConfig } = useGlobalStyles();
    const { revisions, isLoading } = useGlobalStylesRevisions();
    const revisionId = (0, import_element79.useMemo)(() => {
      const match2 = path?.match(/^\/revisions\/(.+)$/);
      return match2 ? match2[1] : null;
    }, [path]);
    const selectedRevision = (0, import_element79.useMemo)(() => {
      if (!revisionId || !revisions.length) {
        return null;
      }
      return revisions.find(
        (rev) => String(rev.id) === String(revisionId)
      );
    }, [revisionId, revisions]);
    const displayConfig = selectedRevision || userConfig;
    const mergedConfig = (0, import_element79.useMemo)(() => {
      if (!isObjectEmpty2(displayConfig) && !isObjectEmpty2(baseConfig)) {
        return mergeGlobalStyles(baseConfig, displayConfig);
      }
      return {};
    }, [baseConfig, displayConfig]);
    const renderedBlocksArray = (0, import_element79.useMemo)(
      () => Array.isArray(blocks) ? blocks : [blocks],
      [blocks]
    );
    const originalSettings = (0, import_data74.useSelect)(
      (select5) => select5(import_block_editor39.store).getSettings(),
      []
    );
    const settings = (0, import_element79.useMemo)(
      () => ({
        ...originalSettings,
        isPreviewMode: true
      }),
      [originalSettings]
    );
    const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
    const editorStyles = !isObjectEmpty2(globalStyles) && !isObjectEmpty2(displayConfig) ? globalStyles : settings.styles;
    if (isLoading) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(
      import_block_editor39.__unstableIframe,
      {
        ref,
        className: "editor-revisions__iframe",
        name: "revisions",
        tabIndex: 0,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("style", {
            // Forming a "block formatting context" to prevent margin collapsing.
            // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
            children: `.is-root-container { display: flow-root; }`
          }),
          /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_components94.Disabled, { className: "editor-revisions__example-preview__content", children: /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(
            ExperimentalBlockEditorProvider3,
            {
              value: renderedBlocksArray,
              settings,
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_block_editor39.BlockList, { renderAppender: false }),
                /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_block_editor39.__unstableEditorStyles, { styles: editorStyles }),
                /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
                  __unstableBlockStyleVariationOverridesWithConfig,
                  {
                    config: mergedConfig
                  }
                )
              ]
            }
          ) })
        ]
      }
    );
  }
  var revisions_default = (0, import_element79.forwardRef)(StylesCanvasRevisions);

  // packages/editor/build-module/components/resizable-editor/index.mjs
  var import_element80 = __toESM(require_element(), 1);
  var import_components96 = __toESM(require_components(), 1);

  // packages/editor/build-module/components/resizable-editor/resize-handle.mjs
  var import_i18n113 = __toESM(require_i18n(), 1);
  var import_keycodes5 = __toESM(require_keycodes(), 1);
  var import_components95 = __toESM(require_components(), 1);
  var import_jsx_runtime196 = __toESM(require_jsx_runtime(), 1);
  var DELTA_DISTANCE = 20;
  function ResizeHandle({ direction, resizeWidthBy }) {
    function handleKeyDown(event) {
      const { keyCode } = event;
      if (keyCode !== import_keycodes5.LEFT && keyCode !== import_keycodes5.RIGHT) {
        return;
      }
      event.preventDefault();
      if (direction === "left" && keyCode === import_keycodes5.LEFT || direction === "right" && keyCode === import_keycodes5.RIGHT) {
        resizeWidthBy(DELTA_DISTANCE);
      } else if (direction === "left" && keyCode === import_keycodes5.RIGHT || direction === "right" && keyCode === import_keycodes5.LEFT) {
        resizeWidthBy(-DELTA_DISTANCE);
      }
    }
    const resizeHandleVariants = {
      active: {
        opacity: 1,
        scaleY: 1.3
      }
    };
    const resizableHandleHelpId = `resizable-editor__resize-help-${direction}`;
    return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)(import_jsx_runtime196.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_components95.Tooltip, { text: (0, import_i18n113.__)("Drag to resize"), children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
        import_components95.__unstableMotion.button,
        {
          className: `editor-resizable-editor__resize-handle is-${direction}`,
          "aria-label": (0, import_i18n113.__)("Drag to resize"),
          "aria-describedby": resizableHandleHelpId,
          onKeyDown: handleKeyDown,
          variants: resizeHandleVariants,
          whileFocus: "active",
          whileHover: "active",
          whileTap: "active",
          role: "separator",
          "aria-orientation": "vertical"
        },
        "handle"
      ) }),
      /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_components95.VisuallyHidden, { id: resizableHandleHelpId, children: (0, import_i18n113.__)("Use left and right arrow keys to resize the canvas.") })
    ] });
  }

  // packages/editor/build-module/components/resizable-editor/index.mjs
  var import_jsx_runtime197 = __toESM(require_jsx_runtime(), 1);
  var HANDLE_STYLES_OVERRIDE = {
    position: void 0,
    userSelect: void 0,
    cursor: void 0,
    width: void 0,
    height: void 0,
    top: void 0,
    right: void 0,
    bottom: void 0,
    left: void 0
  };
  function ResizableEditor({ className, enableResizing, height, children }) {
    const [width, setWidth] = (0, import_element80.useState)("100%");
    const resizableRef = (0, import_element80.useRef)();
    const resizeWidthBy = (0, import_element80.useCallback)((deltaPixels) => {
      if (resizableRef.current) {
        setWidth(resizableRef.current.offsetWidth + deltaPixels);
      }
    }, []);
    return /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
      import_components96.ResizableBox,
      {
        className: clsx_default("editor-resizable-editor", className, {
          "is-resizable": enableResizing
        }),
        ref: (api) => {
          resizableRef.current = api?.resizable;
        },
        size: {
          width: enableResizing ? width : "100%",
          height: enableResizing && height ? height : "100%"
        },
        onResizeStop: (event, direction, element) => {
          setWidth(element.style.width);
        },
        minWidth: 300,
        maxWidth: "100%",
        maxHeight: "100%",
        enable: {
          left: enableResizing,
          right: enableResizing
        },
        showHandle: enableResizing,
        resizeRatio: 2,
        handleComponent: {
          left: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
            ResizeHandle,
            {
              direction: "left",
              resizeWidthBy
            }
          ),
          right: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
            ResizeHandle,
            {
              direction: "right",
              resizeWidthBy
            }
          )
        },
        handleClasses: void 0,
        handleStyles: {
          left: HANDLE_STYLES_OVERRIDE,
          right: HANDLE_STYLES_OVERRIDE
        },
        children
      }
    );
  }
  var resizable_editor_default = ResizableEditor;

  // packages/editor/build-module/components/styles-canvas/index.mjs
  var import_jsx_runtime198 = __toESM(require_jsx_runtime(), 1);
  function getStylesCanvasTitle(path, showStylebook2) {
    if (showStylebook2) {
      return (0, import_i18n114.__)("Style Book");
    }
    if (path?.startsWith("/revisions")) {
      return (0, import_i18n114.__)("Style Revisions");
    }
    return "";
  }
  function StylesCanvas() {
    const { stylesPath: stylesPath2, showStylebook: showStylebook2, showListViewByDefault } = (0, import_data75.useSelect)(
      (select5) => {
        const { getStylesPath: getStylesPath2, getShowStylebook: getShowStylebook2 } = unlock(
          select5(store)
        );
        const _showListViewByDefault = select5(import_preferences11.store).get(
          "core",
          "showListViewByDefault"
        );
        return {
          stylesPath: getStylesPath2(),
          showStylebook: getShowStylebook2(),
          showListViewByDefault: _showListViewByDefault
        };
      },
      []
    );
    const { resetStylesNavigation: resetStylesNavigation2, setStylesPath: setStylesPath2 } = unlock(
      (0, import_data75.useDispatch)(store)
    );
    const { setIsListViewOpened: setIsListViewOpened2 } = (0, import_data75.useDispatch)(store);
    const focusOnMountRef = (0, import_compose18.useFocusOnMount)("firstElement");
    const sectionFocusReturnRef = (0, import_compose18.useFocusReturn)();
    let content = null;
    if (showStylebook2) {
      content = /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
        style_book_default2,
        {
          path: stylesPath2,
          onPathChange: setStylesPath2,
          ref: sectionFocusReturnRef
        }
      );
    } else if (stylesPath2?.startsWith("/revisions")) {
      content = /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
        revisions_default,
        {
          path: stylesPath2,
          ref: sectionFocusReturnRef
        }
      );
    }
    const title = getStylesCanvasTitle(stylesPath2, showStylebook2);
    const onCloseCanvas = () => {
      setIsListViewOpened2(showListViewByDefault);
      resetStylesNavigation2();
    };
    const closeOnEscape = (event) => {
      if (event.keyCode === import_keycodes6.ESCAPE && !event.defaultPrevented) {
        event.preventDefault();
        onCloseCanvas();
      }
    };
    return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "editor-styles-canvas", children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(resizable_editor_default, { enableResizing: false, children: /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(
      "section",
      {
        className: "editor-styles-canvas__section",
        ref: focusOnMountRef,
        onKeyDown: closeOnEscape,
        "aria-label": title,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
            import_components97.Button,
            {
              size: "compact",
              className: "editor-styles-canvas__close-button",
              icon: close_small_default,
              label: (0, import_i18n114.__)("Close"),
              onClick: onCloseCanvas
            }
          ),
          content
        ]
      }
    ) }) });
  }

  // packages/editor/build-module/components/document-bar/useEditedSectionDetails.mjs
  var import_data76 = __toESM(require_data(), 1);
  var import_html_entities10 = __toESM(require_html_entities(), 1);
  var import_block_editor40 = __toESM(require_block_editor(), 1);
  var import_core_data53 = __toESM(require_core_data(), 1);
  function useEditedSectionDetails() {
    return (0, import_data76.useSelect)((select5) => {
      if (!window?.__experimentalContentOnlyPatternInsertion) {
        return null;
      }
      const {
        getBlockAttributes: getBlockAttributes2,
        getBlockName: getBlockName2,
        __experimentalGetParsedPattern
      } = select5(import_block_editor40.store);
      const { getEditedEntityRecord, getCurrentTheme } = select5(import_core_data53.store);
      const { getEditedContentOnlySection } = unlock(
        select5(import_block_editor40.store)
      );
      const editedSectionId = getEditedContentOnlySection();
      if (!editedSectionId) {
        return null;
      }
      const attributes = getBlockAttributes2(editedSectionId);
      const patternName = attributes?.metadata?.patternName;
      if (patternName) {
        const pattern = typeof __experimentalGetParsedPattern === "function" ? __experimentalGetParsedPattern(patternName) : null;
        return {
          patternName,
          patternTitle: pattern?.title || attributes?.metadata?.name,
          type: "pattern"
        };
      }
      const blockName = getBlockName2(editedSectionId);
      if (blockName === "core/block" && !!attributes?.ref) {
        const entity = getEditedEntityRecord(
          "postType",
          "wp_block",
          attributes.ref
        );
        if (entity?.title) {
          return {
            patternName: attributes.ref,
            patternTitle: (0, import_html_entities10.decodeEntities)(entity.title),
            type: "synced-pattern"
          };
        }
      }
      if (blockName === "core/template-part" && !!attributes?.slug) {
        const theme = attributes.theme || getCurrentTheme()?.stylesheet;
        const templatePartId = theme ? `${theme}//${attributes.slug}` : null;
        if (templatePartId) {
          const entity = getEditedEntityRecord(
            "postType",
            "wp_template_part",
            templatePartId
          );
          if (entity?.title) {
            return {
              patternName: attributes.slug,
              patternTitle: (0, import_html_entities10.decodeEntities)(entity.title),
              type: "template-part"
            };
          }
        }
      }
      return null;
    }, []);
  }

  // packages/editor/build-module/components/document-bar/index.mjs
  var import_jsx_runtime199 = __toESM(require_jsx_runtime(), 1);
  var MotionButton = import_components98.__unstableMotion.create(import_components98.Button);
  function DocumentBar(props) {
    const { stopEditingContentOnlySection } = unlock(
      (0, import_data77.useDispatch)(import_block_editor41.store)
    );
    const unlockedPatternInfo = useEditedSectionDetails();
    const {
      postId: postId2,
      postType: postType2,
      postTypeLabel,
      documentTitle,
      isNotFound,
      templateTitle,
      onNavigateToPreviousEntityRecord,
      isTemplatePreview,
      stylesCanvasTitle
    } = (0, import_data77.useSelect)((select5) => {
      const {
        getCurrentPostType: getCurrentPostType2,
        getCurrentPostId: getCurrentPostId2,
        getEditorSettings: getEditorSettings2,
        getRenderingMode: getRenderingMode2
      } = select5(store);
      const {
        getEditedEntityRecord,
        getPostType,
        getCurrentTheme,
        isResolving: isResolvingSelector
      } = select5(import_core_data54.store);
      const _postType = getCurrentPostType2();
      const _postId = getCurrentPostId2();
      const _document = getEditedEntityRecord(
        "postType",
        _postType,
        _postId
      );
      const { default_template_types: templateTypes = [] } = getCurrentTheme() ?? {};
      const _templateInfo = getTemplateInfo({
        templateTypes,
        template: _document
      });
      const _postTypeLabel = getPostType(_postType)?.labels?.singular_name;
      const { getStylesPath: getStylesPath2, getShowStylebook: getShowStylebook2 } = unlock(
        select5(store)
      );
      const _stylesPath = getStylesPath2();
      const _showStylebook = getShowStylebook2();
      const _stylesCanvasTitle = getStylesCanvasTitle(
        _stylesPath,
        _showStylebook
      );
      return {
        postId: _postId,
        postType: _postType,
        postTypeLabel: _postTypeLabel,
        documentTitle: _document.title,
        isNotFound: !_document && !isResolvingSelector(
          "getEditedEntityRecord",
          "postType",
          _postType,
          _postId
        ),
        templateTitle: _templateInfo.title,
        onNavigateToPreviousEntityRecord: getEditorSettings2().onNavigateToPreviousEntityRecord,
        isTemplatePreview: getRenderingMode2() === "template-locked",
        stylesCanvasTitle: _stylesCanvasTitle
      };
    }, []);
    const { open: openCommandCenter } = (0, import_data77.useDispatch)(import_commands3.store);
    const isReducedMotion = (0, import_compose19.useReducedMotion)();
    const isTemplate2 = TEMPLATE_POST_TYPES.includes(postType2);
    const hasBackButton = !!onNavigateToPreviousEntityRecord || !!unlockedPatternInfo;
    const entityTitle = isTemplate2 ? templateTitle : documentTitle;
    const title = unlockedPatternInfo?.patternTitle || props.title || stylesCanvasTitle || entityTitle;
    const icon = props.icon;
    const handleBackClick = (event) => {
      event.stopPropagation();
      if (unlockedPatternInfo) {
        stopEditingContentOnlySection();
      } else if (onNavigateToPreviousEntityRecord) {
        onNavigateToPreviousEntityRecord();
      }
    };
    const pageTypeBadge = usePageTypeBadge(postId2);
    const mountedRef = (0, import_element81.useRef)(false);
    (0, import_element81.useEffect)(() => {
      mountedRef.current = true;
    }, []);
    return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(
      "div",
      {
        className: clsx_default("editor-document-bar", {
          "has-back-button": hasBackButton
        }),
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_components98.__unstableAnimatePresence, { children: hasBackButton && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
            MotionButton,
            {
              className: "editor-document-bar__back",
              icon: (0, import_i18n115.isRTL)() ? chevron_right_small_default : chevron_left_small_default,
              onClick: handleBackClick,
              size: "compact",
              initial: mountedRef.current ? { opacity: 0, transform: "translateX(15%)" } : false,
              animate: { opacity: 1, transform: "translateX(0%)" },
              exit: { opacity: 0, transform: "translateX(15%)" },
              transition: isReducedMotion ? { duration: 0 } : void 0,
              children: (0, import_i18n115.__)("Back")
            }
          ) }),
          !isTemplate2 && isTemplatePreview && !hasBackButton && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
            import_block_editor41.BlockIcon,
            {
              icon: layout_default,
              className: "editor-document-bar__icon-layout"
            }
          ),
          isNotFound ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_components98.__experimentalText, { children: (0, import_i18n115.__)("Document not found") }) : /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(
            import_components98.Button,
            {
              className: "editor-document-bar__command",
              onClick: () => openCommandCenter(),
              size: "compact",
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(
                  import_components98.__unstableMotion.div,
                  {
                    className: "editor-document-bar__title",
                    initial: mountedRef.current ? {
                      opacity: 0,
                      transform: hasBackButton ? "translateX(15%)" : "translateX(-15%)"
                    } : false,
                    animate: {
                      opacity: 1,
                      transform: "translateX(0%)"
                    },
                    transition: isReducedMotion ? { duration: 0 } : void 0,
                    children: [
                      icon && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_block_editor41.BlockIcon, { icon }),
                      /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_components98.__experimentalText, { size: "body", as: "h1", children: [
                        /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "editor-document-bar__post-title", children: title ? (0, import_dom.__unstableStripHTML)(title) : (0, import_i18n115.__)("No title") }),
                        unlockedPatternInfo && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "editor-document-bar__post-type-label", children: unlockedPatternInfo.type === "template-part" ? `\xB7 ${(0, import_i18n115.__)("Template Part")}` : `\xB7 ${(0, import_i18n115.__)("Pattern")}` }),
                        !unlockedPatternInfo && pageTypeBadge && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "editor-document-bar__post-type-label", children: `\xB7 ${pageTypeBadge}` }),
                        !unlockedPatternInfo && postTypeLabel && !props.title && !pageTypeBadge && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "editor-document-bar__post-type-label", children: `\xB7 ${(0, import_html_entities11.decodeEntities)(
                          postTypeLabel
                        )}` })
                      ] })
                    ]
                  },
                  hasBackButton
                ),
                /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "editor-document-bar__shortcut", children: import_keycodes7.displayShortcut.primary("k") })
              ]
            }
          )
        ]
      }
    );
  }

  // packages/editor/build-module/components/document-outline/index.mjs
  var import_i18n116 = __toESM(require_i18n(), 1);
  var import_data78 = __toESM(require_data(), 1);
  var import_element82 = __toESM(require_element(), 1);
  var import_rich_text = __toESM(require_rich_text(), 1);
  var import_block_editor42 = __toESM(require_block_editor(), 1);
  var import_core_data55 = __toESM(require_core_data(), 1);
  var import_components99 = __toESM(require_components(), 1);

  // packages/editor/build-module/components/document-outline/item.mjs
  var import_jsx_runtime200 = __toESM(require_jsx_runtime(), 1);
  var TableOfContentsItem = ({
    children,
    isValid,
    isDisabled,
    level,
    href,
    onSelect
  }) => {
    function handleClick(event) {
      if (isDisabled) {
        event.preventDefault();
        return;
      }
      onSelect();
    }
    return /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(
      "li",
      {
        className: clsx_default(
          "document-outline__item",
          `is-${level.toLowerCase()}`,
          {
            "is-invalid": !isValid,
            "is-disabled": isDisabled
          }
        ),
        children: /* @__PURE__ */ (0, import_jsx_runtime200.jsxs)(
          "a",
          {
            href,
            className: "document-outline__button",
            "aria-disabled": isDisabled,
            onClick: handleClick,
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(
                "span",
                {
                  className: "document-outline__emdash",
                  "aria-hidden": "true"
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime200.jsx)("strong", { className: "document-outline__level", children: level }),
              /* @__PURE__ */ (0, import_jsx_runtime200.jsx)("span", { className: "document-outline__item-content", children })
            ]
          }
        )
      }
    );
  };
  var item_default = TableOfContentsItem;

  // packages/editor/build-module/components/document-outline/index.mjs
  var import_jsx_runtime201 = __toESM(require_jsx_runtime(), 1);
  var emptyHeadingContent = /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("em", { children: (0, import_i18n116.__)("(Empty heading)") });
  var incorrectLevelContent = [
    /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("br", {}, "incorrect-break"),
    /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("em", { children: (0, import_i18n116.__)("(Incorrect heading level)") }, "incorrect-message")
  ];
  var singleH1Headings = [
    /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("br", {}, "incorrect-break-h1"),
    /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("em", { children: (0, import_i18n116.__)("(Your theme may already use a H1 for the post title)") }, "incorrect-message-h1")
  ];
  var multipleH1Headings = [
    /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("br", {}, "incorrect-break-multiple-h1"),
    /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("em", { children: (0, import_i18n116.__)("(Multiple H1 headings are not recommended)") }, "incorrect-message-multiple-h1")
  ];
  function EmptyOutlineIllustration() {
    return /* @__PURE__ */ (0, import_jsx_runtime201.jsxs)(
      import_components99.SVG,
      {
        width: "138",
        height: "148",
        viewBox: "0 0 138 148",
        fill: "none",
        xmlns: "http://www.w3.org/2000/svg",
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_components99.Rect, { width: "138", height: "148", rx: "4", fill: "#F0F6FC" }),
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_components99.Line, { x1: "44", y1: "28", x2: "24", y2: "28", stroke: "#DDDDDD" }),
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_components99.Rect, { x: "48", y: "16", width: "27", height: "23", rx: "4", fill: "#DDDDDD" }),
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
            import_components99.Path,
            {
              d: "M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z",
              fill: "black"
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_components99.Line, { x1: "55", y1: "59", x2: "24", y2: "59", stroke: "#DDDDDD" }),
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_components99.Rect, { x: "59", y: "47", width: "29", height: "23", rx: "4", fill: "#DDDDDD" }),
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
            import_components99.Path,
            {
              d: "M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z",
              fill: "black"
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_components99.Line, { x1: "80", y1: "90", x2: "24", y2: "90", stroke: "#DDDDDD" }),
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_components99.Rect, { x: "84", y: "78", width: "30", height: "23", rx: "4", fill: "#F0B849" }),
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
            import_components99.Path,
            {
              d: "M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z",
              fill: "black"
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_components99.Line, { x1: "66", y1: "121", x2: "24", y2: "121", stroke: "#DDDDDD" }),
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_components99.Rect, { x: "70", y: "109", width: "29", height: "23", rx: "4", fill: "#DDDDDD" }),
          /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
            import_components99.Path,
            {
              d: "M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z",
              fill: "black"
            }
          )
        ]
      }
    );
  }
  var computeOutlineHeadings = (blocks = []) => {
    return blocks.filter((block) => block.name === "core/heading").map((block) => ({
      ...block,
      level: block.attributes.level,
      isEmpty: isEmptyHeading(block)
    }));
  };
  var isEmptyHeading = (heading) => !heading.attributes.content || heading.attributes.content.trim().length === 0;
  function DocumentOutline({
    onSelect,
    hasOutlineItemsDisabled
  }) {
    const { selectBlock: selectBlock2 } = (0, import_data78.useDispatch)(import_block_editor42.store);
    const { title, isTitleSupported } = (0, import_data78.useSelect)((select5) => {
      const { getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
      const { getPostType } = select5(import_core_data55.store);
      const postType2 = getPostType(getEditedPostAttribute2("type"));
      return {
        title: getEditedPostAttribute2("title"),
        isTitleSupported: postType2?.supports?.title ?? false
      };
    });
    const blocks = (0, import_data78.useSelect)((select5) => {
      const { getClientIdsWithDescendants: getClientIdsWithDescendants2, getBlock: getBlock2 } = select5(import_block_editor42.store);
      const clientIds = getClientIdsWithDescendants2();
      return clientIds.map((id) => getBlock2(id));
    });
    const contentBlocks = (0, import_data78.useSelect)((select5) => {
      if (select5(store).getRenderingMode() === "post-only") {
        return void 0;
      }
      const { getBlocksByName, getClientIdsOfDescendants: getClientIdsOfDescendants2 } = select5(import_block_editor42.store);
      const [postContentClientId] = getBlocksByName("core/post-content");
      if (!postContentClientId) {
        return void 0;
      }
      return getClientIdsOfDescendants2(postContentClientId);
    }, []);
    const prevHeadingLevelRef = (0, import_element82.useRef)(1);
    const headings = (0, import_element82.useMemo)(
      () => computeOutlineHeadings(blocks),
      [blocks]
    );
    if (headings.length < 1) {
      return /* @__PURE__ */ (0, import_jsx_runtime201.jsxs)("div", { className: "editor-document-outline has-no-headings", children: [
        /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(EmptyOutlineIllustration, {}),
        /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("p", { children: (0, import_i18n116.__)(
          "Navigate the structure of your document and address issues like empty or incorrect heading levels."
        ) })
      ] });
    }
    const titleNode = document.querySelector(".editor-post-title__input");
    const hasTitle = isTitleSupported && title && titleNode;
    const countByLevel = headings.reduce(
      (acc, heading) => ({
        ...acc,
        [heading.level]: (acc[heading.level] || 0) + 1
      }),
      {}
    );
    const hasMultipleH1 = countByLevel[1] > 1;
    function isContentBlock(clientId) {
      return Array.isArray(contentBlocks) ? contentBlocks.includes(clientId) : true;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("div", { className: "document-outline", children: /* @__PURE__ */ (0, import_jsx_runtime201.jsxs)("ul", { children: [
      hasTitle && /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
        item_default,
        {
          level: (0, import_i18n116.__)("Title"),
          isValid: true,
          onSelect,
          href: `#${titleNode.id}`,
          isDisabled: hasOutlineItemsDisabled,
          children: title
        }
      ),
      headings.map((item) => {
        const isIncorrectLevel = item.level > prevHeadingLevelRef.current + 1;
        const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle);
        prevHeadingLevelRef.current = item.level;
        return /* @__PURE__ */ (0, import_jsx_runtime201.jsxs)(
          item_default,
          {
            level: `H${item.level}`,
            isValid,
            isDisabled: hasOutlineItemsDisabled || !isContentBlock(item.clientId),
            href: `#block-${item.clientId}`,
            onSelect: () => {
              selectBlock2(item.clientId);
              onSelect?.();
            },
            children: [
              item.isEmpty ? emptyHeadingContent : (0, import_rich_text.getTextContent)(
                (0, import_rich_text.create)({
                  html: item.attributes.content
                })
              ),
              isIncorrectLevel && incorrectLevelContent,
              item.level === 1 && hasMultipleH1 && multipleH1Headings,
              hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings
            ]
          },
          item.clientId
        );
      })
    ] }) });
  }

  // packages/editor/build-module/components/document-outline/check.mjs
  var import_data79 = __toESM(require_data(), 1);
  var import_block_editor43 = __toESM(require_block_editor(), 1);
  function DocumentOutlineCheck({ children }) {
    const hasHeadings = (0, import_data79.useSelect)((select5) => {
      const { getGlobalBlockCount: getGlobalBlockCount2 } = select5(import_block_editor43.store);
      return getGlobalBlockCount2("core/heading") > 0;
    });
    if (!hasHeadings) {
      return null;
    }
    return children;
  }

  // packages/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.mjs
  var import_element83 = __toESM(require_element(), 1);
  var import_data80 = __toESM(require_data(), 1);
  var import_i18n117 = __toESM(require_i18n(), 1);
  var import_block_editor44 = __toESM(require_block_editor(), 1);
  var import_keyboard_shortcuts4 = __toESM(require_keyboard_shortcuts(), 1);
  var import_keycodes8 = __toESM(require_keycodes(), 1);
  var import_jsx_runtime202 = __toESM(require_jsx_runtime(), 1);
  function EditorKeyboardShortcutsRegister() {
    const { registerShortcut } = (0, import_data80.useDispatch)(import_keyboard_shortcuts4.store);
    (0, import_element83.useEffect)(() => {
      registerShortcut({
        name: "core/editor/toggle-mode",
        category: "global",
        description: (0, import_i18n117.__)("Switch between visual editor and code editor."),
        keyCombination: {
          modifier: "secondary",
          character: "m"
        }
      });
      registerShortcut({
        name: "core/editor/save",
        category: "global",
        description: (0, import_i18n117.__)("Save your changes."),
        keyCombination: {
          modifier: "primary",
          character: "s"
        }
      });
      registerShortcut({
        name: "core/editor/undo",
        category: "global",
        description: (0, import_i18n117.__)("Undo your last changes."),
        keyCombination: {
          modifier: "primary",
          character: "z"
        }
      });
      registerShortcut({
        name: "core/editor/redo",
        category: "global",
        description: (0, import_i18n117.__)("Redo your last undo."),
        keyCombination: {
          modifier: "primaryShift",
          character: "z"
        },
        // Disable on Apple OS because it conflicts with the browser's
        // history shortcut. It's a fine alias for both Windows and Linux.
        // Since there's no conflict for Ctrl+Shift+Z on both Windows and
        // Linux, we keep it as the default for consistency.
        aliases: (0, import_keycodes8.isAppleOS)() ? [] : [
          {
            modifier: "primary",
            character: "y"
          }
        ]
      });
      registerShortcut({
        name: "core/editor/toggle-list-view",
        category: "global",
        description: (0, import_i18n117.__)("Show or hide the List View."),
        keyCombination: {
          modifier: "access",
          character: "o"
        }
      });
      registerShortcut({
        name: "core/editor/toggle-distraction-free",
        category: "global",
        description: (0, import_i18n117.__)("Enter or exit distraction free mode."),
        keyCombination: {
          modifier: "primaryShift",
          character: "\\"
        }
      });
      registerShortcut({
        name: "core/editor/toggle-sidebar",
        category: "global",
        description: (0, import_i18n117.__)("Show or hide the Settings panel."),
        keyCombination: {
          modifier: "primaryShift",
          character: ","
        }
      });
      registerShortcut({
        name: "core/editor/keyboard-shortcuts",
        category: "main",
        description: (0, import_i18n117.__)("Display these keyboard shortcuts."),
        keyCombination: {
          modifier: "access",
          character: "h"
        }
      });
      registerShortcut({
        name: "core/editor/next-region",
        category: "global",
        description: (0, import_i18n117.__)("Navigate to the next part of the editor."),
        keyCombination: {
          modifier: "ctrl",
          character: "`"
        },
        aliases: [
          {
            modifier: "access",
            character: "n"
          }
        ]
      });
      registerShortcut({
        name: "core/editor/previous-region",
        category: "global",
        description: (0, import_i18n117.__)("Navigate to the previous part of the editor."),
        keyCombination: {
          modifier: "ctrlShift",
          character: "`"
        },
        aliases: [
          {
            modifier: "access",
            character: "p"
          },
          {
            modifier: "ctrlShift",
            character: "~"
          }
        ]
      });
    }, [registerShortcut]);
    return /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(import_block_editor44.BlockEditorKeyboardShortcuts.Register, {});
  }
  var register_shortcuts_default = EditorKeyboardShortcutsRegister;

  // packages/editor/build-module/components/editor-history/redo.mjs
  var import_i18n118 = __toESM(require_i18n(), 1);
  var import_components100 = __toESM(require_components(), 1);
  var import_data81 = __toESM(require_data(), 1);
  var import_keycodes9 = __toESM(require_keycodes(), 1);
  var import_element84 = __toESM(require_element(), 1);
  var import_jsx_runtime203 = __toESM(require_jsx_runtime(), 1);
  function EditorHistoryRedo(props, ref) {
    const shortcut = (0, import_keycodes9.isAppleOS)() ? import_keycodes9.displayShortcut.primaryShift("z") : import_keycodes9.displayShortcut.primary("y");
    const hasRedo = (0, import_data81.useSelect)(
      (select5) => select5(store).hasEditorRedo(),
      []
    );
    const { redo: redo2 } = (0, import_data81.useDispatch)(store);
    return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
      import_components100.Button,
      {
        __next40pxDefaultSize: true,
        ...props,
        ref,
        icon: !(0, import_i18n118.isRTL)() ? redo_default : undo_default,
        label: (0, import_i18n118.__)("Redo"),
        shortcut,
        "aria-disabled": !hasRedo,
        onClick: hasRedo ? redo2 : void 0,
        className: "editor-history__redo"
      }
    );
  }
  var redo_default2 = (0, import_element84.forwardRef)(EditorHistoryRedo);

  // packages/editor/build-module/components/editor-history/undo.mjs
  var import_i18n119 = __toESM(require_i18n(), 1);
  var import_components101 = __toESM(require_components(), 1);
  var import_data82 = __toESM(require_data(), 1);
  var import_keycodes10 = __toESM(require_keycodes(), 1);
  var import_element85 = __toESM(require_element(), 1);
  var import_jsx_runtime204 = __toESM(require_jsx_runtime(), 1);
  function EditorHistoryUndo(props, ref) {
    const hasUndo = (0, import_data82.useSelect)(
      (select5) => select5(store).hasEditorUndo(),
      []
    );
    const { undo: undo2 } = (0, import_data82.useDispatch)(store);
    return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
      import_components101.Button,
      {
        __next40pxDefaultSize: true,
        ...props,
        ref,
        icon: !(0, import_i18n119.isRTL)() ? undo_default : redo_default,
        label: (0, import_i18n119.__)("Undo"),
        shortcut: import_keycodes10.displayShortcut.primary("z"),
        "aria-disabled": !hasUndo,
        onClick: hasUndo ? undo2 : void 0,
        className: "editor-history__undo"
      }
    );
  }
  var undo_default2 = (0, import_element85.forwardRef)(EditorHistoryUndo);

  // packages/editor/build-module/components/editor-notices/index.mjs
  var import_components103 = __toESM(require_components(), 1);
  var import_data84 = __toESM(require_data(), 1);
  var import_notices18 = __toESM(require_notices(), 1);

  // packages/editor/build-module/components/template-validation-notice/index.mjs
  var import_components102 = __toESM(require_components(), 1);
  var import_i18n120 = __toESM(require_i18n(), 1);
  var import_data83 = __toESM(require_data(), 1);
  var import_element86 = __toESM(require_element(), 1);
  var import_block_editor45 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime205 = __toESM(require_jsx_runtime(), 1);
  function TemplateValidationNotice() {
    const [showConfirmDialog, setShowConfirmDialog] = (0, import_element86.useState)(false);
    const isValid = (0, import_data83.useSelect)((select5) => {
      return select5(import_block_editor45.store).isValidTemplate();
    }, []);
    const { setTemplateValidity: setTemplateValidity2, synchronizeTemplate: synchronizeTemplate2 } = (0, import_data83.useDispatch)(import_block_editor45.store);
    if (isValid) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)(import_jsx_runtime205.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
        import_components102.Notice,
        {
          className: "editor-template-validation-notice",
          isDismissible: false,
          status: "warning",
          actions: [
            {
              label: (0, import_i18n120.__)("Keep it as is"),
              onClick: () => setTemplateValidity2(true)
            },
            {
              label: (0, import_i18n120.__)("Reset the template"),
              onClick: () => setShowConfirmDialog(true)
            }
          ],
          children: (0, import_i18n120.__)(
            "The content of your post doesn\u2019t match the template assigned to your post type."
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
        import_components102.__experimentalConfirmDialog,
        {
          isOpen: showConfirmDialog,
          confirmButtonText: (0, import_i18n120.__)("Reset"),
          onConfirm: () => {
            setShowConfirmDialog(false);
            synchronizeTemplate2();
          },
          onCancel: () => setShowConfirmDialog(false),
          size: "medium",
          children: (0, import_i18n120.__)(
            "Resetting the template may result in loss of content, do you want to continue?"
          )
        }
      )
    ] });
  }

  // packages/editor/build-module/components/editor-notices/index.mjs
  var import_jsx_runtime206 = __toESM(require_jsx_runtime(), 1);
  function EditorNotices() {
    const { notices } = (0, import_data84.useSelect)(
      (select5) => ({
        notices: select5(import_notices18.store).getNotices()
      }),
      []
    );
    const { removeNotice } = (0, import_data84.useDispatch)(import_notices18.store);
    const dismissibleNotices = notices.filter(
      ({ isDismissible, type }) => isDismissible && type === "default"
    );
    const nonDismissibleNotices = notices.filter(
      ({ isDismissible, type }) => !isDismissible && type === "default"
    );
    return /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(import_jsx_runtime206.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(
        import_components103.NoticeList,
        {
          notices: nonDismissibleNotices,
          className: "components-editor-notices__pinned"
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(
        import_components103.NoticeList,
        {
          notices: dismissibleNotices,
          className: "components-editor-notices__dismissible",
          onRemove: removeNotice,
          children: /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(TemplateValidationNotice, {})
        }
      )
    ] });
  }
  var editor_notices_default = EditorNotices;

  // packages/editor/build-module/components/editor-snackbars/index.mjs
  var import_components104 = __toESM(require_components(), 1);
  var import_data85 = __toESM(require_data(), 1);
  var import_notices19 = __toESM(require_notices(), 1);
  var import_jsx_runtime207 = __toESM(require_jsx_runtime(), 1);
  var MAX_VISIBLE_NOTICES = -3;
  function EditorSnackbars() {
    const notices = (0, import_data85.useSelect)(
      (select5) => select5(import_notices19.store).getNotices(),
      []
    );
    const { removeNotice } = (0, import_data85.useDispatch)(import_notices19.store);
    const snackbarNotices = notices.filter(({ type }) => type === "snackbar").slice(MAX_VISIBLE_NOTICES);
    return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
      import_components104.SnackbarList,
      {
        notices: snackbarNotices,
        className: "components-editor-notices__snackbar",
        onRemove: removeNotice
      }
    );
  }

  // packages/editor/build-module/components/entities-saved-states/index.mjs
  var import_components107 = __toESM(require_components(), 1);
  var import_i18n123 = __toESM(require_i18n(), 1);
  var import_element88 = __toESM(require_element(), 1);
  var import_compose20 = __toESM(require_compose(), 1);
  var import_data89 = __toESM(require_data(), 1);

  // packages/editor/build-module/components/entities-saved-states/entity-type-list.mjs
  var import_i18n122 = __toESM(require_i18n(), 1);
  var import_data87 = __toESM(require_data(), 1);
  var import_components106 = __toESM(require_components(), 1);
  var import_core_data57 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/entities-saved-states/entity-record-item.mjs
  var import_components105 = __toESM(require_components(), 1);
  var import_i18n121 = __toESM(require_i18n(), 1);
  var import_data86 = __toESM(require_data(), 1);
  var import_core_data56 = __toESM(require_core_data(), 1);
  var import_html_entities12 = __toESM(require_html_entities(), 1);
  var import_jsx_runtime208 = __toESM(require_jsx_runtime(), 1);
  function EntityRecordItem({ record, checked, onChange }) {
    const { name: name2, kind, title, key } = record;
    const { entityRecordTitle, hasPostMetaChanges: hasPostMetaChanges2 } = (0, import_data86.useSelect)(
      (select5) => {
        if ("postType" !== kind || "wp_template" !== name2) {
          return {
            entityRecordTitle: title,
            hasPostMetaChanges: unlock(
              select5(store)
            ).hasPostMetaChanges(name2, key)
          };
        }
        const template2 = select5(import_core_data56.store).getEditedEntityRecord(
          kind,
          name2,
          key
        );
        const { default_template_types: templateTypes = [] } = select5(import_core_data56.store).getCurrentTheme() ?? {};
        return {
          entityRecordTitle: getTemplateInfo({
            template: template2,
            templateTypes
          }).title,
          hasPostMetaChanges: unlock(
            select5(store)
          ).hasPostMetaChanges(name2, key)
        };
      },
      [name2, kind, title, key]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime208.jsxs)(import_jsx_runtime208.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(import_components105.PanelRow, { children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(
        import_components105.CheckboxControl,
        {
          label: (0, import_html_entities12.decodeEntities)(entityRecordTitle) || (0, import_i18n121.__)("Untitled"),
          checked,
          onChange,
          className: "entities-saved-states__change-control"
        }
      ) }),
      hasPostMetaChanges2 && /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("ul", { className: "entities-saved-states__changes", children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("li", { children: (0, import_i18n121.__)("Post Meta.") }) })
    ] });
  }

  // packages/editor/build-module/components/entities-saved-states/entity-type-list.mjs
  var import_jsx_runtime209 = __toESM(require_jsx_runtime(), 1);
  function getEntityDescription(entity, count) {
    switch (entity) {
      case "site":
        return 1 === count ? (0, import_i18n122.__)("This change will affect your whole site.") : (0, import_i18n122.__)("These changes will affect your whole site.");
      case "wp_template":
        return (0, import_i18n122.__)(
          "This change will affect other parts of your site that use this template."
        );
      case "page":
      case "post":
        return (0, import_i18n122.__)("The following has been modified.");
    }
  }
  function GlobalStylesDescription({ record }) {
    const { editedRecord, savedRecord } = (0, import_data87.useSelect)(
      (select5) => {
        const { getEditedEntityRecord, getEntityRecord } = select5(import_core_data57.store);
        return {
          editedRecord: getEditedEntityRecord(
            record.kind,
            record.name,
            record.key
          ),
          savedRecord: getEntityRecord(
            record.kind,
            record.name,
            record.key
          )
        };
      },
      [record.kind, record.name, record.key]
    );
    const globalStylesChanges = getGlobalStylesChanges(
      editedRecord,
      savedRecord,
      {
        maxResults: 10
      }
    );
    return globalStylesChanges.length ? /* @__PURE__ */ (0, import_jsx_runtime209.jsx)("ul", { className: "entities-saved-states__changes", children: globalStylesChanges.map((change) => /* @__PURE__ */ (0, import_jsx_runtime209.jsx)("li", { children: change }, change)) }) : null;
  }
  function EntityDescription({ record, count }) {
    if ("globalStyles" === record?.name) {
      return null;
    }
    const description = getEntityDescription(record?.name, count);
    return description ? /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(import_components106.PanelRow, { children: description }) : null;
  }
  function EntityTypeList({
    list,
    unselectedEntities,
    setUnselectedEntities
  }) {
    const count = list.length;
    const firstRecord = list[0];
    const entityConfig = (0, import_data87.useSelect)(
      (select5) => select5(import_core_data57.store).getEntityConfig(
        firstRecord.kind,
        firstRecord.name
      ),
      [firstRecord.kind, firstRecord.name]
    );
    let entityLabel = entityConfig.label;
    if (firstRecord?.name === "wp_template_part") {
      entityLabel = 1 === count ? (0, import_i18n122.__)("Template Part") : (0, import_i18n122.__)("Template Parts");
    }
    return /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)(
      import_components106.PanelBody,
      {
        title: entityLabel,
        initialOpen: true,
        className: "entities-saved-states__panel-body",
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(EntityDescription, { record: firstRecord, count }),
          list.map((record) => {
            return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(
              EntityRecordItem,
              {
                record,
                checked: !unselectedEntities.some(
                  (elt) => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property
                ),
                onChange: (value) => setUnselectedEntities(record, value)
              },
              record.key || record.property
            );
          }),
          "globalStyles" === firstRecord?.name && /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(GlobalStylesDescription, { record: firstRecord })
        ]
      }
    );
  }

  // packages/editor/build-module/components/entities-saved-states/hooks/use-is-dirty.mjs
  var import_data88 = __toESM(require_data(), 1);
  var import_core_data58 = __toESM(require_core_data(), 1);
  var import_element87 = __toESM(require_element(), 1);
  var useIsDirty = () => {
    const { editedEntities, siteEdits, siteEntityConfig } = (0, import_data88.useSelect)(
      (select5) => {
        const {
          __experimentalGetDirtyEntityRecords,
          getEntityRecordEdits,
          getEntityConfig
        } = select5(import_core_data58.store);
        return {
          editedEntities: __experimentalGetDirtyEntityRecords(),
          siteEdits: getEntityRecordEdits("root", "site"),
          siteEntityConfig: getEntityConfig("root", "site")
        };
      },
      []
    );
    const dirtyEntityRecords = (0, import_element87.useMemo)(() => {
      const editedEntitiesWithoutSite = editedEntities.filter(
        (record) => !(record.kind === "root" && record.name === "site")
      );
      const siteEntityLabels = siteEntityConfig?.meta?.labels ?? {};
      const editedSiteEntities = [];
      for (const property in siteEdits) {
        editedSiteEntities.push({
          kind: "root",
          name: "site",
          title: siteEntityLabels[property] || property,
          property
        });
      }
      return [...editedEntitiesWithoutSite, ...editedSiteEntities];
    }, [editedEntities, siteEdits, siteEntityConfig]);
    const [unselectedEntities, _setUnselectedEntities] = (0, import_element87.useState)([]);
    const setUnselectedEntities = ({ kind, name: name2, key, property }, checked) => {
      if (checked) {
        _setUnselectedEntities(
          unselectedEntities.filter(
            (elt) => elt.kind !== kind || elt.name !== name2 || elt.key !== key || elt.property !== property
          )
        );
      } else {
        _setUnselectedEntities([
          ...unselectedEntities,
          { kind, name: name2, key, property }
        ]);
      }
    };
    const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
    return {
      dirtyEntityRecords,
      isDirty,
      setUnselectedEntities,
      unselectedEntities
    };
  };

  // packages/editor/build-module/components/entities-saved-states/index.mjs
  var import_jsx_runtime210 = __toESM(require_jsx_runtime(), 1);
  function identity(values) {
    return values;
  }
  function EntitiesSavedStates({
    close,
    renderDialog,
    variant
  }) {
    const isDirtyProps = useIsDirty();
    return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(
      EntitiesSavedStatesExtensible,
      {
        close,
        renderDialog,
        variant,
        ...isDirtyProps
      }
    );
  }
  function EntitiesSavedStatesExtensible({
    additionalPrompt = void 0,
    close,
    onSave = identity,
    saveEnabled: saveEnabledProp = void 0,
    saveLabel = (0, import_i18n123.__)("Save"),
    renderDialog,
    dirtyEntityRecords,
    isDirty,
    setUnselectedEntities,
    unselectedEntities,
    variant = "default"
  }) {
    const saveButtonRef = (0, import_element88.useRef)();
    const { saveDirtyEntities: saveDirtyEntities2 } = unlock((0, import_data89.useDispatch)(store));
    const partitionedSavables = dirtyEntityRecords.reduce((acc, record) => {
      const { name: name2 } = record;
      if (!acc[name2]) {
        acc[name2] = [];
      }
      acc[name2].push(record);
      return acc;
    }, {});
    const {
      site: siteSavables,
      wp_template: templateSavables,
      wp_template_part: templatePartSavables,
      ...contentSavables
    } = partitionedSavables;
    const sortedPartitionedSavables = [
      siteSavables,
      templateSavables,
      templatePartSavables,
      ...Object.values(contentSavables)
    ].filter(Array.isArray);
    const saveEnabled = saveEnabledProp ?? isDirty;
    const dismissPanel = (0, import_element88.useCallback)(() => close(), [close]);
    const [saveDialogRef, saveDialogProps] = (0, import_compose20.__experimentalUseDialog)({
      onClose: () => dismissPanel()
    });
    const dialogLabelId = (0, import_compose20.useInstanceId)(
      EntitiesSavedStatesExtensible,
      "entities-saved-states__panel-label"
    );
    const dialogDescriptionId = (0, import_compose20.useInstanceId)(
      EntitiesSavedStatesExtensible,
      "entities-saved-states__panel-description"
    );
    const selectItemsToSaveDescription = !!dirtyEntityRecords.length ? (0, import_i18n123.__)("Select the items you want to save.") : void 0;
    const isInline = variant === "inline";
    const actionButtons = /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)(import_jsx_runtime210.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(
        import_components107.FlexItem,
        {
          isBlock: isInline ? false : true,
          as: import_components107.Button,
          variant: isInline ? "tertiary" : "secondary",
          size: isInline ? void 0 : "compact",
          onClick: dismissPanel,
          children: (0, import_i18n123.__)("Cancel")
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(
        import_components107.FlexItem,
        {
          isBlock: isInline ? false : true,
          as: import_components107.Button,
          ref: saveButtonRef,
          variant: "primary",
          size: isInline ? void 0 : "compact",
          disabled: !saveEnabled,
          accessibleWhenDisabled: true,
          onClick: () => saveDirtyEntities2({
            onSave,
            dirtyEntityRecords,
            entitiesToSkip: unselectedEntities,
            close
          }),
          className: "editor-entities-saved-states__save-button",
          children: saveLabel
        }
      )
    ] });
    return /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)(
      "div",
      {
        ref: renderDialog ? saveDialogRef : void 0,
        ...renderDialog && saveDialogProps,
        className: clsx_default("entities-saved-states__panel", {
          "is-inline": isInline
        }),
        role: renderDialog ? "dialog" : void 0,
        "aria-labelledby": renderDialog ? dialogLabelId : void 0,
        "aria-describedby": renderDialog ? dialogDescriptionId : void 0,
        children: [
          !isInline && /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(import_components107.Flex, { className: "entities-saved-states__panel-header", gap: 2, children: actionButtons }),
          /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)("div", { className: "entities-saved-states__text-prompt", children: [
            /* @__PURE__ */ (0, import_jsx_runtime210.jsx)("div", { className: "entities-saved-states__text-prompt--header-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(
              "strong",
              {
                id: renderDialog ? dialogLabelId : void 0,
                className: "entities-saved-states__text-prompt--header",
                children: (0, import_i18n123.__)("Are you ready to save?")
              }
            ) }),
            /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)("div", { id: renderDialog ? dialogDescriptionId : void 0, children: [
              additionalPrompt,
              /* @__PURE__ */ (0, import_jsx_runtime210.jsx)("p", { className: "entities-saved-states__text-prompt--changes-count", children: isDirty ? (0, import_element88.createInterpolateElement)(
                (0, import_i18n123.sprintf)(
                  /* translators: %d: number of site changes waiting to be saved. */
                  (0, import_i18n123._n)(
                    "There is <strong>%d site change</strong> waiting to be saved.",
                    "There are <strong>%d site changes</strong> waiting to be saved.",
                    dirtyEntityRecords.length
                  ),
                  dirtyEntityRecords.length
                ),
                { strong: /* @__PURE__ */ (0, import_jsx_runtime210.jsx)("strong", {}) }
              ) : selectItemsToSaveDescription })
            ] })
          ] }),
          sortedPartitionedSavables.map((list) => {
            return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(
              EntityTypeList,
              {
                list,
                unselectedEntities,
                setUnselectedEntities
              },
              list[0].name
            );
          }),
          isInline && /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(
            import_components107.Flex,
            {
              direction: "row",
              justify: "flex-end",
              className: "entities-saved-states__panel-footer",
              children: actionButtons
            }
          )
        ]
      }
    );
  }

  // packages/editor/build-module/components/error-boundary/index.mjs
  var import_element89 = __toESM(require_element(), 1);
  var import_i18n124 = __toESM(require_i18n(), 1);
  var import_components108 = __toESM(require_components(), 1);
  var import_data90 = __toESM(require_data(), 1);
  var import_compose21 = __toESM(require_compose(), 1);
  var import_hooks39 = __toESM(require_hooks(), 1);
  var import_jsx_runtime211 = __toESM(require_jsx_runtime(), 1);
  function getContent() {
    try {
      return (0, import_data90.select)(store).getEditedPostContent();
    } catch (error) {
    }
  }
  function CopyButton({ text, children, variant = "secondary" }) {
    const ref = (0, import_compose21.useCopyToClipboard)(text);
    return /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(import_components108.Button, { __next40pxDefaultSize: true, variant, ref, children });
  }
  var ErrorBoundary = class extends import_element89.Component {
    constructor() {
      super(...arguments);
      this.state = {
        error: null
      };
    }
    componentDidCatch(error) {
      (0, import_hooks39.doAction)("editor.ErrorBoundary.errorLogged", error);
    }
    static getDerivedStateFromError(error) {
      return { error };
    }
    render() {
      const { error } = this.state;
      const { canCopyContent = false } = this.props;
      if (!error) {
        return this.props.children;
      }
      return /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)(
        import_components108.__experimentalHStack,
        {
          className: "editor-error-boundary",
          alignment: "baseline",
          spacing: 4,
          justify: "space-between",
          expanded: false,
          wrap: true,
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(import_components108.__experimentalText, { as: "p", children: (0, import_i18n124.__)("The editor has encountered an unexpected error.") }),
            /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)(import_components108.__experimentalHStack, { expanded: false, children: [
              canCopyContent && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(CopyButton, { text: getContent, children: (0, import_i18n124.__)("Copy contents") }),
              /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(CopyButton, { variant: "primary", text: error?.stack, children: (0, import_i18n124.__)("Copy error") })
            ] })
          ]
        }
      );
    }
  };
  var error_boundary_default = ErrorBoundary;

  // packages/editor/build-module/components/local-autosave-monitor/index.mjs
  var import_element90 = __toESM(require_element(), 1);
  var import_compose22 = __toESM(require_compose(), 1);
  var import_data91 = __toESM(require_data(), 1);
  var import_i18n125 = __toESM(require_i18n(), 1);
  var import_blocks23 = __toESM(require_blocks(), 1);
  var import_notices20 = __toESM(require_notices(), 1);
  var import_jsx_runtime212 = __toESM(require_jsx_runtime(), 1);
  var requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame;
  var hasStorageSupport;
  var hasSessionStorageSupport = () => {
    if (hasStorageSupport !== void 0) {
      return hasStorageSupport;
    }
    try {
      window.sessionStorage.setItem("__wpEditorTestSessionStorage", "");
      window.sessionStorage.removeItem("__wpEditorTestSessionStorage");
      hasStorageSupport = true;
    } catch {
      hasStorageSupport = false;
    }
    return hasStorageSupport;
  };
  function useAutosaveNotice() {
    const { postId: postId2, isEditedPostNew: isEditedPostNew2, hasRemoteAutosave } = (0, import_data91.useSelect)(
      (select5) => ({
        postId: select5(store).getCurrentPostId(),
        isEditedPostNew: select5(store).isEditedPostNew(),
        hasRemoteAutosave: !!select5(store).getEditorSettings().autosave
      }),
      []
    );
    const { getEditedPostAttribute: getEditedPostAttribute2 } = (0, import_data91.useSelect)(store);
    const { createWarningNotice, removeNotice } = (0, import_data91.useDispatch)(import_notices20.store);
    const { editPost: editPost2, resetEditorBlocks: resetEditorBlocks2 } = (0, import_data91.useDispatch)(store);
    (0, import_element90.useEffect)(() => {
      let localAutosave = localAutosaveGet(postId2, isEditedPostNew2);
      if (!localAutosave) {
        return;
      }
      try {
        localAutosave = JSON.parse(localAutosave);
      } catch {
        return;
      }
      const { post_title: title, content, excerpt } = localAutosave;
      const edits = { title, content, excerpt };
      {
        const hasDifference = Object.keys(edits).some((key) => {
          return edits[key] !== getEditedPostAttribute2(key);
        });
        if (!hasDifference) {
          localAutosaveClear(postId2, isEditedPostNew2);
          return;
        }
      }
      if (hasRemoteAutosave) {
        return;
      }
      const id = "wpEditorAutosaveRestore";
      createWarningNotice(
        (0, import_i18n125.__)(
          "The backup of this post in your browser is different from the version below."
        ),
        {
          id,
          actions: [
            {
              label: (0, import_i18n125.__)("Restore the backup"),
              onClick() {
                const {
                  content: editsContent,
                  ...editsWithoutContent
                } = edits;
                editPost2(editsWithoutContent);
                resetEditorBlocks2((0, import_blocks23.parse)(edits.content));
                removeNotice(id);
              }
            }
          ]
        }
      );
    }, [isEditedPostNew2, postId2]);
  }
  function useAutosavePurge() {
    const { postId: postId2, isEditedPostNew: isEditedPostNew2, isDirty, isAutosaving, didError } = (0, import_data91.useSelect)(
      (select5) => ({
        postId: select5(store).getCurrentPostId(),
        isEditedPostNew: select5(store).isEditedPostNew(),
        isDirty: select5(store).isEditedPostDirty(),
        isAutosaving: select5(store).isAutosavingPost(),
        didError: select5(store).didPostSaveRequestFail()
      }),
      []
    );
    const lastIsDirtyRef = (0, import_element90.useRef)(isDirty);
    const lastIsAutosavingRef = (0, import_element90.useRef)(isAutosaving);
    (0, import_element90.useEffect)(() => {
      if (!didError && (lastIsAutosavingRef.current && !isAutosaving || lastIsDirtyRef.current && !isDirty)) {
        localAutosaveClear(postId2, isEditedPostNew2);
      }
      lastIsDirtyRef.current = isDirty;
      lastIsAutosavingRef.current = isAutosaving;
    }, [isDirty, isAutosaving, didError]);
    const wasEditedPostNew = (0, import_compose22.usePrevious)(isEditedPostNew2);
    const prevPostId = (0, import_compose22.usePrevious)(postId2);
    (0, import_element90.useEffect)(() => {
      if (prevPostId === postId2 && wasEditedPostNew && !isEditedPostNew2) {
        localAutosaveClear(postId2, true);
      }
    }, [isEditedPostNew2, postId2]);
  }
  function LocalAutosaveMonitor() {
    const { autosave: autosave2 } = (0, import_data91.useDispatch)(store);
    const deferredAutosave = (0, import_element90.useCallback)(() => {
      requestIdleCallback(() => autosave2({ local: true }));
    }, []);
    useAutosaveNotice();
    useAutosavePurge();
    const localAutosaveInterval = (0, import_data91.useSelect)(
      (select5) => select5(store).getEditorSettings().localAutosaveInterval,
      []
    );
    return /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(
      autosave_monitor_default,
      {
        interval: localAutosaveInterval,
        autosave: deferredAutosave
      }
    );
  }
  var local_autosave_monitor_default = (0, import_compose22.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor);

  // packages/editor/build-module/components/page-attributes/check.mjs
  var import_data92 = __toESM(require_data(), 1);
  var import_core_data59 = __toESM(require_core_data(), 1);
  function PageAttributesCheck({ children }) {
    const supportsPageAttributes = (0, import_data92.useSelect)((select5) => {
      const { getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
      const { getPostType } = select5(import_core_data59.store);
      const postType2 = getPostType(getEditedPostAttribute2("type"));
      return !!postType2?.supports?.["page-attributes"];
    }, []);
    if (!supportsPageAttributes) {
      return null;
    }
    return children;
  }
  var check_default2 = PageAttributesCheck;

  // packages/editor/build-module/components/page-attributes/order.mjs
  var import_i18n126 = __toESM(require_i18n(), 1);
  var import_components109 = __toESM(require_components(), 1);
  var import_data94 = __toESM(require_data(), 1);
  var import_element91 = __toESM(require_element(), 1);

  // packages/editor/build-module/components/post-type-support-check/index.mjs
  var import_data93 = __toESM(require_data(), 1);
  var import_core_data60 = __toESM(require_core_data(), 1);
  function checkSupport(supports = {}, key) {
    if (supports[key] !== void 0) {
      return !!supports[key];
    }
    const [topKey, subKey] = key.split(".");
    const [subProperties] = Array.isArray(supports[topKey]) ? supports[topKey] : [];
    return Array.isArray(subProperties) ? subProperties.includes(subKey) : !!subProperties?.[subKey];
  }
  function PostTypeSupportCheck({ children, supportKeys }) {
    const postType2 = (0, import_data93.useSelect)((select5) => {
      const { getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
      const { getPostType } = select5(import_core_data60.store);
      return getPostType(getEditedPostAttribute2("type"));
    }, []);
    let isSupported = !!postType2;
    if (postType2) {
      isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some((key) => checkSupport(postType2.supports, key));
    }
    if (!isSupported) {
      return null;
    }
    return children;
  }
  var post_type_support_check_default = PostTypeSupportCheck;

  // packages/editor/build-module/components/page-attributes/order.mjs
  var import_jsx_runtime213 = __toESM(require_jsx_runtime(), 1);
  function PageAttributesOrder() {
    const order = (0, import_data94.useSelect)(
      (select5) => select5(store).getEditedPostAttribute("menu_order") ?? 0,
      []
    );
    const { editPost: editPost2 } = (0, import_data94.useDispatch)(store);
    const [orderInput, setOrderInput] = (0, import_element91.useState)(null);
    const setUpdatedOrder = (value2) => {
      setOrderInput(value2);
      const newOrder = Number(value2);
      if (Number.isInteger(newOrder) && value2.trim?.() !== "") {
        editPost2({ menu_order: newOrder });
      }
    };
    const value = orderInput ?? order;
    return /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(import_components109.Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(import_components109.FlexBlock, { children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(
      import_components109.__experimentalNumberControl,
      {
        __next40pxDefaultSize: true,
        label: (0, import_i18n126.__)("Order"),
        help: (0, import_i18n126.__)("Set the page order."),
        value,
        onChange: setUpdatedOrder,
        hideLabelFromVision: true,
        onBlur: () => {
          setOrderInput(null);
        }
      }
    ) }) });
  }
  function PageAttributesOrderWithChecks() {
    return /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(post_type_support_check_default, { supportKeys: "page-attributes", children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(PageAttributesOrder, {}) });
  }

  // packages/editor/build-module/components/page-attributes/panel.mjs
  var import_data96 = __toESM(require_data(), 1);
  var import_core_data62 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/page-attributes/parent.mjs
  var import_remove_accents2 = __toESM(require_remove_accents(), 1);
  var import_i18n127 = __toESM(require_i18n(), 1);
  var import_components111 = __toESM(require_components(), 1);
  var import_compose23 = __toESM(require_compose(), 1);
  var import_element93 = __toESM(require_element(), 1);
  var import_data95 = __toESM(require_data(), 1);
  var import_html_entities14 = __toESM(require_html_entities(), 1);
  var import_core_data61 = __toESM(require_core_data(), 1);
  var import_block_editor46 = __toESM(require_block_editor(), 1);
  var import_url10 = __toESM(require_url(), 1);

  // packages/editor/build-module/components/post-panel-row/index.mjs
  var import_components110 = __toESM(require_components(), 1);
  var import_element92 = __toESM(require_element(), 1);
  var import_jsx_runtime214 = __toESM(require_jsx_runtime(), 1);
  var PostPanelRow = (0, import_element92.forwardRef)(({ className, label, children }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(
      import_components110.__experimentalHStack,
      {
        className: clsx_default("editor-post-panel__row", className),
        ref,
        children: [
          label && /* @__PURE__ */ (0, import_jsx_runtime214.jsx)("div", { className: "editor-post-panel__row-label", children: label }),
          /* @__PURE__ */ (0, import_jsx_runtime214.jsx)("div", { className: "editor-post-panel__row-control", children })
        ]
      }
    );
  });
  var post_panel_row_default = PostPanelRow;

  // packages/editor/build-module/utils/terms.mjs
  var import_html_entities13 = __toESM(require_html_entities(), 1);
  function buildTermsTree2(flatTerms) {
    const flatTermsWithParentAndChildren = flatTerms.map((term) => {
      return {
        children: [],
        parent: void 0,
        ...term
      };
    });
    if (flatTermsWithParentAndChildren.some(
      ({ parent }) => parent === void 0
    )) {
      return flatTermsWithParentAndChildren;
    }
    const termsByParent = flatTermsWithParentAndChildren.reduce(
      (acc, term) => {
        const { parent } = term;
        if (!acc[parent]) {
          acc[parent] = [];
        }
        acc[parent].push(term);
        return acc;
      },
      {}
    );
    const fillWithChildren = (terms) => {
      return terms.map((term) => {
        const children = termsByParent[term.id];
        return {
          ...term,
          children: children && children.length ? fillWithChildren(children) : []
        };
      });
    };
    return fillWithChildren(termsByParent["0"] || []);
  }
  var unescapeString = (arg) => {
    return (0, import_html_entities13.decodeEntities)(arg);
  };
  var unescapeTerm = (term) => {
    return {
      ...term,
      name: unescapeString(term.name)
    };
  };
  var unescapeTerms = (terms) => {
    return (terms ?? []).map(unescapeTerm);
  };

  // packages/editor/build-module/components/page-attributes/parent.mjs
  var import_jsx_runtime215 = __toESM(require_jsx_runtime(), 1);
  function getTitle(post2) {
    return post2?.title?.rendered ? (0, import_html_entities14.decodeEntities)(post2.title.rendered) : `#${post2.id} (${(0, import_i18n127.__)("no title")})`;
  }
  var getItemPriority2 = (name2, searchValue) => {
    const normalizedName = (0, import_remove_accents2.default)(name2 || "").toLowerCase();
    const normalizedSearch = (0, import_remove_accents2.default)(searchValue || "").toLowerCase();
    if (normalizedName === normalizedSearch) {
      return 0;
    }
    if (normalizedName.startsWith(normalizedSearch)) {
      return normalizedName.length;
    }
    return Infinity;
  };
  function PageAttributesParent2() {
    const { editPost: editPost2 } = (0, import_data95.useDispatch)(store);
    const [fieldValue, setFieldValue] = (0, import_element93.useState)(false);
    const {
      isHierarchical,
      parentPostId,
      parentPostTitle,
      pageItems,
      isLoading
    } = (0, import_data95.useSelect)(
      (select5) => {
        const {
          getPostType,
          getEntityRecords,
          getEntityRecord,
          isResolving
        } = select5(import_core_data61.store);
        const { getCurrentPostId: getCurrentPostId2, getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
        const postTypeSlug = getEditedPostAttribute2("type");
        const pageId = getEditedPostAttribute2("parent");
        const pType = getPostType(postTypeSlug);
        const postId2 = getCurrentPostId2();
        const postIsHierarchical = pType?.hierarchical ?? false;
        const query = {
          per_page: 100,
          exclude: postId2,
          parent_exclude: postId2,
          orderby: "menu_order",
          order: "asc",
          _fields: "id,title,parent"
        };
        if (!!fieldValue) {
          query.search = fieldValue;
          query.orderby = "relevance";
        }
        const parentPost = pageId ? getEntityRecord("postType", postTypeSlug, pageId) : null;
        return {
          isHierarchical: postIsHierarchical,
          parentPostId: pageId,
          parentPostTitle: parentPost ? getTitle(parentPost) : "",
          pageItems: postIsHierarchical ? getEntityRecords("postType", postTypeSlug, query) : null,
          isLoading: postIsHierarchical ? isResolving("getEntityRecords", [
            "postType",
            postTypeSlug,
            query
          ]) : false
        };
      },
      [fieldValue]
    );
    const parentOptions = (0, import_element93.useMemo)(() => {
      const getOptionsFromTree = (tree2, level = 0) => {
        const mappedNodes = tree2.map((treeNode) => [
          {
            value: treeNode.id,
            label: "\u2014 ".repeat(level) + (0, import_html_entities14.decodeEntities)(treeNode.name),
            rawName: treeNode.name
          },
          ...getOptionsFromTree(treeNode.children || [], level + 1)
        ]);
        const sortedNodes = mappedNodes.sort(([a3], [b3]) => {
          const priorityA = getItemPriority2(a3.rawName, fieldValue);
          const priorityB = getItemPriority2(b3.rawName, fieldValue);
          return priorityA >= priorityB ? 1 : -1;
        });
        return sortedNodes.flat();
      };
      if (!pageItems) {
        return [];
      }
      let tree = pageItems.map((item) => ({
        id: item.id,
        parent: item.parent,
        name: getTitle(item)
      }));
      if (!fieldValue) {
        tree = buildTermsTree2(tree);
      }
      const opts = getOptionsFromTree(tree);
      const optsHasParent = opts.find(
        (item) => item.value === parentPostId
      );
      if (parentPostTitle && !optsHasParent) {
        opts.unshift({
          value: parentPostId,
          label: parentPostTitle
        });
      }
      return opts;
    }, [pageItems, fieldValue, parentPostTitle, parentPostId]);
    if (!isHierarchical) {
      return null;
    }
    const handleKeydown = (inputValue) => {
      setFieldValue(inputValue);
    };
    const handleChange = (selectedPostId) => {
      editPost2({ parent: selectedPostId });
    };
    return /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(
      import_components111.ComboboxControl,
      {
        __next40pxDefaultSize: true,
        className: "editor-page-attributes__parent",
        label: (0, import_i18n127.__)("Parent"),
        help: (0, import_i18n127.__)("Choose a parent page."),
        value: parentPostId,
        options: parentOptions,
        onFilterValueChange: (0, import_compose23.debounce)(handleKeydown, 300),
        onChange: handleChange,
        hideLabelFromVision: true,
        isLoading
      }
    );
  }
  function PostParentToggle({ isOpen, onClick }) {
    const parentPost = (0, import_data95.useSelect)((select5) => {
      const { getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
      const parentPostId = getEditedPostAttribute2("parent");
      if (!parentPostId) {
        return null;
      }
      const { getEntityRecord } = select5(import_core_data61.store);
      const postTypeSlug = getEditedPostAttribute2("type");
      return getEntityRecord("postType", postTypeSlug, parentPostId);
    }, []);
    const parentTitle = (0, import_element93.useMemo)(
      () => !parentPost ? (0, import_i18n127.__)("None") : getTitle(parentPost),
      [parentPost]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(
      import_components111.Button,
      {
        size: "compact",
        className: "editor-post-parent__panel-toggle",
        variant: "tertiary",
        "aria-expanded": isOpen,
        "aria-label": (
          // translators: %s: Current post parent.
          (0, import_i18n127.sprintf)((0, import_i18n127.__)("Change parent: %s"), parentTitle)
        ),
        onClick,
        children: parentTitle
      }
    );
  }
  function ParentRow() {
    const homeUrl = (0, import_data95.useSelect)((select5) => {
      return select5(import_core_data61.store).getEntityRecord("root", "__unstableBase")?.home;
    }, []);
    const [popoverAnchor, setPopoverAnchor] = (0, import_element93.useState)(null);
    const popoverProps = (0, import_element93.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(post_panel_row_default, { label: (0, import_i18n127.__)("Parent"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(
      import_components111.Dropdown,
      {
        popoverProps,
        className: "editor-post-parent__panel-dropdown",
        contentClassName: "editor-post-parent__panel-dialog",
        focusOnMount: true,
        renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(PostParentToggle, { isOpen, onClick: onToggle }),
        renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime215.jsxs)("div", { className: "editor-post-parent", children: [
          /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(
            import_block_editor46.__experimentalInspectorPopoverHeader,
            {
              title: (0, import_i18n127.__)("Parent"),
              onClose
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime215.jsxs)("div", { children: [
            (0, import_element93.createInterpolateElement)(
              (0, import_i18n127.sprintf)(
                /* translators: %s: The home URL of the WordPress installation without the scheme. */
                (0, import_i18n127.__)(
                  'Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %s<wbr />/services<wbr />/pricing.'
                ),
                (0, import_url10.filterURLForDisplay)(homeUrl).replace(
                  /([/.])/g,
                  "<wbr />$1"
                )
              ),
              {
                wbr: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("wbr", {})
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("p", { children: (0, import_element93.createInterpolateElement)(
              (0, import_i18n127.__)(
                "They also show up as sub-items in the default navigation menu. <a>Learn more.</a>"
              ),
              {
                a: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(
                  import_components111.ExternalLink,
                  {
                    href: (0, import_i18n127.__)(
                      "https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes"
                    )
                  }
                )
              }
            ) })
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(PageAttributesParent2, {})
        ] })
      }
    ) });
  }
  var parent_default2 = PageAttributesParent2;

  // packages/editor/build-module/components/page-attributes/panel.mjs
  var import_jsx_runtime216 = __toESM(require_jsx_runtime(), 1);
  var PANEL_NAME = "page-attributes";
  function AttributesPanel() {
    const { isEnabled, postType: postType2 } = (0, import_data96.useSelect)((select5) => {
      const { getEditedPostAttribute: getEditedPostAttribute2, isEditorPanelEnabled: isEditorPanelEnabled2 } = select5(store);
      const { getPostType } = select5(import_core_data62.store);
      return {
        isEnabled: isEditorPanelEnabled2(PANEL_NAME),
        postType: getPostType(getEditedPostAttribute2("type"))
      };
    }, []);
    if (!isEnabled || !postType2) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(ParentRow, {});
  }
  function PageAttributesPanel() {
    return /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(check_default2, { children: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(AttributesPanel, {}) });
  }

  // packages/editor/build-module/components/post-template/classic-theme.mjs
  var import_i18n129 = __toESM(require_i18n(), 1);
  var import_components113 = __toESM(require_components(), 1);
  var import_data99 = __toESM(require_data(), 1);
  var import_core_data64 = __toESM(require_core_data(), 1);
  var import_block_editor47 = __toESM(require_block_editor(), 1);
  var import_element96 = __toESM(require_element(), 1);
  var import_notices21 = __toESM(require_notices(), 1);

  // packages/editor/build-module/components/post-template/create-new-template-modal.mjs
  var import_data97 = __toESM(require_data(), 1);
  var import_element94 = __toESM(require_element(), 1);
  var import_blocks24 = __toESM(require_blocks(), 1);
  var import_components112 = __toESM(require_components(), 1);
  var import_i18n128 = __toESM(require_i18n(), 1);
  var import_jsx_runtime217 = __toESM(require_jsx_runtime(), 1);
  var DEFAULT_TITLE = (0, import_i18n128.__)("Custom Template");
  function CreateNewTemplateModal({ onClose }) {
    const { defaultBlockTemplate, onNavigateToEntityRecord } = (0, import_data97.useSelect)(
      (select5) => {
        const { getEditorSettings: getEditorSettings2, getCurrentTemplateId: getCurrentTemplateId2 } = select5(store);
        return {
          defaultBlockTemplate: getEditorSettings2().defaultBlockTemplate,
          onNavigateToEntityRecord: getEditorSettings2().onNavigateToEntityRecord,
          getTemplateId: getCurrentTemplateId2
        };
      }
    );
    const { createTemplate: createTemplate2 } = unlock((0, import_data97.useDispatch)(store));
    const [title, setTitle] = (0, import_element94.useState)("");
    const [isBusy, setIsBusy] = (0, import_element94.useState)(false);
    const cancel = () => {
      setTitle("");
      onClose();
    };
    const submit = async (event) => {
      event.preventDefault();
      if (isBusy) {
        return;
      }
      setIsBusy(true);
      const newTemplateContent = defaultBlockTemplate ?? (0, import_blocks24.serialize)([
        (0, import_blocks24.createBlock)(
          "core/group",
          {
            tagName: "header",
            layout: { inherit: true }
          },
          [
            (0, import_blocks24.createBlock)("core/site-title"),
            (0, import_blocks24.createBlock)("core/site-tagline")
          ]
        ),
        (0, import_blocks24.createBlock)("core/separator"),
        (0, import_blocks24.createBlock)(
          "core/group",
          {
            tagName: "main"
          },
          [
            (0, import_blocks24.createBlock)(
              "core/group",
              {
                layout: { inherit: true }
              },
              [(0, import_blocks24.createBlock)("core/post-title")]
            ),
            (0, import_blocks24.createBlock)("core/post-content", {
              layout: { inherit: true }
            })
          ]
        )
      ]);
      const newTemplate = await createTemplate2({
        slug: paramCase(title || DEFAULT_TITLE) || "wp-custom-template",
        content: newTemplateContent,
        title: title || DEFAULT_TITLE,
        status: "publish"
      });
      setIsBusy(false);
      onNavigateToEntityRecord({
        postId: newTemplate.id,
        postType: "wp_template"
      });
      cancel();
    };
    return /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
      import_components112.Modal,
      {
        title: (0, import_i18n128.__)("Create custom template"),
        onRequestClose: cancel,
        focusOnMount: "firstContentElement",
        size: "small",
        overlayClassName: "editor-post-template__create-template-modal",
        children: /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
          "form",
          {
            className: "editor-post-template__create-form",
            onSubmit: submit,
            children: /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)(import_components112.__experimentalVStack, { spacing: "3", children: [
              /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
                import_components112.TextControl,
                {
                  __next40pxDefaultSize: true,
                  label: (0, import_i18n128.__)("Name"),
                  value: title,
                  onChange: setTitle,
                  placeholder: DEFAULT_TITLE,
                  disabled: isBusy,
                  help: (0, import_i18n128.__)(
                    // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts
                    'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.'
                  )
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)(import_components112.__experimentalHStack, { justify: "right", children: [
                /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
                  import_components112.Button,
                  {
                    __next40pxDefaultSize: true,
                    variant: "tertiary",
                    onClick: cancel,
                    children: (0, import_i18n128.__)("Cancel")
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
                  import_components112.Button,
                  {
                    __next40pxDefaultSize: true,
                    variant: "primary",
                    type: "submit",
                    isBusy,
                    "aria-disabled": isBusy,
                    children: (0, import_i18n128.__)("Create")
                  }
                )
              ] })
            ] })
          }
        )
      }
    );
  }

  // packages/editor/build-module/components/post-template/hooks.mjs
  var import_data98 = __toESM(require_data(), 1);
  var import_element95 = __toESM(require_element(), 1);
  var import_core_data63 = __toESM(require_core_data(), 1);
  function useEditedPostContext() {
    return (0, import_data98.useSelect)((select5) => {
      const { getCurrentPostId: getCurrentPostId2, getCurrentPostType: getCurrentPostType2 } = select5(store);
      return {
        postId: getCurrentPostId2(),
        postType: getCurrentPostType2()
      };
    }, []);
  }
  function useAllowSwitchingTemplates() {
    const { postType: postType2, postId: postId2 } = useEditedPostContext();
    return (0, import_data98.useSelect)(
      (select5) => {
        const { canUser, getEntityRecord, getEntityRecords } = select5(import_core_data63.store);
        const siteSettings = canUser("read", {
          kind: "root",
          name: "site"
        }) ? getEntityRecord("root", "site") : void 0;
        const isPostsPage = +postId2 === siteSettings?.page_for_posts;
        const isFrontPage = postType2 === "page" && +postId2 === siteSettings?.page_on_front;
        const templates = isFrontPage ? getEntityRecords("postType", "wp_template", {
          per_page: -1
        }) : [];
        const hasFrontPage = isFrontPage && !!templates?.some(({ slug }) => slug === "front-page");
        return !isPostsPage && !hasFrontPage;
      },
      [postId2, postType2]
    );
  }
  function useTemplates(postType2) {
    return (0, import_data98.useSelect)(
      (select5) => select5(import_core_data63.store).getEntityRecords("postType", "wp_template", {
        per_page: -1,
        post_type: postType2
        // We look at the combined templates for now (old endpoint)
        // because posts only accept slugs for templates, not IDs.
      }),
      [postType2]
    );
  }
  function useAvailableTemplates(postType2) {
    const currentTemplateSlug = useCurrentTemplateSlug();
    const allowSwitchingTemplate = useAllowSwitchingTemplates();
    const templates = useTemplates(postType2);
    return (0, import_element95.useMemo)(
      () => allowSwitchingTemplate && templates?.filter(
        (template2) => template2.is_custom && template2.slug !== currentTemplateSlug && !!template2.content.raw
        // Skip empty templates.
      ),
      [templates, currentTemplateSlug, allowSwitchingTemplate]
    );
  }
  function useCurrentTemplateSlug() {
    const { postType: postType2, postId: postId2 } = useEditedPostContext();
    const templates = useTemplates(postType2);
    const entityTemplate = (0, import_data98.useSelect)(
      (select5) => {
        const post2 = select5(import_core_data63.store).getEditedEntityRecord(
          "postType",
          postType2,
          postId2
        );
        return post2?.template;
      },
      [postType2, postId2]
    );
    if (!entityTemplate) {
      return;
    }
    return templates?.find((template2) => template2.slug === entityTemplate)?.slug;
  }

  // packages/editor/build-module/components/post-template/classic-theme.mjs
  var import_jsx_runtime218 = __toESM(require_jsx_runtime(), 1);
  function PostTemplateToggle({ isOpen, onClick }) {
    const templateTitle = (0, import_data99.useSelect)((select5) => {
      const templateSlug = select5(store).getEditedPostAttribute("template");
      const { supportsTemplateMode, availableTemplates } = select5(store).getEditorSettings();
      if (!supportsTemplateMode && availableTemplates[templateSlug]) {
        return availableTemplates[templateSlug];
      }
      const template2 = select5(import_core_data64.store).canUser("create", {
        kind: "postType",
        name: "wp_template"
      }) && select5(store).getCurrentTemplateId();
      return template2?.title || template2?.slug || availableTemplates?.[templateSlug];
    }, []);
    return /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
      import_components113.Button,
      {
        __next40pxDefaultSize: true,
        variant: "tertiary",
        "aria-expanded": isOpen,
        "aria-label": (0, import_i18n129.__)("Template options"),
        onClick,
        children: templateTitle ?? (0, import_i18n129.__)("Default template")
      }
    );
  }
  function PostTemplateDropdownContent({ onClose }) {
    const allowSwitchingTemplate = useAllowSwitchingTemplates();
    const {
      availableTemplates,
      fetchedTemplates,
      selectedTemplateSlug,
      canCreate,
      canEdit,
      currentTemplateId,
      onNavigateToEntityRecord,
      getEditorSettings: getEditorSettings2
    } = (0, import_data99.useSelect)(
      (select5) => {
        const { canUser, getEntityRecords } = select5(import_core_data64.store);
        const editorSettings2 = select5(store).getEditorSettings();
        const canCreateTemplates = canUser("create", {
          kind: "postType",
          name: "wp_template"
        });
        const _currentTemplateId = select5(store).getCurrentTemplateId();
        return {
          availableTemplates: editorSettings2.availableTemplates,
          fetchedTemplates: canCreateTemplates ? getEntityRecords("postType", "wp_template", {
            post_type: select5(store).getCurrentPostType(),
            per_page: -1
          }) : void 0,
          selectedTemplateSlug: select5(store).getEditedPostAttribute("template"),
          canCreate: allowSwitchingTemplate && canCreateTemplates && editorSettings2.supportsTemplateMode,
          canEdit: allowSwitchingTemplate && canCreateTemplates && editorSettings2.supportsTemplateMode && !!_currentTemplateId,
          currentTemplateId: _currentTemplateId,
          onNavigateToEntityRecord: editorSettings2.onNavigateToEntityRecord,
          getEditorSettings: select5(store).getEditorSettings
        };
      },
      [allowSwitchingTemplate]
    );
    const options = (0, import_element96.useMemo)(
      () => Object.entries({
        ...availableTemplates,
        ...Object.fromEntries(
          (fetchedTemplates ?? []).map(({ slug, title }) => [
            slug,
            title.rendered
          ])
        )
      }).map(([slug, title]) => ({ value: slug, label: title })),
      [availableTemplates, fetchedTemplates]
    );
    const selectedOption = options.find((option) => option.value === selectedTemplateSlug) ?? options.find((option) => !option.value);
    const { editPost: editPost2 } = (0, import_data99.useDispatch)(store);
    const { createSuccessNotice } = (0, import_data99.useDispatch)(import_notices21.store);
    const [isCreateModalOpen, setIsCreateModalOpen] = (0, import_element96.useState)(false);
    return /* @__PURE__ */ (0, import_jsx_runtime218.jsxs)("div", { className: "editor-post-template__classic-theme-dropdown", children: [
      /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
        import_block_editor47.__experimentalInspectorPopoverHeader,
        {
          title: (0, import_i18n129.__)("Template"),
          help: (0, import_i18n129.__)(
            "Templates define the way content is displayed when viewing your site."
          ),
          actions: canCreate ? [
            {
              icon: add_template_default,
              label: (0, import_i18n129.__)("Add template"),
              onClick: () => setIsCreateModalOpen(true)
            }
          ] : [],
          onClose
        }
      ),
      !allowSwitchingTemplate ? /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(import_components113.Notice, { status: "warning", isDismissible: false, children: (0, import_i18n129.__)("The posts page template cannot be changed.") }) : /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
        import_components113.SelectControl,
        {
          __next40pxDefaultSize: true,
          hideLabelFromVision: true,
          label: (0, import_i18n129.__)("Template"),
          value: selectedOption?.value ?? "",
          options,
          onChange: (slug) => editPost2({ template: slug || "" })
        }
      ),
      canEdit && onNavigateToEntityRecord && /* @__PURE__ */ (0, import_jsx_runtime218.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
        import_components113.Button,
        {
          __next40pxDefaultSize: true,
          variant: "link",
          onClick: () => {
            onNavigateToEntityRecord({
              postId: currentTemplateId,
              postType: "wp_template"
            });
            onClose();
            createSuccessNotice(
              (0, import_i18n129.__)(
                "Editing template. Changes made here affect all posts and pages that use the template."
              ),
              {
                type: "snackbar",
                actions: [
                  {
                    label: (0, import_i18n129.__)("Go back"),
                    onClick: () => getEditorSettings2().onNavigateToPreviousEntityRecord()
                  }
                ]
              }
            );
          },
          children: (0, import_i18n129.__)("Edit template")
        }
      ) }),
      isCreateModalOpen && /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
        CreateNewTemplateModal,
        {
          onClose: () => setIsCreateModalOpen(false)
        }
      )
    ] });
  }
  function ClassicThemeControl() {
    const [popoverAnchor, setPopoverAnchor] = (0, import_element96.useState)(null);
    const popoverProps = (0, import_element96.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        className: "editor-post-template__dropdown",
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(post_panel_row_default, { label: (0, import_i18n129.__)("Template"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
      import_components113.Dropdown,
      {
        popoverProps,
        focusOnMount: true,
        renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
          PostTemplateToggle,
          {
            isOpen,
            onClick: onToggle
          }
        ),
        renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(PostTemplateDropdownContent, { onClose })
      }
    ) });
  }
  var classic_theme_default = ClassicThemeControl;

  // packages/editor/build-module/components/plugin-document-setting-panel/index.mjs
  var import_components115 = __toESM(require_components(), 1);
  var import_plugins3 = __toESM(require_plugins(), 1);
  var import_data101 = __toESM(require_data(), 1);
  var import_warning = __toESM(require_warning(), 1);

  // packages/editor/build-module/components/preferences-modal/enable-plugin-document-setting-panel.mjs
  var import_components114 = __toESM(require_components(), 1);

  // packages/editor/build-module/components/preferences-modal/enable-panel.mjs
  var import_data100 = __toESM(require_data(), 1);
  var import_preferences12 = __toESM(require_preferences(), 1);
  var import_jsx_runtime219 = __toESM(require_jsx_runtime(), 1);
  var { PreferenceBaseOption } = unlock(import_preferences12.privateApis);
  function EnablePanelOption(props) {
    const { toggleEditorPanelEnabled: toggleEditorPanelEnabled2 } = (0, import_data100.useDispatch)(store);
    const { isChecked, isRemoved } = (0, import_data100.useSelect)(
      (select5) => {
        const { isEditorPanelEnabled: isEditorPanelEnabled2, isEditorPanelRemoved: isEditorPanelRemoved2 } = select5(store);
        return {
          isChecked: isEditorPanelEnabled2(props.panelName),
          isRemoved: isEditorPanelRemoved2(props.panelName)
        };
      },
      [props.panelName]
    );
    if (isRemoved) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(
      PreferenceBaseOption,
      {
        isChecked,
        onChange: () => toggleEditorPanelEnabled2(props.panelName),
        ...props
      }
    );
  }

  // packages/editor/build-module/components/preferences-modal/enable-plugin-document-setting-panel.mjs
  var import_jsx_runtime220 = __toESM(require_jsx_runtime(), 1);
  var { Fill: Fill4, Slot: Slot4 } = (0, import_components114.createSlotFill)(
    "EnablePluginDocumentSettingPanelOption"
  );
  var EnablePluginDocumentSettingPanelOption = ({ label, panelName }) => /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(Fill4, { children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(EnablePanelOption, { label, panelName }) });
  EnablePluginDocumentSettingPanelOption.Slot = Slot4;
  var enable_plugin_document_setting_panel_default = EnablePluginDocumentSettingPanelOption;

  // packages/editor/build-module/components/plugin-document-setting-panel/index.mjs
  var import_jsx_runtime221 = __toESM(require_jsx_runtime(), 1);
  var { Fill: Fill5, Slot: Slot5 } = (0, import_components115.createSlotFill)("PluginDocumentSettingPanel");
  var PluginDocumentSettingPanel = ({
    name: name2,
    className,
    title,
    icon,
    children
  }) => {
    const { name: pluginName } = (0, import_plugins3.usePluginContext)();
    const panelName = `${pluginName}/${name2}`;
    const { opened, isEnabled } = (0, import_data101.useSelect)(
      (select5) => {
        const { isEditorPanelOpened: isEditorPanelOpened2, isEditorPanelEnabled: isEditorPanelEnabled2 } = select5(store);
        return {
          opened: isEditorPanelOpened2(panelName),
          isEnabled: isEditorPanelEnabled2(panelName)
        };
      },
      [panelName]
    );
    const { toggleEditorPanelOpened: toggleEditorPanelOpened2 } = (0, import_data101.useDispatch)(store);
    if (void 0 === name2) {
      (0, import_warning.default)("PluginDocumentSettingPanel requires a name property.");
    }
    return /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)(import_jsx_runtime221.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(
        enable_plugin_document_setting_panel_default,
        {
          label: title,
          panelName
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(Fill5, { children: isEnabled && /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(
        import_components115.PanelBody,
        {
          className,
          title,
          icon,
          opened,
          onToggle: () => toggleEditorPanelOpened2(panelName),
          children
        }
      ) })
    ] });
  };
  PluginDocumentSettingPanel.Slot = Slot5;
  var plugin_document_setting_panel_default = PluginDocumentSettingPanel;

  // packages/editor/build-module/components/block-settings-menu/plugin-block-settings-menu-item.mjs
  var import_block_editor48 = __toESM(require_block_editor(), 1);
  var import_components116 = __toESM(require_components(), 1);
  var import_compose24 = __toESM(require_compose(), 1);
  var import_jsx_runtime222 = __toESM(require_jsx_runtime(), 1);
  var isEverySelectedBlockAllowed = (selected, allowed) => selected.filter((id) => !allowed.includes(id)).length === 0;
  var shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks);
  var PluginBlockSettingsMenuItem = ({
    allowedBlocks,
    icon,
    label,
    onClick,
    small,
    role
  }) => /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(import_block_editor48.BlockSettingsMenuControls, { children: ({ selectedBlocks, onClose }) => {
    if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
      import_components116.MenuItem,
      {
        onClick: (0, import_compose24.compose)(onClick, onClose),
        icon,
        label: small ? label : void 0,
        role,
        children: !small && label
      }
    );
  } });
  var plugin_block_settings_menu_item_default = PluginBlockSettingsMenuItem;

  // packages/editor/build-module/components/plugin-more-menu-item/index.mjs
  var import_components117 = __toESM(require_components(), 1);
  var import_plugins4 = __toESM(require_plugins(), 1);
  var import_jsx_runtime223 = __toESM(require_jsx_runtime(), 1);
  function PluginMoreMenuItem(props) {
    const context = (0, import_plugins4.usePluginContext)();
    return /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(
      action_item_default,
      {
        name: "core/plugin-more-menu",
        as: props.as ?? import_components117.MenuItem,
        icon: props.icon || context.icon,
        ...props
      }
    );
  }

  // packages/editor/build-module/components/plugin-post-publish-panel/index.mjs
  var import_plugins5 = __toESM(require_plugins(), 1);
  var import_components118 = __toESM(require_components(), 1);
  var import_jsx_runtime224 = __toESM(require_jsx_runtime(), 1);
  var { Fill: Fill6, Slot: Slot6 } = (0, import_components118.createSlotFill)("PluginPostPublishPanel");
  var PluginPostPublishPanel = ({
    children,
    className,
    title,
    initialOpen = false,
    icon
  }) => {
    const { icon: pluginIcon } = (0, import_plugins5.usePluginContext)();
    return /* @__PURE__ */ (0, import_jsx_runtime224.jsx)(Fill6, { children: /* @__PURE__ */ (0, import_jsx_runtime224.jsx)(
      import_components118.PanelBody,
      {
        className,
        initialOpen: initialOpen || !title,
        title,
        icon: icon ?? pluginIcon,
        children
      }
    ) });
  };
  PluginPostPublishPanel.Slot = Slot6;
  var plugin_post_publish_panel_default = PluginPostPublishPanel;

  // packages/editor/build-module/components/plugin-post-status-info/index.mjs
  var import_components119 = __toESM(require_components(), 1);
  var import_jsx_runtime225 = __toESM(require_jsx_runtime(), 1);
  var { Fill: Fill7, Slot: Slot7 } = (0, import_components119.createSlotFill)("PluginPostStatusInfo");
  var PluginPostStatusInfo = ({ children, className }) => /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(Fill7, { children: /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(import_components119.PanelRow, { className, children }) });
  PluginPostStatusInfo.Slot = Slot7;
  var plugin_post_status_info_default = PluginPostStatusInfo;

  // packages/editor/build-module/components/plugin-pre-publish-panel/index.mjs
  var import_components120 = __toESM(require_components(), 1);
  var import_plugins6 = __toESM(require_plugins(), 1);
  var import_jsx_runtime226 = __toESM(require_jsx_runtime(), 1);
  var { Fill: Fill8, Slot: Slot8 } = (0, import_components120.createSlotFill)("PluginPrePublishPanel");
  var PluginPrePublishPanel = ({
    children,
    className,
    title,
    initialOpen = false,
    icon
  }) => {
    const { icon: pluginIcon } = (0, import_plugins6.usePluginContext)();
    return /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(Fill8, { children: /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(
      import_components120.PanelBody,
      {
        className,
        initialOpen: initialOpen || !title,
        title,
        icon: icon ?? pluginIcon,
        children
      }
    ) });
  };
  PluginPrePublishPanel.Slot = Slot8;
  var plugin_pre_publish_panel_default = PluginPrePublishPanel;

  // packages/editor/build-module/components/plugin-preview-menu-item/index.mjs
  var import_components121 = __toESM(require_components(), 1);
  var import_plugins7 = __toESM(require_plugins(), 1);
  var import_jsx_runtime227 = __toESM(require_jsx_runtime(), 1);
  function PluginPreviewMenuItem(props) {
    const context = (0, import_plugins7.usePluginContext)();
    return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
      action_item_default,
      {
        name: "core/plugin-preview-menu",
        as: props.as ?? import_components121.MenuItem,
        icon: props.icon || context.icon,
        ...props
      }
    );
  }

  // packages/editor/build-module/components/plugin-sidebar/index.mjs
  var import_jsx_runtime228 = __toESM(require_jsx_runtime(), 1);
  function PluginSidebar({ className, ...props }) {
    return /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
      complementary_area_default,
      {
        panelClassName: className,
        className: "editor-sidebar",
        scope: "core",
        ...props
      }
    );
  }

  // packages/editor/build-module/components/plugin-sidebar-more-menu-item/index.mjs
  var import_jsx_runtime229 = __toESM(require_jsx_runtime(), 1);
  function PluginSidebarMoreMenuItem(props) {
    return /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(
      ComplementaryAreaMoreMenuItem,
      {
        __unstableExplicitMenuItem: true,
        scope: "core",
        ...props
      }
    );
  }

  // packages/editor/build-module/components/post-template/panel.mjs
  var import_data106 = __toESM(require_data(), 1);
  var import_core_data69 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/post-template/block-theme.mjs
  var import_data105 = __toESM(require_data(), 1);
  var import_html_entities16 = __toESM(require_html_entities(), 1);
  var import_components125 = __toESM(require_components(), 1);
  var import_element99 = __toESM(require_element(), 1);
  var import_i18n133 = __toESM(require_i18n(), 1);
  var import_core_data68 = __toESM(require_core_data(), 1);
  var import_notices22 = __toESM(require_notices(), 1);
  var import_preferences13 = __toESM(require_preferences(), 1);

  // packages/editor/build-module/components/post-template/swap-template-button.mjs
  var import_element97 = __toESM(require_element(), 1);
  var import_html_entities15 = __toESM(require_html_entities(), 1);
  var import_block_editor49 = __toESM(require_block_editor(), 1);
  var import_components122 = __toESM(require_components(), 1);
  var import_i18n130 = __toESM(require_i18n(), 1);
  var import_data102 = __toESM(require_data(), 1);
  var import_core_data65 = __toESM(require_core_data(), 1);
  var import_blocks25 = __toESM(require_blocks(), 1);

  // packages/editor/build-module/utils/search-templates.mjs
  var import_remove_accents3 = __toESM(require_remove_accents(), 1);
  function normalizeSearchInput(input = "") {
    input = (0, import_remove_accents3.default)(input);
    input = input.trim().toLowerCase();
    return input;
  }
  function getTemplateSearchRank(template2, searchValue) {
    const normalizedSearchValue = normalizeSearchInput(searchValue);
    const normalizedTitle = normalizeSearchInput(template2.title);
    let rank = 0;
    if (normalizedSearchValue === normalizedTitle) {
      rank += 30;
    } else if (normalizedTitle.startsWith(normalizedSearchValue)) {
      rank += 20;
    } else {
      const searchTerms = normalizedSearchValue.split(" ");
      const hasMatchedTerms = searchTerms.every(
        (searchTerm) => normalizedTitle.includes(searchTerm)
      );
      if (hasMatchedTerms) {
        rank += 10;
      }
    }
    return rank;
  }
  function searchTemplates(templates = [], searchValue = "") {
    if (!searchValue) {
      return templates;
    }
    const rankedTemplates = templates.map((template2) => {
      return [template2, getTemplateSearchRank(template2, searchValue)];
    }).filter(([, rank]) => rank > 0);
    rankedTemplates.sort(([, rank1], [, rank2]) => rank2 - rank1);
    return rankedTemplates.map(([template2]) => template2);
  }

  // packages/editor/build-module/components/post-template/swap-template-button.mjs
  var import_jsx_runtime230 = __toESM(require_jsx_runtime(), 1);
  function SwapTemplateButton({ onClick }) {
    const [showModal, setShowModal] = (0, import_element97.useState)(false);
    const { postType: postType2, postId: postId2 } = useEditedPostContext();
    const availableTemplates = useAvailableTemplates(postType2);
    const { editEntityRecord } = (0, import_data102.useDispatch)(import_core_data65.store);
    const onTemplateSelect = async (template2) => {
      editEntityRecord(
        "postType",
        postType2,
        postId2,
        { template: template2.name },
        { undoIgnore: true }
      );
      setShowModal(false);
      onClick();
    };
    return /* @__PURE__ */ (0, import_jsx_runtime230.jsxs)(import_jsx_runtime230.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
        import_components122.MenuItem,
        {
          disabled: !availableTemplates?.length,
          accessibleWhenDisabled: true,
          onClick: () => setShowModal(true),
          children: (0, import_i18n130.__)("Change template")
        }
      ),
      showModal && /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
        import_components122.Modal,
        {
          title: (0, import_i18n130.__)("Choose a template"),
          onRequestClose: () => setShowModal(false),
          overlayClassName: "editor-post-template__swap-template-modal",
          isFullScreen: true,
          children: /* @__PURE__ */ (0, import_jsx_runtime230.jsx)("div", { className: "editor-post-template__swap-template-modal-content", children: /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
            TemplatesList,
            {
              postType: postType2,
              onSelect: onTemplateSelect
            }
          ) })
        }
      )
    ] });
  }
  function TemplatesList({ postType: postType2, onSelect }) {
    const [searchValue, setSearchValue] = (0, import_element97.useState)("");
    const availableTemplates = useAvailableTemplates(postType2);
    const templatesAsPatterns = (0, import_element97.useMemo)(
      () => availableTemplates.map((template2) => ({
        name: template2.slug,
        blocks: (0, import_blocks25.parse)(template2.content.raw),
        title: (0, import_html_entities15.decodeEntities)(template2.title.rendered),
        id: template2.id
      })),
      [availableTemplates]
    );
    const filteredBlockTemplates = (0, import_element97.useMemo)(() => {
      return searchTemplates(templatesAsPatterns, searchValue);
    }, [templatesAsPatterns, searchValue]);
    return /* @__PURE__ */ (0, import_jsx_runtime230.jsxs)(import_jsx_runtime230.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
        import_components122.SearchControl,
        {
          onChange: setSearchValue,
          value: searchValue,
          label: (0, import_i18n130.__)("Search"),
          placeholder: (0, import_i18n130.__)("Search"),
          className: "editor-post-template__swap-template-search"
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
        import_block_editor49.__experimentalBlockPatternsList,
        {
          label: (0, import_i18n130.__)("Templates"),
          blockPatterns: filteredBlockTemplates,
          onClickPattern: onSelect
        }
      )
    ] });
  }

  // packages/editor/build-module/components/post-template/reset-default-template.mjs
  var import_components123 = __toESM(require_components(), 1);
  var import_i18n131 = __toESM(require_i18n(), 1);
  var import_data103 = __toESM(require_data(), 1);
  var import_core_data66 = __toESM(require_core_data(), 1);
  var import_jsx_runtime231 = __toESM(require_jsx_runtime(), 1);
  function ResetDefaultTemplate({ onClick }) {
    const currentTemplateSlug = useCurrentTemplateSlug();
    const allowSwitchingTemplate = useAllowSwitchingTemplates();
    const { postType: postType2, postId: postId2 } = useEditedPostContext();
    const { editEntityRecord } = (0, import_data103.useDispatch)(import_core_data66.store);
    if (!currentTemplateSlug || !allowSwitchingTemplate) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime231.jsx)(
      import_components123.MenuItem,
      {
        onClick: () => {
          editEntityRecord(
            "postType",
            postType2,
            postId2,
            { template: "" },
            { undoIgnore: true }
          );
          onClick();
        },
        children: (0, import_i18n131.__)("Use default template")
      }
    );
  }

  // packages/editor/build-module/components/post-template/create-new-template.mjs
  var import_components124 = __toESM(require_components(), 1);
  var import_i18n132 = __toESM(require_i18n(), 1);
  var import_data104 = __toESM(require_data(), 1);
  var import_core_data67 = __toESM(require_core_data(), 1);
  var import_element98 = __toESM(require_element(), 1);
  var import_jsx_runtime232 = __toESM(require_jsx_runtime(), 1);
  function CreateNewTemplate() {
    const { canCreateTemplates } = (0, import_data104.useSelect)((select5) => {
      const { canUser } = select5(import_core_data67.store);
      return {
        canCreateTemplates: canUser("create", {
          kind: "postType",
          name: "wp_template"
        })
      };
    }, []);
    const [isCreateModalOpen, setIsCreateModalOpen] = (0, import_element98.useState)(false);
    const allowSwitchingTemplate = useAllowSwitchingTemplates();
    if (!canCreateTemplates || !allowSwitchingTemplate) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime232.jsxs)(import_jsx_runtime232.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
        import_components124.MenuItem,
        {
          onClick: () => {
            setIsCreateModalOpen(true);
          },
          children: (0, import_i18n132.__)("Create new template")
        }
      ),
      isCreateModalOpen && /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
        CreateNewTemplateModal,
        {
          onClose: () => {
            setIsCreateModalOpen(false);
          }
        }
      )
    ] });
  }

  // packages/editor/build-module/components/post-template/block-theme.mjs
  var import_jsx_runtime233 = __toESM(require_jsx_runtime(), 1);
  function BlockThemeControl({ id }) {
    const {
      isTemplateHidden,
      onNavigateToEntityRecord,
      getEditorSettings: getEditorSettings2,
      hasGoBack,
      hasSpecificTemplate
    } = (0, import_data105.useSelect)((select5) => {
      const {
        getRenderingMode: getRenderingMode2,
        getEditorSettings: _getEditorSettings,
        getCurrentPost: getCurrentPost2
      } = unlock(select5(store));
      const editorSettings2 = _getEditorSettings();
      const currentPost = getCurrentPost2();
      return {
        isTemplateHidden: getRenderingMode2() === "post-only",
        onNavigateToEntityRecord: editorSettings2.onNavigateToEntityRecord,
        getEditorSettings: _getEditorSettings,
        hasGoBack: editorSettings2.hasOwnProperty(
          "onNavigateToPreviousEntityRecord"
        ),
        hasSpecificTemplate: !!currentPost.template
      };
    }, []);
    const { get: getPreference } = (0, import_data105.useSelect)(import_preferences13.store);
    const { editedRecord: template2, hasResolved } = (0, import_core_data68.useEntityRecord)(
      "postType",
      "wp_template",
      id
    );
    const { getEntityRecord } = (0, import_data105.useSelect)(import_core_data68.store);
    const { editEntityRecord } = (0, import_data105.useDispatch)(import_core_data68.store);
    const { createSuccessNotice } = (0, import_data105.useDispatch)(import_notices22.store);
    const { setRenderingMode: setRenderingMode2, setDefaultRenderingMode: setDefaultRenderingMode2 } = unlock(
      (0, import_data105.useDispatch)(store)
    );
    const canCreateTemplate = (0, import_data105.useSelect)(
      (select5) => !!select5(import_core_data68.store).canUser("create", {
        kind: "postType",
        name: "wp_template"
      }),
      []
    );
    const [popoverAnchor, setPopoverAnchor] = (0, import_element99.useState)(null);
    const popoverProps = (0, import_element99.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        className: "editor-post-template__dropdown",
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor]
    );
    if (!hasResolved) {
      return null;
    }
    const notificationAction = hasGoBack ? [
      {
        label: (0, import_i18n133.__)("Go back"),
        onClick: () => getEditorSettings2().onNavigateToPreviousEntityRecord()
      }
    ] : void 0;
    const mayShowTemplateEditNotice = () => {
      if (!getPreference("core/edit-site", "welcomeGuideTemplate")) {
        createSuccessNotice(
          (0, import_i18n133.__)(
            "Editing template. Changes made here affect all posts and pages that use the template."
          ),
          { type: "snackbar", actions: notificationAction }
        );
      }
    };
    return /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(post_panel_row_default, { label: (0, import_i18n133.__)("Template"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
      import_components125.DropdownMenu,
      {
        popoverProps,
        focusOnMount: true,
        toggleProps: {
          size: "compact",
          variant: "tertiary",
          tooltipPosition: "middle left"
        },
        label: (0, import_i18n133.__)("Template options"),
        text: (0, import_html_entities16.decodeEntities)(template2.title),
        icon: null,
        children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)(import_jsx_runtime233.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)(import_components125.MenuGroup, { children: [
            canCreateTemplate && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
              import_components125.MenuItem,
              {
                onClick: async () => {
                  onNavigateToEntityRecord({
                    postId: template2.id,
                    postType: "wp_template"
                  });
                  if (!hasSpecificTemplate && window?.__experimentalTemplateActivate) {
                    const activeTemplates = await getEntityRecord(
                      "root",
                      "site"
                    ).active_templates;
                    if (activeTemplates[template2.slug] !== template2.id) {
                      editEntityRecord(
                        "root",
                        "site",
                        void 0,
                        {
                          active_templates: {
                            ...activeTemplates,
                            [template2.slug]: template2.id
                          }
                        }
                      );
                    }
                  }
                  onClose();
                  mayShowTemplateEditNotice();
                },
                children: (0, import_i18n133.__)("Edit template")
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(SwapTemplateButton, { onClick: onClose }),
            /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(ResetDefaultTemplate, { onClick: onClose }),
            canCreateTemplate && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(CreateNewTemplate, {})
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(import_components125.MenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
            import_components125.MenuItem,
            {
              icon: !isTemplateHidden ? check_default : void 0,
              isSelected: !isTemplateHidden,
              role: "menuitemcheckbox",
              onClick: () => {
                const newRenderingMode = isTemplateHidden ? "template-locked" : "post-only";
                setRenderingMode2(newRenderingMode);
                setDefaultRenderingMode2(newRenderingMode);
              },
              children: (0, import_i18n133.__)("Show template")
            }
          ) })
        ] })
      }
    ) });
  }

  // packages/editor/build-module/components/post-template/panel.mjs
  var import_jsx_runtime234 = __toESM(require_jsx_runtime(), 1);
  function PostTemplatePanel() {
    const { templateId: templateId2, isBlockTheme } = (0, import_data106.useSelect)((select5) => {
      const { getCurrentTemplateId: getCurrentTemplateId2, getEditorSettings: getEditorSettings2 } = select5(store);
      return {
        templateId: getCurrentTemplateId2(),
        isBlockTheme: getEditorSettings2().__unstableIsBlockBasedTheme
      };
    }, []);
    const isVisible = (0, import_data106.useSelect)((select5) => {
      const postTypeSlug = select5(store).getCurrentPostType();
      const postType2 = select5(import_core_data69.store).getPostType(postTypeSlug);
      if (!postType2?.viewable) {
        return false;
      }
      const settings = select5(store).getEditorSettings();
      const hasTemplates = !!settings.availableTemplates && Object.keys(settings.availableTemplates).length > 0;
      if (hasTemplates) {
        return true;
      }
      if (!settings.supportsTemplateMode) {
        return false;
      }
      const canCreateTemplates = select5(import_core_data69.store).canUser("create", {
        kind: "postType",
        name: "wp_template"
      }) ?? false;
      return canCreateTemplates;
    }, []);
    const canViewTemplates = (0, import_data106.useSelect)(
      (select5) => {
        return isVisible ? select5(import_core_data69.store).canUser("read", {
          kind: "postType",
          name: "wp_template"
        }) : false;
      },
      [isVisible]
    );
    if ((!isBlockTheme || !canViewTemplates) && isVisible) {
      return /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(classic_theme_default, {});
    }
    if (isBlockTheme && !!templateId2) {
      return /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(BlockThemeControl, { id: templateId2 });
    }
    return null;
  }

  // packages/editor/build-module/components/post-author/index.mjs
  var import_data110 = __toESM(require_data(), 1);
  var import_core_data71 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/post-author/combobox.mjs
  var import_compose25 = __toESM(require_compose(), 1);
  var import_element101 = __toESM(require_element(), 1);
  var import_data108 = __toESM(require_data(), 1);
  var import_i18n135 = __toESM(require_i18n(), 1);
  var import_components126 = __toESM(require_components(), 1);

  // packages/editor/build-module/components/post-author/hook.mjs
  var import_i18n134 = __toESM(require_i18n(), 1);
  var import_element100 = __toESM(require_element(), 1);
  var import_data107 = __toESM(require_data(), 1);
  var import_html_entities17 = __toESM(require_html_entities(), 1);
  var import_core_data70 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/post-author/constants.mjs
  var BASE_QUERY = {
    _fields: "id,name",
    context: "view"
    // Allows non-admins to perform requests.
  };
  var AUTHORS_QUERY = {
    who: "authors",
    per_page: 100,
    ...BASE_QUERY
  };

  // packages/editor/build-module/components/post-author/hook.mjs
  function useAuthorsQuery(search) {
    const { authorId, authors, postAuthor, isLoading } = (0, import_data107.useSelect)(
      (select5) => {
        const { getUser, getUsers, isResolving } = select5(import_core_data70.store);
        const { getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
        const _authorId = getEditedPostAttribute2("author");
        const query = { ...AUTHORS_QUERY };
        if (search) {
          query.search = search;
          query.search_columns = ["name"];
        }
        return {
          authorId: _authorId,
          authors: getUsers(query),
          postAuthor: getUser(_authorId, BASE_QUERY),
          isLoading: isResolving("getUsers", [query])
        };
      },
      [search]
    );
    const authorOptions = (0, import_element100.useMemo)(() => {
      const fetchedAuthors = (authors ?? []).map((author) => {
        return {
          value: author.id,
          label: (0, import_html_entities17.decodeEntities)(author.name)
        };
      });
      const foundAuthor = fetchedAuthors.findIndex(
        ({ value }) => postAuthor?.id === value
      );
      let currentAuthor = [];
      if (foundAuthor < 0 && postAuthor) {
        currentAuthor = [
          {
            value: postAuthor.id,
            label: (0, import_html_entities17.decodeEntities)(postAuthor.name)
          }
        ];
      } else if (foundAuthor < 0 && !postAuthor) {
        currentAuthor = [
          {
            value: 0,
            label: (0, import_i18n134.__)("(No author)")
          }
        ];
      }
      return [...currentAuthor, ...fetchedAuthors];
    }, [authors, postAuthor]);
    return { authorId, authorOptions, postAuthor, isLoading };
  }

  // packages/editor/build-module/components/post-author/combobox.mjs
  var import_jsx_runtime235 = __toESM(require_jsx_runtime(), 1);
  function PostAuthorCombobox() {
    const [fieldValue, setFieldValue] = (0, import_element101.useState)();
    const { editPost: editPost2 } = (0, import_data108.useDispatch)(store);
    const { authorId, authorOptions, isLoading } = useAuthorsQuery(fieldValue);
    const handleSelect = (postAuthorId) => {
      if (!postAuthorId) {
        return;
      }
      editPost2({ author: postAuthorId });
    };
    return /* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
      import_components126.ComboboxControl,
      {
        __next40pxDefaultSize: true,
        label: (0, import_i18n135.__)("Author"),
        options: authorOptions,
        value: authorId,
        onFilterValueChange: (0, import_compose25.debounce)(setFieldValue, 300),
        onChange: handleSelect,
        allowReset: false,
        hideLabelFromVision: true,
        isLoading
      }
    );
  }

  // packages/editor/build-module/components/post-author/select.mjs
  var import_i18n136 = __toESM(require_i18n(), 1);
  var import_data109 = __toESM(require_data(), 1);
  var import_components127 = __toESM(require_components(), 1);
  var import_jsx_runtime236 = __toESM(require_jsx_runtime(), 1);
  function PostAuthorSelect() {
    const { editPost: editPost2 } = (0, import_data109.useDispatch)(store);
    const { authorId, authorOptions } = useAuthorsQuery();
    const setAuthorId = (value) => {
      const author = Number(value);
      editPost2({ author });
    };
    return /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(
      import_components127.SelectControl,
      {
        __next40pxDefaultSize: true,
        className: "post-author-selector",
        label: (0, import_i18n136.__)("Author"),
        options: authorOptions,
        onChange: setAuthorId,
        value: authorId,
        hideLabelFromVision: true
      }
    );
  }

  // packages/editor/build-module/components/post-author/index.mjs
  var import_jsx_runtime237 = __toESM(require_jsx_runtime(), 1);
  var minimumUsersForCombobox = 25;
  function PostAuthor() {
    const showCombobox = (0, import_data110.useSelect)((select5) => {
      const authors = select5(import_core_data71.store).getUsers(AUTHORS_QUERY);
      return authors?.length >= minimumUsersForCombobox;
    }, []);
    if (showCombobox) {
      return /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(PostAuthorCombobox, {});
    }
    return /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(PostAuthorSelect, {});
  }
  var post_author_default = PostAuthor;

  // packages/editor/build-module/components/post-author/check.mjs
  var import_data111 = __toESM(require_data(), 1);
  var import_jsx_runtime238 = __toESM(require_jsx_runtime(), 1);
  function PostAuthorCheck({ children }) {
    const { hasAssignAuthorAction } = (0, import_data111.useSelect)((select5) => {
      const post2 = select5(store).getCurrentPost();
      const canAssignAuthor = post2?._links?.["wp:action-assign-author"] ? true : false;
      return {
        hasAssignAuthorAction: canAssignAuthor
      };
    }, []);
    if (!hasAssignAuthorAction) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(post_type_support_check_default, { supportKeys: "author", children });
  }

  // packages/editor/build-module/components/post-author/panel.mjs
  var import_i18n137 = __toESM(require_i18n(), 1);
  var import_components128 = __toESM(require_components(), 1);
  var import_element102 = __toESM(require_element(), 1);
  var import_html_entities18 = __toESM(require_html_entities(), 1);
  var import_block_editor50 = __toESM(require_block_editor(), 1);
  var import_data112 = __toESM(require_data(), 1);
  var import_core_data72 = __toESM(require_core_data(), 1);
  var import_jsx_runtime239 = __toESM(require_jsx_runtime(), 1);
  function PostAuthorToggle({ isOpen, onClick }) {
    const { postAuthor } = (0, import_data112.useSelect)((select5) => {
      const id = select5(store).getEditedPostAttribute("author");
      return {
        postAuthor: select5(import_core_data72.store).getUser(id, BASE_QUERY)
      };
    }, []);
    const authorName = (0, import_html_entities18.decodeEntities)(postAuthor?.name) || (0, import_i18n137.__)("(No author)");
    return /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(
      import_components128.Button,
      {
        size: "compact",
        className: "editor-post-author__panel-toggle",
        variant: "tertiary",
        "aria-expanded": isOpen,
        "aria-label": (
          // translators: %s: Author name.
          (0, import_i18n137.sprintf)((0, import_i18n137.__)("Change author: %s"), authorName)
        ),
        onClick,
        children: authorName
      }
    );
  }
  function PostAuthor2() {
    const [popoverAnchor, setPopoverAnchor] = (0, import_element102.useState)(null);
    const popoverProps = (0, import_element102.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(PostAuthorCheck, { children: /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(post_panel_row_default, { label: (0, import_i18n137.__)("Author"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(
      import_components128.Dropdown,
      {
        popoverProps,
        contentClassName: "editor-post-author__panel-dialog",
        focusOnMount: true,
        renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(
          PostAuthorToggle,
          {
            isOpen,
            onClick: onToggle
          }
        ),
        renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime239.jsxs)("div", { className: "editor-post-author", children: [
          /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(
            import_block_editor50.__experimentalInspectorPopoverHeader,
            {
              title: (0, import_i18n137.__)("Author"),
              onClose
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(post_author_default, { onClose })
        ] })
      }
    ) }) });
  }
  var panel_default = PostAuthor2;

  // packages/editor/build-module/components/post-comments/index.mjs
  var import_i18n138 = __toESM(require_i18n(), 1);
  var import_components129 = __toESM(require_components(), 1);
  var import_data113 = __toESM(require_data(), 1);
  var import_jsx_runtime240 = __toESM(require_jsx_runtime(), 1);
  var COMMENT_OPTIONS = [
    {
      label: (0, import_i18n138._x)("Open", 'Adjective: e.g. "Comments are open"'),
      value: "open",
      description: (0, import_i18n138.__)("Visitors can add new comments and replies.")
    },
    {
      label: (0, import_i18n138.__)("Closed"),
      value: "closed",
      description: [
        (0, import_i18n138.__)("Visitors cannot add new comments or replies."),
        (0, import_i18n138.__)("Existing comments remain visible.")
      ].join(" ")
    }
  ];
  function PostComments() {
    const commentStatus = (0, import_data113.useSelect)(
      (select5) => select5(store).getEditedPostAttribute("comment_status") ?? "open",
      []
    );
    const { editPost: editPost2 } = (0, import_data113.useDispatch)(store);
    const handleStatus = (newCommentStatus) => editPost2({
      comment_status: newCommentStatus
    });
    return /* @__PURE__ */ (0, import_jsx_runtime240.jsx)("form", { children: /* @__PURE__ */ (0, import_jsx_runtime240.jsx)(import_components129.__experimentalVStack, { spacing: 4, children: /* @__PURE__ */ (0, import_jsx_runtime240.jsx)(
      import_components129.RadioControl,
      {
        className: "editor-change-status__options",
        hideLabelFromVision: true,
        label: (0, import_i18n138.__)("Comment status"),
        options: COMMENT_OPTIONS,
        onChange: handleStatus,
        selected: commentStatus
      }
    ) }) });
  }
  var post_comments_default = PostComments;

  // packages/editor/build-module/components/post-discussion/panel.mjs
  var import_i18n140 = __toESM(require_i18n(), 1);
  var import_components131 = __toESM(require_components(), 1);
  var import_data115 = __toESM(require_data(), 1);
  var import_element103 = __toESM(require_element(), 1);
  var import_block_editor51 = __toESM(require_block_editor(), 1);
  var import_core_data73 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/post-pingbacks/index.mjs
  var import_i18n139 = __toESM(require_i18n(), 1);
  var import_components130 = __toESM(require_components(), 1);
  var import_data114 = __toESM(require_data(), 1);
  var import_jsx_runtime241 = __toESM(require_jsx_runtime(), 1);
  function PostPingbacks() {
    const pingStatus = (0, import_data114.useSelect)(
      (select5) => select5(store).getEditedPostAttribute("ping_status") ?? "open",
      []
    );
    const { editPost: editPost2 } = (0, import_data114.useDispatch)(store);
    const onTogglePingback = () => editPost2({
      ping_status: pingStatus === "open" ? "closed" : "open"
    });
    return /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(
      import_components130.CheckboxControl,
      {
        label: (0, import_i18n139.__)("Enable pingbacks & trackbacks"),
        checked: pingStatus === "open",
        onChange: onTogglePingback,
        help: /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(
          import_components130.ExternalLink,
          {
            href: (0, import_i18n139.__)(
              "https://wordpress.org/documentation/article/trackbacks-and-pingbacks/"
            ),
            children: (0, import_i18n139.__)("Learn more about pingbacks & trackbacks")
          }
        )
      }
    );
  }
  var post_pingbacks_default = PostPingbacks;

  // packages/editor/build-module/components/post-discussion/panel.mjs
  var import_jsx_runtime242 = __toESM(require_jsx_runtime(), 1);
  var PANEL_NAME2 = "discussion-panel";
  function ModalContents({ onClose }) {
    return /* @__PURE__ */ (0, import_jsx_runtime242.jsxs)("div", { className: "editor-post-discussion", children: [
      /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
        import_block_editor51.__experimentalInspectorPopoverHeader,
        {
          title: (0, import_i18n140.__)("Discussion"),
          onClose
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime242.jsxs)(import_components131.__experimentalVStack, { spacing: 4, children: [
        /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(post_type_support_check_default, { supportKeys: "comments", children: /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(post_comments_default, {}) }),
        /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(post_type_support_check_default, { supportKeys: "trackbacks", children: /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(post_pingbacks_default, {}) })
      ] })
    ] });
  }
  function PostDiscussionToggle({ isOpen, onClick }) {
    const {
      commentStatus,
      pingStatus,
      commentsSupported,
      trackbacksSupported
    } = (0, import_data115.useSelect)((select5) => {
      const { getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
      const { getPostType } = select5(import_core_data73.store);
      const postType2 = getPostType(getEditedPostAttribute2("type"));
      return {
        commentStatus: getEditedPostAttribute2("comment_status") ?? "open",
        pingStatus: getEditedPostAttribute2("ping_status") ?? "open",
        commentsSupported: !!postType2.supports.comments,
        trackbacksSupported: !!postType2.supports.trackbacks
      };
    }, []);
    let label;
    if (commentStatus === "open") {
      if (pingStatus === "open") {
        label = (0, import_i18n140._x)("Open", 'Adjective: e.g. "Comments are open"');
      } else {
        label = trackbacksSupported ? (0, import_i18n140.__)("Comments only") : (0, import_i18n140._x)("Open", 'Adjective: e.g. "Comments are open"');
      }
    } else if (pingStatus === "open") {
      label = commentsSupported ? (0, import_i18n140.__)("Pings only") : (0, import_i18n140.__)("Pings enabled");
    } else {
      label = (0, import_i18n140.__)("Closed");
    }
    return /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
      import_components131.Button,
      {
        size: "compact",
        className: "editor-post-discussion__panel-toggle",
        variant: "tertiary",
        "aria-label": (0, import_i18n140.__)("Change discussion options"),
        "aria-expanded": isOpen,
        onClick,
        children: label
      }
    );
  }
  function PostDiscussionPanel() {
    const { isEnabled } = (0, import_data115.useSelect)((select5) => {
      const { isEditorPanelEnabled: isEditorPanelEnabled2 } = select5(store);
      return {
        isEnabled: isEditorPanelEnabled2(PANEL_NAME2)
      };
    }, []);
    const [popoverAnchor, setPopoverAnchor] = (0, import_element103.useState)(null);
    const popoverProps = (0, import_element103.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor]
    );
    if (!isEnabled) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(post_type_support_check_default, { supportKeys: ["comments", "trackbacks"], children: /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(post_panel_row_default, { label: (0, import_i18n140.__)("Discussion"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
      import_components131.Dropdown,
      {
        popoverProps,
        className: "editor-post-discussion__panel-dropdown",
        contentClassName: "editor-post-discussion__panel-dialog",
        focusOnMount: true,
        renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
          PostDiscussionToggle,
          {
            isOpen,
            onClick: onToggle
          }
        ),
        renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(ModalContents, { onClose })
      }
    ) }) });
  }

  // packages/editor/build-module/components/post-excerpt/index.mjs
  var import_i18n141 = __toESM(require_i18n(), 1);
  var import_components132 = __toESM(require_components(), 1);
  var import_data116 = __toESM(require_data(), 1);
  var import_element104 = __toESM(require_element(), 1);
  var import_html_entities19 = __toESM(require_html_entities(), 1);
  var import_jsx_runtime243 = __toESM(require_jsx_runtime(), 1);
  function PostExcerpt({
    hideLabelFromVision = false,
    updateOnBlur = false
  }) {
    const { excerpt, shouldUseDescriptionLabel, usedAttribute } = (0, import_data116.useSelect)(
      (select5) => {
        const { getCurrentPostType: getCurrentPostType2, getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
        const postType2 = getCurrentPostType2();
        const _usedAttribute = [
          "wp_template",
          "wp_template_part"
        ].includes(postType2) ? "description" : "excerpt";
        return {
          excerpt: getEditedPostAttribute2(_usedAttribute),
          // There are special cases where we want to label the excerpt as a description.
          shouldUseDescriptionLabel: [
            "wp_template",
            "wp_template_part",
            "wp_block"
          ].includes(postType2),
          usedAttribute: _usedAttribute
        };
      },
      []
    );
    const { editPost: editPost2 } = (0, import_data116.useDispatch)(store);
    const [localExcerpt, setLocalExcerpt] = (0, import_element104.useState)(
      (0, import_html_entities19.decodeEntities)(excerpt)
    );
    const updatePost2 = (value) => {
      editPost2({ [usedAttribute]: value });
    };
    const label = shouldUseDescriptionLabel ? (0, import_i18n141.__)("Write a description (optional)") : (0, import_i18n141.__)("Write an excerpt (optional)");
    return /* @__PURE__ */ (0, import_jsx_runtime243.jsx)("div", { className: "editor-post-excerpt", children: /* @__PURE__ */ (0, import_jsx_runtime243.jsx)(
      import_components132.TextareaControl,
      {
        label,
        hideLabelFromVision,
        className: "editor-post-excerpt__textarea",
        onChange: updateOnBlur ? setLocalExcerpt : updatePost2,
        onBlur: updateOnBlur ? () => updatePost2(localExcerpt) : void 0,
        value: updateOnBlur ? localExcerpt : excerpt,
        help: !shouldUseDescriptionLabel ? /* @__PURE__ */ (0, import_jsx_runtime243.jsx)(
          import_components132.ExternalLink,
          {
            href: (0, import_i18n141.__)(
              "https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt"
            ),
            children: (0, import_i18n141.__)("Learn more about manual excerpts")
          }
        ) : (0, import_i18n141.__)("Write a description")
      }
    ) });
  }

  // packages/editor/build-module/components/post-excerpt/check.mjs
  var import_jsx_runtime244 = __toESM(require_jsx_runtime(), 1);
  function PostExcerptCheck({ children }) {
    return /* @__PURE__ */ (0, import_jsx_runtime244.jsx)(post_type_support_check_default, { supportKeys: "excerpt", children });
  }
  var check_default3 = PostExcerptCheck;

  // packages/editor/build-module/components/post-excerpt/panel.mjs
  var import_i18n142 = __toESM(require_i18n(), 1);
  var import_components134 = __toESM(require_components(), 1);
  var import_data117 = __toESM(require_data(), 1);
  var import_element105 = __toESM(require_element(), 1);
  var import_block_editor52 = __toESM(require_block_editor(), 1);
  var import_core_data74 = __toESM(require_core_data(), 1);
  var import_html_entities20 = __toESM(require_html_entities(), 1);

  // packages/editor/build-module/components/post-excerpt/plugin.mjs
  var import_components133 = __toESM(require_components(), 1);
  var import_jsx_runtime245 = __toESM(require_jsx_runtime(), 1);
  var { Fill: Fill9, Slot: Slot9 } = (0, import_components133.createSlotFill)("PluginPostExcerpt");
  var PluginPostExcerpt = ({ children, className }) => {
    return /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(Fill9, { children: /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(import_components133.PanelRow, { className, children }) });
  };
  PluginPostExcerpt.Slot = Slot9;
  var plugin_default = PluginPostExcerpt;

  // packages/editor/build-module/components/post-excerpt/panel.mjs
  var import_jsx_runtime246 = __toESM(require_jsx_runtime(), 1);
  var PANEL_NAME3 = "post-excerpt";
  function ExcerptPanel() {
    const { isOpened, isEnabled, postType: postType2 } = (0, import_data117.useSelect)((select5) => {
      const {
        isEditorPanelOpened: isEditorPanelOpened2,
        isEditorPanelEnabled: isEditorPanelEnabled2,
        getCurrentPostType: getCurrentPostType2
      } = select5(store);
      return {
        isOpened: isEditorPanelOpened2(PANEL_NAME3),
        isEnabled: isEditorPanelEnabled2(PANEL_NAME3),
        postType: getCurrentPostType2()
      };
    }, []);
    const { toggleEditorPanelOpened: toggleEditorPanelOpened2 } = (0, import_data117.useDispatch)(store);
    const toggleExcerptPanel = () => toggleEditorPanelOpened2(PANEL_NAME3);
    if (!isEnabled) {
      return null;
    }
    const shouldUseDescriptionLabel = [
      "wp_template",
      "wp_template_part",
      "wp_block"
    ].includes(postType2);
    return /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(
      import_components134.PanelBody,
      {
        title: shouldUseDescriptionLabel ? (0, import_i18n142.__)("Description") : (0, import_i18n142.__)("Excerpt"),
        opened: isOpened,
        onToggle: toggleExcerptPanel,
        children: /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(plugin_default.Slot, { children: (fills) => /* @__PURE__ */ (0, import_jsx_runtime246.jsxs)(import_jsx_runtime246.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(PostExcerpt, {}),
          fills
        ] }) })
      }
    );
  }
  function PostExcerptPanel() {
    return /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(check_default3, { children: /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(ExcerptPanel, {}) });
  }
  function PrivatePostExcerptPanel() {
    return /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(check_default3, { children: /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(PrivateExcerpt, {}) });
  }
  function PrivateExcerpt() {
    const { shouldRender, excerpt, shouldBeUsedAsDescription, allowEditing } = (0, import_data117.useSelect)((select5) => {
      const {
        getCurrentPostType: getCurrentPostType2,
        getCurrentPostId: getCurrentPostId2,
        getEditedPostAttribute: getEditedPostAttribute2,
        isEditorPanelEnabled: isEditorPanelEnabled2
      } = select5(store);
      const postType2 = getCurrentPostType2();
      const isTemplateOrTemplatePart2 = [
        "wp_template",
        "wp_template_part"
      ].includes(postType2);
      const isPattern = postType2 === "wp_block";
      const _shouldBeUsedAsDescription = isTemplateOrTemplatePart2 || isPattern;
      const _usedAttribute = isTemplateOrTemplatePart2 ? "description" : "excerpt";
      const _excerpt = getEditedPostAttribute2(_usedAttribute);
      const template2 = isTemplateOrTemplatePart2 && select5(import_core_data74.store).getEntityRecord(
        "postType",
        postType2,
        getCurrentPostId2()
      );
      const fallback = !_excerpt && isTemplateOrTemplatePart2 ? getTemplateInfo({
        template: template2,
        templateTypes: select5(import_core_data74.store).getCurrentTheme()?.default_template_types
      })?.description : void 0;
      const _shouldRender = isEditorPanelEnabled2(PANEL_NAME3) || _shouldBeUsedAsDescription;
      return {
        excerpt: _excerpt ?? fallback,
        shouldRender: _shouldRender,
        shouldBeUsedAsDescription: _shouldBeUsedAsDescription,
        // If we should render, allow editing for all post types that are not used as description.
        // For the rest allow editing only for user generated entities.
        allowEditing: _shouldRender && (!_shouldBeUsedAsDescription || isPattern || template2 && template2.source === TEMPLATE_ORIGINS.custom && !template2.has_theme_file && template2.is_custom)
      };
    }, []);
    const [popoverAnchor, setPopoverAnchor] = (0, import_element105.useState)(null);
    const label = shouldBeUsedAsDescription ? (0, import_i18n142.__)("Description") : (0, import_i18n142.__)("Excerpt");
    const popoverProps = (0, import_element105.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        "aria-label": label,
        headerTitle: label,
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor, label]
    );
    if (!shouldRender) {
      return false;
    }
    const excerptText = !!excerpt && /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(import_components134.__experimentalText, { align: "left", numberOfLines: 4, truncate: allowEditing, children: (0, import_html_entities20.decodeEntities)(excerpt) });
    if (!allowEditing) {
      return excerptText;
    }
    const excerptPlaceholder = shouldBeUsedAsDescription ? (0, import_i18n142.__)("Add a description\u2026") : (0, import_i18n142.__)("Add an excerpt\u2026");
    const triggerEditLabel = shouldBeUsedAsDescription ? (0, import_i18n142.__)("Edit description") : (0, import_i18n142.__)("Edit excerpt");
    return /* @__PURE__ */ (0, import_jsx_runtime246.jsxs)(import_components134.__experimentalVStack, { children: [
      excerptText,
      /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(
        import_components134.Dropdown,
        {
          className: "editor-post-excerpt__dropdown",
          contentClassName: "editor-post-excerpt__dropdown__content",
          popoverProps,
          focusOnMount: true,
          ref: setPopoverAnchor,
          renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(
            import_components134.Button,
            {
              __next40pxDefaultSize: true,
              onClick: onToggle,
              variant: "link",
              children: excerptText ? triggerEditLabel : excerptPlaceholder
            }
          ),
          renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime246.jsxs)(import_jsx_runtime246.Fragment, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(
              import_block_editor52.__experimentalInspectorPopoverHeader,
              {
                title: label,
                onClose
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(import_components134.__experimentalVStack, { spacing: 4, children: /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(plugin_default.Slot, { children: (fills) => /* @__PURE__ */ (0, import_jsx_runtime246.jsxs)(import_jsx_runtime246.Fragment, { children: [
              /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(
                PostExcerpt,
                {
                  hideLabelFromVision: true,
                  updateOnBlur: true
                }
              ),
              fills
            ] }) }) })
          ] })
        }
      )
    ] });
  }

  // packages/editor/build-module/components/post-featured-image/index.mjs
  var import_i18n143 = __toESM(require_i18n(), 1);
  var import_hooks44 = __toESM(require_hooks(), 1);
  var import_components135 = __toESM(require_components(), 1);
  var import_blob3 = __toESM(require_blob(), 1);
  var import_element106 = __toESM(require_element(), 1);
  var import_compose26 = __toESM(require_compose(), 1);
  var import_data119 = __toESM(require_data(), 1);
  var import_block_editor53 = __toESM(require_block_editor(), 1);
  var import_core_data76 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/theme-support-check/index.mjs
  var import_data118 = __toESM(require_data(), 1);
  var import_core_data75 = __toESM(require_core_data(), 1);
  function ThemeSupportCheck({ children, supportKeys }) {
    const { postType: postType2, themeSupports } = (0, import_data118.useSelect)((select5) => {
      return {
        postType: select5(store).getEditedPostAttribute("type"),
        themeSupports: select5(import_core_data75.store).getThemeSupports()
      };
    }, []);
    const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some((key) => {
      const supported = themeSupports?.[key] ?? false;
      if ("post-thumbnails" === key && Array.isArray(supported)) {
        return supported.includes(postType2);
      }
      return supported;
    });
    if (!isSupported) {
      return null;
    }
    return children;
  }

  // packages/editor/build-module/components/post-featured-image/check.mjs
  var import_jsx_runtime247 = __toESM(require_jsx_runtime(), 1);
  function PostFeaturedImageCheck({ children }) {
    return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(ThemeSupportCheck, { supportKeys: "post-thumbnails", children: /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(post_type_support_check_default, { supportKeys: "thumbnail", children }) });
  }
  var check_default4 = PostFeaturedImageCheck;

  // packages/editor/build-module/components/post-featured-image/index.mjs
  var import_jsx_runtime248 = __toESM(require_jsx_runtime(), 1);
  var ALLOWED_MEDIA_TYPES = ["image"];
  var DEFAULT_FEATURE_IMAGE_LABEL = (0, import_i18n143.__)("Featured image");
  var DEFAULT_SET_FEATURE_IMAGE_LABEL = (0, import_i18n143.__)("Add a featured image");
  var instructions = /* @__PURE__ */ (0, import_jsx_runtime248.jsx)("p", { children: (0, import_i18n143.__)(
    "To edit the featured image, you need permission to upload media."
  ) });
  function getMediaDetails(media, postId2) {
    if (!media) {
      return {};
    }
    const defaultSize = (0, import_hooks44.applyFilters)(
      "editor.PostFeaturedImage.imageSize",
      "large",
      media.id,
      postId2
    );
    if (defaultSize in (media?.media_details?.sizes ?? {})) {
      return {
        mediaWidth: media.media_details.sizes[defaultSize].width,
        mediaHeight: media.media_details.sizes[defaultSize].height,
        mediaSourceUrl: media.media_details.sizes[defaultSize].source_url
      };
    }
    const fallbackSize = (0, import_hooks44.applyFilters)(
      "editor.PostFeaturedImage.imageSize",
      "thumbnail",
      media.id,
      postId2
    );
    if (fallbackSize in (media?.media_details?.sizes ?? {})) {
      return {
        mediaWidth: media.media_details.sizes[fallbackSize].width,
        mediaHeight: media.media_details.sizes[fallbackSize].height,
        mediaSourceUrl: media.media_details.sizes[fallbackSize].source_url
      };
    }
    return {
      mediaWidth: media.media_details.width,
      mediaHeight: media.media_details.height,
      mediaSourceUrl: media.source_url
    };
  }
  function PostFeaturedImage({
    currentPostId,
    featuredImageId,
    onUpdateImage,
    onRemoveImage,
    media,
    postType: postType2,
    noticeUI,
    noticeOperations,
    isRequestingFeaturedImageMedia
  }) {
    const returnsFocusRef = (0, import_element106.useRef)(false);
    const [isLoading, setIsLoading] = (0, import_element106.useState)(false);
    const { getSettings: getSettings5 } = (0, import_data119.useSelect)(import_block_editor53.store);
    const { mediaSourceUrl } = getMediaDetails(media, currentPostId);
    function onDropFiles(filesList) {
      getSettings5().mediaUpload({
        allowedTypes: ALLOWED_MEDIA_TYPES,
        filesList,
        onFileChange([image]) {
          if ((0, import_blob3.isBlobURL)(image?.url)) {
            setIsLoading(true);
            return;
          }
          if (image) {
            onUpdateImage(image);
          }
          setIsLoading(false);
        },
        onError(message) {
          noticeOperations.removeAllNotices();
          noticeOperations.createErrorNotice(message);
        },
        multiple: false
      });
    }
    function getImageDescription(imageMedia) {
      if (imageMedia.alt_text) {
        return (0, import_i18n143.sprintf)(
          // Translators: %s: The selected image alt text.
          (0, import_i18n143.__)("Current image: %s"),
          imageMedia.alt_text
        );
      }
      return (0, import_i18n143.sprintf)(
        // Translators: %s: The selected image filename.
        (0, import_i18n143.__)(
          "The current image has no alternative text. The file name is: %s"
        ),
        imageMedia.media_details.sizes?.full?.file || imageMedia.slug
      );
    }
    function returnFocus(node) {
      if (returnsFocusRef.current && node) {
        node.focus();
        returnsFocusRef.current = false;
      }
    }
    const isMissingMedia = !isRequestingFeaturedImageMedia && !!featuredImageId && !media;
    return /* @__PURE__ */ (0, import_jsx_runtime248.jsxs)(check_default4, { children: [
      noticeUI,
      /* @__PURE__ */ (0, import_jsx_runtime248.jsxs)("div", { className: "editor-post-featured-image", children: [
        media && /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(
          "div",
          {
            id: `editor-post-featured-image-${featuredImageId}-describedby`,
            className: "hidden",
            children: getImageDescription(media)
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(import_block_editor53.MediaUploadCheck, { fallback: instructions, children: /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(
          import_block_editor53.MediaUpload,
          {
            title: postType2?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
            onSelect: onUpdateImage,
            unstableFeaturedImageFlow: true,
            allowedTypes: ALLOWED_MEDIA_TYPES,
            modalClass: "editor-post-featured-image__media-modal",
            render: ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime248.jsxs)("div", { className: "editor-post-featured-image__container", children: [
              isMissingMedia ? /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(
                import_components135.Notice,
                {
                  status: "warning",
                  isDismissible: false,
                  children: (0, import_i18n143.__)(
                    "Could not retrieve the featured image data."
                  )
                }
              ) : /* @__PURE__ */ (0, import_jsx_runtime248.jsxs)(
                import_components135.Button,
                {
                  __next40pxDefaultSize: true,
                  ref: returnFocus,
                  className: !featuredImageId ? "editor-post-featured-image__toggle" : "editor-post-featured-image__preview",
                  onClick: open,
                  "aria-label": !featuredImageId ? null : (0, import_i18n143.__)(
                    "Edit or replace the featured image"
                  ),
                  "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`,
                  "aria-haspopup": "dialog",
                  disabled: isLoading,
                  accessibleWhenDisabled: true,
                  children: [
                    !!featuredImageId && media && /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(
                      "img",
                      {
                        className: "editor-post-featured-image__preview-image",
                        src: mediaSourceUrl,
                        alt: getImageDescription(
                          media
                        )
                      }
                    ),
                    (isLoading || isRequestingFeaturedImageMedia) && /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(import_components135.Spinner, {}),
                    !featuredImageId && !isLoading && (postType2?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)
                  ]
                }
              ),
              !!featuredImageId && /* @__PURE__ */ (0, import_jsx_runtime248.jsxs)(
                import_components135.__experimentalHStack,
                {
                  className: clsx_default(
                    "editor-post-featured-image__actions",
                    {
                      "editor-post-featured-image__actions-missing-image": isMissingMedia,
                      "editor-post-featured-image__actions-is-requesting-image": isRequestingFeaturedImageMedia
                    }
                  ),
                  children: [
                    /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(
                      import_components135.Button,
                      {
                        __next40pxDefaultSize: true,
                        className: "editor-post-featured-image__action",
                        onClick: open,
                        "aria-haspopup": "dialog",
                        variant: isMissingMedia ? "secondary" : void 0,
                        children: (0, import_i18n143.__)("Replace")
                      }
                    ),
                    /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(
                      import_components135.Button,
                      {
                        __next40pxDefaultSize: true,
                        className: "editor-post-featured-image__action",
                        onClick: () => {
                          onRemoveImage();
                          returnsFocusRef.current = true;
                        },
                        variant: isMissingMedia ? "secondary" : void 0,
                        isDestructive: isMissingMedia,
                        children: (0, import_i18n143.__)("Remove")
                      }
                    )
                  ]
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(import_components135.DropZone, { onFilesDrop: onDropFiles })
            ] }),
            value: featuredImageId
          }
        ) })
      ] })
    ] });
  }
  var applyWithSelect = (0, import_data119.withSelect)((select5) => {
    const { getEntityRecord, getPostType, hasFinishedResolution } = select5(import_core_data76.store);
    const { getCurrentPostId: getCurrentPostId2, getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
    const featuredImageId = getEditedPostAttribute2("featured_media");
    return {
      media: featuredImageId ? getEntityRecord("postType", "attachment", featuredImageId, {
        context: "view"
      }) : null,
      currentPostId: getCurrentPostId2(),
      postType: getPostType(getEditedPostAttribute2("type")),
      featuredImageId,
      isRequestingFeaturedImageMedia: !!featuredImageId && !hasFinishedResolution("getEntityRecord", [
        "postType",
        "attachment",
        featuredImageId,
        { context: "view" }
      ])
    };
  });
  var applyWithDispatch = (0, import_data119.withDispatch)(
    (dispatch6, { noticeOperations }, { select: select5 }) => {
      const { editPost: editPost2 } = dispatch6(store);
      return {
        onUpdateImage(image) {
          editPost2({ featured_media: image.id });
        },
        onDropImage(filesList) {
          select5(import_block_editor53.store).getSettings().mediaUpload({
            allowedTypes: ["image"],
            filesList,
            onFileChange([image]) {
              editPost2({ featured_media: image.id });
            },
            onError(message) {
              noticeOperations.removeAllNotices();
              noticeOperations.createErrorNotice(message);
            },
            multiple: false
          });
        },
        onRemoveImage() {
          editPost2({ featured_media: 0 });
        }
      };
    }
  );
  var post_featured_image_default = (0, import_compose26.compose)(
    import_components135.withNotices,
    applyWithSelect,
    applyWithDispatch,
    (0, import_components135.withFilters)("editor.PostFeaturedImage")
  )(PostFeaturedImage);

  // packages/editor/build-module/components/post-featured-image/panel.mjs
  var import_i18n144 = __toESM(require_i18n(), 1);
  var import_components136 = __toESM(require_components(), 1);
  var import_data120 = __toESM(require_data(), 1);
  var import_core_data77 = __toESM(require_core_data(), 1);
  var import_jsx_runtime249 = __toESM(require_jsx_runtime(), 1);
  var PANEL_NAME4 = "featured-image";
  function PostFeaturedImagePanel({ withPanelBody = true }) {
    const { postType: postType2, isEnabled, isOpened } = (0, import_data120.useSelect)((select5) => {
      const {
        getEditedPostAttribute: getEditedPostAttribute2,
        isEditorPanelEnabled: isEditorPanelEnabled2,
        isEditorPanelOpened: isEditorPanelOpened2
      } = select5(store);
      const { getPostType } = select5(import_core_data77.store);
      return {
        postType: getPostType(getEditedPostAttribute2("type")),
        isEnabled: isEditorPanelEnabled2(PANEL_NAME4),
        isOpened: isEditorPanelOpened2(PANEL_NAME4)
      };
    }, []);
    const { toggleEditorPanelOpened: toggleEditorPanelOpened2 } = (0, import_data120.useDispatch)(store);
    if (!isEnabled) {
      return null;
    }
    if (!withPanelBody) {
      return /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(check_default4, { children: /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(post_featured_image_default, {}) });
    }
    return /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(check_default4, { children: /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(
      import_components136.PanelBody,
      {
        title: postType2?.labels?.featured_image ?? (0, import_i18n144.__)("Featured image"),
        opened: isOpened,
        onToggle: () => toggleEditorPanelOpened2(PANEL_NAME4),
        children: /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(post_featured_image_default, {})
      }
    ) });
  }

  // packages/editor/build-module/components/post-format/index.mjs
  var import_i18n145 = __toESM(require_i18n(), 1);
  var import_components137 = __toESM(require_components(), 1);
  var import_data122 = __toESM(require_data(), 1);
  var import_compose27 = __toESM(require_compose(), 1);
  var import_core_data78 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/post-format/check.mjs
  var import_data121 = __toESM(require_data(), 1);
  var import_jsx_runtime250 = __toESM(require_jsx_runtime(), 1);
  function PostFormatCheck({ children }) {
    const disablePostFormats = (0, import_data121.useSelect)(
      (select5) => select5(store).getEditorSettings().disablePostFormats,
      []
    );
    if (disablePostFormats) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime250.jsx)(post_type_support_check_default, { supportKeys: "post-formats", children });
  }

  // packages/editor/build-module/components/post-format/index.mjs
  var import_jsx_runtime251 = __toESM(require_jsx_runtime(), 1);
  var POST_FORMATS = [
    { id: "aside", caption: (0, import_i18n145.__)("Aside") },
    { id: "audio", caption: (0, import_i18n145.__)("Audio") },
    { id: "chat", caption: (0, import_i18n145.__)("Chat") },
    { id: "gallery", caption: (0, import_i18n145.__)("Gallery") },
    { id: "image", caption: (0, import_i18n145.__)("Image") },
    { id: "link", caption: (0, import_i18n145.__)("Link") },
    { id: "quote", caption: (0, import_i18n145.__)("Quote") },
    { id: "standard", caption: (0, import_i18n145.__)("Standard") },
    { id: "status", caption: (0, import_i18n145.__)("Status") },
    { id: "video", caption: (0, import_i18n145.__)("Video") }
  ].sort((a3, b3) => {
    const normalizedA = a3.caption.toUpperCase();
    const normalizedB = b3.caption.toUpperCase();
    if (normalizedA < normalizedB) {
      return -1;
    }
    if (normalizedA > normalizedB) {
      return 1;
    }
    return 0;
  });
  function PostFormat() {
    const instanceId = (0, import_compose27.useInstanceId)(PostFormat);
    const postFormatSelectorId = `post-format-selector-${instanceId}`;
    const { postFormat, suggestedFormat, supportedFormats } = (0, import_data122.useSelect)(
      (select5) => {
        const { getEditedPostAttribute: getEditedPostAttribute2, getSuggestedPostFormat: getSuggestedPostFormat2 } = select5(store);
        const _postFormat = getEditedPostAttribute2("format");
        const themeSupports = select5(import_core_data78.store).getThemeSupports();
        return {
          postFormat: _postFormat ?? "standard",
          suggestedFormat: getSuggestedPostFormat2(),
          supportedFormats: themeSupports.formats
        };
      },
      []
    );
    const formats = POST_FORMATS.filter((format) => {
      return supportedFormats?.includes(format.id) || postFormat === format.id;
    });
    const suggestion = formats.find(
      (format) => format.id === suggestedFormat
    );
    const { editPost: editPost2 } = (0, import_data122.useDispatch)(store);
    const onUpdatePostFormat = (format) => editPost2({ format });
    return /* @__PURE__ */ (0, import_jsx_runtime251.jsx)(PostFormatCheck, { children: /* @__PURE__ */ (0, import_jsx_runtime251.jsxs)("div", { className: "editor-post-format", children: [
      /* @__PURE__ */ (0, import_jsx_runtime251.jsx)(
        import_components137.RadioControl,
        {
          className: "editor-post-format__options",
          label: (0, import_i18n145.__)("Post Format"),
          selected: postFormat,
          onChange: (format) => onUpdatePostFormat(format),
          id: postFormatSelectorId,
          options: formats.map((format) => ({
            label: format.caption,
            value: format.id
          })),
          hideLabelFromVision: true
        }
      ),
      suggestion && suggestion.id !== postFormat && /* @__PURE__ */ (0, import_jsx_runtime251.jsx)("p", { className: "editor-post-format__suggestion", children: /* @__PURE__ */ (0, import_jsx_runtime251.jsx)(
        import_components137.Button,
        {
          __next40pxDefaultSize: true,
          variant: "link",
          onClick: () => onUpdatePostFormat(suggestion.id),
          children: (0, import_i18n145.sprintf)(
            /* translators: %s: post format */
            (0, import_i18n145.__)("Apply suggested format: %s"),
            suggestion.caption
          )
        }
      ) })
    ] }) });
  }

  // packages/editor/build-module/components/post-last-revision/index.mjs
  var import_i18n146 = __toESM(require_i18n(), 1);
  var import_components138 = __toESM(require_components(), 1);
  var import_data124 = __toESM(require_data(), 1);
  var import_url11 = __toESM(require_url(), 1);

  // packages/editor/build-module/components/post-last-revision/check.mjs
  var import_data123 = __toESM(require_data(), 1);
  var import_jsx_runtime252 = __toESM(require_jsx_runtime(), 1);
  function PostLastRevisionCheck({ children }) {
    const { lastRevisionId, revisionsCount } = (0, import_data123.useSelect)((select5) => {
      const { getCurrentPostLastRevisionId: getCurrentPostLastRevisionId2, getCurrentPostRevisionsCount: getCurrentPostRevisionsCount2 } = select5(store);
      return {
        lastRevisionId: getCurrentPostLastRevisionId2(),
        revisionsCount: getCurrentPostRevisionsCount2()
      };
    }, []);
    if (!lastRevisionId || revisionsCount < 2) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime252.jsx)(post_type_support_check_default, { supportKeys: "revisions", children });
  }
  var check_default5 = PostLastRevisionCheck;

  // packages/editor/build-module/components/post-last-revision/index.mjs
  var import_jsx_runtime253 = __toESM(require_jsx_runtime(), 1);
  function usePostLastRevisionInfo() {
    return (0, import_data124.useSelect)((select5) => {
      const { getCurrentPostLastRevisionId: getCurrentPostLastRevisionId2, getCurrentPostRevisionsCount: getCurrentPostRevisionsCount2 } = select5(store);
      return {
        lastRevisionId: getCurrentPostLastRevisionId2(),
        revisionsCount: getCurrentPostRevisionsCount2()
      };
    }, []);
  }
  function PostLastRevision() {
    const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();
    return /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(check_default5, { children: /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(
      import_components138.Button,
      {
        __next40pxDefaultSize: true,
        href: (0, import_url11.addQueryArgs)("revision.php", {
          revision: lastRevisionId
        }),
        className: "editor-post-last-revision__title",
        icon: backup_default,
        iconPosition: "right",
        text: (0, import_i18n146.sprintf)(
          /* translators: %s: number of revisions. */
          (0, import_i18n146.__)("Revisions (%s)"),
          revisionsCount
        )
      }
    ) });
  }
  function PrivatePostLastRevision() {
    const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();
    return /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(check_default5, { children: /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(post_panel_row_default, { label: (0, import_i18n146.__)("Revisions"), children: /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(
      import_components138.Button,
      {
        href: (0, import_url11.addQueryArgs)("revision.php", {
          revision: lastRevisionId
        }),
        className: "editor-private-post-last-revision__button",
        text: revisionsCount,
        variant: "tertiary",
        size: "compact"
      }
    ) }) });
  }
  var post_last_revision_default = PostLastRevision;

  // packages/editor/build-module/components/post-last-revision/panel.mjs
  var import_components139 = __toESM(require_components(), 1);
  var import_jsx_runtime254 = __toESM(require_jsx_runtime(), 1);
  function PostLastRevisionPanel() {
    return /* @__PURE__ */ (0, import_jsx_runtime254.jsx)(check_default5, { children: /* @__PURE__ */ (0, import_jsx_runtime254.jsx)(import_components139.PanelBody, { className: "editor-post-last-revision__panel", children: /* @__PURE__ */ (0, import_jsx_runtime254.jsx)(post_last_revision_default, {}) }) });
  }
  var panel_default2 = PostLastRevisionPanel;

  // packages/editor/build-module/components/post-locked-modal/index.mjs
  var import_i18n147 = __toESM(require_i18n(), 1);
  var import_components140 = __toESM(require_components(), 1);
  var import_data125 = __toESM(require_data(), 1);
  var import_url12 = __toESM(require_url(), 1);
  var import_element107 = __toESM(require_element(), 1);
  var import_hooks45 = __toESM(require_hooks(), 1);
  var import_compose28 = __toESM(require_compose(), 1);
  var import_core_data79 = __toESM(require_core_data(), 1);
  var import_jsx_runtime255 = __toESM(require_jsx_runtime(), 1);
  function PostLockedModal() {
    const instanceId = (0, import_compose28.useInstanceId)(PostLockedModal);
    const hookName = "core/editor/post-locked-modal-" + instanceId;
    const { autosave: autosave2, updatePostLock: updatePostLock2 } = (0, import_data125.useDispatch)(store);
    const {
      isLocked,
      isTakeover,
      user,
      postId: postId2,
      postLockUtils,
      activePostLock,
      postType: postType2,
      previewLink,
      supportsSync
    } = (0, import_data125.useSelect)((select5) => {
      const {
        isPostLocked: isPostLocked2,
        isPostLockTakeover: isPostLockTakeover2,
        getPostLockUser: getPostLockUser2,
        getCurrentPostId: getCurrentPostId2,
        getCurrentPostType: getCurrentPostType2,
        getActivePostLock: getActivePostLock2,
        getEditedPostAttribute: getEditedPostAttribute2,
        getEditedPostPreviewLink: getEditedPostPreviewLink2,
        getEditorSettings: getEditorSettings2
      } = select5(store);
      const { getPostType, getEntityConfig } = select5(import_core_data79.store);
      const currentPostType = getCurrentPostType2();
      return {
        isLocked: isPostLocked2(),
        isTakeover: isPostLockTakeover2(),
        user: getPostLockUser2(),
        postId: getCurrentPostId2(),
        postLockUtils: getEditorSettings2().postLockUtils,
        activePostLock: getActivePostLock2(),
        postType: getPostType(getEditedPostAttribute2("type")),
        previewLink: getEditedPostPreviewLink2(),
        supportsSync: Boolean(
          getEntityConfig("postType", currentPostType)?.syncConfig
        )
      };
    }, []);
    (0, import_element107.useEffect)(() => {
      function sendPostLock(data) {
        if (isLocked) {
          return;
        }
        data["wp-refresh-post-lock"] = {
          lock: activePostLock,
          post_id: postId2
        };
      }
      function receivePostLock(data) {
        if (!data["wp-refresh-post-lock"]) {
          return;
        }
        const received = data["wp-refresh-post-lock"];
        if (received.lock_error) {
          autosave2();
          updatePostLock2({
            isLocked: true,
            isTakeover: true,
            user: {
              name: received.lock_error.name,
              avatar: received.lock_error.avatar_src_2x
            }
          });
        } else if (received.new_lock) {
          updatePostLock2({
            isLocked: false,
            activePostLock: received.new_lock
          });
        }
      }
      function releasePostLock() {
        if (isLocked || !activePostLock) {
          return;
        }
        const data = new window.FormData();
        data.append("action", "wp-remove-post-lock");
        data.append("_wpnonce", postLockUtils.unlockNonce);
        data.append("post_ID", postId2);
        data.append("active_post_lock", activePostLock);
        if (window.navigator.sendBeacon) {
          window.navigator.sendBeacon(postLockUtils.ajaxUrl, data);
        } else {
          const xhr = new window.XMLHttpRequest();
          xhr.open("POST", postLockUtils.ajaxUrl, false);
          xhr.send(data);
        }
      }
      (0, import_hooks45.addAction)("heartbeat.send", hookName, sendPostLock);
      (0, import_hooks45.addAction)("heartbeat.tick", hookName, receivePostLock);
      window.addEventListener("beforeunload", releasePostLock);
      return () => {
        (0, import_hooks45.removeAction)("heartbeat.send", hookName);
        (0, import_hooks45.removeAction)("heartbeat.tick", hookName);
        window.removeEventListener("beforeunload", releasePostLock);
      };
    }, []);
    if (!isLocked) {
      return null;
    }
    if (supportsSync) {
      if (true) {
        return null;
      }
    }
    const userDisplayName = user.name;
    const userAvatar = user.avatar;
    const unlockUrl = (0, import_url12.addQueryArgs)("post.php", {
      "get-post-lock": "1",
      lockKey: true,
      post: postId2,
      action: "edit",
      _wpnonce: postLockUtils.nonce
    });
    const allPostsUrl = (0, import_url12.addQueryArgs)("edit.php", {
      post_type: postType2?.slug
    });
    const allPostsLabel = (0, import_i18n147.__)("Exit editor");
    return /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
      import_components140.Modal,
      {
        title: isTakeover ? (0, import_i18n147.__)("Someone else has taken over this post") : (0, import_i18n147.__)("This post is already being edited"),
        focusOnMount: true,
        shouldCloseOnClickOutside: false,
        shouldCloseOnEsc: false,
        isDismissible: false,
        className: "editor-post-locked-modal",
        size: "medium",
        children: /* @__PURE__ */ (0, import_jsx_runtime255.jsxs)(import_components140.__experimentalHStack, { alignment: "top", spacing: 6, children: [
          !!userAvatar && /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
            "img",
            {
              src: userAvatar,
              alt: (0, import_i18n147.__)("Avatar"),
              className: "editor-post-locked-modal__avatar",
              width: 64,
              height: 64
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime255.jsxs)("div", { children: [
            !!isTakeover && /* @__PURE__ */ (0, import_jsx_runtime255.jsx)("p", { children: (0, import_element107.createInterpolateElement)(
              userDisplayName ? (0, import_i18n147.sprintf)(
                /* translators: %s: user's display name */
                (0, import_i18n147.__)(
                  "<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don\u2019t worry, your changes up to this moment have been saved."
                ),
                userDisplayName
              ) : (0, import_i18n147.__)(
                "Another user now has editing control of this post (<PreviewLink />). Don\u2019t worry, your changes up to this moment have been saved."
              ),
              {
                strong: /* @__PURE__ */ (0, import_jsx_runtime255.jsx)("strong", {}),
                PreviewLink: /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(import_components140.ExternalLink, { href: previewLink, children: (0, import_i18n147.__)("preview") })
              }
            ) }),
            !isTakeover && /* @__PURE__ */ (0, import_jsx_runtime255.jsxs)(import_jsx_runtime255.Fragment, { children: [
              /* @__PURE__ */ (0, import_jsx_runtime255.jsx)("p", { children: (0, import_element107.createInterpolateElement)(
                userDisplayName ? (0, import_i18n147.sprintf)(
                  /* translators: %s: user's display name */
                  (0, import_i18n147.__)(
                    "<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over."
                  ),
                  userDisplayName
                ) : (0, import_i18n147.__)(
                  "Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over."
                ),
                {
                  strong: /* @__PURE__ */ (0, import_jsx_runtime255.jsx)("strong", {}),
                  PreviewLink: /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(import_components140.ExternalLink, { href: previewLink, children: (0, import_i18n147.__)("preview") })
                }
              ) }),
              /* @__PURE__ */ (0, import_jsx_runtime255.jsx)("p", { children: (0, import_i18n147.__)(
                "If you take over, the other user will lose editing control to the post, but their changes will be saved."
              ) })
            ] }),
            /* @__PURE__ */ (0, import_jsx_runtime255.jsxs)(
              import_components140.__experimentalHStack,
              {
                className: "editor-post-locked-modal__buttons",
                justify: "flex-end",
                children: [
                  !isTakeover && /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
                    import_components140.Button,
                    {
                      __next40pxDefaultSize: true,
                      variant: "tertiary",
                      href: unlockUrl,
                      children: (0, import_i18n147.__)("Take over")
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
                    import_components140.Button,
                    {
                      __next40pxDefaultSize: true,
                      variant: "primary",
                      href: allPostsUrl,
                      children: allPostsLabel
                    }
                  )
                ]
              }
            )
          ] })
        ] })
      }
    );
  }
  var post_locked_modal_default = true ? (0, import_components140.withFilters)("editor.PostLockedModal")(PostLockedModal) : PostLockedModal;

  // packages/editor/build-module/components/post-pending-status/index.mjs
  var import_i18n148 = __toESM(require_i18n(), 1);
  var import_components141 = __toESM(require_components(), 1);
  var import_data127 = __toESM(require_data(), 1);

  // packages/editor/build-module/components/post-pending-status/check.mjs
  var import_data126 = __toESM(require_data(), 1);
  function PostPendingStatusCheck({ children }) {
    const { hasPublishAction, isPublished } = (0, import_data126.useSelect)((select5) => {
      const { isCurrentPostPublished: isCurrentPostPublished2, getCurrentPost: getCurrentPost2 } = select5(store);
      return {
        hasPublishAction: getCurrentPost2()._links?.["wp:action-publish"] ?? false,
        isPublished: isCurrentPostPublished2()
      };
    }, []);
    if (isPublished || !hasPublishAction) {
      return null;
    }
    return children;
  }
  var check_default6 = PostPendingStatusCheck;

  // packages/editor/build-module/components/post-pending-status/index.mjs
  var import_jsx_runtime256 = __toESM(require_jsx_runtime(), 1);
  function PostPendingStatus() {
    const status = (0, import_data127.useSelect)(
      (select5) => select5(store).getEditedPostAttribute("status"),
      []
    );
    const { editPost: editPost2 } = (0, import_data127.useDispatch)(store);
    const togglePendingStatus = () => {
      const updatedStatus = status === "pending" ? "draft" : "pending";
      editPost2({ status: updatedStatus });
    };
    return /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(check_default6, { children: /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(
      import_components141.CheckboxControl,
      {
        label: (0, import_i18n148.__)("Pending review"),
        checked: status === "pending",
        onChange: togglePendingStatus
      }
    ) });
  }
  var post_pending_status_default = PostPendingStatus;

  // packages/editor/build-module/components/post-preview-button/index.mjs
  var import_element108 = __toESM(require_element(), 1);
  var import_components142 = __toESM(require_components(), 1);
  var import_i18n149 = __toESM(require_i18n(), 1);
  var import_data128 = __toESM(require_data(), 1);
  var import_hooks46 = __toESM(require_hooks(), 1);
  var import_core_data80 = __toESM(require_core_data(), 1);
  var import_jsx_runtime257 = __toESM(require_jsx_runtime(), 1);
  function writeInterstitialMessage(targetDocument) {
    let markup = (0, import_element108.renderToString)(
      /* @__PURE__ */ (0, import_jsx_runtime257.jsxs)("div", { className: "editor-post-preview-button__interstitial-message", children: [
        /* @__PURE__ */ (0, import_jsx_runtime257.jsxs)(import_components142.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 96 96", children: [
          /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(
            import_components142.Path,
            {
              className: "outer",
              d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",
              fill: "none"
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(
            import_components142.Path,
            {
              className: "inner",
              d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",
              fill: "none"
            }
          )
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime257.jsx)("p", { children: (0, import_i18n149.__)("Generating preview\u2026") })
      ] })
    );
    markup += `
		<style>
			body {
				margin: 0;
			}
			.editor-post-preview-button__interstitial-message {
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				height: 100vh;
				width: 100vw;
			}
			@-webkit-keyframes paint {
				0% {
					stroke-dashoffset: 0;
				}
			}
			@-moz-keyframes paint {
				0% {
					stroke-dashoffset: 0;
				}
			}
			@-o-keyframes paint {
				0% {
					stroke-dashoffset: 0;
				}
			}
			@keyframes paint {
				0% {
					stroke-dashoffset: 0;
				}
			}
			.editor-post-preview-button__interstitial-message svg {
				width: 192px;
				height: 192px;
				stroke: #555d66;
				stroke-width: 0.75;
			}
			.editor-post-preview-button__interstitial-message svg .outer,
			.editor-post-preview-button__interstitial-message svg .inner {
				stroke-dasharray: 280;
				stroke-dashoffset: 280;
				-webkit-animation: paint 1.5s ease infinite alternate;
				-moz-animation: paint 1.5s ease infinite alternate;
				-o-animation: paint 1.5s ease infinite alternate;
				animation: paint 1.5s ease infinite alternate;
			}
			p {
				text-align: center;
				font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
			}
		</style>
	`;
    markup = (0, import_hooks46.applyFilters)("editor.PostPreview.interstitialMarkup", markup);
    targetDocument.write(markup);
    targetDocument.title = (0, import_i18n149.__)("Generating preview\u2026");
    targetDocument.close();
  }
  function PostPreviewButton({
    className,
    textContent,
    forceIsAutosaveable,
    role,
    onPreview
  }) {
    const { postId: postId2, currentPostLink, previewLink, isSaveable, isViewable } = (0, import_data128.useSelect)((select5) => {
      const editor = select5(store);
      const core = select5(import_core_data80.store);
      const postType2 = core.getPostType(
        editor.getCurrentPostType("type")
      );
      const canView = postType2?.viewable ?? false;
      if (!canView) {
        return { isViewable: canView };
      }
      return {
        postId: editor.getCurrentPostId(),
        currentPostLink: editor.getCurrentPostAttribute("link"),
        previewLink: editor.getEditedPostPreviewLink(),
        isSaveable: editor.isEditedPostSaveable(),
        isViewable: canView
      };
    }, []);
    const { __unstableSaveForPreview: __unstableSaveForPreview2 } = (0, import_data128.useDispatch)(store);
    if (!isViewable) {
      return null;
    }
    const targetId = `wp-preview-${postId2}`;
    const openPreviewWindow = async (event) => {
      event.preventDefault();
      const previewWindow = window.open("", targetId);
      previewWindow.focus();
      writeInterstitialMessage(previewWindow.document);
      const link = await __unstableSaveForPreview2({ forceIsAutosaveable });
      previewWindow.location = link;
      onPreview?.();
    };
    const href = previewLink || currentPostLink;
    return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(
      import_components142.Button,
      {
        variant: !className ? "tertiary" : void 0,
        className: className || "editor-post-preview",
        href,
        target: targetId,
        accessibleWhenDisabled: true,
        disabled: !isSaveable,
        onClick: openPreviewWindow,
        role,
        size: "compact",
        children: textContent || /* @__PURE__ */ (0, import_jsx_runtime257.jsxs)(import_jsx_runtime257.Fragment, { children: [
          (0, import_i18n149._x)("Preview", "imperative verb"),
          /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(import_components142.VisuallyHidden, {
            as: "span",
            /* translators: accessibility text */
            children: (0, import_i18n149.__)("(opens in a new tab)")
          })
        ] })
      }
    );
  }

  // packages/editor/build-module/components/post-publish-button/index.mjs
  var import_components143 = __toESM(require_components(), 1);
  var import_element109 = __toESM(require_element(), 1);
  var import_data130 = __toESM(require_data(), 1);
  var import_compose30 = __toESM(require_compose(), 1);

  // packages/editor/build-module/components/post-publish-button/label.mjs
  var import_i18n150 = __toESM(require_i18n(), 1);
  var import_data129 = __toESM(require_data(), 1);
  var import_compose29 = __toESM(require_compose(), 1);
  function PublishButtonLabel() {
    const isSmallerThanMediumViewport = (0, import_compose29.useViewportMatch)("medium", "<");
    const {
      isPublished,
      isBeingScheduled,
      isSaving,
      isPublishing,
      hasPublishAction,
      isAutosaving,
      hasNonPostEntityChanges: hasNonPostEntityChanges2,
      postStatusHasChanged,
      postStatus
    } = (0, import_data129.useSelect)((select5) => {
      const {
        isCurrentPostPublished: isCurrentPostPublished2,
        isEditedPostBeingScheduled: isEditedPostBeingScheduled2,
        isSavingPost: isSavingPost2,
        isPublishingPost: isPublishingPost2,
        getCurrentPost: getCurrentPost2,
        getCurrentPostType: getCurrentPostType2,
        isAutosavingPost: isAutosavingPost2,
        getPostEdits: getPostEdits2,
        getEditedPostAttribute: getEditedPostAttribute2
      } = select5(store);
      return {
        isPublished: isCurrentPostPublished2(),
        isBeingScheduled: isEditedPostBeingScheduled2(),
        isSaving: isSavingPost2(),
        isPublishing: isPublishingPost2(),
        hasPublishAction: getCurrentPost2()._links?.["wp:action-publish"] ?? false,
        postType: getCurrentPostType2(),
        isAutosaving: isAutosavingPost2(),
        hasNonPostEntityChanges: select5(store).hasNonPostEntityChanges(),
        postStatusHasChanged: !!getPostEdits2()?.status,
        postStatus: getEditedPostAttribute2("status")
      };
    }, []);
    if (isPublishing) {
      return (0, import_i18n150.__)("Publishing\u2026");
    } else if ((isPublished || isBeingScheduled) && isSaving && !isAutosaving) {
      return (0, import_i18n150.__)("Saving\u2026");
    }
    if (!hasPublishAction) {
      return isSmallerThanMediumViewport ? (0, import_i18n150.__)("Publish") : (0, import_i18n150.__)("Submit for Review");
    }
    if (hasNonPostEntityChanges2 || isPublished || postStatusHasChanged && !["future", "publish"].includes(postStatus) || !postStatusHasChanged && postStatus === "future") {
      return (0, import_i18n150.__)("Save");
    }
    if (isBeingScheduled) {
      return (0, import_i18n150.__)("Schedule");
    }
    return (0, import_i18n150.__)("Publish");
  }

  // packages/editor/build-module/components/post-publish-button/index.mjs
  var import_jsx_runtime258 = __toESM(require_jsx_runtime(), 1);
  var noop5 = () => {
  };
  var PostPublishButton = class extends import_element109.Component {
    constructor(props) {
      super(props);
      this.createOnClick = this.createOnClick.bind(this);
      this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this);
      this.state = {
        entitiesSavedStatesCallback: false
      };
    }
    createOnClick(callback) {
      return (...args) => {
        const { hasNonPostEntityChanges: hasNonPostEntityChanges2, setEntitiesSavedStatesCallback } = this.props;
        if (hasNonPostEntityChanges2 && setEntitiesSavedStatesCallback) {
          this.setState({
            entitiesSavedStatesCallback: () => callback(...args)
          });
          setEntitiesSavedStatesCallback(
            () => this.closeEntitiesSavedStates
          );
          return noop5;
        }
        return callback(...args);
      };
    }
    closeEntitiesSavedStates(savedEntities) {
      const { postType: postType2, postId: postId2 } = this.props;
      const { entitiesSavedStatesCallback } = this.state;
      this.setState({ entitiesSavedStatesCallback: false }, () => {
        if (savedEntities && savedEntities.some(
          (elt) => elt.kind === "postType" && elt.name === postType2 && elt.key === postId2
        )) {
          entitiesSavedStatesCallback();
        }
      });
    }
    render() {
      const {
        forceIsDirty,
        hasPublishAction,
        isBeingScheduled,
        isOpen,
        isPostSavingLocked: isPostSavingLocked2,
        isPublishable,
        isPublished,
        isSaveable,
        isSaving,
        isAutoSaving,
        isToggle,
        savePostStatus,
        onSubmit = noop5,
        onToggle,
        visibility,
        hasNonPostEntityChanges: hasNonPostEntityChanges2,
        isSavingNonPostEntityChanges: isSavingNonPostEntityChanges2,
        postStatus,
        postStatusHasChanged
      } = this.props;
      const isButtonDisabled = (isSaving || !isSaveable || isPostSavingLocked2 || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges2 || isSavingNonPostEntityChanges2);
      const isToggleDisabled = (isPublished || isSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges2 || isSavingNonPostEntityChanges2);
      let publishStatus = "publish";
      if (postStatusHasChanged) {
        publishStatus = postStatus;
      } else if (!hasPublishAction) {
        publishStatus = "pending";
      } else if (visibility === "private") {
        publishStatus = "private";
      } else if (isBeingScheduled) {
        publishStatus = "future";
      }
      const onClickButton = () => {
        if (isButtonDisabled) {
          return;
        }
        onSubmit();
        savePostStatus(publishStatus);
      };
      const onClickToggle = () => {
        if (isToggleDisabled) {
          return;
        }
        onToggle();
      };
      const buttonProps = {
        "aria-disabled": isButtonDisabled,
        className: "editor-post-publish-button",
        isBusy: !isAutoSaving && isSaving,
        variant: "primary",
        onClick: this.createOnClick(onClickButton),
        "aria-haspopup": hasNonPostEntityChanges2 ? "dialog" : void 0
      };
      const toggleProps = {
        "aria-disabled": isToggleDisabled,
        "aria-expanded": isOpen,
        className: "editor-post-publish-panel__toggle",
        isBusy: isSaving && isPublished,
        variant: "primary",
        size: "compact",
        onClick: this.createOnClick(onClickToggle),
        "aria-haspopup": hasNonPostEntityChanges2 ? "dialog" : void 0
      };
      const componentProps = isToggle ? toggleProps : buttonProps;
      return /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_jsx_runtime258.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(
        import_components143.Button,
        {
          ...componentProps,
          className: `${componentProps.className} editor-post-publish-button__button`,
          size: "compact",
          children: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(PublishButtonLabel, {})
        }
      ) });
    }
  };
  var post_publish_button_default = (0, import_compose30.compose)([
    (0, import_data130.withSelect)((select5) => {
      const {
        isSavingPost: isSavingPost2,
        isAutosavingPost: isAutosavingPost2,
        isEditedPostBeingScheduled: isEditedPostBeingScheduled2,
        getEditedPostVisibility: getEditedPostVisibility2,
        isCurrentPostPublished: isCurrentPostPublished2,
        isEditedPostSaveable: isEditedPostSaveable2,
        isEditedPostPublishable: isEditedPostPublishable2,
        isPostSavingLocked: isPostSavingLocked2,
        getCurrentPost: getCurrentPost2,
        getCurrentPostType: getCurrentPostType2,
        getCurrentPostId: getCurrentPostId2,
        hasNonPostEntityChanges: hasNonPostEntityChanges2,
        isSavingNonPostEntityChanges: isSavingNonPostEntityChanges2,
        getEditedPostAttribute: getEditedPostAttribute2,
        getPostEdits: getPostEdits2
      } = select5(store);
      return {
        isSaving: isSavingPost2(),
        isAutoSaving: isAutosavingPost2(),
        isBeingScheduled: isEditedPostBeingScheduled2(),
        visibility: getEditedPostVisibility2(),
        isSaveable: isEditedPostSaveable2(),
        isPostSavingLocked: isPostSavingLocked2(),
        isPublishable: isEditedPostPublishable2(),
        isPublished: isCurrentPostPublished2(),
        hasPublishAction: getCurrentPost2()._links?.["wp:action-publish"] ?? false,
        postType: getCurrentPostType2(),
        postId: getCurrentPostId2(),
        postStatus: getEditedPostAttribute2("status"),
        postStatusHasChanged: getPostEdits2()?.status,
        hasNonPostEntityChanges: hasNonPostEntityChanges2(),
        isSavingNonPostEntityChanges: isSavingNonPostEntityChanges2()
      };
    }),
    (0, import_data130.withDispatch)((dispatch6) => {
      const { editPost: editPost2, savePost: savePost2 } = dispatch6(store);
      return {
        savePostStatus: (status) => {
          editPost2({ status }, { undoIgnore: true });
          savePost2();
        }
      };
    })
  ])(PostPublishButton);

  // packages/editor/build-module/components/post-publish-panel/index.mjs
  var import_i18n163 = __toESM(require_i18n(), 1);
  var import_element118 = __toESM(require_element(), 1);
  var import_components154 = __toESM(require_components(), 1);
  var import_data144 = __toESM(require_data(), 1);
  var import_compose35 = __toESM(require_compose(), 1);
  var import_core_data90 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/post-publish-panel/prepublish.mjs
  var import_i18n161 = __toESM(require_i18n(), 1);
  var import_components152 = __toESM(require_components(), 1);
  var import_data142 = __toESM(require_data(), 1);
  var import_url14 = __toESM(require_url(), 1);
  var import_core_data88 = __toESM(require_core_data(), 1);
  var import_html_entities22 = __toESM(require_html_entities(), 1);

  // packages/editor/build-module/components/post-visibility/index.mjs
  var import_i18n152 = __toESM(require_i18n(), 1);
  var import_element110 = __toESM(require_element(), 1);
  var import_components144 = __toESM(require_components(), 1);
  var import_compose31 = __toESM(require_compose(), 1);
  var import_data131 = __toESM(require_data(), 1);
  var import_block_editor54 = __toESM(require_block_editor(), 1);

  // packages/editor/build-module/components/post-visibility/utils.mjs
  var import_i18n151 = __toESM(require_i18n(), 1);
  var VISIBILITY_OPTIONS = [
    {
      label: (0, import_i18n151.__)("Public"),
      value: "public",
      description: (0, import_i18n151.__)("Visible to everyone.")
    },
    {
      label: (0, import_i18n151.__)("Private"),
      value: "private",
      description: (0, import_i18n151.__)("Only visible to site admins and editors.")
    },
    {
      label: (0, import_i18n151.__)("Password protected"),
      value: "password",
      description: (0, import_i18n151.__)("Only visible to those who know the password.")
    }
  ];

  // packages/editor/build-module/components/post-visibility/index.mjs
  var import_jsx_runtime259 = __toESM(require_jsx_runtime(), 1);
  function PostVisibility({ onClose }) {
    const instanceId = (0, import_compose31.useInstanceId)(PostVisibility);
    const { status, visibility, password } = (0, import_data131.useSelect)((select5) => ({
      status: select5(store).getEditedPostAttribute("status"),
      visibility: select5(store).getEditedPostVisibility(),
      password: select5(store).getEditedPostAttribute("password")
    }));
    const { editPost: editPost2 } = (0, import_data131.useDispatch)(store);
    const [hasPassword, setHasPassword] = (0, import_element110.useState)(!!password);
    function updateVisibility(value) {
      const nextValues = {
        public: {
          status: visibility === "private" ? "draft" : status,
          password: ""
        },
        private: { status: "private", password: "" },
        password: {
          status: visibility === "private" ? "draft" : status,
          password: password || ""
        }
      };
      editPost2(nextValues[value]);
      setHasPassword(value === "password");
    }
    const updatePassword = (value) => {
      editPost2({ password: value });
    };
    return /* @__PURE__ */ (0, import_jsx_runtime259.jsxs)("div", { className: "editor-post-visibility", children: [
      /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
        import_block_editor54.__experimentalInspectorPopoverHeader,
        {
          title: (0, import_i18n152.__)("Visibility"),
          help: (0, import_i18n152.__)("Control how this post is viewed."),
          onClose
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime259.jsxs)(import_components144.__experimentalVStack, { spacing: 4, children: [
        /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
          import_components144.RadioControl,
          {
            label: (0, import_i18n152.__)("Visibility"),
            hideLabelFromVision: true,
            options: VISIBILITY_OPTIONS,
            selected: hasPassword ? "password" : visibility,
            onChange: updateVisibility
          }
        ),
        hasPassword && /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
          import_components144.TextControl,
          {
            label: (0, import_i18n152.__)("Password"),
            onChange: updatePassword,
            value: password,
            placeholder: (0, import_i18n152.__)("Use a secure password"),
            type: "text",
            id: `editor-post-visibility__password-input-${instanceId}`,
            __next40pxDefaultSize: true,
            maxLength: 255
          }
        )
      ] })
    ] });
  }

  // packages/editor/build-module/components/post-visibility/label.mjs
  var import_data132 = __toESM(require_data(), 1);
  function PostVisibilityLabel() {
    return usePostVisibilityLabel();
  }
  function usePostVisibilityLabel() {
    const visibility = (0, import_data132.useSelect)(
      (select5) => select5(store).getEditedPostVisibility(),
      []
    );
    return VISIBILITY_OPTIONS.find((option) => option.value === visibility)?.label;
  }

  // node_modules/date-fns/toDate.mjs
  function toDate(argument) {
    const argStr = Object.prototype.toString.call(argument);
    if (argument instanceof Date || typeof argument === "object" && argStr === "[object Date]") {
      return new argument.constructor(+argument);
    } else if (typeof argument === "number" || argStr === "[object Number]" || typeof argument === "string" || argStr === "[object String]") {
      return new Date(argument);
    } else {
      return /* @__PURE__ */ new Date(NaN);
    }
  }

  // node_modules/date-fns/constants.mjs
  var daysInYear = 365.2425;
  var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
  var minTime = -maxTime;
  var millisecondsInMinute = 6e4;
  var millisecondsInHour = 36e5;
  var secondsInHour = 3600;
  var secondsInDay = secondsInHour * 24;
  var secondsInWeek = secondsInDay * 7;
  var secondsInYear = secondsInDay * daysInYear;
  var secondsInMonth = secondsInYear / 12;
  var secondsInQuarter = secondsInMonth * 3;

  // node_modules/date-fns/endOfMonth.mjs
  function endOfMonth(date) {
    const _date = toDate(date);
    const month = _date.getMonth();
    _date.setFullYear(_date.getFullYear(), month + 1, 0);
    _date.setHours(23, 59, 59, 999);
    return _date;
  }

  // node_modules/date-fns/startOfMonth.mjs
  function startOfMonth(date) {
    const _date = toDate(date);
    _date.setDate(1);
    _date.setHours(0, 0, 0, 0);
    return _date;
  }

  // node_modules/date-fns/parseISO.mjs
  function parseISO(argument, options) {
    const additionalDigits = options?.additionalDigits ?? 2;
    const dateStrings = splitDateString(argument);
    let date;
    if (dateStrings.date) {
      const parseYearResult = parseYear(dateStrings.date, additionalDigits);
      date = parseDate(parseYearResult.restDateString, parseYearResult.year);
    }
    if (!date || isNaN(date.getTime())) {
      return /* @__PURE__ */ new Date(NaN);
    }
    const timestamp = date.getTime();
    let time = 0;
    let offset3;
    if (dateStrings.time) {
      time = parseTime(dateStrings.time);
      if (isNaN(time)) {
        return /* @__PURE__ */ new Date(NaN);
      }
    }
    if (dateStrings.timezone) {
      offset3 = parseTimezone(dateStrings.timezone);
      if (isNaN(offset3)) {
        return /* @__PURE__ */ new Date(NaN);
      }
    } else {
      const dirtyDate = new Date(timestamp + time);
      const result = /* @__PURE__ */ new Date(0);
      result.setFullYear(
        dirtyDate.getUTCFullYear(),
        dirtyDate.getUTCMonth(),
        dirtyDate.getUTCDate()
      );
      result.setHours(
        dirtyDate.getUTCHours(),
        dirtyDate.getUTCMinutes(),
        dirtyDate.getUTCSeconds(),
        dirtyDate.getUTCMilliseconds()
      );
      return result;
    }
    return new Date(timestamp + time + offset3);
  }
  var patterns = {
    dateTimeDelimiter: /[T ]/,
    timeZoneDelimiter: /[Z ]/i,
    timezone: /([Z+-].*)$/
  };
  var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
  var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
  var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
  function splitDateString(dateString) {
    const dateStrings = {};
    const array = dateString.split(patterns.dateTimeDelimiter);
    let timeString;
    if (array.length > 2) {
      return dateStrings;
    }
    if (/:/.test(array[0])) {
      timeString = array[0];
    } else {
      dateStrings.date = array[0];
      timeString = array[1];
      if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
        dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
        timeString = dateString.substr(
          dateStrings.date.length,
          dateString.length
        );
      }
    }
    if (timeString) {
      const token = patterns.timezone.exec(timeString);
      if (token) {
        dateStrings.time = timeString.replace(token[1], "");
        dateStrings.timezone = token[1];
      } else {
        dateStrings.time = timeString;
      }
    }
    return dateStrings;
  }
  function parseYear(dateString, additionalDigits) {
    const regex = new RegExp(
      "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
    );
    const captures = dateString.match(regex);
    if (!captures) return { year: NaN, restDateString: "" };
    const year = captures[1] ? parseInt(captures[1]) : null;
    const century = captures[2] ? parseInt(captures[2]) : null;
    return {
      year: century === null ? year : century * 100,
      restDateString: dateString.slice((captures[1] || captures[2]).length)
    };
  }
  function parseDate(dateString, year) {
    if (year === null) return /* @__PURE__ */ new Date(NaN);
    const captures = dateString.match(dateRegex);
    if (!captures) return /* @__PURE__ */ new Date(NaN);
    const isWeekDate = !!captures[4];
    const dayOfYear = parseDateUnit(captures[1]);
    const month = parseDateUnit(captures[2]) - 1;
    const day = parseDateUnit(captures[3]);
    const week = parseDateUnit(captures[4]);
    const dayOfWeek = parseDateUnit(captures[5]) - 1;
    if (isWeekDate) {
      if (!validateWeekDate(year, week, dayOfWeek)) {
        return /* @__PURE__ */ new Date(NaN);
      }
      return dayOfISOWeekYear(year, week, dayOfWeek);
    } else {
      const date = /* @__PURE__ */ new Date(0);
      if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
        return /* @__PURE__ */ new Date(NaN);
      }
      date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
      return date;
    }
  }
  function parseDateUnit(value) {
    return value ? parseInt(value) : 1;
  }
  function parseTime(timeString) {
    const captures = timeString.match(timeRegex);
    if (!captures) return NaN;
    const hours = parseTimeUnit(captures[1]);
    const minutes = parseTimeUnit(captures[2]);
    const seconds = parseTimeUnit(captures[3]);
    if (!validateTime(hours, minutes, seconds)) {
      return NaN;
    }
    return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3;
  }
  function parseTimeUnit(value) {
    return value && parseFloat(value.replace(",", ".")) || 0;
  }
  function parseTimezone(timezoneString) {
    if (timezoneString === "Z") return 0;
    const captures = timezoneString.match(timezoneRegex);
    if (!captures) return 0;
    const sign = captures[1] === "+" ? -1 : 1;
    const hours = parseInt(captures[2]);
    const minutes = captures[3] && parseInt(captures[3]) || 0;
    if (!validateTimezone(hours, minutes)) {
      return NaN;
    }
    return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
  }
  function dayOfISOWeekYear(isoWeekYear, week, day) {
    const date = /* @__PURE__ */ new Date(0);
    date.setUTCFullYear(isoWeekYear, 0, 4);
    const fourthOfJanuaryDay = date.getUTCDay() || 7;
    const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
    date.setUTCDate(date.getUTCDate() + diff);
    return date;
  }
  var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  function isLeapYearIndex(year) {
    return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
  }
  function validateDate(year, month, date) {
    return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
  }
  function validateDayOfYearDate(year, dayOfYear) {
    return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
  }
  function validateWeekDate(_year, week, day) {
    return week >= 1 && week <= 53 && day >= 0 && day <= 6;
  }
  function validateTime(hours, minutes, seconds) {
    if (hours === 24) {
      return minutes === 0 && seconds === 0;
    }
    return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
  }
  function validateTimezone(_hours, minutes) {
    return minutes >= 0 && minutes <= 59;
  }

  // packages/editor/build-module/components/post-schedule/index.mjs
  var import_date5 = __toESM(require_date(), 1);
  var import_i18n153 = __toESM(require_i18n(), 1);
  var import_data133 = __toESM(require_data(), 1);
  var import_block_editor55 = __toESM(require_block_editor(), 1);
  var import_element111 = __toESM(require_element(), 1);
  var import_core_data81 = __toESM(require_core_data(), 1);
  var import_jsx_runtime260 = __toESM(require_jsx_runtime(), 1);
  var { PrivatePublishDateTimePicker } = unlock(import_block_editor55.privateApis);
  function PostSchedule(props) {
    return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
      PrivatePostSchedule,
      {
        ...props,
        showPopoverHeaderActions: true,
        isCompact: false
      }
    );
  }
  function PrivatePostSchedule({
    onClose,
    showPopoverHeaderActions,
    isCompact
  }) {
    const { postDate, postType: postType2 } = (0, import_data133.useSelect)(
      (select5) => ({
        postDate: select5(store).getEditedPostAttribute("date"),
        postType: select5(store).getCurrentPostType()
      }),
      []
    );
    const { editPost: editPost2 } = (0, import_data133.useDispatch)(store);
    const onUpdateDate = (date) => editPost2({ date });
    const [previewedMonth, setPreviewedMonth] = (0, import_element111.useState)(
      startOfMonth(new Date(postDate))
    );
    const eventsByPostType = (0, import_data133.useSelect)(
      (select5) => select5(import_core_data81.store).getEntityRecords("postType", postType2, {
        status: "publish,future",
        after: startOfMonth(previewedMonth).toISOString(),
        before: endOfMonth(previewedMonth).toISOString(),
        exclude: [select5(store).getCurrentPostId()],
        per_page: 100,
        _fields: "id,date"
      }),
      [previewedMonth, postType2]
    );
    const events = (0, import_element111.useMemo)(
      () => (eventsByPostType || []).map(({ date: eventDate }) => ({
        date: new Date(eventDate)
      })),
      [eventsByPostType]
    );
    const settings = (0, import_date5.getSettings)();
    const is12HourTime = /a(?!\\)/i.test(
      settings.formats.time.toLowerCase().replace(/\\\\/g, "").split("").reverse().join("")
      // Reverse the string and test for "a" not followed by a slash.
    );
    return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
      PrivatePublishDateTimePicker,
      {
        currentDate: postDate,
        onChange: onUpdateDate,
        is12Hour: is12HourTime,
        dateOrder: (
          /* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */
          (0, import_i18n153._x)("dmy", "date order")
        ),
        events,
        onMonthPreviewed: (date) => setPreviewedMonth(parseISO(date)),
        onClose,
        isCompact,
        showPopoverHeaderActions
      }
    );
  }

  // packages/editor/build-module/components/post-schedule/label.mjs
  var import_i18n154 = __toESM(require_i18n(), 1);
  var import_date6 = __toESM(require_date(), 1);
  var import_data134 = __toESM(require_data(), 1);
  function PostScheduleLabel(props) {
    return usePostScheduleLabel(props);
  }
  function usePostScheduleLabel({ full = false } = {}) {
    const { date, isFloating } = (0, import_data134.useSelect)(
      (select5) => ({
        date: select5(store).getEditedPostAttribute("date"),
        isFloating: select5(store).isEditedPostDateFloating()
      }),
      []
    );
    return full ? getFullPostScheduleLabel(date) : getPostScheduleLabel(date, { isFloating });
  }
  function getFullPostScheduleLabel(dateAttribute) {
    const date = (0, import_date6.getDate)(dateAttribute);
    const timezoneAbbreviation = getTimezoneAbbreviation();
    const formattedDate = (0, import_date6.dateI18n)(
      // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
      (0, import_i18n154._x)("F j, Y g:i\xA0a", "post schedule full date format"),
      date
    );
    return (0, import_i18n154.isRTL)() ? `${timezoneAbbreviation} ${formattedDate}` : `${formattedDate} ${timezoneAbbreviation}`;
  }
  function getPostScheduleLabel(dateAttribute, { isFloating = false, now = /* @__PURE__ */ new Date() } = {}) {
    if (!dateAttribute || isFloating) {
      return (0, import_i18n154.__)("Immediately");
    }
    if (!isTimezoneSameAsSiteTimezone(now)) {
      return getFullPostScheduleLabel(dateAttribute);
    }
    const date = (0, import_date6.getDate)(dateAttribute);
    if (isSameDay(date, now)) {
      return (0, import_i18n154.sprintf)(
        // translators: %s: Time of day the post is scheduled for.
        (0, import_i18n154.__)("Today at %s"),
        // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
        (0, import_date6.dateI18n)((0, import_i18n154._x)("g:i\xA0a", "post schedule time format"), date)
      );
    }
    const tomorrow = new Date(now);
    tomorrow.setDate(tomorrow.getDate() + 1);
    if (isSameDay(date, tomorrow)) {
      return (0, import_i18n154.sprintf)(
        // translators: %s: Time of day the post is scheduled for.
        (0, import_i18n154.__)("Tomorrow at %s"),
        // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
        (0, import_date6.dateI18n)((0, import_i18n154._x)("g:i\xA0a", "post schedule time format"), date)
      );
    }
    if (date.getFullYear() === now.getFullYear()) {
      return (0, import_date6.dateI18n)(
        // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
        (0, import_i18n154._x)("F j g:i\xA0a", "post schedule date format without year"),
        date
      );
    }
    return (0, import_date6.dateI18n)(
      // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
      (0, import_i18n154._x)("F j, Y g:i\xA0a", "post schedule full date format"),
      date
    );
  }
  function getTimezoneAbbreviation() {
    const { timezone } = (0, import_date6.getSettings)();
    if (timezone.abbr && isNaN(Number(timezone.abbr))) {
      return timezone.abbr;
    }
    const symbol = timezone.offset < 0 ? "" : "+";
    return `UTC${symbol}${timezone.offsetFormatted}`;
  }
  function isTimezoneSameAsSiteTimezone(date) {
    const { timezone } = (0, import_date6.getSettings)();
    const siteOffset = Number(timezone.offset);
    const dateOffset = -1 * (date.getTimezoneOffset() / 60);
    return siteOffset === dateOffset;
  }
  function isSameDay(left, right) {
    return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear();
  }

  // packages/editor/build-module/components/post-publish-panel/maybe-tags-panel.mjs
  var import_i18n156 = __toESM(require_i18n(), 1);
  var import_element113 = __toESM(require_element(), 1);
  var import_data137 = __toESM(require_data(), 1);
  var import_components147 = __toESM(require_components(), 1);
  var import_core_data84 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/post-taxonomies/flat-term-selector.mjs
  var import_i18n155 = __toESM(require_i18n(), 1);
  var import_element112 = __toESM(require_element(), 1);
  var import_components146 = __toESM(require_components(), 1);
  var import_data136 = __toESM(require_data(), 1);
  var import_core_data83 = __toESM(require_core_data(), 1);
  var import_compose32 = __toESM(require_compose(), 1);
  var import_a11y4 = __toESM(require_a11y(), 1);
  var import_notices23 = __toESM(require_notices(), 1);

  // packages/editor/build-module/components/post-taxonomies/most-used-terms.mjs
  var import_components145 = __toESM(require_components(), 1);
  var import_data135 = __toESM(require_data(), 1);
  var import_core_data82 = __toESM(require_core_data(), 1);
  var import_jsx_runtime261 = __toESM(require_jsx_runtime(), 1);
  var MIN_MOST_USED_TERMS = 3;
  var DEFAULT_QUERY2 = {
    per_page: 10,
    orderby: "count",
    order: "desc",
    hide_empty: true,
    _fields: "id,name,count",
    context: "view"
  };
  function MostUsedTerms({ onSelect, taxonomy }) {
    const { _terms, showTerms } = (0, import_data135.useSelect)(
      (select5) => {
        const mostUsedTerms = select5(import_core_data82.store).getEntityRecords(
          "taxonomy",
          taxonomy.slug,
          DEFAULT_QUERY2
        );
        return {
          _terms: mostUsedTerms,
          showTerms: mostUsedTerms?.length >= MIN_MOST_USED_TERMS
        };
      },
      [taxonomy.slug]
    );
    if (!showTerms) {
      return null;
    }
    const terms = unescapeTerms(_terms);
    return /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "editor-post-taxonomies__flat-term-most-used", children: [
      /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
        import_components145.BaseControl.VisualLabel,
        {
          as: "h3",
          className: "editor-post-taxonomies__flat-term-most-used-label",
          children: taxonomy.labels.most_used
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
        "ul",
        {
          role: "list",
          className: "editor-post-taxonomies__flat-term-most-used-list",
          children: terms.map((term) => /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
            import_components145.Button,
            {
              __next40pxDefaultSize: true,
              variant: "link",
              onClick: () => onSelect(term),
              children: term.name
            }
          ) }, term.id))
        }
      )
    ] });
  }

  // packages/editor/build-module/components/post-taxonomies/flat-term-selector.mjs
  var import_jsx_runtime262 = __toESM(require_jsx_runtime(), 1);
  var EMPTY_ARRAY6 = [];
  var MAX_TERMS_SUGGESTIONS = 100;
  var DEFAULT_QUERY3 = {
    per_page: MAX_TERMS_SUGGESTIONS,
    _fields: "id,name",
    context: "view"
  };
  var isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase();
  var termNamesToIds = (names, terms) => {
    return names.map(
      (termName) => terms.find((term) => isSameTermName(term.name, termName))?.id
    ).filter((id) => id !== void 0);
  };
  function FlatTermSelector({ slug }) {
    const [values, setValues] = (0, import_element112.useState)([]);
    const [search, setSearch] = (0, import_element112.useState)("");
    const debouncedSearch = (0, import_compose32.useDebounce)(setSearch, 500);
    const {
      terms,
      termIds,
      taxonomy,
      hasAssignAction,
      hasCreateAction,
      hasResolvedTerms
    } = (0, import_data136.useSelect)(
      (select5) => {
        const { getCurrentPost: getCurrentPost2, getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
        const { getEntityRecords, getEntityRecord, hasFinishedResolution } = select5(import_core_data83.store);
        const post2 = getCurrentPost2();
        const _taxonomy = getEntityRecord("root", "taxonomy", slug);
        const _termIds = _taxonomy ? getEditedPostAttribute2(_taxonomy.rest_base) : EMPTY_ARRAY6;
        const query = {
          ...DEFAULT_QUERY3,
          include: _termIds?.join(","),
          per_page: -1
        };
        return {
          hasCreateAction: _taxonomy ? post2._links?.["wp:action-create-" + _taxonomy.rest_base] ?? false : false,
          hasAssignAction: _taxonomy ? post2._links?.["wp:action-assign-" + _taxonomy.rest_base] ?? false : false,
          taxonomy: _taxonomy,
          termIds: _termIds,
          terms: _termIds?.length ? getEntityRecords("taxonomy", slug, query) : EMPTY_ARRAY6,
          hasResolvedTerms: hasFinishedResolution("getEntityRecords", [
            "taxonomy",
            slug,
            query
          ])
        };
      },
      [slug]
    );
    const { searchResults } = (0, import_data136.useSelect)(
      (select5) => {
        const { getEntityRecords } = select5(import_core_data83.store);
        return {
          searchResults: !!search ? getEntityRecords("taxonomy", slug, {
            ...DEFAULT_QUERY3,
            search
          }) : EMPTY_ARRAY6
        };
      },
      [search, slug]
    );
    (0, import_element112.useEffect)(() => {
      if (hasResolvedTerms) {
        const newValues = (terms ?? []).map(
          (term) => unescapeString(term.name)
        );
        setValues(newValues);
      }
    }, [terms, hasResolvedTerms]);
    const suggestions = (0, import_element112.useMemo)(() => {
      return (searchResults ?? []).map(
        (term) => unescapeString(term.name)
      );
    }, [searchResults]);
    const { editPost: editPost2 } = (0, import_data136.useDispatch)(store);
    const { saveEntityRecord } = (0, import_data136.useDispatch)(import_core_data83.store);
    const { createErrorNotice } = (0, import_data136.useDispatch)(import_notices23.store);
    if (!hasAssignAction) {
      return null;
    }
    async function findOrCreateTerm(term) {
      try {
        const newTerm = await saveEntityRecord("taxonomy", slug, term, {
          throwOnError: true
        });
        return unescapeTerm(newTerm);
      } catch (error) {
        if (error.code !== "term_exists") {
          throw error;
        }
        return {
          id: error.data.term_id,
          name: term.name
        };
      }
    }
    function onUpdateTerms(newTermIds) {
      editPost2({ [taxonomy.rest_base]: newTermIds });
    }
    function onChange(termNames) {
      const availableTerms = [
        ...terms ?? [],
        ...searchResults ?? []
      ];
      const uniqueTerms = termNames.reduce((acc, name2) => {
        if (!acc.some((n3) => n3.toLowerCase() === name2.toLowerCase())) {
          acc.push(name2);
        }
        return acc;
      }, []);
      const newTermNames = uniqueTerms.filter(
        (termName) => !availableTerms.find(
          (term) => isSameTermName(term.name, termName)
        )
      );
      setValues(uniqueTerms);
      if (newTermNames.length === 0) {
        onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
        return;
      }
      if (!hasCreateAction) {
        return;
      }
      Promise.all(
        newTermNames.map(
          (termName) => findOrCreateTerm({ name: termName })
        )
      ).then((newTerms) => {
        const newAvailableTerms = availableTerms.concat(newTerms);
        onUpdateTerms(
          termNamesToIds(uniqueTerms, newAvailableTerms)
        );
      }).catch((error) => {
        createErrorNotice(error.message, {
          type: "snackbar"
        });
        onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
      });
    }
    function appendTerm(newTerm) {
      if (termIds.includes(newTerm.id)) {
        return;
      }
      const newTermIds = [...termIds, newTerm.id];
      const defaultName = slug === "post_tag" ? (0, import_i18n155.__)("Tag") : (0, import_i18n155.__)("Term");
      const termAddedMessage = (0, import_i18n155.sprintf)(
        /* translators: %s: term name. */
        (0, import_i18n155._x)("%s added", "term"),
        taxonomy?.labels?.singular_name ?? defaultName
      );
      (0, import_a11y4.speak)(termAddedMessage, "assertive");
      onUpdateTerms(newTermIds);
    }
    const newTermLabel = taxonomy?.labels?.add_new_item ?? (slug === "post_tag" ? (0, import_i18n155.__)("Add Tag") : (0, import_i18n155.__)("Add Term"));
    const singularName = taxonomy?.labels?.singular_name ?? (slug === "post_tag" ? (0, import_i18n155.__)("Tag") : (0, import_i18n155.__)("Term"));
    const termAddedLabel = (0, import_i18n155.sprintf)(
      /* translators: %s: term name. */
      (0, import_i18n155._x)("%s added", "term"),
      singularName
    );
    const termRemovedLabel = (0, import_i18n155.sprintf)(
      /* translators: %s: term name. */
      (0, import_i18n155._x)("%s removed", "term"),
      singularName
    );
    const removeTermLabel = (0, import_i18n155.sprintf)(
      /* translators: %s: term name. */
      (0, import_i18n155._x)("Remove %s", "term"),
      singularName
    );
    return /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)(import_components146.__experimentalVStack, { spacing: 4, children: [
      /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
        import_components146.FormTokenField,
        {
          __next40pxDefaultSize: true,
          value: values,
          suggestions,
          onChange,
          onInputChange: debouncedSearch,
          maxSuggestions: MAX_TERMS_SUGGESTIONS,
          label: newTermLabel,
          messages: {
            added: termAddedLabel,
            removed: termRemovedLabel,
            remove: removeTermLabel
          }
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(MostUsedTerms, { taxonomy, onSelect: appendTerm })
    ] });
  }
  var flat_term_selector_default = (0, import_components146.withFilters)("editor.PostTaxonomyType")(FlatTermSelector);

  // packages/editor/build-module/components/post-publish-panel/maybe-tags-panel.mjs
  var import_jsx_runtime263 = __toESM(require_jsx_runtime(), 1);
  var TagsPanel = () => {
    const tagLabels = (0, import_data137.useSelect)((select5) => {
      const taxonomy = select5(import_core_data84.store).getTaxonomy("post_tag");
      return taxonomy?.labels;
    }, []);
    const addNewItem = tagLabels?.add_new_item ?? (0, import_i18n156.__)("Add tag");
    const tagLabel = tagLabels?.name ?? (0, import_i18n156.__)("Tags");
    const panelBodyTitle = [
      (0, import_i18n156.__)("Suggestion:"),
      /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "editor-post-publish-panel__link", children: addNewItem }, "label")
    ];
    return /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)(import_components147.PanelBody, { initialOpen: false, title: panelBodyTitle, children: [
      /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("p", { children: (0, import_i18n156.sprintf)(
        // translators: %s is the taxonomy name (e.g., "Tags").
        (0, import_i18n156.__)(
          "%s help users and search engines navigate your site and find your content. Add a few keywords to describe your post."
        ),
        tagLabel
      ) }),
      /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(flat_term_selector_default, { slug: "post_tag" })
    ] });
  };
  var MaybeTagsPanel = () => {
    const { postHasTags, siteHasTags, isPostTypeSupported } = (0, import_data137.useSelect)(
      (select5) => {
        const postType2 = select5(store).getCurrentPostType();
        const tagsTaxonomy = select5(import_core_data84.store).getEntityRecord(
          "root",
          "taxonomy",
          "post_tag"
        );
        const _isPostTypeSupported = tagsTaxonomy?.types?.includes(postType2);
        const areTagsFetched = tagsTaxonomy !== void 0;
        const tags = tagsTaxonomy && select5(store).getEditedPostAttribute(
          tagsTaxonomy.rest_base
        );
        const siteTags = _isPostTypeSupported ? !!select5(import_core_data84.store).getEntityRecords(
          "taxonomy",
          "post_tag",
          { per_page: 1 }
        )?.length : false;
        return {
          postHasTags: !!tags?.length,
          siteHasTags: siteTags,
          isPostTypeSupported: areTagsFetched && _isPostTypeSupported
        };
      },
      []
    );
    const [hadTagsWhenOpeningThePanel] = (0, import_element113.useState)(postHasTags);
    if (!isPostTypeSupported || !siteHasTags) {
      return null;
    }
    if (!hadTagsWhenOpeningThePanel) {
      return /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(TagsPanel, {});
    }
    return null;
  };
  var maybe_tags_panel_default = MaybeTagsPanel;

  // packages/editor/build-module/components/post-publish-panel/maybe-post-format-panel.mjs
  var import_components148 = __toESM(require_components(), 1);
  var import_data138 = __toESM(require_data(), 1);
  var import_i18n157 = __toESM(require_i18n(), 1);
  var import_core_data85 = __toESM(require_core_data(), 1);
  var import_jsx_runtime264 = __toESM(require_jsx_runtime(), 1);
  var getSuggestion = (supportedFormats, suggestedPostFormat) => {
    const formats = POST_FORMATS.filter(
      (format) => supportedFormats?.includes(format.id)
    );
    return formats.find((format) => format.id === suggestedPostFormat);
  };
  var PostFormatSuggestion = ({
    suggestedPostFormat,
    suggestionText,
    onUpdatePostFormat
  }) => /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
    import_components148.Button,
    {
      __next40pxDefaultSize: true,
      variant: "link",
      onClick: () => onUpdatePostFormat(suggestedPostFormat),
      children: suggestionText
    }
  );
  function PostFormatPanel() {
    const { currentPostFormat, suggestion } = (0, import_data138.useSelect)((select5) => {
      const { getEditedPostAttribute: getEditedPostAttribute2, getSuggestedPostFormat: getSuggestedPostFormat2 } = select5(store);
      const supportedFormats = select5(import_core_data85.store).getThemeSupports().formats ?? [];
      return {
        currentPostFormat: getEditedPostAttribute2("format"),
        suggestion: getSuggestion(
          supportedFormats,
          getSuggestedPostFormat2()
        )
      };
    }, []);
    const { editPost: editPost2 } = (0, import_data138.useDispatch)(store);
    const onUpdatePostFormat = (format) => editPost2({ format });
    const panelBodyTitle = [
      (0, import_i18n157.__)("Suggestion:"),
      /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("span", { className: "editor-post-publish-panel__link", children: (0, import_i18n157.__)("Use a post format") }, "label")
    ];
    if (!suggestion || suggestion.id === currentPostFormat) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(import_components148.PanelBody, { initialOpen: false, title: panelBodyTitle, children: [
      /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("p", { children: (0, import_i18n157.__)(
        "Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling."
      ) }),
      /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
        PostFormatSuggestion,
        {
          onUpdatePostFormat,
          suggestedPostFormat: suggestion.id,
          suggestionText: (0, import_i18n157.sprintf)(
            /* translators: %1s: post format */
            (0, import_i18n157.__)('Apply the "%1$s" format.'),
            suggestion.caption
          )
        }
      ) })
    ] });
  }

  // packages/editor/build-module/components/post-publish-panel/maybe-category-panel.mjs
  var import_i18n159 = __toESM(require_i18n(), 1);
  var import_data140 = __toESM(require_data(), 1);
  var import_components150 = __toESM(require_components(), 1);
  var import_core_data87 = __toESM(require_core_data(), 1);
  var import_element115 = __toESM(require_element(), 1);

  // packages/editor/build-module/components/post-taxonomies/hierarchical-term-selector.mjs
  var import_i18n158 = __toESM(require_i18n(), 1);
  var import_element114 = __toESM(require_element(), 1);
  var import_notices24 = __toESM(require_notices(), 1);
  var import_components149 = __toESM(require_components(), 1);
  var import_data139 = __toESM(require_data(), 1);
  var import_compose33 = __toESM(require_compose(), 1);
  var import_core_data86 = __toESM(require_core_data(), 1);
  var import_a11y5 = __toESM(require_a11y(), 1);
  var import_html_entities21 = __toESM(require_html_entities(), 1);
  var import_jsx_runtime265 = __toESM(require_jsx_runtime(), 1);
  var { normalizeTextString } = unlock(import_components149.privateApis);
  var { RECEIVE_INTERMEDIATE_RESULTS } = unlock(import_core_data86.privateApis);
  var DEFAULT_QUERY4 = {
    per_page: -1,
    orderby: "name",
    order: "asc",
    _fields: "id,name,parent",
    context: "view",
    [RECEIVE_INTERMEDIATE_RESULTS]: true
  };
  var MIN_TERMS_COUNT_FOR_FILTER = 8;
  var EMPTY_ARRAY7 = [];
  function sortBySelected(termsTree, terms) {
    const treeHasSelection = (termTree) => {
      if (terms.indexOf(termTree.id) !== -1) {
        return true;
      }
      if (void 0 === termTree.children) {
        return false;
      }
      return termTree.children.map(treeHasSelection).filter((child) => child).length > 0;
    };
    const termOrChildIsSelected = (termA, termB) => {
      const termASelected = treeHasSelection(termA);
      const termBSelected = treeHasSelection(termB);
      if (termASelected === termBSelected) {
        return 0;
      }
      if (termASelected && !termBSelected) {
        return -1;
      }
      if (!termASelected && termBSelected) {
        return 1;
      }
      return 0;
    };
    const newTermTree = [...termsTree];
    newTermTree.sort(termOrChildIsSelected);
    return newTermTree;
  }
  function findTerm(terms, parent, name2) {
    return terms.find((term) => {
      return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name2.toLowerCase();
    });
  }
  function getFilterMatcher(filterValue) {
    const matchTermsForFilter = (originalTerm) => {
      if ("" === filterValue) {
        return originalTerm;
      }
      const term = { ...originalTerm };
      if (term.children.length > 0) {
        term.children = term.children.map(matchTermsForFilter).filter((child) => child);
      }
      if (-1 !== normalizeTextString(term.name).indexOf(
        normalizeTextString(filterValue)
      ) || term.children.length > 0) {
        return term;
      }
      return false;
    };
    return matchTermsForFilter;
  }
  function HierarchicalTermSelector({ slug }) {
    const [adding, setAdding] = (0, import_element114.useState)(false);
    const [formName, setFormName] = (0, import_element114.useState)("");
    const [formParent, setFormParent] = (0, import_element114.useState)("");
    const [showForm, setShowForm] = (0, import_element114.useState)(false);
    const [filterValue, setFilterValue] = (0, import_element114.useState)("");
    const [filteredTermsTree, setFilteredTermsTree] = (0, import_element114.useState)([]);
    const debouncedSpeak = (0, import_compose33.useDebounce)(import_a11y5.speak, 500);
    const {
      hasCreateAction,
      hasAssignAction,
      terms,
      loading,
      availableTerms,
      taxonomy
    } = (0, import_data139.useSelect)(
      (select5) => {
        const { getCurrentPost: getCurrentPost2, getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
        const { getEntityRecord, getEntityRecords, isResolving } = select5(import_core_data86.store);
        const _taxonomy = getEntityRecord("root", "taxonomy", slug);
        const post2 = getCurrentPost2();
        return {
          hasCreateAction: _taxonomy ? !!post2._links?.["wp:action-create-" + _taxonomy.rest_base] : false,
          hasAssignAction: _taxonomy ? !!post2._links?.["wp:action-assign-" + _taxonomy.rest_base] : false,
          terms: _taxonomy ? getEditedPostAttribute2(_taxonomy.rest_base) : EMPTY_ARRAY7,
          loading: isResolving("getEntityRecords", [
            "taxonomy",
            slug,
            DEFAULT_QUERY4
          ]),
          availableTerms: getEntityRecords("taxonomy", slug, DEFAULT_QUERY4) || EMPTY_ARRAY7,
          taxonomy: _taxonomy
        };
      },
      [slug]
    );
    const { editPost: editPost2 } = (0, import_data139.useDispatch)(store);
    const { saveEntityRecord } = (0, import_data139.useDispatch)(import_core_data86.store);
    const availableTermsTree = (0, import_element114.useMemo)(
      () => sortBySelected(buildTermsTree2(availableTerms), terms),
      // Remove `terms` from the dependency list to avoid reordering every time
      // checking or unchecking a term.
      [availableTerms]
    );
    const { createErrorNotice } = (0, import_data139.useDispatch)(import_notices24.store);
    if (!hasAssignAction) {
      return null;
    }
    const addTerm = (term) => {
      return saveEntityRecord("taxonomy", slug, term, {
        throwOnError: true
      });
    };
    const onUpdateTerms = (termIds) => {
      editPost2({ [taxonomy.rest_base]: termIds });
    };
    const onChange = (termId) => {
      const hasTerm = terms.includes(termId);
      const newTerms = hasTerm ? terms.filter((id) => id !== termId) : [...terms, termId];
      onUpdateTerms(newTerms);
    };
    const onChangeFormName = (value) => {
      setFormName(value);
    };
    const onChangeFormParent = (parentId) => {
      setFormParent(parentId);
    };
    const onToggleForm = () => {
      setShowForm(!showForm);
    };
    const onAddTerm = async (event) => {
      event.preventDefault();
      if (formName === "" || adding) {
        return;
      }
      const existingTerm = findTerm(availableTerms, formParent, formName);
      if (existingTerm) {
        if (!terms.some((term) => term === existingTerm.id)) {
          onUpdateTerms([...terms, existingTerm.id]);
        }
        setFormName("");
        setFormParent("");
        return;
      }
      setAdding(true);
      let newTerm;
      try {
        newTerm = await addTerm({
          name: formName,
          parent: formParent ? formParent : void 0
        });
      } catch (error) {
        createErrorNotice(error.message, {
          type: "snackbar"
        });
        return;
      }
      const defaultName = slug === "category" ? (0, import_i18n158.__)("Category") : (0, import_i18n158.__)("Term");
      const termAddedMessage = (0, import_i18n158.sprintf)(
        /* translators: %s: term name. */
        (0, import_i18n158._x)("%s added", "term"),
        taxonomy?.labels?.singular_name ?? defaultName
      );
      (0, import_a11y5.speak)(termAddedMessage, "assertive");
      setAdding(false);
      setFormName("");
      setFormParent("");
      onUpdateTerms([...terms, newTerm.id]);
    };
    const setFilter = (value) => {
      const newFilteredTermsTree = availableTermsTree.map(getFilterMatcher(value)).filter((term) => term);
      const getResultCount = (termsTree) => {
        let count = 0;
        for (let i3 = 0; i3 < termsTree.length; i3++) {
          count++;
          if (void 0 !== termsTree[i3].children) {
            count += getResultCount(termsTree[i3].children);
          }
        }
        return count;
      };
      setFilterValue(value);
      setFilteredTermsTree(newFilteredTermsTree);
      const resultCount = getResultCount(newFilteredTermsTree);
      const resultsFoundMessage = (0, import_i18n158.sprintf)(
        /* translators: %d: number of results. */
        (0, import_i18n158._n)("%d result found.", "%d results found.", resultCount),
        resultCount
      );
      debouncedSpeak(resultsFoundMessage, "assertive");
    };
    const renderTerms = (renderedTerms) => {
      return renderedTerms.map((term) => {
        return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(
          "div",
          {
            className: "editor-post-taxonomies__hierarchical-terms-choice",
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
                import_components149.CheckboxControl,
                {
                  checked: terms.indexOf(term.id) !== -1,
                  onChange: () => {
                    const termId = parseInt(term.id, 10);
                    onChange(termId);
                  },
                  label: (0, import_html_entities21.decodeEntities)(term.name)
                }
              ),
              !!term.children.length && /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("div", { className: "editor-post-taxonomies__hierarchical-terms-subchoices", children: renderTerms(term.children) })
            ]
          },
          term.id
        );
      });
    };
    const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => taxonomy?.labels?.[labelProperty] ?? (slug === "category" ? fallbackIsCategory : fallbackIsNotCategory);
    const newTermButtonLabel = labelWithFallback(
      "add_new_item",
      (0, import_i18n158.__)("Add Category"),
      (0, import_i18n158.__)("Add Term")
    );
    const newTermLabel = labelWithFallback(
      "new_item_name",
      (0, import_i18n158.__)("Add Category"),
      (0, import_i18n158.__)("Add Term")
    );
    const parentSelectLabel = labelWithFallback(
      "parent_item",
      (0, import_i18n158.__)("Parent Category"),
      (0, import_i18n158.__)("Parent Term")
    );
    const noParentOption = `\u2014 ${parentSelectLabel} \u2014`;
    const newTermSubmitLabel = newTermButtonLabel;
    const filterLabel = taxonomy?.labels?.search_items ?? (0, import_i18n158.__)("Search Terms");
    const groupLabel = taxonomy?.name ?? (0, import_i18n158.__)("Terms");
    const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;
    return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(import_components149.Flex, { direction: "column", gap: "4", children: [
      showFilter && !loading && /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
        import_components149.SearchControl,
        {
          __next40pxDefaultSize: true,
          label: filterLabel,
          placeholder: filterLabel,
          value: filterValue,
          onChange: setFilter
        }
      ),
      loading && /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
        import_components149.Flex,
        {
          justify: "center",
          style: {
            // Match SearchControl height to prevent layout shift.
            height: "40px"
          },
          children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(import_components149.Spinner, {})
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
        "div",
        {
          className: "editor-post-taxonomies__hierarchical-terms-list",
          tabIndex: "0",
          role: "group",
          "aria-label": groupLabel,
          children: renderTerms(
            "" !== filterValue ? filteredTermsTree : availableTermsTree
          )
        }
      ),
      !loading && hasCreateAction && /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(import_components149.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
        import_components149.Button,
        {
          __next40pxDefaultSize: true,
          onClick: onToggleForm,
          className: "editor-post-taxonomies__hierarchical-terms-add",
          "aria-expanded": showForm,
          variant: "link",
          children: newTermButtonLabel
        }
      ) }),
      showForm && /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("form", { onSubmit: onAddTerm, children: /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(import_components149.Flex, { direction: "column", gap: "4", children: [
        /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
          import_components149.TextControl,
          {
            __next40pxDefaultSize: true,
            className: "editor-post-taxonomies__hierarchical-terms-input",
            label: newTermLabel,
            value: formName,
            onChange: onChangeFormName,
            required: true
          }
        ),
        !!availableTerms.length && /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
          import_components149.TreeSelect,
          {
            __next40pxDefaultSize: true,
            label: parentSelectLabel,
            noOptionLabel: noParentOption,
            onChange: onChangeFormParent,
            selectedId: formParent,
            tree: availableTermsTree
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(import_components149.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
          import_components149.Button,
          {
            __next40pxDefaultSize: true,
            variant: "secondary",
            type: "submit",
            className: "editor-post-taxonomies__hierarchical-terms-submit",
            children: newTermSubmitLabel
          }
        ) })
      ] }) })
    ] });
  }
  var hierarchical_term_selector_default = (0, import_components149.withFilters)("editor.PostTaxonomyType")(
    HierarchicalTermSelector
  );

  // packages/editor/build-module/components/post-publish-panel/maybe-category-panel.mjs
  var import_jsx_runtime266 = __toESM(require_jsx_runtime(), 1);
  function MaybeCategoryPanel() {
    const { hasNoCategory, hasSiteCategories } = (0, import_data140.useSelect)((select5) => {
      const postType2 = select5(store).getCurrentPostType();
      const { canUser, getEntityRecord } = select5(import_core_data87.store);
      const categoriesTaxonomy = getEntityRecord(
        "root",
        "taxonomy",
        "category"
      );
      const defaultCategoryId = canUser("read", {
        kind: "root",
        name: "site"
      }) ? getEntityRecord("root", "site")?.default_category : void 0;
      const defaultCategory = defaultCategoryId ? getEntityRecord("taxonomy", "category", defaultCategoryId) : void 0;
      const postTypeSupportsCategories = categoriesTaxonomy && categoriesTaxonomy.types.some((type) => type === postType2);
      const categories = categoriesTaxonomy && select5(store).getEditedPostAttribute(
        categoriesTaxonomy.rest_base
      );
      const siteCategories = postTypeSupportsCategories ? !!select5(import_core_data87.store).getEntityRecords("taxonomy", "category", {
        exclude: [defaultCategoryId],
        per_page: 1
      })?.length : false;
      const noCategory = !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && (categories?.length === 0 || categories?.length === 1 && defaultCategory?.id === categories[0]);
      return {
        hasNoCategory: noCategory,
        hasSiteCategories: siteCategories
      };
    }, []);
    const [shouldShowPanel, setShouldShowPanel] = (0, import_element115.useState)(false);
    (0, import_element115.useEffect)(() => {
      if (hasNoCategory) {
        setShouldShowPanel(true);
      }
    }, [hasNoCategory]);
    if (!shouldShowPanel || !hasSiteCategories) {
      return null;
    }
    const panelBodyTitle = [
      (0, import_i18n159.__)("Suggestion:"),
      /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: "editor-post-publish-panel__link", children: (0, import_i18n159.__)("Assign a category") }, "label")
    ];
    return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(import_components150.PanelBody, { initialOpen: false, title: panelBodyTitle, children: [
      /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { children: (0, import_i18n159.__)(
        "Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about."
      ) }),
      /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(hierarchical_term_selector_default, { slug: "category" })
    ] });
  }
  var maybe_category_panel_default = MaybeCategoryPanel;

  // packages/editor/build-module/components/post-publish-panel/maybe-upload-media.mjs
  var import_components151 = __toESM(require_components(), 1);
  var import_data141 = __toESM(require_data(), 1);
  var import_i18n160 = __toESM(require_i18n(), 1);
  var import_block_editor56 = __toESM(require_block_editor(), 1);
  var import_element116 = __toESM(require_element(), 1);
  var import_blob4 = __toESM(require_blob(), 1);

  // packages/editor/build-module/components/post-publish-panel/media-util.mjs
  var import_url13 = __toESM(require_url(), 1);
  function generateUniqueBasenames(urls) {
    const basenames = /* @__PURE__ */ new Set();
    return Object.fromEntries(
      urls.map((url) => {
        const filename = (0, import_url13.getFilename)(url);
        let basename = "";
        if (filename) {
          const parts = filename.split(".");
          if (parts.length > 1) {
            parts.pop();
          }
          basename = parts.join(".");
        }
        if (!basename) {
          basename = v4_default();
        }
        if (basenames.has(basename)) {
          basename = `${basename}-${v4_default()}`;
        }
        basenames.add(basename);
        return [url, basename];
      })
    );
  }
  function fetchMedia(urls) {
    return Object.fromEntries(
      Object.entries(generateUniqueBasenames(urls)).map(
        ([url, basename]) => {
          const filePromise = window.fetch(url.includes("?") ? url : url + "?").then((response) => response.blob()).then((blob) => {
            return new File([blob], `${basename}.png`, {
              type: blob.type
            });
          });
          return [url, filePromise];
        }
      )
    );
  }

  // packages/editor/build-module/components/post-publish-panel/maybe-upload-media.mjs
  var import_jsx_runtime267 = __toESM(require_jsx_runtime(), 1);
  function flattenBlocks(blocks) {
    const result = [];
    blocks.forEach((block) => {
      result.push(block);
      result.push(...flattenBlocks(block.innerBlocks));
    });
    return result;
  }
  function hasExternalMedia(block) {
    if (block.name === "core/image" || block.name === "core/cover") {
      return block.attributes.url && !block.attributes.id;
    }
    if (block.name === "core/media-text") {
      return block.attributes.mediaUrl && !block.attributes.mediaId;
    }
    return void 0;
  }
  function getMediaInfo(block) {
    if (block.name === "core/image" || block.name === "core/cover") {
      const { url, alt, id } = block.attributes;
      return { url, alt, id };
    }
    if (block.name === "core/media-text") {
      const { mediaUrl: url, mediaAlt: alt, mediaId: id } = block.attributes;
      return { url, alt, id };
    }
    return {};
  }
  function Image({ clientId, alt, url }) {
    const { selectBlock: selectBlock2 } = (0, import_data141.useDispatch)(import_block_editor56.store);
    return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
      import_components151.__unstableMotion.img,
      {
        tabIndex: 0,
        role: "button",
        "aria-label": (0, import_i18n160.__)("Select image block."),
        onClick: () => {
          selectBlock2(clientId);
        },
        onKeyDown: (event) => {
          if (event.key === "Enter" || event.key === " ") {
            selectBlock2(clientId);
            event.preventDefault();
          }
        },
        alt,
        src: url,
        animate: { opacity: 1 },
        exit: { opacity: 0, scale: 0 },
        style: {
          width: "32px",
          height: "32px",
          objectFit: "cover",
          borderRadius: "2px",
          cursor: "pointer"
        },
        whileHover: { scale: 1.08 }
      },
      clientId
    );
  }
  function MaybeUploadMediaPanel() {
    const [isUploading, setIsUploading] = (0, import_element116.useState)(false);
    const [isAnimating, setIsAnimating] = (0, import_element116.useState)(false);
    const [hadUploadError, setHadUploadError] = (0, import_element116.useState)(false);
    const { editorBlocks, mediaUpload: mediaUpload2 } = (0, import_data141.useSelect)(
      (select5) => ({
        editorBlocks: select5(import_block_editor56.store).getBlocks(),
        mediaUpload: select5(import_block_editor56.store).getSettings().mediaUpload
      }),
      []
    );
    const blocksWithExternalMedia = flattenBlocks(editorBlocks).filter(
      (block) => hasExternalMedia(block)
    );
    const { updateBlockAttributes: updateBlockAttributes2 } = (0, import_data141.useDispatch)(import_block_editor56.store);
    if (!mediaUpload2 || !blocksWithExternalMedia.length) {
      return null;
    }
    const panelBodyTitle = [
      (0, import_i18n160.__)("Suggestion:"),
      /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("span", { className: "editor-post-publish-panel__link", children: (0, import_i18n160.__)("External media") }, "label")
    ];
    function updateBlockWithUploadedMedia(block, media) {
      if (block.name === "core/image" || block.name === "core/cover") {
        updateBlockAttributes2(block.clientId, {
          id: media.id,
          url: media.url
        });
      }
      if (block.name === "core/media-text") {
        updateBlockAttributes2(block.clientId, {
          mediaId: media.id,
          mediaUrl: media.url
        });
      }
    }
    function uploadImages() {
      setIsUploading(true);
      setHadUploadError(false);
      const mediaUrls = new Set(
        blocksWithExternalMedia.map((block) => {
          const { url } = getMediaInfo(block);
          return url;
        })
      );
      const uploadPromises = Object.fromEntries(
        Object.entries(fetchMedia([...mediaUrls])).map(
          ([url, filePromise]) => {
            const uploadPromise = filePromise.then(
              (blob) => new Promise((resolve, reject) => {
                mediaUpload2({
                  filesList: [blob],
                  onFileChange: ([media]) => {
                    if ((0, import_blob4.isBlobURL)(media.url)) {
                      return;
                    }
                    resolve(media);
                  },
                  onError() {
                    reject();
                  }
                });
              })
            );
            return [url, uploadPromise];
          }
        )
      );
      Promise.allSettled(
        blocksWithExternalMedia.map((block) => {
          const { url } = getMediaInfo(block);
          return uploadPromises[url].then(
            (media) => updateBlockWithUploadedMedia(block, media)
          ).then(() => setIsAnimating(true)).catch(() => setHadUploadError(true));
        })
      ).finally(() => {
        setIsUploading(false);
      });
    }
    return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(import_components151.PanelBody, { initialOpen: true, title: panelBodyTitle, children: [
      /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { children: (0, import_i18n160.__)(
        "Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly."
      ) }),
      /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
        "div",
        {
          style: {
            display: "inline-flex",
            flexWrap: "wrap",
            gap: "8px"
          },
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
              import_components151.__unstableAnimatePresence,
              {
                onExitComplete: () => setIsAnimating(false),
                children: blocksWithExternalMedia.map((block) => {
                  const { url, alt } = getMediaInfo(block);
                  return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
                    Image,
                    {
                      clientId: block.clientId,
                      url,
                      alt
                    },
                    block.clientId
                  );
                })
              }
            ),
            isUploading || isAnimating ? /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(import_components151.Spinner, {}) : /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
              import_components151.Button,
              {
                size: "compact",
                variant: "primary",
                onClick: uploadImages,
                children: (0, import_i18n160._x)("Upload", "verb")
              }
            )
          ]
        }
      ),
      hadUploadError && /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { children: (0, import_i18n160.__)("Upload failed, try again.") })
    ] });
  }

  // packages/editor/build-module/components/post-publish-panel/prepublish.mjs
  var import_jsx_runtime268 = __toESM(require_jsx_runtime(), 1);
  function PostPublishPanelPrepublish({ children }) {
    const {
      isBeingScheduled,
      isRequestingSiteIcon,
      hasPublishAction,
      siteIconUrl,
      siteTitle,
      siteHome
    } = (0, import_data142.useSelect)((select5) => {
      const { getCurrentPost: getCurrentPost2, isEditedPostBeingScheduled: isEditedPostBeingScheduled2 } = select5(store);
      const { getEntityRecord, isResolving } = select5(import_core_data88.store);
      const siteData = getEntityRecord("root", "__unstableBase", void 0) || {};
      return {
        hasPublishAction: getCurrentPost2()._links?.["wp:action-publish"] ?? false,
        isBeingScheduled: isEditedPostBeingScheduled2(),
        isRequestingSiteIcon: isResolving("getEntityRecord", [
          "root",
          "__unstableBase",
          void 0
        ]),
        siteIconUrl: siteData.site_icon_url,
        siteTitle: siteData.name,
        siteHome: siteData.home && (0, import_url14.filterURLForDisplay)(siteData.home)
      };
    }, []);
    let siteIcon = /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(import_components152.Icon, { className: "components-site-icon", size: "36px", icon: wordpress_default });
    if (siteIconUrl) {
      siteIcon = /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
        "img",
        {
          alt: (0, import_i18n161.__)("Site Icon"),
          className: "components-site-icon",
          src: siteIconUrl
        }
      );
    }
    if (isRequestingSiteIcon) {
      siteIcon = null;
    }
    let prePublishTitle, prePublishBodyText;
    if (!hasPublishAction) {
      prePublishTitle = (0, import_i18n161.__)("Are you ready to submit for review?");
      prePublishBodyText = (0, import_i18n161.__)(
        "Your work will be reviewed and then approved."
      );
    } else if (isBeingScheduled) {
      prePublishTitle = (0, import_i18n161.__)("Are you ready to schedule?");
      prePublishBodyText = (0, import_i18n161.__)(
        "Your work will be published at the specified date and time."
      );
    } else {
      prePublishTitle = (0, import_i18n161.__)("Are you ready to publish?");
      prePublishBodyText = (0, import_i18n161.__)(
        "Double-check your settings before publishing."
      );
    }
    return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "editor-post-publish-panel__prepublish", children: [
      /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("strong", { children: prePublishTitle }) }),
      /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { children: prePublishBodyText }),
      /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "components-site-card", children: [
        siteIcon,
        /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "components-site-info", children: [
          /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("span", { className: "components-site-name", children: (0, import_html_entities22.decodeEntities)(siteTitle) || (0, import_i18n161.__)("(Untitled)") }),
          /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("span", { className: "components-site-home", children: siteHome })
        ] })
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(MaybeUploadMediaPanel, {}),
      hasPublishAction && /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(import_jsx_runtime268.Fragment, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
          import_components152.PanelBody,
          {
            initialOpen: false,
            title: [
              (0, import_i18n161.__)("Visibility:"),
              /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
                "span",
                {
                  className: "editor-post-publish-panel__link",
                  children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(PostVisibilityLabel, {})
                },
                "label"
              )
            ],
            children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(PostVisibility, {})
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
          import_components152.PanelBody,
          {
            initialOpen: false,
            title: [
              (0, import_i18n161.__)("Publish:"),
              /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
                "span",
                {
                  className: "editor-post-publish-panel__link",
                  children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(PostScheduleLabel, {})
                },
                "label"
              )
            ],
            children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(PostSchedule, {})
          }
        )
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(PostFormatPanel, {}),
      /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(maybe_tags_panel_default, {}),
      /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(maybe_category_panel_default, {}),
      children
    ] });
  }
  var prepublish_default = PostPublishPanelPrepublish;

  // packages/editor/build-module/components/post-publish-panel/postpublish.mjs
  var import_components153 = __toESM(require_components(), 1);
  var import_i18n162 = __toESM(require_i18n(), 1);
  var import_element117 = __toESM(require_element(), 1);
  var import_data143 = __toESM(require_data(), 1);
  var import_url15 = __toESM(require_url(), 1);
  var import_html_entities23 = __toESM(require_html_entities(), 1);
  var import_compose34 = __toESM(require_compose(), 1);
  var import_core_data89 = __toESM(require_core_data(), 1);
  var import_jsx_runtime269 = __toESM(require_jsx_runtime(), 1);
  var POSTNAME = "%postname%";
  var PAGENAME = "%pagename%";
  var getFuturePostUrl = (post2) => {
    const { slug } = post2;
    if (post2.permalink_template.includes(POSTNAME)) {
      return post2.permalink_template.replace(POSTNAME, slug);
    }
    if (post2.permalink_template.includes(PAGENAME)) {
      return post2.permalink_template.replace(PAGENAME, slug);
    }
    return post2.permalink_template;
  };
  function CopyButton2({ text }) {
    const [showCopyConfirmation, setShowCopyConfirmation] = (0, import_element117.useState)(false);
    const timeoutIdRef = (0, import_element117.useRef)();
    const ref = (0, import_compose34.useCopyToClipboard)(text, () => {
      setShowCopyConfirmation(true);
      if (timeoutIdRef.current) {
        clearTimeout(timeoutIdRef.current);
      }
      timeoutIdRef.current = setTimeout(() => {
        setShowCopyConfirmation(false);
      }, 4e3);
    });
    (0, import_element117.useEffect)(() => {
      return () => {
        if (timeoutIdRef.current) {
          clearTimeout(timeoutIdRef.current);
        }
      };
    }, []);
    return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_components153.Button, { __next40pxDefaultSize: true, variant: "secondary", ref, children: showCopyConfirmation ? (0, import_i18n162.__)("Copied!") : (0, import_i18n162.__)("Copy") });
  }
  function PostPublishPanelPostpublish({
    focusOnMount,
    children
  }) {
    const { post: post2, postType: postType2, isScheduled } = (0, import_data143.useSelect)((select5) => {
      const {
        getEditedPostAttribute: getEditedPostAttribute2,
        getCurrentPost: getCurrentPost2,
        isCurrentPostScheduled: isCurrentPostScheduled2
      } = select5(store);
      const { getPostType } = select5(import_core_data89.store);
      return {
        post: getCurrentPost2(),
        postType: getPostType(getEditedPostAttribute2("type")),
        isScheduled: isCurrentPostScheduled2()
      };
    }, []);
    const postLabel = postType2?.labels?.singular_name;
    const viewPostLabel = postType2?.labels?.view_item;
    const addNewPostLabel = postType2?.labels?.add_new_item;
    const link = post2.status === "future" ? getFuturePostUrl(post2) : post2.link;
    const addLink = (0, import_url15.addQueryArgs)("post-new.php", {
      post_type: post2.type
    });
    const postLinkRef = (0, import_element117.useCallback)(
      (node) => {
        if (focusOnMount && node) {
          node.focus();
        }
      },
      [focusOnMount]
    );
    const postPublishNonLinkHeader = isScheduled ? /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(import_jsx_runtime269.Fragment, { children: [
      (0, import_i18n162.__)("is now scheduled. It will go live on"),
      " ",
      /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(PostScheduleLabel, {}),
      "."
    ] }) : (0, import_i18n162.__)("is now live.");
    return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "post-publish-panel__postpublish", children: [
      /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(import_components153.PanelBody, { className: "post-publish-panel__postpublish-header", children: [
        /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_components153.ExternalLink, { ref: postLinkRef, href: link, children: (0, import_html_entities23.decodeEntities)(post2.title) || (0, import_i18n162.__)("(no title)") }),
        " ",
        postPublishNonLinkHeader
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(import_components153.PanelBody, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "post-publish-panel__postpublish-subheader", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("strong", { children: (0, import_i18n162.__)("What\u2019s next?") }) }),
        /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "post-publish-panel__postpublish-post-address-container", children: [
          /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
            import_components153.TextControl,
            {
              __next40pxDefaultSize: true,
              className: "post-publish-panel__postpublish-post-address",
              readOnly: true,
              label: (0, import_i18n162.sprintf)(
                /* translators: %s: post type singular name */
                (0, import_i18n162.__)("%s address"),
                postLabel
              ),
              value: (0, import_url15.safeDecodeURIComponent)(link),
              onFocus: (event) => event.target.select()
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "post-publish-panel__postpublish-post-address__copy-button-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(CopyButton2, { text: link }) })
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "post-publish-panel__postpublish-buttons", children: [
          !isScheduled && /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(
            import_components153.Button,
            {
              variant: "primary",
              href: link,
              __next40pxDefaultSize: true,
              icon: external_default,
              iconPosition: "right",
              target: "_blank",
              children: [
                viewPostLabel,
                /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_components153.VisuallyHidden, {
                  as: "span",
                  /* translators: accessibility text */
                  children: (0, import_i18n162.__)("(opens in a new tab)")
                })
              ]
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
            import_components153.Button,
            {
              variant: isScheduled ? "primary" : "secondary",
              __next40pxDefaultSize: true,
              href: addLink,
              children: addNewPostLabel
            }
          )
        ] })
      ] }),
      children
    ] });
  }

  // packages/editor/build-module/components/post-publish-panel/index.mjs
  var import_jsx_runtime270 = __toESM(require_jsx_runtime(), 1);
  var PostPublishPanel = class extends import_element118.Component {
    constructor() {
      super(...arguments);
      this.onSubmit = this.onSubmit.bind(this);
      this.cancelButtonNode = (0, import_element118.createRef)();
    }
    componentDidMount() {
      this.timeoutID = setTimeout(() => {
        this.cancelButtonNode.current.focus();
      }, 0);
    }
    componentWillUnmount() {
      clearTimeout(this.timeoutID);
    }
    componentDidUpdate(prevProps) {
      if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty || this.props.currentPostId !== prevProps.currentPostId) {
        this.props.onClose();
      }
    }
    onSubmit() {
      const { onClose, hasPublishAction, isPostTypeViewable } = this.props;
      if (!hasPublishAction || !isPostTypeViewable) {
        onClose();
      }
    }
    render() {
      const {
        forceIsDirty,
        isBeingScheduled,
        isPublished,
        isPublishSidebarEnabled: isPublishSidebarEnabled2,
        isScheduled,
        isSaving,
        isSavingNonPostEntityChanges: isSavingNonPostEntityChanges2,
        onClose,
        onTogglePublishSidebar,
        PostPublishExtension,
        PrePublishExtension,
        currentPostId,
        ...additionalProps
      } = this.props;
      const {
        hasPublishAction,
        isDirty,
        isPostTypeViewable,
        ...propsForPanel
      } = additionalProps;
      const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled;
      const isPrePublish = !isPublishedOrScheduled && !isSaving;
      const isPostPublish = isPublishedOrScheduled && !isSaving;
      return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "editor-post-publish-panel", ...propsForPanel, children: [
        /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("div", { className: "editor-post-publish-panel__header", children: isPostPublish ? /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
          import_components154.Button,
          {
            size: "compact",
            onClick: onClose,
            icon: close_small_default,
            label: (0, import_i18n163.__)("Close panel")
          }
        ) : /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(import_jsx_runtime270.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("div", { className: "editor-post-publish-panel__header-cancel-button", children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
            import_components154.Button,
            {
              ref: this.cancelButtonNode,
              accessibleWhenDisabled: true,
              disabled: isSavingNonPostEntityChanges2,
              onClick: onClose,
              variant: "secondary",
              size: "compact",
              children: (0, import_i18n163.__)("Cancel")
            }
          ) }),
          /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("div", { className: "editor-post-publish-panel__header-publish-button", children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
            post_publish_button_default,
            {
              onSubmit: this.onSubmit,
              forceIsDirty
            }
          ) })
        ] }) }),
        /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "editor-post-publish-panel__content", children: [
          isPrePublish && /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(prepublish_default, { children: PrePublishExtension && /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(PrePublishExtension, {}) }),
          isPostPublish && /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(PostPublishPanelPostpublish, { focusOnMount: true, children: PostPublishExtension && /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(PostPublishExtension, {}) }),
          isSaving && /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(import_components154.Spinner, {})
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("div", { className: "editor-post-publish-panel__footer", children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
          import_components154.CheckboxControl,
          {
            label: (0, import_i18n163.__)("Always show pre-publish checks."),
            checked: isPublishSidebarEnabled2,
            onChange: onTogglePublishSidebar
          }
        ) })
      ] });
    }
  };
  var post_publish_panel_default = (0, import_compose35.compose)([
    (0, import_data144.withSelect)((select5) => {
      const { getPostType } = select5(import_core_data90.store);
      const {
        getCurrentPost: getCurrentPost2,
        getCurrentPostId: getCurrentPostId2,
        getEditedPostAttribute: getEditedPostAttribute2,
        isCurrentPostPublished: isCurrentPostPublished2,
        isCurrentPostScheduled: isCurrentPostScheduled2,
        isEditedPostBeingScheduled: isEditedPostBeingScheduled2,
        isEditedPostDirty: isEditedPostDirty2,
        isAutosavingPost: isAutosavingPost2,
        isSavingPost: isSavingPost2,
        isSavingNonPostEntityChanges: isSavingNonPostEntityChanges2
      } = select5(store);
      const { isPublishSidebarEnabled: isPublishSidebarEnabled2 } = select5(store);
      const postType2 = getPostType(getEditedPostAttribute2("type"));
      return {
        hasPublishAction: getCurrentPost2()._links?.["wp:action-publish"] ?? false,
        isPostTypeViewable: postType2?.viewable,
        isBeingScheduled: isEditedPostBeingScheduled2(),
        isDirty: isEditedPostDirty2(),
        isPublished: isCurrentPostPublished2(),
        isPublishSidebarEnabled: isPublishSidebarEnabled2(),
        isSaving: isSavingPost2() && !isAutosavingPost2(),
        isSavingNonPostEntityChanges: isSavingNonPostEntityChanges2(),
        isScheduled: isCurrentPostScheduled2(),
        currentPostId: getCurrentPostId2()
      };
    }),
    (0, import_data144.withDispatch)((dispatch6, { isPublishSidebarEnabled: isPublishSidebarEnabled2 }) => {
      const { disablePublishSidebar: disablePublishSidebar2, enablePublishSidebar: enablePublishSidebar2 } = dispatch6(store);
      return {
        onTogglePublishSidebar: () => {
          if (isPublishSidebarEnabled2) {
            disablePublishSidebar2();
          } else {
            enablePublishSidebar2();
          }
        }
      };
    }),
    import_components154.withFocusReturn,
    import_components154.withConstrainedTabbing
  ])(PostPublishPanel);

  // packages/editor/build-module/components/post-saved-state/index.mjs
  var import_components157 = __toESM(require_components(), 1);
  var import_compose37 = __toESM(require_compose(), 1);
  var import_data148 = __toESM(require_data(), 1);
  var import_element120 = __toESM(require_element(), 1);
  var import_i18n166 = __toESM(require_i18n(), 1);
  var import_keycodes11 = __toESM(require_keycodes(), 1);
  var import_preferences14 = __toESM(require_preferences(), 1);

  // packages/editor/build-module/components/post-status/index.mjs
  var import_components156 = __toESM(require_components(), 1);
  var import_i18n165 = __toESM(require_i18n(), 1);
  var import_data147 = __toESM(require_data(), 1);
  var import_element119 = __toESM(require_element(), 1);
  var import_core_data91 = __toESM(require_core_data(), 1);
  var import_block_editor57 = __toESM(require_block_editor(), 1);
  var import_compose36 = __toESM(require_compose(), 1);

  // packages/editor/build-module/components/post-sticky/index.mjs
  var import_i18n164 = __toESM(require_i18n(), 1);
  var import_components155 = __toESM(require_components(), 1);
  var import_data146 = __toESM(require_data(), 1);

  // packages/editor/build-module/components/post-sticky/check.mjs
  var import_data145 = __toESM(require_data(), 1);
  function PostStickyCheck({ children }) {
    const { hasStickyAction, postType: postType2 } = (0, import_data145.useSelect)((select5) => {
      const post2 = select5(store).getCurrentPost();
      return {
        hasStickyAction: post2._links?.["wp:action-sticky"] ?? false,
        postType: select5(store).getCurrentPostType()
      };
    }, []);
    if (postType2 !== "post" || !hasStickyAction) {
      return null;
    }
    return children;
  }

  // packages/editor/build-module/components/post-sticky/index.mjs
  var import_jsx_runtime271 = __toESM(require_jsx_runtime(), 1);
  function PostSticky() {
    const postSticky = (0, import_data146.useSelect)((select5) => {
      return select5(store).getEditedPostAttribute("sticky") ?? false;
    }, []);
    const { editPost: editPost2 } = (0, import_data146.useDispatch)(store);
    return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(PostStickyCheck, { children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
      import_components155.CheckboxControl,
      {
        className: "editor-post-sticky__checkbox-control",
        label: (0, import_i18n164.__)("Sticky"),
        help: (0, import_i18n164.__)("Pin this post to the top of the blog."),
        checked: postSticky,
        onChange: () => editPost2({ sticky: !postSticky })
      }
    ) });
  }

  // packages/editor/build-module/components/post-status/index.mjs
  var import_jsx_runtime272 = __toESM(require_jsx_runtime(), 1);
  var postStatusesInfo = {
    "auto-draft": { label: (0, import_i18n165.__)("Draft"), icon: drafts_default },
    draft: { label: (0, import_i18n165.__)("Draft"), icon: drafts_default },
    pending: { label: (0, import_i18n165.__)("Pending"), icon: pending_default },
    private: { label: (0, import_i18n165.__)("Private"), icon: not_allowed_default },
    future: { label: (0, import_i18n165.__)("Scheduled"), icon: scheduled_default },
    publish: { label: (0, import_i18n165.__)("Published"), icon: published_default }
  };
  var STATUS_OPTIONS = [
    {
      label: (0, import_i18n165.__)("Draft"),
      value: "draft",
      description: (0, import_i18n165.__)("Not ready to publish.")
    },
    {
      label: (0, import_i18n165.__)("Pending"),
      value: "pending",
      description: (0, import_i18n165.__)("Waiting for review before publishing.")
    },
    {
      label: (0, import_i18n165.__)("Private"),
      value: "private",
      description: (0, import_i18n165.__)("Only visible to site admins and editors.")
    },
    {
      label: (0, import_i18n165.__)("Scheduled"),
      value: "future",
      description: (0, import_i18n165.__)("Publish automatically on a chosen date.")
    },
    {
      label: (0, import_i18n165.__)("Published"),
      value: "publish",
      description: (0, import_i18n165.__)("Visible to everyone.")
    }
  ];
  function PostStatus() {
    const { status, date, password, postId: postId2, postType: postType2, canEdit } = (0, import_data147.useSelect)(
      (select5) => {
        const {
          getEditedPostAttribute: getEditedPostAttribute2,
          getCurrentPostId: getCurrentPostId2,
          getCurrentPostType: getCurrentPostType2,
          getCurrentPost: getCurrentPost2
        } = select5(store);
        return {
          status: getEditedPostAttribute2("status"),
          date: getEditedPostAttribute2("date"),
          password: getEditedPostAttribute2("password"),
          postId: getCurrentPostId2(),
          postType: getCurrentPostType2(),
          canEdit: getCurrentPost2()._links?.["wp:action-publish"] ?? false
        };
      },
      []
    );
    const [showPassword, setShowPassword] = (0, import_element119.useState)(!!password);
    const passwordInputId = (0, import_compose36.useInstanceId)(
      PostStatus,
      "editor-change-status__password-input"
    );
    const { editEntityRecord } = (0, import_data147.useDispatch)(import_core_data91.store);
    const [popoverAnchor, setPopoverAnchor] = (0, import_element119.useState)(null);
    const popoverProps = (0, import_element119.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        "aria-label": (0, import_i18n165.__)("Status & visibility"),
        headerTitle: (0, import_i18n165.__)("Status & visibility"),
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor]
    );
    if (DESIGN_POST_TYPES.includes(postType2)) {
      return null;
    }
    const updatePost2 = ({
      status: newStatus = status,
      password: newPassword = password,
      date: newDate = date
    }) => {
      editEntityRecord("postType", postType2, postId2, {
        status: newStatus,
        date: newDate,
        password: newPassword
      });
    };
    const handleTogglePassword = (value) => {
      setShowPassword(value);
      if (!value) {
        updatePost2({ password: "" });
      }
    };
    const handleStatus = (value) => {
      let newDate = date;
      let newPassword = password;
      if (status === "future" && new Date(date) > /* @__PURE__ */ new Date()) {
        newDate = null;
      }
      if (value === "private" && password) {
        newPassword = "";
      }
      updatePost2({
        status: value,
        date: newDate,
        password: newPassword
      });
    };
    return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(post_panel_row_default, { label: (0, import_i18n165.__)("Status"), ref: setPopoverAnchor, children: canEdit ? /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
      import_components156.Dropdown,
      {
        className: "editor-post-status",
        contentClassName: "editor-change-status__content",
        popoverProps,
        focusOnMount: true,
        renderToggle: ({ onToggle, isOpen }) => /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
          import_components156.Button,
          {
            className: "editor-post-status__toggle",
            variant: "tertiary",
            size: "compact",
            onClick: onToggle,
            icon: postStatusesInfo[status]?.icon,
            "aria-label": (0, import_i18n165.sprintf)(
              // translators: %s: Current post status.
              (0, import_i18n165.__)("Change status: %s"),
              postStatusesInfo[status]?.label
            ),
            "aria-expanded": isOpen,
            children: postStatusesInfo[status]?.label
          }
        ),
        renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(import_jsx_runtime272.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
            import_block_editor57.__experimentalInspectorPopoverHeader,
            {
              title: (0, import_i18n165.__)("Status & visibility"),
              onClose
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
            "form",
            {
              onSubmit: (event) => {
                event.preventDefault();
                onClose();
              },
              children: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(import_components156.__experimentalVStack, { spacing: 4, children: [
                /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
                  import_components156.RadioControl,
                  {
                    className: "editor-change-status__options",
                    hideLabelFromVision: true,
                    label: (0, import_i18n165.__)("Status"),
                    options: STATUS_OPTIONS,
                    onChange: handleStatus,
                    selected: status === "auto-draft" ? "draft" : status
                  }
                ),
                status === "future" && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "editor-change-status__publish-date-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
                  PrivatePostSchedule,
                  {
                    showPopoverHeaderActions: false,
                    isCompact: true
                  }
                ) }),
                status !== "private" && /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
                  import_components156.__experimentalVStack,
                  {
                    as: "fieldset",
                    spacing: 4,
                    className: "editor-change-status__password-fieldset",
                    children: [
                      /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
                        import_components156.CheckboxControl,
                        {
                          label: (0, import_i18n165.__)(
                            "Password protected"
                          ),
                          help: (0, import_i18n165.__)(
                            "Only visible to those who know the password."
                          ),
                          checked: showPassword,
                          onChange: handleTogglePassword
                        }
                      ),
                      showPassword && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "editor-change-status__password-input", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
                        import_components156.TextControl,
                        {
                          label: (0, import_i18n165.__)(
                            "Password"
                          ),
                          onChange: (value) => updatePost2({
                            password: value
                          }),
                          value: password,
                          placeholder: (0, import_i18n165.__)(
                            "Use a secure password"
                          ),
                          type: "text",
                          id: passwordInputId,
                          __next40pxDefaultSize: true,
                          maxLength: 255
                        }
                      ) })
                    ]
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(PostSticky, {})
              ] })
            }
          )
        ] })
      }
    ) : /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "editor-post-status is-read-only", children: postStatusesInfo[status]?.label }) });
  }

  // packages/editor/build-module/components/post-saved-state/index.mjs
  var import_jsx_runtime273 = __toESM(require_jsx_runtime(), 1);
  function PostSavedState({ forceIsDirty }) {
    const [forceSavedMessage, setForceSavedMessage] = (0, import_element120.useState)(false);
    const isLargeViewport = (0, import_compose37.useViewportMatch)("small");
    const {
      isAutosaving,
      isDirty,
      isNew,
      isPublished,
      isSaveable,
      isSaving,
      isScheduled,
      hasPublishAction,
      showIconLabels,
      postStatus,
      postStatusHasChanged
    } = (0, import_data148.useSelect)(
      (select5) => {
        const {
          isEditedPostNew: isEditedPostNew2,
          isCurrentPostPublished: isCurrentPostPublished2,
          isCurrentPostScheduled: isCurrentPostScheduled2,
          isEditedPostDirty: isEditedPostDirty2,
          isSavingPost: isSavingPost2,
          isEditedPostSaveable: isEditedPostSaveable2,
          getCurrentPost: getCurrentPost2,
          isAutosavingPost: isAutosavingPost2,
          getEditedPostAttribute: getEditedPostAttribute2,
          getPostEdits: getPostEdits2
        } = select5(store);
        const { get } = select5(import_preferences14.store);
        return {
          isAutosaving: isAutosavingPost2(),
          isDirty: forceIsDirty || isEditedPostDirty2(),
          isNew: isEditedPostNew2(),
          isPublished: isCurrentPostPublished2(),
          isSaving: isSavingPost2(),
          isSaveable: isEditedPostSaveable2(),
          isScheduled: isCurrentPostScheduled2(),
          hasPublishAction: getCurrentPost2()?._links?.["wp:action-publish"] ?? false,
          showIconLabels: get("core", "showIconLabels"),
          postStatus: getEditedPostAttribute2("status"),
          postStatusHasChanged: !!getPostEdits2()?.status
        };
      },
      [forceIsDirty]
    );
    const isPending = postStatus === "pending";
    const { savePost: savePost2 } = (0, import_data148.useDispatch)(store);
    const wasSaving = (0, import_compose37.usePrevious)(isSaving);
    (0, import_element120.useEffect)(() => {
      let timeoutId;
      if (wasSaving && !isSaving) {
        setForceSavedMessage(true);
        timeoutId = setTimeout(() => {
          setForceSavedMessage(false);
        }, 1e3);
      }
      return () => clearTimeout(timeoutId);
    }, [isSaving]);
    if (!hasPublishAction && isPending) {
      return null;
    }
    const isIneligibleStatus = !["pending", "draft", "auto-draft"].includes(postStatus) && STATUS_OPTIONS.map(({ value }) => value).includes(postStatus);
    if (isPublished || isScheduled || isIneligibleStatus || postStatusHasChanged && ["pending", "draft"].includes(postStatus)) {
      return null;
    }
    const label = isPending ? (0, import_i18n166.__)("Save as pending") : (0, import_i18n166.__)("Save draft");
    const shortLabel = (0, import_i18n166.__)("Save");
    const isSaved = forceSavedMessage || !isNew && !isDirty;
    const isSavedState = isSaving || isSaved;
    const isDisabled = isSaving || isSaved || !isSaveable;
    let text;
    if (isSaving) {
      text = isAutosaving ? (0, import_i18n166.__)("Autosaving") : (0, import_i18n166.__)("Saving");
    } else if (isSaved) {
      text = (0, import_i18n166.__)("Saved");
    } else if (isLargeViewport) {
      text = label;
    } else if (showIconLabels) {
      text = shortLabel;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(
      import_components157.Button,
      {
        className: isSaveable || isSaving ? clsx_default({
          "editor-post-save-draft": !isSavedState,
          "editor-post-saved-state": isSavedState,
          "is-saving": isSaving,
          "is-autosaving": isAutosaving,
          "is-saved": isSaved,
          [(0, import_components157.__unstableGetAnimateClassName)({
            type: "loading"
          })]: isSaving
        }) : void 0,
        onClick: isDisabled ? void 0 : () => savePost2(),
        shortcut: isDisabled ? void 0 : import_keycodes11.displayShortcut.primary("s"),
        variant: "tertiary",
        size: "compact",
        icon: isLargeViewport ? void 0 : cloud_upload_default,
        label: text || label,
        "aria-disabled": isDisabled,
        children: [
          isSavedState && /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(icon_default, { icon: isSaved ? check_default : cloud_default }),
          text
        ]
      }
    );
  }

  // packages/editor/build-module/components/post-schedule/check.mjs
  var import_data149 = __toESM(require_data(), 1);
  function PostScheduleCheck({ children }) {
    const hasPublishAction = (0, import_data149.useSelect)((select5) => {
      return select5(store).getCurrentPost()._links?.["wp:action-publish"] ?? false;
    }, []);
    if (!hasPublishAction) {
      return null;
    }
    return children;
  }

  // packages/editor/build-module/components/post-schedule/panel.mjs
  var import_components158 = __toESM(require_components(), 1);
  var import_i18n167 = __toESM(require_i18n(), 1);
  var import_element121 = __toESM(require_element(), 1);
  var import_data150 = __toESM(require_data(), 1);
  var import_jsx_runtime274 = __toESM(require_jsx_runtime(), 1);
  function PostSchedulePanel() {
    const [popoverAnchor, setPopoverAnchor] = (0, import_element121.useState)(null);
    const postType2 = (0, import_data150.useSelect)(
      (select5) => select5(store).getCurrentPostType(),
      []
    );
    const popoverProps = (0, import_element121.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        "aria-label": (0, import_i18n167.__)("Change publish date"),
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor]
    );
    const label = usePostScheduleLabel();
    const fullLabel = usePostScheduleLabel({ full: true });
    if (DESIGN_POST_TYPES.includes(postType2)) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(PostScheduleCheck, { children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(post_panel_row_default, { label: (0, import_i18n167.__)("Publish"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
      import_components158.Dropdown,
      {
        popoverProps,
        focusOnMount: true,
        className: "editor-post-schedule__panel-dropdown",
        contentClassName: "editor-post-schedule__dialog",
        renderToggle: ({ onToggle, isOpen }) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
          import_components158.Button,
          {
            size: "compact",
            className: "editor-post-schedule__dialog-toggle",
            variant: "tertiary",
            tooltipPosition: "middle left",
            onClick: onToggle,
            "aria-label": (0, import_i18n167.sprintf)(
              // translators: %s: Current post date.
              (0, import_i18n167.__)("Change date: %s"),
              label
            ),
            label: fullLabel,
            showTooltip: label !== fullLabel,
            "aria-expanded": isOpen,
            children: label
          }
        ),
        renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(PostSchedule, { onClose })
      }
    ) }) });
  }

  // packages/editor/build-module/components/post-switch-to-draft-button/index.mjs
  var import_components159 = __toESM(require_components(), 1);
  var import_i18n168 = __toESM(require_i18n(), 1);
  var import_data151 = __toESM(require_data(), 1);
  var import_element122 = __toESM(require_element(), 1);
  var import_deprecated9 = __toESM(require_deprecated(), 1);
  var import_jsx_runtime275 = __toESM(require_jsx_runtime(), 1);
  function PostSwitchToDraftButton() {
    (0, import_deprecated9.default)("wp.editor.PostSwitchToDraftButton", {
      since: "6.7",
      version: "6.9"
    });
    const [showConfirmDialog, setShowConfirmDialog] = (0, import_element122.useState)(false);
    const { editPost: editPost2, savePost: savePost2 } = (0, import_data151.useDispatch)(store);
    const { isSaving, isPublished, isScheduled } = (0, import_data151.useSelect)((select5) => {
      const { isSavingPost: isSavingPost2, isCurrentPostPublished: isCurrentPostPublished2, isCurrentPostScheduled: isCurrentPostScheduled2 } = select5(store);
      return {
        isSaving: isSavingPost2(),
        isPublished: isCurrentPostPublished2(),
        isScheduled: isCurrentPostScheduled2()
      };
    }, []);
    const isDisabled = isSaving || !isPublished && !isScheduled;
    let alertMessage;
    let confirmButtonText;
    if (isPublished) {
      alertMessage = (0, import_i18n168.__)("Are you sure you want to unpublish this post?");
      confirmButtonText = (0, import_i18n168.__)("Unpublish");
    } else if (isScheduled) {
      alertMessage = (0, import_i18n168.__)("Are you sure you want to unschedule this post?");
      confirmButtonText = (0, import_i18n168.__)("Unschedule");
    }
    const handleConfirm = () => {
      setShowConfirmDialog(false);
      editPost2({ status: "draft" });
      savePost2();
    };
    return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(import_jsx_runtime275.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
        import_components159.Button,
        {
          __next40pxDefaultSize: true,
          className: "editor-post-switch-to-draft",
          onClick: () => {
            if (!isDisabled) {
              setShowConfirmDialog(true);
            }
          },
          "aria-disabled": isDisabled,
          variant: "secondary",
          style: { flexGrow: "1", justifyContent: "center" },
          children: (0, import_i18n168.__)("Switch to draft")
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
        import_components159.__experimentalConfirmDialog,
        {
          isOpen: showConfirmDialog,
          onConfirm: handleConfirm,
          onCancel: () => setShowConfirmDialog(false),
          confirmButtonText,
          children: alertMessage
        }
      )
    ] });
  }

  // packages/editor/build-module/components/post-sync-status/index.mjs
  var import_data152 = __toESM(require_data(), 1);
  var import_i18n169 = __toESM(require_i18n(), 1);
  var import_jsx_runtime276 = __toESM(require_jsx_runtime(), 1);
  function PostSyncStatus() {
    const { syncStatus, postType: postType2 } = (0, import_data152.useSelect)((select5) => {
      const { getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
      const meta2 = getEditedPostAttribute2("meta");
      const currentSyncStatus = meta2?.wp_pattern_sync_status === "unsynced" ? "unsynced" : getEditedPostAttribute2("wp_pattern_sync_status");
      return {
        syncStatus: currentSyncStatus,
        postType: getEditedPostAttribute2("type")
      };
    });
    if (postType2 !== "wp_block") {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(post_panel_row_default, { label: (0, import_i18n169.__)("Sync status"), children: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("div", { className: "editor-post-sync-status__value", children: syncStatus === "unsynced" ? (0, import_i18n169._x)("Not synced", "pattern (singular)") : (0, import_i18n169._x)("Synced", "pattern (singular)") }) });
  }

  // packages/editor/build-module/components/post-taxonomies/index.mjs
  var import_element123 = __toESM(require_element(), 1);
  var import_data153 = __toESM(require_data(), 1);
  var import_core_data92 = __toESM(require_core_data(), 1);
  var import_jsx_runtime277 = __toESM(require_jsx_runtime(), 1);
  var identity2 = (x2) => x2;
  function PostTaxonomies({ taxonomyWrapper = identity2 }) {
    const { postType: postType2, taxonomies } = (0, import_data153.useSelect)((select5) => {
      return {
        postType: select5(store).getCurrentPostType(),
        taxonomies: select5(import_core_data92.store).getEntityRecords(
          "root",
          "taxonomy",
          { per_page: -1 }
        )
      };
    }, []);
    const visibleTaxonomies = (taxonomies ?? []).filter(
      (taxonomy) => (
        // In some circumstances .visibility can end up as undefined so optional chaining operator required.
        // https://github.com/WordPress/gutenberg/issues/40326
        taxonomy.types.includes(postType2) && taxonomy.visibility?.show_ui
      )
    );
    return visibleTaxonomies.map((taxonomy) => {
      const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector_default : flat_term_selector_default;
      return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(import_element123.Fragment, { children: taxonomyWrapper(
        /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(TaxonomyComponent, { slug: taxonomy.slug }),
        taxonomy
      ) }, `taxonomy-${taxonomy.slug}`);
    });
  }
  var post_taxonomies_default = PostTaxonomies;

  // packages/editor/build-module/components/post-taxonomies/check.mjs
  var import_data154 = __toESM(require_data(), 1);
  var import_core_data93 = __toESM(require_core_data(), 1);
  function PostTaxonomiesCheck({ children }) {
    const hasTaxonomies = (0, import_data154.useSelect)((select5) => {
      const postType2 = select5(store).getCurrentPostType();
      const taxonomies = select5(import_core_data93.store).getEntityRecords(
        "root",
        "taxonomy",
        { per_page: -1 }
      );
      return taxonomies?.some(
        (taxonomy) => taxonomy.types.includes(postType2)
      );
    }, []);
    if (!hasTaxonomies) {
      return null;
    }
    return children;
  }

  // packages/editor/build-module/components/post-taxonomies/panel.mjs
  var import_components160 = __toESM(require_components(), 1);
  var import_data155 = __toESM(require_data(), 1);
  var import_jsx_runtime278 = __toESM(require_jsx_runtime(), 1);
  function TaxonomyPanel({ taxonomy, children }) {
    const slug = taxonomy?.slug;
    const panelName = slug ? `taxonomy-panel-${slug}` : "";
    const { isEnabled, isOpened } = (0, import_data155.useSelect)(
      (select5) => {
        const { isEditorPanelEnabled: isEditorPanelEnabled2, isEditorPanelOpened: isEditorPanelOpened2 } = select5(store);
        return {
          isEnabled: slug ? isEditorPanelEnabled2(panelName) : false,
          isOpened: slug ? isEditorPanelOpened2(panelName) : false
        };
      },
      [panelName, slug]
    );
    const { toggleEditorPanelOpened: toggleEditorPanelOpened2 } = (0, import_data155.useDispatch)(store);
    if (!isEnabled) {
      return null;
    }
    const taxonomyMenuName = taxonomy?.labels?.menu_name;
    if (!taxonomyMenuName) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
      import_components160.PanelBody,
      {
        title: taxonomyMenuName,
        opened: isOpened,
        onToggle: () => toggleEditorPanelOpened2(panelName),
        children
      }
    );
  }
  function PostTaxonomies2() {
    return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(PostTaxonomiesCheck, { children: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
      post_taxonomies_default,
      {
        taxonomyWrapper: (content, taxonomy) => {
          return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(TaxonomyPanel, { taxonomy, children: content });
        }
      }
    ) });
  }

  // packages/editor/build-module/components/post-text-editor/index.mjs
  var import_react_autosize_textarea = __toESM(require_lib(), 1);
  var import_i18n170 = __toESM(require_i18n(), 1);
  var import_core_data94 = __toESM(require_core_data(), 1);
  var import_element124 = __toESM(require_element(), 1);
  var import_blocks26 = __toESM(require_blocks(), 1);
  var import_data156 = __toESM(require_data(), 1);
  var import_compose38 = __toESM(require_compose(), 1);
  var import_components161 = __toESM(require_components(), 1);
  var import_jsx_runtime279 = __toESM(require_jsx_runtime(), 1);
  function PostTextEditor() {
    const instanceId = (0, import_compose38.useInstanceId)(PostTextEditor);
    const { content, blocks, type, id } = (0, import_data156.useSelect)((select5) => {
      const { getEditedEntityRecord } = select5(import_core_data94.store);
      const { getCurrentPostType: getCurrentPostType2, getCurrentPostId: getCurrentPostId2 } = select5(store);
      const _type = getCurrentPostType2();
      const _id = getCurrentPostId2();
      const editedRecord = getEditedEntityRecord("postType", _type, _id);
      return {
        content: editedRecord?.content,
        blocks: editedRecord?.blocks,
        type: _type,
        id: _id
      };
    }, []);
    const { editEntityRecord } = (0, import_data156.useDispatch)(import_core_data94.store);
    const value = (0, import_element124.useMemo)(() => {
      if (content instanceof Function) {
        return content({ blocks });
      } else if (blocks) {
        return (0, import_blocks26.__unstableSerializeAndClean)(blocks);
      }
      return content;
    }, [content, blocks]);
    return /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(import_jsx_runtime279.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
        import_components161.VisuallyHidden,
        {
          as: "label",
          htmlFor: `post-content-${instanceId}`,
          children: (0, import_i18n170.__)("Type text or HTML")
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
        import_react_autosize_textarea.default,
        {
          autoComplete: "off",
          dir: "auto",
          value,
          onChange: (event) => {
            editEntityRecord("postType", type, id, {
              content: event.target.value,
              blocks: void 0,
              selection: void 0
            });
          },
          className: "editor-post-text-editor",
          id: `post-content-${instanceId}`,
          placeholder: (0, import_i18n170.__)("Start writing with text or HTML")
        }
      )
    ] });
  }

  // packages/editor/build-module/components/post-title/index.mjs
  var import_i18n171 = __toESM(require_i18n(), 1);
  var import_element126 = __toESM(require_element(), 1);
  var import_html_entities24 = __toESM(require_html_entities(), 1);
  var import_data159 = __toESM(require_data(), 1);
  var import_block_editor58 = __toESM(require_block_editor(), 1);
  var import_keycodes12 = __toESM(require_keycodes(), 1);
  var import_blocks27 = __toESM(require_blocks(), 1);
  var import_rich_text2 = __toESM(require_rich_text(), 1);
  var import_compose39 = __toESM(require_compose(), 1);
  var import_dom2 = __toESM(require_dom(), 1);

  // packages/editor/build-module/components/post-title/constants.mjs
  var DEFAULT_CLASSNAMES = "wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text";
  var REGEXP_NEWLINES = /[\r\n]+/g;

  // packages/editor/build-module/components/post-title/use-post-title-focus.mjs
  var import_element125 = __toESM(require_element(), 1);
  var import_data157 = __toESM(require_data(), 1);
  function usePostTitleFocus(forwardedRef) {
    const ref = (0, import_element125.useRef)();
    const { isCleanNewPost: isCleanNewPost2 } = (0, import_data157.useSelect)((select5) => {
      const { isCleanNewPost: _isCleanNewPost } = select5(store);
      return {
        isCleanNewPost: _isCleanNewPost()
      };
    }, []);
    (0, import_element125.useImperativeHandle)(forwardedRef, () => ({
      focus: () => {
        ref?.current?.focus();
      }
    }));
    (0, import_element125.useEffect)(() => {
      if (!ref.current) {
        return;
      }
      const { defaultView } = ref.current.ownerDocument;
      const { name: name2, parent } = defaultView;
      const ownerDocument = name2 === "editor-canvas" ? parent.document : defaultView.document;
      const { activeElement, body } = ownerDocument;
      if (isCleanNewPost2 && (!activeElement || body === activeElement)) {
        ref.current.focus();
      }
    }, [isCleanNewPost2]);
    return { ref };
  }

  // packages/editor/build-module/components/post-title/use-post-title.mjs
  var import_data158 = __toESM(require_data(), 1);
  function usePostTitle() {
    const { editPost: editPost2 } = (0, import_data158.useDispatch)(store);
    const { title } = (0, import_data158.useSelect)((select5) => {
      const { getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
      return {
        title: getEditedPostAttribute2("title")
      };
    }, []);
    function updateTitle(newTitle) {
      editPost2({ title: newTitle });
    }
    return { title, setTitle: updateTitle };
  }

  // packages/editor/build-module/components/post-title/index.mjs
  var import_jsx_runtime280 = __toESM(require_jsx_runtime(), 1);
  var PostTitle = (0, import_element126.forwardRef)((_, forwardedRef) => {
    const { placeholder, isEditingContentOnlySection } = (0, import_data159.useSelect)(
      (select5) => {
        const { getSettings: getSettings5, getEditedContentOnlySection } = unlock(
          select5(import_block_editor58.store)
        );
        const { titlePlaceholder } = getSettings5();
        return {
          placeholder: titlePlaceholder,
          isEditingContentOnlySection: !!getEditedContentOnlySection()
        };
      },
      []
    );
    const [isSelected, setIsSelected] = (0, import_element126.useState)(false);
    const { ref: focusRef } = usePostTitleFocus(forwardedRef);
    const { title, setTitle: onUpdate } = usePostTitle();
    const [selection, setSelection] = (0, import_element126.useState)({});
    const { clearSelectedBlock: clearSelectedBlock2, insertBlocks: insertBlocks2, insertDefaultBlock: insertDefaultBlock2 } = (0, import_data159.useDispatch)(import_block_editor58.store);
    const decodedPlaceholder = (0, import_html_entities24.decodeEntities)(placeholder) || (0, import_i18n171.__)("Add title");
    const {
      value,
      onChange,
      ref: richTextRef
    } = (0, import_rich_text2.__unstableUseRichText)({
      value: title,
      onChange(newValue) {
        onUpdate(newValue.replace(REGEXP_NEWLINES, " "));
      },
      placeholder: decodedPlaceholder,
      selectionStart: selection.start,
      selectionEnd: selection.end,
      onSelectionChange(newStart, newEnd) {
        setSelection((sel) => {
          const { start, end } = sel;
          if (start === newStart && end === newEnd) {
            return sel;
          }
          return {
            start: newStart,
            end: newEnd
          };
        });
      },
      __unstableDisableFormats: false
    });
    function onInsertBlockAfter(blocks) {
      insertBlocks2(blocks, 0);
    }
    function onSelect() {
      setIsSelected(true);
      clearSelectedBlock2();
    }
    function onUnselect() {
      setIsSelected(false);
      setSelection({});
    }
    function onEnterPress() {
      insertDefaultBlock2(void 0, void 0, 0);
    }
    function onKeyDown(event) {
      if (event.keyCode === import_keycodes12.ENTER) {
        event.preventDefault();
        onEnterPress();
      }
    }
    function onPaste(event) {
      const clipboardData = event.clipboardData;
      let plainText = "";
      let html = "";
      try {
        plainText = clipboardData.getData("text/plain");
        html = clipboardData.getData("text/html");
      } catch (error) {
        return;
      }
      window.console.log("Received HTML:\n\n", html);
      window.console.log("Received plain text:\n\n", plainText);
      const content = (0, import_blocks27.pasteHandler)({
        HTML: html,
        plainText
      });
      event.preventDefault();
      if (!content.length) {
        return;
      }
      if (typeof content !== "string") {
        const [firstBlock] = content;
        if (!title && (firstBlock.name === "core/heading" || firstBlock.name === "core/paragraph")) {
          const contentNoHTML = (0, import_dom2.__unstableStripHTML)(
            firstBlock.attributes.content
          );
          onUpdate(contentNoHTML);
          onInsertBlockAfter(content.slice(1));
        } else {
          onInsertBlockAfter(content);
        }
      } else {
        const contentNoHTML = (0, import_dom2.__unstableStripHTML)(content);
        onChange((0, import_rich_text2.insert)(value, (0, import_rich_text2.create)({ html: contentNoHTML })));
      }
    }
    const className = clsx_default(DEFAULT_CLASSNAMES, {
      "is-selected": isSelected
    });
    const style = isEditingContentOnlySection ? { opacity: 0.2 } : void 0;
    return (
      /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
      /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
        "h1",
        {
          ref: (0, import_compose39.useMergeRefs)([richTextRef, focusRef]),
          contentEditable: !isEditingContentOnlySection,
          className,
          "aria-label": decodedPlaceholder,
          role: "textbox",
          "aria-multiline": "true",
          onFocus: onSelect,
          onBlur: onUnselect,
          onKeyDown,
          onPaste,
          style
        }
      )
    );
  });
  var post_title_default = (0, import_element126.forwardRef)((_, forwardedRef) => /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(post_type_support_check_default, { supportKeys: "title", children: /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(PostTitle, { ref: forwardedRef }) }));

  // packages/editor/build-module/components/post-title/post-title-raw.mjs
  var import_components162 = __toESM(require_components(), 1);
  var import_i18n172 = __toESM(require_i18n(), 1);
  var import_html_entities25 = __toESM(require_html_entities(), 1);
  var import_data160 = __toESM(require_data(), 1);
  var import_block_editor59 = __toESM(require_block_editor(), 1);
  var import_element127 = __toESM(require_element(), 1);
  var import_jsx_runtime281 = __toESM(require_jsx_runtime(), 1);
  function PostTitleRaw(_, forwardedRef) {
    const { placeholder } = (0, import_data160.useSelect)((select5) => {
      const { getSettings: getSettings5 } = select5(import_block_editor59.store);
      const { titlePlaceholder } = getSettings5();
      return {
        placeholder: titlePlaceholder
      };
    }, []);
    const [isSelected, setIsSelected] = (0, import_element127.useState)(false);
    const { title, setTitle: onUpdate } = usePostTitle();
    const { ref: focusRef } = usePostTitleFocus(forwardedRef);
    function onChange(value) {
      onUpdate(value.replace(REGEXP_NEWLINES, " "));
    }
    function onSelect() {
      setIsSelected(true);
    }
    function onUnselect() {
      setIsSelected(false);
    }
    const className = clsx_default(DEFAULT_CLASSNAMES, {
      "is-selected": isSelected,
      "is-raw-text": true
    });
    const decodedPlaceholder = (0, import_html_entities25.decodeEntities)(placeholder) || (0, import_i18n172.__)("Add title");
    return /* @__PURE__ */ (0, import_jsx_runtime281.jsx)(
      import_components162.TextareaControl,
      {
        ref: focusRef,
        value: title,
        onChange,
        onFocus: onSelect,
        onBlur: onUnselect,
        label: placeholder,
        className,
        placeholder: decodedPlaceholder,
        hideLabelFromVision: true,
        autoComplete: "off",
        dir: "auto",
        rows: 1
      }
    );
  }
  var post_title_raw_default = (0, import_element127.forwardRef)(PostTitleRaw);

  // packages/editor/build-module/components/post-trash/index.mjs
  var import_i18n173 = __toESM(require_i18n(), 1);
  var import_components163 = __toESM(require_components(), 1);
  var import_data162 = __toESM(require_data(), 1);
  var import_element128 = __toESM(require_element(), 1);

  // packages/editor/build-module/components/post-trash/check.mjs
  var import_data161 = __toESM(require_data(), 1);
  var import_core_data95 = __toESM(require_core_data(), 1);
  function PostTrashCheck({ children }) {
    const { canTrashPost } = (0, import_data161.useSelect)((select5) => {
      const { isEditedPostNew: isEditedPostNew2, getCurrentPostId: getCurrentPostId2, getCurrentPostType: getCurrentPostType2 } = select5(store);
      const { canUser } = select5(import_core_data95.store);
      const postType2 = getCurrentPostType2();
      const postId2 = getCurrentPostId2();
      const isNew = isEditedPostNew2();
      const canUserDelete = !!postId2 ? canUser("delete", {
        kind: "postType",
        name: postType2,
        id: postId2
      }) : false;
      return {
        canTrashPost: (!isNew || postId2) && canUserDelete && !GLOBAL_POST_TYPES.includes(postType2)
      };
    }, []);
    if (!canTrashPost) {
      return null;
    }
    return children;
  }

  // packages/editor/build-module/components/post-trash/index.mjs
  var import_jsx_runtime282 = __toESM(require_jsx_runtime(), 1);
  function PostTrash({ onActionPerformed }) {
    const registry = (0, import_data162.useRegistry)();
    const { isNew, isDeleting, postId: postId2, title } = (0, import_data162.useSelect)((select5) => {
      const store3 = select5(store);
      return {
        isNew: store3.isEditedPostNew(),
        isDeleting: store3.isDeletingPost(),
        postId: store3.getCurrentPostId(),
        title: store3.getCurrentPostAttribute("title")
      };
    }, []);
    const { trashPost: trashPost3 } = (0, import_data162.useDispatch)(store);
    const [showConfirmDialog, setShowConfirmDialog] = (0, import_element128.useState)(false);
    if (isNew || !postId2) {
      return null;
    }
    const handleConfirm = async () => {
      setShowConfirmDialog(false);
      await trashPost3();
      const item = await registry.resolveSelect(store).getCurrentPost();
      onActionPerformed?.("move-to-trash", [item]);
    };
    return /* @__PURE__ */ (0, import_jsx_runtime282.jsxs)(PostTrashCheck, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
        import_components163.Button,
        {
          __next40pxDefaultSize: true,
          className: "editor-post-trash",
          isDestructive: true,
          variant: "secondary",
          isBusy: isDeleting,
          "aria-disabled": isDeleting,
          onClick: isDeleting ? void 0 : () => setShowConfirmDialog(true),
          children: (0, import_i18n173.__)("Move to trash")
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
        import_components163.__experimentalConfirmDialog,
        {
          isOpen: showConfirmDialog,
          onConfirm: handleConfirm,
          onCancel: () => setShowConfirmDialog(false),
          confirmButtonText: (0, import_i18n173.__)("Move to trash"),
          size: "small",
          children: (0, import_i18n173.sprintf)(
            // translators: %s: The item's title.
            (0, import_i18n173.__)('Are you sure you want to move "%s" to the trash?'),
            title
          )
        }
      )
    ] });
  }

  // packages/editor/build-module/components/post-url/index.mjs
  var import_data163 = __toESM(require_data(), 1);
  var import_url16 = __toESM(require_url(), 1);
  var import_element129 = __toESM(require_element(), 1);
  var import_block_editor60 = __toESM(require_block_editor(), 1);
  var import_i18n174 = __toESM(require_i18n(), 1);
  var import_components164 = __toESM(require_components(), 1);
  var import_notices25 = __toESM(require_notices(), 1);
  var import_core_data96 = __toESM(require_core_data(), 1);
  var import_compose40 = __toESM(require_compose(), 1);
  var import_jsx_runtime283 = __toESM(require_jsx_runtime(), 1);
  function PostURL({ onClose }) {
    const {
      isEditable,
      postSlug,
      postLink,
      permalinkPrefix,
      permalinkSuffix,
      permalink
    } = (0, import_data163.useSelect)((select5) => {
      const post2 = select5(store).getCurrentPost();
      const postTypeSlug = select5(store).getCurrentPostType();
      const postType2 = select5(import_core_data96.store).getPostType(postTypeSlug);
      const permalinkParts = select5(store).getPermalinkParts();
      const hasPublishAction = post2?._links?.["wp:action-publish"] ?? false;
      return {
        isEditable: select5(store).isPermalinkEditable() && hasPublishAction,
        postSlug: (0, import_url16.safeDecodeURIComponent)(
          select5(store).getEditedPostSlug()
        ),
        viewPostLabel: postType2?.labels.view_item,
        postLink: post2.link,
        permalinkPrefix: permalinkParts?.prefix,
        permalinkSuffix: permalinkParts?.suffix,
        permalink: (0, import_url16.safeDecodeURIComponent)(
          select5(store).getPermalink()
        )
      };
    }, []);
    const { editPost: editPost2 } = (0, import_data163.useDispatch)(store);
    const { createNotice } = (0, import_data163.useDispatch)(import_notices25.store);
    const [forceEmptyField, setForceEmptyField] = (0, import_element129.useState)(false);
    const copyButtonRef = (0, import_compose40.useCopyToClipboard)(permalink, () => {
      createNotice("info", (0, import_i18n174.__)("Copied Permalink to clipboard."), {
        isDismissible: true,
        type: "snackbar"
      });
    });
    const postUrlSlugDescriptionId = "editor-post-url__slug-description-" + (0, import_compose40.useInstanceId)(PostURL);
    return /* @__PURE__ */ (0, import_jsx_runtime283.jsxs)("div", { className: "editor-post-url", children: [
      /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
        import_block_editor60.__experimentalInspectorPopoverHeader,
        {
          title: (0, import_i18n174.__)("Slug"),
          onClose
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime283.jsxs)(import_components164.__experimentalVStack, { spacing: 3, children: [
        isEditable && /* @__PURE__ */ (0, import_jsx_runtime283.jsx)("p", { className: "editor-post-url__intro", children: (0, import_element129.createInterpolateElement)(
          (0, import_i18n174.__)(
            "<span>Customize the last part of the Permalink.</span> <a>Learn more.</a>"
          ),
          {
            span: /* @__PURE__ */ (0, import_jsx_runtime283.jsx)("span", { id: postUrlSlugDescriptionId }),
            a: /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
              import_components164.ExternalLink,
              {
                href: (0, import_i18n174.__)(
                  "https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink"
                )
              }
            )
          }
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime283.jsxs)("div", { children: [
          isEditable && /* @__PURE__ */ (0, import_jsx_runtime283.jsxs)(import_jsx_runtime283.Fragment, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
              import_components164.__experimentalInputControl,
              {
                __next40pxDefaultSize: true,
                prefix: /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(import_components164.__experimentalInputControlPrefixWrapper, { children: "/" }),
                suffix: /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(import_components164.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
                  import_components164.Button,
                  {
                    icon: copy_small_default,
                    ref: copyButtonRef,
                    size: "small",
                    label: "Copy"
                  }
                ) }),
                label: (0, import_i18n174.__)("Slug"),
                hideLabelFromVision: true,
                value: forceEmptyField ? "" : postSlug,
                autoComplete: "off",
                spellCheck: "false",
                type: "text",
                className: "editor-post-url__input",
                onChange: (newValue) => {
                  editPost2({ slug: newValue });
                  if (!newValue) {
                    if (!forceEmptyField) {
                      setForceEmptyField(true);
                    }
                    return;
                  }
                  if (forceEmptyField) {
                    setForceEmptyField(false);
                  }
                },
                onBlur: (event) => {
                  editPost2({
                    slug: (0, import_url16.cleanForSlug)(
                      event.target.value
                    )
                  });
                  if (forceEmptyField) {
                    setForceEmptyField(false);
                  }
                },
                "aria-describedby": postUrlSlugDescriptionId
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime283.jsxs)("p", { className: "editor-post-url__permalink", children: [
              /* @__PURE__ */ (0, import_jsx_runtime283.jsx)("span", { className: "editor-post-url__permalink-visual-label", children: (0, import_i18n174.__)("Permalink:") }),
              /* @__PURE__ */ (0, import_jsx_runtime283.jsxs)(
                import_components164.ExternalLink,
                {
                  className: "editor-post-url__link",
                  href: postLink,
                  target: "_blank",
                  children: [
                    /* @__PURE__ */ (0, import_jsx_runtime283.jsx)("span", { className: "editor-post-url__link-prefix", children: permalinkPrefix }),
                    /* @__PURE__ */ (0, import_jsx_runtime283.jsx)("span", { className: "editor-post-url__link-slug", children: postSlug }),
                    /* @__PURE__ */ (0, import_jsx_runtime283.jsx)("span", { className: "editor-post-url__link-suffix", children: permalinkSuffix })
                  ]
                }
              )
            ] })
          ] }),
          !isEditable && /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
            import_components164.ExternalLink,
            {
              className: "editor-post-url__link",
              href: postLink,
              target: "_blank",
              children: postLink
            }
          )
        ] })
      ] })
    ] });
  }

  // packages/editor/build-module/components/post-url/check.mjs
  var import_data164 = __toESM(require_data(), 1);
  var import_core_data97 = __toESM(require_core_data(), 1);
  function PostURLCheck({ children }) {
    const isVisible = (0, import_data164.useSelect)((select5) => {
      const postTypeSlug = select5(store).getCurrentPostType();
      const postType2 = select5(import_core_data97.store).getPostType(postTypeSlug);
      if (!postType2?.viewable) {
        return false;
      }
      const post2 = select5(store).getCurrentPost();
      if (!post2.link) {
        return false;
      }
      const permalinkParts = select5(store).getPermalinkParts();
      if (!permalinkParts) {
        return false;
      }
      return true;
    }, []);
    if (!isVisible) {
      return null;
    }
    return children;
  }

  // packages/editor/build-module/components/post-url/label.mjs
  var import_data165 = __toESM(require_data(), 1);
  var import_url17 = __toESM(require_url(), 1);
  function PostURLLabel() {
    return usePostURLLabel();
  }
  function usePostURLLabel() {
    const postLink = (0, import_data165.useSelect)(
      (select5) => select5(store).getPermalink(),
      []
    );
    return (0, import_url17.filterURLForDisplay)((0, import_url17.safeDecodeURIComponent)(postLink));
  }

  // packages/editor/build-module/components/post-url/panel.mjs
  var import_element130 = __toESM(require_element(), 1);
  var import_data166 = __toESM(require_data(), 1);
  var import_components165 = __toESM(require_components(), 1);
  var import_i18n175 = __toESM(require_i18n(), 1);
  var import_url18 = __toESM(require_url(), 1);
  var import_core_data98 = __toESM(require_core_data(), 1);
  var import_jsx_runtime284 = __toESM(require_jsx_runtime(), 1);
  function PostURLPanel() {
    const { isFrontPage } = (0, import_data166.useSelect)((select5) => {
      const { getCurrentPostId: getCurrentPostId2 } = select5(store);
      const { getEditedEntityRecord, canUser } = select5(import_core_data98.store);
      const siteSettings = canUser("read", {
        kind: "root",
        name: "site"
      }) ? getEditedEntityRecord("root", "site") : void 0;
      const _id = getCurrentPostId2();
      return {
        isFrontPage: siteSettings?.page_on_front === _id
      };
    }, []);
    const [popoverAnchor, setPopoverAnchor] = (0, import_element130.useState)(null);
    const popoverProps = (0, import_element130.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor]
    );
    const label = isFrontPage ? (0, import_i18n175.__)("Link") : (0, import_i18n175.__)("Slug");
    return /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(PostURLCheck, { children: /* @__PURE__ */ (0, import_jsx_runtime284.jsxs)(post_panel_row_default, { label, ref: setPopoverAnchor, children: [
      !isFrontPage && /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
        import_components165.Dropdown,
        {
          popoverProps,
          className: "editor-post-url__panel-dropdown",
          contentClassName: "editor-post-url__panel-dialog",
          focusOnMount: true,
          renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
            PostURLToggle,
            {
              isOpen,
              onClick: onToggle
            }
          ),
          renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(PostURL, { onClose })
        }
      ),
      isFrontPage && /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(FrontPageLink, {})
    ] }) });
  }
  function PostURLToggle({ isOpen, onClick }) {
    const { slug } = (0, import_data166.useSelect)((select5) => {
      return {
        slug: select5(store).getEditedPostSlug()
      };
    }, []);
    const decodedSlug = (0, import_url18.safeDecodeURIComponent)(slug);
    return /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
      import_components165.Button,
      {
        size: "compact",
        className: "editor-post-url__panel-toggle",
        variant: "tertiary",
        "aria-expanded": isOpen,
        "aria-label": (
          // translators: %s: Current post link.
          (0, import_i18n175.sprintf)((0, import_i18n175.__)("Change link: %s"), decodedSlug)
        ),
        onClick,
        children: /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(import_jsx_runtime284.Fragment, { children: decodedSlug })
      }
    );
  }
  function FrontPageLink() {
    const { postLink } = (0, import_data166.useSelect)((select5) => {
      const { getCurrentPost: getCurrentPost2 } = select5(store);
      return {
        postLink: getCurrentPost2()?.link
      };
    }, []);
    return /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
      import_components165.ExternalLink,
      {
        className: "editor-post-url__front-page-link",
        href: postLink,
        target: "_blank",
        children: postLink
      }
    );
  }

  // packages/editor/build-module/components/post-visibility/check.mjs
  var import_data167 = __toESM(require_data(), 1);
  function PostVisibilityCheck({ render }) {
    const canEdit = (0, import_data167.useSelect)((select5) => {
      return select5(store).getCurrentPost()._links?.["wp:action-publish"] ?? false;
    });
    return render({ canEdit });
  }

  // packages/editor/build-module/components/table-of-contents/index.mjs
  var import_i18n179 = __toESM(require_i18n(), 1);
  var import_components166 = __toESM(require_components(), 1);
  var import_data172 = __toESM(require_data(), 1);
  var import_element132 = __toESM(require_element(), 1);
  var import_block_editor62 = __toESM(require_block_editor(), 1);

  // packages/editor/build-module/components/table-of-contents/panel.mjs
  var import_i18n178 = __toESM(require_i18n(), 1);
  var import_data171 = __toESM(require_data(), 1);
  var import_block_editor61 = __toESM(require_block_editor(), 1);

  // packages/editor/build-module/components/word-count/index.mjs
  var import_data168 = __toESM(require_data(), 1);
  var import_i18n176 = __toESM(require_i18n(), 1);
  var import_wordcount = __toESM(require_wordcount(), 1);
  var import_jsx_runtime285 = __toESM(require_jsx_runtime(), 1);
  function WordCount() {
    const content = (0, import_data168.useSelect)(
      (select5) => select5(store).getEditedPostAttribute("content"),
      []
    );
    const wordCountType = (0, import_i18n176._x)("words", "Word count type. Do not translate!");
    return /* @__PURE__ */ (0, import_jsx_runtime285.jsx)("span", { className: "word-count", children: (0, import_wordcount.count)(content, wordCountType) });
  }

  // packages/editor/build-module/components/time-to-read/index.mjs
  var import_data169 = __toESM(require_data(), 1);
  var import_i18n177 = __toESM(require_i18n(), 1);
  var import_wordcount2 = __toESM(require_wordcount(), 1);
  var import_element131 = __toESM(require_element(), 1);
  var import_jsx_runtime286 = __toESM(require_jsx_runtime(), 1);
  var AVERAGE_READING_RATE = 189;
  function TimeToRead() {
    const content = (0, import_data169.useSelect)(
      (select5) => select5(store).getEditedPostAttribute("content"),
      []
    );
    const wordCountType = (0, import_i18n177._x)("words", "Word count type. Do not translate!");
    const minutesToRead = Math.round(
      (0, import_wordcount2.count)(content, wordCountType) / AVERAGE_READING_RATE
    );
    const minutesToReadString = minutesToRead === 0 ? (0, import_element131.createInterpolateElement)((0, import_i18n177.__)("<span>< 1</span> minute"), {
      span: /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("span", {})
    }) : (0, import_element131.createInterpolateElement)(
      (0, import_i18n177.sprintf)(
        /* translators: %s: the number of minutes to read the post. */
        (0, import_i18n177._n)(
          "<span>%s</span> minute",
          "<span>%s</span> minutes",
          minutesToRead
        ),
        minutesToRead
      ),
      {
        span: /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("span", {})
      }
    );
    return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("span", { className: "time-to-read", children: minutesToReadString });
  }

  // packages/editor/build-module/components/character-count/index.mjs
  var import_data170 = __toESM(require_data(), 1);
  var import_wordcount3 = __toESM(require_wordcount(), 1);
  function CharacterCount() {
    const content = (0, import_data170.useSelect)(
      (select5) => select5(store).getEditedPostAttribute("content"),
      []
    );
    return (0, import_wordcount3.count)(content, "characters_including_spaces");
  }

  // packages/editor/build-module/components/table-of-contents/panel.mjs
  var import_jsx_runtime287 = __toESM(require_jsx_runtime(), 1);
  function TableOfContentsPanel({ hasOutlineItemsDisabled, onRequestClose }) {
    const { headingCount, paragraphCount, numberOfBlocks } = (0, import_data171.useSelect)(
      (select5) => {
        const { getGlobalBlockCount: getGlobalBlockCount2 } = select5(import_block_editor61.store);
        return {
          headingCount: getGlobalBlockCount2("core/heading"),
          paragraphCount: getGlobalBlockCount2("core/paragraph"),
          numberOfBlocks: getGlobalBlockCount2()
        };
      },
      []
    );
    return (
      /*
       * Disable reason: The `list` ARIA role is redundant but
       * Safari+VoiceOver won't announce the list otherwise.
       */
      /* eslint-disable jsx-a11y/no-redundant-roles */
      /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)(import_jsx_runtime287.Fragment, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
          "div",
          {
            className: "table-of-contents__wrapper",
            role: "note",
            "aria-label": (0, import_i18n178.__)("Document Statistics"),
            tabIndex: "0",
            children: /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("ul", { role: "list", className: "table-of-contents__counts", children: [
              /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("li", { className: "table-of-contents__count", children: [
                (0, import_i18n178.__)("Words"),
                /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(WordCount, {})
              ] }),
              /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("li", { className: "table-of-contents__count", children: [
                (0, import_i18n178.__)("Characters"),
                /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("span", { className: "table-of-contents__number", children: /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(CharacterCount, {}) })
              ] }),
              /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("li", { className: "table-of-contents__count", children: [
                (0, import_i18n178.__)("Time to read"),
                /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(TimeToRead, {})
              ] }),
              /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("li", { className: "table-of-contents__count", children: [
                (0, import_i18n178.__)("Headings"),
                /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("span", { className: "table-of-contents__number", children: headingCount })
              ] }),
              /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("li", { className: "table-of-contents__count", children: [
                (0, import_i18n178.__)("Paragraphs"),
                /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("span", { className: "table-of-contents__number", children: paragraphCount })
              ] }),
              /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("li", { className: "table-of-contents__count", children: [
                (0, import_i18n178.__)("Blocks"),
                /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("span", { className: "table-of-contents__number", children: numberOfBlocks })
              ] })
            ] })
          }
        ),
        headingCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)(import_jsx_runtime287.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("hr", {}),
          /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("h2", { className: "table-of-contents__title", children: (0, import_i18n178.__)("Document Outline") }),
          /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
            DocumentOutline,
            {
              onSelect: onRequestClose,
              hasOutlineItemsDisabled
            }
          )
        ] })
      ] })
    );
  }
  var panel_default3 = TableOfContentsPanel;

  // packages/editor/build-module/components/table-of-contents/index.mjs
  var import_jsx_runtime288 = __toESM(require_jsx_runtime(), 1);
  function TableOfContents({ hasOutlineItemsDisabled, repositionDropdown, ...props }, ref) {
    const hasBlocks = (0, import_data172.useSelect)(
      (select5) => !!select5(import_block_editor62.store).getBlockCount(),
      []
    );
    return /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
      import_components166.Dropdown,
      {
        popoverProps: {
          placement: repositionDropdown ? "right" : "bottom"
        },
        className: "table-of-contents",
        contentClassName: "table-of-contents__popover",
        renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
          import_components166.Button,
          {
            __next40pxDefaultSize: true,
            ...props,
            ref,
            onClick: hasBlocks ? onToggle : void 0,
            icon: info_default,
            "aria-expanded": isOpen,
            "aria-haspopup": "true",
            label: (0, import_i18n179.__)("Details"),
            tooltipPosition: "bottom",
            "aria-disabled": !hasBlocks
          }
        ),
        renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
          panel_default3,
          {
            onRequestClose: onClose,
            hasOutlineItemsDisabled
          }
        )
      }
    );
  }
  var table_of_contents_default = (0, import_element132.forwardRef)(TableOfContents);

  // packages/editor/build-module/components/unsaved-changes-warning/index.mjs
  var import_i18n180 = __toESM(require_i18n(), 1);
  var import_element133 = __toESM(require_element(), 1);
  var import_data173 = __toESM(require_data(), 1);
  var import_core_data99 = __toESM(require_core_data(), 1);
  function UnsavedChangesWarning() {
    const { __experimentalGetDirtyEntityRecords } = (0, import_data173.useSelect)(import_core_data99.store);
    (0, import_element133.useEffect)(() => {
      const warnIfUnsavedChanges = (event) => {
        const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
        if (dirtyEntityRecords.length > 0) {
          event.returnValue = (0, import_i18n180.__)(
            "You have unsaved changes. If you proceed, they will be lost."
          );
          return event.returnValue;
        }
      };
      window.addEventListener("beforeunload", warnIfUnsavedChanges);
      return () => {
        window.removeEventListener("beforeunload", warnIfUnsavedChanges);
      };
    }, [__experimentalGetDirtyEntityRecords]);
    return null;
  }

  // packages/editor/build-module/components/deprecated.mjs
  var import_deprecated10 = __toESM(require_deprecated(), 1);
  var import_element134 = __toESM(require_element(), 1);
  var import_block_editor63 = __toESM(require_block_editor(), 1);
  var import_server_side_render = __toESM(require_server_side_render(), 1);
  var import_jsx_runtime289 = __toESM(require_jsx_runtime(), 1);
  function deprecateComponent(name2, Wrapped, staticsToHoist = []) {
    const Component6 = (0, import_element134.forwardRef)((props, ref) => {
      (0, import_deprecated10.default)("wp.editor." + name2, {
        since: "5.3",
        alternative: "wp.blockEditor." + name2,
        version: "6.2"
      });
      return /* @__PURE__ */ (0, import_jsx_runtime289.jsx)(Wrapped, { ref, ...props });
    });
    staticsToHoist.forEach((staticName) => {
      Component6[staticName] = deprecateComponent(
        name2 + "." + staticName,
        Wrapped[staticName]
      );
    });
    return Component6;
  }
  function deprecateFunction(name2, func) {
    return (...args) => {
      (0, import_deprecated10.default)("wp.editor." + name2, {
        since: "5.3",
        alternative: "wp.blockEditor." + name2,
        version: "6.2"
      });
      return func(...args);
    };
  }
  var RichText = deprecateComponent("RichText", import_block_editor63.RichText, ["Content"]);
  RichText.isEmpty = deprecateFunction(
    "RichText.isEmpty",
    import_block_editor63.RichText.isEmpty
  );
  var Autocomplete = deprecateComponent(
    "Autocomplete",
    import_block_editor63.Autocomplete
  );
  var AlignmentToolbar = deprecateComponent(
    "AlignmentToolbar",
    import_block_editor63.AlignmentToolbar
  );
  var BlockAlignmentToolbar = deprecateComponent(
    "BlockAlignmentToolbar",
    import_block_editor63.BlockAlignmentToolbar
  );
  var BlockControls = deprecateComponent(
    "BlockControls",
    import_block_editor63.BlockControls,
    ["Slot"]
  );
  var BlockEdit = deprecateComponent("BlockEdit", import_block_editor63.BlockEdit);
  var BlockEditorKeyboardShortcuts2 = deprecateComponent(
    "BlockEditorKeyboardShortcuts",
    import_block_editor63.BlockEditorKeyboardShortcuts
  );
  var BlockFormatControls = deprecateComponent(
    "BlockFormatControls",
    import_block_editor63.BlockFormatControls,
    ["Slot"]
  );
  var BlockIcon3 = deprecateComponent("BlockIcon", import_block_editor63.BlockIcon);
  var BlockInspector = deprecateComponent(
    "BlockInspector",
    import_block_editor63.BlockInspector
  );
  var BlockList4 = deprecateComponent("BlockList", import_block_editor63.BlockList);
  var BlockMover = deprecateComponent("BlockMover", import_block_editor63.BlockMover);
  var BlockNavigationDropdown = deprecateComponent(
    "BlockNavigationDropdown",
    import_block_editor63.BlockNavigationDropdown
  );
  var BlockSelectionClearer = deprecateComponent(
    "BlockSelectionClearer",
    import_block_editor63.BlockSelectionClearer
  );
  var BlockSettingsMenu = deprecateComponent(
    "BlockSettingsMenu",
    import_block_editor63.BlockSettingsMenu
  );
  var BlockTitle = deprecateComponent("BlockTitle", import_block_editor63.BlockTitle);
  var BlockToolbar = deprecateComponent(
    "BlockToolbar",
    import_block_editor63.BlockToolbar
  );
  var ColorPalette2 = deprecateComponent(
    "ColorPalette",
    import_block_editor63.ColorPalette
  );
  var ContrastChecker = deprecateComponent(
    "ContrastChecker",
    import_block_editor63.ContrastChecker
  );
  var CopyHandler = deprecateComponent("CopyHandler", import_block_editor63.CopyHandler);
  var DefaultBlockAppender = deprecateComponent(
    "DefaultBlockAppender",
    import_block_editor63.DefaultBlockAppender
  );
  var FontSizePicker = deprecateComponent(
    "FontSizePicker",
    import_block_editor63.FontSizePicker
  );
  var Inserter = deprecateComponent("Inserter", import_block_editor63.Inserter);
  var InnerBlocks = deprecateComponent("InnerBlocks", import_block_editor63.InnerBlocks, [
    "ButtonBlockAppender",
    "DefaultBlockAppender",
    "Content"
  ]);
  var InspectorAdvancedControls = deprecateComponent(
    "InspectorAdvancedControls",
    import_block_editor63.InspectorAdvancedControls,
    ["Slot"]
  );
  var InspectorControls = deprecateComponent(
    "InspectorControls",
    import_block_editor63.InspectorControls,
    ["Slot"]
  );
  var PanelColorSettings = deprecateComponent(
    "PanelColorSettings",
    import_block_editor63.PanelColorSettings
  );
  var PlainText = deprecateComponent("PlainText", import_block_editor63.PlainText);
  var RichTextShortcut = deprecateComponent(
    "RichTextShortcut",
    import_block_editor63.RichTextShortcut
  );
  var RichTextToolbarButton = deprecateComponent(
    "RichTextToolbarButton",
    import_block_editor63.RichTextToolbarButton
  );
  var __unstableRichTextInputEvent = deprecateComponent(
    "__unstableRichTextInputEvent",
    import_block_editor63.__unstableRichTextInputEvent
  );
  var MediaPlaceholder = deprecateComponent(
    "MediaPlaceholder",
    import_block_editor63.MediaPlaceholder
  );
  var MediaUpload3 = deprecateComponent("MediaUpload", import_block_editor63.MediaUpload);
  var MediaUploadCheck2 = deprecateComponent(
    "MediaUploadCheck",
    import_block_editor63.MediaUploadCheck
  );
  var MultiSelectScrollIntoView = deprecateComponent(
    "MultiSelectScrollIntoView",
    import_block_editor63.MultiSelectScrollIntoView
  );
  var NavigableToolbar = deprecateComponent(
    "NavigableToolbar",
    import_block_editor63.NavigableToolbar
  );
  var ObserveTyping = deprecateComponent(
    "ObserveTyping",
    import_block_editor63.ObserveTyping
  );
  var SkipToSelectedBlock = deprecateComponent(
    "SkipToSelectedBlock",
    import_block_editor63.SkipToSelectedBlock
  );
  var URLInput = deprecateComponent("URLInput", import_block_editor63.URLInput);
  var URLInputButton = deprecateComponent(
    "URLInputButton",
    import_block_editor63.URLInputButton
  );
  var URLPopover = deprecateComponent("URLPopover", import_block_editor63.URLPopover);
  var Warning = deprecateComponent("Warning", import_block_editor63.Warning);
  var WritingFlow = deprecateComponent("WritingFlow", import_block_editor63.WritingFlow);
  var createCustomColorsHOC = deprecateFunction(
    "createCustomColorsHOC",
    import_block_editor63.createCustomColorsHOC
  );
  var getColorClassName2 = deprecateFunction(
    "getColorClassName",
    import_block_editor63.getColorClassName
  );
  var getColorObjectByAttributeValues = deprecateFunction(
    "getColorObjectByAttributeValues",
    import_block_editor63.getColorObjectByAttributeValues
  );
  var getColorObjectByColorValue = deprecateFunction(
    "getColorObjectByColorValue",
    import_block_editor63.getColorObjectByColorValue
  );
  var getFontSize = deprecateFunction("getFontSize", import_block_editor63.getFontSize);
  var getFontSizeClass = deprecateFunction(
    "getFontSizeClass",
    import_block_editor63.getFontSizeClass
  );
  var withColorContext = deprecateFunction(
    "withColorContext",
    import_block_editor63.withColorContext
  );
  var withColors = deprecateFunction("withColors", import_block_editor63.withColors);
  var withFontSizes = deprecateFunction(
    "withFontSizes",
    import_block_editor63.withFontSizes
  );

  // packages/editor/build-module/components/index.mjs
  var VisualEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts;
  var TextEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts;

  // packages/editor/build-module/hooks/default-autocompleters.mjs
  function setDefaultCompleters(completers = []) {
    completers.push({ ...user_default });
    return completers;
  }
  (0, import_hooks47.addFilter)(
    "editor.Autocomplete.completers",
    "editor/autocompleters/set-default-completers",
    setDefaultCompleters
  );

  // packages/editor/build-module/hooks/media-upload.mjs
  var import_element135 = __toESM(require_element(), 1);
  var import_hooks48 = __toESM(require_hooks(), 1);
  var import_deprecated11 = __toESM(require_deprecated(), 1);
  var import_media_utils6 = __toESM(require_media_utils(), 1);
  var import_jsx_runtime290 = __toESM(require_jsx_runtime(), 1);
  var { MediaUploadModal: MediaUploadModalComponent } = unlock(
    import_media_utils6.privateApis
  );
  var MediaUploadModalWrapper = class extends import_element135.Component {
    constructor(props) {
      super(props);
      this.state = {
        isOpen: false
      };
      this.openModal = this.openModal.bind(this);
      this.closeModal = this.closeModal.bind(this);
    }
    openModal() {
      this.setState({ isOpen: true });
    }
    closeModal() {
      this.setState({ isOpen: false });
      this.props.onClose?.();
    }
    render() {
      const {
        allowedTypes,
        multiple,
        value,
        onSelect,
        title,
        modalClass,
        render
      } = this.props;
      const { isOpen } = this.state;
      return /* @__PURE__ */ (0, import_jsx_runtime290.jsxs)(import_jsx_runtime290.Fragment, { children: [
        render({ open: this.openModal }),
        /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(
          MediaUploadModalComponent,
          {
            allowedTypes,
            multiple,
            value,
            onSelect: (media) => {
              onSelect(media);
              this.closeModal();
            },
            onClose: this.closeModal,
            title,
            isOpen,
            modalClass
          }
        )
      ] });
    }
  };
  if (window.__experimentalDataViewsMediaModal) {
    (0, import_hooks48.addFilter)(
      "editor.MediaUpload",
      "core/editor/components/media-upload",
      () => {
        (0, import_deprecated11.default)("Extending MediaUpload as a class component", {
          since: "7.0",
          version: "7.2",
          hint: "MediaUpload will become a function component in WordPress 7.2 Please update any custom implementations to use function components instead."
        });
        return MediaUploadModalWrapper;
      }
    );
  } else {
    (0, import_hooks48.addFilter)(
      "editor.MediaUpload",
      "core/editor/components/media-upload",
      () => {
        return import_media_utils6.MediaUpload;
      }
    );
  }

  // packages/editor/build-module/hooks/pattern-overrides.mjs
  var import_hooks49 = __toESM(require_hooks(), 1);
  var import_patterns8 = __toESM(require_patterns(), 1);
  var import_compose41 = __toESM(require_compose(), 1);
  var import_block_editor64 = __toESM(require_block_editor(), 1);
  var import_data174 = __toESM(require_data(), 1);
  var import_blocks28 = __toESM(require_blocks(), 1);
  var import_jsx_runtime291 = __toESM(require_jsx_runtime(), 1);
  var {
    PatternOverridesControls,
    ResetOverridesControl,
    PATTERN_TYPES: PATTERN_TYPES4,
    PATTERN_SYNC_TYPES
  } = unlock(import_patterns8.privateApis);
  var withPatternOverrideControls = (0, import_compose41.createHigherOrderComponent)(
    (BlockEdit2) => (props) => {
      const isSupportedBlock = (0, import_data174.useSelect)(
        (select5) => {
          const { __experimentalBlockBindingsSupportedAttributes } = select5(import_block_editor64.store).getSettings();
          return !!__experimentalBlockBindingsSupportedAttributes?.[props.name];
        },
        [props.name]
      );
      return /* @__PURE__ */ (0, import_jsx_runtime291.jsxs)(import_jsx_runtime291.Fragment, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime291.jsx)(BlockEdit2, { ...props }, "edit"),
        props.isSelected && isSupportedBlock && /* @__PURE__ */ (0, import_jsx_runtime291.jsx)(ControlsWithStoreSubscription, { ...props })
      ] });
    },
    "withPatternOverrideControls"
  );
  function ControlsWithStoreSubscription(props) {
    const blockEditingMode = (0, import_block_editor64.useBlockEditingMode)();
    const { hasPatternOverridesSource, isEditingSyncedPattern } = (0, import_data174.useSelect)(
      (select5) => {
        const { getCurrentPostType: getCurrentPostType2, getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
        return {
          // For editing link to the site editor if the theme and user permissions support it.
          hasPatternOverridesSource: !!(0, import_blocks28.getBlockBindingsSource)(
            "core/pattern-overrides"
          ),
          isEditingSyncedPattern: getCurrentPostType2() === PATTERN_TYPES4.user && getEditedPostAttribute2("meta")?.wp_pattern_sync_status !== PATTERN_SYNC_TYPES.unsynced && getEditedPostAttribute2("wp_pattern_sync_status") !== PATTERN_SYNC_TYPES.unsynced
        };
      },
      []
    );
    const bindings = props.attributes.metadata?.bindings;
    const hasPatternBindings = !!bindings && Object.values(bindings).some(
      (binding) => binding.source === "core/pattern-overrides"
    );
    const shouldShowPatternOverridesControls = isEditingSyncedPattern && blockEditingMode === "default";
    const shouldShowResetOverridesControl = !isEditingSyncedPattern && !!props.attributes.metadata?.name && blockEditingMode !== "disabled" && hasPatternBindings;
    if (!hasPatternOverridesSource) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime291.jsxs)(import_jsx_runtime291.Fragment, { children: [
      shouldShowPatternOverridesControls && /* @__PURE__ */ (0, import_jsx_runtime291.jsx)(PatternOverridesControls, { ...props }),
      shouldShowResetOverridesControl && /* @__PURE__ */ (0, import_jsx_runtime291.jsx)(ResetOverridesControl, { ...props })
    ] });
  }
  (0, import_hooks49.addFilter)(
    "editor.BlockEdit",
    "core/editor/with-pattern-override-controls",
    withPatternOverrideControls
  );

  // packages/editor/build-module/hooks/navigation-link-view-button.mjs
  var import_hooks50 = __toESM(require_hooks(), 1);
  var import_compose42 = __toESM(require_compose(), 1);
  var import_element136 = __toESM(require_element(), 1);
  var import_i18n181 = __toESM(require_i18n(), 1);
  var import_block_editor65 = __toESM(require_block_editor(), 1);
  var import_components168 = __toESM(require_components(), 1);
  var import_data175 = __toESM(require_data(), 1);
  var import_jsx_runtime292 = __toESM(require_jsx_runtime(), 1);
  var SUPPORTED_BLOCKS = ["core/navigation-link", "core/navigation-submenu"];
  function NavigationViewButton({ attributes }) {
    const { kind, id, type } = attributes;
    const blockEditingMode = (0, import_block_editor65.useBlockEditingMode)();
    const onNavigateToEntityRecord = (0, import_data175.useSelect)(
      (select5) => select5(import_block_editor65.store).getSettings().onNavigateToEntityRecord,
      []
    );
    const onViewPage = (0, import_element136.useCallback)(() => {
      if (kind === "post-type" && type === "page" && id && onNavigateToEntityRecord) {
        onNavigateToEntityRecord({
          postId: id,
          postType: type
        });
      }
    }, [kind, id, type, onNavigateToEntityRecord]);
    if (kind !== "post-type" || type !== "page" || !id || !onNavigateToEntityRecord || blockEditingMode !== "contentOnly") {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime292.jsx)(import_block_editor65.__unstableBlockToolbarLastItem, { children: /* @__PURE__ */ (0, import_jsx_runtime292.jsx)(import_components168.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime292.jsx)(
      import_components168.ToolbarButton,
      {
        name: "view",
        title: (0, import_i18n181.__)("View"),
        onClick: onViewPage,
        children: (0, import_i18n181.__)("View")
      }
    ) }) });
  }
  var withNavigationViewButton = (0, import_compose42.createHigherOrderComponent)(
    (BlockEdit2) => (props) => {
      const isSupportedBlock = SUPPORTED_BLOCKS.includes(props.name);
      return /* @__PURE__ */ (0, import_jsx_runtime292.jsxs)(import_jsx_runtime292.Fragment, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime292.jsx)(BlockEdit2, { ...props }, "edit"),
        props.isSelected && isSupportedBlock && /* @__PURE__ */ (0, import_jsx_runtime292.jsx)(NavigationViewButton, { ...props })
      ] });
    },
    "withNavigationViewButton"
  );
  (0, import_hooks50.addFilter)(
    "editor.BlockEdit",
    "core/editor/with-navigation-view-button",
    withNavigationViewButton
  );

  // packages/editor/build-module/hooks/template-part-navigation-edit-button.mjs
  var import_hooks51 = __toESM(require_hooks(), 1);
  var import_compose43 = __toESM(require_compose(), 1);
  var import_element137 = __toESM(require_element(), 1);
  var import_i18n182 = __toESM(require_i18n(), 1);
  var import_block_editor66 = __toESM(require_block_editor(), 1);
  var import_components169 = __toESM(require_components(), 1);
  var import_data176 = __toESM(require_data(), 1);
  var import_jsx_runtime293 = __toESM(require_jsx_runtime(), 1);
  var NAVIGATION_BLOCK_NAME = "core/navigation";
  var TEMPLATE_PART_BLOCK_NAME = "core/template-part";
  var BLOCK_INSPECTOR_AREA = "edit-post/block";
  function TemplatePartNavigationEditButton({ clientId }) {
    const { selectBlock: selectBlock2, flashBlock } = (0, import_data176.useDispatch)(import_block_editor66.store);
    const { enableComplementaryArea: enableComplementaryArea2 } = (0, import_data176.useDispatch)(store2);
    const {
      hasNavigationBlocks,
      firstNavigationBlockId,
      isNavigationEditable
    } = (0, import_data176.useSelect)(
      (select5) => {
        const {
          getClientIdsOfDescendants: getClientIdsOfDescendants2,
          getBlockName: getBlockName2,
          getBlockEditingMode
        } = select5(import_block_editor66.store);
        const descendants = getClientIdsOfDescendants2(clientId);
        const navigationBlocksInTemplatePart = descendants.filter(
          (blockId) => getBlockName2(blockId) === NAVIGATION_BLOCK_NAME
        );
        const _hasNavigationBlocks = navigationBlocksInTemplatePart.length > 0;
        const _firstNavigationBlockId = _hasNavigationBlocks ? navigationBlocksInTemplatePart[0] : null;
        return {
          hasNavigationBlocks: _hasNavigationBlocks,
          firstNavigationBlockId: _firstNavigationBlockId,
          // We can't use the useBlockEditingMode hook here because the current
          // context is the template part, not the navigation block.
          isNavigationEditable: getBlockEditingMode(_firstNavigationBlockId) !== "disabled"
        };
      },
      [clientId]
    );
    const onEditNavigation = (0, import_element137.useCallback)(() => {
      if (firstNavigationBlockId) {
        selectBlock2(firstNavigationBlockId);
        flashBlock(firstNavigationBlockId, 500);
        enableComplementaryArea2("core", BLOCK_INSPECTOR_AREA);
      }
    }, [
      firstNavigationBlockId,
      selectBlock2,
      flashBlock,
      enableComplementaryArea2
    ]);
    if (!hasNavigationBlocks || !isNavigationEditable) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(import_block_editor66.__unstableBlockToolbarLastItem, { children: /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(import_components169.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
      import_components169.ToolbarButton,
      {
        label: (0, import_i18n182.__)("Edit navigation"),
        onClick: onEditNavigation,
        children: (0, import_i18n182.__)("Edit navigation")
      }
    ) }) });
  }
  var withTemplatePartNavigationEditButton = (0, import_compose43.createHigherOrderComponent)(
    (BlockEdit2) => (props) => {
      const isTemplatePart2 = props.name === TEMPLATE_PART_BLOCK_NAME;
      return /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(import_jsx_runtime293.Fragment, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(BlockEdit2, { ...props }, "edit"),
        props.isSelected && isTemplatePart2 && /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
          TemplatePartNavigationEditButton,
          {
            clientId: props.clientId
          }
        )
      ] });
    },
    "withTemplatePartNavigationEditButton"
  );
  (0, import_hooks51.addFilter)(
    "editor.BlockEdit",
    "core/editor/with-template-part-navigation-edit-button",
    withTemplatePartNavigationEditButton
  );

  // packages/editor/build-module/hooks/push-changes-to-global-styles/index.mjs
  var import_hooks52 = __toESM(require_hooks(), 1);
  var import_compose44 = __toESM(require_compose(), 1);
  var import_block_editor67 = __toESM(require_block_editor(), 1);
  var import_components170 = __toESM(require_components(), 1);
  var import_i18n183 = __toESM(require_i18n(), 1);
  var import_blocks29 = __toESM(require_blocks(), 1);
  var import_element138 = __toESM(require_element(), 1);
  var import_data177 = __toESM(require_data(), 1);
  var import_notices26 = __toESM(require_notices(), 1);
  var import_core_data100 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/utils/set-nested-value.mjs
  function setNestedValue(object, path, value) {
    if (!object || typeof object !== "object") {
      return object;
    }
    path.reduce((acc, key, idx) => {
      if (acc[key] === void 0) {
        if (Number.isInteger(path[idx + 1])) {
          acc[key] = [];
        } else {
          acc[key] = {};
        }
      }
      if (idx === path.length - 1) {
        acc[key] = value;
      }
      return acc[key];
    }, object);
    return object;
  }

  // packages/editor/build-module/hooks/push-changes-to-global-styles/index.mjs
  var import_jsx_runtime294 = __toESM(require_jsx_runtime(), 1);
  var { cleanEmptyObject: cleanEmptyObject3 } = unlock(import_block_editor67.privateApis);
  var STYLE_PROPERTY2 = {
    ...import_blocks29.__EXPERIMENTAL_STYLE_PROPERTY,
    blockGap: { value: ["spacing", "blockGap"] }
  };
  var STYLE_PATH_TO_CSS_VAR_INFIX = {
    "border.color": "color",
    "color.background": "color",
    "color.text": "color",
    "elements.link.color.text": "color",
    "elements.link.:hover.color.text": "color",
    "elements.link.typography.fontFamily": "font-family",
    "elements.link.typography.fontSize": "font-size",
    "elements.button.color.text": "color",
    "elements.button.color.background": "color",
    "elements.button.typography.fontFamily": "font-family",
    "elements.button.typography.fontSize": "font-size",
    "elements.caption.color.text": "color",
    "elements.heading.color": "color",
    "elements.heading.color.background": "color",
    "elements.heading.typography.fontFamily": "font-family",
    "elements.heading.gradient": "gradient",
    "elements.heading.color.gradient": "gradient",
    "elements.h1.color": "color",
    "elements.h1.color.background": "color",
    "elements.h1.typography.fontFamily": "font-family",
    "elements.h1.color.gradient": "gradient",
    "elements.h2.color": "color",
    "elements.h2.color.background": "color",
    "elements.h2.typography.fontFamily": "font-family",
    "elements.h2.color.gradient": "gradient",
    "elements.h3.color": "color",
    "elements.h3.color.background": "color",
    "elements.h3.typography.fontFamily": "font-family",
    "elements.h3.color.gradient": "gradient",
    "elements.h4.color": "color",
    "elements.h4.color.background": "color",
    "elements.h4.typography.fontFamily": "font-family",
    "elements.h4.color.gradient": "gradient",
    "elements.h5.color": "color",
    "elements.h5.color.background": "color",
    "elements.h5.typography.fontFamily": "font-family",
    "elements.h5.color.gradient": "gradient",
    "elements.h6.color": "color",
    "elements.h6.color.background": "color",
    "elements.h6.typography.fontFamily": "font-family",
    "elements.h6.color.gradient": "gradient",
    "color.gradient": "gradient",
    blockGap: "spacing",
    "typography.fontSize": "font-size",
    "typography.fontFamily": "font-family"
  };
  var STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
    "border.color": "borderColor",
    "color.background": "backgroundColor",
    "color.text": "textColor",
    "color.gradient": "gradient",
    "typography.fontSize": "fontSize",
    "typography.fontFamily": "fontFamily"
  };
  var SUPPORTED_STYLES = ["border", "color", "spacing", "typography"];
  var getValueFromObjectPath2 = (object, path) => {
    let value = object;
    path.forEach((fieldName) => {
      value = value?.[fieldName];
    });
    return value;
  };
  var flatBorderProperties = ["borderColor", "borderWidth", "borderStyle"];
  var sides = ["top", "right", "bottom", "left"];
  function getBorderStyleChanges(border, presetColor, userStyle) {
    if (!border && !presetColor) {
      return [];
    }
    const changes = [
      ...getFallbackBorderStyleChange("top", border, userStyle),
      ...getFallbackBorderStyleChange("right", border, userStyle),
      ...getFallbackBorderStyleChange("bottom", border, userStyle),
      ...getFallbackBorderStyleChange("left", border, userStyle)
    ];
    const { color: customColor, style, width } = border || {};
    const hasColorOrWidth = presetColor || customColor || width;
    if (hasColorOrWidth && !style) {
      sides.forEach((side) => {
        if (!userStyle?.[side]?.style) {
          changes.push({
            path: ["border", side, "style"],
            value: "solid"
          });
        }
      });
    }
    return changes;
  }
  function getFallbackBorderStyleChange(side, border, globalBorderStyle) {
    if (!border?.[side] || globalBorderStyle?.[side]?.style) {
      return [];
    }
    const { color, style, width } = border[side];
    const hasColorOrWidth = color || width;
    if (!hasColorOrWidth || style) {
      return [];
    }
    return [{ path: ["border", side, "style"], value: "solid" }];
  }
  function useChangesToPush(name2, attributes, userConfig) {
    const supports = (0, import_data177.useSelect)(
      (select5) => {
        return unlock(select5(import_blocks29.store)).getSupportedStyles(name2);
      },
      [name2]
    );
    const blockUserConfig = userConfig?.styles?.blocks?.[name2];
    return (0, import_element138.useMemo)(() => {
      const changes = supports.flatMap((key) => {
        if (!STYLE_PROPERTY2[key]) {
          return [];
        }
        const { value: path } = STYLE_PROPERTY2[key];
        const presetAttributeKey = path.join(".");
        const presetAttributeValue = attributes[STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]];
        const value = presetAttributeValue ? `var:preset|${STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|${presetAttributeValue}` : getValueFromObjectPath2(attributes.style, path);
        if (key === "linkColor") {
          const linkChanges = value ? [{ path, value }] : [];
          const hoverPath = [
            "elements",
            "link",
            ":hover",
            "color",
            "text"
          ];
          const hoverValue = getValueFromObjectPath2(
            attributes.style,
            hoverPath
          );
          if (hoverValue) {
            linkChanges.push({ path: hoverPath, value: hoverValue });
          }
          return linkChanges;
        }
        if (flatBorderProperties.includes(key) && value) {
          const borderChanges = [{ path, value }];
          sides.forEach((side) => {
            const currentPath = [...path];
            currentPath.splice(-1, 0, side);
            borderChanges.push({ path: currentPath, value });
          });
          return borderChanges;
        }
        return value ? [{ path, value }] : [];
      });
      getBorderStyleChanges(
        attributes.style?.border,
        attributes.borderColor,
        blockUserConfig?.border
      ).forEach((change) => changes.push(change));
      return changes;
    }, [supports, attributes, blockUserConfig]);
  }
  function PushChangesToGlobalStylesControl({
    name: name2,
    attributes,
    setAttributes
  }) {
    const { user: userConfig, setUser: setUserConfig } = useGlobalStyles();
    const changes = useChangesToPush(name2, attributes, userConfig);
    const { __unstableMarkNextChangeAsNotPersistent } = (0, import_data177.useDispatch)(import_block_editor67.store);
    const { createSuccessNotice } = (0, import_data177.useDispatch)(import_notices26.store);
    const pushChanges = (0, import_element138.useCallback)(() => {
      if (changes.length === 0) {
        return;
      }
      if (changes.length > 0) {
        const { style: blockStyles } = attributes;
        const newBlockStyles = structuredClone(blockStyles);
        const newUserConfig = structuredClone(userConfig);
        for (const { path, value } of changes) {
          setNestedValue(newBlockStyles, path, void 0);
          setNestedValue(
            newUserConfig,
            ["styles", "blocks", name2, ...path],
            value
          );
        }
        const newBlockAttributes = {
          borderColor: void 0,
          backgroundColor: void 0,
          textColor: void 0,
          gradient: void 0,
          fontSize: void 0,
          fontFamily: void 0,
          style: cleanEmptyObject3(newBlockStyles)
        };
        __unstableMarkNextChangeAsNotPersistent();
        setAttributes(newBlockAttributes);
        setUserConfig(newUserConfig, { undoIgnore: true });
        createSuccessNotice(
          (0, import_i18n183.sprintf)(
            // translators: %s: Title of the block e.g. 'Heading'.
            (0, import_i18n183.__)("%s styles applied."),
            (0, import_blocks29.getBlockType)(name2).title
          ),
          {
            type: "snackbar",
            actions: [
              {
                label: (0, import_i18n183.__)("Undo"),
                onClick() {
                  __unstableMarkNextChangeAsNotPersistent();
                  setAttributes(attributes);
                  setUserConfig(userConfig, {
                    undoIgnore: true
                  });
                }
              }
            ]
          }
        );
      }
    }, [
      __unstableMarkNextChangeAsNotPersistent,
      attributes,
      changes,
      createSuccessNotice,
      name2,
      setAttributes,
      setUserConfig,
      userConfig
    ]);
    return /* @__PURE__ */ (0, import_jsx_runtime294.jsxs)(
      import_components170.BaseControl,
      {
        className: "editor-push-changes-to-global-styles-control",
        help: (0, import_i18n183.sprintf)(
          // translators: %s: Title of the block e.g. 'Heading'.
          (0, import_i18n183.__)(
            "Apply this block\u2019s typography, spacing, dimensions, and color styles to all %s blocks."
          ),
          (0, import_blocks29.getBlockType)(name2).title
        ),
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(import_components170.BaseControl.VisualLabel, { children: (0, import_i18n183.__)("Styles") }),
          /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(
            import_components170.Button,
            {
              __next40pxDefaultSize: true,
              variant: "secondary",
              accessibleWhenDisabled: true,
              disabled: changes.length === 0,
              onClick: pushChanges,
              children: (0, import_i18n183.__)("Apply globally")
            }
          )
        ]
      }
    );
  }
  function PushChangesToGlobalStyles(props) {
    const blockEditingMode = (0, import_block_editor67.useBlockEditingMode)();
    const isBlockBasedTheme = (0, import_data177.useSelect)(
      (select5) => select5(import_core_data100.store).getCurrentTheme()?.is_block_theme,
      []
    );
    const supportsStyles = SUPPORTED_STYLES.some(
      (feature) => (0, import_blocks29.hasBlockSupport)(props.name, feature)
    );
    const isDisplayed = blockEditingMode === "default" && supportsStyles && isBlockBasedTheme;
    if (!isDisplayed) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(import_block_editor67.InspectorAdvancedControls, { children: /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(PushChangesToGlobalStylesControl, { ...props }) });
  }
  var withPushChangesToGlobalStyles = (0, import_compose44.createHigherOrderComponent)(
    (BlockEdit2) => (props) => /* @__PURE__ */ (0, import_jsx_runtime294.jsxs)(import_jsx_runtime294.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(BlockEdit2, { ...props }, "edit"),
      props.isSelected && /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(PushChangesToGlobalStyles, { ...props })
    ] })
  );
  (0, import_hooks52.addFilter)(
    "editor.BlockEdit",
    "core/editor/push-changes-to-global-styles",
    withPushChangesToGlobalStyles
  );

  // packages/editor/build-module/components/header/back-button.mjs
  var import_components171 = __toESM(require_components(), 1);
  var import_jsx_runtime295 = __toESM(require_jsx_runtime(), 1);
  var slotName = "__experimentalMainDashboardButton";
  var useHasBackButton = () => {
    const fills = (0, import_components171.__experimentalUseSlotFills)(slotName);
    return Boolean(fills && fills.length);
  };
  var { Fill: Fill10, Slot: Slot10 } = (0, import_components171.createSlotFill)(slotName);
  var BackButton = Fill10;
  var BackButtonSlot = () => {
    const fills = (0, import_components171.__experimentalUseSlotFills)(slotName);
    return /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
      Slot10,
      {
        bubblesVirtually: true,
        fillProps: { length: !fills ? 0 : fills.length }
      }
    );
  };
  BackButton.Slot = BackButtonSlot;
  var back_button_default = BackButton;

  // packages/editor/build-module/components/editor/index.mjs
  var import_data229 = __toESM(require_data(), 1);
  var import_core_data121 = __toESM(require_core_data(), 1);
  var import_components214 = __toESM(require_components(), 1);
  var import_i18n225 = __toESM(require_i18n(), 1);
  var import_element174 = __toESM(require_element(), 1);
  var import_block_editor98 = __toESM(require_block_editor(), 1);

  // packages/editor/build-module/utils/block-selection-path.mjs
  var import_data178 = __toESM(require_data(), 1);
  var import_element139 = __toESM(require_element(), 1);
  var import_block_editor68 = __toESM(require_block_editor(), 1);
  function useGenerateBlockPath() {
    const registry = (0, import_data178.useRegistry)();
    return (0, import_element139.useCallback)(
      (clientId) => {
        const { getBlock: getBlock2, getBlockParents, getBlockOrder: getBlockOrder2 } = registry.select(import_block_editor68.store);
        const block = getBlock2(clientId);
        if (!block) {
          return null;
        }
        const parents = getBlockParents(clientId);
        const path = [];
        const hierarchy = [...parents, clientId];
        for (let i3 = 0; i3 < hierarchy.length; i3++) {
          const currentClientId = hierarchy[i3];
          const currentBlock = getBlock2(currentClientId);
          if (!currentBlock) {
            return null;
          }
          const parentClientId = i3 > 0 ? hierarchy[i3 - 1] : "";
          const siblings = getBlockOrder2(parentClientId);
          const index2 = siblings.indexOf(currentClientId);
          if (index2 === -1) {
            return null;
          }
          path.push({
            blockName: currentBlock.name,
            index: index2,
            // Store a simple content hash for verification (first 100 chars of serialized content)
            contentHash: JSON.stringify(
              currentBlock.attributes
            ).slice(0, 100)
          });
        }
        return path;
      },
      [registry]
    );
  }
  function useRestoreBlockFromPath() {
    const registry = (0, import_data178.useRegistry)();
    return (0, import_element139.useCallback)(
      (path) => {
        if (!path || !Array.isArray(path) || path.length === 0) {
          return null;
        }
        const { getBlock: getBlock2, getBlockOrder: getBlockOrder2 } = registry.select(import_block_editor68.store);
        let currentParentId = "";
        for (let i3 = 0; i3 < path.length; i3++) {
          const step = path[i3];
          const siblings = getBlockOrder2(currentParentId);
          if (step.index >= siblings.length) {
            return null;
          }
          const candidateClientId = siblings[step.index];
          const candidateBlock = getBlock2(candidateClientId);
          if (!candidateBlock) {
            return null;
          }
          if (candidateBlock.name !== step.blockName) {
            return null;
          }
          if (i3 === path.length - 1) {
            return candidateClientId;
          }
          currentParentId = candidateClientId;
        }
        return null;
      },
      [registry]
    );
  }

  // packages/editor/build-module/components/editor-interface/index.mjs
  var import_data199 = __toESM(require_data(), 1);
  var import_i18n197 = __toESM(require_i18n(), 1);
  var import_preferences22 = __toESM(require_preferences(), 1);
  var import_block_editor81 = __toESM(require_block_editor(), 1);
  var import_compose57 = __toESM(require_compose(), 1);
  var import_element151 = __toESM(require_element(), 1);
  var import_html_entities26 = __toESM(require_html_entities(), 1);

  // packages/editor/build-module/components/header/index.mjs
  var import_block_editor73 = __toESM(require_block_editor(), 1);
  var import_data188 = __toESM(require_data(), 1);
  var import_compose49 = __toESM(require_compose(), 1);
  var import_components182 = __toESM(require_components(), 1);
  var import_preferences20 = __toESM(require_preferences(), 1);
  var import_element144 = __toESM(require_element(), 1);

  // packages/editor/build-module/components/collapsible-block-toolbar/index.mjs
  var import_block_editor69 = __toESM(require_block_editor(), 1);
  var import_element140 = __toESM(require_element(), 1);
  var import_components172 = __toESM(require_components(), 1);
  var import_i18n184 = __toESM(require_i18n(), 1);
  var import_data179 = __toESM(require_data(), 1);
  var import_jsx_runtime296 = __toESM(require_jsx_runtime(), 1);
  var { useHasBlockToolbar } = unlock(import_block_editor69.privateApis);
  function CollapsibleBlockToolbar({ isCollapsed, onToggle }) {
    const { blockSelectionStart } = (0, import_data179.useSelect)((select5) => {
      return {
        blockSelectionStart: select5(import_block_editor69.store).getBlockSelectionStart()
      };
    }, []);
    const hasBlockToolbar = useHasBlockToolbar();
    const hasBlockSelection = !!blockSelectionStart;
    (0, import_element140.useEffect)(() => {
      if (blockSelectionStart) {
        onToggle(false);
      }
    }, [blockSelectionStart, onToggle]);
    if (!hasBlockToolbar) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime296.jsxs)(import_jsx_runtime296.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(
        "div",
        {
          className: clsx_default("editor-collapsible-block-toolbar", {
            "is-collapsed": isCollapsed || !hasBlockSelection
          }),
          children: /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(import_block_editor69.BlockToolbar, { hideDragHandle: true })
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(import_components172.Popover.Slot, { name: "block-toolbar" }),
      /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(
        import_components172.Button,
        {
          className: "editor-collapsible-block-toolbar__toggle",
          icon: isCollapsed ? next_default : previous_default,
          onClick: () => {
            onToggle(!isCollapsed);
          },
          label: isCollapsed ? (0, import_i18n184.__)("Show block tools") : (0, import_i18n184.__)("Hide block tools"),
          size: "compact"
        }
      )
    ] });
  }

  // packages/editor/build-module/components/document-tools/index.mjs
  var import_compose45 = __toESM(require_compose(), 1);
  var import_data180 = __toESM(require_data(), 1);
  var import_i18n185 = __toESM(require_i18n(), 1);
  var import_block_editor70 = __toESM(require_block_editor(), 1);
  var import_components173 = __toESM(require_components(), 1);
  var import_element141 = __toESM(require_element(), 1);
  var import_keyboard_shortcuts5 = __toESM(require_keyboard_shortcuts(), 1);
  var import_preferences15 = __toESM(require_preferences(), 1);
  var import_jsx_runtime297 = __toESM(require_jsx_runtime(), 1);
  function DocumentTools({ className, disableBlockTools = false }) {
    const { setIsInserterOpened: setIsInserterOpened2, setIsListViewOpened: setIsListViewOpened2 } = (0, import_data180.useDispatch)(store);
    const {
      isDistractionFree,
      isInserterOpened: isInserterOpened2,
      isListViewOpen,
      listViewShortcut,
      inserterSidebarToggleRef: inserterSidebarToggleRef2,
      listViewToggleRef: listViewToggleRef2,
      showIconLabels
    } = (0, import_data180.useSelect)((select5) => {
      const { get } = select5(import_preferences15.store);
      const {
        isListViewOpened: isListViewOpened2,
        getEditorMode: getEditorMode2,
        getInserterSidebarToggleRef: getInserterSidebarToggleRef2,
        getListViewToggleRef: getListViewToggleRef2
      } = unlock(select5(store));
      const { getShortcutRepresentation } = select5(import_keyboard_shortcuts5.store);
      return {
        isInserterOpened: select5(store).isInserterOpened(),
        isListViewOpen: isListViewOpened2(),
        listViewShortcut: getShortcutRepresentation(
          "core/editor/toggle-list-view"
        ),
        inserterSidebarToggleRef: getInserterSidebarToggleRef2(),
        listViewToggleRef: getListViewToggleRef2(),
        showIconLabels: get("core", "showIconLabels"),
        isDistractionFree: get("core", "distractionFree"),
        isVisualMode: getEditorMode2() === "visual"
      };
    }, []);
    const preventDefault = (event) => {
      if (isInserterOpened2) {
        event.preventDefault();
      }
    };
    const isWideViewport = (0, import_compose45.useViewportMatch)("wide");
    const toolbarAriaLabel = (0, import_i18n185.__)("Document tools");
    const toggleListView = (0, import_element141.useCallback)(
      () => setIsListViewOpened2(!isListViewOpen),
      [setIsListViewOpened2, isListViewOpen]
    );
    const toggleInserter = (0, import_element141.useCallback)(
      () => setIsInserterOpened2(!isInserterOpened2),
      [isInserterOpened2, setIsInserterOpened2]
    );
    const longLabel = (0, import_i18n185._x)(
      "Block Inserter",
      "Generic label for block inserter button"
    );
    const shortLabel = !isInserterOpened2 ? (0, import_i18n185.__)("Add") : (0, import_i18n185.__)("Close");
    return (
      // Some plugins expect and use the `edit-post-header-toolbar` CSS class to
      // find the toolbar and inject UI elements into it. This is not officially
      // supported, but we're keeping it in the list of class names for backwards
      // compatibility.
      /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(
        import_block_editor70.NavigableToolbar,
        {
          className: clsx_default(
            "editor-document-tools",
            "edit-post-header-toolbar",
            className
          ),
          "aria-label": toolbarAriaLabel,
          variant: "unstyled",
          children: /* @__PURE__ */ (0, import_jsx_runtime297.jsxs)("div", { className: "editor-document-tools__left", children: [
            !isDistractionFree && /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(
              import_components173.ToolbarButton,
              {
                ref: inserterSidebarToggleRef2,
                className: "editor-document-tools__inserter-toggle",
                variant: "primary",
                isPressed: isInserterOpened2,
                onMouseDown: preventDefault,
                onClick: toggleInserter,
                disabled: disableBlockTools,
                icon: plus_default,
                label: showIconLabels ? shortLabel : longLabel,
                showTooltip: !showIconLabels,
                "aria-expanded": isInserterOpened2
              }
            ),
            (isWideViewport || !showIconLabels) && /* @__PURE__ */ (0, import_jsx_runtime297.jsxs)(import_jsx_runtime297.Fragment, { children: [
              /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(
                import_components173.ToolbarItem,
                {
                  as: undo_default2,
                  showTooltip: !showIconLabels,
                  variant: showIconLabels ? "tertiary" : void 0,
                  size: "compact"
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(
                import_components173.ToolbarItem,
                {
                  as: redo_default2,
                  showTooltip: !showIconLabels,
                  variant: showIconLabels ? "tertiary" : void 0,
                  size: "compact"
                }
              ),
              !isDistractionFree && /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(
                import_components173.ToolbarButton,
                {
                  className: "editor-document-tools__document-overview-toggle",
                  icon: list_view_default,
                  disabled: disableBlockTools,
                  isPressed: isListViewOpen,
                  label: (0, import_i18n185.__)("Document Overview"),
                  onClick: toggleListView,
                  shortcut: listViewShortcut,
                  showTooltip: !showIconLabels,
                  variant: showIconLabels ? "tertiary" : void 0,
                  "aria-expanded": isListViewOpen,
                  ref: listViewToggleRef2
                }
              )
            ] })
          ] })
        }
      )
    );
  }
  var document_tools_default = DocumentTools;

  // packages/editor/build-module/components/more-menu/index.mjs
  var import_i18n188 = __toESM(require_i18n(), 1);
  var import_data183 = __toESM(require_data(), 1);
  var import_keycodes13 = __toESM(require_keycodes(), 1);
  var import_components178 = __toESM(require_components(), 1);
  var import_preferences16 = __toESM(require_preferences(), 1);

  // packages/editor/build-module/components/more-menu/copy-content-menu-item.mjs
  var import_components174 = __toESM(require_components(), 1);
  var import_data181 = __toESM(require_data(), 1);
  var import_i18n186 = __toESM(require_i18n(), 1);
  var import_compose46 = __toESM(require_compose(), 1);
  var import_notices27 = __toESM(require_notices(), 1);
  var import_core_data101 = __toESM(require_core_data(), 1);
  var import_blocks30 = __toESM(require_blocks(), 1);
  var import_jsx_runtime298 = __toESM(require_jsx_runtime(), 1);
  function CopyContentMenuItem() {
    const { createNotice } = (0, import_data181.useDispatch)(import_notices27.store);
    const { getCurrentPostId: getCurrentPostId2, getCurrentPostType: getCurrentPostType2 } = (0, import_data181.useSelect)(store);
    const { getEditedEntityRecord } = (0, import_data181.useSelect)(import_core_data101.store);
    function getText() {
      const record = getEditedEntityRecord(
        "postType",
        getCurrentPostType2(),
        getCurrentPostId2()
      );
      if (!record) {
        return "";
      }
      if (typeof record.content === "function") {
        return record.content(record);
      } else if (record.blocks) {
        return (0, import_blocks30.__unstableSerializeAndClean)(record.blocks);
      } else if (record.content) {
        return record.content;
      }
    }
    function onSuccess() {
      createNotice("info", (0, import_i18n186.__)("All content copied."), {
        isDismissible: true,
        type: "snackbar"
      });
    }
    const ref = (0, import_compose46.useCopyToClipboard)(getText, onSuccess);
    return /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(import_components174.MenuItem, { ref, children: (0, import_i18n186.__)("Copy all blocks") });
  }

  // packages/editor/build-module/components/mode-switcher/index.mjs
  var import_i18n187 = __toESM(require_i18n(), 1);
  var import_components175 = __toESM(require_components(), 1);
  var import_data182 = __toESM(require_data(), 1);
  var import_keyboard_shortcuts6 = __toESM(require_keyboard_shortcuts(), 1);
  var import_jsx_runtime299 = __toESM(require_jsx_runtime(), 1);
  var MODES = [
    {
      value: "visual",
      label: (0, import_i18n187.__)("Visual editor")
    },
    {
      value: "text",
      label: (0, import_i18n187.__)("Code editor")
    }
  ];
  function ModeSwitcher() {
    const { shortcut, isRichEditingEnabled, isCodeEditingEnabled, mode } = (0, import_data182.useSelect)(
      (select5) => ({
        shortcut: select5(
          import_keyboard_shortcuts6.store
        ).getShortcutRepresentation("core/editor/toggle-mode"),
        isRichEditingEnabled: select5(store).getEditorSettings().richEditingEnabled,
        isCodeEditingEnabled: select5(store).getEditorSettings().codeEditingEnabled,
        mode: select5(store).getEditorMode()
      }),
      []
    );
    const { switchEditorMode: switchEditorMode2 } = (0, import_data182.useDispatch)(store);
    let selectedMode = mode;
    if (!isRichEditingEnabled && mode === "visual") {
      selectedMode = "text";
    }
    if (!isCodeEditingEnabled && mode === "text") {
      selectedMode = "visual";
    }
    const choices = MODES.map((choice) => {
      if (!isCodeEditingEnabled && choice.value === "text") {
        choice = {
          ...choice,
          disabled: true
        };
      }
      if (!isRichEditingEnabled && choice.value === "visual") {
        choice = {
          ...choice,
          disabled: true,
          info: (0, import_i18n187.__)(
            "You can enable the visual editor in your profile settings."
          )
        };
      }
      if (choice.value !== selectedMode && !choice.disabled) {
        return { ...choice, shortcut };
      }
      return choice;
    });
    return /* @__PURE__ */ (0, import_jsx_runtime299.jsx)(import_components175.MenuGroup, { label: (0, import_i18n187.__)("Editor"), children: /* @__PURE__ */ (0, import_jsx_runtime299.jsx)(
      import_components175.MenuItemsChoice,
      {
        choices,
        value: selectedMode,
        onSelect: switchEditorMode2
      }
    ) });
  }
  var mode_switcher_default = ModeSwitcher;

  // packages/editor/build-module/components/more-menu/tools-more-menu-group.mjs
  var import_components176 = __toESM(require_components(), 1);
  var import_jsx_runtime300 = __toESM(require_jsx_runtime(), 1);
  var { Fill: ToolsMoreMenuGroup, Slot: Slot11 } = (0, import_components176.createSlotFill)("ToolsMoreMenuGroup");
  ToolsMoreMenuGroup.Slot = ({ fillProps }) => /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(Slot11, { fillProps });
  var tools_more_menu_group_default = ToolsMoreMenuGroup;

  // packages/editor/build-module/components/more-menu/view-more-menu-group.mjs
  var import_components177 = __toESM(require_components(), 1);
  var import_element142 = __toESM(require_element(), 1);
  var import_jsx_runtime301 = __toESM(require_jsx_runtime(), 1);
  var { Fill: ViewMoreMenuGroup, Slot: Slot12 } = (0, import_components177.createSlotFill)(
    import_element142.Platform.OS === "web" ? /* @__PURE__ */ Symbol("ViewMoreMenuGroup") : "ViewMoreMenuGroup"
  );
  ViewMoreMenuGroup.Slot = ({ fillProps }) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(Slot12, { fillProps });
  var view_more_menu_group_default = ViewMoreMenuGroup;

  // packages/editor/build-module/components/more-menu/index.mjs
  var import_jsx_runtime302 = __toESM(require_jsx_runtime(), 1);
  function MoreMenu() {
    const { openModal: openModal2 } = (0, import_data183.useDispatch)(store2);
    const { set: setPreference } = (0, import_data183.useDispatch)(import_preferences16.store);
    const { toggleDistractionFree: toggleDistractionFree2 } = (0, import_data183.useDispatch)(store);
    const showIconLabels = (0, import_data183.useSelect)(
      (select5) => select5(import_preferences16.store).get("core", "showIconLabels"),
      []
    );
    const turnOffDistractionFree = () => {
      setPreference("core", "distractionFree", false);
    };
    return /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(import_jsx_runtime302.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
      import_components178.DropdownMenu,
      {
        icon: more_vertical_default,
        label: (0, import_i18n188.__)("Options"),
        popoverProps: {
          placement: "bottom-end",
          className: "more-menu-dropdown__content"
        },
        toggleProps: {
          showTooltip: !showIconLabels,
          ...showIconLabels && { variant: "tertiary" },
          tooltipPosition: "bottom",
          size: "compact"
        },
        children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime302.jsxs)(import_jsx_runtime302.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime302.jsxs)(import_components178.MenuGroup, { label: (0, import_i18n188._x)("View", "noun"), children: [
            /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
              import_preferences16.PreferenceToggleMenuItem,
              {
                scope: "core",
                name: "fixedToolbar",
                onToggle: turnOffDistractionFree,
                label: (0, import_i18n188.__)("Top toolbar"),
                info: (0, import_i18n188.__)(
                  "Access all block and document tools in a single place"
                ),
                messageActivated: (0, import_i18n188.__)(
                  "Top toolbar activated."
                ),
                messageDeactivated: (0, import_i18n188.__)(
                  "Top toolbar deactivated."
                )
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
              import_preferences16.PreferenceToggleMenuItem,
              {
                scope: "core",
                name: "distractionFree",
                label: (0, import_i18n188.__)("Distraction free"),
                info: (0, import_i18n188.__)("Write with calmness"),
                handleToggling: false,
                onToggle: () => toggleDistractionFree2({
                  createNotice: false
                }),
                messageActivated: (0, import_i18n188.__)(
                  "Distraction free mode activated."
                ),
                messageDeactivated: (0, import_i18n188.__)(
                  "Distraction free mode deactivated."
                ),
                shortcut: import_keycodes13.displayShortcut.primaryShift(
                  "\\"
                )
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
              import_preferences16.PreferenceToggleMenuItem,
              {
                scope: "core",
                name: "focusMode",
                label: (0, import_i18n188.__)("Spotlight mode"),
                info: (0, import_i18n188.__)("Focus on one block at a time"),
                messageActivated: (0, import_i18n188.__)(
                  "Spotlight mode activated."
                ),
                messageDeactivated: (0, import_i18n188.__)(
                  "Spotlight mode deactivated."
                )
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(view_more_menu_group_default.Slot, { fillProps: { onClose } })
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(mode_switcher_default, {}),
          /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
            action_item_default.Slot,
            {
              name: "core/plugin-more-menu",
              label: (0, import_i18n188.__)("Panels"),
              fillProps: { onClick: onClose }
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime302.jsxs)(import_components178.MenuGroup, { label: (0, import_i18n188.__)("Tools"), children: [
            /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
              import_components178.MenuItem,
              {
                onClick: () => openModal2("editor/keyboard-shortcut-help"),
                shortcut: import_keycodes13.displayShortcut.access("h"),
                children: (0, import_i18n188.__)("Keyboard shortcuts")
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(CopyContentMenuItem, {}),
            /* @__PURE__ */ (0, import_jsx_runtime302.jsxs)(
              import_components178.MenuItem,
              {
                icon: external_default,
                href: (0, import_i18n188.__)(
                  "https://wordpress.org/documentation/article/wordpress-block-editor/"
                ),
                target: "_blank",
                rel: "noopener noreferrer",
                children: [
                  (0, import_i18n188.__)("Help"),
                  /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(import_components178.VisuallyHidden, {
                    as: "span",
                    /* translators: accessibility text */
                    children: (0, import_i18n188.__)("(opens in a new tab)")
                  })
                ]
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
              tools_more_menu_group_default.Slot,
              {
                fillProps: { onClose }
              }
            )
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(import_components178.MenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
            import_components178.MenuItem,
            {
              onClick: () => openModal2("editor/preferences"),
              children: (0, import_i18n188.__)("Preferences")
            }
          ) })
        ] })
      }
    ) });
  }

  // packages/editor/build-module/components/post-publish-button/post-publish-button-or-toggle.mjs
  var import_compose47 = __toESM(require_compose(), 1);
  var import_data184 = __toESM(require_data(), 1);
  var import_jsx_runtime303 = __toESM(require_jsx_runtime(), 1);
  var IS_TOGGLE = "toggle";
  var IS_BUTTON = "button";
  function PostPublishButtonOrToggle({
    forceIsDirty,
    setEntitiesSavedStatesCallback
  }) {
    let component;
    const isSmallerThanMediumViewport = (0, import_compose47.useViewportMatch)("medium", "<");
    const { togglePublishSidebar: togglePublishSidebar2 } = (0, import_data184.useDispatch)(store);
    const {
      hasPublishAction,
      isBeingScheduled,
      isPending,
      isPublished,
      isPublishSidebarEnabled: isPublishSidebarEnabled2,
      isPublishSidebarOpened: isPublishSidebarOpened2,
      isScheduled,
      postStatus,
      postStatusHasChanged
    } = (0, import_data184.useSelect)((select5) => {
      return {
        hasPublishAction: !!select5(store).getCurrentPost()?._links?.["wp:action-publish"],
        isBeingScheduled: select5(store).isEditedPostBeingScheduled(),
        isPending: select5(store).isCurrentPostPending(),
        isPublished: select5(store).isCurrentPostPublished(),
        isPublishSidebarEnabled: select5(store).isPublishSidebarEnabled(),
        isPublishSidebarOpened: select5(store).isPublishSidebarOpened(),
        isScheduled: select5(store).isCurrentPostScheduled(),
        postStatus: select5(store).getEditedPostAttribute("status"),
        postStatusHasChanged: select5(store).getPostEdits()?.status
      };
    }, []);
    if (isPublished || postStatusHasChanged && !["future", "publish"].includes(postStatus) || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) {
      component = IS_BUTTON;
    } else if (isSmallerThanMediumViewport || isPublishSidebarEnabled2) {
      component = IS_TOGGLE;
    } else {
      component = IS_BUTTON;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(
      post_publish_button_default,
      {
        forceIsDirty,
        isOpen: isPublishSidebarOpened2,
        isToggle: component === IS_TOGGLE,
        onToggle: togglePublishSidebar2,
        setEntitiesSavedStatesCallback
      }
    );
  }

  // packages/editor/build-module/components/post-view-link/index.mjs
  var import_i18n189 = __toESM(require_i18n(), 1);
  var import_components179 = __toESM(require_components(), 1);
  var import_core_data102 = __toESM(require_core_data(), 1);
  var import_data185 = __toESM(require_data(), 1);
  var import_preferences17 = __toESM(require_preferences(), 1);
  var import_jsx_runtime304 = __toESM(require_jsx_runtime(), 1);
  function PostViewLink() {
    const { hasLoaded, permalink, isPublished, label, showIconLabels } = (0, import_data185.useSelect)((select5) => {
      const postTypeSlug = select5(store).getCurrentPostType();
      const postType2 = select5(import_core_data102.store).getPostType(postTypeSlug);
      const { get } = select5(import_preferences17.store);
      return {
        permalink: select5(store).getPermalink(),
        isPublished: select5(store).isCurrentPostPublished(),
        label: postType2?.labels.view_item,
        hasLoaded: !!postType2,
        showIconLabels: get("core", "showIconLabels")
      };
    }, []);
    if (!isPublished || !permalink || !hasLoaded) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime304.jsx)(
      import_components179.Button,
      {
        icon: external_default,
        label: label || (0, import_i18n189.__)("View post"),
        href: permalink,
        target: "_blank",
        showTooltip: !showIconLabels,
        size: "compact"
      }
    );
  }

  // packages/editor/build-module/components/preview-dropdown/index.mjs
  var import_compose48 = __toESM(require_compose(), 1);
  var import_components180 = __toESM(require_components(), 1);
  var import_i18n190 = __toESM(require_i18n(), 1);
  var import_data186 = __toESM(require_data(), 1);
  var import_core_data103 = __toESM(require_core_data(), 1);
  var import_preferences18 = __toESM(require_preferences(), 1);
  var import_block_editor71 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime305 = __toESM(require_jsx_runtime(), 1);
  function PreviewDropdown({ forceIsAutosaveable, disabled }) {
    const {
      deviceType: deviceType2,
      homeUrl,
      isTemplate: isTemplate2,
      isViewable,
      showIconLabels,
      isTemplateHidden,
      templateId: templateId2
    } = (0, import_data186.useSelect)((select5) => {
      const {
        getDeviceType: getDeviceType2,
        getCurrentPostType: getCurrentPostType2,
        getCurrentTemplateId: getCurrentTemplateId2,
        getRenderingMode: getRenderingMode2
      } = select5(store);
      const { getEntityRecord, getPostType } = select5(import_core_data103.store);
      const { get } = select5(import_preferences18.store);
      const _currentPostType = getCurrentPostType2();
      return {
        deviceType: getDeviceType2(),
        homeUrl: getEntityRecord("root", "__unstableBase")?.home,
        isTemplate: _currentPostType === "wp_template",
        isViewable: getPostType(_currentPostType)?.viewable ?? false,
        showIconLabels: get("core", "showIconLabels"),
        isTemplateHidden: getRenderingMode2() === "post-only",
        templateId: getCurrentTemplateId2()
      };
    }, []);
    const { setDeviceType: setDeviceType2, setRenderingMode: setRenderingMode2, setDefaultRenderingMode: setDefaultRenderingMode2 } = unlock(
      (0, import_data186.useDispatch)(store)
    );
    const { resetZoomLevel } = unlock((0, import_data186.useDispatch)(import_block_editor71.store));
    const handleDevicePreviewChange = (newDeviceType) => {
      setDeviceType2(newDeviceType);
      resetZoomLevel();
    };
    const isMobile = (0, import_compose48.useViewportMatch)("medium", "<");
    if (isMobile) {
      return null;
    }
    const popoverProps = {
      placement: "bottom-end"
    };
    const toggleProps = {
      className: "editor-preview-dropdown__toggle",
      iconPosition: "right",
      size: "compact",
      showTooltip: !showIconLabels,
      disabled,
      accessibleWhenDisabled: disabled
    };
    const menuProps = {
      "aria-label": (0, import_i18n190.__)("View options")
    };
    const deviceIcons = {
      desktop: desktop_default,
      mobile: mobile_default,
      tablet: tablet_default
    };
    const choices = [
      {
        value: "Desktop",
        label: (0, import_i18n190.__)("Desktop"),
        icon: desktop_default
      },
      {
        value: "Tablet",
        label: (0, import_i18n190.__)("Tablet"),
        icon: tablet_default
      },
      {
        value: "Mobile",
        label: (0, import_i18n190.__)("Mobile"),
        icon: mobile_default
      }
    ];
    return /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(
      import_components180.DropdownMenu,
      {
        className: clsx_default(
          "editor-preview-dropdown",
          `editor-preview-dropdown--${deviceType2.toLowerCase()}`
        ),
        popoverProps,
        toggleProps,
        menuProps,
        icon: deviceIcons[deviceType2.toLowerCase()],
        label: (0, import_i18n190.__)("View"),
        disableOpenOnArrowDown: disabled,
        children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime305.jsxs)(import_jsx_runtime305.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(import_components180.MenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(
            import_components180.MenuItemsChoice,
            {
              choices,
              value: deviceType2,
              onSelect: handleDevicePreviewChange
            }
          ) }),
          isTemplate2 && /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(import_components180.MenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime305.jsxs)(
            import_components180.MenuItem,
            {
              href: homeUrl,
              target: "_blank",
              icon: external_default,
              onClick: onClose,
              children: [
                (0, import_i18n190.__)("View site"),
                /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(import_components180.VisuallyHidden, {
                  as: "span",
                  /* translators: accessibility text */
                  children: (0, import_i18n190.__)("(opens in a new tab)")
                })
              ]
            }
          ) }),
          !isTemplate2 && !!templateId2 && /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(import_components180.MenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(
            import_components180.MenuItem,
            {
              icon: !isTemplateHidden ? check_default : void 0,
              isSelected: !isTemplateHidden,
              role: "menuitemcheckbox",
              onClick: () => {
                const newRenderingMode = isTemplateHidden ? "template-locked" : "post-only";
                setRenderingMode2(newRenderingMode);
                setDefaultRenderingMode2(newRenderingMode);
                resetZoomLevel();
              },
              children: (0, import_i18n190.__)("Show template")
            }
          ) }),
          isViewable && /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(import_components180.MenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(
            PostPreviewButton,
            {
              className: "editor-preview-dropdown__button-external",
              role: "menuitem",
              forceIsAutosaveable,
              "aria-label": (0, import_i18n190.__)("Preview in new tab"),
              textContent: /* @__PURE__ */ (0, import_jsx_runtime305.jsxs)(import_jsx_runtime305.Fragment, { children: [
                (0, import_i18n190.__)("Preview in new tab"),
                /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(import_components180.Icon, { icon: external_default })
              ] }),
              onPreview: onClose
            }
          ) }),
          /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(
            action_item_default.Slot,
            {
              name: "core/plugin-preview-menu",
              fillProps: { onClick: onClose }
            }
          )
        ] })
      }
    );
  }

  // packages/editor/build-module/components/zoom-out-toggle/index.mjs
  var import_components181 = __toESM(require_components(), 1);
  var import_i18n191 = __toESM(require_i18n(), 1);
  var import_element143 = __toESM(require_element(), 1);
  var import_data187 = __toESM(require_data(), 1);
  var import_block_editor72 = __toESM(require_block_editor(), 1);
  var import_preferences19 = __toESM(require_preferences(), 1);
  var import_keyboard_shortcuts7 = __toESM(require_keyboard_shortcuts(), 1);
  var import_keycodes14 = __toESM(require_keycodes(), 1);
  var import_jsx_runtime306 = __toESM(require_jsx_runtime(), 1);
  var ZoomOutToggle = ({ disabled }) => {
    const { isZoomOut, showIconLabels, isDistractionFree } = (0, import_data187.useSelect)(
      (select5) => ({
        isZoomOut: unlock(select5(import_block_editor72.store)).isZoomOut(),
        showIconLabels: select5(import_preferences19.store).get(
          "core",
          "showIconLabels"
        ),
        isDistractionFree: select5(import_preferences19.store).get(
          "core",
          "distractionFree"
        )
      })
    );
    const { resetZoomLevel, setZoomLevel } = unlock(
      (0, import_data187.useDispatch)(import_block_editor72.store)
    );
    const { registerShortcut, unregisterShortcut } = (0, import_data187.useDispatch)(
      import_keyboard_shortcuts7.store
    );
    (0, import_element143.useEffect)(() => {
      registerShortcut({
        name: "core/editor/zoom",
        category: "global",
        description: (0, import_i18n191.__)("Enter or exit zoom out."),
        keyCombination: {
          // `primaryShift+0` (`ctrl+shift+0`) is the shortcut for switching
          // to input mode in Windows, so apply a different key combination.
          modifier: (0, import_keycodes14.isAppleOS)() ? "primaryShift" : "secondary",
          character: "0"
        }
      });
      return () => {
        unregisterShortcut("core/editor/zoom");
      };
    }, [registerShortcut, unregisterShortcut]);
    (0, import_keyboard_shortcuts7.useShortcut)(
      "core/editor/zoom",
      () => {
        if (isZoomOut) {
          resetZoomLevel();
        } else {
          setZoomLevel("auto-scaled");
        }
      },
      {
        isDisabled: isDistractionFree
      }
    );
    const handleZoomOut = () => {
      if (isZoomOut) {
        resetZoomLevel();
      } else {
        setZoomLevel("auto-scaled");
      }
    };
    return /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
      import_components181.Button,
      {
        accessibleWhenDisabled: true,
        disabled,
        onClick: handleZoomOut,
        icon: square_default,
        label: (0, import_i18n191.__)("Zoom Out"),
        isPressed: isZoomOut,
        size: "compact",
        showTooltip: !showIconLabels,
        className: "editor-zoom-out-toggle"
      }
    );
  };
  var zoom_out_toggle_default = ZoomOutToggle;

  // packages/editor/build-module/components/header/index.mjs
  var import_jsx_runtime307 = __toESM(require_jsx_runtime(), 1);
  var toolbarVariations = {
    distractionFreeDisabled: { y: "-50px" },
    distractionFreeHover: { y: 0 },
    distractionFreeHidden: { y: "-50px" },
    visible: { y: 0 },
    hidden: { y: 0 }
  };
  var backButtonVariations = {
    distractionFreeDisabled: { x: "-100%" },
    distractionFreeHover: { x: 0 },
    distractionFreeHidden: { x: "-100%" },
    visible: { x: 0 },
    hidden: { x: 0 }
  };
  function Header({
    customSaveButton,
    forceIsDirty,
    setEntitiesSavedStatesCallback
  }) {
    const isWideViewport = (0, import_compose49.useViewportMatch)("large");
    const isLargeViewport = (0, import_compose49.useViewportMatch)("medium");
    const isTooNarrowForDocumentBar = (0, import_compose49.useMediaQuery)("(max-width: 403px)");
    const {
      postType: postType2,
      isTextEditor,
      isPublishSidebarOpened: isPublishSidebarOpened2,
      showIconLabels,
      hasFixedToolbar,
      hasBlockSelection,
      hasSectionRootClientId,
      isStylesCanvasActive
    } = (0, import_data188.useSelect)((select5) => {
      const { get: getPreference } = select5(import_preferences20.store);
      const {
        getEditorMode: getEditorMode2,
        getCurrentPostType: getCurrentPostType2,
        isPublishSidebarOpened: _isPublishSidebarOpened
      } = select5(store);
      const { getStylesPath: getStylesPath2, getShowStylebook: getShowStylebook2 } = unlock(
        select5(store)
      );
      const { getBlockSelectionStart: getBlockSelectionStart2, getSectionRootClientId } = unlock(
        select5(import_block_editor73.store)
      );
      return {
        postType: getCurrentPostType2(),
        isTextEditor: getEditorMode2() === "text",
        isPublishSidebarOpened: _isPublishSidebarOpened(),
        showIconLabels: getPreference("core", "showIconLabels"),
        hasFixedToolbar: getPreference("core", "fixedToolbar"),
        hasBlockSelection: !!getBlockSelectionStart2(),
        hasSectionRootClientId: !!getSectionRootClientId(),
        isStylesCanvasActive: !!getStylesPath2()?.startsWith("/revisions") || getShowStylebook2()
      };
    }, []);
    const canBeZoomedOut = ["post", "page", "wp_template"].includes(postType2) && hasSectionRootClientId;
    const disablePreviewOption = [
      NAVIGATION_POST_TYPE,
      TEMPLATE_PART_POST_TYPE,
      PATTERN_POST_TYPE
    ].includes(postType2) || isStylesCanvasActive;
    const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0, import_element144.useState)(true);
    const hasCenter = !isTooNarrowForDocumentBar && (!hasFixedToolbar || hasFixedToolbar && (!hasBlockSelection || isBlockToolsCollapsed));
    const hasBackButton = useHasBackButton();
    return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("div", { className: "editor-header edit-post-header", children: [
      hasBackButton && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
        import_components182.__unstableMotion.div,
        {
          className: "editor-header__back-button",
          variants: backButtonVariations,
          transition: { type: "tween" },
          children: /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(back_button_default.Slot, {})
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)(
        import_components182.__unstableMotion.div,
        {
          variants: toolbarVariations,
          className: "editor-header__toolbar",
          transition: { type: "tween" },
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
              document_tools_default,
              {
                disableBlockTools: isStylesCanvasActive || isTextEditor
              }
            ),
            hasFixedToolbar && isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
              CollapsibleBlockToolbar,
              {
                isCollapsed: isBlockToolsCollapsed,
                onToggle: setIsBlockToolsCollapsed
              }
            )
          ]
        }
      ),
      hasCenter && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
        import_components182.__unstableMotion.div,
        {
          className: "editor-header__center",
          variants: toolbarVariations,
          transition: { type: "tween" },
          children: /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(DocumentBar, {})
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)(
        import_components182.__unstableMotion.div,
        {
          variants: toolbarVariations,
          transition: { type: "tween" },
          className: "editor-header__settings",
          children: [
            !customSaveButton && !isPublishSidebarOpened2 && /*
            * This button isn't completely hidden by the publish sidebar.
            * We can't hide the whole toolbar when the publish sidebar is open because
            * we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
            * We track that DOM node to return focus to the PostPublishButtonOrToggle
            * when the publish sidebar has been closed.
            */
            /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(PostSavedState, { forceIsDirty }),
            /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(PostViewLink, {}),
            /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
              PreviewDropdown,
              {
                forceIsAutosaveable: forceIsDirty,
                disabled: disablePreviewOption
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
              PostPreviewButton,
              {
                className: "editor-header__post-preview-button",
                forceIsAutosaveable: forceIsDirty
              }
            ),
            isWideViewport && canBeZoomedOut && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(zoom_out_toggle_default, { disabled: isStylesCanvasActive }),
            (isWideViewport || !showIconLabels) && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(pinned_items_default.Slot, { scope: "core" }),
            !customSaveButton && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
              PostPublishButtonOrToggle,
              {
                forceIsDirty,
                setEntitiesSavedStatesCallback
              }
            ),
            customSaveButton,
            /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(MoreMenu, {})
          ]
        }
      )
    ] });
  }
  var header_default2 = Header;

  // packages/editor/build-module/components/inserter-sidebar/index.mjs
  var import_data189 = __toESM(require_data(), 1);
  var import_block_editor74 = __toESM(require_block_editor(), 1);
  var import_compose50 = __toESM(require_compose(), 1);
  var import_element145 = __toESM(require_element(), 1);
  var import_preferences21 = __toESM(require_preferences(), 1);
  var import_keycodes15 = __toESM(require_keycodes(), 1);
  var import_jsx_runtime308 = __toESM(require_jsx_runtime(), 1);
  var { PrivateInserterLibrary } = unlock(import_block_editor74.privateApis);
  function InserterSidebar() {
    const {
      blockSectionRootClientId,
      inserterSidebarToggleRef: inserterSidebarToggleRef2,
      inserter,
      showMostUsedBlocks,
      sidebarIsOpened
    } = (0, import_data189.useSelect)((select5) => {
      const {
        getInserterSidebarToggleRef: getInserterSidebarToggleRef2,
        getInserter: getInserter2,
        isPublishSidebarOpened: isPublishSidebarOpened2
      } = unlock(select5(store));
      const { getBlockRootClientId: getBlockRootClientId2, isZoomOut, getSectionRootClientId } = unlock(select5(import_block_editor74.store));
      const { get } = select5(import_preferences21.store);
      const { getActiveComplementaryArea: getActiveComplementaryArea2 } = select5(store2);
      const getBlockSectionRootClientId = () => {
        if (isZoomOut()) {
          const sectionRootClientId = getSectionRootClientId();
          if (sectionRootClientId) {
            return sectionRootClientId;
          }
        }
        return getBlockRootClientId2();
      };
      return {
        inserterSidebarToggleRef: getInserterSidebarToggleRef2(),
        inserter: getInserter2(),
        showMostUsedBlocks: get("core", "mostUsedBlocks"),
        blockSectionRootClientId: getBlockSectionRootClientId(),
        sidebarIsOpened: !!(getActiveComplementaryArea2("core") || isPublishSidebarOpened2())
      };
    }, []);
    const { setIsInserterOpened: setIsInserterOpened2 } = (0, import_data189.useDispatch)(store);
    const { disableComplementaryArea: disableComplementaryArea2 } = (0, import_data189.useDispatch)(store2);
    const isMobileViewport = (0, import_compose50.useViewportMatch)("medium", "<");
    const libraryRef = (0, import_element145.useRef)();
    const closeInserterSidebar = (0, import_element145.useCallback)(() => {
      setIsInserterOpened2(false);
      inserterSidebarToggleRef2.current?.focus();
    }, [inserterSidebarToggleRef2, setIsInserterOpened2]);
    const closeOnEscape = (0, import_element145.useCallback)(
      (event) => {
        if (event.keyCode === import_keycodes15.ESCAPE && !event.defaultPrevented) {
          event.preventDefault();
          closeInserterSidebar();
        }
      },
      [closeInserterSidebar]
    );
    const inserterContents = /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("div", { className: "editor-inserter-sidebar__content", children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(
      PrivateInserterLibrary,
      {
        showMostUsedBlocks,
        showInserterHelpPanel: true,
        shouldFocusBlock: isMobileViewport,
        rootClientId: blockSectionRootClientId,
        onSelect: inserter.onSelect,
        __experimentalInitialTab: inserter.tab,
        __experimentalInitialCategory: inserter.category,
        __experimentalFilterValue: inserter.filterValue,
        onPatternCategorySelection: sidebarIsOpened ? () => disableComplementaryArea2("core") : void 0,
        ref: libraryRef,
        onClose: closeInserterSidebar
      }
    ) });
    return (
      // eslint-disable-next-line jsx-a11y/no-static-element-interactions
      /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("div", { onKeyDown: closeOnEscape, className: "editor-inserter-sidebar", children: inserterContents })
    );
  }

  // packages/editor/build-module/components/list-view-sidebar/index.mjs
  var import_block_editor75 = __toESM(require_block_editor(), 1);
  var import_compose51 = __toESM(require_compose(), 1);
  var import_data190 = __toESM(require_data(), 1);
  var import_dom3 = __toESM(require_dom(), 1);
  var import_element146 = __toESM(require_element(), 1);
  var import_i18n193 = __toESM(require_i18n(), 1);
  var import_keyboard_shortcuts8 = __toESM(require_keyboard_shortcuts(), 1);
  var import_keycodes16 = __toESM(require_keycodes(), 1);

  // packages/editor/build-module/components/list-view-sidebar/list-view-outline.mjs
  var import_components183 = __toESM(require_components(), 1);
  var import_i18n192 = __toESM(require_i18n(), 1);
  var import_jsx_runtime309 = __toESM(require_jsx_runtime(), 1);
  function ListViewOutline() {
    return /* @__PURE__ */ (0, import_jsx_runtime309.jsxs)(import_jsx_runtime309.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime309.jsxs)("div", { className: "editor-list-view-sidebar__outline", children: [
        /* @__PURE__ */ (0, import_jsx_runtime309.jsxs)("div", { children: [
          /* @__PURE__ */ (0, import_jsx_runtime309.jsx)(import_components183.__experimentalText, { children: (0, import_i18n192.__)("Characters:") }),
          /* @__PURE__ */ (0, import_jsx_runtime309.jsx)(import_components183.__experimentalText, { children: /* @__PURE__ */ (0, import_jsx_runtime309.jsx)(CharacterCount, {}) })
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime309.jsxs)("div", { children: [
          /* @__PURE__ */ (0, import_jsx_runtime309.jsx)(import_components183.__experimentalText, { children: (0, import_i18n192.__)("Words:") }),
          /* @__PURE__ */ (0, import_jsx_runtime309.jsx)(WordCount, {})
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime309.jsxs)("div", { children: [
          /* @__PURE__ */ (0, import_jsx_runtime309.jsx)(import_components183.__experimentalText, { children: (0, import_i18n192.__)("Time to read:") }),
          /* @__PURE__ */ (0, import_jsx_runtime309.jsx)(TimeToRead, {})
        ] })
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime309.jsx)(DocumentOutline, {})
    ] });
  }

  // packages/editor/build-module/components/list-view-sidebar/index.mjs
  var import_jsx_runtime310 = __toESM(require_jsx_runtime(), 1);
  var { TabbedSidebar } = unlock(import_block_editor75.privateApis);
  function ListViewSidebar() {
    const { setIsListViewOpened: setIsListViewOpened2 } = (0, import_data190.useDispatch)(store);
    const { getListViewToggleRef: getListViewToggleRef2 } = unlock((0, import_data190.useSelect)(store));
    const focusOnMountRef = (0, import_compose51.useFocusOnMount)("firstElement");
    const closeListView = (0, import_element146.useCallback)(() => {
      setIsListViewOpened2(false);
      getListViewToggleRef2().current?.focus();
    }, [getListViewToggleRef2, setIsListViewOpened2]);
    const closeOnEscape = (0, import_element146.useCallback)(
      (event) => {
        if (event.keyCode === import_keycodes16.ESCAPE && !event.defaultPrevented) {
          event.preventDefault();
          closeListView();
        }
      },
      [closeListView]
    );
    const [dropZoneElement, setDropZoneElement] = (0, import_element146.useState)(null);
    const [tab, setTab] = (0, import_element146.useState)("list-view");
    const sidebarRef = (0, import_element146.useRef)();
    const tabsRef = (0, import_element146.useRef)();
    const listViewRef = (0, import_element146.useRef)();
    const listViewContainerRef = (0, import_compose51.useMergeRefs)([
      focusOnMountRef,
      listViewRef,
      setDropZoneElement
    ]);
    function handleSidebarFocus(currentTab) {
      const tabPanelFocus = import_dom3.focus.tabbable.find(tabsRef.current)[0];
      if (currentTab === "list-view") {
        const listViewApplicationFocus = import_dom3.focus.tabbable.find(
          listViewRef.current
        )[0];
        const listViewFocusArea = sidebarRef.current.contains(
          listViewApplicationFocus
        ) ? listViewApplicationFocus : tabPanelFocus;
        listViewFocusArea.focus();
      } else {
        tabPanelFocus.focus();
      }
    }
    const handleToggleListViewShortcut = (0, import_element146.useCallback)(() => {
      if (sidebarRef.current.contains(
        sidebarRef.current.ownerDocument.activeElement
      )) {
        closeListView();
      } else {
        handleSidebarFocus(tab);
      }
    }, [closeListView, tab]);
    (0, import_keyboard_shortcuts8.useShortcut)("core/editor/toggle-list-view", handleToggleListViewShortcut);
    return (
      // eslint-disable-next-line jsx-a11y/no-static-element-interactions
      /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(
        "div",
        {
          className: "editor-list-view-sidebar",
          onKeyDown: closeOnEscape,
          ref: sidebarRef,
          children: /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(
            TabbedSidebar,
            {
              tabs: [
                {
                  name: "list-view",
                  title: (0, import_i18n193._x)("List View", "Post overview"),
                  panel: /* @__PURE__ */ (0, import_jsx_runtime310.jsx)("div", { className: "editor-list-view-sidebar__list-view-container", children: /* @__PURE__ */ (0, import_jsx_runtime310.jsx)("div", { className: "editor-list-view-sidebar__list-view-panel-content", children: /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(
                    import_block_editor75.__experimentalListView,
                    {
                      dropZoneElement
                    }
                  ) }) }),
                  panelRef: listViewContainerRef
                },
                {
                  name: "outline",
                  title: (0, import_i18n193._x)("Outline", "Post overview"),
                  panel: /* @__PURE__ */ (0, import_jsx_runtime310.jsx)("div", { className: "editor-list-view-sidebar__list-view-container", children: /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(ListViewOutline, {}) })
                }
              ],
              onClose: closeListView,
              onSelect: (tabName) => setTab(tabName),
              defaultTabId: "list-view",
              ref: tabsRef,
              closeButtonLabel: (0, import_i18n193.__)("Close")
            }
          )
        }
      )
    );
  }

  // packages/editor/build-module/components/save-publish-panels/index.mjs
  var import_data191 = __toESM(require_data(), 1);
  var import_components184 = __toESM(require_components(), 1);
  var import_i18n194 = __toESM(require_i18n(), 1);
  var import_element147 = __toESM(require_element(), 1);
  var import_jsx_runtime311 = __toESM(require_jsx_runtime(), 1);
  var { Fill: Fill11, Slot: Slot13 } = (0, import_components184.createSlotFill)("ActionsPanel");
  function SavePublishPanels({
    setEntitiesSavedStatesCallback,
    closeEntitiesSavedStates,
    isEntitiesSavedStatesOpen,
    forceIsDirtyPublishPanel
  }) {
    const { closePublishSidebar: closePublishSidebar2, togglePublishSidebar: togglePublishSidebar2 } = (0, import_data191.useDispatch)(store);
    const {
      publishSidebarOpened,
      isPublishable,
      isDirty,
      hasOtherEntitiesChanges
    } = (0, import_data191.useSelect)((select5) => {
      const {
        isPublishSidebarOpened: isPublishSidebarOpened2,
        isEditedPostPublishable: isEditedPostPublishable2,
        isCurrentPostPublished: isCurrentPostPublished2,
        isEditedPostDirty: isEditedPostDirty2,
        hasNonPostEntityChanges: hasNonPostEntityChanges2
      } = select5(store);
      const _hasOtherEntitiesChanges = hasNonPostEntityChanges2();
      return {
        publishSidebarOpened: isPublishSidebarOpened2(),
        isPublishable: !isCurrentPostPublished2() && isEditedPostPublishable2(),
        isDirty: _hasOtherEntitiesChanges || isEditedPostDirty2(),
        hasOtherEntitiesChanges: _hasOtherEntitiesChanges
      };
    }, []);
    const openEntitiesSavedStates = (0, import_element147.useCallback)(
      () => setEntitiesSavedStatesCallback(true),
      []
    );
    let unmountableContent;
    if (publishSidebarOpened) {
      unmountableContent = /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(
        post_publish_panel_default,
        {
          onClose: closePublishSidebar2,
          forceIsDirty: forceIsDirtyPublishPanel,
          PrePublishExtension: plugin_pre_publish_panel_default.Slot,
          PostPublishExtension: plugin_post_publish_panel_default.Slot
        }
      );
    } else if (isPublishable && !hasOtherEntitiesChanges) {
      unmountableContent = /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: "editor-layout__toggle-publish-panel", children: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(
        import_components184.Button,
        {
          __next40pxDefaultSize: true,
          variant: "secondary",
          onClick: togglePublishSidebar2,
          "aria-expanded": false,
          children: (0, import_i18n194.__)("Open publish panel")
        }
      ) });
    } else {
      unmountableContent = /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: "editor-layout__toggle-entities-saved-states-panel", children: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(
        import_components184.Button,
        {
          __next40pxDefaultSize: true,
          variant: "secondary",
          onClick: openEntitiesSavedStates,
          "aria-expanded": false,
          "aria-haspopup": "dialog",
          disabled: !isDirty,
          accessibleWhenDisabled: true,
          children: (0, import_i18n194.__)("Open save panel")
        }
      ) });
    }
    return /* @__PURE__ */ (0, import_jsx_runtime311.jsxs)(import_jsx_runtime311.Fragment, { children: [
      isEntitiesSavedStatesOpen && /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(
        EntitiesSavedStates,
        {
          close: closeEntitiesSavedStates,
          renderDialog: true
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(Slot13, { bubblesVirtually: true }),
      !isEntitiesSavedStatesOpen && unmountableContent
    ] });
  }

  // packages/editor/build-module/components/text-editor/index.mjs
  var import_components185 = __toESM(require_components(), 1);
  var import_data192 = __toESM(require_data(), 1);
  var import_i18n195 = __toESM(require_i18n(), 1);
  var import_keyboard_shortcuts9 = __toESM(require_keyboard_shortcuts(), 1);
  var import_element148 = __toESM(require_element(), 1);
  var import_jsx_runtime312 = __toESM(require_jsx_runtime(), 1);
  function TextEditor({ autoFocus = false }) {
    const { switchEditorMode: switchEditorMode2 } = (0, import_data192.useDispatch)(store);
    const { shortcut, isRichEditingEnabled } = (0, import_data192.useSelect)((select5) => {
      const { getEditorSettings: getEditorSettings2 } = select5(store);
      const { getShortcutRepresentation } = select5(import_keyboard_shortcuts9.store);
      return {
        shortcut: getShortcutRepresentation("core/editor/toggle-mode"),
        isRichEditingEnabled: getEditorSettings2().richEditingEnabled
      };
    }, []);
    const titleRef = (0, import_element148.useRef)();
    (0, import_element148.useEffect)(() => {
      if (autoFocus) {
        return;
      }
      titleRef?.current?.focus();
    }, [autoFocus]);
    return /* @__PURE__ */ (0, import_jsx_runtime312.jsxs)("div", { className: "editor-text-editor", children: [
      isRichEditingEnabled && /* @__PURE__ */ (0, import_jsx_runtime312.jsxs)("div", { className: "editor-text-editor__toolbar", children: [
        /* @__PURE__ */ (0, import_jsx_runtime312.jsx)("h2", { children: (0, import_i18n195.__)("Editing code") }),
        /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
          import_components185.Button,
          {
            __next40pxDefaultSize: true,
            variant: "tertiary",
            onClick: () => switchEditorMode2("visual"),
            shortcut,
            children: (0, import_i18n195.__)("Exit code editor")
          }
        )
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime312.jsxs)("div", { className: "editor-text-editor__body", children: [
        /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(post_title_raw_default, { ref: titleRef }),
        /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(PostTextEditor, {})
      ] })
    ] });
  }

  // packages/editor/build-module/components/visual-editor/index.mjs
  var import_block_editor80 = __toESM(require_block_editor(), 1);
  var import_element150 = __toESM(require_element(), 1);
  var import_data198 = __toESM(require_data(), 1);
  var import_blocks32 = __toESM(require_blocks(), 1);
  var import_core_data105 = __toESM(require_core_data(), 1);
  var import_compose56 = __toESM(require_compose(), 1);

  // packages/editor/build-module/components/visual-editor/edit-template-blocks-notification.mjs
  var import_data193 = __toESM(require_data(), 1);
  var import_core_data104 = __toESM(require_core_data(), 1);
  var import_element149 = __toESM(require_element(), 1);
  var import_i18n196 = __toESM(require_i18n(), 1);
  var import_components186 = __toESM(require_components(), 1);
  var import_jsx_runtime313 = __toESM(require_jsx_runtime(), 1);
  function EditTemplateBlocksNotification({ contentRef }) {
    const { onNavigateToEntityRecord, templateId: templateId2 } = (0, import_data193.useSelect)((select5) => {
      const { getEditorSettings: getEditorSettings2, getCurrentTemplateId: getCurrentTemplateId2 } = select5(store);
      return {
        onNavigateToEntityRecord: getEditorSettings2().onNavigateToEntityRecord,
        templateId: getCurrentTemplateId2()
      };
    }, []);
    const canEditTemplate = (0, import_data193.useSelect)(
      (select5) => !!select5(import_core_data104.store).canUser("create", {
        kind: "postType",
        name: "wp_template"
      }),
      []
    );
    const [isDialogOpen, setIsDialogOpen] = (0, import_element149.useState)(false);
    (0, import_element149.useEffect)(() => {
      const handleDblClick = (event) => {
        if (!canEditTemplate) {
          return;
        }
        if (!event.target.classList.contains("is-root-container") || event.target.dataset?.type === "core/template-part") {
          return;
        }
        if (!event.defaultPrevented) {
          event.preventDefault();
          setIsDialogOpen(true);
        }
      };
      const canvas = contentRef.current;
      canvas?.addEventListener("dblclick", handleDblClick);
      return () => {
        canvas?.removeEventListener("dblclick", handleDblClick);
      };
    }, [contentRef, canEditTemplate]);
    if (!canEditTemplate) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(
      import_components186.__experimentalConfirmDialog,
      {
        isOpen: isDialogOpen,
        confirmButtonText: (0, import_i18n196.__)("Edit template"),
        onConfirm: () => {
          setIsDialogOpen(false);
          onNavigateToEntityRecord({
            postId: templateId2,
            postType: "wp_template"
          });
        },
        onCancel: () => setIsDialogOpen(false),
        size: "medium",
        children: (0, import_i18n196.__)(
          "You\u2019ve tried to select a block that is part of a template that may be used elsewhere on your site. Would you like to edit the template?"
        )
      }
    );
  }

  // packages/editor/build-module/components/visual-editor/use-select-nearest-editable-block.mjs
  var import_compose52 = __toESM(require_compose(), 1);
  var import_data194 = __toESM(require_data(), 1);
  var import_block_editor76 = __toESM(require_block_editor(), 1);
  var DISTANCE_THRESHOLD = 500;
  function clamp(value, min2, max2) {
    return Math.min(Math.max(value, min2), max2);
  }
  function distanceFromRect(x2, y3, rect) {
    const dx = x2 - clamp(x2, rect.left, rect.right);
    const dy = y3 - clamp(y3, rect.top, rect.bottom);
    return Math.sqrt(dx * dx + dy * dy);
  }
  function useSelectNearestEditableBlock({
    isEnabled = true
  } = {}) {
    const { getEnabledClientIdsTree, getBlockName: getBlockName2, getBlockOrder: getBlockOrder2 } = unlock(
      (0, import_data194.useSelect)(import_block_editor76.store)
    );
    const { selectBlock: selectBlock2 } = (0, import_data194.useDispatch)(import_block_editor76.store);
    return (0, import_compose52.useRefEffect)(
      (element) => {
        if (!isEnabled) {
          return;
        }
        const selectNearestEditableBlock = (x2, y3) => {
          const editableBlockClientIds = getEnabledClientIdsTree().flatMap(({ clientId }) => {
            const blockName = getBlockName2(clientId);
            if (blockName === "core/template-part") {
              return [];
            }
            if (blockName === "core/post-content") {
              const innerBlocks = getBlockOrder2(clientId);
              if (innerBlocks.length) {
                return innerBlocks;
              }
            }
            return [clientId];
          });
          let nearestDistance = Infinity, nearestClientId = null;
          for (const clientId of editableBlockClientIds) {
            const block = element.querySelector(
              `[data-block="${clientId}"]`
            );
            if (!block) {
              continue;
            }
            const rect = block.getBoundingClientRect();
            const distance = distanceFromRect(x2, y3, rect);
            if (distance < nearestDistance && distance < DISTANCE_THRESHOLD) {
              nearestDistance = distance;
              nearestClientId = clientId;
            }
          }
          if (nearestClientId) {
            selectBlock2(nearestClientId);
          }
        };
        const handleClick = (event) => {
          const shouldSelect = event.target === element || event.target.classList.contains("is-root-container");
          if (shouldSelect) {
            selectNearestEditableBlock(event.clientX, event.clientY);
          }
        };
        element.addEventListener("click", handleClick);
        return () => element.removeEventListener("click", handleClick);
      },
      [isEnabled]
    );
  }

  // packages/editor/build-module/components/visual-editor/use-zoom-out-mode-exit.mjs
  var import_data195 = __toESM(require_data(), 1);
  var import_compose53 = __toESM(require_compose(), 1);
  var import_block_editor77 = __toESM(require_block_editor(), 1);
  function useZoomOutModeExit() {
    const { getSettings: getSettings5, isZoomOut } = unlock((0, import_data195.useSelect)(import_block_editor77.store));
    const { resetZoomLevel } = unlock((0, import_data195.useDispatch)(import_block_editor77.store));
    return (0, import_compose53.useRefEffect)(
      (node) => {
        function onDoubleClick(event) {
          if (!isZoomOut()) {
            return;
          }
          if (!event.defaultPrevented) {
            event.preventDefault();
            const { __experimentalSetIsInserterOpened } = getSettings5();
            if (typeof __experimentalSetIsInserterOpened === "function") {
              __experimentalSetIsInserterOpened(false);
            }
            resetZoomLevel();
          }
        }
        node.addEventListener("dblclick", onDoubleClick);
        return () => {
          node.removeEventListener("dblclick", onDoubleClick);
        };
      },
      [getSettings5, isZoomOut, resetZoomLevel]
    );
  }

  // packages/editor/build-module/components/visual-editor/use-padding-appender.mjs
  var import_data196 = __toESM(require_data(), 1);
  var import_compose54 = __toESM(require_compose(), 1);
  var import_block_editor78 = __toESM(require_block_editor(), 1);
  var import_blocks31 = __toESM(require_blocks(), 1);
  var CSS2 = ':root :where(.editor-styles-wrapper)::after {content: ""; display: block; height: 40vh;}';
  function usePaddingAppender(enabled) {
    const registry = (0, import_data196.useRegistry)();
    const effect = (0, import_compose54.useRefEffect)(
      (node) => {
        function onMouseDown(event) {
          if (event.target !== node && // Tests for the parent element because in the iframed editor if the click is
          // below the padding the target will be the parent element (html) and should
          // still be treated as intent to append.
          event.target !== node.parentElement) {
            return;
          }
          const lastChild = node.lastElementChild;
          if (!lastChild) {
            return;
          }
          const lastChildRect = lastChild.getBoundingClientRect();
          if (event.clientY < lastChildRect.bottom) {
            return;
          }
          event.preventDefault();
          const blockOrder = registry.select(import_block_editor78.store).getBlockOrder("");
          const lastBlockClientId = blockOrder[blockOrder.length - 1];
          const lastBlock = registry.select(import_block_editor78.store).getBlock(lastBlockClientId);
          const { selectBlock: selectBlock2, insertDefaultBlock: insertDefaultBlock2 } = registry.dispatch(import_block_editor78.store);
          if (lastBlock && (0, import_blocks31.isUnmodifiedDefaultBlock)(lastBlock)) {
            selectBlock2(lastBlockClientId);
          } else {
            insertDefaultBlock2();
          }
        }
        const { ownerDocument } = node;
        ownerDocument.addEventListener("pointerdown", onMouseDown);
        return () => {
          ownerDocument.removeEventListener("pointerdown", onMouseDown);
        };
      },
      [registry]
    );
    return enabled ? [effect, CSS2] : [];
  }

  // packages/editor/build-module/components/visual-editor/use-edit-content-only-section-exit.mjs
  var import_data197 = __toESM(require_data(), 1);
  var import_compose55 = __toESM(require_compose(), 1);
  var import_block_editor79 = __toESM(require_block_editor(), 1);
  function useEditContentOnlySectionExit() {
    const { getEditedContentOnlySection } = unlock(
      (0, import_data197.useSelect)(import_block_editor79.store)
    );
    const { stopEditingContentOnlySection } = unlock(
      (0, import_data197.useDispatch)(import_block_editor79.store)
    );
    return (0, import_compose55.useRefEffect)(
      (node) => {
        function onClick(event) {
          const editedContentOnlySection = getEditedContentOnlySection();
          if (!editedContentOnlySection) {
            return;
          }
          const isClickOutside = !event.target.closest(
            `[data-block="${editedContentOnlySection}"]`
          );
          if (isClickOutside && !event.defaultPrevented) {
            event.preventDefault();
            stopEditingContentOnlySection();
          }
        }
        node.addEventListener("click", onClick);
        return () => {
          node.removeEventListener("click", onClick);
        };
      },
      [getEditedContentOnlySection, stopEditingContentOnlySection]
    );
  }

  // packages/editor/build-module/components/visual-editor/index.mjs
  var import_jsx_runtime314 = __toESM(require_jsx_runtime(), 1);
  var {
    LayoutStyle,
    useLayoutClasses,
    useLayoutStyles,
    ExperimentalBlockCanvas: BlockCanvas,
    useFlashEditableBlocks
  } = unlock(import_block_editor80.privateApis);
  function getPostContentAttributes(blocks) {
    for (let i3 = 0; i3 < blocks.length; i3++) {
      if (blocks[i3].name === "core/post-content") {
        return blocks[i3].attributes;
      }
      if (blocks[i3].innerBlocks.length) {
        const nestedPostContent = getPostContentAttributes(
          blocks[i3].innerBlocks
        );
        if (nestedPostContent) {
          return nestedPostContent;
        }
      }
    }
  }
  function checkForPostContentAtRootLevel(blocks) {
    for (let i3 = 0; i3 < blocks.length; i3++) {
      if (blocks[i3].name === "core/post-content") {
        return true;
      }
    }
    return false;
  }
  function VisualEditor({
    // Ideally as we unify post and site editors, we won't need these props.
    autoFocus,
    disableIframe = false,
    iframeProps,
    contentRef,
    className
  }) {
    const isMobileViewport = (0, import_compose56.useViewportMatch)("small", "<");
    const {
      renderingMode: renderingMode2,
      postContentAttributes,
      editedPostTemplate = {},
      wrapperBlockName,
      wrapperUniqueId,
      deviceType: deviceType2,
      isFocusedEntity,
      isDesignPostType,
      postType: postType2,
      isPreview,
      styles,
      canvasMinHeight: canvasMinHeight2
    } = (0, import_data198.useSelect)((select5) => {
      const {
        getCurrentPostId: getCurrentPostId2,
        getCurrentPostType: getCurrentPostType2,
        getCurrentTemplateId: getCurrentTemplateId2,
        getEditorSettings: getEditorSettings2,
        getRenderingMode: getRenderingMode2,
        getDeviceType: getDeviceType2,
        getCanvasMinHeight: getCanvasMinHeight2
      } = unlock(select5(store));
      const { getPostType, getEditedEntityRecord } = select5(import_core_data105.store);
      const postTypeSlug = getCurrentPostType2();
      const _renderingMode = getRenderingMode2();
      let _wrapperBlockName;
      if (postTypeSlug === PATTERN_POST_TYPE) {
        _wrapperBlockName = "core/block";
      } else if (_renderingMode === "post-only") {
        _wrapperBlockName = "core/post-content";
      }
      const editorSettings2 = getEditorSettings2();
      const supportsTemplateMode = editorSettings2.supportsTemplateMode;
      const postTypeObject = getPostType(postTypeSlug);
      const currentTemplateId = getCurrentTemplateId2();
      const template2 = currentTemplateId ? getEditedEntityRecord(
        "postType",
        TEMPLATE_POST_TYPE,
        currentTemplateId
      ) : void 0;
      return {
        renderingMode: _renderingMode,
        postContentAttributes: editorSettings2.postContentAttributes,
        isDesignPostType: DESIGN_POST_TYPES.includes(postTypeSlug),
        // Post template fetch returns a 404 on classic themes, which
        // messes with e2e tests, so check it's a block theme first.
        editedPostTemplate: postTypeObject?.viewable && supportsTemplateMode ? template2 : void 0,
        wrapperBlockName: _wrapperBlockName,
        wrapperUniqueId: getCurrentPostId2(),
        deviceType: getDeviceType2(),
        isFocusedEntity: !!editorSettings2.onNavigateToPreviousEntityRecord,
        postType: postTypeSlug,
        isPreview: editorSettings2.isPreviewMode,
        styles: editorSettings2.styles,
        canvasMinHeight: getCanvasMinHeight2()
      };
    }, []);
    const { isCleanNewPost: isCleanNewPost2 } = (0, import_data198.useSelect)(store);
    const {
      hasRootPaddingAwareAlignments,
      themeHasDisabledLayoutStyles,
      themeSupportsLayout,
      isZoomedOut
    } = (0, import_data198.useSelect)((select5) => {
      const { getSettings: getSettings5, isZoomOut: _isZoomOut } = unlock(
        select5(import_block_editor80.store)
      );
      const _settings = getSettings5();
      return {
        themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
        themeSupportsLayout: _settings.supportsLayout,
        hasRootPaddingAwareAlignments: _settings.__experimentalFeatures?.useRootPaddingAwareAlignments,
        isZoomedOut: _isZoomOut()
      };
    }, []);
    const localRef = (0, import_element150.useRef)();
    const deviceStyles = (0, import_block_editor80.__experimentalUseResizeCanvas)(deviceType2);
    const [globalLayoutSettings] = (0, import_block_editor80.useSettings)("layout");
    const fallbackLayout = (0, import_element150.useMemo)(() => {
      if (renderingMode2 !== "post-only" || isDesignPostType) {
        return { type: "default" };
      }
      if (themeSupportsLayout) {
        return { ...globalLayoutSettings, type: "constrained" };
      }
      return { type: "default" };
    }, [
      renderingMode2,
      themeSupportsLayout,
      globalLayoutSettings,
      isDesignPostType
    ]);
    const newestPostContentAttributes = (0, import_element150.useMemo)(() => {
      if (!editedPostTemplate?.content && !editedPostTemplate?.blocks && postContentAttributes) {
        return postContentAttributes;
      }
      if (editedPostTemplate?.blocks) {
        return getPostContentAttributes(editedPostTemplate?.blocks);
      }
      const parseableContent = typeof editedPostTemplate?.content === "string" ? editedPostTemplate?.content : "";
      return getPostContentAttributes((0, import_blocks32.parse)(parseableContent)) || {};
    }, [
      editedPostTemplate?.content,
      editedPostTemplate?.blocks,
      postContentAttributes
    ]);
    const hasPostContentAtRootLevel = (0, import_element150.useMemo)(() => {
      if (!editedPostTemplate?.content && !editedPostTemplate?.blocks) {
        return false;
      }
      if (editedPostTemplate?.blocks) {
        return checkForPostContentAtRootLevel(editedPostTemplate?.blocks);
      }
      const parseableContent = typeof editedPostTemplate?.content === "string" ? editedPostTemplate?.content : "";
      return checkForPostContentAtRootLevel((0, import_blocks32.parse)(parseableContent)) || false;
    }, [editedPostTemplate?.content, editedPostTemplate?.blocks]);
    const { layout = {}, align = "" } = newestPostContentAttributes || {};
    const postContentLayoutClasses = useLayoutClasses(
      newestPostContentAttributes,
      "core/post-content"
    );
    const blockListLayoutClass = clsx_default(
      {
        "is-layout-flow": !themeSupportsLayout
      },
      themeSupportsLayout && postContentLayoutClasses,
      align && `align${align}`
    );
    const postContentLayoutStyles = useLayoutStyles(
      newestPostContentAttributes,
      "core/post-content",
      ".block-editor-block-list__layout.is-root-container"
    );
    const postContentLayout = (0, import_element150.useMemo)(() => {
      return layout && (layout?.type === "constrained" || layout?.inherit || layout?.contentSize || layout?.wideSize) ? { ...globalLayoutSettings, ...layout, type: "constrained" } : { ...globalLayoutSettings, ...layout, type: "default" };
    }, [
      layout?.type,
      layout?.inherit,
      layout?.contentSize,
      layout?.wideSize,
      globalLayoutSettings
    ]);
    const blockListLayout = postContentAttributes ? postContentLayout : fallbackLayout;
    const postEditorLayout = blockListLayout?.type === "default" && !hasPostContentAtRootLevel ? fallbackLayout : blockListLayout;
    const observeTypingRef = (0, import_block_editor80.__unstableUseTypingObserver)();
    const titleRef = (0, import_element150.useRef)();
    (0, import_element150.useEffect)(() => {
      if (!autoFocus || !isCleanNewPost2()) {
        return;
      }
      titleRef?.current?.focus();
    }, [autoFocus, isCleanNewPost2]);
    const alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}
		.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}
		.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}
		.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;
    const enableResizing = [
      NAVIGATION_POST_TYPE,
      TEMPLATE_PART_POST_TYPE,
      PATTERN_POST_TYPE
    ].includes(postType2) && // Disable in previews / view mode.
    !isPreview && // Disable resizing in mobile viewport.
    !isMobileViewport && // Disable resizing in zoomed-out mode.
    !isZoomedOut;
    const calculatedMinHeight = (0, import_element150.useMemo)(() => {
      if (!localRef.current) {
        return canvasMinHeight2;
      }
      const { ownerDocument } = localRef.current;
      const scrollTop = ownerDocument.documentElement.scrollTop || ownerDocument.body.scrollTop;
      return canvasMinHeight2 + scrollTop;
    }, [canvasMinHeight2]);
    const [paddingAppenderRef, paddingStyle] = usePaddingAppender(
      !isPreview && renderingMode2 === "post-only" && !isDesignPostType
    );
    const iframeStyles = (0, import_element150.useMemo)(() => {
      return [
        ...styles ?? [],
        {
          // Ensures margins of children are contained so that the body background paints behind them.
          // Otherwise, the background of html (when zoomed out) would show there and appear broken. It's
          // important mostly for post-only views yet conceivably an issue in templated views too.
          css: `:where(.block-editor-iframe__body){display:flow-root;${calculatedMinHeight ? `min-height:${calculatedMinHeight}px;` : ""}}.is-root-container{display:flow-root;${// Some themes will have `min-height: 100vh` for the root container,
          // which isn't a requirement in auto resize mode.
          enableResizing ? "min-height:0!important;" : ""}}
				${paddingStyle ? paddingStyle : ""}
				${enableResizing ? `.block-editor-iframe__html{background:var(--wp-editor-canvas-background);display:flex;align-items:center;justify-content:center;min-height:100vh;}.block-editor-iframe__body{width:100%;}` : ""}`
          // The CSS above centers the body content vertically when resizing is enabled and applies a background
          // color to the iframe HTML element to match the background color of the editor canvas.
        }
      ];
    }, [styles, enableResizing, calculatedMinHeight, paddingStyle]);
    const typewriterRef = (0, import_block_editor80.__unstableUseTypewriter)();
    contentRef = (0, import_compose56.useMergeRefs)([
      localRef,
      contentRef,
      renderingMode2 === "post-only" ? typewriterRef : null,
      useFlashEditableBlocks({
        isEnabled: renderingMode2 === "template-locked"
      }),
      useSelectNearestEditableBlock({
        isEnabled: renderingMode2 === "template-locked"
      }),
      useZoomOutModeExit(),
      paddingAppenderRef,
      useEditContentOnlySectionExit()
    ]);
    return /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
      "div",
      {
        className: clsx_default(
          "editor-visual-editor",
          // this class is here for backward compatibility reasons.
          "edit-post-visual-editor",
          className,
          {
            "has-padding": isFocusedEntity || enableResizing,
            "is-resizable": enableResizing,
            "is-iframed": !disableIframe
          }
        ),
        children: /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(resizable_editor_default, { enableResizing, height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime314.jsxs)(
          BlockCanvas,
          {
            shouldIframe: !disableIframe,
            contentRef,
            styles: iframeStyles,
            height: "100%",
            iframeProps: {
              ...iframeProps,
              style: {
                ...iframeProps?.style,
                ...deviceStyles
              }
            },
            children: [
              themeSupportsLayout && !themeHasDisabledLayoutStyles && renderingMode2 === "post-only" && !isDesignPostType && /* @__PURE__ */ (0, import_jsx_runtime314.jsxs)(import_jsx_runtime314.Fragment, { children: [
                /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
                  LayoutStyle,
                  {
                    selector: ".editor-visual-editor__post-title-wrapper",
                    layout: fallbackLayout
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
                  LayoutStyle,
                  {
                    selector: ".block-editor-block-list__layout.is-root-container",
                    layout: postEditorLayout
                  }
                ),
                align && /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(LayoutStyle, { css: alignCSS }),
                postContentLayoutStyles && /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
                  LayoutStyle,
                  {
                    layout: postContentLayout,
                    css: postContentLayoutStyles
                  }
                )
              ] }),
              renderingMode2 === "post-only" && !isDesignPostType && /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
                "div",
                {
                  className: clsx_default(
                    "editor-visual-editor__post-title-wrapper",
                    // The following class is only here for backward compatibility
                    // some themes might be using it to style the post title.
                    "edit-post-visual-editor__post-title-wrapper",
                    {
                      "has-global-padding": hasRootPaddingAwareAlignments
                    }
                  ),
                  contentEditable: false,
                  ref: observeTypingRef,
                  style: {
                    // This is using inline styles
                    // so it's applied for both iframed and non iframed editors.
                    marginTop: "4rem"
                  },
                  children: /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(post_title_default, { ref: titleRef })
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime314.jsxs)(
                import_block_editor80.RecursionProvider,
                {
                  blockName: wrapperBlockName,
                  uniqueId: wrapperUniqueId,
                  children: [
                    /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
                      import_block_editor80.BlockList,
                      {
                        className: clsx_default(
                          "is-" + deviceType2.toLowerCase() + "-preview",
                          renderingMode2 !== "post-only" || isDesignPostType ? "wp-site-blocks" : `${blockListLayoutClass} wp-block-post-content`,
                          // Ensure root level blocks receive default/flow blockGap styling rules.
                          {
                            "has-global-padding": renderingMode2 === "post-only" && !isDesignPostType && hasRootPaddingAwareAlignments
                          }
                        ),
                        layout: blockListLayout,
                        dropZoneElement: (
                          // When iframed, pass in the html element of the iframe to
                          // ensure the drop zone extends to the edges of the iframe.
                          disableIframe ? localRef.current : localRef.current?.parentNode
                        ),
                        __unstableDisableDropZone: (
                          // In template preview mode, disable drop zones at the root of the template.
                          renderingMode2 === "template-locked" ? true : false
                        )
                      }
                    ),
                    renderingMode2 === "template-locked" && /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
                      EditTemplateBlocksNotification,
                      {
                        contentRef: localRef
                      }
                    )
                  ]
                }
              )
            ]
          }
        ) })
      }
    );
  }
  var visual_editor_default = VisualEditor;

  // packages/editor/build-module/components/editor-interface/index.mjs
  var import_jsx_runtime315 = __toESM(require_jsx_runtime(), 1);
  var interfaceLabels = {
    /* translators: accessibility text for the editor top bar landmark region. */
    header: (0, import_i18n197.__)("Editor top bar"),
    /* translators: accessibility text for the editor content landmark region. */
    body: (0, import_i18n197.__)("Editor content"),
    /* translators: accessibility text for the editor settings landmark region. */
    sidebar: (0, import_i18n197.__)("Editor settings"),
    /* translators: accessibility text for the editor publish landmark region. */
    actions: (0, import_i18n197.__)("Editor publish"),
    /* translators: accessibility text for the editor footer landmark region. */
    footer: (0, import_i18n197.__)("Editor footer")
  };
  function EditorInterface({
    className,
    children,
    forceIsDirty,
    contentRef,
    disableIframe,
    autoFocus,
    customSaveButton,
    customSavePanel,
    forceDisableBlockTools,
    iframeProps
  }) {
    const {
      mode,
      isInserterOpened: isInserterOpened2,
      isListViewOpened: isListViewOpened2,
      isDistractionFree,
      isPreviewMode,
      showBlockBreadcrumbs,
      postTypeLabel,
      stylesPath: stylesPath2,
      showStylebook: showStylebook2
    } = (0, import_data199.useSelect)((select5) => {
      const { get } = select5(import_preferences22.store);
      const { getEditorSettings: getEditorSettings2, getPostTypeLabel: getPostTypeLabel2 } = select5(store);
      const { getStylesPath: getStylesPath2, getShowStylebook: getShowStylebook2 } = unlock(
        select5(store)
      );
      const editorSettings2 = getEditorSettings2();
      let _mode = select5(store).getEditorMode();
      if (!editorSettings2.richEditingEnabled && _mode === "visual") {
        _mode = "text";
      }
      if (!editorSettings2.codeEditingEnabled && _mode === "text") {
        _mode = "visual";
      }
      return {
        mode: _mode,
        isInserterOpened: select5(store).isInserterOpened(),
        isListViewOpened: select5(store).isListViewOpened(),
        isDistractionFree: get("core", "distractionFree"),
        isPreviewMode: editorSettings2.isPreviewMode,
        showBlockBreadcrumbs: get("core", "showBlockBreadcrumbs"),
        postTypeLabel: getPostTypeLabel2(),
        stylesPath: getStylesPath2(),
        showStylebook: getShowStylebook2()
      };
    }, []);
    const isLargeViewport = (0, import_compose57.useViewportMatch)("medium");
    const secondarySidebarLabel = isListViewOpened2 ? (0, import_i18n197.__)("Document Overview") : (0, import_i18n197.__)("Block Library");
    const shouldShowStylesCanvas = showStylebook2 || stylesPath2?.startsWith("/revisions");
    const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0, import_element151.useState)(false);
    const closeEntitiesSavedStates = (0, import_element151.useCallback)(
      (arg) => {
        if (typeof entitiesSavedStatesCallback === "function") {
          entitiesSavedStatesCallback(arg);
        }
        setEntitiesSavedStatesCallback(false);
      },
      [entitiesSavedStatesCallback]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
      interface_skeleton_default,
      {
        isDistractionFree,
        className: clsx_default("editor-editor-interface", className, {
          "is-entity-save-view-open": !!entitiesSavedStatesCallback,
          "is-distraction-free": isDistractionFree && !isPreviewMode
        }),
        labels: {
          ...interfaceLabels,
          secondarySidebar: secondarySidebarLabel
        },
        header: !isPreviewMode && /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
          header_default2,
          {
            forceIsDirty,
            setEntitiesSavedStatesCallback,
            customSaveButton,
            forceDisableBlockTools
          }
        ),
        editorNotices: /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(editor_notices_default, {}),
        secondarySidebar: !isPreviewMode && mode === "visual" && (isInserterOpened2 && /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(InserterSidebar, {}) || isListViewOpened2 && /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(ListViewSidebar, {})),
        sidebar: !isPreviewMode && !isDistractionFree && /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(complementary_area_default.Slot, { scope: "core" }),
        content: /* @__PURE__ */ (0, import_jsx_runtime315.jsxs)(import_jsx_runtime315.Fragment, { children: [
          !isDistractionFree && !isPreviewMode && /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(editor_notices_default, {}),
          shouldShowStylesCanvas ? /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(StylesCanvas, {}) : /* @__PURE__ */ (0, import_jsx_runtime315.jsxs)(import_jsx_runtime315.Fragment, { children: [
            !isPreviewMode && mode === "text" && /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
              TextEditor,
              {
                autoFocus
              }
            ),
            !isPreviewMode && !isLargeViewport && mode === "visual" && /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(import_block_editor81.BlockToolbar, { hideDragHandle: true }),
            (isPreviewMode || mode === "visual") && /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
              visual_editor_default,
              {
                contentRef,
                disableIframe,
                autoFocus,
                iframeProps
              }
            ),
            children
          ] })
        ] }),
        footer: !isPreviewMode && !isDistractionFree && isLargeViewport && showBlockBreadcrumbs && mode === "visual" && /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
          import_block_editor81.BlockBreadcrumb,
          {
            rootLabelText: postTypeLabel ? (0, import_html_entities26.decodeEntities)(postTypeLabel) : void 0
          }
        ),
        actions: !isPreviewMode ? customSavePanel || /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
          SavePublishPanels,
          {
            closeEntitiesSavedStates,
            isEntitiesSavedStatesOpen: entitiesSavedStatesCallback,
            setEntitiesSavedStatesCallback,
            forceIsDirtyPublishPanel: forceIsDirty
          }
        ) : void 0
      }
    );
  }

  // packages/editor/build-module/components/sidebar/index.mjs
  var import_block_editor90 = __toESM(require_block_editor(), 1);
  var import_data219 = __toESM(require_data(), 1);
  var import_element167 = __toESM(require_element(), 1);
  var import_i18n212 = __toESM(require_i18n(), 1);
  var import_keyboard_shortcuts10 = __toESM(require_keyboard_shortcuts(), 1);
  var import_components203 = __toESM(require_components(), 1);

  // packages/editor/build-module/components/pattern-overrides-panel/index.mjs
  var import_data200 = __toESM(require_data(), 1);
  var import_patterns9 = __toESM(require_patterns(), 1);
  var import_jsx_runtime316 = __toESM(require_jsx_runtime(), 1);
  var { OverridesPanel } = unlock(import_patterns9.privateApis);
  function PatternOverridesPanel() {
    const supportsPatternOverridesPanel = (0, import_data200.useSelect)(
      (select5) => select5(store).getCurrentPostType() === "wp_block",
      []
    );
    if (!supportsPatternOverridesPanel) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(OverridesPanel, {});
  }

  // packages/editor/build-module/components/sidebar/post-summary.mjs
  var import_components198 = __toESM(require_components(), 1);
  var import_data212 = __toESM(require_data(), 1);

  // packages/editor/build-module/components/post-card-panel/index.mjs
  var import_components190 = __toESM(require_components(), 1);
  var import_core_data110 = __toESM(require_core_data(), 1);
  var import_data205 = __toESM(require_data(), 1);
  var import_element156 = __toESM(require_element(), 1);
  var import_i18n201 = __toESM(require_i18n(), 1);
  var import_dom4 = __toESM(require_dom(), 1);

  // packages/editor/build-module/components/post-actions/index.mjs
  var import_data204 = __toESM(require_data(), 1);
  var import_element155 = __toESM(require_element(), 1);
  var import_i18n200 = __toESM(require_i18n(), 1);
  var import_components189 = __toESM(require_components(), 1);
  var import_core_data109 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/post-actions/actions.mjs
  var import_data203 = __toESM(require_data(), 1);
  var import_element154 = __toESM(require_element(), 1);
  var import_core_data108 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/post-actions/set-as-homepage.mjs
  var import_i18n198 = __toESM(require_i18n(), 1);
  var import_element152 = __toESM(require_element(), 1);
  var import_components187 = __toESM(require_components(), 1);
  var import_data201 = __toESM(require_data(), 1);
  var import_core_data106 = __toESM(require_core_data(), 1);
  var import_notices28 = __toESM(require_notices(), 1);

  // packages/editor/build-module/utils/get-item-title.mjs
  var import_html_entities27 = __toESM(require_html_entities(), 1);
  function getItemTitle2(item) {
    if (typeof item.title === "string") {
      return (0, import_html_entities27.decodeEntities)(item.title);
    }
    if (item.title && "rendered" in item.title) {
      return (0, import_html_entities27.decodeEntities)(item.title.rendered);
    }
    if (item.title && "raw" in item.title) {
      return (0, import_html_entities27.decodeEntities)(item.title.raw);
    }
    return "";
  }

  // packages/editor/build-module/components/post-actions/set-as-homepage.mjs
  var import_jsx_runtime317 = __toESM(require_jsx_runtime(), 1);
  var SetAsHomepageModal = ({ items, closeModal: closeModal2 }) => {
    const [item] = items;
    const pageTitle = getItemTitle2(item);
    const { showOnFront, currentHomePage, isSaving } = (0, import_data201.useSelect)(
      (select5) => {
        const { getEntityRecord, isSavingEntityRecord } = select5(import_core_data106.store);
        const siteSettings = getEntityRecord("root", "site");
        const currentHomePageItem = getEntityRecord(
          "postType",
          "page",
          siteSettings?.page_on_front
        );
        return {
          showOnFront: siteSettings?.show_on_front,
          currentHomePage: currentHomePageItem,
          isSaving: isSavingEntityRecord("root", "site")
        };
      }
    );
    const { saveEntityRecord } = (0, import_data201.useDispatch)(import_core_data106.store);
    const { createSuccessNotice, createErrorNotice } = (0, import_data201.useDispatch)(import_notices28.store);
    async function onSetPageAsHomepage(event) {
      event.preventDefault();
      try {
        await saveEntityRecord("root", "site", {
          page_on_front: item.id,
          show_on_front: "page"
        });
        createSuccessNotice((0, import_i18n198.__)("Homepage updated."), {
          type: "snackbar"
        });
      } catch (error) {
        const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n198.__)("An error occurred while setting the homepage.");
        createErrorNotice(errorMessage, { type: "snackbar" });
      } finally {
        closeModal2?.();
      }
    }
    let modalWarning = "";
    if ("posts" === showOnFront) {
      modalWarning = (0, import_i18n198.__)(
        "This will replace the current homepage which is set to display latest posts."
      );
    } else if (currentHomePage) {
      modalWarning = (0, import_i18n198.sprintf)(
        // translators: %s: title of the current home page.
        (0, import_i18n198.__)('This will replace the current homepage: "%s"'),
        getItemTitle2(currentHomePage)
      );
    }
    const modalText = (0, import_i18n198.sprintf)(
      // translators: %1$s: title of the page to be set as the homepage, %2$s: homepage replacement warning message.
      (0, import_i18n198.__)('Set "%1$s" as the site homepage? %2$s'),
      pageTitle,
      modalWarning
    ).trim();
    const modalButtonLabel = (0, import_i18n198.__)("Set homepage");
    return /* @__PURE__ */ (0, import_jsx_runtime317.jsx)("form", { onSubmit: onSetPageAsHomepage, children: /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)(import_components187.__experimentalVStack, { spacing: "5", children: [
      /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(import_components187.__experimentalText, { children: modalText }),
      /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)(import_components187.__experimentalHStack, { justify: "right", children: [
        /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(
          import_components187.Button,
          {
            __next40pxDefaultSize: true,
            variant: "tertiary",
            onClick: () => {
              closeModal2?.();
            },
            disabled: isSaving,
            accessibleWhenDisabled: true,
            children: (0, import_i18n198.__)("Cancel")
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(
          import_components187.Button,
          {
            __next40pxDefaultSize: true,
            variant: "primary",
            type: "submit",
            disabled: isSaving,
            accessibleWhenDisabled: true,
            children: modalButtonLabel
          }
        )
      ] })
    ] }) });
  };
  var useSetAsHomepageAction = () => {
    const { pageOnFront, pageForPosts } = (0, import_data201.useSelect)((select5) => {
      const { getEntityRecord, canUser } = select5(import_core_data106.store);
      const siteSettings = canUser("read", {
        kind: "root",
        name: "site"
      }) ? getEntityRecord("root", "site") : void 0;
      return {
        pageOnFront: siteSettings?.page_on_front,
        pageForPosts: siteSettings?.page_for_posts
      };
    });
    return (0, import_element152.useMemo)(
      () => ({
        id: "set-as-homepage",
        label: (0, import_i18n198.__)("Set as homepage"),
        isEligible(post2) {
          if (post2.status !== "publish") {
            return false;
          }
          if (post2.type !== "page") {
            return false;
          }
          if (pageOnFront === post2.id) {
            return false;
          }
          if (pageForPosts === post2.id) {
            return false;
          }
          return true;
        },
        modalFocusOnMount: "firstContentElement",
        RenderModal: SetAsHomepageModal
      }),
      [pageForPosts, pageOnFront]
    );
  };

  // packages/editor/build-module/components/post-actions/set-as-posts-page.mjs
  var import_i18n199 = __toESM(require_i18n(), 1);
  var import_element153 = __toESM(require_element(), 1);
  var import_components188 = __toESM(require_components(), 1);
  var import_data202 = __toESM(require_data(), 1);
  var import_core_data107 = __toESM(require_core_data(), 1);
  var import_notices29 = __toESM(require_notices(), 1);
  var import_jsx_runtime318 = __toESM(require_jsx_runtime(), 1);
  var SetAsPostsPageModal = ({ items, closeModal: closeModal2 }) => {
    const [item] = items;
    const pageTitle = getItemTitle2(item);
    const { currentPostsPage, isPageForPostsSet, isSaving } = (0, import_data202.useSelect)(
      (select5) => {
        const { getEntityRecord, isSavingEntityRecord } = select5(import_core_data107.store);
        const siteSettings = getEntityRecord("root", "site");
        const currentPostsPageItem = getEntityRecord(
          "postType",
          "page",
          siteSettings?.page_for_posts
        );
        return {
          currentPostsPage: currentPostsPageItem,
          isPageForPostsSet: siteSettings?.page_for_posts !== 0,
          isSaving: isSavingEntityRecord("root", "site")
        };
      }
    );
    const { saveEntityRecord } = (0, import_data202.useDispatch)(import_core_data107.store);
    const { createSuccessNotice, createErrorNotice } = (0, import_data202.useDispatch)(import_notices29.store);
    async function onSetPageAsPostsPage(event) {
      event.preventDefault();
      try {
        await saveEntityRecord("root", "site", {
          page_for_posts: item.id,
          show_on_front: "page"
        });
        createSuccessNotice((0, import_i18n199.__)("Posts page updated."), {
          type: "snackbar"
        });
      } catch (error) {
        const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n199.__)("An error occurred while setting the posts page.");
        createErrorNotice(errorMessage, { type: "snackbar" });
      } finally {
        closeModal2?.();
      }
    }
    const modalWarning = isPageForPostsSet && currentPostsPage ? (0, import_i18n199.sprintf)(
      // translators: %s: title of the current posts page.
      (0, import_i18n199.__)('This will replace the current posts page: "%s"'),
      getItemTitle2(currentPostsPage)
    ) : (0, import_i18n199.__)("This page will show the latest posts.");
    const modalText = (0, import_i18n199.sprintf)(
      // translators: %1$s: title of the page to be set as the posts page, %2$s: posts page replacement warning message.
      (0, import_i18n199.__)('Set "%1$s" as the posts page? %2$s'),
      pageTitle,
      modalWarning
    );
    const modalButtonLabel = (0, import_i18n199.__)("Set posts page");
    return /* @__PURE__ */ (0, import_jsx_runtime318.jsx)("form", { onSubmit: onSetPageAsPostsPage, children: /* @__PURE__ */ (0, import_jsx_runtime318.jsxs)(import_components188.__experimentalVStack, { spacing: "5", children: [
      /* @__PURE__ */ (0, import_jsx_runtime318.jsx)(import_components188.__experimentalText, { children: modalText }),
      /* @__PURE__ */ (0, import_jsx_runtime318.jsxs)(import_components188.__experimentalHStack, { justify: "right", children: [
        /* @__PURE__ */ (0, import_jsx_runtime318.jsx)(
          import_components188.Button,
          {
            __next40pxDefaultSize: true,
            variant: "tertiary",
            onClick: () => {
              closeModal2?.();
            },
            disabled: isSaving,
            accessibleWhenDisabled: true,
            children: (0, import_i18n199.__)("Cancel")
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime318.jsx)(
          import_components188.Button,
          {
            __next40pxDefaultSize: true,
            variant: "primary",
            type: "submit",
            disabled: isSaving,
            accessibleWhenDisabled: true,
            children: modalButtonLabel
          }
        )
      ] })
    ] }) });
  };
  var useSetAsPostsPageAction = () => {
    const { pageOnFront, pageForPosts } = (0, import_data202.useSelect)((select5) => {
      const { getEntityRecord, canUser } = select5(import_core_data107.store);
      const siteSettings = canUser("read", {
        kind: "root",
        name: "site"
      }) ? getEntityRecord("root", "site") : void 0;
      return {
        pageOnFront: siteSettings?.page_on_front,
        pageForPosts: siteSettings?.page_for_posts
      };
    });
    return (0, import_element153.useMemo)(
      () => ({
        id: "set-as-posts-page",
        label: (0, import_i18n199.__)("Set as posts page"),
        isEligible(post2) {
          if (post2.status !== "publish") {
            return false;
          }
          if (post2.type !== "page") {
            return false;
          }
          if (pageOnFront === post2.id) {
            return false;
          }
          if (pageForPosts === post2.id) {
            return false;
          }
          return true;
        },
        modalFocusOnMount: "firstContentElement",
        RenderModal: SetAsPostsPageModal
      }),
      [pageForPosts, pageOnFront]
    );
  };

  // packages/editor/build-module/components/post-actions/actions.mjs
  var import_jsx_runtime319 = __toESM(require_jsx_runtime(), 1);
  function usePostActions({ postType: postType2, onActionPerformed, context }) {
    const { defaultActions } = (0, import_data203.useSelect)(
      (select5) => {
        const { getEntityActions: getEntityActions3 } = unlock(select5(store));
        return {
          defaultActions: getEntityActions3("postType", postType2)
        };
      },
      [postType2]
    );
    const shouldShowHomepageActions = (0, import_data203.useSelect)(
      (select5) => {
        if (postType2 !== "page") {
          return false;
        }
        const { getDefaultTemplateId, getEntityRecord, canUser } = select5(import_core_data108.store);
        const canUpdateSettings = canUser("update", {
          kind: "root",
          name: "site"
        });
        if (!canUpdateSettings) {
          return false;
        }
        const frontPageTemplateId = getDefaultTemplateId({
          slug: "front-page"
        });
        if (!frontPageTemplateId) {
          return true;
        }
        const frontPageTemplate = getEntityRecord(
          "postType",
          "wp_template",
          frontPageTemplateId
        );
        if (!frontPageTemplate) {
          return true;
        }
        return frontPageTemplate.slug !== "front-page";
      },
      [postType2]
    );
    const setAsHomepageAction = useSetAsHomepageAction();
    const setAsPostsPageAction = useSetAsPostsPageAction();
    const { registerPostTypeSchema: registerPostTypeSchema2 } = unlock((0, import_data203.useDispatch)(store));
    (0, import_element154.useEffect)(() => {
      registerPostTypeSchema2(postType2);
    }, [registerPostTypeSchema2, postType2]);
    return (0, import_element154.useMemo)(() => {
      let actions2 = [...defaultActions];
      if (shouldShowHomepageActions) {
        actions2.push(setAsHomepageAction, setAsPostsPageAction);
      }
      actions2 = actions2.sort(
        (a3, b3) => b3.id === "move-to-trash" ? -1 : 0
      );
      actions2 = actions2.filter((action) => {
        if (!action.context) {
          return true;
        }
        return action.context === context;
      });
      if (onActionPerformed) {
        for (let i3 = 0; i3 < actions2.length; ++i3) {
          if (actions2[i3].callback) {
            const existingCallback = actions2[i3].callback;
            actions2[i3] = {
              ...actions2[i3],
              callback: (items, argsObject) => {
                existingCallback(items, {
                  ...argsObject,
                  onActionPerformed: (_items) => {
                    if (argsObject?.onActionPerformed) {
                      argsObject.onActionPerformed(_items);
                    }
                    onActionPerformed(
                      actions2[i3].id,
                      _items
                    );
                  }
                });
              }
            };
          }
          if (actions2[i3].RenderModal) {
            const ExistingRenderModal = actions2[i3].RenderModal;
            actions2[i3] = {
              ...actions2[i3],
              RenderModal: (props) => {
                return /* @__PURE__ */ (0, import_jsx_runtime319.jsx)(
                  ExistingRenderModal,
                  {
                    ...props,
                    onActionPerformed: (_items) => {
                      if (props.onActionPerformed) {
                        props.onActionPerformed(_items);
                      }
                      onActionPerformed(
                        actions2[i3].id,
                        _items
                      );
                    }
                  }
                );
              }
            };
          }
        }
      }
      return actions2;
    }, [
      context,
      defaultActions,
      onActionPerformed,
      setAsHomepageAction,
      setAsPostsPageAction,
      shouldShowHomepageActions
    ]);
  }

  // packages/editor/build-module/components/post-actions/index.mjs
  var import_jsx_runtime320 = __toESM(require_jsx_runtime(), 1);
  var { Menu: Menu5, kebabCase: kebabCase4 } = unlock(import_components189.privateApis);
  function PostActions({ postType: postType2, postId: postId2, onActionPerformed }) {
    const [activeModalAction, setActiveModalAction] = (0, import_element155.useState)(null);
    const { item, permissions } = (0, import_data204.useSelect)(
      (select5) => {
        const { getEditedEntityRecord, getEntityRecordPermissions } = unlock(select5(import_core_data109.store));
        return {
          item: getEditedEntityRecord("postType", postType2, postId2),
          permissions: getEntityRecordPermissions(
            "postType",
            postType2,
            postId2
          )
        };
      },
      [postId2, postType2]
    );
    const itemWithPermissions = (0, import_element155.useMemo)(() => {
      return {
        ...item,
        permissions
      };
    }, [item, permissions]);
    const allActions = usePostActions({ postType: postType2, onActionPerformed });
    const actions2 = (0, import_element155.useMemo)(() => {
      return allActions.filter((action) => {
        return !action.isEligible || action.isEligible(itemWithPermissions);
      });
    }, [allActions, itemWithPermissions]);
    return /* @__PURE__ */ (0, import_jsx_runtime320.jsxs)(import_jsx_runtime320.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime320.jsxs)(Menu5, { placement: "bottom-end", children: [
        /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
          Menu5.TriggerButton,
          {
            render: /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
              import_components189.Button,
              {
                size: "small",
                icon: more_vertical_default,
                label: (0, import_i18n200.__)("Actions"),
                disabled: !actions2.length,
                accessibleWhenDisabled: true,
                className: "editor-all-actions-button"
              }
            )
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(Menu5.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
          ActionsDropdownMenuGroup,
          {
            actions: actions2,
            items: [itemWithPermissions],
            setActiveModalAction
          }
        ) })
      ] }),
      !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
        ActionModal,
        {
          action: activeModalAction,
          items: [itemWithPermissions],
          closeModal: () => setActiveModalAction(null)
        }
      )
    ] });
  }
  function DropdownMenuItemTrigger({ action, onClick, items }) {
    const label = typeof action.label === "string" ? action.label : action.label(items);
    return /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(Menu5.Item, { onClick, children: /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(Menu5.ItemLabel, { children: label }) });
  }
  function ActionModal({ action, items, closeModal: closeModal2 }) {
    const label = typeof action.label === "string" ? action.label : action.label(items);
    return /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
      import_components189.Modal,
      {
        title: action.modalHeader || label,
        __experimentalHideHeader: !!action.hideModalHeader,
        onRequestClose: closeModal2 ?? (() => {
        }),
        focusOnMount: "firstContentElement",
        size: "medium",
        overlayClassName: `editor-action-modal editor-action-modal__${kebabCase4(
          action.id
        )}`,
        children: /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(action.RenderModal, { items, closeModal: closeModal2 })
      }
    );
  }
  function ActionsDropdownMenuGroup({ actions: actions2, items, setActiveModalAction }) {
    const registry = (0, import_data204.useRegistry)();
    return /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(Menu5.Group, { children: actions2.map((action) => {
      return /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
        DropdownMenuItemTrigger,
        {
          action,
          onClick: () => {
            if ("RenderModal" in action) {
              setActiveModalAction(action);
              return;
            }
            action.callback(items, { registry });
          },
          items
        },
        action.id
      );
    }) });
  }

  // packages/editor/build-module/components/post-card-panel/index.mjs
  var import_jsx_runtime321 = __toESM(require_jsx_runtime(), 1);
  var { Badge: Badge2 } = unlock(import_components190.privateApis);
  function PostCardPanel({
    postType: postType2,
    postId: postId2,
    onActionPerformed
  }) {
    const postIds = (0, import_element156.useMemo)(
      () => Array.isArray(postId2) ? postId2 : [postId2],
      [postId2]
    );
    const { postTitle, icon, labels } = (0, import_data205.useSelect)(
      (select5) => {
        const { getEditedEntityRecord, getCurrentTheme, getPostType } = select5(import_core_data110.store);
        const { getPostIcon: getPostIcon2 } = unlock(select5(store));
        let _title = "";
        const _record = getEditedEntityRecord(
          "postType",
          postType2,
          postIds[0]
        );
        if (postIds.length === 1) {
          const { default_template_types: templateTypes = [] } = getCurrentTheme() ?? {};
          const _templateInfo = [
            TEMPLATE_POST_TYPE,
            TEMPLATE_PART_POST_TYPE
          ].includes(postType2) ? getTemplateInfo({
            template: _record,
            templateTypes
          }) : {};
          _title = _templateInfo?.title || _record?.title;
        }
        return {
          postTitle: _title,
          icon: getPostIcon2(postType2, {
            area: _record?.area
          }),
          labels: getPostType(postType2)?.labels
        };
      },
      [postIds, postType2]
    );
    const pageTypeBadge = usePageTypeBadge(postId2);
    let title = (0, import_i18n201.__)("No title");
    if (labels?.name && postIds.length > 1) {
      title = (0, import_i18n201.sprintf)(
        // translators: %1$d number of selected items %2$s: Name of the plural post type e.g: "Posts".
        (0, import_i18n201.__)("%1$d %2$s"),
        postIds.length,
        labels?.name
      );
    } else if (postTitle) {
      title = (0, import_dom4.__unstableStripHTML)(postTitle);
    }
    return /* @__PURE__ */ (0, import_jsx_runtime321.jsxs)(import_components190.__experimentalVStack, { spacing: 1, className: "editor-post-card-panel", children: [
      /* @__PURE__ */ (0, import_jsx_runtime321.jsxs)(
        import_components190.__experimentalHStack,
        {
          spacing: 2,
          className: "editor-post-card-panel__header",
          alignment: "flex-start",
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(import_components190.Icon, { className: "editor-post-card-panel__icon", icon }),
            /* @__PURE__ */ (0, import_jsx_runtime321.jsxs)(
              import_components190.__experimentalText,
              {
                numberOfLines: 2,
                truncate: true,
                className: "editor-post-card-panel__title",
                as: "h2",
                children: [
                  /* @__PURE__ */ (0, import_jsx_runtime321.jsx)("span", { className: "editor-post-card-panel__title-name", children: title }),
                  pageTypeBadge && postIds.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(Badge2, { children: pageTypeBadge })
                ]
              }
            ),
            postIds.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(
              PostActions,
              {
                postType: postType2,
                postId: postIds[0],
                onActionPerformed
              }
            )
          ]
        }
      ),
      postIds.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(import_components190.__experimentalText, { className: "editor-post-card-panel__description", children: (0, import_i18n201.sprintf)(
        // translators: %s: Name of the plural post type e.g: "Posts".
        (0, import_i18n201.__)("Changes will be applied to all selected %s."),
        labels?.name.toLowerCase()
      ) })
    ] });
  }

  // packages/editor/build-module/components/post-content-information/index.mjs
  var import_components191 = __toESM(require_components(), 1);
  var import_data206 = __toESM(require_data(), 1);
  var import_i18n202 = __toESM(require_i18n(), 1);
  var import_wordcount4 = __toESM(require_wordcount(), 1);
  var import_element157 = __toESM(require_element(), 1);
  var import_core_data111 = __toESM(require_core_data(), 1);
  var import_jsx_runtime322 = __toESM(require_jsx_runtime(), 1);
  var AVERAGE_READING_RATE2 = 189;
  function PostContentInformation() {
    const { postContent } = (0, import_data206.useSelect)((select5) => {
      const { getEditedPostAttribute: getEditedPostAttribute2, getCurrentPostType: getCurrentPostType2, getCurrentPostId: getCurrentPostId2 } = select5(store);
      const { canUser } = select5(import_core_data111.store);
      const { getEntityRecord } = select5(import_core_data111.store);
      const siteSettings = canUser("read", {
        kind: "root",
        name: "site"
      }) ? getEntityRecord("root", "site") : void 0;
      const postType2 = getCurrentPostType2();
      const _id = getCurrentPostId2();
      const isPostsPage = +_id === siteSettings?.page_for_posts;
      const showPostContentInfo = !isPostsPage && ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(
        postType2
      );
      return {
        postContent: showPostContentInfo && getEditedPostAttribute2("content")
      };
    }, []);
    const wordCountType = (0, import_i18n202._x)("words", "Word count type. Do not translate!");
    const wordsCounted = (0, import_element157.useMemo)(
      () => postContent ? (0, import_wordcount4.count)(postContent, wordCountType) : 0,
      [postContent, wordCountType]
    );
    if (!wordsCounted) {
      return null;
    }
    const readingTime = Math.round(wordsCounted / AVERAGE_READING_RATE2);
    const wordsCountText = (0, import_i18n202.sprintf)(
      // translators: %s: the number of words in the post.
      (0, import_i18n202._n)("%s word", "%s words", wordsCounted),
      wordsCounted.toLocaleString()
    );
    const minutesText = readingTime <= 1 ? (0, import_i18n202.__)("1 minute") : (0, import_i18n202.sprintf)(
      /* translators: %s: the number of minutes to read the post. */
      (0, import_i18n202._n)("%s minute", "%s minutes", readingTime),
      readingTime.toLocaleString()
    );
    return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("div", { className: "editor-post-content-information", children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(import_components191.__experimentalText, { children: (0, import_i18n202.sprintf)(
      /* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */
      (0, import_i18n202.__)("%1$s, %2$s read time."),
      wordsCountText,
      minutesText
    ) }) });
  }

  // packages/editor/build-module/components/post-format/panel.mjs
  var import_components192 = __toESM(require_components(), 1);
  var import_i18n203 = __toESM(require_i18n(), 1);
  var import_data207 = __toESM(require_data(), 1);
  var import_element158 = __toESM(require_element(), 1);
  var import_block_editor82 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime323 = __toESM(require_jsx_runtime(), 1);
  function PostFormat2() {
    const { postFormat } = (0, import_data207.useSelect)((select5) => {
      const { getEditedPostAttribute: getEditedPostAttribute2 } = select5(store);
      const _postFormat = getEditedPostAttribute2("format");
      return {
        postFormat: _postFormat ?? "standard"
      };
    }, []);
    const activeFormat = POST_FORMATS.find(
      (format) => format.id === postFormat
    );
    const [popoverAnchor, setPopoverAnchor] = (0, import_element158.useState)(null);
    const popoverProps = (0, import_element158.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime323.jsx)(PostFormatCheck, { children: /* @__PURE__ */ (0, import_jsx_runtime323.jsx)(post_panel_row_default, { label: (0, import_i18n203.__)("Format"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0, import_jsx_runtime323.jsx)(
      import_components192.Dropdown,
      {
        popoverProps,
        contentClassName: "editor-post-format__dialog",
        focusOnMount: true,
        renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime323.jsx)(
          import_components192.Button,
          {
            size: "compact",
            variant: "tertiary",
            "aria-expanded": isOpen,
            "aria-label": (0, import_i18n203.sprintf)(
              // translators: %s: Current post format.
              (0, import_i18n203.__)("Change format: %s"),
              activeFormat?.caption
            ),
            onClick: onToggle,
            children: activeFormat?.caption
          }
        ),
        renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime323.jsxs)("div", { className: "editor-post-format__dialog-content", children: [
          /* @__PURE__ */ (0, import_jsx_runtime323.jsx)(
            import_block_editor82.__experimentalInspectorPopoverHeader,
            {
              title: (0, import_i18n203.__)("Format"),
              onClose
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime323.jsx)(PostFormat, {})
        ] })
      }
    ) }) });
  }
  var panel_default4 = PostFormat2;

  // packages/editor/build-module/components/post-last-edited-panel/index.mjs
  var import_components193 = __toESM(require_components(), 1);
  var import_data208 = __toESM(require_data(), 1);
  var import_i18n204 = __toESM(require_i18n(), 1);
  var import_date7 = __toESM(require_date(), 1);
  var import_jsx_runtime324 = __toESM(require_jsx_runtime(), 1);
  function PostLastEditedPanel() {
    const modified = (0, import_data208.useSelect)(
      (select5) => select5(store).getEditedPostAttribute("modified"),
      []
    );
    const lastEditedText = modified && (0, import_i18n204.sprintf)(
      // translators: %s: Human-readable time difference, e.g. "2 days ago".
      (0, import_i18n204.__)("Last edited %s."),
      (0, import_date7.humanTimeDiff)(modified)
    );
    if (!lastEditedText) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("div", { className: "editor-post-last-edited-panel", children: /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(import_components193.__experimentalText, { children: lastEditedText }) });
  }

  // packages/editor/build-module/components/post-panel-section/index.mjs
  var import_components194 = __toESM(require_components(), 1);
  var import_jsx_runtime325 = __toESM(require_jsx_runtime(), 1);
  function PostPanelSection({ className, children }) {
    return /* @__PURE__ */ (0, import_jsx_runtime325.jsx)(import_components194.__experimentalVStack, { className: clsx_default("editor-post-panel__section", className), children });
  }
  var post_panel_section_default = PostPanelSection;

  // packages/editor/build-module/components/blog-title/index.mjs
  var import_i18n205 = __toESM(require_i18n(), 1);
  var import_compose58 = __toESM(require_compose(), 1);
  var import_data209 = __toESM(require_data(), 1);
  var import_core_data112 = __toESM(require_core_data(), 1);
  var import_html_entities28 = __toESM(require_html_entities(), 1);
  var import_components195 = __toESM(require_components(), 1);
  var import_element159 = __toESM(require_element(), 1);
  var import_block_editor83 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime326 = __toESM(require_jsx_runtime(), 1);
  var EMPTY_OBJECT4 = {};
  function BlogTitle() {
    const { editEntityRecord } = (0, import_data209.useDispatch)(import_core_data112.store);
    const { postsPageTitle, postsPageId, isTemplate: isTemplate2, postSlug } = (0, import_data209.useSelect)(
      (select5) => {
        const { getEntityRecord, getEditedEntityRecord, canUser } = select5(import_core_data112.store);
        const siteSettings = canUser("read", {
          kind: "root",
          name: "site"
        }) ? getEntityRecord("root", "site") : void 0;
        const _postsPageRecord = siteSettings?.page_for_posts ? getEditedEntityRecord(
          "postType",
          "page",
          siteSettings?.page_for_posts
        ) : EMPTY_OBJECT4;
        const { getEditedPostAttribute: getEditedPostAttribute2, getCurrentPostType: getCurrentPostType2 } = select5(store);
        return {
          postsPageId: _postsPageRecord?.id,
          postsPageTitle: _postsPageRecord?.title,
          isTemplate: getCurrentPostType2() === TEMPLATE_POST_TYPE,
          postSlug: getEditedPostAttribute2("slug")
        };
      },
      []
    );
    const [popoverAnchor, setPopoverAnchor] = (0, import_element159.useState)(null);
    const popoverProps = (0, import_element159.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor]
    );
    if (!isTemplate2 || !["home", "index"].includes(postSlug) || !postsPageId) {
      return null;
    }
    const setPostsPageTitle = (newValue) => {
      editEntityRecord("postType", "page", postsPageId, {
        title: newValue
      });
    };
    const decodedTitle = (0, import_html_entities28.decodeEntities)(postsPageTitle);
    return /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(post_panel_row_default, { label: (0, import_i18n205.__)("Blog title"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(
      import_components195.Dropdown,
      {
        popoverProps,
        contentClassName: "editor-blog-title-dropdown__content",
        focusOnMount: true,
        renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(
          import_components195.Button,
          {
            size: "compact",
            variant: "tertiary",
            "aria-expanded": isOpen,
            "aria-label": (0, import_i18n205.sprintf)(
              // translators: %s: Current post link.
              (0, import_i18n205.__)("Change blog title: %s"),
              decodedTitle
            ),
            onClick: onToggle,
            children: decodedTitle
          }
        ),
        renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime326.jsxs)(import_jsx_runtime326.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(
            import_block_editor83.__experimentalInspectorPopoverHeader,
            {
              title: (0, import_i18n205.__)("Blog title"),
              onClose
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(
            import_components195.__experimentalInputControl,
            {
              placeholder: (0, import_i18n205.__)("No title"),
              size: "__unstable-large",
              value: postsPageTitle,
              onChange: (0, import_compose58.debounce)(setPostsPageTitle, 300),
              label: (0, import_i18n205.__)("Blog title"),
              help: (0, import_i18n205.__)(
                "Set the Posts Page title. Appears in search results, and when the page is shared on social media."
              ),
              hideLabelFromVision: true
            }
          )
        ] })
      }
    ) });
  }

  // packages/editor/build-module/components/posts-per-page/index.mjs
  var import_i18n206 = __toESM(require_i18n(), 1);
  var import_data210 = __toESM(require_data(), 1);
  var import_core_data113 = __toESM(require_core_data(), 1);
  var import_components196 = __toESM(require_components(), 1);
  var import_element160 = __toESM(require_element(), 1);
  var import_block_editor84 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime327 = __toESM(require_jsx_runtime(), 1);
  function PostsPerPage() {
    const { editEntityRecord } = (0, import_data210.useDispatch)(import_core_data113.store);
    const { postsPerPage, isTemplate: isTemplate2, postSlug } = (0, import_data210.useSelect)((select5) => {
      const { getEditedPostAttribute: getEditedPostAttribute2, getCurrentPostType: getCurrentPostType2 } = select5(store);
      const { getEditedEntityRecord, canUser } = select5(import_core_data113.store);
      const siteSettings = canUser("read", {
        kind: "root",
        name: "site"
      }) ? getEditedEntityRecord("root", "site") : void 0;
      return {
        isTemplate: getCurrentPostType2() === TEMPLATE_POST_TYPE,
        postSlug: getEditedPostAttribute2("slug"),
        postsPerPage: siteSettings?.posts_per_page || 1
      };
    }, []);
    const [popoverAnchor, setPopoverAnchor] = (0, import_element160.useState)(null);
    const popoverProps = (0, import_element160.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor]
    );
    if (!isTemplate2 || !["home", "index"].includes(postSlug)) {
      return null;
    }
    const setPostsPerPage = (newValue) => {
      editEntityRecord("root", "site", void 0, {
        posts_per_page: newValue
      });
    };
    return /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(post_panel_row_default, { label: (0, import_i18n206.__)("Posts per page"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(
      import_components196.Dropdown,
      {
        popoverProps,
        contentClassName: "editor-posts-per-page-dropdown__content",
        focusOnMount: true,
        renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(
          import_components196.Button,
          {
            size: "compact",
            variant: "tertiary",
            "aria-expanded": isOpen,
            "aria-label": (0, import_i18n206.__)("Change posts per page"),
            onClick: onToggle,
            children: postsPerPage
          }
        ),
        renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime327.jsxs)(import_jsx_runtime327.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(
            import_block_editor84.__experimentalInspectorPopoverHeader,
            {
              title: (0, import_i18n206.__)("Posts per page"),
              onClose
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(
            import_components196.__experimentalNumberControl,
            {
              placeholder: 0,
              value: postsPerPage,
              size: "__unstable-large",
              spinControls: "custom",
              step: "1",
              min: "1",
              onChange: setPostsPerPage,
              label: (0, import_i18n206.__)("Posts per page"),
              help: (0, import_i18n206.__)(
                "Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting."
              ),
              hideLabelFromVision: true
            }
          )
        ] })
      }
    ) });
  }

  // packages/editor/build-module/components/site-discussion/index.mjs
  var import_i18n207 = __toESM(require_i18n(), 1);
  var import_data211 = __toESM(require_data(), 1);
  var import_core_data114 = __toESM(require_core_data(), 1);
  var import_components197 = __toESM(require_components(), 1);
  var import_element161 = __toESM(require_element(), 1);
  var import_block_editor85 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime328 = __toESM(require_jsx_runtime(), 1);
  var COMMENT_OPTIONS2 = [
    {
      label: (0, import_i18n207._x)("Open", 'Adjective: e.g. "Comments are open"'),
      value: "open",
      description: (0, import_i18n207.__)("Visitors can add new comments and replies.")
    },
    {
      label: (0, import_i18n207.__)("Closed"),
      value: "",
      description: [
        (0, import_i18n207.__)("Visitors cannot add new comments or replies."),
        (0, import_i18n207.__)("Existing comments remain visible.")
      ].join(" ")
    }
  ];
  function SiteDiscussion() {
    const { editEntityRecord } = (0, import_data211.useDispatch)(import_core_data114.store);
    const { allowCommentsOnNewPosts, isTemplate: isTemplate2, postSlug } = (0, import_data211.useSelect)(
      (select5) => {
        const { getEditedPostAttribute: getEditedPostAttribute2, getCurrentPostType: getCurrentPostType2 } = select5(store);
        const { getEditedEntityRecord, canUser } = select5(import_core_data114.store);
        const siteSettings = canUser("read", {
          kind: "root",
          name: "site"
        }) ? getEditedEntityRecord("root", "site") : void 0;
        return {
          isTemplate: getCurrentPostType2() === TEMPLATE_POST_TYPE,
          postSlug: getEditedPostAttribute2("slug"),
          allowCommentsOnNewPosts: siteSettings?.default_comment_status || ""
        };
      },
      []
    );
    const [popoverAnchor, setPopoverAnchor] = (0, import_element161.useState)(null);
    const popoverProps = (0, import_element161.useMemo)(
      () => ({
        // Anchor the popover to the middle of the entire row so that it doesn't
        // move around when the label changes.
        anchor: popoverAnchor,
        placement: "left-start",
        offset: 36,
        shift: true
      }),
      [popoverAnchor]
    );
    if (!isTemplate2 || !["home", "index"].includes(postSlug)) {
      return null;
    }
    const setAllowCommentsOnNewPosts = (newValue) => {
      editEntityRecord("root", "site", void 0, {
        default_comment_status: newValue ? "open" : null
      });
    };
    return /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(post_panel_row_default, { label: (0, import_i18n207.__)("Discussion"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
      import_components197.Dropdown,
      {
        popoverProps,
        contentClassName: "editor-site-discussion-dropdown__content",
        focusOnMount: true,
        renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
          import_components197.Button,
          {
            size: "compact",
            variant: "tertiary",
            "aria-expanded": isOpen,
            "aria-label": (0, import_i18n207.__)("Change discussion settings"),
            onClick: onToggle,
            children: allowCommentsOnNewPosts ? (0, import_i18n207.__)("Comments open") : (0, import_i18n207.__)("Comments closed")
          }
        ),
        renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)(import_jsx_runtime328.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
            import_block_editor85.__experimentalInspectorPopoverHeader,
            {
              title: (0, import_i18n207.__)("Discussion"),
              onClose
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)(import_components197.__experimentalVStack, { spacing: 3, children: [
            /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(import_components197.__experimentalText, { children: (0, import_i18n207.__)(
              "Changes will apply to new posts only. Individual posts may override these settings."
            ) }),
            /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
              import_components197.RadioControl,
              {
                className: "editor-site-discussion__options",
                hideLabelFromVision: true,
                label: (0, import_i18n207.__)("Comment status"),
                options: COMMENT_OPTIONS2,
                onChange: setAllowCommentsOnNewPosts,
                selected: allowCommentsOnNewPosts
              }
            )
          ] })
        ] })
      }
    ) });
  }

  // packages/editor/build-module/components/sidebar/post-summary.mjs
  var import_jsx_runtime329 = __toESM(require_jsx_runtime(), 1);
  var PANEL_NAME5 = "post-status";
  function PostSummary({ onActionPerformed }) {
    const { isRemovedPostStatusPanel, postType: postType2, postId: postId2 } = (0, import_data212.useSelect)(
      (select5) => {
        const {
          isEditorPanelRemoved: isEditorPanelRemoved2,
          getCurrentPostType: getCurrentPostType2,
          getCurrentPostId: getCurrentPostId2
        } = select5(store);
        return {
          isRemovedPostStatusPanel: isEditorPanelRemoved2(PANEL_NAME5),
          postType: getCurrentPostType2(),
          postId: getCurrentPostId2()
        };
      },
      []
    );
    return /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(post_panel_section_default, { className: "editor-post-summary", children: /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(plugin_post_status_info_default.Slot, { children: (fills) => /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(import_jsx_runtime329.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime329.jsxs)(import_components198.__experimentalVStack, { spacing: 4, children: [
      /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(
        PostCardPanel,
        {
          postType: postType2,
          postId: postId2,
          onActionPerformed
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PostFeaturedImagePanel, { withPanelBody: false }),
      /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PrivatePostExcerptPanel, {}),
      /* @__PURE__ */ (0, import_jsx_runtime329.jsxs)(import_components198.__experimentalVStack, { spacing: 1, children: [
        /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PostContentInformation, {}),
        /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PostLastEditedPanel, {})
      ] }),
      !isRemovedPostStatusPanel && /* @__PURE__ */ (0, import_jsx_runtime329.jsxs)(import_components198.__experimentalVStack, { spacing: 4, children: [
        /* @__PURE__ */ (0, import_jsx_runtime329.jsxs)(import_components198.__experimentalVStack, { spacing: 1, children: [
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PostStatus, {}),
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PostSchedulePanel, {}),
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PostURLPanel, {}),
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(panel_default, {}),
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PostTemplatePanel, {}),
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PostDiscussionPanel, {}),
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PrivatePostLastRevision, {}),
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PageAttributesPanel, {}),
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PostSyncStatus, {}),
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(BlogTitle, {}),
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(PostsPerPage, {}),
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(SiteDiscussion, {}),
          /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(panel_default4, {}),
          fills
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(
          PostTrash,
          {
            onActionPerformed
          }
        )
      ] })
    ] }) }) }) });
  }

  // packages/editor/build-module/components/post-transform-panel/index.mjs
  var import_data214 = __toESM(require_data(), 1);
  var import_core_data116 = __toESM(require_core_data(), 1);
  var import_components199 = __toESM(require_components(), 1);
  var import_i18n208 = __toESM(require_i18n(), 1);
  var import_block_editor86 = __toESM(require_block_editor(), 1);
  var import_blocks34 = __toESM(require_blocks(), 1);

  // packages/editor/build-module/components/post-transform-panel/hooks.mjs
  var import_data213 = __toESM(require_data(), 1);
  var import_element162 = __toESM(require_element(), 1);
  var import_core_data115 = __toESM(require_core_data(), 1);
  var import_blocks33 = __toESM(require_blocks(), 1);
  var import_patterns10 = __toESM(require_patterns(), 1);
  var { EXCLUDED_PATTERN_SOURCES, PATTERN_TYPES: PATTERN_TYPES5 } = unlock(import_patterns10.privateApis);
  function injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet) {
    block.innerBlocks = block.innerBlocks.map((innerBlock) => {
      return injectThemeAttributeInBlockTemplateContent(
        innerBlock,
        currentThemeStylesheet
      );
    });
    if (block.name === "core/template-part" && block.attributes.theme === void 0) {
      block.attributes.theme = currentThemeStylesheet;
    }
    return block;
  }
  function filterPatterns(patterns2, template2) {
    const filterOutDuplicatesByName = (currentItem, index2, items) => index2 === items.findIndex((item) => currentItem.name === item.name);
    const filterOutExcludedPatternSources = (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source);
    const filterCompatiblePatterns = (pattern) => pattern.templateTypes?.includes(template2.slug) || pattern.blockTypes?.includes("core/template-part/" + template2.area);
    return patterns2.filter((pattern, index2, items) => {
      return filterOutDuplicatesByName(pattern, index2, items) && filterOutExcludedPatternSources(pattern) && filterCompatiblePatterns(pattern);
    });
  }
  function preparePatterns(patterns2, currentThemeStylesheet) {
    return patterns2.map((pattern) => ({
      ...pattern,
      keywords: pattern.keywords || [],
      type: PATTERN_TYPES5.theme,
      blocks: (0, import_blocks33.parse)(pattern.content, {
        __unstableSkipMigrationLogs: true
      }).map(
        (block) => injectThemeAttributeInBlockTemplateContent(
          block,
          currentThemeStylesheet
        )
      )
    }));
  }
  function useAvailablePatterns({ area, name: name2, slug }) {
    const { blockPatterns, restBlockPatterns, currentThemeStylesheet } = (0, import_data213.useSelect)((select5) => {
      const { getEditorSettings: getEditorSettings2 } = select5(store);
      const settings = getEditorSettings2();
      return {
        blockPatterns: settings.__experimentalAdditionalBlockPatterns ?? settings.__experimentalBlockPatterns,
        restBlockPatterns: select5(import_core_data115.store).getBlockPatterns(),
        currentThemeStylesheet: select5(import_core_data115.store).getCurrentTheme().stylesheet
      };
    }, []);
    return (0, import_element162.useMemo)(() => {
      const mergedPatterns = [
        ...blockPatterns || [],
        ...restBlockPatterns || []
      ];
      const filteredPatterns = filterPatterns(mergedPatterns, {
        area,
        name: name2,
        slug
      });
      return preparePatterns(filteredPatterns, currentThemeStylesheet);
    }, [
      area,
      name2,
      slug,
      blockPatterns,
      restBlockPatterns,
      currentThemeStylesheet
    ]);
  }

  // packages/editor/build-module/components/post-transform-panel/index.mjs
  var import_jsx_runtime330 = __toESM(require_jsx_runtime(), 1);
  function TemplatesList2({ availableTemplates, onSelect }) {
    if (!availableTemplates || availableTemplates?.length === 0) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime330.jsx)(
      import_block_editor86.__experimentalBlockPatternsList,
      {
        label: (0, import_i18n208.__)("Templates"),
        blockPatterns: availableTemplates,
        onClickPattern: onSelect,
        showTitlesAsTooltip: true
      }
    );
  }
  function PostTransform() {
    const { area, name: name2, slug, postType: postType2, postId: postId2 } = (0, import_data214.useSelect)((select5) => {
      const { getCurrentPostType: getCurrentPostType2, getCurrentPostId: getCurrentPostId2 } = select5(store);
      const { getEditedEntityRecord } = select5(import_core_data116.store);
      const type = getCurrentPostType2();
      const id = getCurrentPostId2();
      const record = getEditedEntityRecord("postType", type, id);
      return {
        area: record?.area,
        name: record?.name,
        slug: record?.slug,
        postType: type,
        postId: id
      };
    }, []);
    const { editEntityRecord } = (0, import_data214.useDispatch)(import_core_data116.store);
    const availablePatterns = useAvailablePatterns({ area, name: name2, slug });
    const onTemplateSelect = async (selectedTemplate) => {
      await editEntityRecord("postType", postType2, postId2, {
        blocks: selectedTemplate.blocks,
        content: (0, import_blocks34.serialize)(selectedTemplate.blocks)
      });
    };
    if (!availablePatterns?.length) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime330.jsx)(
      import_components199.PanelBody,
      {
        title: (0, import_i18n208.__)("Design"),
        initialOpen: postType2 === TEMPLATE_PART_POST_TYPE,
        children: /* @__PURE__ */ (0, import_jsx_runtime330.jsx)(
          TemplatesList2,
          {
            availableTemplates: availablePatterns,
            onSelect: onTemplateSelect
          }
        )
      }
    );
  }
  function PostTransformPanel() {
    const { postType: postType2 } = (0, import_data214.useSelect)((select5) => {
      const { getCurrentPostType: getCurrentPostType2 } = select5(store);
      return {
        postType: getCurrentPostType2()
      };
    }, []);
    if (![TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE].includes(postType2)) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime330.jsx)(PostTransform, {});
  }

  // packages/editor/build-module/components/sidebar/header.mjs
  var import_components200 = __toESM(require_components(), 1);
  var import_i18n209 = __toESM(require_i18n(), 1);
  var import_data215 = __toESM(require_data(), 1);
  var import_element163 = __toESM(require_element(), 1);
  var import_html_entities29 = __toESM(require_html_entities(), 1);

  // packages/editor/build-module/components/sidebar/constants.mjs
  var sidebars = {
    document: "edit-post/document",
    block: "edit-post/block"
  };

  // packages/editor/build-module/components/sidebar/header.mjs
  var import_jsx_runtime331 = __toESM(require_jsx_runtime(), 1);
  var { Tabs: Tabs4 } = unlock(import_components200.privateApis);
  var SidebarHeader = (_, ref) => {
    const postTypeLabel = (0, import_data215.useSelect)(
      (select5) => select5(store).getPostTypeLabel(),
      []
    );
    const documentLabel = postTypeLabel ? (0, import_html_entities29.decodeEntities)(postTypeLabel) : (
      // translators: Default label for the Document sidebar tab, not selected.
      (0, import_i18n209._x)("Document", "noun, panel")
    );
    return /* @__PURE__ */ (0, import_jsx_runtime331.jsxs)(Tabs4.TabList, { ref, children: [
      /* @__PURE__ */ (0, import_jsx_runtime331.jsx)(
        Tabs4.Tab,
        {
          tabId: sidebars.document,
          "data-tab-id": sidebars.document,
          children: documentLabel
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime331.jsx)(
        Tabs4.Tab,
        {
          tabId: sidebars.block,
          "data-tab-id": sidebars.block,
          children: (0, import_i18n209.__)("Block")
        }
      )
    ] });
  };
  var header_default3 = (0, import_element163.forwardRef)(SidebarHeader);

  // packages/editor/build-module/components/template-content-panel/index.mjs
  var import_data216 = __toESM(require_data(), 1);
  var import_block_editor87 = __toESM(require_block_editor(), 1);
  var import_components201 = __toESM(require_components(), 1);
  var import_i18n210 = __toESM(require_i18n(), 1);
  var import_hooks55 = __toESM(require_hooks(), 1);
  var import_element164 = __toESM(require_element(), 1);
  var import_jsx_runtime332 = __toESM(require_jsx_runtime(), 1);
  var { BlockQuickNavigation } = unlock(import_block_editor87.privateApis);
  var POST_CONTENT_BLOCK_TYPES2 = [
    "core/post-title",
    "core/post-featured-image",
    "core/post-content"
  ];
  var TEMPLATE_PART_BLOCK = "core/template-part";
  function TemplateContentPanel() {
    const postContentBlockTypes = (0, import_element164.useMemo)(
      () => (0, import_hooks55.applyFilters)(
        "editor.postContentBlockTypes",
        POST_CONTENT_BLOCK_TYPES2
      ),
      []
    );
    const { clientIds, postType: postType2, renderingMode: renderingMode2 } = (0, import_data216.useSelect)(
      (select5) => {
        const {
          getCurrentPostType: getCurrentPostType2,
          getPostBlocksByName: getPostBlocksByName2,
          getRenderingMode: getRenderingMode2
        } = unlock(select5(store));
        const _postType = getCurrentPostType2();
        return {
          postType: _postType,
          clientIds: getPostBlocksByName2(
            TEMPLATE_POST_TYPE === _postType ? TEMPLATE_PART_BLOCK : postContentBlockTypes
          ),
          renderingMode: getRenderingMode2()
        };
      },
      [postContentBlockTypes]
    );
    const { enableComplementaryArea: enableComplementaryArea2 } = (0, import_data216.useDispatch)(store2);
    if (renderingMode2 === "post-only" && postType2 !== TEMPLATE_POST_TYPE || clientIds.length === 0) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(import_components201.PanelBody, { title: (0, import_i18n210.__)("Content"), children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
      BlockQuickNavigation,
      {
        clientIds,
        onSelect: () => {
          enableComplementaryArea2("core", "edit-post/document");
        }
      }
    ) });
  }

  // packages/editor/build-module/components/template-part-content-panel/index.mjs
  var import_data217 = __toESM(require_data(), 1);
  var import_element165 = __toESM(require_element(), 1);
  var import_blocks35 = __toESM(require_blocks(), 1);
  var import_block_editor88 = __toESM(require_block_editor(), 1);
  var import_components202 = __toESM(require_components(), 1);
  var import_i18n211 = __toESM(require_i18n(), 1);
  var import_jsx_runtime333 = __toESM(require_jsx_runtime(), 1);
  var { BlockQuickNavigation: BlockQuickNavigation2 } = unlock(import_block_editor88.privateApis);
  function TemplatePartContentPanelInner() {
    const blockTypes = (0, import_data217.useSelect)((select5) => {
      const { getBlockTypes: getBlockTypes6 } = select5(import_blocks35.store);
      return getBlockTypes6();
    }, []);
    const themeBlockNames = (0, import_element165.useMemo)(() => {
      return blockTypes.filter((blockType) => {
        return blockType.category === "theme";
      }).map(({ name: name2 }) => name2);
    }, [blockTypes]);
    const themeBlocks = (0, import_data217.useSelect)(
      (select5) => {
        const { getBlocksByName } = select5(import_block_editor88.store);
        return getBlocksByName(themeBlockNames);
      },
      [themeBlockNames]
    );
    if (themeBlocks.length === 0) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime333.jsx)(import_components202.PanelBody, { title: (0, import_i18n211.__)("Content"), children: /* @__PURE__ */ (0, import_jsx_runtime333.jsx)(BlockQuickNavigation2, { clientIds: themeBlocks }) });
  }
  function TemplatePartContentPanel() {
    const postType2 = (0, import_data217.useSelect)((select5) => {
      const { getCurrentPostType: getCurrentPostType2 } = select5(store);
      return getCurrentPostType2();
    }, []);
    if (postType2 !== TEMPLATE_PART_POST_TYPE) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime333.jsx)(TemplatePartContentPanelInner, {});
  }

  // packages/editor/build-module/components/provider/use-auto-switch-editor-sidebars.mjs
  var import_data218 = __toESM(require_data(), 1);
  var import_element166 = __toESM(require_element(), 1);
  var import_block_editor89 = __toESM(require_block_editor(), 1);
  var import_preferences23 = __toESM(require_preferences(), 1);
  function useAutoSwitchEditorSidebars() {
    const { hasBlockSelection } = (0, import_data218.useSelect)((select5) => {
      return {
        hasBlockSelection: !!select5(import_block_editor89.store).getBlockSelectionStart()
      };
    }, []);
    const { getActiveComplementaryArea: getActiveComplementaryArea2 } = (0, import_data218.useSelect)(store2);
    const { enableComplementaryArea: enableComplementaryArea2 } = (0, import_data218.useDispatch)(store2);
    const { get: getPreference } = (0, import_data218.useSelect)(import_preferences23.store);
    (0, import_element166.useEffect)(() => {
      const activeGeneralSidebar = getActiveComplementaryArea2("core");
      const isEditorSidebarOpened = [
        "edit-post/document",
        "edit-post/block"
      ].includes(activeGeneralSidebar);
      const isDistractionFree = getPreference("core", "distractionFree");
      if (!isEditorSidebarOpened || isDistractionFree) {
        return;
      }
      if (hasBlockSelection) {
        enableComplementaryArea2("core", "edit-post/block");
      } else {
        enableComplementaryArea2("core", "edit-post/document");
      }
    }, [
      hasBlockSelection,
      getActiveComplementaryArea2,
      enableComplementaryArea2,
      getPreference
    ]);
  }
  var use_auto_switch_editor_sidebars_default = useAutoSwitchEditorSidebars;

  // packages/editor/build-module/components/sidebar/index.mjs
  var import_jsx_runtime334 = __toESM(require_jsx_runtime(), 1);
  var { Tabs: Tabs5 } = unlock(import_components203.privateApis);
  var SIDEBAR_ACTIVE_BY_DEFAULT = import_element167.Platform.select({
    web: true,
    native: false
  });
  var SidebarContent = ({
    tabName,
    keyboardShortcut,
    onActionPerformed,
    extraPanels
  }) => {
    const tabListRef = (0, import_element167.useRef)(null);
    const tabsContextValue = (0, import_element167.useContext)(Tabs5.Context);
    (0, import_element167.useEffect)(() => {
      const tabsElements = Array.from(
        tabListRef.current?.querySelectorAll('[role="tab"]') || []
      );
      const selectedTabElement = tabsElements.find(
        // We are purposefully using a custom `data-tab-id` attribute here
        // because we don't want rely on any assumptions about `Tabs`
        // component internals.
        (element) => element.getAttribute("data-tab-id") === tabName
      );
      const activeElement = selectedTabElement?.ownerDocument.activeElement;
      const tabsHasFocus = tabsElements.some((element) => {
        return activeElement && activeElement.id === element.id;
      });
      if (tabsHasFocus && selectedTabElement && selectedTabElement.id !== activeElement?.id) {
        selectedTabElement?.focus();
      }
    }, [tabName]);
    return /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
      PluginSidebar,
      {
        identifier: tabName,
        header: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(Tabs5.Context.Provider, { value: tabsContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(header_default3, { ref: tabListRef }) }),
        closeLabel: (0, import_i18n212.__)("Close Settings"),
        className: "editor-sidebar__panel",
        headerClassName: "editor-sidebar__panel-tabs",
        title: (
          /* translators: button label text should, if possible, be under 16 characters. */
          (0, import_i18n212._x)("Settings", "panel button label")
        ),
        toggleShortcut: keyboardShortcut,
        icon: (0, import_i18n212.isRTL)() ? drawer_left_default : drawer_right_default,
        isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT,
        children: /* @__PURE__ */ (0, import_jsx_runtime334.jsxs)(Tabs5.Context.Provider, { value: tabsContextValue, children: [
          /* @__PURE__ */ (0, import_jsx_runtime334.jsxs)(Tabs5.TabPanel, { tabId: sidebars.document, focusable: false, children: [
            /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(PostSummary, { onActionPerformed }),
            /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(plugin_document_setting_panel_default.Slot, {}),
            /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(TemplateContentPanel, {}),
            /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(TemplatePartContentPanel, {}),
            /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(PostTransformPanel, {}),
            /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(PostTaxonomies2, {}),
            /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(PatternOverridesPanel, {}),
            extraPanels
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(Tabs5.TabPanel, { tabId: sidebars.block, focusable: false, children: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(import_block_editor90.BlockInspector, {}) })
        ] })
      }
    );
  };
  var Sidebar = ({ extraPanels, onActionPerformed }) => {
    use_auto_switch_editor_sidebars_default();
    const { tabName, keyboardShortcut, showSummary } = (0, import_data219.useSelect)(
      (select5) => {
        const shortcut = select5(
          import_keyboard_shortcuts10.store
        ).getShortcutRepresentation("core/editor/toggle-sidebar");
        const sidebar = select5(store2).getActiveComplementaryArea("core");
        const _isEditorSidebarOpened = [
          sidebars.block,
          sidebars.document
        ].includes(sidebar);
        let _tabName = sidebar;
        if (!_isEditorSidebarOpened) {
          _tabName = !!select5(
            import_block_editor90.store
          ).getBlockSelectionStart() ? sidebars.block : sidebars.document;
        }
        return {
          tabName: _tabName,
          keyboardShortcut: shortcut,
          showSummary: ![
            TEMPLATE_POST_TYPE,
            TEMPLATE_PART_POST_TYPE,
            NAVIGATION_POST_TYPE
          ].includes(select5(store).getCurrentPostType())
        };
      },
      []
    );
    const { enableComplementaryArea: enableComplementaryArea2 } = (0, import_data219.useDispatch)(store2);
    const onTabSelect = (0, import_element167.useCallback)(
      (newSelectedTabId) => {
        if (!!newSelectedTabId) {
          enableComplementaryArea2("core", newSelectedTabId);
        }
      },
      [enableComplementaryArea2]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
      Tabs5,
      {
        selectedTabId: tabName,
        onSelect: onTabSelect,
        selectOnMove: false,
        children: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
          SidebarContent,
          {
            tabName,
            keyboardShortcut,
            showSummary,
            onActionPerformed,
            extraPanels
          }
        )
      }
    );
  };
  var sidebar_default2 = Sidebar;

  // packages/editor/build-module/components/collab-sidebar/index.mjs
  var import_i18n221 = __toESM(require_i18n(), 1);
  var import_data225 = __toESM(require_data(), 1);
  var import_components210 = __toESM(require_components(), 1);
  var import_element172 = __toESM(require_element(), 1);
  var import_compose61 = __toESM(require_compose(), 1);
  var import_block_editor97 = __toESM(require_block_editor(), 1);

  // packages/editor/build-module/components/collab-sidebar/constants.mjs
  var collabHistorySidebarName = "edit-post/collab-history-sidebar";
  var collabSidebarName = "edit-post/collab-sidebar";
  var SIDEBARS = [collabHistorySidebarName, collabSidebarName];

  // packages/editor/build-module/components/collab-sidebar/comments.mjs
  var import_element170 = __toESM(require_element(), 1);
  var import_components207 = __toESM(require_components(), 1);
  var import_compose60 = __toESM(require_compose(), 1);
  var import_i18n218 = __toESM(require_i18n(), 1);
  var import_data223 = __toESM(require_data(), 1);
  var import_dom8 = __toESM(require_dom(), 1);
  var import_block_editor94 = __toESM(require_block_editor(), 1);

  // packages/editor/build-module/components/collab-sidebar/comment-author-info.mjs
  var import_components204 = __toESM(require_components(), 1);
  var import_i18n214 = __toESM(require_i18n(), 1);
  var import_date8 = __toESM(require_date(), 1);
  var import_core_data117 = __toESM(require_core_data(), 1);
  var import_data220 = __toESM(require_data(), 1);
  var import_block_editor91 = __toESM(require_block_editor(), 1);

  // packages/editor/build-module/components/collab-sidebar/utils.mjs
  var import_i18n213 = __toESM(require_i18n(), 1);
  function sanitizeCommentString(str) {
    return str.trim();
  }
  function noop6() {
  }
  var AVATAR_BORDER_COLORS = [
    "#3858E9",
    // Blueberry
    "#9fB1FF",
    // Blueberry 2
    "#1D35B4",
    // Dark Blueberry
    "#1A1919",
    // Charcoal 0
    "#E26F56",
    // Pomegranate
    "#33F078",
    // Acid Green
    "#FFF972",
    // Lemon
    "#7A00DF"
    // Purple
  ];
  function getAvatarBorderColor(userId) {
    return AVATAR_BORDER_COLORS[userId % AVATAR_BORDER_COLORS.length];
  }
  function getCommentExcerpt(text, excerptLength = 10) {
    if (!text) {
      return "";
    }
    const wordCountType = (0, import_i18n213._x)("words", "Word count type. Do not translate!");
    const rawText = text.trim();
    let trimmedExcerpt = "";
    if (wordCountType === "words") {
      trimmedExcerpt = rawText.split(" ", excerptLength).join(" ");
    } else if (wordCountType === "characters_excluding_spaces") {
      const textWithSpaces = rawText.split("", excerptLength).join("");
      const numberOfSpaces = textWithSpaces.length - textWithSpaces.replaceAll(" ", "").length;
      trimmedExcerpt = rawText.split("", excerptLength + numberOfSpaces).join("");
    } else if (wordCountType === "characters_including_spaces") {
      trimmedExcerpt = rawText.split("", excerptLength).join("");
    }
    const isTrimmed = trimmedExcerpt !== rawText;
    return isTrimmed ? trimmedExcerpt + "\u2026" : trimmedExcerpt;
  }
  function focusCommentThread(commentId, container, additionalSelector) {
    if (!container) {
      return;
    }
    const threadSelector = commentId ? `[role=treeitem][id="comment-thread-${commentId}"]` : "[role=treeitem]:not([id])";
    const selector = additionalSelector ? `${threadSelector} ${additionalSelector}` : threadSelector;
    return new Promise((resolve) => {
      if (container.querySelector(selector)) {
        return resolve(container.querySelector(selector));
      }
      let timer = null;
      const observer = new window.MutationObserver(() => {
        if (container.querySelector(selector)) {
          clearTimeout(timer);
          observer.disconnect();
          resolve(container.querySelector(selector));
        }
      });
      observer.observe(container, {
        childList: true,
        subtree: true
      });
      timer = setTimeout(() => {
        observer.disconnect();
        resolve(null);
      }, 3e3);
    }).then((element) => element?.focus());
  }

  // packages/editor/build-module/components/collab-sidebar/comment-author-info.mjs
  var import_jsx_runtime335 = __toESM(require_jsx_runtime(), 1);
  function CommentAuthorInfo({ avatar, name: name2, date, userId }) {
    const hasAvatar = !!avatar;
    const dateSettings = (0, import_date8.getSettings)();
    const {
      currentUserAvatar,
      currentUserName,
      currentUserId,
      dateFormat = dateSettings.formats.date
    } = (0, import_data220.useSelect)(
      (select5) => {
        const { canUser, getCurrentUser, getEntityRecord } = select5(import_core_data117.store);
        const siteSettings = canUser("read", {
          kind: "root",
          name: "site"
        }) ? getEntityRecord("root", "site") : void 0;
        if (hasAvatar) {
          return {
            dateFormat: siteSettings?.date_format
          };
        }
        const { getSettings: getSettings5 } = select5(import_block_editor91.store);
        const { __experimentalDiscussionSettings } = getSettings5();
        const defaultAvatar = __experimentalDiscussionSettings?.avatarURL;
        const userData = getCurrentUser();
        return {
          currentUserAvatar: userData?.avatar_urls?.[48] ?? defaultAvatar,
          currentUserName: userData?.name,
          currentUserId: userData?.id,
          dateFormat: siteSettings?.date_format
        };
      },
      [hasAvatar]
    );
    const commentDate = (0, import_date8.getDate)(date);
    const commentDateTime = (0, import_date8.dateI18n)("c", commentDate);
    const shouldShowHumanTimeDiff = Math.floor((/* @__PURE__ */ new Date() - commentDate) / (1e3 * 60 * 60 * 24)) < 30;
    const commentDateText = shouldShowHumanTimeDiff ? (0, import_date8.humanTimeDiff)(commentDate) : (0, import_date8.dateI18n)(dateFormat, commentDate);
    const tooltipText = (0, import_date8.dateI18n)(
      // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
      (0, import_i18n214._x)("F j, Y g:i\xA0a", "Note date full date format"),
      date
    );
    return /* @__PURE__ */ (0, import_jsx_runtime335.jsxs)(import_jsx_runtime335.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(
        "img",
        {
          src: avatar || currentUserAvatar,
          className: "editor-collab-sidebar-panel__user-avatar",
          alt: (0, import_i18n214.__)("User avatar"),
          width: 32,
          height: 32,
          style: {
            borderColor: getAvatarBorderColor(
              userId ?? currentUserId
            )
          }
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime335.jsxs)(import_components204.__experimentalVStack, { spacing: "0", children: [
        /* @__PURE__ */ (0, import_jsx_runtime335.jsx)("span", { className: "editor-collab-sidebar-panel__user-name", children: name2 ?? currentUserName }),
        date && /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(import_components204.Tooltip, { text: tooltipText, children: /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(
          "time",
          {
            dateTime: commentDateTime,
            className: "editor-collab-sidebar-panel__user-time",
            children: commentDateText
          }
        ) })
      ] })
    ] });
  }
  var comment_author_info_default = CommentAuthorInfo;

  // packages/editor/build-module/components/collab-sidebar/comment-form.mjs
  var import_react_autosize_textarea2 = __toESM(require_lib(), 1);
  var import_element168 = __toESM(require_element(), 1);
  var import_components205 = __toESM(require_components(), 1);
  var import_i18n215 = __toESM(require_i18n(), 1);
  var import_compose59 = __toESM(require_compose(), 1);
  var import_keycodes17 = __toESM(require_keycodes(), 1);
  var import_jsx_runtime336 = __toESM(require_jsx_runtime(), 1);
  function CommentForm({
    onSubmit,
    onCancel,
    thread,
    submitButtonText,
    labelText,
    reflowComments = noop6
  }) {
    const [inputComment, setInputComment] = (0, import_element168.useState)(
      thread?.content?.raw ?? ""
    );
    const debouncedCommentUpdated = (0, import_compose59.useDebounce)(reflowComments, 100);
    const updateComment = (value) => {
      setInputComment(value);
    };
    const inputId = (0, import_compose59.useInstanceId)(CommentForm, "comment-input");
    const isDisabled = inputComment === thread?.content?.raw || !sanitizeCommentString(inputComment).length;
    return /* @__PURE__ */ (0, import_jsx_runtime336.jsxs)(
      import_components205.__experimentalVStack,
      {
        className: "editor-collab-sidebar-panel__comment-form",
        spacing: "4",
        as: "form",
        onSubmit: (event) => {
          event.preventDefault();
          onSubmit(inputComment);
          setInputComment("");
        },
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(import_components205.VisuallyHidden, { as: "label", htmlFor: inputId, children: labelText ?? (0, import_i18n215.__)("Note") }),
          /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
            import_react_autosize_textarea2.default,
            {
              id: inputId,
              value: inputComment ?? "",
              onChange: (comment) => {
                updateComment(comment.target.value);
                debouncedCommentUpdated();
              },
              rows: 1,
              maxRows: 20,
              onKeyDown: (event) => {
                if (import_keycodes17.isKeyboardEvent.primary(event, "Enter") && !isDisabled) {
                  event.target.parentNode.requestSubmit();
                }
              }
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime336.jsxs)(import_components205.__experimentalHStack, { spacing: "2", justify: "flex-end", wrap: true, children: [
            /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(import_components205.Button, { size: "compact", variant: "tertiary", onClick: onCancel, children: /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(import_components205.__experimentalTruncate, { children: (0, import_i18n215.__)("Cancel") }) }),
            /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
              import_components205.Button,
              {
                size: "compact",
                accessibleWhenDisabled: true,
                variant: "primary",
                type: "submit",
                disabled: isDisabled,
                children: /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(import_components205.__experimentalTruncate, { children: submitButtonText })
              }
            )
          ] })
        ]
      }
    );
  }
  var comment_form_default = CommentForm;

  // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
  var min = Math.min;
  var max = Math.max;
  var round = Math.round;
  var floor = Math.floor;
  var createCoords = (v3) => ({
    x: v3,
    y: v3
  });
  function evaluate(value, param) {
    return typeof value === "function" ? value(param) : value;
  }
  function getSide(placement) {
    return placement.split("-")[0];
  }
  function getAlignment(placement) {
    return placement.split("-")[1];
  }
  function getOppositeAxis(axis) {
    return axis === "x" ? "y" : "x";
  }
  function getAxisLength(axis) {
    return axis === "y" ? "height" : "width";
  }
  var yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
  function getSideAxis(placement) {
    return yAxisSides.has(getSide(placement)) ? "y" : "x";
  }
  function getAlignmentAxis(placement) {
    return getOppositeAxis(getSideAxis(placement));
  }
  function rectToClientRect(rect) {
    const {
      x: x2,
      y: y3,
      width,
      height
    } = rect;
    return {
      width,
      height,
      top: y3,
      left: x2,
      right: x2 + width,
      bottom: y3 + height,
      x: x2,
      y: y3
    };
  }

  // node_modules/@floating-ui/core/dist/floating-ui.core.mjs
  function computeCoordsFromPlacement(_ref, placement, rtl) {
    let {
      reference,
      floating
    } = _ref;
    const sideAxis = getSideAxis(placement);
    const alignmentAxis = getAlignmentAxis(placement);
    const alignLength = getAxisLength(alignmentAxis);
    const side = getSide(placement);
    const isVertical = sideAxis === "y";
    const commonX = reference.x + reference.width / 2 - floating.width / 2;
    const commonY = reference.y + reference.height / 2 - floating.height / 2;
    const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
    let coords;
    switch (side) {
      case "top":
        coords = {
          x: commonX,
          y: reference.y - floating.height
        };
        break;
      case "bottom":
        coords = {
          x: commonX,
          y: reference.y + reference.height
        };
        break;
      case "right":
        coords = {
          x: reference.x + reference.width,
          y: commonY
        };
        break;
      case "left":
        coords = {
          x: reference.x - floating.width,
          y: commonY
        };
        break;
      default:
        coords = {
          x: reference.x,
          y: reference.y
        };
    }
    switch (getAlignment(placement)) {
      case "start":
        coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
        break;
      case "end":
        coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
        break;
    }
    return coords;
  }
  var computePosition = async (reference, floating, config) => {
    const {
      placement = "bottom",
      strategy = "absolute",
      middleware = [],
      platform: platform2
    } = config;
    const validMiddleware = middleware.filter(Boolean);
    const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
    let rects = await platform2.getElementRects({
      reference,
      floating,
      strategy
    });
    let {
      x: x2,
      y: y3
    } = computeCoordsFromPlacement(rects, placement, rtl);
    let statefulPlacement = placement;
    let middlewareData = {};
    let resetCount = 0;
    for (let i3 = 0; i3 < validMiddleware.length; i3++) {
      const {
        name: name2,
        fn
      } = validMiddleware[i3];
      const {
        x: nextX,
        y: nextY,
        data,
        reset
      } = await fn({
        x: x2,
        y: y3,
        initialPlacement: placement,
        placement: statefulPlacement,
        strategy,
        middlewareData,
        rects,
        platform: platform2,
        elements: {
          reference,
          floating
        }
      });
      x2 = nextX != null ? nextX : x2;
      y3 = nextY != null ? nextY : y3;
      middlewareData = {
        ...middlewareData,
        [name2]: {
          ...middlewareData[name2],
          ...data
        }
      };
      if (reset && resetCount <= 50) {
        resetCount++;
        if (typeof reset === "object") {
          if (reset.placement) {
            statefulPlacement = reset.placement;
          }
          if (reset.rects) {
            rects = reset.rects === true ? await platform2.getElementRects({
              reference,
              floating,
              strategy
            }) : reset.rects;
          }
          ({
            x: x2,
            y: y3
          } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
        }
        i3 = -1;
      }
    }
    return {
      x: x2,
      y: y3,
      placement: statefulPlacement,
      strategy,
      middlewareData
    };
  };
  var originSides = /* @__PURE__ */ new Set(["left", "top"]);
  async function convertValueToCoords(state, options) {
    const {
      placement,
      platform: platform2,
      elements: elements2
    } = state;
    const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements2.floating));
    const side = getSide(placement);
    const alignment = getAlignment(placement);
    const isVertical = getSideAxis(placement) === "y";
    const mainAxisMulti = originSides.has(side) ? -1 : 1;
    const crossAxisMulti = rtl && isVertical ? -1 : 1;
    const rawValue = evaluate(options, state);
    let {
      mainAxis,
      crossAxis,
      alignmentAxis
    } = typeof rawValue === "number" ? {
      mainAxis: rawValue,
      crossAxis: 0,
      alignmentAxis: null
    } : {
      mainAxis: rawValue.mainAxis || 0,
      crossAxis: rawValue.crossAxis || 0,
      alignmentAxis: rawValue.alignmentAxis
    };
    if (alignment && typeof alignmentAxis === "number") {
      crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
    }
    return isVertical ? {
      x: crossAxis * crossAxisMulti,
      y: mainAxis * mainAxisMulti
    } : {
      x: mainAxis * mainAxisMulti,
      y: crossAxis * crossAxisMulti
    };
  }
  var offset = function(options) {
    if (options === void 0) {
      options = 0;
    }
    return {
      name: "offset",
      options,
      async fn(state) {
        var _middlewareData$offse, _middlewareData$arrow;
        const {
          x: x2,
          y: y3,
          placement,
          middlewareData
        } = state;
        const diffCoords = await convertValueToCoords(state, options);
        if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
          return {};
        }
        return {
          x: x2 + diffCoords.x,
          y: y3 + diffCoords.y,
          data: {
            ...diffCoords,
            placement
          }
        };
      }
    };
  };

  // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
  function hasWindow() {
    return typeof window !== "undefined";
  }
  function getNodeName(node) {
    if (isNode(node)) {
      return (node.nodeName || "").toLowerCase();
    }
    return "#document";
  }
  function getWindow(node) {
    var _node$ownerDocument;
    return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
  }
  function getDocumentElement(node) {
    var _ref;
    return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
  }
  function isNode(value) {
    if (!hasWindow()) {
      return false;
    }
    return value instanceof Node || value instanceof getWindow(value).Node;
  }
  function isElement(value) {
    if (!hasWindow()) {
      return false;
    }
    return value instanceof Element || value instanceof getWindow(value).Element;
  }
  function isHTMLElement(value) {
    if (!hasWindow()) {
      return false;
    }
    return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
  }
  function isShadowRoot(value) {
    if (!hasWindow() || typeof ShadowRoot === "undefined") {
      return false;
    }
    return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
  }
  var invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
  function isOverflowElement(element) {
    const {
      overflow,
      overflowX,
      overflowY,
      display
    } = getComputedStyle2(element);
    return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
  }
  var tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]);
  function isTableElement(element) {
    return tableElements.has(getNodeName(element));
  }
  var topLayerSelectors = [":popover-open", ":modal"];
  function isTopLayer(element) {
    return topLayerSelectors.some((selector) => {
      try {
        return element.matches(selector);
      } catch (_e) {
        return false;
      }
    });
  }
  var transformProperties = ["transform", "translate", "scale", "rotate", "perspective"];
  var willChangeValues = ["transform", "translate", "scale", "rotate", "perspective", "filter"];
  var containValues = ["paint", "layout", "strict", "content"];
  function isContainingBlock(elementOrCss) {
    const webkit = isWebKit();
    const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
    return transformProperties.some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || willChangeValues.some((value) => (css.willChange || "").includes(value)) || containValues.some((value) => (css.contain || "").includes(value));
  }
  function getContainingBlock(element) {
    let currentNode = getParentNode(element);
    while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
      if (isContainingBlock(currentNode)) {
        return currentNode;
      } else if (isTopLayer(currentNode)) {
        return null;
      }
      currentNode = getParentNode(currentNode);
    }
    return null;
  }
  function isWebKit() {
    if (typeof CSS === "undefined" || !CSS.supports) return false;
    return CSS.supports("-webkit-backdrop-filter", "none");
  }
  var lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]);
  function isLastTraversableNode(node) {
    return lastTraversableNodeNames.has(getNodeName(node));
  }
  function getComputedStyle2(element) {
    return getWindow(element).getComputedStyle(element);
  }
  function getNodeScroll(element) {
    if (isElement(element)) {
      return {
        scrollLeft: element.scrollLeft,
        scrollTop: element.scrollTop
      };
    }
    return {
      scrollLeft: element.scrollX,
      scrollTop: element.scrollY
    };
  }
  function getParentNode(node) {
    if (getNodeName(node) === "html") {
      return node;
    }
    const result = (
      // Step into the shadow DOM of the parent of a slotted node.
      node.assignedSlot || // DOM Element detected.
      node.parentNode || // ShadowRoot detected.
      isShadowRoot(node) && node.host || // Fallback.
      getDocumentElement(node)
    );
    return isShadowRoot(result) ? result.host : result;
  }
  function getNearestOverflowAncestor(node) {
    const parentNode = getParentNode(node);
    if (isLastTraversableNode(parentNode)) {
      return node.ownerDocument ? node.ownerDocument.body : node.body;
    }
    if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
      return parentNode;
    }
    return getNearestOverflowAncestor(parentNode);
  }
  function getOverflowAncestors(node, list, traverseIframes) {
    var _node$ownerDocument2;
    if (list === void 0) {
      list = [];
    }
    if (traverseIframes === void 0) {
      traverseIframes = true;
    }
    const scrollableAncestor = getNearestOverflowAncestor(node);
    const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
    const win = getWindow(scrollableAncestor);
    if (isBody) {
      const frameElement = getFrameElement(win);
      return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
    }
    return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
  }
  function getFrameElement(win) {
    return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
  }

  // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
  function getCssDimensions(element) {
    const css = getComputedStyle2(element);
    let width = parseFloat(css.width) || 0;
    let height = parseFloat(css.height) || 0;
    const hasOffset = isHTMLElement(element);
    const offsetWidth = hasOffset ? element.offsetWidth : width;
    const offsetHeight = hasOffset ? element.offsetHeight : height;
    const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
    if (shouldFallback) {
      width = offsetWidth;
      height = offsetHeight;
    }
    return {
      width,
      height,
      $: shouldFallback
    };
  }
  function unwrapElement(element) {
    return !isElement(element) ? element.contextElement : element;
  }
  function getScale(element) {
    const domElement = unwrapElement(element);
    if (!isHTMLElement(domElement)) {
      return createCoords(1);
    }
    const rect = domElement.getBoundingClientRect();
    const {
      width,
      height,
      $: $2
    } = getCssDimensions(domElement);
    let x2 = ($2 ? round(rect.width) : rect.width) / width;
    let y3 = ($2 ? round(rect.height) : rect.height) / height;
    if (!x2 || !Number.isFinite(x2)) {
      x2 = 1;
    }
    if (!y3 || !Number.isFinite(y3)) {
      y3 = 1;
    }
    return {
      x: x2,
      y: y3
    };
  }
  var noOffsets = /* @__PURE__ */ createCoords(0);
  function getVisualOffsets(element) {
    const win = getWindow(element);
    if (!isWebKit() || !win.visualViewport) {
      return noOffsets;
    }
    return {
      x: win.visualViewport.offsetLeft,
      y: win.visualViewport.offsetTop
    };
  }
  function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
    if (isFixed === void 0) {
      isFixed = false;
    }
    if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
      return false;
    }
    return isFixed;
  }
  function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
    if (includeScale === void 0) {
      includeScale = false;
    }
    if (isFixedStrategy === void 0) {
      isFixedStrategy = false;
    }
    const clientRect = element.getBoundingClientRect();
    const domElement = unwrapElement(element);
    let scale = createCoords(1);
    if (includeScale) {
      if (offsetParent) {
        if (isElement(offsetParent)) {
          scale = getScale(offsetParent);
        }
      } else {
        scale = getScale(element);
      }
    }
    const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
    let x2 = (clientRect.left + visualOffsets.x) / scale.x;
    let y3 = (clientRect.top + visualOffsets.y) / scale.y;
    let width = clientRect.width / scale.x;
    let height = clientRect.height / scale.y;
    if (domElement) {
      const win = getWindow(domElement);
      const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
      let currentWin = win;
      let currentIFrame = getFrameElement(currentWin);
      while (currentIFrame && offsetParent && offsetWin !== currentWin) {
        const iframeScale = getScale(currentIFrame);
        const iframeRect = currentIFrame.getBoundingClientRect();
        const css = getComputedStyle2(currentIFrame);
        const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
        const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
        x2 *= iframeScale.x;
        y3 *= iframeScale.y;
        width *= iframeScale.x;
        height *= iframeScale.y;
        x2 += left;
        y3 += top;
        currentWin = getWindow(currentIFrame);
        currentIFrame = getFrameElement(currentWin);
      }
    }
    return rectToClientRect({
      width,
      height,
      x: x2,
      y: y3
    });
  }
  function getWindowScrollBarX(element, rect) {
    const leftScroll = getNodeScroll(element).scrollLeft;
    if (!rect) {
      return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
    }
    return rect.left + leftScroll;
  }
  function getHTMLOffset(documentElement, scroll) {
    const htmlRect = documentElement.getBoundingClientRect();
    const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
    const y3 = htmlRect.top + scroll.scrollTop;
    return {
      x: x2,
      y: y3
    };
  }
  function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
    let {
      elements: elements2,
      rect,
      offsetParent,
      strategy
    } = _ref;
    const isFixed = strategy === "fixed";
    const documentElement = getDocumentElement(offsetParent);
    const topLayer = elements2 ? isTopLayer(elements2.floating) : false;
    if (offsetParent === documentElement || topLayer && isFixed) {
      return rect;
    }
    let scroll = {
      scrollLeft: 0,
      scrollTop: 0
    };
    let scale = createCoords(1);
    const offsets = createCoords(0);
    const isOffsetParentAnElement = isHTMLElement(offsetParent);
    if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
      if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
        scroll = getNodeScroll(offsetParent);
      }
      if (isHTMLElement(offsetParent)) {
        const offsetRect = getBoundingClientRect(offsetParent);
        scale = getScale(offsetParent);
        offsets.x = offsetRect.x + offsetParent.clientLeft;
        offsets.y = offsetRect.y + offsetParent.clientTop;
      }
    }
    const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
    return {
      width: rect.width * scale.x,
      height: rect.height * scale.y,
      x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
      y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
    };
  }
  function getClientRects(element) {
    return Array.from(element.getClientRects());
  }
  function getDocumentRect(element) {
    const html = getDocumentElement(element);
    const scroll = getNodeScroll(element);
    const body = element.ownerDocument.body;
    const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
    const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
    let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
    const y3 = -scroll.scrollTop;
    if (getComputedStyle2(body).direction === "rtl") {
      x2 += max(html.clientWidth, body.clientWidth) - width;
    }
    return {
      width,
      height,
      x: x2,
      y: y3
    };
  }
  var SCROLLBAR_MAX = 25;
  function getViewportRect(element, strategy) {
    const win = getWindow(element);
    const html = getDocumentElement(element);
    const visualViewport = win.visualViewport;
    let width = html.clientWidth;
    let height = html.clientHeight;
    let x2 = 0;
    let y3 = 0;
    if (visualViewport) {
      width = visualViewport.width;
      height = visualViewport.height;
      const visualViewportBased = isWebKit();
      if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
        x2 = visualViewport.offsetLeft;
        y3 = visualViewport.offsetTop;
      }
    }
    const windowScrollbarX = getWindowScrollBarX(html);
    if (windowScrollbarX <= 0) {
      const doc = html.ownerDocument;
      const body = doc.body;
      const bodyStyles = getComputedStyle(body);
      const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
      const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
      if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
        width -= clippingStableScrollbarWidth;
      }
    } else if (windowScrollbarX <= SCROLLBAR_MAX) {
      width += windowScrollbarX;
    }
    return {
      width,
      height,
      x: x2,
      y: y3
    };
  }
  var absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
  function getInnerBoundingClientRect(element, strategy) {
    const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
    const top = clientRect.top + element.clientTop;
    const left = clientRect.left + element.clientLeft;
    const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
    const width = element.clientWidth * scale.x;
    const height = element.clientHeight * scale.y;
    const x2 = left * scale.x;
    const y3 = top * scale.y;
    return {
      width,
      height,
      x: x2,
      y: y3
    };
  }
  function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
    let rect;
    if (clippingAncestor === "viewport") {
      rect = getViewportRect(element, strategy);
    } else if (clippingAncestor === "document") {
      rect = getDocumentRect(getDocumentElement(element));
    } else if (isElement(clippingAncestor)) {
      rect = getInnerBoundingClientRect(clippingAncestor, strategy);
    } else {
      const visualOffsets = getVisualOffsets(element);
      rect = {
        x: clippingAncestor.x - visualOffsets.x,
        y: clippingAncestor.y - visualOffsets.y,
        width: clippingAncestor.width,
        height: clippingAncestor.height
      };
    }
    return rectToClientRect(rect);
  }
  function hasFixedPositionAncestor(element, stopNode) {
    const parentNode = getParentNode(element);
    if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
      return false;
    }
    return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
  }
  function getClippingElementAncestors(element, cache) {
    const cachedResult = cache.get(element);
    if (cachedResult) {
      return cachedResult;
    }
    let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
    let currentContainingBlockComputedStyle = null;
    const elementIsFixed = getComputedStyle2(element).position === "fixed";
    let currentNode = elementIsFixed ? getParentNode(element) : element;
    while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
      const computedStyle = getComputedStyle2(currentNode);
      const currentNodeIsContaining = isContainingBlock(currentNode);
      if (!currentNodeIsContaining && computedStyle.position === "fixed") {
        currentContainingBlockComputedStyle = null;
      }
      const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
      if (shouldDropCurrentNode) {
        result = result.filter((ancestor) => ancestor !== currentNode);
      } else {
        currentContainingBlockComputedStyle = computedStyle;
      }
      currentNode = getParentNode(currentNode);
    }
    cache.set(element, result);
    return result;
  }
  function getClippingRect(_ref) {
    let {
      element,
      boundary,
      rootBoundary,
      strategy
    } = _ref;
    const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
    const clippingAncestors = [...elementClippingAncestors, rootBoundary];
    const firstClippingAncestor = clippingAncestors[0];
    const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
      const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
      accRect.top = max(rect.top, accRect.top);
      accRect.right = min(rect.right, accRect.right);
      accRect.bottom = min(rect.bottom, accRect.bottom);
      accRect.left = max(rect.left, accRect.left);
      return accRect;
    }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
    return {
      width: clippingRect.right - clippingRect.left,
      height: clippingRect.bottom - clippingRect.top,
      x: clippingRect.left,
      y: clippingRect.top
    };
  }
  function getDimensions(element) {
    const {
      width,
      height
    } = getCssDimensions(element);
    return {
      width,
      height
    };
  }
  function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
    const isOffsetParentAnElement = isHTMLElement(offsetParent);
    const documentElement = getDocumentElement(offsetParent);
    const isFixed = strategy === "fixed";
    const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
    let scroll = {
      scrollLeft: 0,
      scrollTop: 0
    };
    const offsets = createCoords(0);
    function setLeftRTLScrollbarOffset() {
      offsets.x = getWindowScrollBarX(documentElement);
    }
    if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
      if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
        scroll = getNodeScroll(offsetParent);
      }
      if (isOffsetParentAnElement) {
        const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
        offsets.x = offsetRect.x + offsetParent.clientLeft;
        offsets.y = offsetRect.y + offsetParent.clientTop;
      } else if (documentElement) {
        setLeftRTLScrollbarOffset();
      }
    }
    if (isFixed && !isOffsetParentAnElement && documentElement) {
      setLeftRTLScrollbarOffset();
    }
    const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
    const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
    const y3 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
    return {
      x: x2,
      y: y3,
      width: rect.width,
      height: rect.height
    };
  }
  function isStaticPositioned(element) {
    return getComputedStyle2(element).position === "static";
  }
  function getTrueOffsetParent(element, polyfill) {
    if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
      return null;
    }
    if (polyfill) {
      return polyfill(element);
    }
    let rawOffsetParent = element.offsetParent;
    if (getDocumentElement(element) === rawOffsetParent) {
      rawOffsetParent = rawOffsetParent.ownerDocument.body;
    }
    return rawOffsetParent;
  }
  function getOffsetParent(element, polyfill) {
    const win = getWindow(element);
    if (isTopLayer(element)) {
      return win;
    }
    if (!isHTMLElement(element)) {
      let svgOffsetParent = getParentNode(element);
      while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
        if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
          return svgOffsetParent;
        }
        svgOffsetParent = getParentNode(svgOffsetParent);
      }
      return win;
    }
    let offsetParent = getTrueOffsetParent(element, polyfill);
    while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
      offsetParent = getTrueOffsetParent(offsetParent, polyfill);
    }
    if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
      return win;
    }
    return offsetParent || getContainingBlock(element) || win;
  }
  var getElementRects = async function(data) {
    const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
    const getDimensionsFn = this.getDimensions;
    const floatingDimensions = await getDimensionsFn(data.floating);
    return {
      reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
      floating: {
        x: 0,
        y: 0,
        width: floatingDimensions.width,
        height: floatingDimensions.height
      }
    };
  };
  function isRTL17(element) {
    return getComputedStyle2(element).direction === "rtl";
  }
  var platform = {
    convertOffsetParentRelativeRectToViewportRelativeRect,
    getDocumentElement,
    getClippingRect,
    getOffsetParent,
    getElementRects,
    getClientRects,
    getDimensions,
    getScale,
    isElement,
    isRTL: isRTL17
  };
  function rectsAreEqual(a3, b3) {
    return a3.x === b3.x && a3.y === b3.y && a3.width === b3.width && a3.height === b3.height;
  }
  function observeMove(element, onMove) {
    let io = null;
    let timeoutId;
    const root = getDocumentElement(element);
    function cleanup() {
      var _io;
      clearTimeout(timeoutId);
      (_io = io) == null || _io.disconnect();
      io = null;
    }
    function refresh(skip, threshold) {
      if (skip === void 0) {
        skip = false;
      }
      if (threshold === void 0) {
        threshold = 1;
      }
      cleanup();
      const elementRectForRootMargin = element.getBoundingClientRect();
      const {
        left,
        top,
        width,
        height
      } = elementRectForRootMargin;
      if (!skip) {
        onMove();
      }
      if (!width || !height) {
        return;
      }
      const insetTop = floor(top);
      const insetRight = floor(root.clientWidth - (left + width));
      const insetBottom = floor(root.clientHeight - (top + height));
      const insetLeft = floor(left);
      const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
      const options = {
        rootMargin,
        threshold: max(0, min(1, threshold)) || 1
      };
      let isFirstUpdate = true;
      function handleObserve(entries) {
        const ratio = entries[0].intersectionRatio;
        if (ratio !== threshold) {
          if (!isFirstUpdate) {
            return refresh();
          }
          if (!ratio) {
            timeoutId = setTimeout(() => {
              refresh(false, 1e-7);
            }, 1e3);
          } else {
            refresh(false, ratio);
          }
        }
        if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
          refresh();
        }
        isFirstUpdate = false;
      }
      try {
        io = new IntersectionObserver(handleObserve, {
          ...options,
          // Handle <iframe>s
          root: root.ownerDocument
        });
      } catch (_e) {
        io = new IntersectionObserver(handleObserve, options);
      }
      io.observe(element);
    }
    refresh(true);
    return cleanup;
  }
  function autoUpdate(reference, floating, update, options) {
    if (options === void 0) {
      options = {};
    }
    const {
      ancestorScroll = true,
      ancestorResize = true,
      elementResize = typeof ResizeObserver === "function",
      layoutShift = typeof IntersectionObserver === "function",
      animationFrame = false
    } = options;
    const referenceEl = unwrapElement(reference);
    const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
    ancestors.forEach((ancestor) => {
      ancestorScroll && ancestor.addEventListener("scroll", update, {
        passive: true
      });
      ancestorResize && ancestor.addEventListener("resize", update);
    });
    const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
    let reobserveFrame = -1;
    let resizeObserver = null;
    if (elementResize) {
      resizeObserver = new ResizeObserver((_ref) => {
        let [firstEntry] = _ref;
        if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
          resizeObserver.unobserve(floating);
          cancelAnimationFrame(reobserveFrame);
          reobserveFrame = requestAnimationFrame(() => {
            var _resizeObserver;
            (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
          });
        }
        update();
      });
      if (referenceEl && !animationFrame) {
        resizeObserver.observe(referenceEl);
      }
      resizeObserver.observe(floating);
    }
    let frameId;
    let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
    if (animationFrame) {
      frameLoop();
    }
    function frameLoop() {
      const nextRefRect = getBoundingClientRect(reference);
      if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
        update();
      }
      prevRefRect = nextRefRect;
      frameId = requestAnimationFrame(frameLoop);
    }
    update();
    return () => {
      var _resizeObserver2;
      ancestors.forEach((ancestor) => {
        ancestorScroll && ancestor.removeEventListener("scroll", update);
        ancestorResize && ancestor.removeEventListener("resize", update);
      });
      cleanupIo == null || cleanupIo();
      (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
      resizeObserver = null;
      if (animationFrame) {
        cancelAnimationFrame(frameId);
      }
    };
  }
  var offset2 = offset;
  var computePosition2 = (reference, floating, options) => {
    const cache = /* @__PURE__ */ new Map();
    const mergedOptions = {
      platform,
      ...options
    };
    const platformWithCache = {
      ...mergedOptions.platform,
      _c: cache
    };
    return computePosition(reference, floating, {
      ...mergedOptions,
      platform: platformWithCache
    });
  };

  // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
  var React = __toESM(require_react(), 1);
  var import_react = __toESM(require_react(), 1);
  var ReactDOM = __toESM(require_react_dom(), 1);
  var index = typeof document !== "undefined" ? import_react.useLayoutEffect : import_react.useEffect;
  function deepEqual(a3, b3) {
    if (a3 === b3) {
      return true;
    }
    if (typeof a3 !== typeof b3) {
      return false;
    }
    if (typeof a3 === "function" && a3.toString() === b3.toString()) {
      return true;
    }
    let length;
    let i3;
    let keys;
    if (a3 && b3 && typeof a3 === "object") {
      if (Array.isArray(a3)) {
        length = a3.length;
        if (length !== b3.length) return false;
        for (i3 = length; i3-- !== 0; ) {
          if (!deepEqual(a3[i3], b3[i3])) {
            return false;
          }
        }
        return true;
      }
      keys = Object.keys(a3);
      length = keys.length;
      if (length !== Object.keys(b3).length) {
        return false;
      }
      for (i3 = length; i3-- !== 0; ) {
        if (!{}.hasOwnProperty.call(b3, keys[i3])) {
          return false;
        }
      }
      for (i3 = length; i3-- !== 0; ) {
        const key = keys[i3];
        if (key === "_owner" && a3.$$typeof) {
          continue;
        }
        if (!deepEqual(a3[key], b3[key])) {
          return false;
        }
      }
      return true;
    }
    return a3 !== a3 && b3 !== b3;
  }
  function getDPR(element) {
    if (typeof window === "undefined") {
      return 1;
    }
    const win = element.ownerDocument.defaultView || window;
    return win.devicePixelRatio || 1;
  }
  function roundByDPR(element, value) {
    const dpr = getDPR(element);
    return Math.round(value * dpr) / dpr;
  }
  function useLatestRef(value) {
    const ref = React.useRef(value);
    index(() => {
      ref.current = value;
    });
    return ref;
  }
  function useFloating(options) {
    if (options === void 0) {
      options = {};
    }
    const {
      placement = "bottom",
      strategy = "absolute",
      middleware = [],
      platform: platform2,
      elements: {
        reference: externalReference,
        floating: externalFloating
      } = {},
      transform = true,
      whileElementsMounted,
      open
    } = options;
    const [data, setData] = React.useState({
      x: 0,
      y: 0,
      strategy,
      placement,
      middlewareData: {},
      isPositioned: false
    });
    const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
    if (!deepEqual(latestMiddleware, middleware)) {
      setLatestMiddleware(middleware);
    }
    const [_reference, _setReference] = React.useState(null);
    const [_floating, _setFloating] = React.useState(null);
    const setReference = React.useCallback((node) => {
      if (node !== referenceRef.current) {
        referenceRef.current = node;
        _setReference(node);
      }
    }, []);
    const setFloating = React.useCallback((node) => {
      if (node !== floatingRef.current) {
        floatingRef.current = node;
        _setFloating(node);
      }
    }, []);
    const referenceEl = externalReference || _reference;
    const floatingEl = externalFloating || _floating;
    const referenceRef = React.useRef(null);
    const floatingRef = React.useRef(null);
    const dataRef = React.useRef(data);
    const hasWhileElementsMounted = whileElementsMounted != null;
    const whileElementsMountedRef = useLatestRef(whileElementsMounted);
    const platformRef = useLatestRef(platform2);
    const update = React.useCallback(() => {
      if (!referenceRef.current || !floatingRef.current) {
        return;
      }
      const config = {
        placement,
        strategy,
        middleware: latestMiddleware
      };
      if (platformRef.current) {
        config.platform = platformRef.current;
      }
      computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => {
        const fullData = {
          ...data2,
          isPositioned: true
        };
        if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
          dataRef.current = fullData;
          ReactDOM.flushSync(() => {
            setData(fullData);
          });
        }
      });
    }, [latestMiddleware, placement, strategy, platformRef]);
    index(() => {
      if (open === false && dataRef.current.isPositioned) {
        dataRef.current.isPositioned = false;
        setData((data2) => ({
          ...data2,
          isPositioned: false
        }));
      }
    }, [open]);
    const isMountedRef = React.useRef(false);
    index(() => {
      isMountedRef.current = true;
      return () => {
        isMountedRef.current = false;
      };
    }, []);
    index(() => {
      if (referenceEl) referenceRef.current = referenceEl;
      if (floatingEl) floatingRef.current = floatingEl;
      if (referenceEl && floatingEl) {
        if (whileElementsMountedRef.current) {
          return whileElementsMountedRef.current(referenceEl, floatingEl, update);
        }
        update();
      }
    }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
    const refs = React.useMemo(() => ({
      reference: referenceRef,
      floating: floatingRef,
      setReference,
      setFloating
    }), [setReference, setFloating]);
    const elements2 = React.useMemo(() => ({
      reference: referenceEl,
      floating: floatingEl
    }), [referenceEl, floatingEl]);
    const floatingStyles = React.useMemo(() => {
      const initialStyles = {
        position: strategy,
        left: 0,
        top: 0
      };
      if (!elements2.floating) {
        return initialStyles;
      }
      const x2 = roundByDPR(elements2.floating, data.x);
      const y3 = roundByDPR(elements2.floating, data.y);
      if (transform) {
        return {
          ...initialStyles,
          transform: "translate(" + x2 + "px, " + y3 + "px)",
          ...getDPR(elements2.floating) >= 1.5 && {
            willChange: "transform"
          }
        };
      }
      return {
        position: strategy,
        left: x2,
        top: y3
      };
    }, [strategy, transform, elements2.floating, data.x, data.y]);
    return React.useMemo(() => ({
      ...data,
      update,
      refs,
      elements: elements2,
      floatingStyles
    }), [data, update, refs, elements2, floatingStyles]);
  }

  // packages/editor/build-module/components/collab-sidebar/hooks.mjs
  var import_i18n216 = __toESM(require_i18n(), 1);
  var import_element169 = __toESM(require_element(), 1);
  var import_core_data118 = __toESM(require_core_data(), 1);
  var import_data221 = __toESM(require_data(), 1);
  var import_block_editor92 = __toESM(require_block_editor(), 1);
  var import_notices30 = __toESM(require_notices(), 1);
  var import_html_entities30 = __toESM(require_html_entities(), 1);
  var { useBlockElement, cleanEmptyObject: cleanEmptyObject4 } = unlock(import_block_editor92.privateApis);
  function useBlockComments(postId2) {
    const [commentLastUpdated, reflowComments] = (0, import_element169.useReducer)(
      () => Date.now(),
      0
    );
    const queryArgs = {
      post: postId2,
      type: "note",
      status: "all",
      per_page: -1
    };
    const { records: threads } = (0, import_core_data118.useEntityRecords)(
      "root",
      "comment",
      queryArgs,
      { enabled: !!postId2 && typeof postId2 === "number" }
    );
    const { getBlockAttributes: getBlockAttributes2 } = (0, import_data221.useSelect)(import_block_editor92.store);
    const { clientIds } = (0, import_data221.useSelect)((select5) => {
      const { getClientIdsWithDescendants: getClientIdsWithDescendants2 } = select5(import_block_editor92.store);
      return {
        clientIds: getClientIdsWithDescendants2()
      };
    }, []);
    const { resultComments, unresolvedSortedThreads } = (0, import_element169.useMemo)(() => {
      if (!threads || threads.length === 0) {
        return { resultComments: [], unresolvedSortedThreads: [] };
      }
      const blocksWithComments = clientIds.reduce((results, clientId) => {
        const commentId = getBlockAttributes2(clientId)?.metadata?.noteId;
        if (commentId) {
          results[clientId] = commentId;
        }
        return results;
      }, {});
      const compare = {};
      const result = [];
      const commentIdToBlockClientId = Object.keys(
        blocksWithComments
      ).reduce((mapping, clientId) => {
        mapping[blocksWithComments[clientId]] = clientId;
        return mapping;
      }, {});
      threads.forEach((item) => {
        const itemBlock = commentIdToBlockClientId[item.id];
        compare[item.id] = {
          ...item,
          reply: [],
          blockClientId: item.parent === 0 ? itemBlock : null
        };
      });
      threads.forEach((item) => {
        if (item.parent === 0) {
          result.push(compare[item.id]);
        } else if (compare[item.parent]) {
          compare[item.parent].reply.push(compare[item.id]);
        }
      });
      if (0 === result?.length) {
        return { resultComments: [], unresolvedSortedThreads: [] };
      }
      const updatedResult = result.map((item) => ({
        ...item,
        reply: [...item.reply].reverse()
      }));
      const threadIdMap = new Map(
        updatedResult.map((thread) => [String(thread.id), thread])
      );
      const mappedIds = new Set(
        Object.values(blocksWithComments).map((id) => String(id))
      );
      const unresolvedSortedComments = Object.values(blocksWithComments).map((commentId) => threadIdMap.get(String(commentId))).filter(
        (thread) => thread !== void 0 && thread.status === "hold"
      );
      const resolvedSortedComments = Object.values(blocksWithComments).map((commentId) => threadIdMap.get(String(commentId))).filter(
        (thread) => thread !== void 0 && thread.status === "approved"
      );
      const orphanedComments = updatedResult.filter(
        (thread) => !mappedIds.has(String(thread.id))
      );
      const allSortedComments = [
        ...unresolvedSortedComments,
        ...resolvedSortedComments,
        ...orphanedComments
      ];
      return {
        resultComments: allSortedComments,
        unresolvedSortedThreads: unresolvedSortedComments
      };
    }, [clientIds, threads, getBlockAttributes2]);
    return {
      resultComments,
      unresolvedSortedThreads,
      reflowComments,
      commentLastUpdated
    };
  }
  function useBlockCommentsActions(reflowComments = noop6) {
    const { createNotice } = (0, import_data221.useDispatch)(import_notices30.store);
    const { saveEntityRecord, deleteEntityRecord } = (0, import_data221.useDispatch)(import_core_data118.store);
    const { getCurrentPostId: getCurrentPostId2 } = (0, import_data221.useSelect)(store);
    const { getBlockAttributes: getBlockAttributes2, getSelectedBlockClientId: getSelectedBlockClientId2 } = (0, import_data221.useSelect)(import_block_editor92.store);
    const { updateBlockAttributes: updateBlockAttributes2 } = (0, import_data221.useDispatch)(import_block_editor92.store);
    const onError = (error) => {
      const errorMessage = error.message && error.code !== "unknown_error" ? (0, import_html_entities30.decodeEntities)(error.message) : (0, import_i18n216.__)("An error occurred while performing an update.");
      createNotice("error", errorMessage, {
        type: "snackbar",
        isDismissible: true
      });
    };
    const onCreate = async ({ content, parent }) => {
      try {
        const savedRecord = await saveEntityRecord(
          "root",
          "comment",
          {
            post: getCurrentPostId2(),
            content,
            status: "hold",
            type: "note",
            parent: parent || 0
          },
          { throwOnError: true }
        );
        if (!parent && savedRecord?.id) {
          const clientId = getSelectedBlockClientId2();
          const metadata = getBlockAttributes2(clientId)?.metadata;
          updateBlockAttributes2(clientId, {
            metadata: {
              ...metadata,
              noteId: savedRecord.id
            }
          });
        }
        createNotice(
          "snackbar",
          parent ? (0, import_i18n216.__)("Reply added.") : (0, import_i18n216.__)("Note added."),
          {
            type: "snackbar",
            isDismissible: true
          }
        );
        setTimeout(reflowComments, 300);
        return savedRecord;
      } catch (error) {
        reflowComments();
        onError(error);
      }
    };
    const onEdit = async ({ id, content, status }) => {
      const messageType = status ? status : "updated";
      const messages = {
        approved: (0, import_i18n216.__)("Note marked as resolved."),
        hold: (0, import_i18n216.__)("Note reopened."),
        updated: (0, import_i18n216.__)("Note updated.")
      };
      try {
        if (status === "approved" || status === "hold") {
          await saveEntityRecord(
            "root",
            "comment",
            {
              id,
              status
            },
            {
              throwOnError: true
            }
          );
          const newCommentData = {
            post: getCurrentPostId2(),
            content: content || "",
            // Empty content for resolve, content for reopen.
            type: "note",
            status,
            parent: id,
            meta: {
              _wp_note_status: status === "approved" ? "resolved" : "reopen"
            }
          };
          await saveEntityRecord("root", "comment", newCommentData, {
            throwOnError: true
          });
        } else {
          const updateData = {
            id,
            content,
            status
          };
          await saveEntityRecord("root", "comment", updateData, {
            throwOnError: true
          });
        }
        createNotice(
          "snackbar",
          messages[messageType] ?? (0, import_i18n216.__)("Note updated."),
          {
            type: "snackbar",
            isDismissible: true
          }
        );
        reflowComments();
      } catch (error) {
        reflowComments();
        onError(error);
      }
    };
    const onDelete = async (comment) => {
      try {
        await deleteEntityRecord(
          "root",
          "comment",
          comment.id,
          void 0,
          {
            throwOnError: true
          }
        );
        if (!comment.parent) {
          const clientId = getSelectedBlockClientId2();
          const metadata = getBlockAttributes2(clientId)?.metadata;
          updateBlockAttributes2(clientId, {
            metadata: cleanEmptyObject4({
              ...metadata,
              noteId: void 0
            })
          });
        }
        createNotice("snackbar", (0, import_i18n216.__)("Note deleted."), {
          type: "snackbar",
          isDismissible: true
        });
        reflowComments();
      } catch (error) {
        reflowComments();
        onError(error);
      }
    };
    return { onCreate, onEdit, onDelete };
  }
  function useEnableFloatingSidebar(enabled = false) {
    const registry = (0, import_data221.useRegistry)();
    (0, import_element169.useEffect)(() => {
      if (!enabled) {
        return;
      }
      const { getActiveComplementaryArea: getActiveComplementaryArea2 } = registry.select(store2);
      const { disableComplementaryArea: disableComplementaryArea2, enableComplementaryArea: enableComplementaryArea2 } = registry.dispatch(store2);
      const unsubscribe = registry.subscribe(() => {
        if (getActiveComplementaryArea2("core") === null) {
          enableComplementaryArea2("core", collabSidebarName);
        }
      });
      return () => {
        unsubscribe();
        if (getActiveComplementaryArea2("core") === collabSidebarName) {
          disableComplementaryArea2("core", collabSidebarName);
        }
      };
    }, [enabled, registry]);
  }
  function useFloatingThread({
    thread,
    calculatedOffset,
    setHeights,
    selectedThread,
    setBlockRef,
    commentLastUpdated
  }) {
    const blockElement = useBlockElement(thread.blockClientId);
    const updateHeight = (0, import_element169.useCallback)(
      (id, newHeight) => {
        setHeights((prev) => {
          if (prev[id] !== newHeight) {
            return { ...prev, [id]: newHeight };
          }
          return prev;
        });
      },
      [setHeights]
    );
    const { y: y3, refs } = useFloating({
      placement: "right-start",
      middleware: [
        offset2({
          crossAxis: calculatedOffset || -16
        })
      ],
      whileElementsMounted: autoUpdate
    });
    (0, import_element169.useEffect)(() => {
      if (blockElement) {
        refs.setReference(blockElement);
      }
    }, [blockElement, refs, commentLastUpdated]);
    (0, import_element169.useEffect)(() => {
      if (refs.floating?.current) {
        setBlockRef(thread.id, blockElement);
      }
    }, [blockElement, thread.id, refs.floating, setBlockRef]);
    (0, import_element169.useEffect)(() => {
      if (refs.floating?.current) {
        const newHeight = refs.floating.current.scrollHeight;
        updateHeight(thread.id, newHeight);
      }
    }, [
      thread.id,
      updateHeight,
      refs.floating,
      selectedThread,
      commentLastUpdated
    ]);
    return {
      y: y3,
      refs
    };
  }

  // packages/editor/build-module/components/collab-sidebar/add-comment.mjs
  var import_i18n217 = __toESM(require_i18n(), 1);
  var import_data222 = __toESM(require_data(), 1);
  var import_components206 = __toESM(require_components(), 1);
  var import_block_editor93 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime337 = __toESM(require_jsx_runtime(), 1);
  var { useBlockElement: useBlockElement2 } = unlock(import_block_editor93.privateApis);
  function AddComment({
    onSubmit,
    newNoteFormState,
    setNewNoteFormState,
    commentSidebarRef,
    reflowComments = noop6,
    isFloating = false,
    y: y3,
    refs
  }) {
    const { clientId } = (0, import_data222.useSelect)((select5) => {
      const { getSelectedBlockClientId: getSelectedBlockClientId2 } = select5(import_block_editor93.store);
      return {
        clientId: getSelectedBlockClientId2()
      };
    }, []);
    const blockElement = useBlockElement2(clientId);
    const { toggleBlockSpotlight } = unlock((0, import_data222.useDispatch)(import_block_editor93.store));
    const unselectThread = () => {
      setNewNoteFormState("closed");
      blockElement?.focus();
      toggleBlockSpotlight(clientId, false);
    };
    if (newNoteFormState !== "open" || !clientId) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
      import_components206.__experimentalVStack,
      {
        className: clsx_default(
          "editor-collab-sidebar-panel__thread is-selected",
          {
            "is-floating": isFloating
          }
        ),
        spacing: "3",
        tabIndex: 0,
        "aria-label": (0, import_i18n217.__)("New note"),
        role: "treeitem",
        ref: isFloating ? refs.setFloating : void 0,
        style: isFloating ? (
          // Delay showing the floating note box until a Y position is known to prevent blink.
          { top: y3, opacity: !y3 ? 0 : void 0 }
        ) : void 0,
        onBlur: (event) => {
          if (event.currentTarget.contains(event.relatedTarget)) {
            return;
          }
          toggleBlockSpotlight(clientId, false);
          setNewNoteFormState("closed");
        },
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(import_components206.__experimentalHStack, { alignment: "left", spacing: "3", children: /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(comment_author_info_default, {}) }),
          /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(
            comment_form_default,
            {
              onSubmit: async (inputComment) => {
                const { id } = await onSubmit({ content: inputComment });
                focusCommentThread(id, commentSidebarRef.current);
                setNewNoteFormState("creating");
              },
              onCancel: unselectThread,
              reflowComments,
              submitButtonText: (0, import_i18n217.__)("Add note"),
              labelText: (0, import_i18n217.__)("New note")
            }
          )
        ]
      }
    );
  }

  // packages/editor/build-module/components/collab-sidebar/comments.mjs
  var import_jsx_runtime338 = __toESM(require_jsx_runtime(), 1);
  var { useBlockElement: useBlockElement3 } = unlock(import_block_editor94.privateApis);
  var { Menu: Menu6 } = unlock(import_components207.privateApis);
  function Comments({
    threads: noteThreads,
    onEditComment,
    onAddReply,
    onCommentDelete,
    newNoteFormState,
    setNewNoteFormState,
    commentSidebarRef,
    reflowComments,
    isFloating = false,
    commentLastUpdated
  }) {
    const [heights, setHeights] = (0, import_element170.useState)({});
    const [selectedThread, setSelectedThread] = (0, import_element170.useState)(null);
    const [boardOffsets, setBoardOffsets] = (0, import_element170.useState)({});
    const [blockRefs, setBlockRefs] = (0, import_element170.useState)({});
    const { setCanvasMinHeight: setCanvasMinHeight2 } = unlock((0, import_data223.useDispatch)(store));
    const { selectBlock: selectBlock2, toggleBlockSpotlight } = unlock(
      (0, import_data223.useDispatch)(import_block_editor94.store)
    );
    const { blockCommentId, selectedBlockClientId, orderedBlockIds } = (0, import_data223.useSelect)((select5) => {
      const {
        getBlockAttributes: getBlockAttributes2,
        getSelectedBlockClientId: getSelectedBlockClientId2,
        getClientIdsWithDescendants: getClientIdsWithDescendants2
      } = select5(import_block_editor94.store);
      const clientId = getSelectedBlockClientId2();
      return {
        blockCommentId: clientId ? getBlockAttributes2(clientId)?.metadata?.noteId : null,
        selectedBlockClientId: clientId,
        orderedBlockIds: getClientIdsWithDescendants2()
      };
    }, []);
    const relatedBlockElement = useBlockElement3(selectedBlockClientId);
    const threads = (0, import_element170.useMemo)(() => {
      const t4 = [...noteThreads];
      const orderedThreads = [];
      if (isFloating && newNoteFormState === "open") {
        const newNoteThread = {
          id: "new-note-thread",
          blockClientId: selectedBlockClientId,
          content: { rendered: "" }
        };
        orderedBlockIds.forEach((blockId) => {
          if (blockId === selectedBlockClientId) {
            orderedThreads.push(newNoteThread);
          } else {
            const threadForBlock = t4.find(
              (thread) => thread.blockClientId === blockId
            );
            if (threadForBlock) {
              orderedThreads.push(threadForBlock);
            }
          }
        });
        return orderedThreads;
      }
      return t4;
    }, [
      noteThreads,
      isFloating,
      newNoteFormState,
      selectedBlockClientId,
      orderedBlockIds
    ]);
    const handleDelete = async (comment) => {
      const currentIndex = threads.findIndex((t4) => t4.id === comment.id);
      const nextThread = threads[currentIndex + 1];
      const prevThread = threads[currentIndex - 1];
      await onCommentDelete(comment);
      if (comment.parent !== 0) {
        setSelectedThread(comment.parent);
        focusCommentThread(comment.parent, commentSidebarRef.current);
        return;
      }
      if (nextThread) {
        setSelectedThread(nextThread.id);
        focusCommentThread(nextThread.id, commentSidebarRef.current);
      } else if (prevThread) {
        setSelectedThread(prevThread.id);
        focusCommentThread(prevThread.id, commentSidebarRef.current);
      } else {
        setSelectedThread(null);
        setNewNoteFormState("closed");
        relatedBlockElement?.focus();
      }
    };
    (0, import_element170.useEffect)(() => {
      setSelectedThread(
        newNoteFormState === "open" ? "new-note-thread" : blockCommentId
      );
    }, [blockCommentId, newNoteFormState]);
    const setBlockRef = (0, import_element170.useCallback)((id, blockRef) => {
      setBlockRefs((prev) => ({ ...prev, [id]: blockRef }));
    }, []);
    (0, import_element170.useEffect)(() => {
      const calculateAllOffsets = () => {
        const offsets = {};
        if (!isFloating) {
          return { offsets, minHeight: 0 };
        }
        const selectedThreadIndex = threads.findIndex(
          (t4) => t4.id === selectedThread
        );
        const breakIndex = selectedThreadIndex === -1 ? 0 : selectedThreadIndex;
        const selectedThreadData = threads[breakIndex];
        if (!selectedThreadData || !blockRefs[selectedThreadData.id]) {
          return { offsets, minHeight: 0 };
        }
        let blockElement = blockRefs[selectedThreadData.id];
        let blockRect = blockElement?.getBoundingClientRect();
        const selectedThreadTop = blockRect?.top || 0;
        const selectedThreadHeight = heights[selectedThreadData.id] || 0;
        offsets[selectedThreadData.id] = -16;
        let previousThreadData = {
          threadTop: selectedThreadTop - 16,
          threadHeight: selectedThreadHeight
        };
        for (let i3 = breakIndex + 1; i3 < threads.length; i3++) {
          const thread = threads[i3];
          if (!blockRefs[thread.id]) {
            continue;
          }
          blockElement = blockRefs[thread.id];
          blockRect = blockElement?.getBoundingClientRect();
          const threadTop = blockRect?.top || 0;
          const threadHeight = heights[thread.id] || 0;
          let additionalOffset = -16;
          const previousBottom = previousThreadData.threadTop + previousThreadData.threadHeight;
          if (threadTop < previousBottom + 16) {
            additionalOffset = previousBottom - threadTop + 20;
          }
          offsets[thread.id] = additionalOffset;
          previousThreadData = {
            threadTop: threadTop + additionalOffset,
            threadHeight
          };
        }
        let nextThreadData = {
          threadTop: selectedThreadTop - 16
        };
        for (let i3 = selectedThreadIndex - 1; i3 >= 0; i3--) {
          const thread = threads[i3];
          if (!blockRefs[thread.id]) {
            continue;
          }
          blockElement = blockRefs[thread.id];
          blockRect = blockElement?.getBoundingClientRect();
          const threadTop = blockRect?.top || 0;
          const threadHeight = heights[thread.id] || 0;
          let additionalOffset = -16;
          const threadBottom = threadTop + threadHeight;
          if (threadBottom > nextThreadData.threadTop) {
            additionalOffset = nextThreadData.threadTop - threadTop - threadHeight - 20;
          }
          offsets[thread.id] = additionalOffset;
          nextThreadData = {
            threadTop: threadTop + additionalOffset
          };
        }
        let editorMinHeight = 0;
        const lastThread = threads[threads.length - 1];
        if (blockRefs[lastThread.id]) {
          const lastBlockElement = blockRefs[lastThread.id];
          const lastBlockRect = lastBlockElement?.getBoundingClientRect();
          const lastThreadTop = lastBlockRect?.top || 0;
          const lastThreadHeight = heights[lastThread.id] || 0;
          const lastThreadOffset = offsets[lastThread.id] || 0;
          editorMinHeight = lastThreadTop + lastThreadHeight + lastThreadOffset + 32;
        }
        return { offsets, minHeight: editorMinHeight };
      };
      const { offsets: newOffsets, minHeight } = calculateAllOffsets();
      if (Object.keys(newOffsets).length > 0) {
        setBoardOffsets(newOffsets);
      }
      setCanvasMinHeight2(minHeight);
    }, [
      heights,
      blockRefs,
      isFloating,
      threads,
      selectedThread,
      setCanvasMinHeight2
    ]);
    const handleThreadNavigation = (event, thread, isSelected) => {
      if (event.defaultPrevented) {
        return;
      }
      const currentIndex = threads.findIndex((t4) => t4.id === thread.id);
      if ((event.key === "Enter" || event.key === "ArrowRight") && event.currentTarget === event.target && !isSelected) {
        setNewNoteFormState("closed");
        setSelectedThread(thread.id);
        if (!!thread.blockClientId) {
          selectBlock2(thread.blockClientId, null);
          toggleBlockSpotlight(thread.blockClientId, true);
        }
      } else if ((event.key === "Enter" || event.key === "ArrowLeft") && event.currentTarget === event.target && isSelected || event.key === "Escape") {
        setSelectedThread(null);
        setNewNoteFormState("closed");
        if (thread.blockClientId) {
          toggleBlockSpotlight(thread.blockClientId, false);
        }
        focusCommentThread(thread.id, commentSidebarRef.current);
      } else if (event.key === "ArrowDown" && currentIndex < threads.length - 1 && event.currentTarget === event.target) {
        const nextThread = threads[currentIndex + 1];
        focusCommentThread(nextThread.id, commentSidebarRef.current);
      } else if (event.key === "ArrowUp" && currentIndex > 0 && event.currentTarget === event.target) {
        const prevThread = threads[currentIndex - 1];
        focusCommentThread(prevThread.id, commentSidebarRef.current);
      } else if (event.key === "Home" && event.currentTarget === event.target) {
        focusCommentThread(threads[0].id, commentSidebarRef.current);
      } else if (event.key === "End" && event.currentTarget === event.target) {
        focusCommentThread(
          threads[threads.length - 1].id,
          commentSidebarRef.current
        );
      }
    };
    const hasThreads = Array.isArray(threads) && threads.length > 0;
    if (!hasThreads && !isFloating) {
      return /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
        AddComment,
        {
          onSubmit: onAddReply,
          newNoteFormState,
          setNewNoteFormState,
          commentSidebarRef
        }
      );
    }
    return /* @__PURE__ */ (0, import_jsx_runtime338.jsxs)(import_jsx_runtime338.Fragment, { children: [
      !isFloating && newNoteFormState === "open" && /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
        AddComment,
        {
          onSubmit: onAddReply,
          newNoteFormState,
          setNewNoteFormState,
          commentSidebarRef
        }
      ),
      threads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
        Thread,
        {
          thread,
          onAddReply,
          onCommentDelete: handleDelete,
          onEditComment,
          isSelected: selectedThread === thread.id,
          setSelectedThread,
          setNewNoteFormState,
          commentSidebarRef,
          reflowComments,
          isFloating,
          calculatedOffset: boardOffsets[thread.id] ?? 0,
          setHeights,
          setBlockRef,
          selectedThread,
          commentLastUpdated,
          newNoteFormState,
          onKeyDown: (event) => handleThreadNavigation(
            event,
            thread,
            selectedThread === thread.id
          )
        },
        thread.id
      ))
    ] });
  }
  function Thread({
    thread,
    onEditComment,
    onAddReply,
    onCommentDelete,
    isSelected,
    setNewNoteFormState,
    commentSidebarRef,
    reflowComments,
    isFloating,
    calculatedOffset,
    setHeights,
    setBlockRef,
    setSelectedThread,
    selectedThread,
    commentLastUpdated,
    newNoteFormState,
    onKeyDown
  }) {
    const { toggleBlockHighlight, selectBlock: selectBlock2, toggleBlockSpotlight } = unlock(
      (0, import_data223.useDispatch)(import_block_editor94.store)
    );
    const relatedBlockElement = useBlockElement3(thread.blockClientId);
    const debouncedToggleBlockHighlight = (0, import_compose60.useDebounce)(
      toggleBlockHighlight,
      50
    );
    const { y: y3, refs } = useFloatingThread({
      thread,
      calculatedOffset,
      setHeights,
      setBlockRef,
      selectedThread,
      commentLastUpdated
    });
    const isKeyboardTabbingRef = (0, import_element170.useRef)(false);
    const onMouseEnter = () => {
      debouncedToggleBlockHighlight(thread.blockClientId, true);
    };
    const onMouseLeave = () => {
      debouncedToggleBlockHighlight(thread.blockClientId, false);
    };
    const onFocus = () => {
      toggleBlockHighlight(thread.blockClientId, true);
    };
    const onBlur = (event) => {
      const isNoteFocused = event.relatedTarget?.closest(
        ".editor-collab-sidebar-panel__thread"
      );
      const isDialogFocused = event.relatedTarget?.closest('[role="dialog"]');
      const isTabbing = isKeyboardTabbingRef.current;
      if (isNoteFocused && !isTabbing) {
        return;
      }
      if (isDialogFocused) {
        return;
      }
      if (isTabbing && event.currentTarget.contains(event.relatedTarget)) {
        return;
      }
      toggleBlockHighlight(thread.blockClientId, false);
      unselectThread();
    };
    const handleCommentSelect = () => {
      setNewNoteFormState("closed");
      setSelectedThread(thread.id);
      toggleBlockSpotlight(thread.blockClientId, true);
      if (!!thread.blockClientId) {
        selectBlock2(thread.blockClientId, null);
      }
    };
    const unselectThread = () => {
      setSelectedThread(null);
      setNewNoteFormState("closed");
      toggleBlockSpotlight(thread.blockClientId, false);
    };
    const allReplies = thread?.reply || [];
    const lastReply = allReplies.length > 0 ? allReplies[allReplies.length - 1] : void 0;
    const restReplies = allReplies.length > 0 ? allReplies.slice(0, -1) : [];
    const commentExcerpt = getCommentExcerpt(
      (0, import_dom8.__unstableStripHTML)(thread.content?.rendered),
      10
    );
    const ariaLabel = !!thread.blockClientId ? (0, import_i18n218.sprintf)(
      // translators: %s: note excerpt
      (0, import_i18n218.__)("Note: %s"),
      commentExcerpt
    ) : (0, import_i18n218.sprintf)(
      // translators: %s: note excerpt
      (0, import_i18n218.__)("Original block deleted. Note: %s"),
      commentExcerpt
    );
    if (thread.id === "new-note-thread" && newNoteFormState === "open" && isFloating) {
      return /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
        AddComment,
        {
          onSubmit: onAddReply,
          newNoteFormState,
          setNewNoteFormState,
          commentSidebarRef,
          reflowComments,
          isFloating,
          y: y3,
          refs
        }
      );
    }
    return /* @__PURE__ */ (0, import_jsx_runtime338.jsxs)(
      import_components207.__experimentalVStack,
      {
        className: clsx_default("editor-collab-sidebar-panel__thread", {
          "is-selected": isSelected,
          "is-floating": isFloating
        }),
        id: `comment-thread-${thread.id}`,
        spacing: "3",
        onClick: handleCommentSelect,
        onMouseEnter,
        onMouseLeave,
        onFocus,
        onBlur,
        onKeyUp: (event) => {
          if (event.key === "Tab") {
            isKeyboardTabbingRef.current = false;
          }
        },
        onKeyDown: (event) => {
          if (event.key === "Tab") {
            isKeyboardTabbingRef.current = true;
          } else {
            onKeyDown(event);
          }
        },
        tabIndex: 0,
        role: "treeitem",
        "aria-label": ariaLabel,
        "aria-expanded": isSelected,
        ref: isFloating ? refs.setFloating : void 0,
        style: isFloating ? { top: y3 } : void 0,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
            import_components207.Button,
            {
              className: "editor-collab-sidebar-panel__skip-to-comment",
              variant: "secondary",
              size: "compact",
              onClick: () => {
                focusCommentThread(
                  thread.id,
                  commentSidebarRef.current,
                  "textarea"
                );
              },
              children: (0, import_i18n218.__)("Add new reply")
            }
          ),
          !thread.blockClientId && /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(import_components207.__experimentalText, { as: "p", weight: 500, variant: "muted", children: (0, import_i18n218.__)("Original block deleted.") }),
          /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
            CommentBoard,
            {
              thread,
              isExpanded: isSelected,
              onEdit: (params = {}) => {
                onEditComment(params);
                if (params.status === "approved") {
                  unselectThread();
                  if (isFloating) {
                    relatedBlockElement?.focus();
                  } else {
                    focusCommentThread(
                      thread.id,
                      commentSidebarRef.current
                    );
                  }
                }
              },
              onDelete: onCommentDelete,
              reflowComments
            }
          ),
          isSelected && allReplies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
            CommentBoard,
            {
              thread: reply,
              parent: thread,
              isExpanded: isSelected,
              onEdit: onEditComment,
              onDelete: onCommentDelete,
              reflowComments
            },
            reply.id
          )),
          !isSelected && restReplies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(import_components207.__experimentalHStack, { className: "editor-collab-sidebar-panel__more-reply-separator", children: /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
            import_components207.Button,
            {
              size: "compact",
              variant: "tertiary",
              className: "editor-collab-sidebar-panel__more-reply-button",
              onClick: () => {
                setSelectedThread(thread.id);
                focusCommentThread(
                  thread.id,
                  commentSidebarRef.current
                );
              },
              children: (0, import_i18n218.sprintf)(
                // translators: %s: number of replies.
                (0, import_i18n218._n)(
                  "%s more reply",
                  "%s more replies",
                  restReplies.length
                ),
                restReplies.length
              )
            }
          ) }),
          !isSelected && lastReply && /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
            CommentBoard,
            {
              thread: lastReply,
              parent: thread,
              isExpanded: isSelected,
              onEdit: onEditComment,
              onDelete: onCommentDelete,
              reflowComments
            }
          ),
          isSelected && /* @__PURE__ */ (0, import_jsx_runtime338.jsxs)(import_components207.__experimentalVStack, { spacing: "2", role: "treeitem", children: [
            /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(import_components207.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(comment_author_info_default, {}) }),
            /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(import_components207.__experimentalVStack, { spacing: "2", children: /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
              comment_form_default,
              {
                onSubmit: (inputComment) => {
                  if ("approved" === thread.status) {
                    onEditComment({
                      id: thread.id,
                      status: "hold",
                      content: inputComment
                    });
                  } else {
                    onAddReply({
                      content: inputComment,
                      parent: thread.id
                    });
                  }
                },
                onCancel: (event) => {
                  event.stopPropagation();
                  unselectThread();
                  focusCommentThread(
                    thread.id,
                    commentSidebarRef.current
                  );
                },
                submitButtonText: "approved" === thread.status ? (0, import_i18n218.__)("Reopen & Reply") : (0, import_i18n218.__)("Reply"),
                rows: "approved" === thread.status ? 2 : 4,
                labelText: (0, import_i18n218.sprintf)(
                  // translators: %1$s: note identifier, %2$s: author name
                  (0, import_i18n218.__)("Reply to note %1$s by %2$s"),
                  thread.id,
                  thread.author_name
                ),
                reflowComments
              }
            ) })
          ] }),
          !!thread.blockClientId && /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
            import_components207.Button,
            {
              className: "editor-collab-sidebar-panel__skip-to-block",
              variant: "secondary",
              size: "compact",
              onClick: (event) => {
                event.stopPropagation();
                relatedBlockElement?.focus();
              },
              children: (0, import_i18n218.__)("Back to block")
            }
          )
        ]
      }
    );
  }
  var CommentBoard = ({
    thread,
    parent,
    isExpanded,
    onEdit,
    onDelete,
    reflowComments
  }) => {
    const [actionState, setActionState] = (0, import_element170.useState)(false);
    const [showConfirmDialog, setShowConfirmDialog] = (0, import_element170.useState)(false);
    const actionButtonRef = (0, import_element170.useRef)(null);
    const handleConfirmDelete = () => {
      onDelete(thread);
      setActionState(false);
      setShowConfirmDialog(false);
    };
    const handleCancel = () => {
      setActionState(false);
      setShowConfirmDialog(false);
      actionButtonRef.current?.focus();
    };
    const isResolutionComment = thread.type === "note" && thread.meta && (thread.meta._wp_note_status === "resolved" || thread.meta._wp_note_status === "reopen");
    const actions2 = [
      {
        id: "edit",
        title: (0, import_i18n218.__)("Edit"),
        isEligible: ({ status }) => status !== "approved",
        onClick: () => {
          setActionState("edit");
        }
      },
      {
        id: "reopen",
        title: (0, import_i18n218._x)("Reopen", "Reopen note"),
        isEligible: ({ status }) => status === "approved",
        onClick: () => {
          onEdit({ id: thread.id, status: "hold" });
        }
      },
      {
        id: "delete",
        title: (0, import_i18n218.__)("Delete"),
        isEligible: () => true,
        onClick: () => {
          setActionState("delete");
          setShowConfirmDialog(true);
        }
      }
    ];
    const canResolve = thread.parent === 0;
    const moreActions = parent?.status !== "approved" ? actions2.filter((item) => item.isEligible(thread)) : [];
    const deleteConfirmMessage = (
      // When deleting a top level note, descendants will also be deleted.
      thread.parent === 0 ? (0, import_i18n218.__)(
        "Are you sure you want to delete this note? This will also delete all of this note's replies."
      ) : (0, import_i18n218.__)("Are you sure you want to delete this reply?")
    );
    return /* @__PURE__ */ (0, import_jsx_runtime338.jsxs)(
      import_components207.__experimentalVStack,
      {
        spacing: "2",
        role: thread.parent !== 0 ? "treeitem" : void 0,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime338.jsxs)(import_components207.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: [
            /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
              comment_author_info_default,
              {
                avatar: thread?.author_avatar_urls?.[48],
                name: thread?.author_name,
                date: thread?.date,
                userId: thread?.author
              }
            ),
            isExpanded && /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
              import_components207.FlexItem,
              {
                className: "editor-collab-sidebar-panel__comment-status",
                onClick: (event) => {
                  event.stopPropagation();
                },
                children: /* @__PURE__ */ (0, import_jsx_runtime338.jsxs)(import_components207.__experimentalHStack, { spacing: "0", children: [
                  canResolve && /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
                    import_components207.Button,
                    {
                      label: (0, import_i18n218._x)(
                        "Resolve",
                        "Mark note as resolved"
                      ),
                      size: "small",
                      icon: published_default,
                      disabled: thread.status === "approved",
                      accessibleWhenDisabled: thread.status === "approved",
                      onClick: () => {
                        onEdit({
                          id: thread.id,
                          status: "approved"
                        });
                      }
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime338.jsxs)(Menu6, { placement: "bottom-end", children: [
                    /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
                      Menu6.TriggerButton,
                      {
                        render: /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
                          import_components207.Button,
                          {
                            ref: actionButtonRef,
                            size: "small",
                            icon: more_vertical_default,
                            label: (0, import_i18n218.__)("Actions"),
                            disabled: !moreActions.length,
                            accessibleWhenDisabled: true
                          }
                        )
                      }
                    ),
                    /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
                      Menu6.Popover,
                      {
                        modal: false,
                        children: moreActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
                          Menu6.Item,
                          {
                            onClick: () => action.onClick(),
                            children: /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(Menu6.ItemLabel, { children: action.title })
                          },
                          action.id
                        ))
                      }
                    )
                  ] })
                ] })
              }
            )
          ] }),
          "edit" === actionState ? /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
            comment_form_default,
            {
              onSubmit: (value) => {
                onEdit({
                  id: thread.id,
                  content: value
                });
                setActionState(false);
                actionButtonRef.current?.focus();
              },
              onCancel: () => handleCancel(),
              thread,
              submitButtonText: (0, import_i18n218._x)("Update", "verb"),
              labelText: (0, import_i18n218.sprintf)(
                // translators: %1$s: note identifier, %2$s: author name.
                (0, import_i18n218.__)("Edit note %1$s by %2$s"),
                thread.id,
                thread.author_name
              ),
              reflowComments
            }
          ) : /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
            import_element170.RawHTML,
            {
              className: clsx_default(
                "editor-collab-sidebar-panel__user-comment",
                {
                  "editor-collab-sidebar-panel__resolution-text": isResolutionComment
                }
              ),
              children: isResolutionComment ? (() => {
                const actionText = thread.meta._wp_note_status === "resolved" ? (0, import_i18n218.__)("Marked as resolved") : (0, import_i18n218.__)("Reopened");
                const content = thread?.content?.raw;
                if (content && typeof content === "string" && content.trim() !== "") {
                  return (0, import_i18n218.sprintf)(
                    // translators: %1$s: action label ("Marked as resolved" or "Reopened"); %2$s: note text.
                    (0, import_i18n218.__)("%1$s: %2$s"),
                    actionText,
                    content
                  );
                }
                return actionText;
              })() : thread?.content?.rendered
            }
          ),
          "delete" === actionState && /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
            import_components207.__experimentalConfirmDialog,
            {
              isOpen: showConfirmDialog,
              onConfirm: handleConfirmDelete,
              onCancel: handleCancel,
              confirmButtonText: (0, import_i18n218.__)("Delete"),
              children: deleteConfirmMessage
            }
          )
        ]
      }
    );
  };

  // packages/editor/build-module/components/collab-sidebar/comment-menu-item.mjs
  var import_components208 = __toESM(require_components(), 1);
  var import_i18n219 = __toESM(require_i18n(), 1);
  var import_block_editor95 = __toESM(require_block_editor(), 1);
  var import_data224 = __toESM(require_data(), 1);
  var import_blocks36 = __toESM(require_blocks(), 1);
  var import_jsx_runtime339 = __toESM(require_jsx_runtime(), 1);
  var { CommentIconSlotFill } = unlock(import_block_editor95.privateApis);
  var AddCommentMenuItem = ({ clientId, onClick, isDistractionFree }) => {
    const block = (0, import_data224.useSelect)(
      (select5) => {
        return select5(import_block_editor95.store).getBlock(clientId);
      },
      [clientId]
    );
    if (!block?.isValid || block?.name === (0, import_blocks36.getUnregisteredTypeHandlerName)()) {
      return null;
    }
    const isDisabled = isDistractionFree || block?.name === "core/freeform";
    let infoText;
    if (isDistractionFree) {
      infoText = (0, import_i18n219.__)("Notes are disabled in distraction free mode.");
    } else if (block?.name === "core/freeform") {
      infoText = (0, import_i18n219.__)("Convert to blocks to add notes.");
    }
    return /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
      import_components208.MenuItem,
      {
        icon: comment_default,
        onClick,
        "aria-haspopup": "dialog",
        disabled: isDisabled,
        info: infoText,
        children: (0, import_i18n219.__)("Add note")
      }
    );
  };
  var AddCommentMenuItemFill = ({ onClick, isDistractionFree }) => {
    return /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(CommentIconSlotFill.Fill, { children: ({ clientId, onClose }) => /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
      AddCommentMenuItem,
      {
        clientId,
        isDistractionFree,
        onClick: () => {
          onClick();
          onClose();
        }
      }
    ) });
  };
  var comment_menu_item_default = AddCommentMenuItemFill;

  // packages/editor/build-module/components/collab-sidebar/comment-indicator-toolbar.mjs
  var import_components209 = __toESM(require_components(), 1);
  var import_i18n220 = __toESM(require_i18n(), 1);
  var import_element171 = __toESM(require_element(), 1);
  var import_block_editor96 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime340 = __toESM(require_jsx_runtime(), 1);
  var { CommentIconToolbarSlotFill } = unlock(import_block_editor96.privateApis);
  var CommentAvatarIndicator = ({ onClick, thread }) => {
    const threadParticipants = (0, import_element171.useMemo)(() => {
      if (!thread) {
        return [];
      }
      const participantsMap = /* @__PURE__ */ new Map();
      const allComments = [thread, ...thread.reply];
      allComments.sort((a3, b3) => new Date(a3.date) - new Date(b3.date));
      allComments.forEach((comment) => {
        if (comment.author_name && comment.author_avatar_urls) {
          if (!participantsMap.has(comment.author)) {
            participantsMap.set(comment.author, {
              name: comment.author_name,
              avatar: comment.author_avatar_urls?.["48"] || comment.author_avatar_urls?.["96"],
              id: comment.author,
              date: comment.date
            });
          }
        }
      });
      return Array.from(participantsMap.values());
    }, [thread]);
    if (!threadParticipants.length) {
      return null;
    }
    const maxAvatars = 3;
    const isOverflow = threadParticipants.length > maxAvatars;
    const visibleParticipants = isOverflow ? threadParticipants.slice(0, maxAvatars - 1) : threadParticipants;
    const overflowCount = Math.max(
      0,
      threadParticipants.length - visibleParticipants.length
    );
    const threadHasMoreParticipants = threadParticipants.length > 100;
    const overflowText = threadHasMoreParticipants && overflowCount > 0 ? (0, import_i18n220.__)("100+") : (0, import_i18n220.sprintf)(
      // translators: %s: Number of participants.
      (0, import_i18n220.__)("+%s"),
      overflowCount
    );
    return /* @__PURE__ */ (0, import_jsx_runtime340.jsx)(CommentIconToolbarSlotFill.Fill, { children: /* @__PURE__ */ (0, import_jsx_runtime340.jsx)(
      import_components209.ToolbarButton,
      {
        className: "comment-avatar-indicator",
        label: (0, import_i18n220.__)("View notes"),
        onClick,
        showTooltip: true,
        children: /* @__PURE__ */ (0, import_jsx_runtime340.jsxs)(import_components209.__experimentalHStack, { spacing: "1", children: [
          visibleParticipants.map((participant) => /* @__PURE__ */ (0, import_jsx_runtime340.jsx)(
            "img",
            {
              src: participant.avatar,
              alt: participant.name,
              className: "comment-avatar",
              style: {
                borderColor: getAvatarBorderColor(
                  participant.id
                )
              }
            },
            participant.id
          )),
          overflowCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime340.jsx)(import_components209.__experimentalText, { weight: 500, children: overflowText })
        ] })
      }
    ) });
  };
  var comment_indicator_toolbar_default = CommentAvatarIndicator;

  // packages/editor/build-module/components/collab-sidebar/index.mjs
  var import_jsx_runtime341 = __toESM(require_jsx_runtime(), 1);
  function NotesSidebarContent({
    newNoteFormState,
    setNewNoteFormState,
    styles,
    comments,
    commentSidebarRef,
    reflowComments,
    commentLastUpdated,
    isFloating = false
  }) {
    const { onCreate, onEdit, onDelete } = useBlockCommentsActions(reflowComments);
    return /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(
      import_components210.__experimentalVStack,
      {
        className: "editor-collab-sidebar-panel",
        style: styles,
        role: "tree",
        spacing: "3",
        justify: "flex-start",
        ref: (node) => {
          if (node) {
            commentSidebarRef.current = node;
          }
        },
        "aria-label": isFloating ? (0, import_i18n221.__)("Unresolved notes") : (0, import_i18n221.__)("All notes"),
        children: /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(
          Comments,
          {
            threads: comments,
            onEditComment: onEdit,
            onAddReply: onCreate,
            onCommentDelete: onDelete,
            newNoteFormState,
            setNewNoteFormState,
            commentSidebarRef,
            reflowComments,
            commentLastUpdated,
            isFloating
          }
        )
      }
    );
  }
  function NotesSidebar({ postId: postId2 }) {
    const [newNoteFormState, setNewNoteFormState] = (0, import_element172.useState)("closed");
    const { getActiveComplementaryArea: getActiveComplementaryArea2 } = (0, import_data225.useSelect)(store2);
    const { enableComplementaryArea: enableComplementaryArea2 } = (0, import_data225.useDispatch)(store2);
    const { toggleBlockSpotlight } = unlock((0, import_data225.useDispatch)(import_block_editor97.store));
    const isLargeViewport = (0, import_compose61.useViewportMatch)("medium");
    const commentSidebarRef = (0, import_element172.useRef)(null);
    const showFloatingSidebar = isLargeViewport;
    const { clientId, blockCommentId, isDistractionFree } = (0, import_data225.useSelect)(
      (select5) => {
        const {
          getBlockAttributes: getBlockAttributes2,
          getSelectedBlockClientId: getSelectedBlockClientId2,
          getSettings: getSettings5
        } = select5(import_block_editor97.store);
        const _clientId = getSelectedBlockClientId2();
        return {
          clientId: _clientId,
          blockCommentId: _clientId ? getBlockAttributes2(_clientId)?.metadata?.noteId : null,
          isDistractionFree: getSettings5().isDistractionFree
        };
      },
      []
    );
    const {
      resultComments,
      unresolvedSortedThreads,
      reflowComments,
      commentLastUpdated
    } = useBlockComments(postId2);
    useEnableFloatingSidebar(
      showFloatingSidebar && (unresolvedSortedThreads.length > 0 || newNoteFormState !== "closed")
    );
    const { merged: GlobalStyles } = useGlobalStylesContext();
    const backgroundColor = GlobalStyles?.styles?.color?.background;
    const currentThread = blockCommentId ? resultComments.find((thread) => thread.id === blockCommentId) : null;
    const showAllNotesSidebar = resultComments.length > 0;
    async function openTheSidebar() {
      const prevArea = await getActiveComplementaryArea2("core");
      const activeNotesArea = SIDEBARS.find((name2) => name2 === prevArea);
      if (currentThread?.status === "approved") {
        enableComplementaryArea2("core", collabHistorySidebarName);
      } else if (!activeNotesArea || !showAllNotesSidebar) {
        enableComplementaryArea2(
          "core",
          showFloatingSidebar ? collabSidebarName : collabHistorySidebarName
        );
      }
      const currentArea = await getActiveComplementaryArea2("core");
      if (!SIDEBARS.includes(currentArea)) {
        return;
      }
      setNewNoteFormState(!currentThread ? "open" : "closed");
      focusCommentThread(
        currentThread?.id,
        commentSidebarRef.current,
        // Focus a comment thread when there's a selected block with a comment.
        !currentThread ? "textarea" : void 0
      );
      toggleBlockSpotlight(clientId, true);
    }
    if (isDistractionFree) {
      return /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(comment_menu_item_default, { isDistractionFree: true });
    }
    return /* @__PURE__ */ (0, import_jsx_runtime341.jsxs)(import_jsx_runtime341.Fragment, { children: [
      !!currentThread && /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(
        comment_indicator_toolbar_default,
        {
          thread: currentThread,
          onClick: openTheSidebar
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(comment_menu_item_default, { onClick: openTheSidebar }),
      showAllNotesSidebar && /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(
        PluginSidebar,
        {
          identifier: collabHistorySidebarName,
          name: collabHistorySidebarName,
          title: (0, import_i18n221.__)("All notes"),
          header: /* @__PURE__ */ (0, import_jsx_runtime341.jsx)("h2", { className: "interface-complementary-area-header__title", children: (0, import_i18n221.__)("All notes") }),
          icon: comment_default,
          closeLabel: (0, import_i18n221.__)("Close Notes"),
          children: /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(
            NotesSidebarContent,
            {
              comments: resultComments,
              newNoteFormState,
              setNewNoteFormState,
              commentSidebarRef,
              reflowComments,
              commentLastUpdated
            }
          )
        }
      ),
      isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(
        PluginSidebar,
        {
          isPinnable: false,
          header: false,
          identifier: collabSidebarName,
          className: "editor-collab-sidebar",
          headerClassName: "editor-collab-sidebar__header",
          backgroundColor,
          children: /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(
            NotesSidebarContent,
            {
              comments: unresolvedSortedThreads,
              newNoteFormState,
              setNewNoteFormState,
              commentSidebarRef,
              reflowComments,
              commentLastUpdated,
              styles: {
                backgroundColor
              },
              isFloating: true
            }
          )
        }
      )
    ] });
  }
  function NotesSidebarContainer() {
    const { postId: postId2, editorMode } = (0, import_data225.useSelect)((select5) => {
      const { getCurrentPostId: getCurrentPostId2, getEditorMode: getEditorMode2 } = select5(store);
      return {
        postId: getCurrentPostId2(),
        editorMode: getEditorMode2()
      };
    }, []);
    if (!postId2 || typeof postId2 !== "number") {
      return null;
    }
    if (editorMode === "text") {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(post_type_support_check_default, { supportKeys: "editor.notes", children: /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(NotesSidebar, { postId: postId2 }) });
  }

  // packages/editor/build-module/components/global-styles-sidebar/index.mjs
  var import_components213 = __toESM(require_components(), 1);
  var import_i18n224 = __toESM(require_i18n(), 1);
  var import_data228 = __toESM(require_data(), 1);
  var import_element173 = __toESM(require_element(), 1);
  var import_preferences26 = __toESM(require_preferences(), 1);
  var import_compose62 = __toESM(require_compose(), 1);
  var import_core_data120 = __toESM(require_core_data(), 1);

  // packages/editor/build-module/components/global-styles/menu.mjs
  var import_components211 = __toESM(require_components(), 1);
  var import_data226 = __toESM(require_data(), 1);
  var import_i18n222 = __toESM(require_i18n(), 1);
  var import_preferences24 = __toESM(require_preferences(), 1);
  var import_core_data119 = __toESM(require_core_data(), 1);
  var import_jsx_runtime342 = __toESM(require_jsx_runtime(), 1);
  function GlobalStylesActionMenu({
    hideWelcomeGuide = false,
    onChangePath
  }) {
    const { user, setUser } = useGlobalStyles();
    const canReset = !!user && (Object.keys(user?.styles ?? {}).length > 0 || Object.keys(user?.settings ?? {}).length > 0);
    const onReset = () => {
      setUser({ styles: {}, settings: {} });
    };
    const { toggle } = (0, import_data226.useDispatch)(import_preferences24.store);
    const { canEditCSS } = (0, import_data226.useSelect)((select5) => {
      const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select5(import_core_data119.store);
      const globalStylesId = __experimentalGetCurrentGlobalStylesId();
      const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
      return {
        canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"]
      };
    }, []);
    const loadCustomCSS = () => {
      onChangePath("/css");
    };
    return /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
      import_components211.DropdownMenu,
      {
        icon: more_vertical_default,
        label: (0, import_i18n222.__)("More"),
        toggleProps: { size: "compact" },
        children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime342.jsxs)(import_jsx_runtime342.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime342.jsxs)(import_components211.MenuGroup, { children: [
            canEditCSS && /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(import_components211.MenuItem, { onClick: loadCustomCSS, children: (0, import_i18n222.__)("Additional CSS") }),
            !hideWelcomeGuide && /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
              import_components211.MenuItem,
              {
                onClick: () => {
                  toggle(
                    "core/edit-site",
                    "welcomeGuideStyles"
                  );
                  onClose();
                },
                children: (0, import_i18n222.__)("Welcome Guide")
              }
            )
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(import_components211.MenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
            import_components211.MenuItem,
            {
              onClick: () => {
                onReset();
                onClose();
              },
              disabled: !canReset,
              children: (0, import_i18n222.__)("Reset styles")
            }
          ) })
        ] })
      }
    );
  }

  // packages/editor/build-module/components/global-styles-sidebar/default-sidebar.mjs
  var import_jsx_runtime343 = __toESM(require_jsx_runtime(), 1);
  function DefaultSidebar({
    className,
    identifier,
    title,
    icon,
    children,
    closeLabel,
    header,
    headerClassName,
    panelClassName,
    isActiveByDefault
  }) {
    return /* @__PURE__ */ (0, import_jsx_runtime343.jsxs)(import_jsx_runtime343.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(
        complementary_area_default,
        {
          className,
          scope: "core",
          identifier,
          title,
          icon,
          closeLabel,
          header,
          headerClassName,
          panelClassName,
          isActiveByDefault,
          children
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(
        ComplementaryAreaMoreMenuItem,
        {
          scope: "core",
          identifier,
          icon,
          children: title
        }
      )
    ] });
  }

  // packages/editor/build-module/components/global-styles-sidebar/welcome-guide.mjs
  var import_data227 = __toESM(require_data(), 1);
  var import_components212 = __toESM(require_components(), 1);
  var import_i18n223 = __toESM(require_i18n(), 1);
  var import_preferences25 = __toESM(require_preferences(), 1);

  // packages/editor/build-module/components/global-styles-sidebar/welcome-guide-image.mjs
  var import_jsx_runtime344 = __toESM(require_jsx_runtime(), 1);
  function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) {
    return /* @__PURE__ */ (0, import_jsx_runtime344.jsxs)("picture", { className: "editor-welcome-guide__image", children: [
      /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
        "source",
        {
          srcSet: nonAnimatedSrc,
          media: "(prefers-reduced-motion: reduce)"
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" })
    ] });
  }

  // packages/editor/build-module/components/global-styles-sidebar/welcome-guide.mjs
  var import_jsx_runtime345 = __toESM(require_jsx_runtime(), 1);
  function WelcomeGuideStyles() {
    const { toggle } = (0, import_data227.useDispatch)(import_preferences25.store);
    const { isActive, isStylesOpen } = (0, import_data227.useSelect)((select5) => {
      const sidebar = select5(store2).getActiveComplementaryArea("core");
      return {
        isActive: !!select5(import_preferences25.store).get(
          "core/edit-site",
          "welcomeGuideStyles"
        ),
        isStylesOpen: sidebar === "edit-site/global-styles"
      };
    }, []);
    if (!isActive || !isStylesOpen) {
      return null;
    }
    const welcomeLabel = (0, import_i18n223.__)("Welcome to Styles");
    return /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(
      import_components212.Guide,
      {
        className: "editor-welcome-guide guide-styles",
        contentLabel: welcomeLabel,
        finishButtonText: (0, import_i18n223.__)("Get started"),
        onFinish: () => toggle("core/edit-site", "welcomeGuideStyles"),
        pages: [
          {
            image: /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(
              WelcomeGuideImage,
              {
                nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1",
                animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1"
              }
            ),
            content: /* @__PURE__ */ (0, import_jsx_runtime345.jsxs)(import_jsx_runtime345.Fragment, { children: [
              /* @__PURE__ */ (0, import_jsx_runtime345.jsx)("h1", { className: "editor-welcome-guide__heading", children: welcomeLabel }),
              /* @__PURE__ */ (0, import_jsx_runtime345.jsx)("p", { className: "editor-welcome-guide__text", children: (0, import_i18n223.__)(
                "Tweak your site, or give it a whole new look! Get creative \u2014 how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here."
              ) })
            ] })
          },
          {
            image: /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(
              WelcomeGuideImage,
              {
                nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1",
                animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1"
              }
            ),
            content: /* @__PURE__ */ (0, import_jsx_runtime345.jsxs)(import_jsx_runtime345.Fragment, { children: [
              /* @__PURE__ */ (0, import_jsx_runtime345.jsx)("h1", { className: "editor-welcome-guide__heading", children: (0, import_i18n223.__)("Set the design") }),
              /* @__PURE__ */ (0, import_jsx_runtime345.jsx)("p", { className: "editor-welcome-guide__text", children: (0, import_i18n223.__)(
                "You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle!"
              ) })
            ] })
          },
          {
            image: /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(
              WelcomeGuideImage,
              {
                nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1",
                animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1"
              }
            ),
            content: /* @__PURE__ */ (0, import_jsx_runtime345.jsxs)(import_jsx_runtime345.Fragment, { children: [
              /* @__PURE__ */ (0, import_jsx_runtime345.jsx)("h1", { className: "editor-welcome-guide__heading", children: (0, import_i18n223.__)("Personalize blocks") }),
              /* @__PURE__ */ (0, import_jsx_runtime345.jsx)("p", { className: "editor-welcome-guide__text", children: (0, import_i18n223.__)(
                "You can adjust your blocks to ensure a cohesive experience across your site \u2014 add your unique colors to a branded Button block, or adjust the Heading block to your preferred size."
              ) })
            ] })
          },
          {
            image: /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(
              WelcomeGuideImage,
              {
                nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
                animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
              }
            ),
            content: /* @__PURE__ */ (0, import_jsx_runtime345.jsxs)(import_jsx_runtime345.Fragment, { children: [
              /* @__PURE__ */ (0, import_jsx_runtime345.jsx)("h1", { className: "editor-welcome-guide__heading", children: (0, import_i18n223.__)("Learn more") }),
              /* @__PURE__ */ (0, import_jsx_runtime345.jsxs)("p", { className: "editor-welcome-guide__text", children: [
                (0, import_i18n223.__)(
                  "New to block themes and styling your site?"
                ),
                " ",
                /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(
                  import_components212.ExternalLink,
                  {
                    href: (0, import_i18n223.__)(
                      "https://wordpress.org/documentation/article/styles-overview/"
                    ),
                    children: (0, import_i18n223.__)(
                      "Here\u2019s a detailed guide to learn how to make the most of it."
                    )
                  }
                )
              ] })
            ] })
          }
        ]
      }
    );
  }

  // packages/editor/build-module/components/global-styles-sidebar/index.mjs
  var import_jsx_runtime346 = __toESM(require_jsx_runtime(), 1);
  function GlobalStylesSidebar() {
    const {
      shouldResetNavigation,
      stylesPath: stylesPath2,
      showStylebook: showStylebook2,
      showListViewByDefault,
      hasRevisions,
      activeComplementaryArea
    } = (0, import_data228.useSelect)((select5) => {
      const { getActiveComplementaryArea: getActiveComplementaryArea2 } = select5(store2);
      const { getStylesPath: getStylesPath2, getShowStylebook: getShowStylebook2 } = unlock(
        select5(store)
      );
      const _isVisualEditorMode = "visual" === select5(store).getEditorMode();
      const _showListViewByDefault = select5(import_preferences26.store).get(
        "core",
        "showListViewByDefault"
      );
      const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select5(import_core_data120.store);
      const globalStylesId = __experimentalGetCurrentGlobalStylesId();
      const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
      return {
        stylesPath: getStylesPath2(),
        showStylebook: getShowStylebook2(),
        shouldResetNavigation: "edit-site/global-styles" !== getActiveComplementaryArea2("core") || !_isVisualEditorMode,
        showListViewByDefault: _showListViewByDefault,
        hasRevisions: !!globalStyles?._links?.["version-history"]?.[0]?.count,
        activeComplementaryArea: select5(store2).getActiveComplementaryArea("core")
      };
    }, []);
    const { setStylesPath: setStylesPath2, setShowStylebook: setShowStylebook2, resetStylesNavigation: resetStylesNavigation2 } = unlock(
      (0, import_data228.useDispatch)(store)
    );
    const isMobileViewport = (0, import_compose62.useViewportMatch)("medium", "<");
    const isRevisionsOpened = stylesPath2.startsWith("/revisions") && !showStylebook2;
    const isRevisionsStyleBookOpened = stylesPath2.startsWith("/revisions") && showStylebook2;
    const previousActiveArea = (0, import_compose62.usePrevious)(activeComplementaryArea);
    (0, import_element173.useEffect)(() => {
      if (activeComplementaryArea === "edit-site/global-styles" && previousActiveArea !== "edit-site/global-styles") {
        resetStylesNavigation2();
      }
    }, [activeComplementaryArea, previousActiveArea, resetStylesNavigation2]);
    (0, import_element173.useEffect)(() => {
      if (shouldResetNavigation) {
        resetStylesNavigation2();
      }
    }, [shouldResetNavigation, resetStylesNavigation2]);
    const { setIsListViewOpened: setIsListViewOpened2 } = (0, import_data228.useDispatch)(store);
    const toggleRevisions = () => {
      setIsListViewOpened2(false);
      if (isRevisionsOpened || isRevisionsStyleBookOpened) {
        setStylesPath2("/");
      } else {
        setStylesPath2("/revisions");
      }
    };
    const toggleStyleBook = () => {
      setIsListViewOpened2(showStylebook2 && showListViewByDefault);
      setShowStylebook2(!showStylebook2);
    };
    return /* @__PURE__ */ (0, import_jsx_runtime346.jsxs)(import_jsx_runtime346.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(
        DefaultSidebar,
        {
          className: "editor-global-styles-sidebar",
          identifier: "edit-site/global-styles",
          title: (0, import_i18n224.__)("Styles"),
          icon: styles_default,
          closeLabel: (0, import_i18n224.__)("Close Styles"),
          panelClassName: "editor-global-styles-sidebar__panel",
          header: /* @__PURE__ */ (0, import_jsx_runtime346.jsxs)(
            import_components213.Flex,
            {
              className: "editor-global-styles-sidebar__header",
              gap: 1,
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(import_components213.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime346.jsx)("h2", { className: "editor-global-styles-sidebar__header-title", children: (0, import_i18n224.__)("Styles") }) }),
                /* @__PURE__ */ (0, import_jsx_runtime346.jsxs)(
                  import_components213.Flex,
                  {
                    justify: "flex-end",
                    gap: 1,
                    className: "editor-global-styles-sidebar__header-actions",
                    children: [
                      !isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(import_components213.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(
                        import_components213.Button,
                        {
                          icon: seen_default,
                          label: (0, import_i18n224.__)("Style Book"),
                          isPressed: showStylebook2,
                          accessibleWhenDisabled: true,
                          disabled: shouldResetNavigation,
                          onClick: toggleStyleBook,
                          size: "compact"
                        }
                      ) }),
                      /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(import_components213.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(
                        import_components213.Button,
                        {
                          label: (0, import_i18n224.__)("Revisions"),
                          icon: backup_default,
                          onClick: toggleRevisions,
                          accessibleWhenDisabled: true,
                          disabled: !hasRevisions,
                          isPressed: isRevisionsOpened || isRevisionsStyleBookOpened,
                          size: "compact"
                        }
                      ) }),
                      /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(
                        GlobalStylesActionMenu,
                        {
                          onChangePath: setStylesPath2
                        }
                      )
                    ]
                  }
                )
              ]
            }
          ),
          children: /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(
            GlobalStylesUIWrapper,
            {
              path: stylesPath2,
              onPathChange: setStylesPath2
            }
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(WelcomeGuideStyles, {})
    ] });
  }

  // packages/editor/build-module/components/editor/index.mjs
  var import_jsx_runtime347 = __toESM(require_jsx_runtime(), 1);
  function Editor({
    postType: postType2,
    postId: postId2,
    templateId: templateId2,
    settings,
    children,
    initialEdits,
    initialSelection,
    // This could be part of the settings.
    onActionPerformed,
    // The following abstractions are not ideal but necessary
    // to account for site editor and post editor differences for now.
    extraContent,
    extraSidebarPanels,
    ...props
  }) {
    const {
      post: post2,
      template: template2,
      hasLoadedPost,
      error,
      isBlockTheme,
      showGlobalStyles
    } = (0, import_data229.useSelect)(
      (select5) => {
        const {
          getEntityRecord,
          getResolutionError,
          hasFinishedResolution,
          getCurrentTheme,
          __experimentalGetCurrentGlobalStylesId,
          canUser
        } = select5(import_core_data121.store);
        const { getRenderingMode: getRenderingMode2, getCurrentPostType: getCurrentPostType2 } = select5(store);
        const postArgs = ["postType", postType2, postId2];
        const renderingMode2 = getRenderingMode2();
        const currentPostType = getCurrentPostType2();
        const _isBlockTheme = getCurrentTheme()?.is_block_theme;
        const globalStylesId = __experimentalGetCurrentGlobalStylesId();
        const userCanEditGlobalStyles = globalStylesId ? canUser("update", {
          kind: "root",
          name: "globalStyles",
          id: globalStylesId
        }) : false;
        return {
          post: getEntityRecord(...postArgs),
          template: templateId2 ? getEntityRecord(
            "postType",
            TEMPLATE_POST_TYPE,
            templateId2
          ) : void 0,
          hasLoadedPost: hasFinishedResolution(
            "getEntityRecord",
            postArgs
          ),
          error: getResolutionError("getEntityRecord", postArgs)?.message,
          isBlockTheme: _isBlockTheme,
          showGlobalStyles: _isBlockTheme && userCanEditGlobalStyles && (currentPostType === "wp_template" || renderingMode2 === "template-locked")
        };
      },
      [postType2, postId2, templateId2]
    );
    const { selectBlock: selectBlock2 } = (0, import_data229.useDispatch)(import_block_editor98.store);
    const restoreBlockFromPath = useRestoreBlockFromPath();
    (0, import_element174.useEffect)(() => {
      if (!initialSelection || !hasLoadedPost || !post2) {
        return;
      }
      const timeoutId = setTimeout(() => {
        const clientId = restoreBlockFromPath(initialSelection);
        if (clientId) {
          selectBlock2(clientId);
        }
      }, 0);
      return () => clearTimeout(timeoutId);
    }, [
      initialSelection,
      hasLoadedPost,
      post2,
      selectBlock2,
      restoreBlockFromPath
    ]);
    return /* @__PURE__ */ (0, import_jsx_runtime347.jsxs)(import_jsx_runtime347.Fragment, { children: [
      hasLoadedPost && !post2 && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
        import_components214.Notice,
        {
          status: !!error ? "error" : "warning",
          isDismissible: false,
          children: !error ? (0, import_i18n225.__)(
            "You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
          ) : error
        }
      ),
      !!post2 && /* @__PURE__ */ (0, import_jsx_runtime347.jsxs)(
        ExperimentalEditorProvider,
        {
          post: post2,
          __unstableTemplate: template2,
          settings,
          initialEdits,
          useSubRegistry: false,
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(EditorInterface, { ...props, children: extraContent }),
            children,
            /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
              sidebar_default2,
              {
                onActionPerformed,
                extraPanels: extraSidebarPanels
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(NotesSidebarContainer, {}),
            isBlockTheme && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(GlobalStylesRenderer, {}),
            showGlobalStyles && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(GlobalStylesSidebar, {})
          ]
        }
      )
    ] });
  }
  var editor_default = Editor;

  // packages/editor/build-module/components/preferences-modal/index.mjs
  var import_i18n227 = __toESM(require_i18n(), 1);
  var import_compose63 = __toESM(require_compose(), 1);
  var import_data232 = __toESM(require_data(), 1);
  var import_element176 = __toESM(require_element(), 1);
  var import_preferences29 = __toESM(require_preferences(), 1);

  // packages/editor/build-module/components/preferences-modal/enable-publish-sidebar.mjs
  var import_data230 = __toESM(require_data(), 1);
  var import_preferences27 = __toESM(require_preferences(), 1);
  var import_jsx_runtime348 = __toESM(require_jsx_runtime(), 1);
  var { PreferenceBaseOption: PreferenceBaseOption2 } = unlock(import_preferences27.privateApis);
  function EnablePublishSidebarOption(props) {
    const isChecked = (0, import_data230.useSelect)((select5) => {
      return select5(store).isPublishSidebarEnabled();
    }, []);
    const { enablePublishSidebar: enablePublishSidebar2, disablePublishSidebar: disablePublishSidebar2 } = (0, import_data230.useDispatch)(store);
    return /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
      PreferenceBaseOption2,
      {
        isChecked,
        onChange: (isEnabled) => isEnabled ? enablePublishSidebar2() : disablePublishSidebar2(),
        ...props
      }
    );
  }

  // packages/editor/build-module/components/block-visibility/index.mjs
  var import_data231 = __toESM(require_data(), 1);
  var import_preferences28 = __toESM(require_preferences(), 1);
  var import_blocks37 = __toESM(require_blocks(), 1);
  var import_element175 = __toESM(require_element(), 1);
  var import_components215 = __toESM(require_components(), 1);
  var import_i18n226 = __toESM(require_i18n(), 1);
  var import_block_editor99 = __toESM(require_block_editor(), 1);
  var import_jsx_runtime349 = __toESM(require_jsx_runtime(), 1);
  var { BlockManager } = unlock(import_block_editor99.privateApis);
  var EMPTY_ARRAY8 = [];
  function BlockVisibility() {
    const { showBlockTypes: showBlockTypes2, hideBlockTypes: hideBlockTypes2 } = unlock(
      (0, import_data231.useDispatch)(store)
    );
    const {
      blockTypes,
      allowedBlockTypes: _allowedBlockTypes,
      hiddenBlockTypes: _hiddenBlockTypes
    } = (0, import_data231.useSelect)((select5) => {
      return {
        blockTypes: select5(import_blocks37.store).getBlockTypes(),
        allowedBlockTypes: select5(store).getEditorSettings().allowedBlockTypes,
        hiddenBlockTypes: select5(import_preferences28.store).get("core", "hiddenBlockTypes") ?? EMPTY_ARRAY8
      };
    }, []);
    const allowedBlockTypes = (0, import_element175.useMemo)(() => {
      if (_allowedBlockTypes === true) {
        return blockTypes;
      }
      return blockTypes.filter(({ name: name2 }) => {
        return _allowedBlockTypes?.includes(name2);
      });
    }, [_allowedBlockTypes, blockTypes]);
    const filteredBlockTypes = allowedBlockTypes.filter(
      (blockType) => (0, import_blocks37.hasBlockSupport)(blockType, "inserter", true) && (!blockType.parent || blockType.parent.includes("core/post-content"))
    );
    const hiddenBlockTypes = _hiddenBlockTypes.filter((hiddenBlock) => {
      return filteredBlockTypes.some(
        (registeredBlock) => registeredBlock.name === hiddenBlock
      );
    });
    const selectedBlockTypes = filteredBlockTypes.filter(
      (blockType) => !hiddenBlockTypes.includes(blockType.name)
    );
    const numberOfHiddenBlocks = filteredBlockTypes.length - selectedBlockTypes.length;
    function enableAllBlockTypes() {
      onChangeSelectedBlockTypes(filteredBlockTypes);
    }
    const onChangeSelectedBlockTypes = (newSelectedBlockTypes) => {
      if (selectedBlockTypes.length > newSelectedBlockTypes.length) {
        const blockTypesToHide = selectedBlockTypes.filter(
          (blockType) => !newSelectedBlockTypes.find(
            ({ name: name2 }) => name2 === blockType.name
          )
        );
        hideBlockTypes2(blockTypesToHide.map(({ name: name2 }) => name2));
      } else if (selectedBlockTypes.length < newSelectedBlockTypes.length) {
        const blockTypesToShow = newSelectedBlockTypes.filter(
          (blockType) => !selectedBlockTypes.find(
            ({ name: name2 }) => name2 === blockType.name
          )
        );
        showBlockTypes2(blockTypesToShow.map(({ name: name2 }) => name2));
      }
    };
    return /* @__PURE__ */ (0, import_jsx_runtime349.jsxs)("div", { className: "editor-block-visibility", children: [
      !!numberOfHiddenBlocks && /* @__PURE__ */ (0, import_jsx_runtime349.jsxs)("div", { className: "editor-block-visibility__disabled-blocks-count", children: [
        (0, import_i18n226.sprintf)(
          /* translators: %d: number of blocks. */
          (0, import_i18n226._n)(
            "%d block is hidden.",
            "%d blocks are hidden.",
            numberOfHiddenBlocks
          ),
          numberOfHiddenBlocks
        ),
        /* @__PURE__ */ (0, import_jsx_runtime349.jsx)(
          import_components215.Button,
          {
            __next40pxDefaultSize: true,
            variant: "link",
            onClick: enableAllBlockTypes,
            children: (0, import_i18n226.__)("Reset")
          }
        )
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime349.jsx)(
        BlockManager,
        {
          blockTypes: filteredBlockTypes,
          selectedBlockTypes,
          onChange: onChangeSelectedBlockTypes,
          showSelectAll: false
        }
      )
    ] });
  }

  // packages/editor/build-module/components/preferences-modal/index.mjs
  var import_jsx_runtime350 = __toESM(require_jsx_runtime(), 1);
  var {
    PreferencesModal,
    PreferencesModalTabs,
    PreferencesModalSection,
    PreferenceToggleControl
  } = unlock(import_preferences29.privateApis);
  function EditorPreferencesModal({ extraSections = {} }) {
    const isActive = (0, import_data232.useSelect)((select5) => {
      return select5(store2).isModalActive("editor/preferences");
    }, []);
    const { closeModal: closeModal2 } = (0, import_data232.useDispatch)(store2);
    if (!isActive) {
      return null;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(PreferencesModal, { closeModal: closeModal2, children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(PreferencesModalContents, { extraSections }) });
  }
  function PreferencesModalContents({ extraSections = {} }) {
    const isLargeViewport = (0, import_compose63.useViewportMatch)("medium");
    const showBlockBreadcrumbsOption = (0, import_data232.useSelect)(
      (select5) => {
        const { getEditorSettings: getEditorSettings2 } = select5(store);
        const { get } = select5(import_preferences29.store);
        const isRichEditingEnabled = getEditorSettings2().richEditingEnabled;
        const isDistractionFreeEnabled = get("core", "distractionFree");
        return !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled;
      },
      [isLargeViewport]
    );
    const { setIsListViewOpened: setIsListViewOpened2, setIsInserterOpened: setIsInserterOpened2 } = (0, import_data232.useDispatch)(store);
    const { set: setPreference } = (0, import_data232.useDispatch)(import_preferences29.store);
    const sections = (0, import_element176.useMemo)(
      () => [
        {
          name: "general",
          tabLabel: (0, import_i18n227.__)("General"),
          content: /* @__PURE__ */ (0, import_jsx_runtime350.jsxs)(import_jsx_runtime350.Fragment, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime350.jsxs)(
              PreferencesModalSection,
              {
                title: (0, import_i18n227.__)("Interface"),
                children: [
                  /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                    PreferenceToggleControl,
                    {
                      scope: "core",
                      featureName: "showListViewByDefault",
                      help: (0, import_i18n227.__)(
                        "Opens the List View panel by default."
                      ),
                      label: (0, import_i18n227.__)("Always open List View")
                    }
                  ),
                  showBlockBreadcrumbsOption && /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                    PreferenceToggleControl,
                    {
                      scope: "core",
                      featureName: "showBlockBreadcrumbs",
                      help: (0, import_i18n227.__)(
                        "Display the block hierarchy trail at the bottom of the editor."
                      ),
                      label: (0, import_i18n227.__)("Show block breadcrumbs")
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                    PreferenceToggleControl,
                    {
                      scope: "core",
                      featureName: "allowRightClickOverrides",
                      help: (0, import_i18n227.__)(
                        "Allows contextual List View menus via right-click, overriding browser defaults."
                      ),
                      label: (0, import_i18n227.__)(
                        "Allow right-click contextual menus"
                      )
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                    PreferenceToggleControl,
                    {
                      scope: "core",
                      featureName: "enableChoosePatternModal",
                      help: (0, import_i18n227.__)(
                        "Pick from starter content when creating a new page."
                      ),
                      label: (0, import_i18n227.__)("Show starter patterns")
                    }
                  )
                ]
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime350.jsxs)(
              PreferencesModalSection,
              {
                title: (0, import_i18n227.__)("Document settings"),
                description: (0, import_i18n227.__)(
                  "Select what settings are shown in the document panel."
                ),
                children: [
                  /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(enable_plugin_document_setting_panel_default.Slot, {}),
                  /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                    post_taxonomies_default,
                    {
                      taxonomyWrapper: (content, taxonomy) => /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                        EnablePanelOption,
                        {
                          label: taxonomy.labels.menu_name,
                          panelName: `taxonomy-panel-${taxonomy.slug}`
                        }
                      )
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(check_default4, { children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                    EnablePanelOption,
                    {
                      label: (0, import_i18n227.__)("Featured image"),
                      panelName: "featured-image"
                    }
                  ) }),
                  /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(check_default3, { children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                    EnablePanelOption,
                    {
                      label: (0, import_i18n227.__)("Excerpt"),
                      panelName: "post-excerpt"
                    }
                  ) }),
                  /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                    post_type_support_check_default,
                    {
                      supportKeys: ["comments", "trackbacks"],
                      children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                        EnablePanelOption,
                        {
                          label: (0, import_i18n227.__)("Discussion"),
                          panelName: "discussion-panel"
                        }
                      )
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(check_default2, { children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                    EnablePanelOption,
                    {
                      label: (0, import_i18n227.__)("Page attributes"),
                      panelName: "page-attributes"
                    }
                  ) })
                ]
              }
            ),
            isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
              PreferencesModalSection,
              {
                title: (0, import_i18n227.__)("Publishing"),
                children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                  EnablePublishSidebarOption,
                  {
                    help: (0, import_i18n227.__)(
                      "Review settings, such as visibility and tags."
                    ),
                    label: (0, import_i18n227.__)(
                      "Enable pre-publish checks"
                    )
                  }
                )
              }
            ),
            extraSections?.general
          ] })
        },
        {
          name: "appearance",
          tabLabel: (0, import_i18n227.__)("Appearance"),
          content: /* @__PURE__ */ (0, import_jsx_runtime350.jsxs)(
            PreferencesModalSection,
            {
              title: (0, import_i18n227.__)("Appearance"),
              description: (0, import_i18n227.__)(
                "Customize the editor interface to suit your needs."
              ),
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                  PreferenceToggleControl,
                  {
                    scope: "core",
                    featureName: "fixedToolbar",
                    onToggle: () => setPreference(
                      "core",
                      "distractionFree",
                      false
                    ),
                    help: (0, import_i18n227.__)(
                      "Access all block and document tools in a single place."
                    ),
                    label: (0, import_i18n227.__)("Top toolbar")
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                  PreferenceToggleControl,
                  {
                    scope: "core",
                    featureName: "distractionFree",
                    onToggle: () => {
                      setPreference(
                        "core",
                        "fixedToolbar",
                        true
                      );
                      setIsInserterOpened2(false);
                      setIsListViewOpened2(false);
                    },
                    help: (0, import_i18n227.__)(
                      "Reduce visual distractions by hiding the toolbar and other elements to focus on writing."
                    ),
                    label: (0, import_i18n227.__)("Distraction free")
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                  PreferenceToggleControl,
                  {
                    scope: "core",
                    featureName: "focusMode",
                    help: (0, import_i18n227.__)(
                      "Highlights the current block and fades other content."
                    ),
                    label: (0, import_i18n227.__)("Spotlight mode")
                  }
                ),
                extraSections?.appearance
              ]
            }
          )
        },
        {
          name: "accessibility",
          tabLabel: (0, import_i18n227.__)("Accessibility"),
          content: /* @__PURE__ */ (0, import_jsx_runtime350.jsxs)(import_jsx_runtime350.Fragment, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
              PreferencesModalSection,
              {
                title: (0, import_i18n227.__)("Navigation"),
                description: (0, import_i18n227.__)(
                  "Optimize the editing experience for enhanced control."
                ),
                children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                  PreferenceToggleControl,
                  {
                    scope: "core",
                    featureName: "keepCaretInsideBlock",
                    help: (0, import_i18n227.__)(
                      "Keeps the text cursor within blocks while navigating with arrow keys, preventing it from moving to other blocks and enhancing accessibility for keyboard users."
                    ),
                    label: (0, import_i18n227.__)(
                      "Contain text cursor inside block"
                    )
                  }
                )
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
              PreferencesModalSection,
              {
                title: (0, import_i18n227.__)("Interface"),
                children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                  PreferenceToggleControl,
                  {
                    scope: "core",
                    featureName: "showIconLabels",
                    label: (0, import_i18n227.__)("Show button text labels"),
                    help: (0, import_i18n227.__)(
                      "Show text instead of icons on buttons across the interface."
                    )
                  }
                )
              }
            )
          ] })
        },
        {
          name: "blocks",
          tabLabel: (0, import_i18n227.__)("Blocks"),
          content: /* @__PURE__ */ (0, import_jsx_runtime350.jsxs)(import_jsx_runtime350.Fragment, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(PreferencesModalSection, { title: (0, import_i18n227.__)("Inserter"), children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
              PreferenceToggleControl,
              {
                scope: "core",
                featureName: "mostUsedBlocks",
                help: (0, import_i18n227.__)(
                  "Adds a category with the most frequently used blocks in the inserter."
                ),
                label: (0, import_i18n227.__)("Show most used blocks")
              }
            ) }),
            /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
              PreferencesModalSection,
              {
                title: (0, import_i18n227.__)("Manage block visibility"),
                description: (0, import_i18n227.__)(
                  "Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."
                ),
                children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(BlockVisibility, {})
              }
            )
          ] })
        },
        window.__experimentalMediaProcessing && {
          name: "media",
          tabLabel: (0, import_i18n227.__)("Media"),
          content: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(import_jsx_runtime350.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime350.jsxs)(
            PreferencesModalSection,
            {
              title: (0, import_i18n227.__)("General"),
              description: (0, import_i18n227.__)(
                "Customize options related to the media upload flow."
              ),
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                  PreferenceToggleControl,
                  {
                    scope: "core/media",
                    featureName: "optimizeOnUpload",
                    help: (0, import_i18n227.__)(
                      "Compress media items before uploading to the server."
                    ),
                    label: (0, import_i18n227.__)("Pre-upload compression")
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
                  PreferenceToggleControl,
                  {
                    scope: "core/media",
                    featureName: "requireApproval",
                    help: (0, import_i18n227.__)(
                      "Require approval step when optimizing existing media."
                    ),
                    label: (0, import_i18n227.__)("Approval step")
                  }
                )
              ]
            }
          ) })
        }
      ].filter(Boolean),
      [
        showBlockBreadcrumbsOption,
        extraSections,
        setIsInserterOpened2,
        setIsListViewOpened2,
        setPreference,
        isLargeViewport
      ]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(PreferencesModalTabs, { sections });
  }

  // packages/editor/build-module/components/post-fields/index.mjs
  var import_element177 = __toESM(require_element(), 1);
  var import_data233 = __toESM(require_data(), 1);
  function usePostFields({
    postType: postType2
  }) {
    const { registerPostTypeSchema: registerPostTypeSchema2 } = unlock((0, import_data233.useDispatch)(store));
    (0, import_element177.useEffect)(() => {
      registerPostTypeSchema2(postType2);
    }, [registerPostTypeSchema2, postType2]);
    const { fields: fields2 } = (0, import_data233.useSelect)(
      (select5) => {
        const { getEntityFields: getEntityFields3 } = unlock(select5(store));
        return {
          fields: getEntityFields3("postType", postType2)
        };
      },
      [postType2]
    );
    return fields2;
  }
  var post_fields_default = usePostFields;

  // packages/editor/build-module/bindings/api.mjs
  var import_blocks38 = __toESM(require_blocks(), 1);

  // packages/editor/build-module/bindings/pattern-overrides.mjs
  var import_block_editor100 = __toESM(require_block_editor(), 1);
  var CONTENT = "content";
  var pattern_overrides_default = {
    name: "core/pattern-overrides",
    getValues({ select: select5, clientId, context, bindings }) {
      const patternOverridesContent = context["pattern/overrides"];
      const { getBlockAttributes: getBlockAttributes2 } = select5(import_block_editor100.store);
      const currentBlockAttributes = getBlockAttributes2(clientId);
      const overridesValues = {};
      for (const attributeName of Object.keys(bindings)) {
        const overridableValue = patternOverridesContent?.[currentBlockAttributes?.metadata?.name]?.[attributeName];
        if (overridableValue === void 0) {
          overridesValues[attributeName] = currentBlockAttributes[attributeName];
          continue;
        } else {
          overridesValues[attributeName] = overridableValue === "" ? void 0 : overridableValue;
        }
      }
      return overridesValues;
    },
    setValues({ select: select5, dispatch: dispatch6, clientId, bindings }) {
      const { getBlockAttributes: getBlockAttributes2, getBlockParentsByBlockName, getBlocks: getBlocks2 } = select5(import_block_editor100.store);
      const currentBlockAttributes = getBlockAttributes2(clientId);
      const blockName = currentBlockAttributes?.metadata?.name;
      if (!blockName) {
        return;
      }
      const [patternClientId] = getBlockParentsByBlockName(
        clientId,
        "core/block",
        true
      );
      const attributes = Object.entries(bindings).reduce(
        (attrs, [key, { newValue }]) => {
          attrs[key] = newValue;
          return attrs;
        },
        {}
      );
      if (!patternClientId) {
        const syncBlocksWithSameName = (blocks) => {
          for (const block of blocks) {
            if (block.attributes?.metadata?.name === blockName) {
              dispatch6(import_block_editor100.store).updateBlockAttributes(
                block.clientId,
                attributes
              );
            }
            syncBlocksWithSameName(block.innerBlocks);
          }
        };
        syncBlocksWithSameName(getBlocks2());
        return;
      }
      const currentBindingValue = getBlockAttributes2(patternClientId)?.[CONTENT];
      dispatch6(import_block_editor100.store).updateBlockAttributes(patternClientId, {
        [CONTENT]: {
          ...currentBindingValue,
          [blockName]: {
            ...currentBindingValue?.[blockName],
            ...Object.entries(attributes).reduce(
              (acc, [key, value]) => {
                acc[key] = value === void 0 ? "" : value;
                return acc;
              },
              {}
            )
          }
        }
      });
    },
    canUserEditValue: () => true
  };

  // packages/editor/build-module/bindings/post-data.mjs
  var import_i18n228 = __toESM(require_i18n(), 1);
  var import_core_data122 = __toESM(require_core_data(), 1);
  var import_block_editor101 = __toESM(require_block_editor(), 1);
  var NAVIGATION_BLOCK_TYPES = [
    "core/navigation-link",
    "core/navigation-submenu"
  ];
  var postDataFields = [
    {
      label: (0, import_i18n228.__)("Post Date"),
      args: { field: "date" },
      type: "string"
    },
    {
      label: (0, import_i18n228.__)("Post Modified Date"),
      args: { field: "modified" },
      type: "string"
    },
    {
      label: (0, import_i18n228.__)("Post Link"),
      args: { field: "link" },
      type: "string"
    }
  ];
  var post_data_default = {
    name: "core/post-data",
    getValues({ select: select5, context, bindings, clientId }) {
      const { getBlockAttributes: getBlockAttributes2, getBlockName: getBlockName2 } = select5(import_block_editor101.store);
      const blockName = getBlockName2(clientId);
      const isNavigationBlock = NAVIGATION_BLOCK_TYPES.includes(blockName);
      let postId2, postType2;
      if (isNavigationBlock) {
        const blockAttributes = getBlockAttributes2(clientId);
        postId2 = blockAttributes?.id;
        postType2 = blockAttributes?.type;
      } else {
        postId2 = context?.postId;
        postType2 = context?.postType;
      }
      const { getEditedEntityRecord } = select5(import_core_data122.store);
      const entityDataValues = getEditedEntityRecord(
        "postType",
        postType2,
        postId2
      );
      const newValues = {};
      for (const [attributeName, binding] of Object.entries(bindings)) {
        const postDataField = postDataFields.find(
          (field) => field.args.field === binding.args.field
        );
        if (!postDataField) {
          newValues[attributeName] = binding.args.field;
        } else if (!entityDataValues) {
          newValues[attributeName] = postDataField.label;
        } else {
          newValues[attributeName] = entityDataValues[binding.args.field];
        }
      }
      return newValues;
    },
    setValues({ dispatch: dispatch6, context, bindings, clientId, select: select5 }) {
      const { getBlockName: getBlockName2 } = select5(import_block_editor101.store);
      const blockName = getBlockName2(clientId);
      if (NAVIGATION_BLOCK_TYPES.includes(blockName)) {
        return false;
      }
      const newData = {};
      Object.values(bindings).forEach(({ args, newValue }) => {
        newData[args.field] = newValue;
      });
      dispatch6(import_core_data122.store).editEntityRecord(
        "postType",
        context?.postType,
        context?.postId,
        newData
      );
    },
    canUserEditValue({ select: select5, context }) {
      const { getBlockName: getBlockName2, getSelectedBlockClientId: getSelectedBlockClientId2 } = select5(import_block_editor101.store);
      const clientId = getSelectedBlockClientId2();
      const blockName = getBlockName2(clientId);
      if (NAVIGATION_BLOCK_TYPES.includes(blockName)) {
        return false;
      }
      if (context?.query || context?.queryId) {
        return false;
      }
      if (!context?.postType) {
        return false;
      }
      const canUserEdit = select5(import_core_data122.store).canUser("update", {
        kind: "postType",
        name: context?.postType,
        id: context?.postId
      });
      if (!canUserEdit) {
        return false;
      }
      return true;
    },
    getFieldsList({ context, select: select5 }) {
      const selectedBlock = select5(import_block_editor101.store).getSelectedBlock();
      if (selectedBlock?.name !== "core/post-date") {
        return [];
      }
      if (!context || !context.postId || !context.postType) {
        return [];
      }
      return postDataFields;
    }
  };

  // packages/editor/build-module/bindings/post-meta.mjs
  var import_core_data123 = __toESM(require_core_data(), 1);
  function getPostMetaFields(select5, context) {
    const { getRegisteredPostMeta } = unlock(select5(import_core_data123.store));
    const registeredFields = getRegisteredPostMeta(context?.postType);
    const metaFields = [];
    Object.entries(registeredFields).forEach(([key, props]) => {
      if (key === "footnotes" || key.charAt(0) === "_") {
        return;
      }
      metaFields.push({
        label: props.title || key,
        args: { key },
        default: props.default,
        type: props.type
      });
    });
    return metaFields;
  }
  function getValue({ select: select5, context, args }) {
    const metaFields = getPostMetaFields(select5, context);
    const metaField = metaFields.find(
      (field) => field.args.key === args.key
    );
    if (!metaField) {
      return args.key;
    }
    if (!context?.postId) {
      return metaField.default || metaField.label || args.key;
    }
    const { getEditedEntityRecord } = select5(import_core_data123.store);
    const entityMetaValues = getEditedEntityRecord(
      "postType",
      context?.postType,
      context?.postId
    ).meta;
    return entityMetaValues?.[args.key] ?? metaField?.label ?? args.key;
  }
  var post_meta_default = {
    name: "core/post-meta",
    getValues({ select: select5, context, bindings }) {
      const newValues = {};
      for (const [attributeName, binding] of Object.entries(bindings)) {
        newValues[attributeName] = getValue({
          select: select5,
          context,
          args: binding.args
        });
      }
      return newValues;
    },
    setValues({ dispatch: dispatch6, context, bindings }) {
      const newMeta = {};
      Object.values(bindings).forEach(({ args, newValue }) => {
        newMeta[args.key] = newValue;
      });
      dispatch6(import_core_data123.store).editEntityRecord(
        "postType",
        context?.postType,
        context?.postId,
        {
          meta: newMeta
        }
      );
    },
    canUserEditValue({ select: select5, context, args }) {
      if (context?.query || context?.queryId) {
        return false;
      }
      if (!context?.postType) {
        return false;
      }
      const metaFields = getPostMetaFields(select5, context);
      const hasMatchingMetaField = metaFields.some(
        (field) => field.args.key === args.key
      );
      if (!hasMatchingMetaField) {
        return false;
      }
      const areCustomFieldsEnabled = select5(store).getEditorSettings().enableCustomFields;
      if (areCustomFieldsEnabled) {
        return false;
      }
      const canUserEdit = select5(import_core_data123.store).canUser("update", {
        kind: "postType",
        name: context?.postType,
        id: context?.postId
      });
      if (!canUserEdit) {
        return false;
      }
      return true;
    },
    getFieldsList({ select: select5, context }) {
      const metaFields = getPostMetaFields(select5, context);
      return metaFields.map(
        ({ default: defaultProp, ...otherProps }) => ({
          ...otherProps
        })
      );
    }
  };

  // packages/editor/build-module/bindings/term-data.mjs
  var import_i18n229 = __toESM(require_i18n(), 1);
  var import_core_data124 = __toESM(require_core_data(), 1);
  var import_block_editor102 = __toESM(require_block_editor(), 1);
  var NAVIGATION_BLOCK_TYPES2 = [
    "core/navigation-link",
    "core/navigation-submenu"
  ];
  var termDataFields = [
    {
      label: (0, import_i18n229.__)("Term ID"),
      args: { field: "id" },
      type: "string"
    },
    {
      label: (0, import_i18n229.__)("Name"),
      args: { field: "name" },
      type: "string"
    },
    {
      label: (0, import_i18n229.__)("Slug"),
      args: { field: "slug" },
      type: "string"
    },
    {
      label: (0, import_i18n229.__)("Link"),
      args: { field: "link" },
      type: "string"
    },
    {
      label: (0, import_i18n229.__)("Description"),
      args: { field: "description" },
      type: "string"
    },
    {
      label: (0, import_i18n229.__)("Parent ID"),
      args: { field: "parent" },
      type: "string"
    },
    {
      label: (0, import_i18n229.__)("Count"),
      args: { field: "count" },
      type: "string"
    }
  ];
  var term_data_default = {
    name: "core/term-data",
    usesContext: ["taxonomy", "termId", "termData"],
    getValues({ select: select5, context, bindings, clientId }) {
      const { getEntityRecord } = select5(import_core_data124.store);
      const { getBlockAttributes: getBlockAttributes2, getBlockName: getBlockName2 } = select5(import_block_editor102.store);
      const blockName = getBlockName2(clientId);
      const isNavigationBlock = NAVIGATION_BLOCK_TYPES2.includes(blockName);
      let termDataValues;
      if (isNavigationBlock) {
        const blockAttributes = getBlockAttributes2(clientId);
        const typeFromAttributes = blockAttributes?.type;
        const taxonomy = typeFromAttributes === "tag" ? "post_tag" : typeFromAttributes;
        termDataValues = getEntityRecord(
          "taxonomy",
          taxonomy,
          blockAttributes?.id
        );
      } else if (context.termId && context.taxonomy) {
        termDataValues = getEntityRecord(
          "taxonomy",
          context.taxonomy,
          context.termId
        );
      }
      if (!termDataValues && context?.termData && !isNavigationBlock) {
        termDataValues = context.termData;
      }
      const newValues = {};
      for (const [attributeName, binding] of Object.entries(bindings)) {
        const termDataField = termDataFields.find(
          (field) => field.args.field === binding.args.field
        );
        if (!termDataField) {
          newValues[attributeName] = binding.args.field;
        } else if (!termDataValues || termDataValues[binding.args.field] === void 0) {
          newValues[attributeName] = termDataField.label;
        } else if (binding.args.field === "count") {
          newValues[attributeName] = "(" + termDataValues[binding.args.field] + ")";
        } else {
          newValues[attributeName] = termDataValues[binding.args.field];
        }
      }
      return newValues;
    },
    // eslint-disable-next-line no-unused-vars
    setValues({ dispatch: dispatch6, context, bindings }) {
      return false;
    },
    canUserEditValue({ select: select5, context }) {
      const { getBlockName: getBlockName2, getSelectedBlockClientId: getSelectedBlockClientId2 } = select5(import_block_editor102.store);
      const clientId = getSelectedBlockClientId2();
      const blockName = getBlockName2(clientId);
      if (NAVIGATION_BLOCK_TYPES2.includes(blockName)) {
        return false;
      }
      if (context?.termQuery) {
        return false;
      }
      if (!context?.taxonomy || !context?.termId) {
        return false;
      }
      return false;
    },
    getFieldsList({ context, select: select5 }) {
      const { getBlockAttributes: getBlockAttributes2, getBlockName: getBlockName2, getSelectedBlockClientId: getSelectedBlockClientId2 } = select5(import_block_editor102.store);
      const clientId = getSelectedBlockClientId2();
      const blockName = getBlockName2(clientId);
      if (NAVIGATION_BLOCK_TYPES2.includes(blockName)) {
        const blockAttributes = getBlockAttributes2(clientId);
        if (!blockAttributes || !blockAttributes.id || !blockAttributes.type) {
          return [];
        }
        return termDataFields;
      }
      if (!context) {
        return [];
      }
      if (context.taxonomy && context.termId || context.termData) {
        return termDataFields;
      }
      return [];
    }
  };

  // packages/editor/build-module/bindings/api.mjs
  function registerCoreBlockBindingsSources() {
    (0, import_blocks38.registerBlockBindingsSource)(pattern_overrides_default);
    (0, import_blocks38.registerBlockBindingsSource)(post_data_default);
    (0, import_blocks38.registerBlockBindingsSource)(post_meta_default);
    (0, import_blocks38.registerBlockBindingsSource)(term_data_default);
  }

  // packages/editor/build-module/private-apis.mjs
  var { store: interfaceStore, ...remainingInterfaceApis } = build_module_exports;
  var privateApis3 = {};
  lock(privateApis3, {
    CreateTemplatePartModal,
    patternTitleField: pattern_title_default,
    templateTitleField: template_title_default,
    BackButton: back_button_default,
    EntitiesSavedStatesExtensible,
    Editor: editor_default,
    PluginPostExcerpt: plugin_default,
    PostCardPanel,
    PreferencesModal: EditorPreferencesModal,
    usePostActions,
    usePostFields: post_fields_default,
    ToolsMoreMenuGroup: tools_more_menu_group_default,
    ViewMoreMenuGroup: view_more_menu_group_default,
    ResizableEditor: resizable_editor_default,
    registerCoreBlockBindingsSources,
    getTemplateInfo,
    // Global Styles
    GlobalStylesUIWrapper,
    GlobalStylesActionMenu,
    StyleBookPreview,
    useGlobalStyles,
    useStyle: useStyle2,
    // Block selection
    useGenerateBlockPath,
    useRestoreBlockFromPath,
    // This is a temporary private API while we're updating the site editor to use EditorProvider.
    interfaceStore,
    ...remainingInterfaceApis
  });

  // packages/editor/build-module/dataviews/api.mjs
  var import_data234 = __toESM(require_data(), 1);
  function registerEntityAction2(kind, name2, config) {
    const { registerEntityAction: _registerEntityAction } = unlock(
      (0, import_data234.dispatch)(store)
    );
    if (true) {
      _registerEntityAction(kind, name2, config);
    }
  }
  function unregisterEntityAction2(kind, name2, actionId) {
    const { unregisterEntityAction: _unregisterEntityAction } = unlock(
      (0, import_data234.dispatch)(store)
    );
    if (true) {
      _unregisterEntityAction(kind, name2, actionId);
    }
  }
  function registerEntityField2(kind, name2, config) {
    const { registerEntityField: _registerEntityField } = unlock(
      (0, import_data234.dispatch)(store)
    );
    if (true) {
      _registerEntityField(kind, name2, config);
    }
  }
  function unregisterEntityField2(kind, name2, fieldId) {
    const { unregisterEntityField: _unregisterEntityField } = unlock(
      (0, import_data234.dispatch)(store)
    );
    if (true) {
      _unregisterEntityField(kind, name2, fieldId);
    }
  }

  // packages/editor/build-module/index.mjs
  var import_block_editor103 = __toESM(require_block_editor(), 1);
  return __toCommonJS(index_exports);
})();
/*! Bundled license information:

react-is/cjs/react-is.development.js:
  (** @license React v16.13.1
   * react-is.development.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

object-assign/index.js:
  (*
  object-assign
  (c) Sindre Sorhus
  @license MIT
  *)

autosize/dist/autosize.js:
  (*!
  	autosize 4.0.2
  	license: MIT
  	http://www.jacklmoore.com/autosize
  *)

is-plain-object/dist/is-plain-object.mjs:
  (*!
   * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
   *
   * Copyright (c) 2014-2017, Jon Schlinkert.
   * Released under the MIT License.
   *)
*/
//# sourceMappingURL=index.js.map