"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 = (to2, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to2, key) && key !== except) __defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to2; }; 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; } }); // 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/media-utils var require_media_utils = __commonJS({ "package-external:@wordpress/media-utils"(exports, module) { module.exports = window.wp.mediaUtils; } }); // 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; } }); // vendor-external:react var require_react = __commonJS({ "vendor-external:react"(exports, module) { module.exports = window.React; } }); // vendor-external:react-dom var require_react_dom = __commonJS({ "vendor-external:react-dom"(exports, module) { module.exports = window.ReactDOM; } }); // 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(match3) { return characterMap[match3]; } 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; } }); // node_modules/diff/lib/diff/base.js var require_base = __commonJS({ "node_modules/diff/lib/diff/base.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = Diff; function Diff() { } Diff.prototype = { /*istanbul ignore start*/ /*istanbul ignore end*/ diff: function diff(oldString, newString) { var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; var callback = options.callback; if (typeof options === "function") { callback = options; options = {}; } this.options = options; var self = this; function done(value) { if (callback) { setTimeout(function() { callback(void 0, value); }, 0); return true; } else { return value; } } oldString = this.castInput(oldString); newString = this.castInput(newString); oldString = this.removeEmpty(this.tokenize(oldString)); newString = this.removeEmpty(this.tokenize(newString)); var newLen = newString.length, oldLen = oldString.length; var editLength = 1; var maxEditLength = newLen + oldLen; var bestPath = [{ newPos: -1, components: [] }]; var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { return done([{ value: this.join(newString), count: newString.length }]); } function execEditLength() { for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { var basePath = ( /*istanbul ignore start*/ void 0 ); var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; if (addPath) { bestPath[diagonalPath - 1] = void 0; } var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; if (!canAdd && !canRemove) { bestPath[diagonalPath] = void 0; continue; } if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { basePath = clonePath(removePath); self.pushComponent(basePath.components, void 0, true); } else { basePath = addPath; basePath.newPos++; self.pushComponent(basePath.components, true, void 0); } _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); } else { bestPath[diagonalPath] = basePath; } } editLength++; } if (callback) { (function exec() { setTimeout(function() { if (editLength > maxEditLength) { return callback(); } if (!execEditLength()) { exec(); } }, 0); })(); } else { while (editLength <= maxEditLength) { var ret = execEditLength(); if (ret) { return ret; } } } }, /*istanbul ignore start*/ /*istanbul ignore end*/ pushComponent: function pushComponent(components, added, removed) { var last = components[components.length - 1]; if (last && last.added === added && last.removed === removed) { components[components.length - 1] = { count: last.count + 1, added, removed }; } else { components.push({ count: 1, added, removed }); } }, /*istanbul ignore start*/ /*istanbul ignore end*/ extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0; while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { newPos++; oldPos++; commonCount++; } if (commonCount) { basePath.components.push({ count: commonCount }); } basePath.newPos = newPos; return oldPos; }, /*istanbul ignore start*/ /*istanbul ignore end*/ equals: function equals(left, right) { if (this.options.comparator) { return this.options.comparator(left, right); } else { return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); } }, /*istanbul ignore start*/ /*istanbul ignore end*/ removeEmpty: function removeEmpty(array) { var ret = []; for (var i3 = 0; i3 < array.length; i3++) { if (array[i3]) { ret.push(array[i3]); } } return ret; }, /*istanbul ignore start*/ /*istanbul ignore end*/ castInput: function castInput(value) { return value; }, /*istanbul ignore start*/ /*istanbul ignore end*/ tokenize: function tokenize(value) { return value.split(""); }, /*istanbul ignore start*/ /*istanbul ignore end*/ join: function join(chars) { return chars.join(""); } }; function buildValues(diff, components, newString, oldString, useLongestToken) { var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0; for (; componentPos < componentLen; componentPos++) { var component = components[componentPos]; if (!component.removed) { if (!component.added && useLongestToken) { var value = newString.slice(newPos, newPos + component.count); value = value.map(function(value2, i3) { var oldValue = oldString[oldPos + i3]; return oldValue.length > value2.length ? oldValue : value2; }); component.value = diff.join(value); } else { component.value = diff.join(newString.slice(newPos, newPos + component.count)); } newPos += component.count; if (!component.added) { oldPos += component.count; } } else { component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); oldPos += component.count; if (componentPos && components[componentPos - 1].added) { var tmp = components[componentPos - 1]; components[componentPos - 1] = components[componentPos]; components[componentPos] = tmp; } } } var lastComponent = components[componentLen - 1]; if (componentLen > 1 && typeof lastComponent.value === "string" && (lastComponent.added || lastComponent.removed) && diff.equals("", lastComponent.value)) { components[componentLen - 2].value += lastComponent.value; components.pop(); } return components; } function clonePath(path) { return { newPos: path.newPos, components: path.components.slice(0) }; } } }); // node_modules/diff/lib/diff/array.js var require_array = __commonJS({ "node_modules/diff/lib/diff/array.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.diffArrays = diffArrays3; exports.arrayDiff = void 0; var _base = _interopRequireDefault(require_base()); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var arrayDiff = new /*istanbul ignore start*/ _base.default(); exports.arrayDiff = arrayDiff; arrayDiff.tokenize = function(value) { return value.slice(); }; arrayDiff.join = arrayDiff.removeEmpty = function(value) { return value; }; function diffArrays3(oldArr, newArr, callback) { return arrayDiff.diff(oldArr, newArr, callback); } } }); // node_modules/diff/lib/util/params.js var require_params = __commonJS({ "node_modules/diff/lib/util/params.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateOptions = generateOptions; function generateOptions(options, defaults2) { if (typeof options === "function") { defaults2.callback = options; } else if (options) { for (var name2 in options) { if (options.hasOwnProperty(name2)) { defaults2[name2] = options[name2]; } } } return defaults2; } } }); // node_modules/diff/lib/diff/word.js var require_word = __commonJS({ "node_modules/diff/lib/diff/word.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.diffWords = diffWords3; exports.diffWordsWithSpace = diffWordsWithSpace; exports.wordDiff = void 0; var _base = _interopRequireDefault(require_base()); var _params = require_params(); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; var reWhitespace = /\S/; var wordDiff = new /*istanbul ignore start*/ _base.default(); exports.wordDiff = wordDiff; wordDiff.equals = function(left, right) { if (this.options.ignoreCase) { left = left.toLowerCase(); right = right.toLowerCase(); } return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); }; wordDiff.tokenize = function(value) { var tokens = value.split(/(\s+|[()[\]{}'"]|\b)/); for (var i3 = 0; i3 < tokens.length - 1; i3++) { if (!tokens[i3 + 1] && tokens[i3 + 2] && extendedWordChars.test(tokens[i3]) && extendedWordChars.test(tokens[i3 + 2])) { tokens[i3] += tokens[i3 + 2]; tokens.splice(i3 + 1, 2); i3--; } } return tokens; }; function diffWords3(oldStr, newStr, options) { options = /*istanbul ignore start*/ (0, /*istanbul ignore end*/ /*istanbul ignore start*/ _params.generateOptions)(options, { ignoreWhitespace: true }); return wordDiff.diff(oldStr, newStr, options); } function diffWordsWithSpace(oldStr, newStr, options) { return wordDiff.diff(oldStr, newStr, options); } } }); // package-external:@wordpress/block-serialization-default-parser var require_block_serialization_default_parser = __commonJS({ "package-external:@wordpress/block-serialization-default-parser"(exports, module) { module.exports = window.wp.blockSerializationDefaultParser; } }); // 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/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/upload-media var require_upload_media = __commonJS({ "package-external:@wordpress/upload-media"(exports, module) { module.exports = window.wp.uploadMedia; } }); // 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; } }); // package-external:@wordpress/dom var require_dom = __commonJS({ "package-external:@wordpress/dom"(exports, module) { module.exports = window.wp.dom; } }); // package-external:@wordpress/warning var require_warning = __commonJS({ "package-external:@wordpress/warning"(exports, module) { module.exports = window.wp.warning; } }); // 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 Fragment96 = 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 = Fragment96; 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 to2 = 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)) { to2[key] = from[key]; } } if (getOwnPropertySymbols) { symbols = getOwnPropertySymbols(from); for (var i3 = 0; i3 < symbols.length; i3++) { if (propIsEnumerable.call(from, symbols[i3])) { to2[symbols[i3]] = from[symbols[i3]]; } } } } return to2; }; } }); // 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 message2 = "Warning: " + text; if (typeof console !== "undefined") { console.error(message2); } try { throw new Error(message2); } 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 assign2 = require_object_assign(); var ReactPropTypesSecret = require_ReactPropTypesSecret(); var has = require_has(); var checkPropTypes = require_checkPropTypes(); var printWarning = function() { }; if (true) { printWarning = function(text) { var message2 = "Warning: " + text; if (typeof console !== "undefined") { console.error(message2); } try { throw new Error(message2); } catch (x2) { } }; } function emptyFunctionThatReturnsNull() { return null; } module.exports = function(isValidElement2, 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 = "<>"; 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 is2(x2, y3) { if (x2 === y3) { return x2 !== 0 || 1 / x2 === 1 / y3; } else { return x2 !== x2 && y3 !== y3; } } function PropTypeError(message2, data) { this.message = message2; 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 cacheKey2 = componentName + ":" + propName; if (!manualPropTypeCallCache[cacheKey2] && // 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[cacheKey2] = 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 (!isValidElement2(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 (is2(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 = assign2({}, 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 || isValidElement2(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 assign2(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; } update5(); } 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 update5() { 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) { update5(); } }; var destroy2 = function(style) { window.removeEventListener("resize", pageResize, false); ta.removeEventListener("input", update5, false); ta.removeEventListener("keyup", update5, false); ta.removeEventListener("autosize:destroy", destroy2, false); ta.removeEventListener("autosize:update", update5, 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", update5, false); } window.addEventListener("resize", pageResize, false); ta.addEventListener("input", update5, false); ta.addEventListener("autosize:update", update5, false); ta.style.overflowX = "hidden"; ta.style.wordWrap = "break-word"; map.set(ta, { destroy: destroy2, update: update5 }); init(); } function destroy(ta) { var methods = map.get(ta); if (methods) { methods.destroy(); } } function update4(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 assign2(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], update4); } 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 = " "; 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 __268() { this.constructor = d3; } d3.prototype = b3 === null ? Object.create(b3) : (__268.prototype = b3.prototype, new __268()); }; })(); 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 React8 = 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 React8.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; })(React8.Component) ); exports.TextareaAutosize = React8.forwardRef(function(props, ref) { return React8.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; } }); // 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: () => cleanForSlug2, createCustomColorsHOC: () => createCustomColorsHOC, getColorClassName: () => getColorClassName2, getColorObjectByAttributeValues: () => getColorObjectByAttributeValues, getColorObjectByColorValue: () => getColorObjectByColorValue, getFontSize: () => getFontSize, getFontSizeClass: () => getFontSizeClass, getTemplatePartIcon: () => getTemplatePartIcon, mediaUpload: () => mediaUpload, privateApis: () => privateApis18, registerEntityAction: () => registerEntityAction2, registerEntityField: () => registerEntityField2, store: () => store, storeConfig: () => storeConfig, transformStyles: () => import_block_editor105.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_data73 = __toESM(require_data(), 1); var import_core_data54 = __toESM(require_core_data(), 1); var import_element82 = __toESM(require_element(), 1); var import_compose16 = __toESM(require_compose(), 1); var import_hooks39 = __toESM(require_hooks(), 1); // packages/editor/build-module/store/index.mjs var import_data72 = __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; } function revisionId(state = null, action) { switch (action.type) { case "SET_CURRENT_REVISION_ID": return action.revisionId; } return state; } function revisionPage(state = 1, action) { switch (action.type) { case "SET_REVISION_PAGE": return action.page; case "SET_CURRENT_REVISION_ID": if (!action.revisionId) { return 1; } return state; } return state; } function showRevisionDiff(state = true, action) { switch (action.type) { case "SET_SHOW_REVISION_DIFF": return action.showDiff; case "SET_CURRENT_REVISION_ID": return !action.revisionId ? true : state; } return state; } function selectedNote(state = {}, action) { switch (action.type) { case "SELECT_NOTE": return { noteId: action.noteId, options: action.options }; } 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, revisionId, revisionPage, showRevisionDiff, selectedNote, 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 ATTACHMENT_POST_TYPE = "attachment"; 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, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", 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, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", 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, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", 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-down.mjs var import_primitives8 = __toESM(require_primitives(), 1); var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); var chevron_down_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: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); // packages/icons/build-module/library/chevron-left-small.mjs var import_primitives9 = __toESM(require_primitives(), 1); var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); var chevron_left_small_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: "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_primitives10 = __toESM(require_primitives(), 1); var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); var chevron_left_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: "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_primitives11 = __toESM(require_primitives(), 1); var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); var chevron_right_small_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.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_primitives12 = __toESM(require_primitives(), 1); var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); var chevron_right_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: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); // packages/icons/build-module/library/chevron-up.mjs var import_primitives13 = __toESM(require_primitives(), 1); var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); var chevron_up_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: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); // packages/icons/build-module/library/close-small.mjs var import_primitives14 = __toESM(require_primitives(), 1); var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); var close_small_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: "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/close.mjs var import_primitives15 = __toESM(require_primitives(), 1); var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); var close_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.Path, { d: "m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z" }) }); // packages/icons/build-module/library/cloud-upload.mjs var import_primitives16 = __toESM(require_primitives(), 1); var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); var cloud_upload_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.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_primitives17 = __toESM(require_primitives(), 1); var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); var cloud_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, { 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_primitives18 = __toESM(require_primitives(), 1); var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); var code_default = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.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_primitives19 = __toESM(require_primitives(), 1); var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); var color_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, { 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_primitives20 = __toESM(require_primitives(), 1); var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); var comment_author_avatar_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, { fillRule: "evenodd", clipRule: "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" }) }); // packages/icons/build-module/library/comment.mjs var import_primitives21 = __toESM(require_primitives(), 1); var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); var comment_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 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_primitives22 = __toESM(require_primitives(), 1); var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); var copy_small_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: "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_primitives23 = __toESM(require_primitives(), 1); var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); var desktop_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, { 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_primitives24 = __toESM(require_primitives(), 1); var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); var download_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, { 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_primitives25 = __toESM(require_primitives(), 1); var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); var drafts_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, { 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_primitives26 = __toESM(require_primitives(), 1); var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); var drawer_left_default = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives26.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives26.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_primitives27 = __toESM(require_primitives(), 1); var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); var drawer_right_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", 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/envelope.mjs var import_primitives28 = __toESM(require_primitives(), 1); var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); var envelope_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M3 7c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Zm2-.5h14c.3 0 .5.2.5.5v1L12 13.5 4.5 7.9V7c0-.3.2-.5.5-.5Zm-.5 3.3V17c0 .3.2.5.5.5h14c.3 0 .5-.2.5-.5V9.8L12 15.4 4.5 9.8Z" }) }); // packages/icons/build-module/library/error.mjs var import_primitives29 = __toESM(require_primitives(), 1); var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); var error_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z" }) }); // packages/icons/build-module/library/external.mjs var import_primitives30 = __toESM(require_primitives(), 1); var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); var external_default = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives30.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives30.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_primitives31 = __toESM(require_primitives(), 1); var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); var file_default = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(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, { 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_primitives32 = __toESM(require_primitives(), 1); var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); var footer_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, { 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_primitives33 = __toESM(require_primitives(), 1); var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); var format_list_bullets_default = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives33.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives33.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_primitives34 = __toESM(require_primitives(), 1); var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); var header_default = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives34.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives34.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_primitives35 = __toESM(require_primitives(), 1); var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); var info_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, { 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_primitives36 = __toESM(require_primitives(), 1); var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); var keyboard_default = /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(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: "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_runtime36.jsx)(import_primitives36.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_primitives37 = __toESM(require_primitives(), 1); var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); var layout_default = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives37.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives37.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/link.mjs var import_primitives38 = __toESM(require_primitives(), 1); var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); var link_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: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) }); // packages/icons/build-module/library/list-view.mjs var import_primitives39 = __toESM(require_primitives(), 1); var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); var list_view_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, { d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) }); // packages/icons/build-module/library/lock-small.mjs var import_primitives40 = __toESM(require_primitives(), 1); var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); var lock_small_default = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(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, { 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_primitives41 = __toESM(require_primitives(), 1); var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); var mobile_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: "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_primitives42 = __toESM(require_primitives(), 1); var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); var more_vertical_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, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); // packages/icons/build-module/library/navigation-overlay.mjs var import_primitives43 = __toESM(require_primitives(), 1); var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); var navigation_overlay_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: "M18.5 10a1.5 1.5 0 0 1 1.5 1.5v7a1.5 1.5 0 0 1-1.5 1.5h-7a1.5 1.5 0 0 1-1.5-1.5v-7a1.5 1.5 0 0 1 1.5-1.5zM16 4a2 2 0 0 1 2 2v2h-1.5V6a.5.5 0 0 0-.5-.5H6a.5.5 0 0 0-.5.5v3H8v1.5H5.5V16a.5.5 0 0 0 .5.5h2V18H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z" }) }); // packages/icons/build-module/library/navigation.mjs var import_primitives44 = __toESM(require_primitives(), 1); var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); var navigation_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: "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_primitives45 = __toESM(require_primitives(), 1); var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); var next_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, { 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_primitives46 = __toESM(require_primitives(), 1); var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); var not_allowed_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, { 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_primitives47 = __toESM(require_primitives(), 1); var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); var page_default = /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(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: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }), /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives47.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_primitives48 = __toESM(require_primitives(), 1); var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); var pencil_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: "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_primitives49 = __toESM(require_primitives(), 1); var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); var pending_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, { 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_primitives50 = __toESM(require_primitives(), 1); var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); var plus_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, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); // packages/icons/build-module/library/previous.mjs var import_primitives51 = __toESM(require_primitives(), 1); var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); var previous_default = /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives51.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives51.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_primitives52 = __toESM(require_primitives(), 1); var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); var published_default = /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(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, { 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_primitives53 = __toESM(require_primitives(), 1); var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); var redo_default = /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives53.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives53.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_primitives54 = __toESM(require_primitives(), 1); var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); var reset_default = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives54.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives54.Path, { d: "M7 11.5h10V13H7z" }) }); // packages/icons/build-module/library/rotate-left.mjs var import_primitives55 = __toESM(require_primitives(), 1); var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); var rotate_left_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: "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_primitives56 = __toESM(require_primitives(), 1); var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); var rotate_right_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, { 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_primitives57 = __toESM(require_primitives(), 1); var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); var scheduled_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", 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_primitives58 = __toESM(require_primitives(), 1); var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); var seen_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: "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_primitives59 = __toESM(require_primitives(), 1); var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); var settings_default = /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_primitives59.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_primitives59.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_runtime59.jsx)(import_primitives59.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_primitives60 = __toESM(require_primitives(), 1); var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); var shadow_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: "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_primitives61 = __toESM(require_primitives(), 1); var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); var shuffle_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: "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_primitives62 = __toESM(require_primitives(), 1); var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); var sidebar_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: "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_primitives63 = __toESM(require_primitives(), 1); var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); var square_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, { 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_primitives64 = __toESM(require_primitives(), 1); var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); var star_empty_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: "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" }) }); // packages/icons/build-module/library/star-filled.mjs var import_primitives65 = __toESM(require_primitives(), 1); var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); var star_filled_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: "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_primitives66 = __toESM(require_primitives(), 1); var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); var styles_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, { 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_primitives67 = __toESM(require_primitives(), 1); var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); var symbol_filled_default = /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_primitives67.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_primitives67.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_primitives68 = __toESM(require_primitives(), 1); var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1); var symbol_default = /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_primitives68.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_primitives68.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/tablet.mjs var import_primitives69 = __toESM(require_primitives(), 1); var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1); var tablet_default = /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_primitives69.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_primitives69.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_primitives70 = __toESM(require_primitives(), 1); var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1); var trash_default = /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_primitives70.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_primitives70.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_primitives71 = __toESM(require_primitives(), 1); var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1); var typography_default = /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_primitives71.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_primitives71.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_primitives72 = __toESM(require_primitives(), 1); var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1); var undo_default = /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_primitives72.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_primitives72.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/unseen.mjs var import_primitives73 = __toESM(require_primitives(), 1); var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1); var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_primitives73.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_primitives73.Path, { d: "M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z" }) }); // packages/icons/build-module/library/verse.mjs var import_primitives74 = __toESM(require_primitives(), 1); var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1); var verse_default = /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_primitives74.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_primitives74.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_primitives75 = __toESM(require_primitives(), 1); var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1); var video_default = /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_primitives75.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_primitives75.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_primitives76 = __toESM(require_primitives(), 1); var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1); var wordpress_default = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_primitives76.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_primitives76.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 ("navigation-overlay" === areaOrIconName) { return navigation_overlay_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)((select6) => () => { return select6(import_core_data.store).hasUndo(); }); var hasEditorRedo = (0, import_data3.createRegistrySelector)((select6) => () => { return select6(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)( (select6) => (state) => { const postType2 = getCurrentPostType(state); const postId2 = getCurrentPostId(state); return select6(import_core_data.store).hasEditsForEntityRecord( "postType", postType2, postId2 ); } ); var hasNonPostEntityChanges = (0, import_data3.createRegistrySelector)( (select6) => (state) => { const dirtyEntityRecords = select6(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)( (select6) => (state) => { const postId2 = getCurrentPostId(state); const postType2 = getCurrentPostType(state); const post2 = select6(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)((select6) => (state) => { const postType2 = getCurrentPostType(state); const postId2 = getCurrentPostId(state); return select6(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)( (select6) => (state, attributeName) => { if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== "preview_link") { return; } const postType2 = getCurrentPostType(state); const postId2 = getCurrentPostId(state); const currentUserId = select6(import_core_data.store).getCurrentUser()?.id; const autosave2 = select6(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); if (post2.type === ATTACHMENT_POST_TYPE) { return isEditedPostDirty(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)( (select6) => (state) => { const postId2 = getCurrentPostId(state); const postType2 = getCurrentPostType(state); const record = select6(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)( (select6) => (state) => { if (!isEditedPostSaveable(state)) { return false; } if (isPostAutosavingLocked(state)) { return false; } const postType2 = getCurrentPostType(state); const postTypeObject = select6(import_core_data.store).getPostType(postType2); if (!postTypeObject?.supports?.autosave) { return false; } const postId2 = getCurrentPostId(state); const hasFetchedAutosave = select6(import_core_data.store).hasFetchedAutosaves( postType2, postId2 ); const currentUserId = select6(import_core_data.store).getCurrentUser()?.id; const autosave2 = select6(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)( (select6) => (state) => { const entitiesBeingSaved = select6(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)( (select6) => (state) => { const postType2 = getCurrentPostType(state); const postId2 = getCurrentPostId(state); return !select6(import_core_data.store).getLastEntitySaveError( "postType", postType2, postId2 ); } ); var didPostSaveRequestFail = (0, import_data3.createRegistrySelector)( (select6) => (state) => { const postType2 = getCurrentPostType(state); const postId2 = getCurrentPostId(state); return !!select6(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)( (select6) => () => { const blocks = select6(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)( (select6) => (state) => { const postId2 = getCurrentPostId(state); const postType2 = getCurrentPostType(state); const record = select6(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: prefix2, postName, suffix } = permalinkParts; if (isPermalinkEditable(state)) { return prefix2 + postName + suffix; } return prefix2; } 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 [prefix2, suffix] = permalinkTemplate.split( PERMALINK_POSTNAME_REGEX ); return { prefix: prefix2, 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)( (select6) => () => !!select6(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)( (select6) => (state, panelName) => { const inactivePanels = select6(import_preferences.store).get( "core", "inactivePanels" ); return !isEditorPanelRemoved(state, panelName) && !inactivePanels?.includes(panelName); } ); var isEditorPanelOpened = (0, import_data3.createRegistrySelector)( (select6) => (state, panelName) => { const openPanels = select6(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)( (select6) => (state) => { const isZoomOut = unlock(select6(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)( (select6) => () => select6(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)((select6) => (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 select6(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)( (select6) => () => { (0, import_deprecated.default)( "select('core/editor').__experimentalGetDefaultTemplateTypes", { since: "6.8", alternative: "select('core/core-data').getCurrentTheme()?.default_template_types" } ); return select6(import_core_data.store).getCurrentTheme()?.default_template_types; } ); var __experimentalGetDefaultTemplatePartAreas = (0, import_data3.createRegistrySelector)( (select6) => (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 = select6(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)( (select6) => (0, import_data3.createSelector)((state, slug) => { (0, import_deprecated.default)( "select('core/editor').__experimentalGetDefaultTemplateType", { since: "6.8" } ); const templateTypes = select6(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)( (select6) => (0, import_data3.createSelector)((state, template2) => { (0, import_deprecated.default)("select('core/editor').__experimentalGetTemplateInfo", { since: "6.8" }); if (!template2) { return EMPTY_OBJECT2; } const currentTheme = select6(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)( (select6) => (state) => { const currentPostType = getCurrentPostType(state); const postType2 = select6(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 (post2.type === ATTACHMENT_POST_TYPE) { noticeMessage = (0, import_i18n.__)("Media updated."); 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: dispatch7 }) => { dispatch7.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); dispatch7.resetEditorBlocks(blocks, { __unstableShouldCreateUndoLevel: false }); } if (edits && Object.entries(edits).some( ([key, edit]) => edit !== (post2[key]?.raw ?? post2[key]) )) { dispatch7.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: select6, registry }) => { const { id, type } = select6.getCurrentPost(); registry.dispatch(import_core_data2.store).editEntityRecord("postType", type, id, edits, options); }; var savePost = (options = {}) => async ({ select: select6, dispatch: dispatch7, registry }) => { if (!select6.isEditedPostSaveable()) { return; } const content = select6.getEditedPostContent(); if (!options.isAutosave) { dispatch7.editPost({ content }, { undoIgnore: true }); } const previousRecord = select6.getCurrentPost(); let edits = { id: previousRecord.id, ...registry.select(import_core_data2.store).getEntityRecordNonTransientEdits( "postType", previousRecord.type, previousRecord.id ), content }; dispatch7({ 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; } } dispatch7({ 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: select6, dispatch: dispatch7, registry }); } if (error) { const args = getNotificationArgumentsForSaveFail({ post: previousRecord, edits, error }); if (args.length) { registry.dispatch(import_notices.store).createErrorNotice(...args); } } else { const updatedRecord = select6.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: select6, registry }) { const editorSettings2 = select6.getEditorSettings(); if (editorSettings2.onNavigateToPreviousEntityRecord) { return; } const { id, slug } = select6.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: select6, dispatch: dispatch7, registry }) => { const postTypeSlug = select6.getCurrentPostType(); const postType2 = await registry.resolveSelect(import_core_data2.store).getPostType(postTypeSlug); const { rest_base: restBase, rest_namespace: restNamespace = "wp/v2" } = postType2; dispatch7({ type: "REQUEST_POST_DELETE_START" }); try { const post2 = select6.getCurrentPost(); await (0, import_api_fetch.default)({ path: `/${restNamespace}/${restBase}/${post2.id}`, method: "DELETE" }); await dispatch7.savePost(); } catch (error) { registry.dispatch(import_notices.store).createErrorNotice( ...getNotificationArgumentsForTrashFail({ error }) ); } dispatch7({ type: "REQUEST_POST_DELETE_FINISH" }); }; var autosave = ({ local = false, ...options } = {}) => async ({ select: select6, dispatch: dispatch7 }) => { const post2 = select6.getCurrentPost(); if (local) { const isPostNew = select6.isEditedPostNew(); const title = select6.getEditedPostAttribute("title"); const content = select6.getEditedPostAttribute("content"); const excerpt = select6.getEditedPostAttribute("excerpt"); localAutosaveSet(post2.id, isPostNew, title, content, excerpt); } else { await dispatch7.savePost({ isAutosave: true, ...options }); } }; var __unstableSaveForPreview = ({ forceIsAutosaveable } = {}) => async ({ select: select6, dispatch: dispatch7 }) => { if ((forceIsAutosaveable || select6.isEditedPostAutosaveable()) && !select6.isPostLocked()) { const isDraft = ["draft", "auto-draft"].includes( select6.getEditedPostAttribute("status") ); if (isDraft) { await dispatch7.savePost({ isPreview: true }); } else { await dispatch7.autosave({ isPreview: true }); } } return select6.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(lock5) { return { type: "UPDATE_POST_LOCK", lock: lock5 }; } 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: select6, dispatch: dispatch7, registry }) => { const { __unstableShouldCreateUndoLevel, selection } = options; const edits = { blocks, selection }; if (__unstableShouldCreateUndoLevel !== false) { const { id, type } = select6.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); } dispatch7.editPost(edits); }; function updateEditorSettings(settings) { return { type: "UPDATE_EDITOR_SETTINGS", settings }; } var setRenderingMode = (mode) => ({ dispatch: dispatch7, registry, select: select6 }) => { if (select6.__unstableIsEditorReady() && !select6.getEditorSettings().isPreviewMode) { registry.dispatch(import_block_editor3.store).clearSelectedBlock(); } dispatch7({ 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: dispatch7, 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 }); } dispatch7({ type: "SET_IS_INSERTER_OPENED", value }); }; function setIsListViewOpened(isOpen) { return { type: "SET_IS_LIST_VIEW_OPENED", isOpen }; } var toggleDistractionFree = ({ createNotice = true } = {}) => ({ dispatch: dispatch7, 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); dispatch7.setIsInserterOpened(false); dispatch7.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: dispatch7, 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) { dispatch7.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, restoreRevision: () => restoreRevision, revertTemplate: () => revertTemplate2, saveDirtyEntities: () => saveDirtyEntities, selectNote: () => selectNote, setCanvasMinHeight: () => setCanvasMinHeight, setCurrentRevisionId: () => setCurrentRevisionId, setCurrentTemplateId: () => setCurrentTemplateId, setDefaultRenderingMode: () => setDefaultRenderingMode, setIsReady: () => setIsReady, setRevisionPage: () => setRevisionPage, setShowRevisionDiff: () => setShowRevisionDiff, setShowStylebook: () => setShowStylebook, setStylesPath: () => setStylesPath, showBlockTypes: () => showBlockTypes, unregisterEntityAction: () => unregisterEntityAction, unregisterEntityField: () => unregisterEntityField }); var import_core_data53 = __toESM(require_core_data(), 1); var import_i18n122 = __toESM(require_i18n(), 1); var import_notices17 = __toESM(require_notices(), 1); var import_block_editor35 = __toESM(require_block_editor(), 1); var import_preferences10 = __toESM(require_preferences(), 1); var import_url11 = __toESM(require_url(), 1); var import_api_fetch5 = __toESM(require_api_fetch(), 1); var import_blocks20 = __toESM(require_blocks(), 1); var import_html_entities9 = __toESM(require_html_entities(), 1); var import_date6 = __toESM(require_date(), 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/store/private-selectors.mjs var private_selectors_exports = {}; __export(private_selectors_exports, { buildRevisionsPageQuery: () => buildRevisionsPageQuery, getCanvasMinHeight: () => getCanvasMinHeight, getCurrentRevision: () => getCurrentRevision, getCurrentRevisionId: () => getCurrentRevisionId, getDefaultRenderingMode: () => getDefaultRenderingMode, getEntityActions: () => getEntityActions2, getEntityFields: () => getEntityFields2, getInserter: () => getInserter, getInserterSidebarToggleRef: () => getInserterSidebarToggleRef, getListViewToggleRef: () => getListViewToggleRef, getPageRevisions: () => getPageRevisions, getPostBlocksByName: () => getPostBlocksByName, getPostIcon: () => getPostIcon, getPreviousRevision: () => getPreviousRevision, getRevisionPage: () => getRevisionPage, getRevisionsPerPage: () => getRevisionsPerPage, getSelectedNote: () => getSelectedNote, getShowStylebook: () => getShowStylebook, getStylesPath: () => getStylesPath, hasPostMetaChanges: () => hasPostMetaChanges, isCollaborationEnabledForCurrentPost: () => isCollaborationEnabledForCurrentPost, isEntityReady: () => isEntityReady2, isNoteFocused: () => isNoteFocused, isRevisionsMode: () => isRevisionsMode, isShowingRevisionDiff: () => isShowingRevisionDiff }); var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1); var import_block_editor4 = __toESM(require_block_editor(), 1); var import_data5 = __toESM(require_data(), 1); var import_core_data4 = __toESM(require_core_data(), 1); var import_preferences3 = __toESM(require_preferences(), 1); // packages/editor/build-module/dataviews/store/private-selectors.mjs var EMPTY_ARRAY = []; function getEntityActions(state, kind, name2) { return state.actions[kind]?.[name2] ?? EMPTY_ARRAY; } function getEntityFields(state, kind, name2) { return state.fields[kind]?.[name2] ?? EMPTY_ARRAY; } function isEntityReady(state, kind, name2) { return state.isReady[kind]?.[name2]; } // 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_data4 = __toESM(require_data(), 1); var import_core_data3 = __toESM(require_core_data(), 1); var import_media_utils = __toESM(require_media_utils(), 1); var noop = () => { }; function mediaUpload({ additionalData = {}, allowedTypes, filesList, maxUploadFileSize, onError = noop, onFileChange, onSuccess, multiple = true }) { const { receiveEntityRecords } = (0, import_data4.dispatch)(import_core_data3.store); const { getCurrentPost: getCurrentPost2, getEditorSettings: getEditorSettings2 } = (0, import_data4.select)(store); const { lockPostAutosaving: lockPostAutosaving2, unlockPostAutosaving: unlockPostAutosaving2, lockPostSaving: lockPostSaving2, unlockPostSaving: unlockPostSaving2 } = (0, import_data4.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 = () => { if (window.__clientSideMediaProcessing) { return; } lockPostSaving2(lockKey); lockPostAutosaving2(lockKey); imageIsUploading = true; }; const postData = currentPostId ? { post: currentPostId } : {}; const clearSaveLock = () => { if (window.__clientSideMediaProcessing) { return; } unlockPostSaving2(lockKey); unlockPostAutosaving2(lockKey); imageIsUploading = false; }; (0, import_media_utils.uploadMedia)({ allowedTypes, filesList, onFileChange: (file) => { if (!window.__clientSideMediaProcessing) { 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: message2 }) => { if (!window.__clientSideMediaProcessing) { clearSaveLock(); } onError(message2); }, wpAllowedMimeTypes, multiple }); } // packages/editor/build-module/utils/url.mjs var import_url2 = __toESM(require_url(), 1); var import_deprecated3 = __toESM(require_deprecated(), 1); function cleanForSlug2(string) { (0, import_deprecated3.default)("wp.editor.cleanForSlug", { since: "12.7", plugin: "Gutenberg", alternative: "wp.url.cleanForSlug" }); return (0, import_url2.cleanForSlug)(string); } // 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_data5.createRegistrySelector)( (select6) => (0, import_data5.createSelector)( (state) => { if (typeof state.blockInserterPanel === "object") { return state.blockInserterPanel; } if (getRenderingMode(state) === "template-locked") { const { getBlocksByName, getSelectedBlockClientId: getSelectedBlockClientId2, getBlockParents, getBlockOrder: getBlockOrder2 } = select6(import_block_editor4.store); const [postContentClientId] = getBlocksByName("core/post-content"); if (postContentClientId) { const selectedBlockClientId = getSelectedBlockClientId2(); if (selectedBlockClientId && selectedBlockClientId !== postContentClientId && getBlockParents(selectedBlockClientId).includes( postContentClientId )) { return EMPTY_INSERTION_POINT; } return { rootClientId: postContentClientId, insertionIndex: getBlockOrder2(postContentClientId).length, filterValue: void 0 }; } } return EMPTY_INSERTION_POINT; }, (state) => { const { getBlocksByName, getSelectedBlockClientId: getSelectedBlockClientId2, getBlockParents, getBlockOrder: getBlockOrder2 } = select6(import_block_editor4.store); const [postContentClientId] = getBlocksByName("core/post-content"); const selectedBlockClientId = getSelectedBlockClientId2(); return [ state.blockInserterPanel, getRenderingMode(state), postContentClientId, selectedBlockClientId, selectedBlockClientId ? getBlockParents(selectedBlockClientId) : void 0, postContentClientId ? getBlockOrder2(postContentClientId).length : void 0 ]; } ) ); 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_data5.createRegistrySelector)( (select6) => (state, postType2, options) => { { if (postType2 === "wp_template_part" || postType2 === "wp_template") { const templateAreas = select6(import_core_data4.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 = select6(import_core_data4.store).getPostType(postType2); if (typeof postTypeEntity?.icon === "string" && postTypeEntity.icon.startsWith("dashicons-")) { return postTypeEntity.icon.slice(10); } return page_default; } } ); var hasPostMetaChanges = (0, import_data5.createRegistrySelector)( (select6) => (state, postType2, postId2) => { const { type: currentPostType, id: currentPostId } = getCurrentPost(state); const edits = select6(import_core_data4.store).getEntityRecordNonTransientEdits( "postType", postType2 || currentPostType, postId2 || currentPostId ); if (!edits?.meta) { return false; } const originalPostMeta = select6(import_core_data4.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_data5.createRegistrySelector)( (select6) => (0, import_data5.createSelector)( (state, blockNames) => { blockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; const { getBlocksByName, getBlockParents, getBlockName: getBlockName2 } = select6(import_block_editor4.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) ); }) ); }, (state, blockNames) => { blockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; const { getBlocksByName, getBlockParents } = select6(import_block_editor4.store); const clientIds = getBlocksByName(blockNames); const parentsOfClientIds = clientIds.map( (id) => getBlockParents(id) ); return [clientIds, ...parentsOfClientIds]; } ) ); var getDefaultRenderingMode = (0, import_data5.createRegistrySelector)( (select6) => (state, postType2) => { const { getPostType, getCurrentTheme, hasFinishedResolution } = select6(import_core_data4.store); const currentTheme = getCurrentTheme(); const postTypeEntity = getPostType(postType2); if (!hasFinishedResolution("getPostType", [postType2]) || !hasFinishedResolution("getCurrentTheme")) { return void 0; } const theme = currentTheme?.stylesheet; const defaultModePreference = select6(import_preferences3.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; } function getRevisionPage(state) { return state.revisionPage; } function buildRevisionsPageQuery(revisionKey, page) { return { per_page: REVISIONS_PER_PAGE, page, context: "edit", orderby: "date", order: "desc", _fields: [ .../* @__PURE__ */ new Set([ "id", "date", "modified", "author", "meta", "title.raw", "excerpt.raw", "content.raw", revisionKey ]) ].join() }; } var REVISIONS_PER_PAGE = 100; function getRevisionsPerPage() { return REVISIONS_PER_PAGE; } var getPageRevisions = (0, import_data5.createRegistrySelector)( (select6) => (state, page) => { if (!page) { return null; } const { type: postType2, id: postId2 } = getCurrentPost(state); if (!postType2 || !postId2) { return null; } const entityConfig = select6(import_core_data4.store).getEntityConfig( "postType", postType2 ); const revisionKey = entityConfig?.revisionKey || "id"; return select6(import_core_data4.store).getRevisions( "postType", postType2, postId2, buildRevisionsPageQuery(revisionKey, page) ); } ); function isRevisionsMode(state) { return state.revisionId !== null; } function isShowingRevisionDiff(state) { return state.showRevisionDiff; } function getCurrentRevisionId(state) { return state.revisionId; } var getCurrentRevision = (0, import_data5.createRegistrySelector)( (select6) => (state) => { const revisionId2 = getCurrentRevisionId(state); if (!revisionId2) { return void 0; } const page = getRevisionPage(state); if (!page) { return null; } const { type: postType2, id: postId2 } = getCurrentPost(state); const entityConfig = select6(import_core_data4.store).getEntityConfig( "postType", postType2 ); const revisionKey = entityConfig?.revisionKey || "id"; const revisions = select6(import_core_data4.store).getRevisions( "postType", postType2, postId2, buildRevisionsPageQuery(revisionKey, page) ); if (!revisions) { return null; } return revisions.find((r4) => r4[revisionKey] === revisionId2) ?? null; } ); function getSelectedNote(state) { return state.selectedNote?.noteId; } function isNoteFocused(state) { return !!state.selectedNote?.options?.focus; } var getPreviousRevision = (0, import_data5.createRegistrySelector)( (select6) => (state) => { const currentRevisionId = getCurrentRevisionId(state); if (!currentRevisionId) { return void 0; } const page = getRevisionPage(state); if (!page) { return null; } const { type: postType2, id: postId2 } = getCurrentPost(state); const entityConfig = select6(import_core_data4.store).getEntityConfig( "postType", postType2 ); const revisionKey = entityConfig?.revisionKey || "id"; const query = buildRevisionsPageQuery(revisionKey, page); const revisions = select6(import_core_data4.store).getRevisions( "postType", postType2, postId2, query ); if (!revisions) { return null; } const currentIndex = revisions.findIndex( (r4) => r4[revisionKey] === currentRevisionId ); if (currentIndex >= 0 && currentIndex < revisions.length - 1) { return revisions[currentIndex + 1]; } const totalRevisions = getCurrentPostRevisionsCount(state); const totalPages = Math.ceil(totalRevisions / query.per_page) || 1; if (currentIndex === revisions.length - 1 && page < totalPages) { const nextPageRevisions = select6(import_core_data4.store).getRevisions( "postType", postType2, postId2, buildRevisionsPageQuery(revisionKey, page + 1) ); return nextPageRevisions?.[0] ?? null; } return null; } ); var isCollaborationEnabledForCurrentPost = (0, import_data5.createRegistrySelector)( (select6) => (state) => { if (!unlock(select6(import_core_data4.store)).isCollaborationSupported()) { return false; } const currentPostType = getCurrentPostType(state); const entityConfig = select6(import_core_data4.store).getEntityConfig( "postType", currentPostType ); return Boolean( entityConfig?.syncConfig && window._wpCollaborationEnabled ); } ); // packages/editor/build-module/dataviews/store/private-actions.mjs var import_core_data52 = __toESM(require_core_data(), 1); var import_hooks38 = __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_data6 = __toESM(require_data(), 1); var import_element3 = __toESM(require_element(), 1); var import_notices2 = __toESM(require_notices(), 1); var import_url5 = __toESM(require_url(), 1); var import_i18n4 = __toESM(require_i18n(), 1); // packages/fields/build-module/fields/slug/utils.mjs var import_url4 = __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_url4.cleanForSlug)(getItemTitle(item)) || item.id.toString(); }; // packages/fields/build-module/fields/slug/slug-edit.mjs var import_jsx_runtime77 = __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 [prefix2, suffix] = permalinkTemplate.split( PERMALINK_POSTNAME_REGEX2 ); const permalinkPrefix = prefix2; 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_url5.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_data6.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_runtime77.jsxs)("fieldset", { className: "fields-controls__slug", children: [ isEditable && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_components.__experimentalVStack, { children: [ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_components.__experimentalVStack, { spacing: "0px", children: [ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { children: (0, import_i18n4.__)( "Customize the last part of the Permalink." ) }), /* @__PURE__ */ (0, import_jsx_runtime77.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_runtime77.jsx)( import_components.__experimentalInputControl, { __next40pxDefaultSize: true, prefix: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components.__experimentalInputControlPrefixWrapper, { children: "/" }), suffix: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime77.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_runtime77.jsxs)("div", { className: "fields-controls__slug-help", children: [ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "fields-controls__slug-help-visual-label", children: (0, import_i18n4.__)("Permalink:") }), /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)( import_components.ExternalLink, { className: "fields-controls__slug-help-link", href: permalink, children: [ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "fields-controls__slug-help-prefix", children: permalinkPrefix }), /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "fields-controls__slug-help-slug", children: slugToDisplay }), /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "fields-controls__slug-help-suffix", children: permalinkSuffix }) ] } ) ] }) ] }), !isEditable && /* @__PURE__ */ (0, import_jsx_runtime77.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_runtime78 = __toESM(require_jsx_runtime(), 1); function BaseTitleView({ item, className, children }) { const renderedTitle = getItemTitle(item); return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)( import_components2.__experimentalHStack, { className: clsx_default("fields-field__title", className), alignment: "center", justify: "flex-start", children: [ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { children: renderedTitle || (0, import_i18n6.__)("(no title)") }), children ] } ); } function TitleView({ item }) { return /* @__PURE__ */ (0, import_jsx_runtime78.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_data7 = __toESM(require_data(), 1); var import_core_data5 = __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_runtime79 = __toESM(require_jsx_runtime(), 1); var { Badge } = unlock2(import_components3.privateApis); function PageTitleView({ item }) { const { frontPageId, postsPageId } = (0, import_data7.useSelect)((select6) => { const { getEntityRecord } = select6(import_core_data5.store); const siteSettings = getEntityRecord( "root", "site" ); return { frontPageId: siteSettings?.page_on_front, postsPageId: siteSettings?.page_for_posts }; }, []); return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(BaseTitleView, { item, className: "fields-field__page-title", children: [frontPageId, postsPageId].includes(item.id) && /* @__PURE__ */ (0, import_jsx_runtime79.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_runtime80 = __toESM(require_jsx_runtime(), 1); var { PATTERN_TYPES } = unlock2(import_patterns.privateApis); function PatternTitleView({ item }) { return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(BaseTitleView, { item, className: "fields-field__pattern-title", children: item.type === PATTERN_TYPES.theme && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)( import_components4.Tooltip, { placement: "top", text: (0, import_i18n11.__)("This pattern cannot be edited."), children: /* @__PURE__ */ (0, import_jsx_runtime80.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_data6 = __toESM(require_core_data(), 1); var import_data8 = __toESM(require_data(), 1); var import_element6 = __toESM(require_element(), 1); var import_i18n13 = __toESM(require_i18n(), 1); var import_media_utils2 = __toESM(require_media_utils(), 1); var import_notices3 = __toESM(require_notices(), 1); // node_modules/@react-spring/rafz/dist/react-spring-rafz.esm.js var updateQueue = makeQueue(); var raf = (fn) => schedule(fn, updateQueue); var writeQueue = makeQueue(); raf.write = (fn) => schedule(fn, writeQueue); var onStartQueue = makeQueue(); raf.onStart = (fn) => schedule(fn, onStartQueue); var onFrameQueue = makeQueue(); raf.onFrame = (fn) => schedule(fn, onFrameQueue); var onFinishQueue = makeQueue(); raf.onFinish = (fn) => schedule(fn, onFinishQueue); var timeouts = []; raf.setTimeout = (handler, ms) => { let time = raf.now() + ms; let cancel = () => { let i3 = timeouts.findIndex((t4) => t4.cancel == cancel); if (~i3) timeouts.splice(i3, 1); pendingCount -= ~i3 ? 1 : 0; }; let timeout = { time, handler, cancel }; timeouts.splice(findTimeout(time), 0, timeout); pendingCount += 1; start(); return timeout; }; var findTimeout = (time) => ~(~timeouts.findIndex((t4) => t4.time > time) || ~timeouts.length); raf.cancel = (fn) => { onStartQueue.delete(fn); onFrameQueue.delete(fn); onFinishQueue.delete(fn); updateQueue.delete(fn); writeQueue.delete(fn); }; raf.sync = (fn) => { sync = true; raf.batchedUpdates(fn); sync = false; }; raf.throttle = (fn) => { let lastArgs; function queuedFn() { try { fn(...lastArgs); } finally { lastArgs = null; } } function throttled(...args) { lastArgs = args; raf.onStart(queuedFn); } throttled.handler = fn; throttled.cancel = () => { onStartQueue.delete(queuedFn); lastArgs = null; }; return throttled; }; var nativeRaf = typeof window != "undefined" ? window.requestAnimationFrame : () => { }; raf.use = (impl) => nativeRaf = impl; raf.now = typeof performance != "undefined" ? () => performance.now() : Date.now; raf.batchedUpdates = (fn) => fn(); raf.catch = console.error; raf.frameLoop = "always"; raf.advance = () => { if (raf.frameLoop !== "demand") { console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"); } else { update(); } }; var ts = -1; var pendingCount = 0; var sync = false; function schedule(fn, queue) { if (sync) { queue.delete(fn); fn(0); } else { queue.add(fn); start(); } } function start() { if (ts < 0) { ts = 0; if (raf.frameLoop !== "demand") { nativeRaf(loop); } } } function stop() { ts = -1; } function loop() { if (~ts) { nativeRaf(loop); raf.batchedUpdates(update); } } function update() { let prevTs = ts; ts = raf.now(); let count = findTimeout(ts); if (count) { eachSafely(timeouts.splice(0, count), (t4) => t4.handler()); pendingCount -= count; } if (!pendingCount) { stop(); return; } onStartQueue.flush(); updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667); onFrameQueue.flush(); writeQueue.flush(); onFinishQueue.flush(); } function makeQueue() { let next = /* @__PURE__ */ new Set(); let current = next; return { add(fn) { pendingCount += current == next && !next.has(fn) ? 1 : 0; next.add(fn); }, delete(fn) { pendingCount -= current == next && next.has(fn) ? 1 : 0; return next.delete(fn); }, flush(arg) { if (current.size) { next = /* @__PURE__ */ new Set(); pendingCount -= current.size; eachSafely(current, (fn) => fn(arg) && next.add(fn)); pendingCount += next.size; current = next; } } }; } function eachSafely(values, each2) { values.forEach((value) => { try { each2(value); } catch (e3) { raf.catch(e3); } }); } // node_modules/@react-spring/shared/dist/react-spring-shared.esm.js var import_react = __toESM(require_react()); function noop2() { } var defineHidden = (obj, key, value) => Object.defineProperty(obj, key, { value, writable: true, configurable: true }); var is = { arr: Array.isArray, obj: (a3) => !!a3 && a3.constructor.name === "Object", fun: (a3) => typeof a3 === "function", str: (a3) => typeof a3 === "string", num: (a3) => typeof a3 === "number", und: (a3) => a3 === void 0 }; function isEqual(a3, b3) { if (is.arr(a3)) { if (!is.arr(b3) || a3.length !== b3.length) return false; for (let i3 = 0; i3 < a3.length; i3++) { if (a3[i3] !== b3[i3]) return false; } return true; } return a3 === b3; } var each = (obj, fn) => obj.forEach(fn); function eachProp(obj, fn, ctx2) { if (is.arr(obj)) { for (let i3 = 0; i3 < obj.length; i3++) { fn.call(ctx2, obj[i3], `${i3}`); } return; } for (const key in obj) { if (obj.hasOwnProperty(key)) { fn.call(ctx2, obj[key], key); } } } var toArray = (a3) => is.und(a3) ? [] : is.arr(a3) ? a3 : [a3]; function flush(queue, iterator) { if (queue.size) { const items = Array.from(queue); queue.clear(); each(items, iterator); } } var flushCalls = (queue, ...args) => flush(queue, (fn) => fn(...args)); var isSSR = () => typeof window === "undefined" || !window.navigator || /ServerSideRendering|^Deno\//.test(window.navigator.userAgent); var createStringInterpolator$1; var to; var colors$1 = null; var skipAnimation = false; var willAdvance = noop2; var assign = (globals2) => { if (globals2.to) to = globals2.to; if (globals2.now) raf.now = globals2.now; if (globals2.colors !== void 0) colors$1 = globals2.colors; if (globals2.skipAnimation != null) skipAnimation = globals2.skipAnimation; if (globals2.createStringInterpolator) createStringInterpolator$1 = globals2.createStringInterpolator; if (globals2.requestAnimationFrame) raf.use(globals2.requestAnimationFrame); if (globals2.batchedUpdates) raf.batchedUpdates = globals2.batchedUpdates; if (globals2.willAdvance) willAdvance = globals2.willAdvance; if (globals2.frameLoop) raf.frameLoop = globals2.frameLoop; }; var globals = /* @__PURE__ */ Object.freeze({ __proto__: null, get createStringInterpolator() { return createStringInterpolator$1; }, get to() { return to; }, get colors() { return colors$1; }, get skipAnimation() { return skipAnimation; }, get willAdvance() { return willAdvance; }, assign }); var startQueue = /* @__PURE__ */ new Set(); var currentFrame = []; var prevFrame = []; var priority = 0; var frameLoop = { get idle() { return !startQueue.size && !currentFrame.length; }, start(animation) { if (priority > animation.priority) { startQueue.add(animation); raf.onStart(flushStartQueue); } else { startSafely(animation); raf(advance); } }, advance, sort(animation) { if (priority) { raf.onFrame(() => frameLoop.sort(animation)); } else { const prevIndex = currentFrame.indexOf(animation); if (~prevIndex) { currentFrame.splice(prevIndex, 1); startUnsafely(animation); } } }, clear() { currentFrame = []; startQueue.clear(); } }; function flushStartQueue() { startQueue.forEach(startSafely); startQueue.clear(); raf(advance); } function startSafely(animation) { if (!currentFrame.includes(animation)) startUnsafely(animation); } function startUnsafely(animation) { currentFrame.splice(findIndex(currentFrame, (other) => other.priority > animation.priority), 0, animation); } function advance(dt) { const nextFrame = prevFrame; for (let i3 = 0; i3 < currentFrame.length; i3++) { const animation = currentFrame[i3]; priority = animation.priority; if (!animation.idle) { willAdvance(animation); animation.advance(dt); if (!animation.idle) { nextFrame.push(animation); } } } priority = 0; prevFrame = currentFrame; prevFrame.length = 0; currentFrame = nextFrame; return currentFrame.length > 0; } function findIndex(arr, test) { const index2 = arr.findIndex(test); return index2 < 0 ? arr.length : index2; } var colors = { transparent: 0, aliceblue: 4042850303, antiquewhite: 4209760255, aqua: 16777215, aquamarine: 2147472639, azure: 4043309055, beige: 4126530815, bisque: 4293182719, black: 255, blanchedalmond: 4293643775, blue: 65535, blueviolet: 2318131967, brown: 2771004159, burlywood: 3736635391, burntsienna: 3934150143, cadetblue: 1604231423, chartreuse: 2147418367, chocolate: 3530104575, coral: 4286533887, cornflowerblue: 1687547391, cornsilk: 4294499583, crimson: 3692313855, cyan: 16777215, darkblue: 35839, darkcyan: 9145343, darkgoldenrod: 3095792639, darkgray: 2846468607, darkgreen: 6553855, darkgrey: 2846468607, darkkhaki: 3182914559, darkmagenta: 2332068863, darkolivegreen: 1433087999, darkorange: 4287365375, darkorchid: 2570243327, darkred: 2332033279, darksalmon: 3918953215, darkseagreen: 2411499519, darkslateblue: 1211993087, darkslategray: 793726975, darkslategrey: 793726975, darkturquoise: 13554175, darkviolet: 2483082239, deeppink: 4279538687, deepskyblue: 12582911, dimgray: 1768516095, dimgrey: 1768516095, dodgerblue: 512819199, firebrick: 2988581631, floralwhite: 4294635775, forestgreen: 579543807, fuchsia: 4278255615, gainsboro: 3705462015, ghostwhite: 4177068031, gold: 4292280575, goldenrod: 3668254975, gray: 2155905279, green: 8388863, greenyellow: 2919182335, grey: 2155905279, honeydew: 4043305215, hotpink: 4285117695, indianred: 3445382399, indigo: 1258324735, ivory: 4294963455, khaki: 4041641215, lavender: 3873897215, lavenderblush: 4293981695, lawngreen: 2096890111, lemonchiffon: 4294626815, lightblue: 2916673279, lightcoral: 4034953471, lightcyan: 3774873599, lightgoldenrodyellow: 4210742015, lightgray: 3553874943, lightgreen: 2431553791, lightgrey: 3553874943, lightpink: 4290167295, lightsalmon: 4288707327, lightseagreen: 548580095, lightskyblue: 2278488831, lightslategray: 2005441023, lightslategrey: 2005441023, lightsteelblue: 2965692159, lightyellow: 4294959359, lime: 16711935, limegreen: 852308735, linen: 4210091775, magenta: 4278255615, maroon: 2147483903, mediumaquamarine: 1724754687, mediumblue: 52735, mediumorchid: 3126187007, mediumpurple: 2473647103, mediumseagreen: 1018393087, mediumslateblue: 2070474495, mediumspringgreen: 16423679, mediumturquoise: 1221709055, mediumvioletred: 3340076543, midnightblue: 421097727, mintcream: 4127193855, mistyrose: 4293190143, moccasin: 4293178879, navajowhite: 4292783615, navy: 33023, oldlace: 4260751103, olive: 2155872511, olivedrab: 1804477439, orange: 4289003775, orangered: 4282712319, orchid: 3664828159, palegoldenrod: 4008225535, palegreen: 2566625535, paleturquoise: 2951671551, palevioletred: 3681588223, papayawhip: 4293907967, peachpuff: 4292524543, peru: 3448061951, pink: 4290825215, plum: 3718307327, powderblue: 2967529215, purple: 2147516671, rebeccapurple: 1714657791, red: 4278190335, rosybrown: 3163525119, royalblue: 1097458175, saddlebrown: 2336560127, salmon: 4202722047, sandybrown: 4104413439, seagreen: 780883967, seashell: 4294307583, sienna: 2689740287, silver: 3233857791, skyblue: 2278484991, slateblue: 1784335871, slategray: 1887473919, slategrey: 1887473919, snow: 4294638335, springgreen: 16744447, steelblue: 1182971135, tan: 3535047935, teal: 8421631, thistle: 3636451583, tomato: 4284696575, turquoise: 1088475391, violet: 4001558271, wheat: 4125012991, white: 4294967295, whitesmoke: 4126537215, yellow: 4294902015, yellowgreen: 2597139199 }; var NUMBER = "[-+]?\\d*\\.?\\d+"; var PERCENTAGE = NUMBER + "%"; function call(...parts) { return "\\(\\s*(" + parts.join(")\\s*,\\s*(") + ")\\s*\\)"; } var rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER)); var rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER)); var hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE)); var hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)); var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; var hex6 = /^#([0-9a-fA-F]{6})$/; var hex8 = /^#([0-9a-fA-F]{8})$/; function normalizeColor(color) { let match3; if (typeof color === "number") { return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null; } if (match3 = hex6.exec(color)) return parseInt(match3[1] + "ff", 16) >>> 0; if (colors$1 && colors$1[color] !== void 0) { return colors$1[color]; } if (match3 = rgb.exec(color)) { return (parse255(match3[1]) << 24 | parse255(match3[2]) << 16 | parse255(match3[3]) << 8 | 255) >>> 0; } if (match3 = rgba.exec(color)) { return (parse255(match3[1]) << 24 | parse255(match3[2]) << 16 | parse255(match3[3]) << 8 | parse1(match3[4])) >>> 0; } if (match3 = hex3.exec(color)) { return parseInt(match3[1] + match3[1] + match3[2] + match3[2] + match3[3] + match3[3] + "ff", 16) >>> 0; } if (match3 = hex8.exec(color)) return parseInt(match3[1], 16) >>> 0; if (match3 = hex4.exec(color)) { return parseInt(match3[1] + match3[1] + match3[2] + match3[2] + match3[3] + match3[3] + match3[4] + match3[4], 16) >>> 0; } if (match3 = hsl.exec(color)) { return (hslToRgb(parse360(match3[1]), parsePercentage(match3[2]), parsePercentage(match3[3])) | 255) >>> 0; } if (match3 = hsla.exec(color)) { return (hslToRgb(parse360(match3[1]), parsePercentage(match3[2]), parsePercentage(match3[3])) | parse1(match3[4])) >>> 0; } return null; } function hue2rgb(p4, q, t4) { if (t4 < 0) t4 += 1; if (t4 > 1) t4 -= 1; if (t4 < 1 / 6) return p4 + (q - p4) * 6 * t4; if (t4 < 1 / 2) return q; if (t4 < 2 / 3) return p4 + (q - p4) * (2 / 3 - t4) * 6; return p4; } function hslToRgb(h3, s3, l3) { const q = l3 < 0.5 ? l3 * (1 + s3) : l3 + s3 - l3 * s3; const p4 = 2 * l3 - q; const r4 = hue2rgb(p4, q, h3 + 1 / 3); const g3 = hue2rgb(p4, q, h3); const b3 = hue2rgb(p4, q, h3 - 1 / 3); return Math.round(r4 * 255) << 24 | Math.round(g3 * 255) << 16 | Math.round(b3 * 255) << 8; } function parse255(str) { const int = parseInt(str, 10); if (int < 0) return 0; if (int > 255) return 255; return int; } function parse360(str) { const int = parseFloat(str); return (int % 360 + 360) % 360 / 360; } function parse1(str) { const num = parseFloat(str); if (num < 0) return 0; if (num > 1) return 255; return Math.round(num * 255); } function parsePercentage(str) { const int = parseFloat(str); if (int < 0) return 0; if (int > 100) return 1; return int / 100; } function colorToRgba(input) { let int32Color = normalizeColor(input); if (int32Color === null) return input; int32Color = int32Color || 0; let r4 = (int32Color & 4278190080) >>> 24; let g3 = (int32Color & 16711680) >>> 16; let b3 = (int32Color & 65280) >>> 8; let a3 = (int32Color & 255) / 255; return `rgba(${r4}, ${g3}, ${b3}, ${a3})`; } var createInterpolator = (range, output, extrapolate) => { if (is.fun(range)) { return range; } if (is.arr(range)) { return createInterpolator({ range, output, extrapolate }); } if (is.str(range.output[0])) { return createStringInterpolator$1(range); } const config2 = range; const outputRange = config2.output; const inputRange = config2.range || [0, 1]; const extrapolateLeft = config2.extrapolateLeft || config2.extrapolate || "extend"; const extrapolateRight = config2.extrapolateRight || config2.extrapolate || "extend"; const easing = config2.easing || ((t4) => t4); return (input) => { const range2 = findRange(input, inputRange); return interpolate(input, inputRange[range2], inputRange[range2 + 1], outputRange[range2], outputRange[range2 + 1], easing, extrapolateLeft, extrapolateRight, config2.map); }; }; function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) { let result = map ? map(input) : input; if (result < inputMin) { if (extrapolateLeft === "identity") return result; else if (extrapolateLeft === "clamp") result = inputMin; } if (result > inputMax) { if (extrapolateRight === "identity") return result; else if (extrapolateRight === "clamp") result = inputMax; } if (outputMin === outputMax) return outputMin; if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax; if (inputMin === -Infinity) result = -result; else if (inputMax === Infinity) result = result - inputMin; else result = (result - inputMin) / (inputMax - inputMin); result = easing(result); if (outputMin === -Infinity) result = -result; else if (outputMax === Infinity) result = result + outputMin; else result = result * (outputMax - outputMin) + outputMin; return result; } function findRange(input, inputRange) { for (var i3 = 1; i3 < inputRange.length - 1; ++i3) if (inputRange[i3] >= input) break; return i3 - 1; } function _extends() { _extends = Object.assign ? Object.assign.bind() : function(target) { for (var i3 = 1; i3 < arguments.length; i3++) { var source = arguments[i3]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } var $get = /* @__PURE__ */ Symbol.for("FluidValue.get"); var $observers = /* @__PURE__ */ Symbol.for("FluidValue.observers"); var hasFluidValue = (arg) => Boolean(arg && arg[$get]); var getFluidValue = (arg) => arg && arg[$get] ? arg[$get]() : arg; var getFluidObservers = (target) => target[$observers] || null; function callFluidObserver(observer, event) { if (observer.eventObserved) { observer.eventObserved(event); } else { observer(event); } } function callFluidObservers(target, event) { let observers = target[$observers]; if (observers) { observers.forEach((observer) => { callFluidObserver(observer, event); }); } } var FluidValue = class { constructor(get) { this[$get] = void 0; this[$observers] = void 0; if (!get && !(get = this.get)) { throw Error("Unknown getter"); } setFluidGetter(this, get); } }; var setFluidGetter = (target, get) => setHidden(target, $get, get); function addFluidObserver(target, observer) { if (target[$get]) { let observers = target[$observers]; if (!observers) { setHidden(target, $observers, observers = /* @__PURE__ */ new Set()); } if (!observers.has(observer)) { observers.add(observer); if (target.observerAdded) { target.observerAdded(observers.size, observer); } } } return observer; } function removeFluidObserver(target, observer) { let observers = target[$observers]; if (observers && observers.has(observer)) { const count = observers.size - 1; if (count) { observers.delete(observer); } else { target[$observers] = null; } if (target.observerRemoved) { target.observerRemoved(count, observer); } } } var setHidden = (target, key, value) => Object.defineProperty(target, key, { value, writable: true, configurable: true }); var numberRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; var colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi; var unitRegex = new RegExp(`(${numberRegex.source})(%|[a-z]+)`, "i"); var rgbaRegex = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi; var cssVariableRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/; var variableToRgba = (input) => { const [token, fallback] = parseCSSVariable(input); if (!token || isSSR()) { return input; } const value = window.getComputedStyle(document.documentElement).getPropertyValue(token); if (value) { return value.trim(); } else if (fallback && fallback.startsWith("--")) { const _value = window.getComputedStyle(document.documentElement).getPropertyValue(fallback); if (_value) { return _value; } else { return input; } } else if (fallback && cssVariableRegex.test(fallback)) { return variableToRgba(fallback); } else if (fallback) { return fallback; } return input; }; var parseCSSVariable = (current) => { const match3 = cssVariableRegex.exec(current); if (!match3) return [,]; const [, token, fallback] = match3; return [token, fallback]; }; var namedColorRegex; var rgbaRound = (_, p1, p22, p32, p4) => `rgba(${Math.round(p1)}, ${Math.round(p22)}, ${Math.round(p32)}, ${p4})`; var createStringInterpolator = (config2) => { if (!namedColorRegex) namedColorRegex = colors$1 ? new RegExp(`(${Object.keys(colors$1).join("|")})(?!\\w)`, "g") : /^\b$/; const output = config2.output.map((value) => { return getFluidValue(value).replace(cssVariableRegex, variableToRgba).replace(colorRegex, colorToRgba).replace(namedColorRegex, colorToRgba); }); const keyframes = output.map((value) => value.match(numberRegex).map(Number)); const outputRanges = keyframes[0].map((_, i3) => keyframes.map((values) => { if (!(i3 in values)) { throw Error('The arity of each "output" value must be equal'); } return values[i3]; })); const interpolators = outputRanges.map((output2) => createInterpolator(_extends({}, config2, { output: output2 }))); return (input) => { var _output$find; const missingUnit = !unitRegex.test(output[0]) && ((_output$find = output.find((value) => unitRegex.test(value))) == null ? void 0 : _output$find.replace(numberRegex, "")); let i3 = 0; return output[0].replace(numberRegex, () => `${interpolators[i3++](input)}${missingUnit || ""}`).replace(rgbaRegex, rgbaRound); }; }; var prefix = "react-spring: "; var once = (fn) => { const func = fn; let called = false; if (typeof func != "function") { throw new TypeError(`${prefix}once requires a function parameter`); } return (...args) => { if (!called) { func(...args); called = true; } }; }; var warnInterpolate = once(console.warn); function deprecateInterpolate() { warnInterpolate(`${prefix}The "interpolate" function is deprecated in v9 (use "to" instead)`); } var warnDirectCall = once(console.warn); function isAnimatedString(value) { return is.str(value) && (value[0] == "#" || /\d/.test(value) || !isSSR() && cssVariableRegex.test(value) || value in (colors$1 || {})); } var useIsomorphicLayoutEffect = isSSR() ? import_react.useEffect : import_react.useLayoutEffect; var useIsMounted = () => { const isMounted = (0, import_react.useRef)(false); useIsomorphicLayoutEffect(() => { isMounted.current = true; return () => { isMounted.current = false; }; }, []); return isMounted; }; function useForceUpdate() { const update4 = (0, import_react.useState)()[1]; const isMounted = useIsMounted(); return () => { if (isMounted.current) { update4(Math.random()); } }; } function useMemoOne(getResult, inputs) { const [initial] = (0, import_react.useState)(() => ({ inputs, result: getResult() })); const committed = (0, import_react.useRef)(); const prevCache = committed.current; let cache = prevCache; if (cache) { const useCache = Boolean(inputs && cache.inputs && areInputsEqual(inputs, cache.inputs)); if (!useCache) { cache = { inputs, result: getResult() }; } } else { cache = initial; } (0, import_react.useEffect)(() => { committed.current = cache; if (prevCache == initial) { initial.inputs = initial.result = void 0; } }, [cache]); return cache.result; } function areInputsEqual(next, prev) { if (next.length !== prev.length) { return false; } for (let i3 = 0; i3 < next.length; i3++) { if (next[i3] !== prev[i3]) { return false; } } return true; } var useOnce = (effect) => (0, import_react.useEffect)(effect, emptyDeps); var emptyDeps = []; // node_modules/@react-spring/core/dist/react-spring-core.esm.js var React2 = __toESM(require_react()); var import_react3 = __toESM(require_react()); // node_modules/@react-spring/animated/dist/react-spring-animated.esm.js var React = __toESM(require_react()); var import_react2 = __toESM(require_react()); var $node = /* @__PURE__ */ Symbol.for("Animated:node"); var isAnimated = (value) => !!value && value[$node] === value; var getAnimated = (owner) => owner && owner[$node]; var setAnimated = (owner, node) => defineHidden(owner, $node, node); var getPayload = (owner) => owner && owner[$node] && owner[$node].getPayload(); var Animated = class { constructor() { this.payload = void 0; setAnimated(this, this); } getPayload() { return this.payload || []; } }; var AnimatedValue = class _AnimatedValue extends Animated { constructor(_value) { super(); this.done = true; this.elapsedTime = void 0; this.lastPosition = void 0; this.lastVelocity = void 0; this.v0 = void 0; this.durationProgress = 0; this._value = _value; if (is.num(this._value)) { this.lastPosition = this._value; } } static create(value) { return new _AnimatedValue(value); } getPayload() { return [this]; } getValue() { return this._value; } setValue(value, step) { if (is.num(value)) { this.lastPosition = value; if (step) { value = Math.round(value / step) * step; if (this.done) { this.lastPosition = value; } } } if (this._value === value) { return false; } this._value = value; return true; } reset() { const { done } = this; this.done = false; if (is.num(this._value)) { this.elapsedTime = 0; this.durationProgress = 0; this.lastPosition = this._value; if (done) this.lastVelocity = null; this.v0 = null; } } }; var AnimatedString = class _AnimatedString extends AnimatedValue { constructor(value) { super(0); this._string = null; this._toString = void 0; this._toString = createInterpolator({ output: [value, value] }); } static create(value) { return new _AnimatedString(value); } getValue() { let value = this._string; return value == null ? this._string = this._toString(this._value) : value; } setValue(value) { if (is.str(value)) { if (value == this._string) { return false; } this._string = value; this._value = 1; } else if (super.setValue(value)) { this._string = null; } else { return false; } return true; } reset(goal) { if (goal) { this._toString = createInterpolator({ output: [this.getValue(), goal] }); } this._value = 0; super.reset(); } }; var TreeContext = { dependencies: null }; var AnimatedObject = class extends Animated { constructor(source) { super(); this.source = source; this.setValue(source); } getValue(animated2) { const values = {}; eachProp(this.source, (source, key) => { if (isAnimated(source)) { values[key] = source.getValue(animated2); } else if (hasFluidValue(source)) { values[key] = getFluidValue(source); } else if (!animated2) { values[key] = source; } }); return values; } setValue(source) { this.source = source; this.payload = this._makePayload(source); } reset() { if (this.payload) { each(this.payload, (node) => node.reset()); } } _makePayload(source) { if (source) { const payload = /* @__PURE__ */ new Set(); eachProp(source, this._addToPayload, payload); return Array.from(payload); } } _addToPayload(source) { if (TreeContext.dependencies && hasFluidValue(source)) { TreeContext.dependencies.add(source); } const payload = getPayload(source); if (payload) { each(payload, (node) => this.add(node)); } } }; var AnimatedArray = class _AnimatedArray extends AnimatedObject { constructor(source) { super(source); } static create(source) { return new _AnimatedArray(source); } getValue() { return this.source.map((node) => node.getValue()); } setValue(source) { const payload = this.getPayload(); if (source.length == payload.length) { return payload.map((node, i3) => node.setValue(source[i3])).some(Boolean); } super.setValue(source.map(makeAnimated)); return true; } }; function makeAnimated(value) { const nodeType = isAnimatedString(value) ? AnimatedString : AnimatedValue; return nodeType.create(value); } function getAnimatedType(value) { const parentNode = getAnimated(value); return parentNode ? parentNode.constructor : is.arr(value) ? AnimatedArray : isAnimatedString(value) ? AnimatedString : AnimatedValue; } function _extends2() { _extends2 = Object.assign ? Object.assign.bind() : function(target) { for (var i3 = 1; i3 < arguments.length; i3++) { var source = arguments[i3]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends2.apply(this, arguments); } var withAnimated = (Component6, host2) => { const hasInstance = !is.fun(Component6) || Component6.prototype && Component6.prototype.isReactComponent; return (0, import_react2.forwardRef)((givenProps, givenRef) => { const instanceRef = (0, import_react2.useRef)(null); const ref = hasInstance && (0, import_react2.useCallback)((value) => { instanceRef.current = updateRef(givenRef, value); }, [givenRef]); const [props, deps] = getAnimatedState(givenProps, host2); const forceUpdate = useForceUpdate(); const callback = () => { const instance = instanceRef.current; if (hasInstance && !instance) { return; } const didUpdate = instance ? host2.applyAnimatedValues(instance, props.getValue(true)) : false; if (didUpdate === false) { forceUpdate(); } }; const observer = new PropsObserver(callback, deps); const observerRef = (0, import_react2.useRef)(); useIsomorphicLayoutEffect(() => { observerRef.current = observer; each(deps, (dep) => addFluidObserver(dep, observer)); return () => { if (observerRef.current) { each(observerRef.current.deps, (dep) => removeFluidObserver(dep, observerRef.current)); raf.cancel(observerRef.current.update); } }; }); (0, import_react2.useEffect)(callback, []); useOnce(() => () => { const observer2 = observerRef.current; each(observer2.deps, (dep) => removeFluidObserver(dep, observer2)); }); const usedProps = host2.getComponentProps(props.getValue()); return React.createElement(Component6, _extends2({}, usedProps, { ref })); }); }; var PropsObserver = class { constructor(update4, deps) { this.update = update4; this.deps = deps; } eventObserved(event) { if (event.type == "change") { raf.write(this.update); } } }; function getAnimatedState(props, host2) { const dependencies = /* @__PURE__ */ new Set(); TreeContext.dependencies = dependencies; if (props.style) props = _extends2({}, props, { style: host2.createAnimatedStyle(props.style) }); props = new AnimatedObject(props); TreeContext.dependencies = null; return [props, dependencies]; } function updateRef(ref, value) { if (ref) { if (is.fun(ref)) ref(value); else ref.current = value; } return value; } var cacheKey = /* @__PURE__ */ Symbol.for("AnimatedComponent"); var createHost = (components, { applyAnimatedValues: _applyAnimatedValues = () => false, createAnimatedStyle: _createAnimatedStyle = (style) => new AnimatedObject(style), getComponentProps: _getComponentProps = (props) => props } = {}) => { const hostConfig = { applyAnimatedValues: _applyAnimatedValues, createAnimatedStyle: _createAnimatedStyle, getComponentProps: _getComponentProps }; const animated2 = (Component6) => { const displayName = getDisplayName(Component6) || "Anonymous"; if (is.str(Component6)) { Component6 = animated2[Component6] || (animated2[Component6] = withAnimated(Component6, hostConfig)); } else { Component6 = Component6[cacheKey] || (Component6[cacheKey] = withAnimated(Component6, hostConfig)); } Component6.displayName = `Animated(${displayName})`; return Component6; }; eachProp(components, (Component6, key) => { if (is.arr(components)) { key = getDisplayName(Component6); } animated2[key] = animated2(Component6); }); return { animated: animated2 }; }; var getDisplayName = (arg) => is.str(arg) ? arg : arg && is.str(arg.displayName) ? arg.displayName : is.fun(arg) && arg.name || null; // node_modules/@react-spring/core/dist/react-spring-core.esm.js function _extends3() { _extends3 = Object.assign ? Object.assign.bind() : function(target) { for (var i3 = 1; i3 < arguments.length; i3++) { var source = arguments[i3]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends3.apply(this, arguments); } function callProp(value, ...args) { return is.fun(value) ? value(...args) : value; } var matchProp = (value, key) => value === true || !!(key && value && (is.fun(value) ? value(key) : toArray(value).includes(key))); var resolveProp = (prop, key) => is.obj(prop) ? key && prop[key] : prop; var getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : void 0; var noopTransform = (value) => value; var getDefaultProps = (props, transform = noopTransform) => { let keys = DEFAULT_PROPS; if (props.default && props.default !== true) { props = props.default; keys = Object.keys(props); } const defaults2 = {}; for (const key of keys) { const value = transform(props[key], key); if (!is.und(value)) { defaults2[key] = value; } } return defaults2; }; var DEFAULT_PROPS = ["config", "onProps", "onStart", "onChange", "onPause", "onResume", "onRest"]; var RESERVED_PROPS = { config: 1, from: 1, to: 1, ref: 1, loop: 1, reset: 1, pause: 1, cancel: 1, reverse: 1, immediate: 1, default: 1, delay: 1, onProps: 1, onStart: 1, onChange: 1, onPause: 1, onResume: 1, onRest: 1, onResolve: 1, items: 1, trail: 1, sort: 1, expires: 1, initial: 1, enter: 1, update: 1, leave: 1, children: 1, onDestroyed: 1, keys: 1, callId: 1, parentId: 1 }; function getForwardProps(props) { const forward = {}; let count = 0; eachProp(props, (value, prop) => { if (!RESERVED_PROPS[prop]) { forward[prop] = value; count++; } }); if (count) { return forward; } } function inferTo(props) { const to2 = getForwardProps(props); if (to2) { const out = { to: to2 }; eachProp(props, (val, key) => key in to2 || (out[key] = val)); return out; } return _extends3({}, props); } function computeGoal(value) { value = getFluidValue(value); return is.arr(value) ? value.map(computeGoal) : isAnimatedString(value) ? globals.createStringInterpolator({ range: [0, 1], output: [value, value] })(1) : value; } function isAsyncTo(to2) { return is.fun(to2) || is.arr(to2) && is.obj(to2[0]); } var config = { default: { tension: 170, friction: 26 }, gentle: { tension: 120, friction: 14 }, wobbly: { tension: 180, friction: 12 }, stiff: { tension: 210, friction: 20 }, slow: { tension: 280, friction: 60 }, molasses: { tension: 280, friction: 120 } }; var c1 = 1.70158; var c2 = c1 * 1.525; var c3 = c1 + 1; var c4 = 2 * Math.PI / 3; var c5 = 2 * Math.PI / 4.5; var bounceOut = (x2) => { const n1 = 7.5625; const d1 = 2.75; if (x2 < 1 / d1) { return n1 * x2 * x2; } else if (x2 < 2 / d1) { return n1 * (x2 -= 1.5 / d1) * x2 + 0.75; } else if (x2 < 2.5 / d1) { return n1 * (x2 -= 2.25 / d1) * x2 + 0.9375; } else { return n1 * (x2 -= 2.625 / d1) * x2 + 0.984375; } }; var easings = { linear: (x2) => x2, easeInQuad: (x2) => x2 * x2, easeOutQuad: (x2) => 1 - (1 - x2) * (1 - x2), easeInOutQuad: (x2) => x2 < 0.5 ? 2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 2) / 2, easeInCubic: (x2) => x2 * x2 * x2, easeOutCubic: (x2) => 1 - Math.pow(1 - x2, 3), easeInOutCubic: (x2) => x2 < 0.5 ? 4 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 3) / 2, easeInQuart: (x2) => x2 * x2 * x2 * x2, easeOutQuart: (x2) => 1 - Math.pow(1 - x2, 4), easeInOutQuart: (x2) => x2 < 0.5 ? 8 * x2 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 4) / 2, easeInQuint: (x2) => x2 * x2 * x2 * x2 * x2, easeOutQuint: (x2) => 1 - Math.pow(1 - x2, 5), easeInOutQuint: (x2) => x2 < 0.5 ? 16 * x2 * x2 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 5) / 2, easeInSine: (x2) => 1 - Math.cos(x2 * Math.PI / 2), easeOutSine: (x2) => Math.sin(x2 * Math.PI / 2), easeInOutSine: (x2) => -(Math.cos(Math.PI * x2) - 1) / 2, easeInExpo: (x2) => x2 === 0 ? 0 : Math.pow(2, 10 * x2 - 10), easeOutExpo: (x2) => x2 === 1 ? 1 : 1 - Math.pow(2, -10 * x2), easeInOutExpo: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : x2 < 0.5 ? Math.pow(2, 20 * x2 - 10) / 2 : (2 - Math.pow(2, -20 * x2 + 10)) / 2, easeInCirc: (x2) => 1 - Math.sqrt(1 - Math.pow(x2, 2)), easeOutCirc: (x2) => Math.sqrt(1 - Math.pow(x2 - 1, 2)), easeInOutCirc: (x2) => x2 < 0.5 ? (1 - Math.sqrt(1 - Math.pow(2 * x2, 2))) / 2 : (Math.sqrt(1 - Math.pow(-2 * x2 + 2, 2)) + 1) / 2, easeInBack: (x2) => c3 * x2 * x2 * x2 - c1 * x2 * x2, easeOutBack: (x2) => 1 + c3 * Math.pow(x2 - 1, 3) + c1 * Math.pow(x2 - 1, 2), easeInOutBack: (x2) => x2 < 0.5 ? Math.pow(2 * x2, 2) * ((c2 + 1) * 2 * x2 - c2) / 2 : (Math.pow(2 * x2 - 2, 2) * ((c2 + 1) * (x2 * 2 - 2) + c2) + 2) / 2, easeInElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : -Math.pow(2, 10 * x2 - 10) * Math.sin((x2 * 10 - 10.75) * c4), easeOutElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : Math.pow(2, -10 * x2) * Math.sin((x2 * 10 - 0.75) * c4) + 1, easeInOutElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : x2 < 0.5 ? -(Math.pow(2, 20 * x2 - 10) * Math.sin((20 * x2 - 11.125) * c5)) / 2 : Math.pow(2, -20 * x2 + 10) * Math.sin((20 * x2 - 11.125) * c5) / 2 + 1, easeInBounce: (x2) => 1 - bounceOut(1 - x2), easeOutBounce: bounceOut, easeInOutBounce: (x2) => x2 < 0.5 ? (1 - bounceOut(1 - 2 * x2)) / 2 : (1 + bounceOut(2 * x2 - 1)) / 2 }; var defaults = _extends3({}, config.default, { mass: 1, damping: 1, easing: easings.linear, clamp: false }); var AnimationConfig = class { constructor() { this.tension = void 0; this.friction = void 0; this.frequency = void 0; this.damping = void 0; this.mass = void 0; this.velocity = 0; this.restVelocity = void 0; this.precision = void 0; this.progress = void 0; this.duration = void 0; this.easing = void 0; this.clamp = void 0; this.bounce = void 0; this.decay = void 0; this.round = void 0; Object.assign(this, defaults); } }; function mergeConfig(config2, newConfig, defaultConfig) { if (defaultConfig) { defaultConfig = _extends3({}, defaultConfig); sanitizeConfig(defaultConfig, newConfig); newConfig = _extends3({}, defaultConfig, newConfig); } sanitizeConfig(config2, newConfig); Object.assign(config2, newConfig); for (const key in defaults) { if (config2[key] == null) { config2[key] = defaults[key]; } } let { mass, frequency, damping } = config2; if (!is.und(frequency)) { if (frequency < 0.01) frequency = 0.01; if (damping < 0) damping = 0; config2.tension = Math.pow(2 * Math.PI / frequency, 2) * mass; config2.friction = 4 * Math.PI * damping * mass / frequency; } return config2; } function sanitizeConfig(config2, props) { if (!is.und(props.decay)) { config2.duration = void 0; } else { const isTensionConfig = !is.und(props.tension) || !is.und(props.friction); if (isTensionConfig || !is.und(props.frequency) || !is.und(props.damping) || !is.und(props.mass)) { config2.duration = void 0; config2.decay = void 0; } if (isTensionConfig) { config2.frequency = void 0; } } } var emptyArray = []; var Animation = class { constructor() { this.changed = false; this.values = emptyArray; this.toValues = null; this.fromValues = emptyArray; this.to = void 0; this.from = void 0; this.config = new AnimationConfig(); this.immediate = false; } }; function scheduleProps(callId, { key, props, defaultProps, state, actions: actions2 }) { return new Promise((resolve, reject) => { var _props$cancel; let delay; let timeout; let cancel = matchProp((_props$cancel = props.cancel) != null ? _props$cancel : defaultProps == null ? void 0 : defaultProps.cancel, key); if (cancel) { onStart(); } else { if (!is.und(props.pause)) { state.paused = matchProp(props.pause, key); } let pause = defaultProps == null ? void 0 : defaultProps.pause; if (pause !== true) { pause = state.paused || matchProp(pause, key); } delay = callProp(props.delay || 0, key); if (pause) { state.resumeQueue.add(onResume); actions2.pause(); } else { actions2.resume(); onResume(); } } function onPause() { state.resumeQueue.add(onResume); state.timeouts.delete(timeout); timeout.cancel(); delay = timeout.time - raf.now(); } function onResume() { if (delay > 0 && !globals.skipAnimation) { state.delayed = true; timeout = raf.setTimeout(onStart, delay); state.pauseQueue.add(onPause); state.timeouts.add(timeout); } else { onStart(); } } function onStart() { if (state.delayed) { state.delayed = false; } state.pauseQueue.delete(onPause); state.timeouts.delete(timeout); if (callId <= (state.cancelId || 0)) { cancel = true; } try { actions2.start(_extends3({}, props, { callId, cancel }), resolve); } catch (err) { reject(err); } } }); } var getCombinedResult = (target, results) => results.length == 1 ? results[0] : results.some((result) => result.cancelled) ? getCancelledResult(target.get()) : results.every((result) => result.noop) ? getNoopResult(target.get()) : getFinishedResult(target.get(), results.every((result) => result.finished)); var getNoopResult = (value) => ({ value, noop: true, finished: true, cancelled: false }); var getFinishedResult = (value, finished, cancelled = false) => ({ value, finished, cancelled }); var getCancelledResult = (value) => ({ value, cancelled: true, finished: false }); function runAsync(to2, props, state, target) { const { callId, parentId, onRest } = props; const { asyncTo: prevTo, promise: prevPromise } = state; if (!parentId && to2 === prevTo && !props.reset) { return prevPromise; } return state.promise = (async () => { state.asyncId = callId; state.asyncTo = to2; const defaultProps = getDefaultProps(props, (value, key) => key === "onRest" ? void 0 : value); let preventBail; let bail; const bailPromise = new Promise((resolve, reject) => (preventBail = resolve, bail = reject)); const bailIfEnded = (bailSignal) => { const bailResult = callId <= (state.cancelId || 0) && getCancelledResult(target) || callId !== state.asyncId && getFinishedResult(target, false); if (bailResult) { bailSignal.result = bailResult; bail(bailSignal); throw bailSignal; } }; const animate = (arg1, arg2) => { const bailSignal = new BailSignal(); const skipAnimationSignal = new SkipAniamtionSignal(); return (async () => { if (globals.skipAnimation) { stopAsync(state); skipAnimationSignal.result = getFinishedResult(target, false); bail(skipAnimationSignal); throw skipAnimationSignal; } bailIfEnded(bailSignal); const props2 = is.obj(arg1) ? _extends3({}, arg1) : _extends3({}, arg2, { to: arg1 }); props2.parentId = callId; eachProp(defaultProps, (value, key) => { if (is.und(props2[key])) { props2[key] = value; } }); const result2 = await target.start(props2); bailIfEnded(bailSignal); if (state.paused) { await new Promise((resume) => { state.resumeQueue.add(resume); }); } return result2; })(); }; let result; if (globals.skipAnimation) { stopAsync(state); return getFinishedResult(target, false); } try { let animating; if (is.arr(to2)) { animating = (async (queue) => { for (const props2 of queue) { await animate(props2); } })(to2); } else { animating = Promise.resolve(to2(animate, target.stop.bind(target))); } await Promise.all([animating.then(preventBail), bailPromise]); result = getFinishedResult(target.get(), true, false); } catch (err) { if (err instanceof BailSignal) { result = err.result; } else if (err instanceof SkipAniamtionSignal) { result = err.result; } else { throw err; } } finally { if (callId == state.asyncId) { state.asyncId = parentId; state.asyncTo = parentId ? prevTo : void 0; state.promise = parentId ? prevPromise : void 0; } } if (is.fun(onRest)) { raf.batchedUpdates(() => { onRest(result, target, target.item); }); } return result; })(); } function stopAsync(state, cancelId) { flush(state.timeouts, (t4) => t4.cancel()); state.pauseQueue.clear(); state.resumeQueue.clear(); state.asyncId = state.asyncTo = state.promise = void 0; if (cancelId) state.cancelId = cancelId; } var BailSignal = class extends Error { constructor() { super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."); this.result = void 0; } }; var SkipAniamtionSignal = class extends Error { constructor() { super("SkipAnimationSignal"); this.result = void 0; } }; var isFrameValue = (value) => value instanceof FrameValue; var nextId$1 = 1; var FrameValue = class extends FluidValue { constructor(...args) { super(...args); this.id = nextId$1++; this.key = void 0; this._priority = 0; } get priority() { return this._priority; } set priority(priority2) { if (this._priority != priority2) { this._priority = priority2; this._onPriorityChange(priority2); } } get() { const node = getAnimated(this); return node && node.getValue(); } to(...args) { return globals.to(this, args); } interpolate(...args) { deprecateInterpolate(); return globals.to(this, args); } toJSON() { return this.get(); } observerAdded(count) { if (count == 1) this._attach(); } observerRemoved(count) { if (count == 0) this._detach(); } _attach() { } _detach() { } _onChange(value, idle = false) { callFluidObservers(this, { type: "change", parent: this, value, idle }); } _onPriorityChange(priority2) { if (!this.idle) { frameLoop.sort(this); } callFluidObservers(this, { type: "priority", parent: this, priority: priority2 }); } }; var $P = /* @__PURE__ */ Symbol.for("SpringPhase"); var HAS_ANIMATED = 1; var IS_ANIMATING = 2; var IS_PAUSED = 4; var hasAnimated = (target) => (target[$P] & HAS_ANIMATED) > 0; var isAnimating = (target) => (target[$P] & IS_ANIMATING) > 0; var isPaused = (target) => (target[$P] & IS_PAUSED) > 0; var setActiveBit = (target, active) => active ? target[$P] |= IS_ANIMATING | HAS_ANIMATED : target[$P] &= ~IS_ANIMATING; var setPausedBit = (target, paused) => paused ? target[$P] |= IS_PAUSED : target[$P] &= ~IS_PAUSED; var SpringValue = class extends FrameValue { constructor(arg1, arg2) { super(); this.key = void 0; this.animation = new Animation(); this.queue = void 0; this.defaultProps = {}; this._state = { paused: false, delayed: false, pauseQueue: /* @__PURE__ */ new Set(), resumeQueue: /* @__PURE__ */ new Set(), timeouts: /* @__PURE__ */ new Set() }; this._pendingCalls = /* @__PURE__ */ new Set(); this._lastCallId = 0; this._lastToId = 0; this._memoizedDuration = 0; if (!is.und(arg1) || !is.und(arg2)) { const props = is.obj(arg1) ? _extends3({}, arg1) : _extends3({}, arg2, { from: arg1 }); if (is.und(props.default)) { props.default = true; } this.start(props); } } get idle() { return !(isAnimating(this) || this._state.asyncTo) || isPaused(this); } get goal() { return getFluidValue(this.animation.to); } get velocity() { const node = getAnimated(this); return node instanceof AnimatedValue ? node.lastVelocity || 0 : node.getPayload().map((node2) => node2.lastVelocity || 0); } get hasAnimated() { return hasAnimated(this); } get isAnimating() { return isAnimating(this); } get isPaused() { return isPaused(this); } get isDelayed() { return this._state.delayed; } advance(dt) { let idle = true; let changed = false; const anim = this.animation; let { config: config2, toValues } = anim; const payload = getPayload(anim.to); if (!payload && hasFluidValue(anim.to)) { toValues = toArray(getFluidValue(anim.to)); } anim.values.forEach((node2, i3) => { if (node2.done) return; const to2 = node2.constructor == AnimatedString ? 1 : payload ? payload[i3].lastPosition : toValues[i3]; let finished = anim.immediate; let position = to2; if (!finished) { position = node2.lastPosition; if (config2.tension <= 0) { node2.done = true; return; } let elapsed = node2.elapsedTime += dt; const from = anim.fromValues[i3]; const v0 = node2.v0 != null ? node2.v0 : node2.v0 = is.arr(config2.velocity) ? config2.velocity[i3] : config2.velocity; let velocity; const precision = config2.precision || (from == to2 ? 5e-3 : Math.min(1, Math.abs(to2 - from) * 1e-3)); if (!is.und(config2.duration)) { let p4 = 1; if (config2.duration > 0) { if (this._memoizedDuration !== config2.duration) { this._memoizedDuration = config2.duration; if (node2.durationProgress > 0) { node2.elapsedTime = config2.duration * node2.durationProgress; elapsed = node2.elapsedTime += dt; } } p4 = (config2.progress || 0) + elapsed / this._memoizedDuration; p4 = p4 > 1 ? 1 : p4 < 0 ? 0 : p4; node2.durationProgress = p4; } position = from + config2.easing(p4) * (to2 - from); velocity = (position - node2.lastPosition) / dt; finished = p4 == 1; } else if (config2.decay) { const decay = config2.decay === true ? 0.998 : config2.decay; const e3 = Math.exp(-(1 - decay) * elapsed); position = from + v0 / (1 - decay) * (1 - e3); finished = Math.abs(node2.lastPosition - position) <= precision; velocity = v0 * e3; } else { velocity = node2.lastVelocity == null ? v0 : node2.lastVelocity; const restVelocity = config2.restVelocity || precision / 10; const bounceFactor = config2.clamp ? 0 : config2.bounce; const canBounce = !is.und(bounceFactor); const isGrowing = from == to2 ? node2.v0 > 0 : from < to2; let isMoving; let isBouncing = false; const step = 1; const numSteps = Math.ceil(dt / step); for (let n3 = 0; n3 < numSteps; ++n3) { isMoving = Math.abs(velocity) > restVelocity; if (!isMoving) { finished = Math.abs(to2 - position) <= precision; if (finished) { break; } } if (canBounce) { isBouncing = position == to2 || position > to2 == isGrowing; if (isBouncing) { velocity = -velocity * bounceFactor; position = to2; } } const springForce = -config2.tension * 1e-6 * (position - to2); const dampingForce = -config2.friction * 1e-3 * velocity; const acceleration = (springForce + dampingForce) / config2.mass; velocity = velocity + acceleration * step; position = position + velocity * step; } } node2.lastVelocity = velocity; if (Number.isNaN(position)) { console.warn(`Got NaN while animating:`, this); finished = true; } } if (payload && !payload[i3].done) { finished = false; } if (finished) { node2.done = true; } else { idle = false; } if (node2.setValue(position, config2.round)) { changed = true; } }); const node = getAnimated(this); const currVal = node.getValue(); if (idle) { const finalVal = getFluidValue(anim.to); if ((currVal !== finalVal || changed) && !config2.decay) { node.setValue(finalVal); this._onChange(finalVal); } else if (changed && config2.decay) { this._onChange(currVal); } this._stop(); } else if (changed) { this._onChange(currVal); } } set(value) { raf.batchedUpdates(() => { this._stop(); this._focus(value); this._set(value); }); return this; } pause() { this._update({ pause: true }); } resume() { this._update({ pause: false }); } finish() { if (isAnimating(this)) { const { to: to2, config: config2 } = this.animation; raf.batchedUpdates(() => { this._onStart(); if (!config2.decay) { this._set(to2, false); } this._stop(); }); } return this; } update(props) { const queue = this.queue || (this.queue = []); queue.push(props); return this; } start(to2, arg2) { let queue; if (!is.und(to2)) { queue = [is.obj(to2) ? to2 : _extends3({}, arg2, { to: to2 })]; } else { queue = this.queue || []; this.queue = []; } return Promise.all(queue.map((props) => { const up = this._update(props); return up; })).then((results) => getCombinedResult(this, results)); } stop(cancel) { const { to: to2 } = this.animation; this._focus(this.get()); stopAsync(this._state, cancel && this._lastCallId); raf.batchedUpdates(() => this._stop(to2, cancel)); return this; } reset() { this._update({ reset: true }); } eventObserved(event) { if (event.type == "change") { this._start(); } else if (event.type == "priority") { this.priority = event.priority + 1; } } _prepareNode(props) { const key = this.key || ""; let { to: to2, from } = props; to2 = is.obj(to2) ? to2[key] : to2; if (to2 == null || isAsyncTo(to2)) { to2 = void 0; } from = is.obj(from) ? from[key] : from; if (from == null) { from = void 0; } const range = { to: to2, from }; if (!hasAnimated(this)) { if (props.reverse) [to2, from] = [from, to2]; from = getFluidValue(from); if (!is.und(from)) { this._set(from); } else if (!getAnimated(this)) { this._set(to2); } } return range; } _update(_ref, isLoop) { let props = _extends3({}, _ref); const { key, defaultProps } = this; if (props.default) Object.assign(defaultProps, getDefaultProps(props, (value, prop) => /^on/.test(prop) ? resolveProp(value, key) : value)); mergeActiveFn(this, props, "onProps"); sendEvent(this, "onProps", props, this); const range = this._prepareNode(props); if (Object.isFrozen(this)) { throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?"); } const state = this._state; return scheduleProps(++this._lastCallId, { key, props, defaultProps, state, actions: { pause: () => { if (!isPaused(this)) { setPausedBit(this, true); flushCalls(state.pauseQueue); sendEvent(this, "onPause", getFinishedResult(this, checkFinished(this, this.animation.to)), this); } }, resume: () => { if (isPaused(this)) { setPausedBit(this, false); if (isAnimating(this)) { this._resume(); } flushCalls(state.resumeQueue); sendEvent(this, "onResume", getFinishedResult(this, checkFinished(this, this.animation.to)), this); } }, start: this._merge.bind(this, range) } }).then((result) => { if (props.loop && result.finished && !(isLoop && result.noop)) { const nextProps = createLoopUpdate(props); if (nextProps) { return this._update(nextProps, true); } } return result; }); } _merge(range, props, resolve) { if (props.cancel) { this.stop(true); return resolve(getCancelledResult(this)); } const hasToProp = !is.und(range.to); const hasFromProp = !is.und(range.from); if (hasToProp || hasFromProp) { if (props.callId > this._lastToId) { this._lastToId = props.callId; } else { return resolve(getCancelledResult(this)); } } const { key, defaultProps, animation: anim } = this; const { to: prevTo, from: prevFrom } = anim; let { to: to2 = prevTo, from = prevFrom } = range; if (hasFromProp && !hasToProp && (!props.default || is.und(to2))) { to2 = from; } if (props.reverse) [to2, from] = [from, to2]; const hasFromChanged = !isEqual(from, prevFrom); if (hasFromChanged) { anim.from = from; } from = getFluidValue(from); const hasToChanged = !isEqual(to2, prevTo); if (hasToChanged) { this._focus(to2); } const hasAsyncTo = isAsyncTo(props.to); const { config: config2 } = anim; const { decay, velocity } = config2; if (hasToProp || hasFromProp) { config2.velocity = 0; } if (props.config && !hasAsyncTo) { mergeConfig(config2, callProp(props.config, key), props.config !== defaultProps.config ? callProp(defaultProps.config, key) : void 0); } let node = getAnimated(this); if (!node || is.und(to2)) { return resolve(getFinishedResult(this, true)); } const reset = is.und(props.reset) ? hasFromProp && !props.default : !is.und(from) && matchProp(props.reset, key); const value = reset ? from : this.get(); const goal = computeGoal(to2); const isAnimatable = is.num(goal) || is.arr(goal) || isAnimatedString(goal); const immediate = !hasAsyncTo && (!isAnimatable || matchProp(defaultProps.immediate || props.immediate, key)); if (hasToChanged) { const nodeType = getAnimatedType(to2); if (nodeType !== node.constructor) { if (immediate) { node = this._set(goal); } else throw Error(`Cannot animate between ${node.constructor.name} and ${nodeType.name}, as the "to" prop suggests`); } } const goalType = node.constructor; let started = hasFluidValue(to2); let finished = false; if (!started) { const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged; if (hasToChanged || hasValueChanged) { finished = isEqual(computeGoal(value), goal); started = !finished; } if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config2.decay, decay) || !isEqual(config2.velocity, velocity)) { started = true; } } if (finished && isAnimating(this)) { if (anim.changed && !reset) { started = true; } else if (!started) { this._stop(prevTo); } } if (!hasAsyncTo) { if (started || hasFluidValue(prevTo)) { anim.values = node.getPayload(); anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray(goal); } if (anim.immediate != immediate) { anim.immediate = immediate; if (!immediate && !reset) { this._set(prevTo); } } if (started) { const { onRest } = anim; each(ACTIVE_EVENTS, (type) => mergeActiveFn(this, props, type)); const result = getFinishedResult(this, checkFinished(this, prevTo)); flushCalls(this._pendingCalls, result); this._pendingCalls.add(resolve); if (anim.changed) raf.batchedUpdates(() => { anim.changed = !reset; onRest == null ? void 0 : onRest(result, this); if (reset) { callProp(defaultProps.onRest, result); } else { anim.onStart == null ? void 0 : anim.onStart(result, this); } }); } } if (reset) { this._set(value); } if (hasAsyncTo) { resolve(runAsync(props.to, props, this._state, this)); } else if (started) { this._start(); } else if (isAnimating(this) && !hasToChanged) { this._pendingCalls.add(resolve); } else { resolve(getNoopResult(value)); } } _focus(value) { const anim = this.animation; if (value !== anim.to) { if (getFluidObservers(this)) { this._detach(); } anim.to = value; if (getFluidObservers(this)) { this._attach(); } } } _attach() { let priority2 = 0; const { to: to2 } = this.animation; if (hasFluidValue(to2)) { addFluidObserver(to2, this); if (isFrameValue(to2)) { priority2 = to2.priority + 1; } } this.priority = priority2; } _detach() { const { to: to2 } = this.animation; if (hasFluidValue(to2)) { removeFluidObserver(to2, this); } } _set(arg, idle = true) { const value = getFluidValue(arg); if (!is.und(value)) { const oldNode = getAnimated(this); if (!oldNode || !isEqual(value, oldNode.getValue())) { const nodeType = getAnimatedType(value); if (!oldNode || oldNode.constructor != nodeType) { setAnimated(this, nodeType.create(value)); } else { oldNode.setValue(value); } if (oldNode) { raf.batchedUpdates(() => { this._onChange(value, idle); }); } } } return getAnimated(this); } _onStart() { const anim = this.animation; if (!anim.changed) { anim.changed = true; sendEvent(this, "onStart", getFinishedResult(this, checkFinished(this, anim.to)), this); } } _onChange(value, idle) { if (!idle) { this._onStart(); callProp(this.animation.onChange, value, this); } callProp(this.defaultProps.onChange, value, this); super._onChange(value, idle); } _start() { const anim = this.animation; getAnimated(this).reset(getFluidValue(anim.to)); if (!anim.immediate) { anim.fromValues = anim.values.map((node) => node.lastPosition); } if (!isAnimating(this)) { setActiveBit(this, true); if (!isPaused(this)) { this._resume(); } } } _resume() { if (globals.skipAnimation) { this.finish(); } else { frameLoop.start(this); } } _stop(goal, cancel) { if (isAnimating(this)) { setActiveBit(this, false); const anim = this.animation; each(anim.values, (node) => { node.done = true; }); if (anim.toValues) { anim.onChange = anim.onPause = anim.onResume = void 0; } callFluidObservers(this, { type: "idle", parent: this }); const result = cancel ? getCancelledResult(this.get()) : getFinishedResult(this.get(), checkFinished(this, goal != null ? goal : anim.to)); flushCalls(this._pendingCalls, result); if (anim.changed) { anim.changed = false; sendEvent(this, "onRest", result, this); } } } }; function checkFinished(target, to2) { const goal = computeGoal(to2); const value = computeGoal(target.get()); return isEqual(value, goal); } function createLoopUpdate(props, loop2 = props.loop, to2 = props.to) { let loopRet = callProp(loop2); if (loopRet) { const overrides = loopRet !== true && inferTo(loopRet); const reverse = (overrides || props).reverse; const reset = !overrides || overrides.reset; return createUpdate(_extends3({}, props, { loop: loop2, default: false, pause: void 0, to: !reverse || isAsyncTo(to2) ? to2 : void 0, from: reset ? props.from : void 0, reset }, overrides)); } } function createUpdate(props) { const { to: to2, from } = props = inferTo(props); const keys = /* @__PURE__ */ new Set(); if (is.obj(to2)) findDefined(to2, keys); if (is.obj(from)) findDefined(from, keys); props.keys = keys.size ? Array.from(keys) : null; return props; } function findDefined(values, keys) { eachProp(values, (value, key) => value != null && keys.add(key)); } var ACTIVE_EVENTS = ["onStart", "onRest", "onChange", "onPause", "onResume"]; function mergeActiveFn(target, props, type) { target.animation[type] = props[type] !== getDefaultProp(props, type) ? resolveProp(props[type], target.key) : void 0; } function sendEvent(target, type, ...args) { var _target$animation$typ, _target$animation, _target$defaultProps$, _target$defaultProps; (_target$animation$typ = (_target$animation = target.animation)[type]) == null ? void 0 : _target$animation$typ.call(_target$animation, ...args); (_target$defaultProps$ = (_target$defaultProps = target.defaultProps)[type]) == null ? void 0 : _target$defaultProps$.call(_target$defaultProps, ...args); } var BATCHED_EVENTS = ["onStart", "onChange", "onRest"]; var nextId = 1; var Controller = class { constructor(props, flush2) { this.id = nextId++; this.springs = {}; this.queue = []; this.ref = void 0; this._flush = void 0; this._initialProps = void 0; this._lastAsyncId = 0; this._active = /* @__PURE__ */ new Set(); this._changed = /* @__PURE__ */ new Set(); this._started = false; this._item = void 0; this._state = { paused: false, pauseQueue: /* @__PURE__ */ new Set(), resumeQueue: /* @__PURE__ */ new Set(), timeouts: /* @__PURE__ */ new Set() }; this._events = { onStart: /* @__PURE__ */ new Map(), onChange: /* @__PURE__ */ new Map(), onRest: /* @__PURE__ */ new Map() }; this._onFrame = this._onFrame.bind(this); if (flush2) { this._flush = flush2; } if (props) { this.start(_extends3({ default: true }, props)); } } get idle() { return !this._state.asyncTo && Object.values(this.springs).every((spring) => { return spring.idle && !spring.isDelayed && !spring.isPaused; }); } get item() { return this._item; } set item(item) { this._item = item; } get() { const values = {}; this.each((spring, key) => values[key] = spring.get()); return values; } set(values) { for (const key in values) { const value = values[key]; if (!is.und(value)) { this.springs[key].set(value); } } } update(props) { if (props) { this.queue.push(createUpdate(props)); } return this; } start(props) { let { queue } = this; if (props) { queue = toArray(props).map(createUpdate); } else { this.queue = []; } if (this._flush) { return this._flush(this, queue); } prepareKeys(this, queue); return flushUpdateQueue(this, queue); } stop(arg, keys) { if (arg !== !!arg) { keys = arg; } if (keys) { const springs = this.springs; each(toArray(keys), (key) => springs[key].stop(!!arg)); } else { stopAsync(this._state, this._lastAsyncId); this.each((spring) => spring.stop(!!arg)); } return this; } pause(keys) { if (is.und(keys)) { this.start({ pause: true }); } else { const springs = this.springs; each(toArray(keys), (key) => springs[key].pause()); } return this; } resume(keys) { if (is.und(keys)) { this.start({ pause: false }); } else { const springs = this.springs; each(toArray(keys), (key) => springs[key].resume()); } return this; } each(iterator) { eachProp(this.springs, iterator); } _onFrame() { const { onStart, onChange, onRest } = this._events; const active = this._active.size > 0; const changed = this._changed.size > 0; if (active && !this._started || changed && !this._started) { this._started = true; flush(onStart, ([onStart2, result]) => { result.value = this.get(); onStart2(result, this, this._item); }); } const idle = !active && this._started; const values = changed || idle && onRest.size ? this.get() : null; if (changed && onChange.size) { flush(onChange, ([onChange2, result]) => { result.value = values; onChange2(result, this, this._item); }); } if (idle) { this._started = false; flush(onRest, ([onRest2, result]) => { result.value = values; onRest2(result, this, this._item); }); } } eventObserved(event) { if (event.type == "change") { this._changed.add(event.parent); if (!event.idle) { this._active.add(event.parent); } } else if (event.type == "idle") { this._active.delete(event.parent); } else return; raf.onFrame(this._onFrame); } }; function flushUpdateQueue(ctrl, queue) { return Promise.all(queue.map((props) => flushUpdate(ctrl, props))).then((results) => getCombinedResult(ctrl, results)); } async function flushUpdate(ctrl, props, isLoop) { const { keys, to: to2, from, loop: loop2, onRest, onResolve } = props; const defaults2 = is.obj(props.default) && props.default; if (loop2) { props.loop = false; } if (to2 === false) props.to = null; if (from === false) props.from = null; const asyncTo = is.arr(to2) || is.fun(to2) ? to2 : void 0; if (asyncTo) { props.to = void 0; props.onRest = void 0; if (defaults2) { defaults2.onRest = void 0; } } else { each(BATCHED_EVENTS, (key) => { const handler = props[key]; if (is.fun(handler)) { const queue = ctrl["_events"][key]; props[key] = ({ finished, cancelled }) => { const result2 = queue.get(handler); if (result2) { if (!finished) result2.finished = false; if (cancelled) result2.cancelled = true; } else { queue.set(handler, { value: null, finished: finished || false, cancelled: cancelled || false }); } }; if (defaults2) { defaults2[key] = props[key]; } } }); } const state = ctrl["_state"]; if (props.pause === !state.paused) { state.paused = props.pause; flushCalls(props.pause ? state.pauseQueue : state.resumeQueue); } else if (state.paused) { props.pause = true; } const promises = (keys || Object.keys(ctrl.springs)).map((key) => ctrl.springs[key].start(props)); const cancel = props.cancel === true || getDefaultProp(props, "cancel") === true; if (asyncTo || cancel && state.asyncId) { promises.push(scheduleProps(++ctrl["_lastAsyncId"], { props, state, actions: { pause: noop2, resume: noop2, start(props2, resolve) { if (cancel) { stopAsync(state, ctrl["_lastAsyncId"]); resolve(getCancelledResult(ctrl)); } else { props2.onRest = onRest; resolve(runAsync(asyncTo, props2, state, ctrl)); } } } })); } if (state.paused) { await new Promise((resume) => { state.resumeQueue.add(resume); }); } const result = getCombinedResult(ctrl, await Promise.all(promises)); if (loop2 && result.finished && !(isLoop && result.noop)) { const nextProps = createLoopUpdate(props, loop2, to2); if (nextProps) { prepareKeys(ctrl, [nextProps]); return flushUpdate(ctrl, nextProps, true); } } if (onResolve) { raf.batchedUpdates(() => onResolve(result, ctrl, ctrl.item)); } return result; } function createSpring(key, observer) { const spring = new SpringValue(); spring.key = key; if (observer) { addFluidObserver(spring, observer); } return spring; } function prepareSprings(springs, props, create4) { if (props.keys) { each(props.keys, (key) => { const spring = springs[key] || (springs[key] = create4(key)); spring["_prepareNode"](props); }); } } function prepareKeys(ctrl, queue) { each(queue, (props) => { prepareSprings(ctrl.springs, props, (key) => { return createSpring(key, ctrl); }); }); } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i3; for (i3 = 0; i3 < sourceKeys.length; i3++) { key = sourceKeys[i3]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } var _excluded$3 = ["children"]; var SpringContext = (_ref) => { let { children } = _ref, props = _objectWithoutPropertiesLoose(_ref, _excluded$3); const inherited = (0, import_react3.useContext)(ctx); const pause = props.pause || !!inherited.pause, immediate = props.immediate || !!inherited.immediate; props = useMemoOne(() => ({ pause, immediate }), [pause, immediate]); const { Provider } = ctx; return React2.createElement(Provider, { value: props }, children); }; var ctx = makeContext(SpringContext, {}); SpringContext.Provider = ctx.Provider; SpringContext.Consumer = ctx.Consumer; function makeContext(target, init) { Object.assign(target, React2.createContext(init)); target.Provider._context = target; target.Consumer._context = target; return target; } var TransitionPhase; (function(TransitionPhase2) { TransitionPhase2["MOUNT"] = "mount"; TransitionPhase2["ENTER"] = "enter"; TransitionPhase2["UPDATE"] = "update"; TransitionPhase2["LEAVE"] = "leave"; })(TransitionPhase || (TransitionPhase = {})); var Interpolation = class extends FrameValue { constructor(source, args) { super(); this.key = void 0; this.idle = true; this.calc = void 0; this._active = /* @__PURE__ */ new Set(); this.source = source; this.calc = createInterpolator(...args); const value = this._get(); const nodeType = getAnimatedType(value); setAnimated(this, nodeType.create(value)); } advance(_dt) { const value = this._get(); const oldValue = this.get(); if (!isEqual(value, oldValue)) { getAnimated(this).setValue(value); this._onChange(value, this.idle); } if (!this.idle && checkIdle(this._active)) { becomeIdle(this); } } _get() { const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray(getFluidValue(this.source)); return this.calc(...inputs); } _start() { if (this.idle && !checkIdle(this._active)) { this.idle = false; each(getPayload(this), (node) => { node.done = false; }); if (globals.skipAnimation) { raf.batchedUpdates(() => this.advance()); becomeIdle(this); } else { frameLoop.start(this); } } } _attach() { let priority2 = 1; each(toArray(this.source), (source) => { if (hasFluidValue(source)) { addFluidObserver(source, this); } if (isFrameValue(source)) { if (!source.idle) { this._active.add(source); } priority2 = Math.max(priority2, source.priority + 1); } }); this.priority = priority2; this._start(); } _detach() { each(toArray(this.source), (source) => { if (hasFluidValue(source)) { removeFluidObserver(source, this); } }); this._active.clear(); becomeIdle(this); } eventObserved(event) { if (event.type == "change") { if (event.idle) { this.advance(); } else { this._active.add(event.parent); this._start(); } } else if (event.type == "idle") { this._active.delete(event.parent); } else if (event.type == "priority") { this.priority = toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0); } } }; function isIdle(source) { return source.idle !== false; } function checkIdle(active) { return !active.size || Array.from(active).every(isIdle); } function becomeIdle(self) { if (!self.idle) { self.idle = true; each(getPayload(self), (node) => { node.done = true; }); callFluidObservers(self, { type: "idle", parent: self }); } } globals.assign({ createStringInterpolator, to: (source, args) => new Interpolation(source, args) }); var update2 = frameLoop.advance; // node_modules/@react-spring/web/dist/react-spring-web.esm.js var import_react_dom = __toESM(require_react_dom()); function _objectWithoutPropertiesLoose2(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i3; for (i3 = 0; i3 < sourceKeys.length; i3++) { key = sourceKeys[i3]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } var _excluded$2 = ["style", "children", "scrollTop", "scrollLeft"]; var isCustomPropRE = /^--/; function dangerousStyleValue(name2, value) { if (value == null || typeof value === "boolean" || value === "") return ""; if (typeof value === "number" && value !== 0 && !isCustomPropRE.test(name2) && !(isUnitlessNumber.hasOwnProperty(name2) && isUnitlessNumber[name2])) return value + "px"; return ("" + value).trim(); } var attributeCache = {}; function applyAnimatedValues(instance, props) { if (!instance.nodeType || !instance.setAttribute) { return false; } const isFilterElement = instance.nodeName === "filter" || instance.parentNode && instance.parentNode.nodeName === "filter"; const _ref = props, { style, children, scrollTop, scrollLeft } = _ref, attributes = _objectWithoutPropertiesLoose2(_ref, _excluded$2); const values = Object.values(attributes); const names = Object.keys(attributes).map((name2) => isFilterElement || instance.hasAttribute(name2) ? name2 : attributeCache[name2] || (attributeCache[name2] = name2.replace(/([A-Z])/g, (n3) => "-" + n3.toLowerCase()))); if (children !== void 0) { instance.textContent = children; } for (let name2 in style) { if (style.hasOwnProperty(name2)) { const value = dangerousStyleValue(name2, style[name2]); if (isCustomPropRE.test(name2)) { instance.style.setProperty(name2, value); } else { instance.style[name2] = value; } } } names.forEach((name2, i3) => { instance.setAttribute(name2, values[i3]); }); if (scrollTop !== void 0) { instance.scrollTop = scrollTop; } if (scrollLeft !== void 0) { instance.scrollLeft = scrollLeft; } } var isUnitlessNumber = { animationIterationCount: true, borderImageOutset: true, borderImageSlice: true, borderImageWidth: true, boxFlex: true, boxFlexGroup: true, boxOrdinalGroup: true, columnCount: true, columns: true, flex: true, flexGrow: true, flexPositive: true, flexShrink: true, flexNegative: true, flexOrder: true, gridRow: true, gridRowEnd: true, gridRowSpan: true, gridRowStart: true, gridColumn: true, gridColumnEnd: true, gridColumnSpan: true, gridColumnStart: true, fontWeight: true, lineClamp: true, lineHeight: true, opacity: true, order: true, orphans: true, tabSize: true, widows: true, zIndex: true, zoom: true, fillOpacity: true, floodOpacity: true, stopOpacity: true, strokeDasharray: true, strokeDashoffset: true, strokeMiterlimit: true, strokeOpacity: true, strokeWidth: true }; var prefixKey = (prefix2, key) => prefix2 + key.charAt(0).toUpperCase() + key.substring(1); var prefixes = ["Webkit", "Ms", "Moz", "O"]; isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => { prefixes.forEach((prefix2) => acc[prefixKey(prefix2, prop)] = acc[prop]); return acc; }, isUnitlessNumber); var _excluded$1 = ["x", "y", "z"]; var domTransforms = /^(matrix|translate|scale|rotate|skew)/; var pxTransforms = /^(translate)/; var degTransforms = /^(rotate|skew)/; var addUnit = (value, unit) => is.num(value) && value !== 0 ? value + unit : value; var isValueIdentity = (value, id) => is.arr(value) ? value.every((v3) => isValueIdentity(v3, id)) : is.num(value) ? value === id : parseFloat(value) === id; var AnimatedStyle = class extends AnimatedObject { constructor(_ref) { let { x: x2, y: y3, z } = _ref, style = _objectWithoutPropertiesLoose2(_ref, _excluded$1); const inputs = []; const transforms = []; if (x2 || y3 || z) { inputs.push([x2 || 0, y3 || 0, z || 0]); transforms.push((xyz) => [`translate3d(${xyz.map((v3) => addUnit(v3, "px")).join(",")})`, isValueIdentity(xyz, 0)]); } eachProp(style, (value, key) => { if (key === "transform") { inputs.push([value || ""]); transforms.push((transform) => [transform, transform === ""]); } else if (domTransforms.test(key)) { delete style[key]; if (is.und(value)) return; const unit = pxTransforms.test(key) ? "px" : degTransforms.test(key) ? "deg" : ""; inputs.push(toArray(value)); transforms.push(key === "rotate3d" ? ([x3, y4, z2, deg]) => [`rotate3d(${x3},${y4},${z2},${addUnit(deg, unit)})`, isValueIdentity(deg, 0)] : (input) => [`${key}(${input.map((v3) => addUnit(v3, unit)).join(",")})`, isValueIdentity(input, key.startsWith("scale") ? 1 : 0)]); } }); if (inputs.length) { style.transform = new FluidTransform(inputs, transforms); } super(style); } }; var FluidTransform = class extends FluidValue { constructor(inputs, transforms) { super(); this._value = null; this.inputs = inputs; this.transforms = transforms; } get() { return this._value || (this._value = this._get()); } _get() { let transform = ""; let identity3 = true; each(this.inputs, (input, i3) => { const arg1 = getFluidValue(input[0]); const [t4, id] = this.transforms[i3](is.arr(arg1) ? arg1 : input.map(getFluidValue)); transform += " " + t4; identity3 = identity3 && id; }); return identity3 ? "none" : transform; } observerAdded(count) { if (count == 1) each(this.inputs, (input) => each(input, (value) => hasFluidValue(value) && addFluidObserver(value, this))); } observerRemoved(count) { if (count == 0) each(this.inputs, (input) => each(input, (value) => hasFluidValue(value) && removeFluidObserver(value, this))); } eventObserved(event) { if (event.type == "change") { this._value = null; } callFluidObservers(this, event); } }; var primitives = ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"]; var _excluded = ["scrollTop", "scrollLeft"]; globals.assign({ batchedUpdates: import_react_dom.unstable_batchedUpdates, createStringInterpolator, colors }); var host = createHost(primitives, { applyAnimatedValues, createAnimatedStyle: (style) => new AnimatedStyle(style), getComponentProps: (_ref) => { let props = _objectWithoutPropertiesLoose2(_ref, _excluded); return props; } }); var animated = host.animated; // packages/fields/build-module/components/media-edit/use-moving-animation.mjs var import_element5 = __toESM(require_element(), 1); function getAbsolutePosition(element) { return { top: element.offsetTop, left: element.offsetLeft }; } function useMovingAnimation(triggerAnimationOnChange) { const ref = (0, import_element5.useRef)(null); const previousRef = (0, import_element5.useRef)(void 0); if (ref.current) { previousRef.current = getAbsolutePosition(ref.current); } (0, import_element5.useLayoutEffect)(() => { const previous = previousRef.current; if (!previous || !ref.current) { return; } if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) { return; } const controller = new Controller({ x: 0, y: 0, config: { mass: 5, tension: 2e3, friction: 200 }, onChange({ value }) { if (!ref.current) { return; } let { x: x22, y: y22 } = value; x22 = Math.round(x22); y22 = Math.round(y22); const finishedMoving = x22 === 0 && y22 === 0; ref.current.style.transform = finishedMoving ? "" : `translate3d(${x22}px,${y22}px,0)`; } }); ref.current.style.transform = ""; const destination = getAbsolutePosition(ref.current); const x2 = Math.round(previous.left - destination.left); const y3 = Math.round(previous.top - destination.top); controller.start({ x: 0, y: 0, from: { x: x2, y: y3 } }); return () => { controller.stop(); controller.set({ x: 0, y: 0 }); }; }, [triggerAnimationOnChange]); return ref; } // packages/fields/build-module/components/media-edit/index.mjs var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1); var { MediaUploadModal } = unlock2(import_media_utils2.privateApis); function AnimatedMediaItem({ children, index: index2, className }) { const ref = useMovingAnimation(index2); return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { ref, className, children }); } function normalizeValue(value) { if (Array.isArray(value)) { return value; } return value ? [value] : []; } function ConditionalMediaUpload({ render: render4, multiple, ...props }) { const [isModalOpen, setIsModalOpen] = (0, import_element6.useState)(false); if (window.__experimentalDataViewsMediaModal) { return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [ render4 && render4({ open: () => setIsModalOpen(true) }), isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( MediaUploadModal, { ...props, multiple, isOpen: isModalOpen, onClose: () => { setIsModalOpen(false); props.onClose?.(); }, onSelect: (media) => { setIsModalOpen(false); props.onSelect?.(media); } } ) ] }); } return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( import_media_utils2.MediaUpload, { ...props, render: render4, 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_runtime81.jsxs)( "div", { className: clsx_default("fields__media-edit-picker-button", { "has-attachment": attachment }), 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_runtime81.jsx)("span", { className: "fields__media-edit-picker-button-spinner", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_components5.Spinner, {}) }), !isUploading && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( import_components5.DropZone, { onFilesDrop: (files) => onFilesDrop(files, attachment?.id) } ) ] } ); if (!showTooltip) { return mediaPickerButton; } return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_components5.Tooltip, { text: label, placement: "top", 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_runtime81.jsx)(import_components5.__experimentalTruncate, { className: "fields__media-edit-filename", children: attachment.title.rendered }); } function MediaEditPlaceholder(props) { return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(MediaPickerButton, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "fields__media-edit-placeholder", children: props.label }) }); } function MoveButtons({ itemId, index: index2, totalItems, isUploading, moveItem, orientation = "vertical" }) { const isHorizontal = orientation === "horizontal"; return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( import_components5.Button, { __next40pxDefaultSize: true, icon: isHorizontal ? chevron_left_default : chevron_up_default, label: isHorizontal ? (0, import_i18n13.__)("Move left") : (0, import_i18n13.__)("Move up"), size: "small", disabled: isUploading || index2 === 0, accessibleWhenDisabled: true, tooltipPosition: "top", onClick: (event) => { event.stopPropagation(); moveItem(itemId, "up"); } } ), /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( import_components5.Button, { __next40pxDefaultSize: true, icon: isHorizontal ? chevron_right_default : chevron_down_default, label: isHorizontal ? (0, import_i18n13.__)("Move right") : (0, import_i18n13.__)("Move down"), size: "small", disabled: isUploading || index2 === totalItems - 1, accessibleWhenDisabled: true, tooltipPosition: "top", onClick: (event) => { event.stopPropagation(); moveItem(itemId, "down"); } } ) ] }); } function MediaPreview({ attachment }) { const url = attachment.source_url; const mimeType = attachment.mime_type || ""; if (mimeType.startsWith("image")) { return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( "img", { className: "fields__media-edit-thumbnail", alt: attachment.alt_text || "", src: url } ); } else if (mimeType.startsWith("audio")) { return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_components5.Icon, { icon: audio_default }); } else if (mimeType.startsWith("video")) { return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_components5.Icon, { icon: video_default }); } else if (archiveMimeTypes.includes(mimeType)) { return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_components5.Icon, { icon: archive_default }); } return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_components5.Icon, { icon: file_default }); } function ExpandedMediaEditAttachments({ allItems, addButtonLabel, multiple, removeItem, moveItem, open, onFilesDrop, isUploading, setTargetItemId }) { return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)( "div", { className: clsx_default("fields__media-edit-expanded", { "is-multiple": multiple, "is-single": !multiple, "is-empty": !allItems?.length }), children: [ allItems?.map((attachment, index2) => { const hasPreviewImage = attachment.mime_type?.startsWith("image"); const isBlob = (0, import_blob.isBlobURL)(attachment.source_url); const attachmentNumericId = attachment.id; return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)( AnimatedMediaItem, { index: index2, className: clsx_default("fields__media-edit-expanded-item", { "has-preview-image": hasPreviewImage }), children: [ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( MediaPickerButton, { open: () => { setTargetItemId(attachmentNumericId); open(); }, label: !isBlob ? (0, import_i18n13.sprintf)( /* translators: %s: The title of the media item. */ (0, import_i18n13.__)("Replace %s"), attachment.title.rendered ) : (0, import_i18n13.__)("Replace"), showTooltip: true, onFilesDrop, attachment, isUploading, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "fields__media-edit-expanded-preview", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( import_components5.__experimentalVStack, { spacing: 0, alignment: "center", justify: "center", className: "fields__media-edit-expanded-preview-stack", children: (!isBlob || hasPreviewImage) && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( MediaPreview, { attachment } ) } ) }) } ), !isBlob && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "fields__media-edit-expanded-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)( import_components5.__experimentalHStack, { className: "fields__media-edit-expanded-actions", spacing: 0, alignment: "flex-end", expanded: false, children: [ multiple && allItems.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( MoveButtons, { itemId: attachmentNumericId, index: index2, totalItems: allItems.length, isUploading, moveItem, orientation: "horizontal" } ), /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( import_components5.Button, { __next40pxDefaultSize: true, icon: close_small_default, label: (0, import_i18n13.__)("Remove"), size: "small", disabled: isUploading, accessibleWhenDisabled: true, tooltipPosition: "top", onClick: (event) => { event.stopPropagation(); removeItem(attachmentNumericId); } } ) ] } ) }) ] }, attachment.id ); }), (multiple || !allItems?.length) && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( MediaEditPlaceholder, { open: () => { setTargetItemId(void 0); open(); }, label: addButtonLabel, onFilesDrop, isUploading } ) ] } ); } function CompactMediaEditAttachments({ allItems, addButtonLabel, multiple, removeItem, moveItem, open, onFilesDrop, isUploading, setTargetItemId }) { return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [ !!allItems?.length && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( "div", { className: clsx_default("fields__media-edit-compact-group", { "is-single": allItems.length === 1 }), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_components5.__experimentalVStack, { spacing: 0, children: allItems.map((attachment, index2) => { const isBlob = (0, import_blob.isBlobURL)(attachment.source_url); const showMoveButtons = multiple && allItems.length > 1; const attachmentNumericId = attachment.id; return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)( AnimatedMediaItem, { index: index2, className: "fields__media-edit-compact", children: [ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( MediaPickerButton, { open: () => { setTargetItemId( attachmentNumericId ); open(); }, label: (0, import_i18n13.__)("Replace"), showTooltip: true, onFilesDrop, attachment, isUploading, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( MediaPreview, { attachment } ), !isBlob && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( MediaTitle, { attachment } ) ] }) } ), !isBlob && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)( import_components5.__experimentalHStack, { className: "fields__media-edit-compact-movers", spacing: 0, alignment: "flex-end", expanded: false, children: [ showMoveButtons && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( MoveButtons, { itemId: attachmentNumericId, index: index2, totalItems: allItems.length, isUploading, moveItem, orientation: "vertical" } ), /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( import_components5.Button, { __next40pxDefaultSize: true, icon: close_small_default, label: (0, import_i18n13.__)("Remove"), size: "small", disabled: isUploading, accessibleWhenDisabled: true, tooltipPosition: "top", onClick: (event) => { event.stopPropagation(); removeItem( attachmentNumericId ); } } ) ] } ) ] }, attachment.id ); }) }) } ), (multiple || !allItems?.length) && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( MediaEditPlaceholder, { open: () => { setTargetItemId(void 0); open(); }, label: addButtonLabel, onFilesDrop, isUploading } ) ] }); } function MediaEdit({ data, field, onChange, hideLabelFromVision, allowedTypes = ["image"], multiple, isExpanded, validity }) { const value = field.getValue({ item: data }); const [isTouched, setIsTouched] = (0, import_element6.useState)(false); const validityTargetRef = (0, import_element6.useRef)(null); const [customValidity, setCustomValidity] = (0, import_element6.useState)(void 0); (0, import_element6.useEffect)(() => { const validityTarget = validityTargetRef.current; const handler = () => { setIsTouched(true); }; validityTarget?.addEventListener("invalid", handler); return () => validityTarget?.removeEventListener("invalid", handler); }, []); const attachments = (0, import_data8.useSelect)( (select6) => { if (!value) { return null; } const normalizedValue = normalizeValue(value); const sortedIds = [...normalizedValue].sort((a3, b3) => a3 - b3); const { getEntityRecords } = select6(import_core_data6.store); return getEntityRecords("postType", "attachment", { include: sortedIds }); }, [value] ); const stableAttachmentsRef = (0, import_element6.useRef)( null ); if (attachments !== null) { stableAttachmentsRef.current = attachments; } let stableAttachments = attachments; if (attachments === null && stableAttachmentsRef.current && value) { const stableIds = new Set( stableAttachmentsRef.current.map((a3) => a3.id) ); if (normalizeValue(value).every((id) => stableIds.has(id))) { stableAttachments = stableAttachmentsRef.current; } } const orderedAttachments = (0, import_element6.useMemo)(() => { if (!stableAttachments) { return null; } const normalizedValue = normalizeValue(value); const attachmentMap = new Map( stableAttachments.map((a3) => [a3.id, a3]) ); return normalizedValue.map((id) => attachmentMap.get(id)).filter((a3) => a3 !== void 0); }, [stableAttachments, value]); const { createErrorNotice } = (0, import_data8.useDispatch)(import_notices3.store); const { receiveEntityRecords } = (0, import_data8.useDispatch)(import_core_data6.store); const [targetItemId, setTargetItemId] = (0, import_element6.useState)(); const openModalRef = (0, import_element6.useRef)(void 0); const [pendingOpen, setPendingOpen] = (0, import_element6.useState)(false); const [blobs, setBlobs] = (0, import_element6.useState)([]); (0, import_element6.useEffect)(() => { if (pendingOpen) { setPendingOpen(false); openModalRef.current?.(); } }, [pendingOpen]); const onChangeControl = (0, import_element6.useCallback)( (newValue) => onChange(field.setValue({ item: data, value: newValue })), [data, field, onChange] ); const removeItem = (0, import_element6.useCallback)( (itemId) => { const currentIds = normalizeValue(value); const newIds = currentIds.filter((id) => id !== itemId); setIsTouched(true); onChangeControl(newIds.length ? newIds : void 0); }, [value, onChangeControl] ); const moveItem = (0, import_element6.useCallback)( (itemId, direction) => { if (!orderedAttachments) { return; } const currentIds = orderedAttachments.map((a3) => a3.id); const index2 = currentIds.indexOf(itemId); const newIndex = direction === "up" ? index2 - 1 : index2 + 1; [currentIds[index2], currentIds[newIndex]] = [ currentIds[newIndex], currentIds[index2] ]; onChangeControl(currentIds); }, [orderedAttachments, onChangeControl] ); const onFilesDrop = (0, import_element6.useCallback)( (files, _targetItemId) => { setTargetItemId(_targetItemId); (0, import_media_utils2.uploadMedia)({ allowedTypes: allowedTypes?.length ? allowedTypes : void 0, filesList: files, onFileChange(uploadedMedia) { const blobUrls = uploadedMedia.filter((item) => (0, import_blob.isBlobURL)(item.url)).map((item) => item.url); setBlobs(blobUrls); if (!!blobUrls.length) { return; } receiveEntityRecords( "postType", "attachment", [], void 0, true ); const uploadedIds = uploadedMedia.map( (item) => item.id ); if (!multiple) { onChangeControl(uploadedIds[0]); setTargetItemId(void 0); return; } const currentValue = normalizeValue(value); if (_targetItemId === void 0) { onChangeControl([...currentValue, ...uploadedIds]); } else { const newValue = [...currentValue]; newValue.splice( currentValue.indexOf(_targetItemId), 1, ...uploadedIds ); onChangeControl(newValue); } setTargetItemId(void 0); }, onError(error) { setTargetItemId(void 0); setBlobs([]); createErrorNotice(error.message, { type: "snackbar" }); }, multiple: !!multiple }); }, [ allowedTypes, value, multiple, createErrorNotice, onChangeControl, receiveEntityRecords ] ); const addButtonLabel = field.placeholder || (multiple ? (0, import_i18n13.__)("Choose files") : (0, import_i18n13.__)("Choose file")); const allItems = (0, import_element6.useMemo)(() => { if (!blobs.length) { return orderedAttachments; } const items = [ ...orderedAttachments || [] ]; const blobItems = blobs.map((url) => ({ id: url, source_url: url, mime_type: (0, import_blob.getBlobTypeByURL)(url) })); if (targetItemId !== void 0) { const targetIndex = items.findIndex( (a3) => a3.id === targetItemId ); items.splice(targetIndex, 1, ...blobItems); } else { items.push(...blobItems); } return items; }, [orderedAttachments, targetItemId, blobs]); (0, import_element6.useEffect)(() => { if (!isTouched) { return; } const input = validityTargetRef.current; if (!input) { return; } if (validity) { const customValidityResult = validity?.custom; setCustomValidity(customValidityResult); if (customValidityResult?.type === "invalid") { input.setCustomValidity( customValidityResult.message || (0, import_i18n13.__)("Invalid") ); } else { input.setCustomValidity(""); } } else { input.setCustomValidity(""); setCustomValidity(void 0); } }, [isTouched, field.isValid, validity]); const onBlur = (0, import_element6.useCallback)( (event) => { if (isTouched) { return; } if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) { setIsTouched(true); } }, [isTouched] ); return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { onBlur, children: [ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("fieldset", { className: "fields__media-edit", "data-field-id": field.id, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( ConditionalMediaUpload, { onSelect: (selectedMedia) => { if (!multiple) { onChangeControl(selectedMedia.id); setTargetItemId(void 0); return; } const newIds = Array.isArray(selectedMedia) ? selectedMedia.map((m2) => m2.id) : [selectedMedia.id]; const currentValue = normalizeValue(value); if (!currentValue.length) { onChangeControl(newIds); } else if (targetItemId === void 0) { const existingItems = currentValue.filter( (id) => newIds.includes(id) ); const newItems = newIds.filter( (id) => !currentValue.includes(id) ); onChangeControl([ ...existingItems, ...newItems ]); } else if (selectedMedia.id !== targetItemId) { const filtered = currentValue.filter( (id) => id !== selectedMedia.id ); onChangeControl( filtered.map( (id) => id === targetItemId ? selectedMedia.id : id ) ); } setTargetItemId(void 0); }, onClose: () => setTargetItemId(void 0), allowedTypes, value: targetItemId !== void 0 ? targetItemId : value, multiple: multiple && targetItemId === void 0, title: field.label, render: ({ open }) => { openModalRef.current = open; const AttachmentsComponent = isExpanded ? ExpandedMediaEditAttachments : CompactMediaEditAttachments; return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_components5.__experimentalVStack, { spacing: 2, children: [ field.label && (hideLabelFromVision ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_components5.VisuallyHidden, { as: "legend", children: field.label }) : /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( import_components5.BaseControl.VisualLabel, { as: "legend", style: { marginBottom: 0 }, children: field.label } )), /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( AttachmentsComponent, { allItems, addButtonLabel, multiple, removeItem, moveItem, open: () => setPendingOpen(true), onFilesDrop, isUploading: !!blobs.length, setTargetItemId } ), field.description && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_components5.__experimentalText, { variant: "muted", children: field.description }) ] }); } } ) }), /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_components5.VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( "input", { type: "text", ref: validityTargetRef, value: value ?? "", tabIndex: -1, "aria-hidden": "true", onChange: () => { } } ) }), customValidity && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { "aria-live": "polite", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)( "p", { className: clsx_default( "components-validated-control__indicator", { "is-invalid": customValidity.type === "invalid", "is-valid": customValidity.type === "valid" } ), children: [ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( import_components5.Icon, { className: "components-validated-control__indicator-icon", icon: error_default, size: 16, fill: "currentColor" } ), customValidity.message ] } ) }) ] }); } // packages/fields/build-module/fields/featured-image/featured-image-view.mjs var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1); var FeaturedImageView = ({ item, config: config2 }) => { const media = item?._embedded?.["wp:featuredmedia"]?.[0]; const url = media?.source_url; if (url) { return /* @__PURE__ */ (0, import_jsx_runtime82.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: config2?.sizes || "100vw" } ); } return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "fields-controls__featured-image-placeholder" }); }; // packages/fields/build-module/fields/featured-image/index.mjs var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1); var featuredImageField = { id: "featured_media", type: "media", label: (0, import_i18n14.__)("Featured Image"), Edit: (props) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(MediaEdit, { ...props, isExpanded: true }), 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_element7 = __toESM(require_element(), 1); var import_core_data8 = __toESM(require_core_data(), 1); var import_components6 = __toESM(require_components(), 1); var import_data10 = __toESM(require_data(), 1); var import_i18n15 = __toESM(require_i18n(), 1); // packages/fields/build-module/fields/template/hooks.mjs var import_data9 = __toESM(require_data(), 1); var import_core_data7 = __toESM(require_core_data(), 1); function getTemplateSlugToCheck(postType2, slug) { if (slug) { return postType2 === "page" ? `${postType2}-${slug}` : `single-${postType2}-${slug}`; } return postType2 === "page" ? "page" : `single-${postType2}`; } var NAME_NOT_FOUND = ""; function useDefaultTemplateLabel(postType2, postId2, slug) { return (0, import_data9.useSelect)( (select6) => { if (!postType2 || !postId2) { return NAME_NOT_FOUND; } const postIdStr = String(postId2); const homePage = unlock2(select6(import_core_data7.store)).getHomePage(); if (postType2 === "page" && homePage?.postType === "page" && homePage?.postId === postIdStr) { const templates = select6( import_core_data7.store ).getEntityRecords("postType", "wp_template", { per_page: -1 }); const frontPage = templates?.find( (t4) => t4.slug === "front-page" ); if (frontPage) { return getItemTitle(frontPage); } } const postsPageId = unlock2(select6(import_core_data7.store)).getPostsPageId(); if (postType2 === "page" && postsPageId === postIdStr) { const templateId22 = select6(import_core_data7.store).getDefaultTemplateId({ slug: "home" }); if (!templateId22) { return NAME_NOT_FOUND; } const template22 = select6( import_core_data7.store ).getEntityRecord( "postType", "wp_template", templateId22 ); return template22 ? getItemTitle(template22) : NAME_NOT_FOUND; } const slugToCheck = getTemplateSlugToCheck(postType2, slug); const templateId2 = select6(import_core_data7.store).getDefaultTemplateId({ slug: slugToCheck }); if (!templateId2) { return NAME_NOT_FOUND; } const template2 = select6(import_core_data7.store).getEntityRecord( "postType", "wp_template", templateId2 ); return template2 ? getItemTitle(template2) : NAME_NOT_FOUND; }, [postType2, postId2, slug] ); } // packages/fields/build-module/fields/template/template-edit.mjs var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1); var EMPTY_ARRAY2 = []; 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 { templates, canSwitchTemplate } = (0, import_data10.useSelect)( (select6) => { const allTemplates = select6(import_core_data8.store).getEntityRecords( "postType", "wp_template", { per_page: -1, post_type: postType2 } ) ?? EMPTY_ARRAY2; const { getHomePage, getPostsPageId } = unlock2( select6(import_core_data8.store) ); const singlePostId = String(postId2); const isPostsPage = singlePostId !== void 0 && getPostsPageId() === singlePostId; const isFrontPage = singlePostId !== void 0 && postType2 === "page" && getHomePage()?.postId === singlePostId; return { templates: allTemplates, canSwitchTemplate: !isPostsPage && !isFrontPage }; }, [postId2, postType2] ); const defaultTemplateLabel = useDefaultTemplateLabel( postType2, postId2, slug ); const value = field.getValue({ item: data }); const onChangeControl = (0, import_element7.useCallback)( (newValue) => onChange({ [id]: newValue }), [id, onChange] ); const options = (0, import_element7.useMemo)(() => { const templateOptions = templates.map((template2) => ({ label: getItemTitle(template2), value: template2.slug })); return [ { label: defaultTemplateLabel, value: "" }, ...templateOptions ]; }, [templates, defaultTemplateLabel]); return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)( import_components6.SelectControl, { __next40pxDefaultSize: true, label: (0, import_i18n15.__)("Template"), hideLabelFromVision: true, value, options, onChange: onChangeControl, disabled: !canSwitchTemplate } ); }; // packages/fields/build-module/fields/template/template-view.mjs var import_data11 = __toESM(require_data(), 1); var import_core_data9 = __toESM(require_core_data(), 1); var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1); var TemplateView = ({ item, field }) => { const postType2 = item.type; const slug = item.slug; const postId2 = item.id; const templateSlug = field.getValue({ item }); const defaultTemplateLabel = useDefaultTemplateLabel( postType2, postId2, slug ); const templateLabel = (0, import_data11.useSelect)( (select6) => { if (!templateSlug) { return; } const allTemplates = select6( import_core_data9.store ).getEntityRecords("postType", "wp_template", { per_page: -1, post_type: postType2 }); const match3 = allTemplates?.find( (t4) => t4.slug === templateSlug ); return match3 ? getItemTitle(match3) : void 0; }, [postType2, templateSlug] ); return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_jsx_runtime85.Fragment, { children: templateLabel ?? defaultTemplateLabel }); }; // packages/fields/build-module/fields/template/index.mjs var templateField = { id: "template", type: "text", label: (0, import_i18n16.__)("Template"), Edit: TemplateEdit, render: TemplateView, 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_data12 = __toESM(require_data(), 1); var import_element8 = __toESM(require_element(), 1); var import_core_data10 = __toESM(require_core_data(), 1); var import_compose2 = __toESM(require_compose(), 1); var import_html_entities3 = __toESM(require_html_entities(), 1); var import_i18n18 = __toESM(require_i18n(), 1); var import_url6 = __toESM(require_url(), 1); // packages/fields/build-module/fields/parent/utils.mjs var import_html_entities2 = __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_entities2.decodeEntities)(post2.title.rendered) : `#${post2?.id} (${(0, import_i18n17.__)("no title")})`; } // packages/fields/build-module/fields/parent/parent-edit.mjs var import_jsx_runtime86 = __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_element8.useState)(null); const pageId = data.parent; const postId2 = data.id; const postTypeSlug = data.type; const { parentPostTitle, pageItems, isHierarchical } = (0, import_data12.useSelect)( (select6) => { const { getEntityRecord, getEntityRecords, getPostType } = select6(import_core_data10.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_element8.useMemo)(() => { const getOptionsFromTree = (tree2, level = 0) => { const mappedNodes = tree2.map((treeNode) => [ { value: treeNode.id, label: "\u2014 ".repeat(level) + (0, import_html_entities3.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_runtime86.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_compose2.debounce)( (value) => handleKeydown(value), 300 ), onChange: handleChange, hideLabelFromVision: true } ); } var ParentEdit = ({ data, field, onChange }) => { const { id } = field; const homeUrl = (0, import_data12.useSelect)((select6) => { return select6(import_core_data10.store).getEntityRecord("root", "__unstableBase")?.home; }, []); const onChangeControl = (0, import_element8.useCallback)( (newValue) => onChange({ [id]: newValue }), [id, onChange] ); return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("fieldset", { className: "fields-controls__parent", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { children: [ (0, import_element8.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/services/pricing.' ), (0, import_url6.filterURLForDisplay)(homeUrl).replace( /([/.])/g, "$1" ) ), { wbr: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("wbr", {}) } ), /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("p", { children: (0, import_element8.createInterpolateElement)( (0, import_i18n18.__)( "They also show up as sub-items in the default navigation menu. Learn more." ), { a: /* @__PURE__ */ (0, import_jsx_runtime86.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_runtime86.jsx)( PageAttributesParent, { data, onChangeControl } ) ] }) }); }; // packages/fields/build-module/fields/parent/parent-view.mjs var import_data13 = __toESM(require_data(), 1); var import_core_data11 = __toESM(require_core_data(), 1); var import_i18n19 = __toESM(require_i18n(), 1); var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1); var ParentView = ({ item }) => { const parent = (0, import_data13.useSelect)( (select6) => { const { getEntityRecord } = select6(import_core_data11.store); return item?.parent ? getEntityRecord("postType", item.type, item.parent) : null; }, [item.parent, item.type] ); if (parent) { return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_jsx_runtime87.Fragment, { children: getTitleWithFallbackName(parent) }); } return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_jsx_runtime87.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_element9 = __toESM(require_element(), 1); var import_i18n21 = __toESM(require_i18n(), 1); var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1); function PasswordEdit({ data, onChange, field }) { const [showPassword, setShowPassword] = (0, import_element9.useState)( !!field.getValue({ item: data }) ); const handleTogglePassword = (value) => { setShowPassword(value); if (!value) { onChange({ password: "" }); } }; return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)( import_components8.__experimentalVStack, { as: "fieldset", spacing: 4, className: "fields-controls__password", children: [ /* @__PURE__ */ (0, import_jsx_runtime88.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_runtime88.jsx)("div", { className: "fields-controls__password-input", children: /* @__PURE__ */ (0, import_jsx_runtime88.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_runtime89 = __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_runtime89.jsxs)(import_components9.__experimentalHStack, { alignment: "left", spacing: 0, children: [ icon && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "edit-site-post-list__status-icon", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_components9.Icon, { icon }) }), /* @__PURE__ */ (0, import_jsx_runtime89.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_runtime90 = __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_runtime90.jsx)( import_components10.CheckboxControl, { label: (0, import_i18n26.__)("Enable pingbacks & trackbacks"), checked: pingStatus === "open", onChange: onTogglePingback, help: /* @__PURE__ */ (0, import_jsx_runtime90.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_element10 = __toESM(require_element(), 1); var import_date2 = __toESM(require_date(), 1); var import_jsx_runtime91 = __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_element10.createInterpolateElement)( (0, import_i18n28.sprintf)( /* translators: %s: page creation or modification date. */ (0, import_i18n28.__)("Modified: "), getFormattedDate(item.date ?? null) ), { span: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", {}), time: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("time", {}) } ); } const isScheduled = item.status === "future"; if (isScheduled) { return (0, import_element10.createInterpolateElement)( (0, import_i18n28.sprintf)( /* translators: %s: page creation date */ (0, import_i18n28.__)("Scheduled: "), getFormattedDate(item.date ?? null) ), { span: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", {}), time: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("time", {}) } ); } const isPublished = item.status === "publish"; if (isPublished) { return (0, import_element10.createInterpolateElement)( (0, import_i18n28.sprintf)( /* translators: %s: page creation time */ (0, import_i18n28.__)("Published: "), getFormattedDate(item.date ?? null) ), { span: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", {}), time: /* @__PURE__ */ (0, import_jsx_runtime91.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_element10.createInterpolateElement)( (0, import_i18n28.sprintf)( /* translators: %s: page creation or modification date. */ (0, import_i18n28.__)("Modified: "), getFormattedDate(dateToDisplay ?? null) ), { span: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", {}), time: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("time", {}) } ); } return /* @__PURE__ */ (0, import_jsx_runtime91.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_data15 = __toESM(require_data(), 1); var import_core_data13 = __toESM(require_core_data(), 1); // packages/fields/build-module/fields/author/author-view.mjs var import_i18n30 = __toESM(require_i18n(), 1); var import_element11 = __toESM(require_element(), 1); var import_components11 = __toESM(require_components(), 1); var import_data14 = __toESM(require_data(), 1); var import_core_data12 = __toESM(require_core_data(), 1); var import_jsx_runtime92 = __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_data14.useSelect)( (select6) => { if (!shouldFetch) { return null; } const { getEntityRecord } = select6(import_core_data12.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_element11.useState)(false); return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_components11.__experimentalHStack, { alignment: "left", spacing: 0, children: [ !!imageUrl && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)( "div", { className: clsx_default("page-templates-author-field__avatar", { "is-loaded": isImageLoaded }), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)( "img", { onLoad: () => setIsImageLoaded(true), alt: (0, import_i18n30.__)("Author avatar"), src: imageUrl } ) } ), !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_components11.Icon, { icon: comment_author_avatar_default }) }), /* @__PURE__ */ (0, import_jsx_runtime92.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_data15.resolveSelect)(import_core_data13.store).getEntityRecords( "root", "user", { per_page: -1, who: "authors", _fields: "id,name", context: "view" } ) ?? []; 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_data16 = __toESM(require_data(), 1); var import_core_data14 = __toESM(require_core_data(), 1); var import_i18n34 = __toESM(require_i18n(), 1); var import_notices4 = __toESM(require_notices(), 1); var import_element12 = __toESM(require_element(), 1); var import_components12 = __toESM(require_components(), 1); var import_jsx_runtime93 = __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_element12.useState)(items[0]); const { editEntityRecord, saveEditedEntityRecord } = (0, import_data16.useDispatch)(import_core_data14.store); const { createSuccessNotice, createErrorNotice } = (0, import_data16.useDispatch)(import_notices4.store); const isValid2 = isItemValid(item); async function onOrder(event) { event.preventDefault(); if (!isValid2) { 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_runtime93.jsx)("form", { onSubmit: onOrder, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_components12.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0, import_jsx_runtime93.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_runtime93.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_runtime93.jsxs)(import_components12.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)( import_components12.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal2?.(); }, children: (0, import_i18n34.__)("Cancel") } ), /* @__PURE__ */ (0, import_jsx_runtime93.jsx)( import_components12.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", accessibleWhenDisabled: true, disabled: !isValid2, 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_data17 = __toESM(require_data(), 1); var import_core_data15 = __toESM(require_core_data(), 1); var import_i18n35 = __toESM(require_i18n(), 1); var import_notices5 = __toESM(require_notices(), 1); var import_element13 = __toESM(require_element(), 1); var import_components13 = __toESM(require_components(), 1); var import_jsx_runtime94 = __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_element13.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_element13.useState)(false); const { saveEntityRecord } = (0, import_data17.useDispatch)(import_core_data15.store); const { createSuccessNotice, createErrorNotice } = (0, import_data17.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_runtime94.jsx)("form", { onSubmit: createPage, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_components13.__experimentalVStack, { spacing: 3, children: [ typeof item.id === "string" && /* @__PURE__ */ (0, import_jsx_runtime94.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_runtime94.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_runtime94.jsxs)(import_components13.__experimentalHStack, { spacing: 2, justify: "end", children: [ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)( import_components13.Button, { variant: "tertiary", onClick: closeModal2, __next40pxDefaultSize: true, children: (0, import_i18n35.__)("Cancel") } ), /* @__PURE__ */ (0, import_jsx_runtime94.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_data18 = __toESM(require_data(), 1); var import_core_data16 = __toESM(require_core_data(), 1); var import_i18n36 = __toESM(require_i18n(), 1); var import_element14 = __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_runtime95 = __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_element14.useState)(() => getItemTitle(item, "")); const { editEntityRecord, saveEditedEntityRecord } = (0, import_data18.useDispatch)(import_core_data16.store); const { createSuccessNotice, createErrorNotice } = (0, import_data18.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_runtime95.jsx)("form", { onSubmit: onRename, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_components14.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)( import_components14.TextControl, { __next40pxDefaultSize: true, label: (0, import_i18n36.__)("Name"), value: title, onChange: setTitle, required: true } ), /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_components14.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)( import_components14.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal2?.(); }, children: (0, import_i18n36.__)("Cancel") } ), /* @__PURE__ */ (0, import_jsx_runtime95.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_data19 = __toESM(require_data(), 1); var import_core_data17 = __toESM(require_core_data(), 1); var import_i18n37 = __toESM(require_i18n(), 1); var import_notices7 = __toESM(require_notices(), 1); var import_element15 = __toESM(require_element(), 1); var import_blocks3 = __toESM(require_blocks(), 1); var import_components15 = __toESM(require_components(), 1); var import_url7 = __toESM(require_url(), 1); var import_api_fetch2 = __toESM(require_api_fetch(), 1); var import_jsx_runtime96 = __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_data19.dispatch)(import_notices7.store).removeNotice(noticeId); if (!isTemplateRevertable2(template2)) { (0, import_data19.dispatch)(import_notices7.store).createErrorNotice( (0, import_i18n37.__)("This template is not revertable."), { type: "snackbar" } ); return; } try { const templateEntityConfig = (0, import_data19.select)(import_core_data17.store).getEntityConfig( "postType", template2.type ); if (!templateEntityConfig) { (0, import_data19.dispatch)(import_notices7.store).createErrorNotice( (0, import_i18n37.__)( "The editor has encountered an unexpected error. Please reload." ), { type: "snackbar" } ); return; } const fileTemplatePath = (0, import_url7.addQueryArgs)( `${templateEntityConfig.baseURL}/${template2.id}`, { context: "edit", source: template2.origin } ); const fileTemplate = await (0, import_api_fetch2.default)({ path: fileTemplatePath }); if (!fileTemplate) { (0, import_data19.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_blocks3.__unstableSerializeAndClean)(blocksForSerialization); const edited = (0, import_data19.select)(import_core_data17.store).getEditedEntityRecord( "postType", template2.type, template2.id ); (0, import_data19.dispatch)(import_core_data17.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_blocks3.parse)(fileTemplate?.content?.raw); (0, import_data19.dispatch)(import_core_data17.store).editEntityRecord( "postType", template2.type, fileTemplate.id, { content: serializeBlocks, blocks, source: "theme" } ); if (allowUndo) { const undoRevert = () => { (0, import_data19.dispatch)(import_core_data17.store).editEntityRecord( "postType", template2.type, edited.id, { content: serializeBlocks, blocks: edited.blocks, source: "custom" } ); }; (0, import_data19.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_data19.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_element15.useState)(false); const { saveEditedEntityRecord } = (0, import_data19.useDispatch)(import_core_data17.store); const { createSuccessNotice, createErrorNotice } = (0, import_data19.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_runtime96.jsxs)(import_components15.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_components15.__experimentalText, { children: (0, import_i18n37.__)("Reset to default and clear all customizations?") }), /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_components15.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)( import_components15.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: closeModal2, disabled: isBusy, accessibleWhenDisabled: true, children: (0, import_i18n37.__)("Cancel") } ), /* @__PURE__ */ (0, import_jsx_runtime96.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_runtime97 = __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_runtime97.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 start2 = 0; var end = result.length; while (result.charAt(start2) === "\0") start2++; while (result.charAt(end - 1) === "\0") end--; return result.slice(start2, 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(((c6) => 47 === c6))) 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_url8 = __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_url8.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_data18 = __toESM(require_core_data(), 1); var import_i18n41 = __toESM(require_i18n(), 1); var import_notices8 = __toESM(require_notices(), 1); var import_element16 = __toESM(require_element(), 1); var import_data20 = __toESM(require_data(), 1); var import_components16 = __toESM(require_components(), 1); var import_html_entities4 = __toESM(require_html_entities(), 1); var import_jsx_runtime98 = __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_element16.useState)(false); const { createSuccessNotice, createErrorNotice } = (0, import_data20.useDispatch)(import_notices8.store); const { deleteEntityRecord } = (0, import_data20.useDispatch)(import_core_data18.store); return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_components16.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0, import_jsx_runtime98.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_entities4.decodeEntities)(getItemTitle(items[0])) ) }), /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_components16.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0, import_jsx_runtime98.jsx)( import_components16.Button, { variant: "tertiary", onClick: closeModal2, disabled: isBusy, accessibleWhenDisabled: true, __next40pxDefaultSize: true, children: (0, import_i18n41.__)("Cancel") } ), /* @__PURE__ */ (0, import_jsx_runtime98.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_data19 = __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_data19.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_data21 = __toESM(require_data(), 1); var import_core_data20 = __toESM(require_core_data(), 1); var import_i18n43 = __toESM(require_i18n(), 1); var import_notices10 = __toESM(require_notices(), 1); var import_element17 = __toESM(require_element(), 1); var import_components17 = __toESM(require_components(), 1); var import_jsx_runtime99 = __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_element17.useState)(false); const { createSuccessNotice, createErrorNotice } = (0, import_data21.useDispatch)(import_notices10.store); const { deleteEntityRecord } = (0, import_data21.useDispatch)(import_core_data20.store); return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_components17.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0, import_jsx_runtime99.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_runtime99.jsxs)(import_components17.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)( import_components17.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: closeModal2, disabled: isBusy, accessibleWhenDisabled: true, children: (0, import_i18n43.__)("Cancel") } ), /* @__PURE__ */ (0, import_jsx_runtime99.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_element18 = __toESM(require_element(), 1); var import_components18 = __toESM(require_components(), 1); var import_patterns4 = __toESM(require_patterns(), 1); var import_html_entities5 = __toESM(require_html_entities(), 1); // packages/fields/build-module/mutation/index.mjs var import_notices11 = __toESM(require_notices(), 1); var import_core_data21 = __toESM(require_core_data(), 1); var import_data22 = __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_data22.dispatch)(import_notices11.store); const { deleteEntityRecord } = (0, import_data22.dispatch)(import_core_data21.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_runtime100 = __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_element18.useState)(false); const isResetting = items.every( (item) => isTemplateOrTemplatePart(item) && item?.has_theme_file ); return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(import_components18.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0, import_jsx_runtime100.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_runtime100.jsxs)(import_components18.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)( import_components18.Button, { variant: "tertiary", onClick: closeModal2, disabled: isBusy, accessibleWhenDisabled: true, __next40pxDefaultSize: true, children: (0, import_i18n44.__)("Cancel") } ), /* @__PURE__ */ (0, import_jsx_runtime100.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_entities5.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_entities5.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_data25 = __toESM(require_data(), 1); var import_i18n46 = __toESM(require_i18n(), 1); var import_notices13 = __toESM(require_notices(), 1); var import_element20 = __toESM(require_element(), 1); var import_blocks5 = __toESM(require_blocks(), 1); // packages/fields/build-module/components/create-template-part-modal/index.mjs var import_components19 = __toESM(require_components(), 1); var import_compose3 = __toESM(require_compose(), 1); var import_core_data23 = __toESM(require_core_data(), 1); var import_data24 = __toESM(require_data(), 1); var import_element19 = __toESM(require_element(), 1); var import_i18n45 = __toESM(require_i18n(), 1); var import_notices12 = __toESM(require_notices(), 1); var import_blocks4 = __toESM(require_blocks(), 1); // packages/fields/build-module/components/create-template-part-modal/utils.mjs var import_data23 = __toESM(require_data(), 1); var import_core_data22 = __toESM(require_core_data(), 1); var useExistingTemplateParts = () => { return (0, import_data23.useSelect)( (select6) => select6(import_core_data22.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_runtime101 = __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_data24.useSelect)( (select6) => select6(import_core_data23.store).getPostType("wp_template_part")?.labels?.add_new_item, [] ); return /* @__PURE__ */ (0, import_jsx_runtime101.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_runtime101.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 ("navigation-overlay" === areaOrIconName) { return navigation_overlay_default; } return symbol_filled_default; }; function CreateTemplatePartModalContents({ defaultArea = "uncategorized", blocks = [], confirmLabel = (0, import_i18n45.__)("Add"), closeModal: closeModal2, onCreate, onError, defaultTitle = "" }) { const { createErrorNotice } = (0, import_data24.useDispatch)(import_notices12.store); const { saveEntityRecord } = (0, import_data24.useDispatch)(import_core_data23.store); const existingTemplateParts = useExistingTemplateParts(); const [title, setTitle] = (0, import_element19.useState)(defaultTitle); const [area, setArea] = (0, import_element19.useState)(defaultArea); const [isSubmitting, setIsSubmitting] = (0, import_element19.useState)(false); const instanceId = (0, import_compose3.useInstanceId)(CreateTemplatePartModal); const defaultTemplatePartAreas = (0, import_data24.useSelect)( (select6) => select6(import_core_data23.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_blocks4.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_runtime101.jsx)( "form", { onSubmit: async (event) => { event.preventDefault(); await createTemplatePart(); }, children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(import_components19.__experimentalVStack, { spacing: "4", children: [ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)( import_components19.TextControl, { __next40pxDefaultSize: true, label: (0, import_i18n45.__)("Name"), value: title, onChange: setTitle, required: true } ), /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("fieldset", { className: "fields-create-template-part-modal__area-fieldset", children: [ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_components19.BaseControl.VisualLabel, { as: "legend", children: (0, import_i18n45.__)("Area") }), /* @__PURE__ */ (0, import_jsx_runtime101.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_runtime101.jsxs)( "div", { className: "fields-create-template-part-modal__area-radio-wrapper", children: [ /* @__PURE__ */ (0, import_jsx_runtime101.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_runtime101.jsx)( import_components19.Icon, { icon, className: "fields-create-template-part-modal__area-radio-icon" } ), /* @__PURE__ */ (0, import_jsx_runtime101.jsx)( "label", { htmlFor: getAreaRadioId( item.area, instanceId ), className: "fields-create-template-part-modal__area-radio-label", children: item.label } ), /* @__PURE__ */ (0, import_jsx_runtime101.jsx)( import_components19.Icon, { icon: check_default, className: "fields-create-template-part-modal__area-radio-checkmark" } ), /* @__PURE__ */ (0, import_jsx_runtime101.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_runtime101.jsxs)(import_components19.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)( import_components19.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal2(); }, children: (0, import_i18n45.__)("Cancel") } ), /* @__PURE__ */ (0, import_jsx_runtime101.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_runtime102 = __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_element20.useMemo)(() => { return item.blocks ?? (0, import_blocks5.parse)( typeof item.content === "string" ? item.content : item.content.raw, { __unstableSkipMigrationLogs: true } ); }, [item.content, item.blocks]); const { createSuccessNotice } = (0, import_data25.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_runtime102.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/media-fields/build-module/alt_text/index.mjs var import_i18n47 = __toESM(require_i18n(), 1); var import_components20 = __toESM(require_components(), 1); var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1); var altTextField = { id: "alt_text", type: "text", label: (0, import_i18n47.__)("Alt text"), isVisible: (item) => item?.media_type === "image", render: ({ item }) => item?.alt_text || "-", Edit: ({ field, onChange, data }) => { return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( import_components20.TextareaControl, { label: field.label, value: data.alt_text || "", onChange: (value) => onChange({ alt_text: value }), rows: 2 } ); }, enableSorting: false, filterBy: false }; var alt_text_default = altTextField; // packages/media-fields/build-module/attached_to/index.mjs var import_i18n50 = __toESM(require_i18n(), 1); // packages/media-fields/build-module/attached_to/view.mjs var import_element21 = __toESM(require_element(), 1); var import_i18n48 = __toESM(require_i18n(), 1); // packages/media-fields/build-module/utils/get-rendered-content.mjs function getRenderedContent(content) { if (!content) { return ""; } if (typeof content === "string") { return content; } if (typeof content === "object") { return content.rendered || content.raw || ""; } return ""; } // packages/media-fields/build-module/attached_to/view.mjs var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1); function MediaAttachedToView({ item }) { const [attachedPostTitle, setAttachedPostTitle] = (0, import_element21.useState)(null); const parentId = item.post; const embeddedPostId = item._embedded?.["wp:attached-to"]?.[0]?.id; const embeddedPostTitle = item._embedded?.["wp:attached-to"]?.[0]?.title; (0, import_element21.useEffect)(() => { if (!!parentId && parentId === embeddedPostId) { setAttachedPostTitle( getRenderedContent(embeddedPostTitle) || embeddedPostId?.toString() || "" ); } if (!parentId) { setAttachedPostTitle((0, import_i18n48.__)("(Unattached)")); } }, [parentId, embeddedPostId, embeddedPostTitle]); return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_jsx_runtime104.Fragment, { children: attachedPostTitle }); } // packages/media-fields/build-module/attached_to/edit.mjs var import_core_data24 = __toESM(require_core_data(), 1); var import_components21 = __toESM(require_components(), 1); var import_i18n49 = __toESM(require_i18n(), 1); var import_element22 = __toESM(require_element(), 1); var import_compose4 = __toESM(require_compose(), 1); var import_data26 = __toESM(require_data(), 1); var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1); function MediaAttachedToEdit({ data, onChange }) { const defaultPost = !!data.post && !!data?._embedded?.["wp:attached-to"]?.[0] ? [ { label: getRenderedContent( data._embedded?.["wp:attached-to"]?.[0]?.title ), value: data.post.toString() } ] : []; const [options, setOptions] = (0, import_element22.useState)(defaultPost); const [searchResults, setSearchResults] = (0, import_element22.useState)( [] ); const [isLoading, setIsLoading] = (0, import_element22.useState)(false); const [value, setValue] = (0, import_element22.useState)( data?.post?.toString() ?? null ); const postTypes = (0, import_data26.useSelect)( (select6) => select6(import_core_data24.store).getPostTypes(), [] ); const handleDetach = () => { onChange({ post: 0, _embedded: { ...data?._embedded, "wp:attached-to": void 0 } }); setOptions([]); }; const onValueChange = async (filterValue) => { setIsLoading(true); const results = await (0, import_core_data24.__experimentalFetchLinkSuggestions)( filterValue, /* * @TODO `fetchLinkSuggestions()` should accept `perPage` as an option argument. * `isInitialSuggestions` limits the result to 3, otherwise it's hardcoded to 20. */ { type: "post", isInitialSuggestions: true }, {} ); setSearchResults(results); const mappedSuggestions = results.map((result) => { return { label: result.title, value: result.id.toString() }; }); setOptions(mappedSuggestions); setIsLoading(false); }; const handleSelectOption = (selectedPostId) => { if (!selectedPostId) { handleDetach(); return; } setValue(selectedPostId); if (selectedPostId) { const selectedPost = searchResults.find( (result) => result.id === Number(selectedPostId) ); if (selectedPost && postTypes) { const postType2 = postTypes.find( (_postType) => _postType.slug === selectedPost?.type ); const attachedTo = { ...postType2 && { type: postType2.slug }, id: Number(selectedPostId), title: { raw: selectedPost.title, rendered: selectedPost.title } }; onChange({ post: Number(selectedPostId), _embedded: { ...data?._embedded, "wp:attached-to": [attachedTo] } }); } } }; const help = !!data.post ? (0, import_element22.createInterpolateElement)( (0, import_i18n49.__)( "Search for a post or page to attach this media to or ." ), { button: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)( import_components21.Button, { __next40pxDefaultSize: true, onClick: handleDetach, variant: "link", accessibleWhenDisabled: true } ) } ) : (0, import_i18n49.__)("Search for a post or page to attach this media to."); return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)( import_components21.ComboboxControl, { className: "dataviews-media-field__attached-to", __next40pxDefaultSize: true, isLoading, label: (0, import_i18n49.__)("Attached to"), help, value, options, onFilterValueChange: (0, import_compose4.debounce)( (filterValue) => onValueChange(filterValue), 300 ), onChange: handleSelectOption, hideLabelFromVision: true } ); } // packages/media-fields/build-module/attached_to/index.mjs var attachedToField = { id: "attached_to", type: "text", label: (0, import_i18n50.__)("Attached to"), Edit: MediaAttachedToEdit, render: MediaAttachedToView, enableSorting: false, filterBy: false }; var attached_to_default = attachedToField; // packages/media-fields/build-module/author/index.mjs var import_i18n52 = __toESM(require_i18n(), 1); var import_data27 = __toESM(require_data(), 1); var import_core_data25 = __toESM(require_core_data(), 1); // packages/media-fields/build-module/author/view.mjs var import_i18n51 = __toESM(require_i18n(), 1); var import_element23 = __toESM(require_element(), 1); var import_components22 = __toESM(require_components(), 1); var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1); function AuthorView2({ item }) { const author = item?._embedded?.author?.[0]; const text = author?.name; const imageUrl = author?.avatar_urls?.[48]; const [loadingState, setLoadingState] = (0, import_element23.useState)("loading"); (0, import_element23.useEffect)(() => { setLoadingState("loading"); }, [imageUrl]); const imgRef = (0, import_element23.useCallback)((img) => { if (img?.complete) { setLoadingState("instant"); } }, []); const handleLoad = () => { if (loadingState === "loading") { setLoadingState("loaded"); } }; return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(import_components22.__experimentalHStack, { alignment: "left", spacing: 0, children: [ !!imageUrl && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)( "div", { className: clsx_default("media-author-field__avatar", { "is-loading": loadingState === "loading", "is-loaded": loadingState === "loaded" }), children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)( "img", { ref: imgRef, onLoad: handleLoad, alt: (0, import_i18n51.__)("Author avatar"), src: imageUrl } ) } ), !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "media-author-field__icon", children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_components22.Icon, { icon: comment_author_avatar_default }) }), /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "media-author-field__name", children: text }) ] }); } // packages/media-fields/build-module/author/index.mjs var authorField2 = { label: (0, import_i18n52.__)("Author"), id: "author", type: "integer", getElements: async () => { const authors = await (0, import_data27.resolveSelect)(import_core_data25.store).getEntityRecords( "root", "user", { per_page: -1, who: "authors", _fields: "id,name", context: "view" } ) ?? []; return authors.map(({ id, name: name2 }) => ({ value: id, label: name2 })); }, render: AuthorView2, 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"] }, readOnly: true }; var author_default2 = authorField2; // packages/media-fields/build-module/caption/index.mjs var import_i18n53 = __toESM(require_i18n(), 1); var import_components23 = __toESM(require_components(), 1); // packages/media-fields/build-module/utils/get-raw-content.mjs function getRawContent(content) { if (!content) { return ""; } if (typeof content === "string") { return content; } if (typeof content === "object" && "raw" in content) { return content.raw || ""; } return ""; } // packages/media-fields/build-module/caption/index.mjs var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1); var captionField = { id: "caption", type: "text", label: (0, import_i18n53.__)("Caption"), getValue: ({ item }) => getRawContent(item?.caption), render: ({ item }) => getRawContent(item?.caption) || "-", Edit: ({ field, onChange, data }) => { return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)( import_components23.TextareaControl, { label: field.label, value: getRawContent(data.caption) || "", onChange: (value) => onChange({ caption: value }), rows: 2 } ); }, enableSorting: false, filterBy: false }; var caption_default = captionField; // packages/media-fields/build-module/date_added/index.mjs var import_i18n54 = __toESM(require_i18n(), 1); var import_date4 = __toESM(require_date(), 1); var dateAddedField = { id: "date", type: "datetime", label: (0, import_i18n54.__)("Date added"), filterBy: { operators: ["before", "after"] }, format: { datetime: (0, import_date4.getSettings)().formats.datetimeAbbreviated }, readOnly: true }; var date_added_default = dateAddedField; // packages/media-fields/build-module/description/index.mjs var import_i18n55 = __toESM(require_i18n(), 1); var import_components24 = __toESM(require_components(), 1); var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1); var descriptionField = { id: "description", type: "text", label: (0, import_i18n55.__)("Description"), getValue: ({ item }) => getRawContent(item?.description), render: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { children: getRawContent(item?.description) || "-" }), Edit: ({ field, onChange, data }) => { return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( import_components24.TextareaControl, { label: field.label, value: getRawContent(data.description) || "", onChange: (value) => onChange({ description: value }), rows: 5 } ); }, enableSorting: false, filterBy: false }; var description_default = descriptionField; // packages/media-fields/build-module/filename/index.mjs var import_i18n56 = __toESM(require_i18n(), 1); var import_url10 = __toESM(require_url(), 1); // packages/media-fields/build-module/filename/view.mjs var import_components25 = __toESM(require_components(), 1); var import_element24 = __toESM(require_element(), 1); var import_url9 = __toESM(require_url(), 1); var import_jsx_runtime109 = __toESM(require_jsx_runtime(), 1); var TRUNCATE_LENGTH = 15; function FileNameView({ item }) { const fileName = (0, import_element24.useMemo)( () => item?.source_url ? (0, import_url9.getFilename)(item.source_url) : null, [item?.source_url] ); if (!fileName) { return ""; } return fileName.length > TRUNCATE_LENGTH ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_components25.Tooltip, { text: fileName, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_components25.__experimentalTruncate, { limit: TRUNCATE_LENGTH, ellipsizeMode: "tail", children: fileName }) }) : /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_jsx_runtime109.Fragment, { children: fileName }); } // packages/media-fields/build-module/filename/index.mjs var filenameField = { id: "filename", type: "text", label: (0, import_i18n56.__)("File name"), getValue: ({ item }) => (0, import_url10.getFilename)(item?.source_url || ""), render: FileNameView, enableSorting: false, filterBy: false, readOnly: true }; var filename_default = filenameField; // packages/media-fields/build-module/filesize/index.mjs var import_i18n57 = __toESM(require_i18n(), 1); var KB_IN_BYTES = 1024; var MB_IN_BYTES = 1024 * KB_IN_BYTES; var GB_IN_BYTES = 1024 * MB_IN_BYTES; var TB_IN_BYTES = 1024 * GB_IN_BYTES; var PB_IN_BYTES = 1024 * TB_IN_BYTES; var EB_IN_BYTES = 1024 * PB_IN_BYTES; var ZB_IN_BYTES = 1024 * EB_IN_BYTES; var YB_IN_BYTES = 1024 * ZB_IN_BYTES; function getBytesString(bytes, unitSymbol, decimals = 2) { return (0, import_i18n57.sprintf)( // translators: 1: Actual bytes of a file. 2: The unit symbol (e.g. MB). (0, import_i18n57._x)("%1$s %2$s", "file size"), bytes.toLocaleString(void 0, { minimumFractionDigits: 0, maximumFractionDigits: decimals }), unitSymbol ); } function formatFileSize(bytes, decimals = 2) { if (bytes === 0) { return getBytesString(0, (0, import_i18n57._x)("B", "unit symbol"), decimals); } const quant = { /* translators: Unit symbol for yottabyte. */ [(0, import_i18n57._x)("YB", "unit symbol")]: YB_IN_BYTES, /* translators: Unit symbol for zettabyte. */ [(0, import_i18n57._x)("ZB", "unit symbol")]: ZB_IN_BYTES, /* translators: Unit symbol for exabyte. */ [(0, import_i18n57._x)("EB", "unit symbol")]: EB_IN_BYTES, /* translators: Unit symbol for petabyte. */ [(0, import_i18n57._x)("PB", "unit symbol")]: PB_IN_BYTES, /* translators: Unit symbol for terabyte. */ [(0, import_i18n57._x)("TB", "unit symbol")]: TB_IN_BYTES, /* translators: Unit symbol for gigabyte. */ [(0, import_i18n57._x)("GB", "unit symbol")]: GB_IN_BYTES, /* translators: Unit symbol for megabyte. */ [(0, import_i18n57._x)("MB", "unit symbol")]: MB_IN_BYTES, /* translators: Unit symbol for kilobyte. */ [(0, import_i18n57._x)("KB", "unit symbol")]: KB_IN_BYTES, /* translators: Unit symbol for byte. */ [(0, import_i18n57._x)("B", "unit symbol")]: 1 }; for (const [unit, mag] of Object.entries(quant)) { if (bytes >= mag) { return getBytesString(bytes / mag, unit, decimals); } } return ""; } var filesizeField = { id: "filesize", type: "text", label: (0, import_i18n57.__)("File size"), getValue: ({ item }) => item?.media_details?.filesize ? formatFileSize(item?.media_details?.filesize) : "", isVisible: (item) => { return !!item?.media_details?.filesize; }, enableSorting: false, filterBy: false, readOnly: true }; var filesize_default = filesizeField; // packages/media-fields/build-module/media_dimensions/index.mjs var import_i18n58 = __toESM(require_i18n(), 1); var mediaDimensionsField = { id: "media_dimensions", type: "text", label: (0, import_i18n58.__)("Dimensions"), getValue: ({ item }) => item?.media_details?.width && item?.media_details?.height ? (0, import_i18n58.sprintf)( // translators: 1: Width. 2: Height. (0, import_i18n58._x)("%1$s \xD7 %2$s", "image dimensions"), item?.media_details?.width?.toString(), item?.media_details?.height?.toString() ) : "", isVisible: (item) => { return !!(item?.media_details?.width && item?.media_details?.height); }, enableSorting: false, filterBy: false, readOnly: true }; var media_dimensions_default = mediaDimensionsField; // packages/media-fields/build-module/mime_type/index.mjs var import_i18n59 = __toESM(require_i18n(), 1); var mimeTypeField = { id: "mime_type", type: "text", label: (0, import_i18n59.__)("File type"), getValue: ({ item }) => item?.mime_type || "", render: ({ item }) => item?.mime_type || "-", // Disable sorting until REST API support for ordering my `mime_type` is added. // See: https://core.trac.wordpress.org/ticket/64073 enableSorting: false, filterBy: false, readOnly: true }; var mime_type_default = mimeTypeField; // packages/editor/build-module/dataviews/fields/content-preview/index.mjs var import_i18n121 = __toESM(require_i18n(), 1); // packages/editor/build-module/dataviews/fields/content-preview/content-preview-view.mjs var import_i18n120 = __toESM(require_i18n(), 1); var import_block_editor34 = __toESM(require_block_editor(), 1); var import_data71 = __toESM(require_data(), 1); var import_core_data51 = __toESM(require_core_data(), 1); // packages/editor/build-module/components/provider/index.mjs var import_element47 = __toESM(require_element(), 1); var import_data55 = __toESM(require_data(), 1); var import_i18n74 = __toESM(require_i18n(), 1); var import_core_data37 = __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_blocks14 = __toESM(require_blocks(), 1); // packages/editor/build-module/components/provider/with-registry-provider.mjs var import_element25 = __toESM(require_element(), 1); var import_data28 = __toESM(require_data(), 1); var import_compose5 = __toESM(require_compose(), 1); var import_block_editor5 = __toESM(require_block_editor(), 1); var import_jsx_runtime110 = __toESM(require_jsx_runtime(), 1); function getSubRegistry(subRegistries, registry, useSubRegistry) { if (!useSubRegistry) { return registry; } let subRegistry = subRegistries.get(registry); if (!subRegistry) { subRegistry = (0, import_data28.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_data28.useRegistry)(); const [subRegistries] = (0, import_element25.useState)(() => /* @__PURE__ */ new WeakMap()); const subRegistry = getSubRegistry( subRegistries, registry, useSubRegistry ); if (subRegistry === registry) { return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(WrappedComponent, { registry, ...props }); } return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_data28.RegistryProvider, { value: subRegistry, children: /* @__PURE__ */ (0, import_jsx_runtime110.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_element27 = __toESM(require_element(), 1); var import_data33 = __toESM(require_data(), 1); var import_core_data29 = __toESM(require_core_data(), 1); var import_i18n62 = __toESM(require_i18n(), 1); var import_preferences4 = __toESM(require_preferences(), 1); var import_compose6 = __toESM(require_compose(), 1); var import_blocks8 = __toESM(require_blocks(), 1); var import_block_editor7 = __toESM(require_block_editor(), 1); // packages/editor/build-module/components/media-categories/index.mjs var import_i18n60 = __toESM(require_i18n(), 1); var import_data29 = __toESM(require_data(), 1); var import_html_entities6 = __toESM(require_html_entities(), 1); var import_core_data26 = __toESM(require_core_data(), 1); var getExternalLink = (url, text) => `${text}`; 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_entities6.decodeEntities)(creator); let _caption; if (_creator) { _caption = title ? (0, import_i18n60.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_i18n60._x)('"%1$s" by %2$s/ %3$s', "caption"), getExternalLink( foreignLandingUrl, (0, import_html_entities6.decodeEntities)(title) ), creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, licenseUrl ? getExternalLink( `${licenseUrl}?ref=openverse`, fullLicense ) : fullLicense ) : (0, import_i18n60.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_i18n60._x)("Work 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_i18n60.sprintf)( // translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: "CC0 1.0". (0, import_i18n60._x)('"%1$s"/ %2$s', "caption"), getExternalLink( foreignLandingUrl, (0, import_html_entities6.decodeEntities)(title) ), licenseUrl ? getExternalLink( `${licenseUrl}?ref=openverse`, fullLicense ) : fullLicense ) : (0, import_i18n60.sprintf)( // translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: "CC0 1.0". (0, import_i18n60._x)("Work/ %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_data29.resolveSelect)(import_core_data26.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_i18n60.__)("Images"), search_items: (0, import_i18n60.__)("Search images") }, mediaType: "image", async fetch(query = {}) { return coreMediaFetch({ ...query, media_type: "image" }); } }, { name: "videos", labels: { name: (0, import_i18n60.__)("Videos"), search_items: (0, import_i18n60.__)("Search videos") }, mediaType: "video", async fetch(query = {}) { return coreMediaFetch({ ...query, media_type: "video" }); } }, { name: "audio", labels: { name: (0, import_i18n60.__)("Audio"), search_items: (0, import_i18n60.__)("Search audio") }, mediaType: "audio", async fetch(query = {}) { return coreMediaFetch({ ...query, media_type: "audio" }); } }, { name: "openverse", labels: { name: (0, import_i18n60.__)("Openverse"), search_items: (0, import_i18n60.__)("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; // packages/editor/build-module/utils/media-upload/on-success.mjs var import_data30 = __toESM(require_data(), 1); var import_core_data27 = __toESM(require_core_data(), 1); function mediaUploadOnSuccess(attachments) { const { invalidateResolution } = (0, import_data30.dispatch)(import_core_data27.store); for (const attachment of attachments) { if (attachment.id) { invalidateResolution("getEntityRecord", [ "postType", "attachment", attachment.id, { context: "view" } ]); invalidateResolution("getEntityRecord", [ "postType", "attachment", attachment.id ]); } } } // 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/utils/media-finalize/index.mjs var import_api_fetch3 = __toESM(require_api_fetch(), 1); async function mediaFinalize(id) { await (0, import_api_fetch3.default)({ path: `/wp/v2/media/${id}/finalize`, method: "POST" }); } // packages/editor/build-module/components/global-styles-provider/index.mjs var import_block_editor6 = __toESM(require_block_editor(), 1); var import_core_data28 = __toESM(require_core_data(), 1); var import_data32 = __toESM(require_data(), 1); var import_element26 = __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.textIndent", "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_i18n61 = __toESM(require_i18n(), 1); var import_blocks6 = __toESM(require_blocks(), 1); var globalStylesChangesCache = /* @__PURE__ */ new Map(); var EMPTY_ARRAY3 = []; var translationMap = { caption: (0, import_i18n61.__)("Caption"), link: (0, import_i18n61.__)("Link"), button: (0, import_i18n61.__)("Button"), heading: (0, import_i18n61.__)("Heading"), h1: (0, import_i18n61.__)("H1"), h2: (0, import_i18n61.__)("H2"), h3: (0, import_i18n61.__)("H3"), h4: (0, import_i18n61.__)("H4"), h5: (0, import_i18n61.__)("H5"), h6: (0, import_i18n61.__)("H6"), "settings.color": (0, import_i18n61.__)("Color"), "settings.typography": (0, import_i18n61.__)("Typography"), "settings.shadow": (0, import_i18n61.__)("Shadow"), "settings.layout": (0, import_i18n61.__)("Layout"), "styles.color": (0, import_i18n61.__)("Colors"), "styles.spacing": (0, import_i18n61.__)("Spacing"), "styles.background": (0, import_i18n61.__)("Background"), "styles.typography": (0, import_i18n61.__)("Typography") }; var getBlockNames = memize( () => (0, import_blocks6.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 cacheKey2 = JSON.stringify({ next, previous }); if (globalStylesChangesCache.has(cacheKey2)) { return globalStylesChangesCache.get(cacheKey2); } 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(cacheKey2, []); 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(cacheKey2, 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_i18n61.__)(", ") // eslint-disable-line @wordpress/i18n-no-flanking-whitespace ); switch (key) { case "blocks": { return (0, import_i18n61.sprintf)( // translators: %s: a list of block names separated by a comma. (0, import_i18n61._n)("%s block.", "%s blocks.", changeValuesLength), joinedChangesValue ); } case "elements": { return (0, import_i18n61.sprintf)( // translators: %s: a list of element names separated by a comma. (0, import_i18n61._n)("%s element.", "%s elements.", changeValuesLength), joinedChangesValue ); } case "settings": { return (0, import_i18n61.sprintf)( // translators: %s: a list of theme.json setting labels separated by a comma. (0, import_i18n61.__)("%s settings."), joinedChangesValue ); } case "styles": { return (0, import_i18n61.sprintf)( // translators: %s: a list of theme.json top-level styles labels separated by a comma. (0, import_i18n61.__)("%s styles."), joinedChangesValue ); } default: { return (0, import_i18n61.sprintf)( // translators: %s: a list of global styles changes separated by a comma. (0, import_i18n61.__)("%s."), joinedChangesValue ); } } }); } return EMPTY_ARRAY3; } // packages/global-styles-engine/build-module/core/render.mjs var import_blocks7 = __toESM(require_blocks(), 1); var import_style_engine2 = __toESM(require_style_engine(), 1); var import_data31 = __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(colors2 = []) { const values = { r: [], g: [], b: [], a: [] }; colors2.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, colors2) { const values = getValuesFromColors(colors2); return ` `; } // 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 = {}, prefix2, token) { let result = []; Object.keys(input).forEach((key) => { const newKey = prefix2 + 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 updateParagraphTextIndentSelector = (featureDeclarations, settings, blockName) => { if (blockName !== "core/paragraph") { return featureDeclarations; } const blockSettings = settings?.blocks?.["core/paragraph"]; const textIndentSetting = blockSettings?.typography?.textIndent ?? settings?.typography?.textIndent ?? "subsequent"; if (textIndentSetting !== "all") { return featureDeclarations; } const oldSelector = ".wp-block-paragraph + .wp-block-paragraph"; const newSelector = ".wp-block-paragraph"; if (oldSelector in featureDeclarations) { const declarations = featureDeclarations[oldSelector]; const updated = { ...featureDeclarations }; delete updated[oldSelector]; updated[newSelector] = declarations; return updated; } return featureDeclarations; }; 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_blocks7.__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_blocks7.__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; const variationNodesToAdd = []; 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_blocks7.__EXPERIMENTAL_ELEMENTS[element]) { variationNodesToAdd.push({ styles: elementStyles, selector: scopeSelector( variationSelector, import_blocks7.__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; } variationNodesToAdd.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_blocks7.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) { variationNodesToAdd.push({ styles: variationBlockElementStyles, selector: scopeSelector( variationBlockSelector, import_blocks7.__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, name: blockName }); } Object.entries(typedNode?.elements ?? {}).forEach( ([elementName, value]) => { if (typeof blockSelectors !== "string" && value && blockSelectors?.[blockName] && import_blocks7.__EXPERIMENTAL_ELEMENTS[elementName]) { nodes.push({ styles: value, selector: blockSelectors[blockName]?.selector.split(",").map((sel) => { const elementSelectors = import_blocks7.__EXPERIMENTAL_ELEMENTS[elementName].split(","); return elementSelectors.map( (elementSelector) => sel + " " + elementSelector ); }).join(",") }); } } ); nodes.push(...variationNodesToAdd); } ); 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, name: name2 }) => { if (featureSelectors) { let featureDeclarations = getFeatureDeclarations( featureSelectors, styles ); featureDeclarations = updateParagraphTextIndentSelector( featureDeclarations, tree.settings, name2 ); 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) { let featureDeclarations = getFeatureDeclarations( featureSelectors, styleVariations ); featureDeclarations = updateParagraphTextIndentSelector( featureDeclarations, tree.settings, name2 ); 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})` ); } if (hasLayoutSupport && styleVariations?.spacing?.blockGap) { const variationSelectorWithBlock = styleVariationSelector + selector; ruleset += getLayoutStyles({ style: styleVariations, selector: variationSelectorWithBlock, hasBlockGapSupport: true, hasFallbackGapSupport, fallbackGapValue }); } } } ); } 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 config2 = { root: rootSelector }; Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach( ([featureKey, featureName]) => { const featureSelector = getBlockSelector(blockType, featureKey); if (featureSelector) { config2[featureName] = featureSelector; } } ); return config2; }; var getBlockSelectors = (blockTypes, variationInstanceId) => { const { getBlockStyles } = (0, import_data31.select)(import_blocks7.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_blocks7.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(config2) { const blocks = config2.styles?.blocks; const separatorBlock = blocks?.["core/separator"]; const needsSeparatorStyleUpdate = separatorBlock && separatorBlock.color?.background && !separatorBlock.color?.text && !separatorBlock.border?.color; if (needsSeparatorStyleUpdate) { return { ...config2, styles: { ...config2.styles, blocks: { ...blocks, "core/separator": { ...separatorBlock, color: { ...separatorBlock.color, text: separatorBlock.color?.background } } } } }; } return config2; } 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(config2 = {}, blockTypes = [], options = {}) { const { hasBlockGapSupport: hasBlockGapSupportOption, hasFallbackGapSupport: hasFallbackGapSupportOption, disableLayoutStyles = false, disableRootPadding = false, styleOptions = {} } = options; const blocks = blockTypes.length > 0 ? blockTypes : (0, import_blocks7.getBlockTypes)(); const blockGap = getSetting(config2, "spacing.blockGap"); const hasBlockGapSupport = hasBlockGapSupportOption ?? blockGap !== null; const hasFallbackGapSupport = hasFallbackGapSupportOption ?? !hasBlockGapSupport; if (!config2?.styles || !config2?.settings) { return [[], {}]; } const updatedConfig = updateConfigWithSeparator(config2); 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_data32.useSelect)( (select6) => { const { getEntityRecord, getEditedEntityRecord: getEditedEntityRecord2, hasFinishedResolution, canUser } = select6(import_core_data28.store); const _globalStylesId = select6(import_core_data28.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_data32.useSelect)(import_core_data28.store); const { editEntityRecord } = (0, import_data32.useDispatch)(import_core_data28.store); const config2 = (0, import_element26.useMemo)(() => { return { settings: settings ?? {}, styles: styles ?? {}, _links: _links ?? {} }; }, [settings, styles, _links]); const setConfig = (0, import_element26.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, config2, setConfig]; } function useGlobalStylesBaseConfig() { const baseConfig = (0, import_data32.useSelect)( (select6) => select6(import_core_data28.store).__experimentalGetCurrentThemeBaseGlobalStyles(), [] ); return [!!baseConfig, baseConfig]; } function useGlobalStylesContext() { const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig(); const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig(); const mergedConfig = (0, import_element26.useMemo)(() => { if (!baseConfig || !userConfig) { return {}; } return mergeGlobalStyles(baseConfig, userConfig); }, [userConfig, baseConfig]); const context = (0, import_element26.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(select6) { const { RECEIVE_INTERMEDIATE_RESULTS: RECEIVE_INTERMEDIATE_RESULTS2 } = unlock(import_core_data29.privateApis); const { getEntityRecords } = select6(import_core_data29.store); return getEntityRecords("postType", "wp_block", { per_page: -1, [RECEIVE_INTERMEDIATE_RESULTS2]: true }); } var BLOCK_EDITOR_SETTINGS = [ "__experimentalBlockBindingsSupportedAttributes", "__experimentalBlockDirectory", "__experimentalDiscussionSettings", "__experimentalFeatures", "__experimentalGlobalStylesBaseStyles", "allImageSizes", "alignWide", "blockInspectorTabs", "maxUploadFileSize", "allowedMimeTypes", "bodyPlaceholder", "canEditCSS", "canLockBlocks", "canUpdateBlockBindings", "capabilities", "clearBlockSelection", "codeEditingEnabled", "colors", "disableContentOnlyForUnsyncedPatterns", "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, isNavigationOverlayContextKey, mediaUploadOnSuccessKey } = unlock(import_block_editor7.privateApis); function useBlockEditorSettings(settings, postType2, postId2, renderingMode2) { const isLargeViewport = (0, import_compose6.useViewportMatch)("medium"); const { allImageSizes, bigImageSizeThreshold, allowRightClickOverrides, blockTypes, focusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, hasUploadPermissions, hiddenBlockTypes, canUseUnfilteredHTML, userCanCreatePages, pageOnFront, pageForPosts, userPatternCategories, restBlockPatternCategories, sectionRootClientId, deviceType: deviceType2, isNavigationOverlayContext, isRevisionsMode: isRevisionsMode2 } = (0, import_data33.useSelect)( (select6) => { const { canUser, getRawEntityRecord, getEntityRecord, getUserPatternCategories, getBlockPatternCategories } = select6(import_core_data29.store); const { get } = select6(import_preferences4.store); const { getBlockTypes: getBlockTypes6 } = select6(import_blocks8.store); const { getDeviceType: getDeviceType2, isRevisionsMode: _isRevisionsMode } = unlock( select6(store) ); const { getBlocksByName, getBlockAttributes: getBlockAttributes2 } = select6(import_block_editor7.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEntityRecord("root", "site") : void 0; const baseData = getEntityRecord("root", "__unstableBase"); function getSectionRootBlock() { if (renderingMode2 === "template-locked") { return getBlocksByName("core/post-content")?.[0] ?? ""; } return getBlocksByName("core/group").find( (clientId) => getBlockAttributes2(clientId)?.tagName === "main" ) ?? ""; } return { allImageSizes: baseData?.image_sizes, bigImageSizeThreshold: baseData?.image_size_threshold, 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(), isNavigationOverlayContext: postType2 === "wp_template_part" && postId2 ? getEntityRecord( "postType", "wp_template_part", postId2 )?.area === "navigation-overlay" : false, isRevisionsMode: _isRevisionsMode() }; }, [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_element27.useMemo)( () => [...settingsBlockPatterns || []].filter( ({ postTypes }) => { return !postTypes || Array.isArray(postTypes) && postTypes.includes(postType2); } ), [settingsBlockPatterns, postType2] ); const blockPatternCategories = (0, import_element27.useMemo)( () => [ ...settingsBlockPatternCategories || [], ...restBlockPatternCategories || [] ].filter( (x2, index2, arr) => index2 === arr.findIndex((y3) => x2.name === y3.name) ), [settingsBlockPatternCategories, restBlockPatternCategories] ); const { undo: undo2, setIsInserterOpened: setIsInserterOpened2 } = (0, import_data33.useDispatch)(store); const { editMediaEntity } = unlock((0, import_data33.useDispatch)(import_core_data29.store)); const { saveEntityRecord } = (0, import_data33.useDispatch)(import_core_data29.store); const createPageEntity = (0, import_element27.useCallback)( (options) => { if (!userCanCreatePages) { return Promise.reject({ message: (0, import_i18n62.__)( "You do not have permission to create Pages." ) }); } return saveEntityRecord("postType", "page", options); }, [saveEntityRecord, userCanCreatePages] ); const allowedBlockTypes = (0, import_element27.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_element27.useMemo)(() => { const blockEditorSettings = { ...Object.fromEntries( Object.entries(settings).filter( ([key]) => BLOCK_EDITOR_SETTINGS.includes(key) ).filter(([key]) => key !== "onNavigateToEntityRecord") ), [globalStylesDataKey]: globalStylesData, [globalStylesLinksDataKey]: globalStylesLinksData, allImageSizes, bigImageSizeThreshold, allowedBlockTypes, allowRightClickOverrides, focusMode: focusMode && !forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, onNavigateToEntityRecord: settings.onNavigateToEntityRecord, [getMediaSelectKey]: (select6, attachmentId) => { return select6(import_core_data29.store).getEntityRecord( "postType", "attachment", attachmentId ); }, [mediaEditKey]: hasUploadPermissions ? editMediaEntity : void 0, mediaUpload: hasUploadPermissions ? mediaUpload : void 0, [mediaUploadOnSuccessKey]: hasUploadPermissions ? mediaUploadOnSuccess : void 0, mediaSideload: hasUploadPermissions ? media_sideload_default : void 0, mediaFinalize: hasUploadPermissions ? mediaFinalize : void 0, __experimentalBlockPatterns: blockPatterns, [selectBlockPatternsKey]: (select6) => { const { hasFinishedResolution, getBlockPatternsForPostType } = unlock(select6(import_core_data29.store)); const patterns2 = getBlockPatternsForPostType(postType2); return hasFinishedResolution("getBlockPatterns") ? patterns2 : void 0; }, [reusableBlocksSelectKey]: __experimentalReusableBlocksSelect, __experimentalBlockPatternCategories: blockPatternCategories, __experimentalUserPatternCategories: userPatternCategories, __experimentalFetchLinkSuggestions: (search, searchOptions) => (0, import_core_data29.__experimentalFetchLinkSuggestions)(search, searchOptions, settings), inserterMediaCategories: media_categories_default, __experimentalFetchRichUrlData: import_core_data29.__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), // When in template-locked mode (e.g., "Show Template" in the post editor), // don't treat template parts as contentOnly sections. disableContentOnlyForTemplateParts: renderingMode2 === "template-locked", ...deviceType2 ? { [deviceTypeKey]: deviceType2 } : {}, [isNavigationOverlayContextKey]: isNavigationOverlayContext }; if (isRevisionsMode2) { blockEditorSettings.isPreviewMode = true; } return blockEditorSettings; }, [ isRevisionsMode2, 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, settings.onNavigateToEntityRecord, deviceType2, allImageSizes, bigImageSizeThreshold, isNavigationOverlayContext ]); } var use_block_editor_settings_default = useBlockEditorSettings; // packages/editor/build-module/components/provider/disable-non-page-content-blocks.mjs var import_data34 = __toESM(require_data(), 1); var import_block_editor8 = __toESM(require_block_editor(), 1); var import_element29 = __toESM(require_element(), 1); // packages/editor/build-module/components/provider/use-post-content-block-types.mjs var import_element28 = __toESM(require_element(), 1); var import_hooks4 = __toESM(require_hooks(), 1); var POST_CONTENT_BLOCK_TYPES = [ "core/post-title", "core/post-featured-image", "core/post-content" ]; function usePostContentBlockTypes() { return (0, import_element28.useMemo)( () => [ ...(0, import_hooks4.applyFilters)( "editor.postContentBlockTypes", POST_CONTENT_BLOCK_TYPES ) ], [] ); } // packages/editor/build-module/components/provider/disable-non-page-content-blocks.mjs function DisableNonPageContentBlocks() { const postContentBlockTypes = usePostContentBlockTypes(); const { contentOnlyIds, templateParts } = (0, import_data34.useSelect)( (select6) => { const { getPostBlocksByName: getPostBlocksByName2 } = unlock(select6(store)); const { getBlocksByName } = select6(import_block_editor8.store); return { contentOnlyIds: getPostBlocksByName2(postContentBlockTypes), templateParts: getBlocksByName("core/template-part") }; }, [postContentBlockTypes] ); const templatePartChildren = (0, import_data34.useSelect)( (select6) => { const { getBlockOrder: getBlockOrder2 } = select6(import_block_editor8.store); return templateParts.flatMap( (clientId) => getBlockOrder2(clientId) ); }, [templateParts] ); const registry = (0, import_data34.useRegistry)(); (0, import_element29.useEffect)(() => { const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(import_block_editor8.store); setBlockEditingMode("", "disabled"); return () => { unsetBlockEditingMode(""); }; }, [registry]); (0, import_element29.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_element29.useEffect)(() => { const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(import_block_editor8.store); const contentOnlySet = new Set(contentOnlyIds); registry.batch(() => { for (const clientId of contentOnlyIds) { setBlockEditingMode(clientId, "contentOnly"); } for (const clientId of templatePartChildren) { if (!contentOnlySet.has(clientId)) { setBlockEditingMode(clientId, "disabled"); } } }); return () => { registry.batch(() => { for (const clientId of contentOnlyIds) { unsetBlockEditingMode(clientId); } for (const clientId of templatePartChildren) { if (!contentOnlySet.has(clientId)) { unsetBlockEditingMode(clientId); } } }); }; }, [contentOnlyIds, templatePartChildren, registry]); return null; } // packages/editor/build-module/components/provider/navigation-block-editing-mode.mjs var import_element30 = __toESM(require_element(), 1); var import_data35 = __toESM(require_data(), 1); var import_block_editor9 = __toESM(require_block_editor(), 1); function NavigationBlockEditingMode() { const blockClientId = (0, import_data35.useSelect)( (select6) => select6(import_block_editor9.store).getBlockOrder()?.[0], [] ); const { setBlockEditingMode, unsetBlockEditingMode } = (0, import_data35.useDispatch)(import_block_editor9.store); (0, import_element30.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_element31 = __toESM(require_element(), 1); var import_hooks5 = __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_element31.useEffect)(() => { (0, import_hooks5.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_hooks5.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_hooks5.removeFilter)( "blockEditor.__unstableCanInsertBlockType", "removeTemplatePartsFromInserter" ); (0, import_hooks5.removeFilter)( "blockEditor.__unstableCanInsertBlockType", "removePostContentFromInserter" ); }; }, [postType2, mode]); } // packages/editor/build-module/components/provider/use-revision-blocks.mjs var import_data36 = __toESM(require_data(), 1); var import_element32 = __toESM(require_element(), 1); var import_blocks10 = __toESM(require_blocks(), 1); // packages/editor/build-module/components/post-revisions-preview/block-diff.mjs var import_array = __toESM(require_array(), 1); var import_word = __toESM(require_word(), 1); var import_block_serialization_default_parser = __toESM(require_block_serialization_default_parser(), 1); var import_blocks9 = __toESM(require_blocks(), 1); var import_rich_text = __toESM(require_rich_text(), 1); var import_i18n63 = __toESM(require_i18n(), 1); var { parseRawBlock } = unlock(import_blocks9.privateApis); function stringifyValue(value) { if (value === null || value === void 0) { return ""; } if (typeof value === "object") { return JSON.stringify(value, null, 2); } return String(value); } function textSimilarity(text1, text2) { if (!text1 && !text2) { return 1; } if (!text1 || !text2) { return 0; } const segmenter = new Intl.Segmenter(void 0, { granularity: "word" }); const wordLikeRegex = /[\p{L}\p{N}]/u; const getWords = (text) => { const words = []; for (const { segment, isWordLike } of segmenter.segment(text)) { if (isWordLike || wordLikeRegex.test(segment)) { words.push(segment); } } return words; }; const words1 = getWords(text1); const words2 = getWords(text2); if (words1.length === 0 && words2.length === 0) { return 1; } const set1 = new Set(words1); let intersection = 0; for (const word of words2) { if (set1.has(word)) { intersection++; } } const total = Math.max(words1.length, words2.length); return total > 0 ? intersection / total : 0; } function pairSimilarBlocks(blocks) { const removed = []; const added = []; blocks.forEach((block, index2) => { const status = block.__revisionDiffStatus?.status; if (status === "removed") { removed.push({ block, index: index2 }); } else if (status === "added") { added.push({ block, index: index2 }); } }); if (removed.length === 0 || added.length === 0) { return blocks; } const pairedRemoved = /* @__PURE__ */ new Set(); const pairedAdded = /* @__PURE__ */ new Set(); const modifications = /* @__PURE__ */ new Map(); const SIMILARITY_THRESHOLD = 0.5; const addedByName = /* @__PURE__ */ new Map(); for (const add of added) { const name2 = add.block.blockName; if (!addedByName.has(name2)) { addedByName.set(name2, []); } addedByName.get(name2).push(add); } const removedByName = /* @__PURE__ */ new Map(); for (const rem of removed) { const name2 = rem.block.blockName; if (!removedByName.has(name2)) { removedByName.set(name2, []); } removedByName.get(name2).push(rem); } let maxPairedAddedIndex = -1; for (const rem of removed) { const candidates = addedByName.get(rem.block.blockName) || []; const sameNameRemoved = removedByName.get(rem.block.blockName) || []; const unpaired = candidates.filter( (add) => !modifications.has(add.index) && add.index > maxPairedAddedIndex ); if (unpaired.length === 0) { continue; } let bestMatch = null; if (sameNameRemoved.length === 1 && unpaired.length === 1) { const add = unpaired[0]; const attrsMatch = JSON.stringify(rem.block.attrs) === JSON.stringify(add.block.attrs); const contentMatch = (rem.block.innerHTML || "") === (add.block.innerHTML || ""); if (!contentMatch || !attrsMatch) { bestMatch = add; } } else { let bestScore = 0; for (const add of unpaired) { const score = textSimilarity( rem.block.innerHTML || "", add.block.innerHTML || "" ); const attrsMatch = JSON.stringify(rem.block.attrs) === JSON.stringify(add.block.attrs); if (score > bestScore && score > SIMILARITY_THRESHOLD && (score < 1 || !attrsMatch)) { bestScore = score; bestMatch = add; } } } if (bestMatch) { maxPairedAddedIndex = bestMatch.index; const modifiedBlock = { ...bestMatch.block, __revisionDiffStatus: { status: "modified" }, __previousRawBlock: rem.block }; const lo = Math.min(rem.index, bestMatch.index); const hi = Math.max(rem.index, bestMatch.index); let hasAddedBetween = false; for (let i3 = lo + 1; i3 < hi; i3++) { if (blocks[i3].__revisionDiffStatus?.status === "added" && !pairedAdded.has(i3)) { hasAddedBetween = true; break; } } if (hasAddedBetween) { modifications.set(bestMatch.index, modifiedBlock); pairedRemoved.add(rem.index); } else { modifications.set(rem.index, modifiedBlock); pairedAdded.add(bestMatch.index); } } } return blocks.map((block, index2) => { if (pairedRemoved.has(index2) || pairedAdded.has(index2)) { return null; } if (modifications.has(index2)) { return modifications.get(index2); } return block; }).filter(Boolean); } function diffRawBlocks(currentRaw, previousRaw) { const createBlockSignature = (rawBlock) => JSON.stringify({ name: rawBlock.blockName, attrs: rawBlock.attrs, // Use innerContent filtered to non-null and non-whitespace-only strings. // This excludes whitespace between inner blocks which changes based on count. html: (rawBlock.innerContent || []).filter( (c6) => c6 !== null && c6.trim() !== "" ) }); const currentSigs = currentRaw.map(createBlockSignature); const previousSigs = previousRaw.map(createBlockSignature); const diff = (0, import_array.diffArrays)(previousSigs, currentSigs); const result = []; let currIdx = 0; let prevIdx = 0; for (const part of diff) { if (part.added) { for (let i3 = 0; i3 < part.count; i3++) { result.push({ ...currentRaw[currIdx++], __revisionDiffStatus: { status: "added" } }); } } else if (part.removed) { for (let i3 = 0; i3 < part.count; i3++) { result.push({ ...previousRaw[prevIdx++], __revisionDiffStatus: { status: "removed" } }); } } else { for (let i3 = 0; i3 < part.count; i3++) { const currBlock = currentRaw[currIdx++]; const prevBlock = previousRaw[prevIdx++]; const diffedInnerBlocks = diffRawBlocks( currBlock.innerBlocks || [], prevBlock.innerBlocks || [] ); result.push({ ...currBlock, innerBlocks: diffedInnerBlocks }); } } } return pairSimilarBlocks(result); } function hasFormatChangedAtIndex(currentFormats, previousFormats, currentIndex, previousIndex) { const currFmts = currentFormats[currentIndex] || []; const prevFmts = previousFormats[previousIndex] || []; if (currFmts.length !== prevFmts.length) { return true; } for (const fmt of currFmts) { const match3 = prevFmts.find( (pf) => pf.type === fmt.type && JSON.stringify(pf.attributes) === JSON.stringify(fmt.attributes) ); if (!match3) { return true; } } return false; } function describeFormatChange(currentFormats, previousFormats, currIdx, prevIdx) { const currFmts = currentFormats[currIdx] || []; const prevFmts = previousFormats[prevIdx] || []; let addedCount = 0; let removedCount = 0; let changedCount = 0; for (const fmt of currFmts) { const match3 = prevFmts.find((pf) => pf.type === fmt.type); if (!match3) { addedCount++; } else if (JSON.stringify(fmt.attributes) !== JSON.stringify(match3.attributes)) { changedCount++; } } for (const fmt of prevFmts) { const match3 = currFmts.find((cf) => cf.type === fmt.type); if (!match3) { removedCount++; } } if (addedCount > 0 && removedCount === 0 && changedCount === 0) { return { type: "added", description: (0, import_i18n63.sprintf)( /* translators: %d: number of formats added */ (0, import_i18n63._n)("%d format added", "%d formats added", addedCount), addedCount ) }; } if (removedCount > 0 && addedCount === 0 && changedCount === 0) { return { type: "removed", description: (0, import_i18n63.sprintf)( /* translators: %d: number of formats removed */ (0, import_i18n63._n)("%d format removed", "%d formats removed", removedCount), removedCount ) }; } const parts = []; if (addedCount > 0) { parts.push( (0, import_i18n63.sprintf)( /* translators: %d: number of formats added */ (0, import_i18n63._n)("%d format added", "%d formats added", addedCount), addedCount ) ); } if (removedCount > 0) { parts.push( (0, import_i18n63.sprintf)( /* translators: %d: number of formats removed */ (0, import_i18n63._n)("%d format removed", "%d formats removed", removedCount), removedCount ) ); } if (changedCount > 0) { parts.push( (0, import_i18n63.sprintf)( /* translators: %d: number of formats changed */ (0, import_i18n63._n)("%d format changed", "%d formats changed", changedCount), changedCount ) ); } return { type: "changed", description: parts.join(", ") || (0, import_i18n63.__)("Formatting changed") }; } function applyRichTextDiff(currentRichText, previousRichText) { const currentText = currentRichText.toPlainText(); const previousText = previousRichText.toPlainText(); const textDiff = (0, import_word.diffWords)(previousText, currentText); let result = (0, import_rich_text.create)({ text: "" }); let currentIdx = 0; let previousIdx = 0; for (const part of textDiff) { if (part.removed) { const removedSlice = (0, import_rich_text.slice)( previousRichText, previousIdx, previousIdx + part.value.length ); const formatted = (0, import_rich_text.applyFormat)( removedSlice, { type: "revision/diff-removed", attributes: { title: (0, import_i18n63.__)("Removed") } }, 0, part.value.length ); result = (0, import_rich_text.concat)(result, formatted); previousIdx += part.value.length; } else if (part.added) { const addedSlice = (0, import_rich_text.slice)( currentRichText, currentIdx, currentIdx + part.value.length ); const formatted = (0, import_rich_text.applyFormat)( addedSlice, { type: "revision/diff-added", attributes: { title: (0, import_i18n63.__)("Added") } }, 0, part.value.length ); result = (0, import_rich_text.concat)(result, formatted); currentIdx += part.value.length; } else { const currentFormats = currentRichText.formats || []; const previousFormats = previousRichText.formats || []; const len = part.value.length; const checkFormatChanged = (offset3) => hasFormatChangedAtIndex( currentFormats, previousFormats, currentIdx + offset3, previousIdx + offset3 ); let rangeStart = 0; let rangeFormatChanged = checkFormatChanged(0); for (let i3 = 1; i3 <= len; i3++) { const formatChanged = i3 < len && checkFormatChanged(i3); if (i3 === len || formatChanged !== rangeFormatChanged) { const rangeSlice = (0, import_rich_text.slice)( currentRichText, currentIdx + rangeStart, currentIdx + i3 ); if (rangeFormatChanged) { const { type, description } = describeFormatChange( currentFormats, previousFormats, currentIdx + rangeStart, previousIdx + rangeStart ); const formatType = { added: "revision/diff-format-added", removed: "revision/diff-format-removed", changed: "revision/diff-format-changed" }[type]; const marked = (0, import_rich_text.applyFormat)( rangeSlice, { type: formatType, attributes: { title: description } }, 0, i3 - rangeStart ); result = (0, import_rich_text.concat)(result, marked); } else { result = (0, import_rich_text.concat)(result, rangeSlice); } rangeStart = i3; rangeFormatChanged = formatChanged; } } currentIdx += part.value.length; previousIdx += part.value.length; } } return new import_rich_text.RichTextData(result); } function applyDiffToBlock(currentBlock, previousBlock, diffStatus) { const blockType = (0, import_blocks9.getBlockType)(currentBlock.name); if (!blockType) { return; } const changedAttributes = {}; for (const [attrName, attrDef] of Object.entries( blockType.attributes )) { if (attrDef.source === "rich-text") { const currentRichText = currentBlock.attributes[attrName]; const previousRichText = previousBlock.attributes[attrName]; if (currentRichText instanceof import_rich_text.RichTextData && previousRichText instanceof import_rich_text.RichTextData) { currentBlock.attributes[attrName] = applyRichTextDiff( currentRichText, previousRichText ); } } else { const currStr = stringifyValue( currentBlock.attributes[attrName] ); const prevStr = stringifyValue( previousBlock.attributes[attrName] ); if (currStr !== prevStr) { changedAttributes[attrName] = (0, import_word.diffWords)(prevStr, currStr); } } } if (Object.keys(changedAttributes).length > 0) { diffStatus.changedAttributes = changedAttributes; } } function applyDiffRecursively(parsedBlock, rawBlock) { if (rawBlock.__revisionDiffStatus) { if (rawBlock.__revisionDiffStatus.status === "modified" && rawBlock.__previousRawBlock) { const previousParsed = parseRawBlock(rawBlock.__previousRawBlock); if (previousParsed) { applyDiffToBlock( parsedBlock, previousParsed, rawBlock.__revisionDiffStatus ); } } parsedBlock.__revisionDiffStatus = rawBlock.__revisionDiffStatus; parsedBlock.attributes.__revisionDiffStatus = rawBlock.__revisionDiffStatus; } if (parsedBlock.innerBlocks && rawBlock.innerBlocks) { for (let i3 = 0; i3 < parsedBlock.innerBlocks.length; i3++) { const parsedInner = parsedBlock.innerBlocks[i3]; const rawInner = rawBlock.innerBlocks[i3]; if (parsedInner && rawInner) { applyDiffRecursively(parsedInner, rawInner); } } } } function diffRevisionContent(currentContent, previousContent) { const currentRaw = (0, import_block_serialization_default_parser.parse)(currentContent || ""); const previousRaw = (0, import_block_serialization_default_parser.parse)(previousContent || ""); const mergedRaw = diffRawBlocks(currentRaw, previousRaw); return mergedRaw.map((rawBlock) => { const parsed = parseRawBlock(rawBlock); if (parsed) { applyDiffRecursively(parsed, rawBlock); } return parsed; }).filter(Boolean); } // packages/editor/build-module/components/post-revisions-preview/preserve-client-ids.mjs var import_array2 = __toESM(require_array(), 1); function preserveClientIds(newBlocks, prevBlocks) { if (!prevBlocks?.length || !newBlocks?.length) { return newBlocks; } const newSigs = newBlocks.map((block) => block.name); const prevSigs = prevBlocks.map((block) => block.name); const diffResult = (0, import_array2.diffArrays)(prevSigs, newSigs); let newIndex = 0; let prevIndex = 0; const result = []; for (const chunk of diffResult) { if (chunk.removed) { prevIndex += chunk.count; } else if (chunk.added) { for (let i3 = 0; i3 < chunk.count; i3++) { result.push(newBlocks[newIndex++]); } } else { for (let i3 = 0; i3 < chunk.count; i3++) { const newBlock = newBlocks[newIndex++]; const prevBlock = prevBlocks[prevIndex++]; result.push({ ...newBlock, clientId: prevBlock.clientId, innerBlocks: preserveClientIds( newBlock.innerBlocks, prevBlock.innerBlocks ) }); } } } return result; } // packages/editor/build-module/components/provider/use-revision-blocks.mjs function useRevisionBlocks() { const { isInRevisionsMode, showDiff, revision, previousRevision, postType: postType2 } = (0, import_data36.useSelect)((select6) => { const { isRevisionsMode: isRevisionsMode2, isShowingRevisionDiff: isShowingRevisionDiff2, getCurrentRevision: getCurrentRevision2, getPreviousRevision: getPreviousRevision2 } = unlock(select6(store)); const { getCurrentPostType: getCurrentPostType2 } = select6(store); const inRevisions = isRevisionsMode2(); return { isInRevisionsMode: inRevisions, showDiff: isShowingRevisionDiff2(), revision: inRevisions ? getCurrentRevision2() : void 0, previousRevision: inRevisions ? getPreviousRevision2() : void 0, postType: getCurrentPostType2() }; }, []); const previousBlocksRef = (0, import_element32.useRef)([]); const blocks = (0, import_element32.useMemo)(() => { if (!isInRevisionsMode) { previousBlocksRef.current = []; return null; } if (!revision) { return []; } const currentContent = revision?.content?.raw ?? ""; let parsedBlocks; if (showDiff) { const previousContent = previousRevision?.content?.raw || ""; parsedBlocks = diffRevisionContent( currentContent, previousContent ); } else { parsedBlocks = (0, import_blocks10.parse)(currentContent); } if (postType2 === "wp_navigation") { parsedBlocks = [ (0, import_blocks10.createBlock)( "core/navigation", { templateLock: false }, parsedBlocks ) ]; } const blocksWithStableIds = preserveClientIds( parsedBlocks, previousBlocksRef.current ); previousBlocksRef.current = blocksWithStableIds; return blocksWithStableIds; }, [ isInRevisionsMode, revision, revision?.content?.raw, previousRevision?.content?.raw, postType2, showDiff ]); return blocks; } // packages/editor/build-module/components/commands/index.mjs var import_data44 = __toESM(require_data(), 1); var import_i18n66 = __toESM(require_i18n(), 1); var import_commands = __toESM(require_commands(), 1); var import_preferences8 = __toESM(require_preferences(), 1); var import_notices14 = __toESM(require_notices(), 1); var import_block_editor10 = __toESM(require_block_editor(), 1); var import_core_data32 = __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_components30 = __toESM(require_components(), 1); var import_data41 = __toESM(require_data(), 1); var import_i18n64 = __toESM(require_i18n(), 1); var import_element34 = __toESM(require_element(), 1); var import_viewport = __toESM(require_viewport(), 1); var import_preferences7 = __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_components26 = __toESM(require_components(), 1); var import_data40 = __toESM(require_data(), 1); var import_plugins = __toESM(require_plugins(), 1); // packages/interface/build-module/store/index.mjs var import_data39 = __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_preferences5 = __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: dispatch7 }) => { if (!area) { return; } scope = normalizeComplementaryAreaScope(scope); area = normalizeComplementaryAreaName(scope, area); const isComplementaryAreaVisible = registry.select(import_preferences5.store).get(scope, "isComplementaryAreaVisible"); if (!isComplementaryAreaVisible) { registry.dispatch(import_preferences5.store).set(scope, "isComplementaryAreaVisible", true); } dispatch7({ type: "ENABLE_COMPLEMENTARY_AREA", scope, area }); }; var disableComplementaryArea = (scope) => ({ registry }) => { scope = normalizeComplementaryAreaScope(scope); const isComplementaryAreaVisible = registry.select(import_preferences5.store).get(scope, "isComplementaryAreaVisible"); if (isComplementaryAreaVisible) { registry.dispatch(import_preferences5.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_preferences5.store).get(scope, "pinnedItems"); if (pinnedItems?.[item] === true) { return; } registry.dispatch(import_preferences5.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_preferences5.store).get(scope, "pinnedItems"); registry.dispatch(import_preferences5.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_preferences5.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_preferences5.store).set(scope, featureName, !!value); }; } function setFeatureDefaults(scope, defaults2) { return function({ registry }) { (0, import_deprecated5.default)(`dispatch( 'core/interface' ).setFeatureDefaults`, { since: "6.0", alternative: `dispatch( 'core/preferences' ).setDefaults` }); registry.dispatch(import_preferences5.store).setDefaults(scope, defaults2); }; } 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_data37 = __toESM(require_data(), 1); var import_deprecated7 = __toESM(require_deprecated(), 1); var import_preferences6 = __toESM(require_preferences(), 1); var getActiveComplementaryArea = (0, import_data37.createRegistrySelector)( (select6) => (state, scope) => { scope = normalizeComplementaryAreaScope(scope); const isComplementaryAreaVisible = select6(import_preferences6.store).get( scope, "isComplementaryAreaVisible" ); if (isComplementaryAreaVisible === void 0) { return void 0; } if (isComplementaryAreaVisible === false) { return null; } return state?.complementaryAreas?.[scope]; } ); var isComplementaryAreaLoading = (0, import_data37.createRegistrySelector)( (select6) => (state, scope) => { scope = normalizeComplementaryAreaScope(scope); const isVisible = select6(import_preferences6.store).get( scope, "isComplementaryAreaVisible" ); const identifier = state?.complementaryAreas?.[scope]; return isVisible && identifier === void 0; } ); var isItemPinned = (0, import_data37.createRegistrySelector)( (select6) => (state, scope, item) => { scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = select6(import_preferences6.store).get( scope, "pinnedItems" ); return pinnedItems?.[item] ?? true; } ); var isFeatureActive = (0, import_data37.createRegistrySelector)( (select6) => (state, scope, featureName) => { (0, import_deprecated7.default)( `select( 'core/interface' ).isFeatureActive( scope, featureName )`, { since: "6.0", alternative: `select( 'core/preferences' ).get( scope, featureName )` } ); return !!select6(import_preferences6.store).get(scope, featureName); } ); function isModalActive(state, modalName3) { return state.activeModal === modalName3; } // packages/interface/build-module/store/reducer.mjs var import_data38 = __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_data38.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_data39.createReduxStore)(STORE_NAME2, { reducer: reducer_default3, actions: actions_exports2, selectors: selectors_exports2 }); (0, import_data39.register)(store2); // packages/interface/build-module/components/complementary-area-toggle/index.mjs var import_jsx_runtime111 = __toESM(require_jsx_runtime(), 1); function roleSupportsCheckedState(role) { return [ "checkbox", "option", "radio", "switch", "menuitemcheckbox", "menuitemradio", "treeitem" ].includes(role); } function ComplementaryAreaToggle({ as = import_components26.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_data40.useSelect)( (select6) => select6(store2).getActiveComplementaryArea(scope) === identifier, [identifier, scope] ); const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data40.useDispatch)(store2); return /* @__PURE__ */ (0, import_jsx_runtime111.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_runtime112 = __toESM(require_jsx_runtime(), 1); var ComplementaryAreaHeader = ({ children, className, toggleButtonProps }) => { const toggleButton = /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ComplementaryAreaToggle, { icon: close_small_default, ...toggleButtonProps }); return /* @__PURE__ */ (0, import_jsx_runtime112.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_components28 = __toESM(require_components(), 1); // packages/interface/build-module/components/action-item/index.mjs var import_components27 = __toESM(require_components(), 1); var import_element33 = __toESM(require_element(), 1); var import_jsx_runtime113 = __toESM(require_jsx_runtime(), 1); var noop3 = () => { }; function ActionItemSlot({ name: name2, as: Component6 = import_components27.MenuGroup, fillProps = {}, bubblesVirtually, ...props }) { return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)( import_components27.Slot, { name: name2, bubblesVirtually, fillProps, children: (fills) => { if (!import_element33.Children.toArray(fills).length) { return null; } const initializedByPlugins = []; import_element33.Children.forEach( fills, ({ props: { __unstableExplicitMenuItem, __unstableTarget } }) => { if (__unstableTarget && __unstableExplicitMenuItem) { initializedByPlugins.push(__unstableTarget); } } ); const children = import_element33.Children.map(fills, (child) => { if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes( child.props.__unstableTarget )) { return null; } return child; }); return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Component6, { ...props, children }); } } ); } function ActionItem({ name: name2, as: Component6 = import_components27.Button, onClick, ...props }) { return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_components27.Fill, { name: name2, children: ({ onClick: fpOnClick }) => { return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)( Component6, { onClick: onClick || fpOnClick ? (...args) => { (onClick || noop3)(...args); (fpOnClick || noop3)(...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_runtime114 = __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_runtime114.jsx)(import_components28.MenuItem, { ...restProps }); function ComplementaryAreaMoreMenuItem({ scope, target, __unstableExplicitMenuItem, ...props }) { return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)( ComplementaryAreaToggle, { as: (toggleProps) => { return /* @__PURE__ */ (0, import_jsx_runtime114.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_components29 = __toESM(require_components(), 1); var import_jsx_runtime115 = __toESM(require_jsx_runtime(), 1); function PinnedItems({ scope, ...props }) { return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_components29.Fill, { name: `PinnedItems/${scope}`, ...props }); } function PinnedItemsSlot({ scope, className, ...props }) { return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_components29.Slot, { name: `PinnedItems/${scope}`, ...props, children: (fills) => fills?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime115.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_runtime116 = __toESM(require_jsx_runtime(), 1); var ANIMATION_DURATION = 0.3; function ComplementaryAreaSlot({ scope, ...props }) { return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(import_components30.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_element34.useState)({}); (0, import_element34.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_runtime116.jsx)(import_components30.Fill, { name: `ComplementaryArea/${scope}`, children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(import_components30.__unstableAnimatePresence, { initial: false, children: (previousIsActive || isActive) && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)( import_components30.__unstableMotion.div, { variants, initial: "closed", animate: isMobileViewport ? "mobileOpen" : "open", exit: "closed", transition, className: "interface-complementary-area__fill", children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)( "div", { id, className, style: { width: isMobileViewport ? "100vw" : SIDEBAR_WIDTH }, children } ) } ) }) }); } function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { const previousIsSmallRef = (0, import_element34.useRef)(false); const shouldOpenWhenNotSmallRef = (0, import_element34.useRef)(false); const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data41.useDispatch)(store2); (0, import_element34.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_i18n64.__)("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_element34.useState)(false); const { isLoading, isActive, isPinned, activeArea, isSmall, isLarge, showIconLabels } = (0, import_data41.useSelect)( (select6) => { const { getActiveComplementaryArea: getActiveComplementaryArea2, isComplementaryAreaLoading: isComplementaryAreaLoading2, isItemPinned: isItemPinned2 } = select6(store2); const { get } = select6(import_preferences7.store); const _activeArea = getActiveComplementaryArea2(scope); return { isLoading: isComplementaryAreaLoading2(scope), isActive: _activeArea === identifier, isPinned: isItemPinned2(scope, identifier), activeArea: _activeArea, isSmall: select6(import_viewport.store).isViewportMatch("< medium"), isLarge: select6(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_data41.useDispatch)(store2); (0, import_element34.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_runtime116.jsxs)(import_jsx_runtime116.Fragment, { children: [ isPinnable && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(pinned_items_default, { scope, children: isPinned && /* @__PURE__ */ (0, import_jsx_runtime116.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_runtime116.jsx)( ComplementaryAreaMoreMenuItem, { target: name2, scope, icon, identifier, children: title } ), /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)( ComplementaryAreaFill, { activeArea, isActive, className: clsx_default("interface-complementary-area", className), scope, id: identifier.replace("/", ":"), children: [ /* @__PURE__ */ (0, import_jsx_runtime116.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_runtime116.jsxs)(import_jsx_runtime116.Fragment, { children: [ /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("h2", { className: "interface-complementary-area-header__title", children: title }), isPinnable && !isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)( import_components30.Button, { className: "interface-complementary-area__pin-unpin-item", icon: isPinned ? star_filled_default : star_empty_default, label: isPinned ? (0, import_i18n64.__)("Unpin from toolbar") : (0, import_i18n64.__)("Pin to toolbar"), onClick: () => (isPinned ? unpinItem2 : pinItem2)( scope, identifier ), isPressed: isPinned, "aria-expanded": isPinned, size: "compact" } ) ] }) } ), /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(import_components30.Panel, { className: panelClassName, children }) ] } ) ] }); } ComplementaryArea.Slot = ComplementaryAreaSlot; var complementary_area_default = ComplementaryArea; // packages/interface/build-module/components/fullscreen-mode/index.mjs var import_element35 = __toESM(require_element(), 1); var FullscreenMode = ({ isActive }) => { (0, import_element35.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_element35.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_element36 = __toESM(require_element(), 1); var import_jsx_runtime117 = __toESM(require_jsx_runtime(), 1); var NavigableRegion = (0, import_element36.forwardRef)( ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { return /* @__PURE__ */ (0, import_jsx_runtime117.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; // node_modules/@base-ui/utils/esm/useRefWithInit.js var React3 = __toESM(require_react(), 1); var UNINITIALIZED = {}; function useRefWithInit(init, initArg) { const ref = React3.useRef(UNINITIALIZED); if (ref.current === UNINITIALIZED) { ref.current = init(initArg); } return ref; } // node_modules/@base-ui/react/esm/utils/useRenderElement.js var React6 = __toESM(require_react(), 1); // node_modules/@base-ui/utils/esm/useMergedRefs.js function useMergedRefs(a3, b3, c6, d3) { const forkRef = useRefWithInit(createForkRef).current; if (didChange(forkRef, a3, b3, c6, d3)) { update3(forkRef, [a3, b3, c6, d3]); } return forkRef.callback; } function useMergedRefsN(refs) { const forkRef = useRefWithInit(createForkRef).current; if (didChangeN(forkRef, refs)) { update3(forkRef, refs); } return forkRef.callback; } function createForkRef() { return { callback: null, cleanup: null, refs: [] }; } function didChange(forkRef, a3, b3, c6, d3) { return forkRef.refs[0] !== a3 || forkRef.refs[1] !== b3 || forkRef.refs[2] !== c6 || forkRef.refs[3] !== d3; } function didChangeN(forkRef, newRefs) { return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); } function update3(forkRef, refs) { forkRef.refs = refs; if (refs.every((ref) => ref == null)) { forkRef.callback = null; return; } forkRef.callback = (instance) => { if (forkRef.cleanup) { forkRef.cleanup(); forkRef.cleanup = null; } if (instance != null) { const cleanupCallbacks = Array(refs.length).fill(null); for (let i3 = 0; i3 < refs.length; i3 += 1) { const ref = refs[i3]; if (ref == null) { continue; } switch (typeof ref) { case "function": { const refCleanup = ref(instance); if (typeof refCleanup === "function") { cleanupCallbacks[i3] = refCleanup; } break; } case "object": { ref.current = instance; break; } default: } } forkRef.cleanup = () => { for (let i3 = 0; i3 < refs.length; i3 += 1) { const ref = refs[i3]; if (ref == null) { continue; } switch (typeof ref) { case "function": { const cleanupCallback = cleanupCallbacks[i3]; if (typeof cleanupCallback === "function") { cleanupCallback(); } else { ref(null); } break; } case "object": { ref.current = null; break; } default: } } }; } }; } // node_modules/@base-ui/utils/esm/getReactElementRef.js var React5 = __toESM(require_react(), 1); // node_modules/@base-ui/utils/esm/reactVersion.js var React4 = __toESM(require_react(), 1); var majorVersion = parseInt(React4.version, 10); function isReactVersionAtLeast(reactVersionToCheck) { return majorVersion >= reactVersionToCheck; } // node_modules/@base-ui/utils/esm/getReactElementRef.js function getReactElementRef(element) { if (!/* @__PURE__ */ React5.isValidElement(element)) { return null; } const reactElement = element; const propsWithRef = reactElement.props; return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; } // node_modules/@base-ui/utils/esm/mergeObjects.js function mergeObjects(a3, b3) { if (a3 && !b3) { return a3; } if (!a3 && b3) { return b3; } if (a3 || b3) { return { ...a3, ...b3 }; } return void 0; } // node_modules/@base-ui/react/esm/utils/getStateAttributesProps.js function getStateAttributesProps(state, customMapping) { const props = {}; for (const key in state) { const value = state[key]; if (customMapping?.hasOwnProperty(key)) { const customProps = customMapping[key](value); if (customProps != null) { Object.assign(props, customProps); } continue; } if (value === true) { props[`data-${key.toLowerCase()}`] = ""; } else if (value) { props[`data-${key.toLowerCase()}`] = value.toString(); } } return props; } // node_modules/@base-ui/react/esm/utils/resolveClassName.js function resolveClassName(className, state) { return typeof className === "function" ? className(state) : className; } // node_modules/@base-ui/react/esm/utils/resolveStyle.js function resolveStyle(style, state) { return typeof style === "function" ? style(state) : style; } // node_modules/@base-ui/react/esm/merge-props/mergeProps.js var EMPTY_PROPS = {}; function mergeProps(a3, b3, c6, d3, e3) { let merged = { ...resolvePropsGetter(a3, EMPTY_PROPS) }; if (b3) { merged = mergeOne(merged, b3); } if (c6) { merged = mergeOne(merged, c6); } if (d3) { merged = mergeOne(merged, d3); } if (e3) { merged = mergeOne(merged, e3); } return merged; } function mergePropsN(props) { if (props.length === 0) { return EMPTY_PROPS; } if (props.length === 1) { return resolvePropsGetter(props[0], EMPTY_PROPS); } let merged = { ...resolvePropsGetter(props[0], EMPTY_PROPS) }; for (let i3 = 1; i3 < props.length; i3 += 1) { merged = mergeOne(merged, props[i3]); } return merged; } function mergeOne(merged, inputProps) { if (isPropsGetter(inputProps)) { return inputProps(merged); } return mutablyMergeInto(merged, inputProps); } function mutablyMergeInto(mergedProps, externalProps) { if (!externalProps) { return mergedProps; } for (const propName in externalProps) { const externalPropValue = externalProps[propName]; switch (propName) { case "style": { mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); break; } case "className": { mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); break; } default: { if (isEventHandler(propName, externalPropValue)) { mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); } else { mergedProps[propName] = externalPropValue; } } } } return mergedProps; } function isEventHandler(key, value) { const code0 = key.charCodeAt(0); const code1 = key.charCodeAt(1); const code2 = key.charCodeAt(2); return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); } function isPropsGetter(inputProps) { return typeof inputProps === "function"; } function resolvePropsGetter(inputProps, previousProps) { if (isPropsGetter(inputProps)) { return inputProps(previousProps); } return inputProps ?? EMPTY_PROPS; } function mergeEventHandlers(ourHandler, theirHandler) { if (!theirHandler) { return ourHandler; } if (!ourHandler) { return theirHandler; } return (event) => { if (isSyntheticEvent(event)) { const baseUIEvent = event; makeEventPreventable(baseUIEvent); const result2 = theirHandler(baseUIEvent); if (!baseUIEvent.baseUIHandlerPrevented) { ourHandler?.(baseUIEvent); } return result2; } const result = theirHandler(event); ourHandler?.(event); return result; }; } function makeEventPreventable(event) { event.preventBaseUIHandler = () => { event.baseUIHandlerPrevented = true; }; return event; } function mergeClassNames(ourClassName, theirClassName) { if (theirClassName) { if (ourClassName) { return theirClassName + " " + ourClassName; } return theirClassName; } return ourClassName; } function isSyntheticEvent(event) { return event != null && typeof event === "object" && "nativeEvent" in event; } // node_modules/@base-ui/utils/esm/empty.js var EMPTY_ARRAY4 = Object.freeze([]); var EMPTY_OBJECT4 = Object.freeze({}); // node_modules/@base-ui/react/esm/utils/useRenderElement.js var import_react4 = __toESM(require_react(), 1); function useRenderElement(element, componentProps, params = {}) { const renderProp = componentProps.render; const outProps = useRenderElementProps(componentProps, params); if (params.enabled === false) { return null; } const state = params.state ?? EMPTY_OBJECT4; return evaluateRenderProp(element, renderProp, outProps, state); } function useRenderElementProps(componentProps, params = {}) { const { className: classNameProp, style: styleProp, render: renderProp } = componentProps; const { state = EMPTY_OBJECT4, ref, props, stateAttributesMapping, enabled = true } = params; const className = enabled ? resolveClassName(classNameProp, state) : void 0; const style = enabled ? resolveStyle(styleProp, state) : void 0; const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT4; const outProps = enabled ? mergeObjects(stateProps, Array.isArray(props) ? mergePropsN(props) : props) ?? EMPTY_OBJECT4 : EMPTY_OBJECT4; if (typeof document !== "undefined") { if (!enabled) { useMergedRefs(null, null); } else if (Array.isArray(ref)) { outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); } else { outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); } } if (!enabled) { return EMPTY_OBJECT4; } if (className !== void 0) { outProps.className = mergeClassNames(outProps.className, className); } if (style !== void 0) { outProps.style = mergeObjects(outProps.style, style); } return outProps; } function evaluateRenderProp(element, render4, props, state) { if (render4) { if (typeof render4 === "function") { return render4(props, state); } const mergedProps = mergeProps(props, render4.props); mergedProps.ref = props.ref; return /* @__PURE__ */ React6.cloneElement(render4, mergedProps); } if (element) { if (typeof element === "string") { return renderTag(element, props); } } throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage(8)); } function renderTag(Tag, props) { if (Tag === "button") { return /* @__PURE__ */ (0, import_react4.createElement)("button", { type: "button", ...props, key: props.key }); } if (Tag === "img") { return /* @__PURE__ */ (0, import_react4.createElement)("img", { alt: "", ...props, key: props.key }); } return /* @__PURE__ */ React6.createElement(Tag, props); } // 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/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, config2) => { const { placement = "bottom", strategy = "absolute", middleware = [], platform: platform2 } = config2; 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/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 isRTL(element) { return getComputedStyle2(element).direction === "rtl"; } var platform = { convertOffsetParentRelativeRectToViewportRelativeRect, getDocumentElement, getClippingRect, getOffsetParent, getElementRects, getClientRects, getDimensions, getScale, isElement, isRTL }; 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