#js&&****&……PK{MZ^ccurl.jsnu[/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 9681: /***/ ((module) => { var characterMap = { "À": "A", "Á": "A", "Â": "A", "Ã": "A", "Ä": "A", "Å": "A", "Ấ": "A", "Ắ": "A", "Ẳ": "A", "Ẵ": "A", "Ặ": "A", "Æ": "AE", "Ầ": "A", "Ằ": "A", "Ȃ": "A", "Ả": "A", "Ạ": "A", "Ẩ": "A", "Ẫ": "A", "Ậ": "A", "Ç": "C", "Ḉ": "C", "È": "E", "É": "E", "Ê": "E", "Ë": "E", "Ế": "E", "Ḗ": "E", "Ề": "E", "Ḕ": "E", "Ḝ": "E", "Ȇ": "E", "Ẻ": "E", "Ẽ": "E", "Ẹ": "E", "Ể": "E", "Ễ": "E", "Ệ": "E", "Ì": "I", "Í": "I", "Î": "I", "Ï": "I", "Ḯ": "I", "Ȋ": "I", "Ỉ": "I", "Ị": "I", "Ð": "D", "Ñ": "N", "Ò": "O", "Ó": "O", "Ô": "O", "Õ": "O", "Ö": "O", "Ø": "O", "Ố": "O", "Ṍ": "O", "Ṓ": "O", "Ȏ": "O", "Ỏ": "O", "Ọ": "O", "Ổ": "O", "Ỗ": "O", "Ộ": "O", "Ờ": "O", "Ở": "O", "Ỡ": "O", "Ớ": "O", "Ợ": "O", "Ù": "U", "Ú": "U", "Û": "U", "Ü": "U", "Ủ": "U", "Ụ": "U", "Ử": "U", "Ữ": "U", "Ự": "U", "Ý": "Y", "à": "a", "á": "a", "â": "a", "ã": "a", "ä": "a", "å": "a", "ấ": "a", "ắ": "a", "ẳ": "a", "ẵ": "a", "ặ": "a", "æ": "ae", "ầ": "a", "ằ": "a", "ȃ": "a", "ả": "a", "ạ": "a", "ẩ": "a", "ẫ": "a", "ậ": "a", "ç": "c", "ḉ": "c", "è": "e", "é": "e", "ê": "e", "ë": "e", "ế": "e", "ḗ": "e", "ề": "e", "ḕ": "e", "ḝ": "e", "ȇ": "e", "ẻ": "e", "ẽ": "e", "ẹ": "e", "ể": "e", "ễ": "e", "ệ": "e", "ì": "i", "í": "i", "î": "i", "ï": "i", "ḯ": "i", "ȋ": "i", "ỉ": "i", "ị": "i", "ð": "d", "ñ": "n", "ò": "o", "ó": "o", "ô": "o", "õ": "o", "ö": "o", "ø": "o", "ố": "o", "ṍ": "o", "ṓ": "o", "ȏ": "o", "ỏ": "o", "ọ": "o", "ổ": "o", "ỗ": "o", "ộ": "o", "ờ": "o", "ở": "o", "ỡ": "o", "ớ": "o", "ợ": "o", "ù": "u", "ú": "u", "û": "u", "ü": "u", "ủ": "u", "ụ": "u", "ử": "u", "ữ": "u", "ự": "u", "ý": "y", "ÿ": "y", "Ā": "A", "ā": "a", "Ă": "A", "ă": "a", "Ą": "A", "ą": "a", "Ć": "C", "ć": "c", "Ĉ": "C", "ĉ": "c", "Ċ": "C", "ċ": "c", "Č": "C", "č": "c", "C̆": "C", "c̆": "c", "Ď": "D", "ď": "d", "Đ": "D", "đ": "d", "Ē": "E", "ē": "e", "Ĕ": "E", "ĕ": "e", "Ė": "E", "ė": "e", "Ę": "E", "ę": "e", "Ě": "E", "ě": "e", "Ĝ": "G", "Ǵ": "G", "ĝ": "g", "ǵ": "g", "Ğ": "G", "ğ": "g", "Ġ": "G", "ġ": "g", "Ģ": "G", "ģ": "g", "Ĥ": "H", "ĥ": "h", "Ħ": "H", "ħ": "h", "Ḫ": "H", "ḫ": "h", "Ĩ": "I", "ĩ": "i", "Ī": "I", "ī": "i", "Ĭ": "I", "ĭ": "i", "Į": "I", "į": "i", "İ": "I", "ı": "i", "IJ": "IJ", "ij": "ij", "Ĵ": "J", "ĵ": "j", "Ķ": "K", "ķ": "k", "Ḱ": "K", "ḱ": "k", "K̆": "K", "k̆": "k", "Ĺ": "L", "ĺ": "l", "Ļ": "L", "ļ": "l", "Ľ": "L", "ľ": "l", "Ŀ": "L", "ŀ": "l", "Ł": "l", "ł": "l", "Ḿ": "M", "ḿ": "m", "M̆": "M", "m̆": "m", "Ń": "N", "ń": "n", "Ņ": "N", "ņ": "n", "Ň": "N", "ň": "n", "ʼn": "n", "N̆": "N", "n̆": "n", "Ō": "O", "ō": "o", "Ŏ": "O", "ŏ": "o", "Ő": "O", "ő": "o", "Œ": "OE", "œ": "oe", "P̆": "P", "p̆": "p", "Ŕ": "R", "ŕ": "r", "Ŗ": "R", "ŗ": "r", "Ř": "R", "ř": "r", "R̆": "R", "r̆": "r", "Ȓ": "R", "ȓ": "r", "Ś": "S", "ś": "s", "Ŝ": "S", "ŝ": "s", "Ş": "S", "Ș": "S", "ș": "s", "ş": "s", "Š": "S", "š": "s", "Ţ": "T", "ţ": "t", "ț": "t", "Ț": "T", "Ť": "T", "ť": "t", "Ŧ": "T", "ŧ": "t", "T̆": "T", "t̆": "t", "Ũ": "U", "ũ": "u", "Ū": "U", "ū": "u", "Ŭ": "U", "ŭ": "u", "Ů": "U", "ů": "u", "Ű": "U", "ű": "u", "Ų": "U", "ų": "u", "Ȗ": "U", "ȗ": "u", "V̆": "V", "v̆": "v", "Ŵ": "W", "ŵ": "w", "Ẃ": "W", "ẃ": "w", "X̆": "X", "x̆": "x", "Ŷ": "Y", "ŷ": "y", "Ÿ": "Y", "Y̆": "Y", "y̆": "y", "Ź": "Z", "ź": "z", "Ż": "Z", "ż": "z", "Ž": "Z", "ž": "z", "ſ": "s", "ƒ": "f", "Ơ": "O", "ơ": "o", "Ư": "U", "ư": "u", "Ǎ": "A", "ǎ": "a", "Ǐ": "I", "ǐ": "i", "Ǒ": "O", "ǒ": "o", "Ǔ": "U", "ǔ": "u", "Ǖ": "U", "ǖ": "u", "Ǘ": "U", "ǘ": "u", "Ǚ": "U", "ǚ": "u", "Ǜ": "U", "ǜ": "u", "Ứ": "U", "ứ": "u", "Ṹ": "U", "ṹ": "u", "Ǻ": "A", "ǻ": "a", "Ǽ": "AE", "ǽ": "ae", "Ǿ": "O", "ǿ": "o", "Þ": "TH", "þ": "th", "Ṕ": "P", "ṕ": "p", "Ṥ": "S", "ṥ": "s", "X́": "X", "x́": "x", "Ѓ": "Г", "ѓ": "г", "Ќ": "К", "ќ": "к", "A̋": "A", "a̋": "a", "E̋": "E", "e̋": "e", "I̋": "I", "i̋": "i", "Ǹ": "N", "ǹ": "n", "Ồ": "O", "ồ": "o", "Ṑ": "O", "ṑ": "o", "Ừ": "U", "ừ": "u", "Ẁ": "W", "ẁ": "w", "Ỳ": "Y", "ỳ": "y", "Ȁ": "A", "ȁ": "a", "Ȅ": "E", "ȅ": "e", "Ȉ": "I", "ȉ": "i", "Ȍ": "O", "ȍ": "o", "Ȑ": "R", "ȑ": "r", "Ȕ": "U", "ȕ": "u", "B̌": "B", "b̌": "b", "Č̣": "C", "č̣": "c", "Ê̌": "E", "ê̌": "e", "F̌": "F", "f̌": "f", "Ǧ": "G", "ǧ": "g", "Ȟ": "H", "ȟ": "h", "J̌": "J", "ǰ": "j", "Ǩ": "K", "ǩ": "k", "M̌": "M", "m̌": "m", "P̌": "P", "p̌": "p", "Q̌": "Q", "q̌": "q", "Ř̩": "R", "ř̩": "r", "Ṧ": "S", "ṧ": "s", "V̌": "V", "v̌": "v", "W̌": "W", "w̌": "w", "X̌": "X", "x̌": "x", "Y̌": "Y", "y̌": "y", "A̧": "A", "a̧": "a", "B̧": "B", "b̧": "b", "Ḑ": "D", "ḑ": "d", "Ȩ": "E", "ȩ": "e", "Ɛ̧": "E", "ɛ̧": "e", "Ḩ": "H", "ḩ": "h", "I̧": "I", "i̧": "i", "Ɨ̧": "I", "ɨ̧": "i", "M̧": "M", "m̧": "m", "O̧": "O", "o̧": "o", "Q̧": "Q", "q̧": "q", "U̧": "U", "u̧": "u", "X̧": "X", "x̧": "x", "Z̧": "Z", "z̧": "z", "й":"и", "Й":"И", "ё":"е", "Ё":"Е", }; var chars = Object.keys(characterMap).join('|'); var allAccents = new RegExp(chars, 'g'); var firstAccent = new RegExp(chars, ''); function matcher(match) { return characterMap[match]; } var removeAccents = function(string) { return string.replace(allAccents, matcher); }; var hasAccents = function(string) { return !!string.match(firstAccent); }; module.exports = removeAccents; module.exports.has = hasAccents; module.exports.remove = removeAccents; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { addQueryArgs: () => (/* reexport */ addQueryArgs), buildQueryString: () => (/* reexport */ buildQueryString), cleanForSlug: () => (/* reexport */ cleanForSlug), filterURLForDisplay: () => (/* reexport */ filterURLForDisplay), getAuthority: () => (/* reexport */ getAuthority), getFilename: () => (/* reexport */ getFilename), getFragment: () => (/* reexport */ getFragment), getPath: () => (/* reexport */ getPath), getPathAndQueryString: () => (/* reexport */ getPathAndQueryString), getProtocol: () => (/* reexport */ getProtocol), getQueryArg: () => (/* reexport */ getQueryArg), getQueryArgs: () => (/* reexport */ getQueryArgs), getQueryString: () => (/* reexport */ getQueryString), hasQueryArg: () => (/* reexport */ hasQueryArg), isEmail: () => (/* reexport */ isEmail), isPhoneNumber: () => (/* reexport */ isPhoneNumber), isURL: () => (/* reexport */ isURL), isValidAuthority: () => (/* reexport */ isValidAuthority), isValidFragment: () => (/* reexport */ isValidFragment), isValidPath: () => (/* reexport */ isValidPath), isValidProtocol: () => (/* reexport */ isValidProtocol), isValidQueryString: () => (/* reexport */ isValidQueryString), normalizePath: () => (/* reexport */ normalizePath), prependHTTP: () => (/* reexport */ prependHTTP), prependHTTPS: () => (/* reexport */ prependHTTPS), removeQueryArgs: () => (/* reexport */ removeQueryArgs), safeDecodeURI: () => (/* reexport */ safeDecodeURI), safeDecodeURIComponent: () => (/* reexport */ safeDecodeURIComponent) }); ;// ./node_modules/@wordpress/url/build-module/is-url.js /* wp:polyfill */ /** * Determines whether the given string looks like a URL. * * @param {string} url The string to scrutinise. * * @example * ```js * const isURL = isURL( 'https://wordpress.org' ); // true * ``` * * @see https://url.spec.whatwg.org/ * @see https://url.spec.whatwg.org/#valid-url-string * * @return {boolean} Whether or not it looks like a URL. */ function isURL(url) { // A URL can be considered value if the `URL` constructor is able to parse // it. The constructor throws an error for an invalid URL. try { new URL(url); return true; } catch { return false; } } ;// ./node_modules/@wordpress/url/build-module/is-email.js const EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i; /** * Determines whether the given string looks like an email. * * @param {string} email The string to scrutinise. * * @example * ```js * const isEmail = isEmail( 'hello@wordpress.org' ); // true * ``` * * @return {boolean} Whether or not it looks like an email. */ function isEmail(email) { return EMAIL_REGEXP.test(email); } ;// ./node_modules/@wordpress/url/build-module/is-phone-number.js const PHONE_REGEXP = /^(tel:)?(\+)?\d{6,15}$/; /** * Determines whether the given string looks like a phone number. * * @param {string} phoneNumber The string to scrutinize. * * @example * ```js * const isPhoneNumber = isPhoneNumber('+1 (555) 123-4567'); // true * ``` * * @return {boolean} Whether or not it looks like a phone number. */ function isPhoneNumber(phoneNumber) { // Remove any separator from phone number. phoneNumber = phoneNumber.replace(/[-.() ]/g, ''); return PHONE_REGEXP.test(phoneNumber); } ;// ./node_modules/@wordpress/url/build-module/get-protocol.js /** * Returns the protocol part of the URL. * * @param {string} url The full URL. * * @example * ```js * const protocol1 = getProtocol( 'tel:012345678' ); // 'tel:' * const protocol2 = getProtocol( 'https://wordpress.org' ); // 'https:' * ``` * * @return {string|void} The protocol part of the URL. */ function getProtocol(url) { const matches = /^([^\s:]+:)/.exec(url); if (matches) { return matches[1]; } } ;// ./node_modules/@wordpress/url/build-module/is-valid-protocol.js /** * Tests if a url protocol is valid. * * @param {string} protocol The url protocol. * * @example * ```js * const isValid = isValidProtocol( 'https:' ); // true * const isNotValid = isValidProtocol( 'https :' ); // false * ``` * * @return {boolean} True if the argument is a valid protocol (e.g. http:, tel:). */ function isValidProtocol(protocol) { if (!protocol) { return false; } return /^[a-z\-.\+]+[0-9]*:$/i.test(protocol); } ;// ./node_modules/@wordpress/url/build-module/get-authority.js /** * Returns the authority part of the URL. * * @param {string} url The full URL. * * @example * ```js * const authority1 = getAuthority( 'https://wordpress.org/help/' ); // 'wordpress.org' * const authority2 = getAuthority( 'https://localhost:8080/test/' ); // 'localhost:8080' * ``` * * @return {string|void} The authority part of the URL. */ function getAuthority(url) { const matches = /^[^\/\s:]+:(?:\/\/)?\/?([^\/\s#?]+)[\/#?]{0,1}\S*$/.exec(url); if (matches) { return matches[1]; } } ;// ./node_modules/@wordpress/url/build-module/is-valid-authority.js /** * Checks for invalid characters within the provided authority. * * @param {string} authority A string containing the URL authority. * * @example * ```js * const isValid = isValidAuthority( 'wordpress.org' ); // true * const isNotValid = isValidAuthority( 'wordpress#org' ); // false * ``` * * @return {boolean} True if the argument contains a valid authority. */ function isValidAuthority(authority) { if (!authority) { return false; } return /^[^\s#?]+$/.test(authority); } ;// ./node_modules/@wordpress/url/build-module/get-path.js /** * Returns the path part of the URL. * * @param {string} url The full URL. * * @example * ```js * const path1 = getPath( 'http://localhost:8080/this/is/a/test?query=true' ); // 'this/is/a/test' * const path2 = getPath( 'https://wordpress.org/help/faq/' ); // 'help/faq' * ``` * * @return {string|void} The path part of the URL. */ function getPath(url) { const matches = /^[^\/\s:]+:(?:\/\/)?[^\/\s#?]+[\/]([^\s#?]+)[#?]{0,1}\S*$/.exec(url); if (matches) { return matches[1]; } } ;// ./node_modules/@wordpress/url/build-module/is-valid-path.js /** * Checks for invalid characters within the provided path. * * @param {string} path The URL path. * * @example * ```js * const isValid = isValidPath( 'test/path/' ); // true * const isNotValid = isValidPath( '/invalid?test/path/' ); // false * ``` * * @return {boolean} True if the argument contains a valid path */ function isValidPath(path) { if (!path) { return false; } return /^[^\s#?]+$/.test(path); } ;// ./node_modules/@wordpress/url/build-module/get-query-string.js /* wp:polyfill */ /** * Returns the query string part of the URL. * * @param {string} url The full URL. * * @example * ```js * const queryString = getQueryString( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // 'query=true' * ``` * * @return {string|void} The query string part of the URL. */ function getQueryString(url) { let query; try { query = new URL(url, 'http://example.com').search.substring(1); } catch (error) {} if (query) { return query; } } ;// ./node_modules/@wordpress/url/build-module/build-query-string.js /** * Generates URL-encoded query string using input query data. * * It is intended to behave equivalent as PHP's `http_build_query`, configured * with encoding type PHP_QUERY_RFC3986 (spaces as `%20`). * * @example * ```js * const queryString = buildQueryString( { * simple: 'is ok', * arrays: [ 'are', 'fine', 'too' ], * objects: { * evenNested: { * ok: 'yes', * }, * }, * } ); * // "simple=is%20ok&arrays%5B0%5D=are&arrays%5B1%5D=fine&arrays%5B2%5D=too&objects%5BevenNested%5D%5Bok%5D=yes" * ``` * * @param {Record} data Data to encode. * * @return {string} Query string. */ function buildQueryString(data) { let string = ''; const stack = Object.entries(data); let pair; while (pair = stack.shift()) { let [key, value] = pair; // Support building deeply nested data, from array or object values. const hasNestedData = Array.isArray(value) || value && value.constructor === Object; if (hasNestedData) { // Push array or object values onto the stack as composed of their // original key and nested index or key, retaining order by a // combination of Array#reverse and Array#unshift onto the stack. const valuePairs = Object.entries(value).reverse(); for (const [member, memberValue] of valuePairs) { stack.unshift([`${key}[${member}]`, memberValue]); } } else if (value !== undefined) { // Null is treated as special case, equivalent to empty string. if (value === null) { value = ''; } string += '&' + [key, value].map(encodeURIComponent).join('='); } } // Loop will concatenate with leading `&`, but it's only expected for all // but the first query parameter. This strips the leading `&`, while still // accounting for the case that the string may in-fact be empty. return string.substr(1); } ;// ./node_modules/@wordpress/url/build-module/is-valid-query-string.js /** * Checks for invalid characters within the provided query string. * * @param {string} queryString The query string. * * @example * ```js * const isValid = isValidQueryString( 'query=true&another=false' ); // true * const isNotValid = isValidQueryString( 'query=true?another=false' ); // false * ``` * * @return {boolean} True if the argument contains a valid query string. */ function isValidQueryString(queryString) { if (!queryString) { return false; } return /^[^\s#?\/]+$/.test(queryString); } ;// ./node_modules/@wordpress/url/build-module/get-path-and-query-string.js /** * Internal dependencies */ /** * Returns the path part and query string part of the URL. * * @param {string} url The full URL. * * @example * ```js * const pathAndQueryString1 = getPathAndQueryString( 'http://localhost:8080/this/is/a/test?query=true' ); // '/this/is/a/test?query=true' * const pathAndQueryString2 = getPathAndQueryString( 'https://wordpress.org/help/faq/' ); // '/help/faq' * ``` * * @return {string} The path part and query string part of the URL. */ function getPathAndQueryString(url) { const path = getPath(url); const queryString = getQueryString(url); let value = '/'; if (path) { value += path; } if (queryString) { value += `?${queryString}`; } return value; } ;// ./node_modules/@wordpress/url/build-module/get-fragment.js /** * Returns the fragment part of the URL. * * @param {string} url The full URL * * @example * ```js * const fragment1 = getFragment( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // '#fragment' * const fragment2 = getFragment( 'https://wordpress.org#another-fragment?query=true' ); // '#another-fragment' * ``` * * @return {string|void} The fragment part of the URL. */ function getFragment(url) { const matches = /^\S+?(#[^\s\?]*)/.exec(url); if (matches) { return matches[1]; } } ;// ./node_modules/@wordpress/url/build-module/is-valid-fragment.js /** * Checks for invalid characters within the provided fragment. * * @param {string} fragment The url fragment. * * @example * ```js * const isValid = isValidFragment( '#valid-fragment' ); // true * const isNotValid = isValidFragment( '#invalid-#fragment' ); // false * ``` * * @return {boolean} True if the argument contains a valid fragment. */ function isValidFragment(fragment) { if (!fragment) { return false; } return /^#[^\s#?\/]*$/.test(fragment); } ;// ./node_modules/@wordpress/url/build-module/safe-decode-uri-component.js /** * Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if * `decodeURIComponent` throws an error. * * @param {string} uriComponent URI component to decode. * * @return {string} Decoded URI component if possible. */ function safeDecodeURIComponent(uriComponent) { try { return decodeURIComponent(uriComponent); } catch (uriComponentError) { return uriComponent; } } ;// ./node_modules/@wordpress/url/build-module/get-query-args.js /** * Internal dependencies */ /** @typedef {import('./get-query-arg').QueryArgParsed} QueryArgParsed */ /** * @typedef {Record} QueryArgs */ /** * Sets a value in object deeply by a given array of path segments. Mutates the * object reference. * * @param {Record} object Object in which to assign. * @param {string[]} path Path segment at which to set value. * @param {*} value Value to set. */ function setPath(object, path, value) { const length = path.length; const lastIndex = length - 1; for (let i = 0; i < length; i++) { let key = path[i]; if (!key && Array.isArray(object)) { // If key is empty string and next value is array, derive key from // the current length of the array. key = object.length.toString(); } key = ['__proto__', 'constructor', 'prototype'].includes(key) ? key.toUpperCase() : key; // If the next key in the path is numeric (or empty string), it will be // created as an array. Otherwise, it will be created as an object. const isNextKeyArrayIndex = !isNaN(Number(path[i + 1])); object[key] = i === lastIndex ? // If at end of path, assign the intended value. value : // Otherwise, advance to the next object in the path, creating // it if it does not yet exist. object[key] || (isNextKeyArrayIndex ? [] : {}); if (Array.isArray(object[key]) && !isNextKeyArrayIndex) { // If we current key is non-numeric, but the next value is an // array, coerce the value to an object. object[key] = { ...object[key] }; } // Update working reference object to the next in the path. object = object[key]; } } /** * Returns an object of query arguments of the given URL. If the given URL is * invalid or has no querystring, an empty object is returned. * * @param {string} url URL. * * @example * ```js * const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' ); * // { "foo": "bar", "bar": "baz" } * ``` * * @return {QueryArgs} Query args object. */ function getQueryArgs(url) { return (getQueryString(url) || '' // Normalize space encoding, accounting for PHP URL encoding // corresponding to `application/x-www-form-urlencoded`. // // See: https://tools.ietf.org/html/rfc1866#section-8.2.1 ).replace(/\+/g, '%20').split('&').reduce((accumulator, keyValue) => { const [key, value = ''] = keyValue.split('=') // Filtering avoids decoding as `undefined` for value, where // default is restored in destructuring assignment. .filter(Boolean).map(safeDecodeURIComponent); if (key) { const segments = key.replace(/\]/g, '').split('['); setPath(accumulator, segments, value); } return accumulator; }, Object.create(null)); } ;// ./node_modules/@wordpress/url/build-module/add-query-args.js /** * Internal dependencies */ /** * Appends arguments as querystring to the provided URL. If the URL already * includes query arguments, the arguments are merged with (and take precedent * over) the existing set. * * @param {string} [url=''] URL to which arguments should be appended. If omitted, * only the resulting querystring is returned. * @param {Object} [args] Query arguments to apply to URL. * * @example * ```js * const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://google.com/?q=test * ``` * * @return {string} URL with arguments applied. */ function addQueryArgs(url = '', args) { // If no arguments are to be appended, return original URL. if (!args || !Object.keys(args).length) { return url; } const fragment = getFragment(url) || ''; let baseUrl = url.replace(fragment, ''); // Determine whether URL already had query arguments. const queryStringIndex = url.indexOf('?'); if (queryStringIndex !== -1) { // Merge into existing query arguments. args = Object.assign(getQueryArgs(url), args); // Change working base URL to omit previous query arguments. baseUrl = baseUrl.substr(0, queryStringIndex); } return baseUrl + '?' + buildQueryString(args) + fragment; } ;// ./node_modules/@wordpress/url/build-module/get-query-arg.js /** * Internal dependencies */ /** * @typedef {{[key: string]: QueryArgParsed}} QueryArgObject */ /** * @typedef {string|string[]|QueryArgObject} QueryArgParsed */ /** * Returns a single query argument of the url * * @param {string} url URL. * @param {string} arg Query arg name. * * @example * ```js * const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar * ``` * * @return {QueryArgParsed|void} Query arg value. */ function getQueryArg(url, arg) { return getQueryArgs(url)[arg]; } ;// ./node_modules/@wordpress/url/build-module/has-query-arg.js /** * Internal dependencies */ /** * Determines whether the URL contains a given query arg. * * @param {string} url URL. * @param {string} arg Query arg name. * * @example * ```js * const hasBar = hasQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'bar' ); // true * ``` * * @return {boolean} Whether or not the URL contains the query arg. */ function hasQueryArg(url, arg) { return getQueryArg(url, arg) !== undefined; } ;// ./node_modules/@wordpress/url/build-module/remove-query-args.js /** * Internal dependencies */ /** * Removes arguments from the query string of the url * * @param {string} url URL. * @param {...string} args Query Args. * * @example * ```js * const newUrl = removeQueryArgs( 'https://wordpress.org?foo=bar&bar=baz&baz=foobar', 'foo', 'bar' ); // https://wordpress.org?baz=foobar * ``` * * @return {string} Updated URL. */ function removeQueryArgs(url, ...args) { const fragment = url.replace(/^[^#]*/, ''); url = url.replace(/#.*/, ''); const queryStringIndex = url.indexOf('?'); if (queryStringIndex === -1) { return url + fragment; } const query = getQueryArgs(url); const baseURL = url.substr(0, queryStringIndex); args.forEach(arg => delete query[arg]); const queryString = buildQueryString(query); const updatedUrl = queryString ? baseURL + '?' + queryString : baseURL; return updatedUrl + fragment; } ;// ./node_modules/@wordpress/url/build-module/prepend-http.js /** * Internal dependencies */ const USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i; /** * Prepends "http://" to a url, if it looks like something that is meant to be a TLD. * * @param {string} url The URL to test. * * @example * ```js * const actualURL = prependHTTP( 'wordpress.org' ); // http://wordpress.org * ``` * * @return {string} The updated URL. */ function prependHTTP(url) { if (!url) { return url; } url = url.trim(); if (!USABLE_HREF_REGEXP.test(url) && !isEmail(url)) { return 'http://' + url; } return url; } ;// ./node_modules/@wordpress/url/build-module/safe-decode-uri.js /** * Safely decodes a URI with `decodeURI`. Returns the URI unmodified if * `decodeURI` throws an error. * * @param {string} uri URI to decode. * * @example * ```js * const badUri = safeDecodeURI( '%z' ); // does not throw an Error, simply returns '%z' * ``` * * @return {string} Decoded URI if possible. */ function safeDecodeURI(uri) { try { return decodeURI(uri); } catch (uriError) { return uri; } } ;// ./node_modules/@wordpress/url/build-module/filter-url-for-display.js /** * Returns a URL for display. * * @param {string} url Original URL. * @param {number|null} maxLength URL length. * * @example * ```js * const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg * const imageUrl = filterURLForDisplay( 'https://www.wordpress.org/wp-content/uploads/img.png', 20 ); // …ent/uploads/img.png * ``` * * @return {string} Displayed URL. */ function filterURLForDisplay(url, maxLength = null) { if (!url) { return ''; } // Remove protocol and www prefixes. let filteredURL = url.replace(/^[a-z\-.\+]+[0-9]*:(\/\/)?/i, '').replace(/^www\./i, ''); // Ends with / and only has that single slash, strip it. if (filteredURL.match(/^[^\/]+\/$/)) { filteredURL = filteredURL.replace('/', ''); } // capture file name from URL const fileRegexp = /\/([^\/?]+)\.(?:[\w]+)(?=\?|$)/; if (!maxLength || filteredURL.length <= maxLength || !filteredURL.match(fileRegexp)) { return filteredURL; } // If the file is not greater than max length, return last portion of URL. filteredURL = filteredURL.split('?')[0]; const urlPieces = filteredURL.split('/'); const file = urlPieces[urlPieces.length - 1]; if (file.length <= maxLength) { return '…' + filteredURL.slice(-maxLength); } // If the file is greater than max length, truncate the file. const index = file.lastIndexOf('.'); const [fileName, extension] = [file.slice(0, index), file.slice(index + 1)]; const truncatedFile = fileName.slice(-3) + '.' + extension; return file.slice(0, maxLength - truncatedFile.length - 1) + '…' + truncatedFile; } // EXTERNAL MODULE: ./node_modules/remove-accents/index.js var remove_accents = __webpack_require__(9681); var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); ;// ./node_modules/@wordpress/url/build-module/clean-for-slug.js /** * External dependencies */ /** * Performs some basic cleanup of a string for use as a post slug. * * This replicates some of what `sanitize_title()` does in WordPress core, but * is only designed to approximate what the slug will be. * * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin * letters. Removes combining diacritical marks. Converts whitespace, periods, * and forward slashes to hyphens. Removes any remaining non-word characters * except hyphens. Converts remaining string to lowercase. It does not account * for octets, HTML entities, or other encoded characters. * * @param {string} string Title or slug to be processed. * * @return {string} Processed string. */ function cleanForSlug(string) { if (!string) { return ''; } return remove_accents_default()(string) // Convert each group of whitespace, periods, and forward slashes to a hyphen. .replace(/[\s\./]+/g, '-') // Remove anything that's not a letter, number, underscore or hyphen. .replace(/[^\p{L}\p{N}_-]+/gu, '') // Convert to lowercase .toLowerCase() // Replace multiple hyphens with a single one. .replace(/-+/g, '-') // Remove any remaining leading or trailing hyphens. .replace(/(^-+)|(-+$)/g, ''); } ;// ./node_modules/@wordpress/url/build-module/get-filename.js /* wp:polyfill */ /** * Returns the filename part of the URL. * * @param {string} url The full URL. * * @example * ```js * const filename1 = getFilename( 'http://localhost:8080/this/is/a/test.jpg' ); // 'test.jpg' * const filename2 = getFilename( '/this/is/a/test.png' ); // 'test.png' * ``` * * @return {string|void} The filename part of the URL. */ function getFilename(url) { let filename; if (!url) { return; } try { filename = new URL(url, 'http://example.com').pathname.split('/').pop(); } catch (error) {} if (filename) { return filename; } } ;// ./node_modules/@wordpress/url/build-module/normalize-path.js /** * Given a path, returns a normalized path where equal query parameter values * will be treated as identical, regardless of order they appear in the original * text. * * @param {string} path Original path. * * @return {string} Normalized path. */ function normalizePath(path) { const split = path.split('?'); const query = split[1]; const base = split[0]; if (!query) { return base; } // 'b=1%2C2&c=2&a=5' return base + '?' + query // [ 'b=1%2C2', 'c=2', 'a=5' ] .split('&') // [ [ 'b, '1%2C2' ], [ 'c', '2' ], [ 'a', '5' ] ] .map(entry => entry.split('=')) // [ [ 'b', '1,2' ], [ 'c', '2' ], [ 'a', '5' ] ] .map(pair => pair.map(decodeURIComponent)) // [ [ 'a', '5' ], [ 'b, '1,2' ], [ 'c', '2' ] ] .sort((a, b) => a[0].localeCompare(b[0])) // [ [ 'a', '5' ], [ 'b, '1%2C2' ], [ 'c', '2' ] ] .map(pair => pair.map(encodeURIComponent)) // [ 'a=5', 'b=1%2C2', 'c=2' ] .map(pair => pair.join('=')) // 'a=5&b=1%2C2&c=2' .join('&'); } ;// ./node_modules/@wordpress/url/build-module/prepend-https.js /** * Internal dependencies */ /** * Prepends "https://" to a url, if it looks like something that is meant to be a TLD. * * Note: this will not replace "http://" with "https://". * * @param {string} url The URL to test. * * @example * ```js * const actualURL = prependHTTPS( 'wordpress.org' ); // https://wordpress.org * ``` * * @return {string} The updated URL. */ function prependHTTPS(url) { if (!url) { return url; } // If url starts with http://, return it as is. if (url.startsWith('http://')) { return url; } url = prependHTTP(url); return url.replace(/^http:/, 'https:'); } ;// ./node_modules/@wordpress/url/build-module/index.js })(); (window.wp = window.wp || {}).url = __webpack_exports__; /******/ })() ;PK{MZ}+ll compose.jsnu[/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 1933: /***/ ((module, exports, __webpack_require__) => { var __WEBPACK_AMD_DEFINE_RESULT__;/*global define:false */ /** * Copyright 2012-2017 Craig Campbell * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Mousetrap is a simple keyboard shortcut library for Javascript with * no external dependencies * * @version 1.6.5 * @url craig.is/killing/mice */ (function(window, document, undefined) { // Check if mousetrap is used inside browser, if not, return if (!window) { return; } /** * mapping of special keycodes to their corresponding keys * * everything in this dictionary cannot use keypress events * so it has to be here to map to the correct keycodes for * keyup/keydown events * * @type {Object} */ var _MAP = { 8: 'backspace', 9: 'tab', 13: 'enter', 16: 'shift', 17: 'ctrl', 18: 'alt', 20: 'capslock', 27: 'esc', 32: 'space', 33: 'pageup', 34: 'pagedown', 35: 'end', 36: 'home', 37: 'left', 38: 'up', 39: 'right', 40: 'down', 45: 'ins', 46: 'del', 91: 'meta', 93: 'meta', 224: 'meta' }; /** * mapping for special characters so they can support * * this dictionary is only used incase you want to bind a * keyup or keydown event to one of these keys * * @type {Object} */ var _KEYCODE_MAP = { 106: '*', 107: '+', 109: '-', 110: '.', 111 : '/', 186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\', 221: ']', 222: '\'' }; /** * this is a mapping of keys that require shift on a US keypad * back to the non shift equivelents * * this is so you can use keyup events with these keys * * note that this will only work reliably on US keyboards * * @type {Object} */ var _SHIFT_MAP = { '~': '`', '!': '1', '@': '2', '#': '3', '$': '4', '%': '5', '^': '6', '&': '7', '*': '8', '(': '9', ')': '0', '_': '-', '+': '=', ':': ';', '\"': '\'', '<': ',', '>': '.', '?': '/', '|': '\\' }; /** * this is a list of special strings you can use to map * to modifier keys when you specify your keyboard shortcuts * * @type {Object} */ var _SPECIAL_ALIASES = { 'option': 'alt', 'command': 'meta', 'return': 'enter', 'escape': 'esc', 'plus': '+', 'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl' }; /** * variable to store the flipped version of _MAP from above * needed to check if we should use keypress or not when no action * is specified * * @type {Object|undefined} */ var _REVERSE_MAP; /** * loop through the f keys, f1 to f19 and add them to the map * programatically */ for (var i = 1; i < 20; ++i) { _MAP[111 + i] = 'f' + i; } /** * loop through to map numbers on the numeric keypad */ for (i = 0; i <= 9; ++i) { // This needs to use a string cause otherwise since 0 is falsey // mousetrap will never fire for numpad 0 pressed as part of a keydown // event. // // @see https://github.com/ccampbell/mousetrap/pull/258 _MAP[i + 96] = i.toString(); } /** * cross browser add event method * * @param {Element|HTMLDocument} object * @param {string} type * @param {Function} callback * @returns void */ function _addEvent(object, type, callback) { if (object.addEventListener) { object.addEventListener(type, callback, false); return; } object.attachEvent('on' + type, callback); } /** * takes the event and returns the key character * * @param {Event} e * @return {string} */ function _characterFromEvent(e) { // for keypress events we should return the character as is if (e.type == 'keypress') { var character = String.fromCharCode(e.which); // if the shift key is not pressed then it is safe to assume // that we want the character to be lowercase. this means if // you accidentally have caps lock on then your key bindings // will continue to work // // the only side effect that might not be desired is if you // bind something like 'A' cause you want to trigger an // event when capital A is pressed caps lock will no longer // trigger the event. shift+a will though. if (!e.shiftKey) { character = character.toLowerCase(); } return character; } // for non keypress events the special maps are needed if (_MAP[e.which]) { return _MAP[e.which]; } if (_KEYCODE_MAP[e.which]) { return _KEYCODE_MAP[e.which]; } // if it is not in the special map // with keydown and keyup events the character seems to always // come in as an uppercase character whether you are pressing shift // or not. we should make sure it is always lowercase for comparisons return String.fromCharCode(e.which).toLowerCase(); } /** * checks if two arrays are equal * * @param {Array} modifiers1 * @param {Array} modifiers2 * @returns {boolean} */ function _modifiersMatch(modifiers1, modifiers2) { return modifiers1.sort().join(',') === modifiers2.sort().join(','); } /** * takes a key event and figures out what the modifiers are * * @param {Event} e * @returns {Array} */ function _eventModifiers(e) { var modifiers = []; if (e.shiftKey) { modifiers.push('shift'); } if (e.altKey) { modifiers.push('alt'); } if (e.ctrlKey) { modifiers.push('ctrl'); } if (e.metaKey) { modifiers.push('meta'); } return modifiers; } /** * prevents default for this event * * @param {Event} e * @returns void */ function _preventDefault(e) { if (e.preventDefault) { e.preventDefault(); return; } e.returnValue = false; } /** * stops propogation for this event * * @param {Event} e * @returns void */ function _stopPropagation(e) { if (e.stopPropagation) { e.stopPropagation(); return; } e.cancelBubble = true; } /** * determines if the keycode specified is a modifier key or not * * @param {string} key * @returns {boolean} */ function _isModifier(key) { return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta'; } /** * reverses the map lookup so that we can look for specific keys * to see what can and can't use keypress * * @return {Object} */ function _getReverseMap() { if (!_REVERSE_MAP) { _REVERSE_MAP = {}; for (var key in _MAP) { // pull out the numeric keypad from here cause keypress should // be able to detect the keys from the character if (key > 95 && key < 112) { continue; } if (_MAP.hasOwnProperty(key)) { _REVERSE_MAP[_MAP[key]] = key; } } } return _REVERSE_MAP; } /** * picks the best action based on the key combination * * @param {string} key - character for key * @param {Array} modifiers * @param {string=} action passed in */ function _pickBestAction(key, modifiers, action) { // if no action was picked in we should try to pick the one // that we think would work best for this key if (!action) { action = _getReverseMap()[key] ? 'keydown' : 'keypress'; } // modifier keys don't work as expected with keypress, // switch to keydown if (action == 'keypress' && modifiers.length) { action = 'keydown'; } return action; } /** * Converts from a string key combination to an array * * @param {string} combination like "command+shift+l" * @return {Array} */ function _keysFromString(combination) { if (combination === '+') { return ['+']; } combination = combination.replace(/\+{2}/g, '+plus'); return combination.split('+'); } /** * Gets info for a specific key combination * * @param {string} combination key combination ("command+s" or "a" or "*") * @param {string=} action * @returns {Object} */ function _getKeyInfo(combination, action) { var keys; var key; var i; var modifiers = []; // take the keys from this pattern and figure out what the actual // pattern is all about keys = _keysFromString(combination); for (i = 0; i < keys.length; ++i) { key = keys[i]; // normalize key names if (_SPECIAL_ALIASES[key]) { key = _SPECIAL_ALIASES[key]; } // if this is not a keypress event then we should // be smart about using shift keys // this will only work for US keyboards however if (action && action != 'keypress' && _SHIFT_MAP[key]) { key = _SHIFT_MAP[key]; modifiers.push('shift'); } // if this key is a modifier then add it to the list of modifiers if (_isModifier(key)) { modifiers.push(key); } } // depending on what the key combination is // we will try to pick the best event for it action = _pickBestAction(key, modifiers, action); return { key: key, modifiers: modifiers, action: action }; } function _belongsTo(element, ancestor) { if (element === null || element === document) { return false; } if (element === ancestor) { return true; } return _belongsTo(element.parentNode, ancestor); } function Mousetrap(targetElement) { var self = this; targetElement = targetElement || document; if (!(self instanceof Mousetrap)) { return new Mousetrap(targetElement); } /** * element to attach key events to * * @type {Element} */ self.target = targetElement; /** * a list of all the callbacks setup via Mousetrap.bind() * * @type {Object} */ self._callbacks = {}; /** * direct map of string combinations to callbacks used for trigger() * * @type {Object} */ self._directMap = {}; /** * keeps track of what level each sequence is at since multiple * sequences can start out with the same sequence * * @type {Object} */ var _sequenceLevels = {}; /** * variable to store the setTimeout call * * @type {null|number} */ var _resetTimer; /** * temporary state where we will ignore the next keyup * * @type {boolean|string} */ var _ignoreNextKeyup = false; /** * temporary state where we will ignore the next keypress * * @type {boolean} */ var _ignoreNextKeypress = false; /** * are we currently inside of a sequence? * type of action ("keyup" or "keydown" or "keypress") or false * * @type {boolean|string} */ var _nextExpectedAction = false; /** * resets all sequence counters except for the ones passed in * * @param {Object} doNotReset * @returns void */ function _resetSequences(doNotReset) { doNotReset = doNotReset || {}; var activeSequences = false, key; for (key in _sequenceLevels) { if (doNotReset[key]) { activeSequences = true; continue; } _sequenceLevels[key] = 0; } if (!activeSequences) { _nextExpectedAction = false; } } /** * finds all callbacks that match based on the keycode, modifiers, * and action * * @param {string} character * @param {Array} modifiers * @param {Event|Object} e * @param {string=} sequenceName - name of the sequence we are looking for * @param {string=} combination * @param {number=} level * @returns {Array} */ function _getMatches(character, modifiers, e, sequenceName, combination, level) { var i; var callback; var matches = []; var action = e.type; // if there are no events related to this keycode if (!self._callbacks[character]) { return []; } // if a modifier key is coming up on its own we should allow it if (action == 'keyup' && _isModifier(character)) { modifiers = [character]; } // loop through all callbacks for the key that was pressed // and see if any of them match for (i = 0; i < self._callbacks[character].length; ++i) { callback = self._callbacks[character][i]; // if a sequence name is not specified, but this is a sequence at // the wrong level then move onto the next match if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) { continue; } // if the action we are looking for doesn't match the action we got // then we should keep going if (action != callback.action) { continue; } // if this is a keypress event and the meta key and control key // are not pressed that means that we need to only look at the // character, otherwise check the modifiers as well // // chrome will not fire a keypress if meta or control is down // safari will fire a keypress if meta or meta+shift is down // firefox will fire a keypress if meta or control is down if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) { // when you bind a combination or sequence a second time it // should overwrite the first one. if a sequenceName or // combination is specified in this call it does just that // // @todo make deleting its own method? var deleteCombo = !sequenceName && callback.combo == combination; var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level; if (deleteCombo || deleteSequence) { self._callbacks[character].splice(i, 1); } matches.push(callback); } } return matches; } /** * actually calls the callback function * * if your callback function returns false this will use the jquery * convention - prevent default and stop propogation on the event * * @param {Function} callback * @param {Event} e * @returns void */ function _fireCallback(callback, e, combo, sequence) { // if this event should not happen stop here if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) { return; } if (callback(e, combo) === false) { _preventDefault(e); _stopPropagation(e); } } /** * handles a character key event * * @param {string} character * @param {Array} modifiers * @param {Event} e * @returns void */ self._handleKey = function(character, modifiers, e) { var callbacks = _getMatches(character, modifiers, e); var i; var doNotReset = {}; var maxLevel = 0; var processedSequenceCallback = false; // Calculate the maxLevel for sequences so we can only execute the longest callback sequence for (i = 0; i < callbacks.length; ++i) { if (callbacks[i].seq) { maxLevel = Math.max(maxLevel, callbacks[i].level); } } // loop through matching callbacks for this key event for (i = 0; i < callbacks.length; ++i) { // fire for all sequence callbacks // this is because if for example you have multiple sequences // bound such as "g i" and "g t" they both need to fire the // callback for matching g cause otherwise you can only ever // match the first one if (callbacks[i].seq) { // only fire callbacks for the maxLevel to prevent // subsequences from also firing // // for example 'a option b' should not cause 'option b' to fire // even though 'option b' is part of the other sequence // // any sequences that do not match here will be discarded // below by the _resetSequences call if (callbacks[i].level != maxLevel) { continue; } processedSequenceCallback = true; // keep a list of which sequences were matches for later doNotReset[callbacks[i].seq] = 1; _fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq); continue; } // if there were no sequence matches but we are still here // that means this is a regular match so we should fire that if (!processedSequenceCallback) { _fireCallback(callbacks[i].callback, e, callbacks[i].combo); } } // if the key you pressed matches the type of sequence without // being a modifier (ie "keyup" or "keypress") then we should // reset all sequences that were not matched by this event // // this is so, for example, if you have the sequence "h a t" and you // type "h e a r t" it does not match. in this case the "e" will // cause the sequence to reset // // modifier keys are ignored because you can have a sequence // that contains modifiers such as "enter ctrl+space" and in most // cases the modifier key will be pressed before the next key // // also if you have a sequence such as "ctrl+b a" then pressing the // "b" key will trigger a "keypress" and a "keydown" // // the "keydown" is expected when there is a modifier, but the // "keypress" ends up matching the _nextExpectedAction since it occurs // after and that causes the sequence to reset // // we ignore keypresses in a sequence that directly follow a keydown // for the same character var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress; if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) { _resetSequences(doNotReset); } _ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown'; }; /** * handles a keydown event * * @param {Event} e * @returns void */ function _handleKeyEvent(e) { // normalize e.which for key events // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion if (typeof e.which !== 'number') { e.which = e.keyCode; } var character = _characterFromEvent(e); // no character found then stop if (!character) { return; } // need to use === for the character check because the character can be 0 if (e.type == 'keyup' && _ignoreNextKeyup === character) { _ignoreNextKeyup = false; return; } self.handleKey(character, _eventModifiers(e), e); } /** * called to set a 1 second timeout on the specified sequence * * this is so after each key press in the sequence you have 1 second * to press the next key before you have to start over * * @returns void */ function _resetSequenceTimer() { clearTimeout(_resetTimer); _resetTimer = setTimeout(_resetSequences, 1000); } /** * binds a key sequence to an event * * @param {string} combo - combo specified in bind call * @param {Array} keys * @param {Function} callback * @param {string=} action * @returns void */ function _bindSequence(combo, keys, callback, action) { // start off by adding a sequence level record for this combination // and setting the level to 0 _sequenceLevels[combo] = 0; /** * callback to increase the sequence level for this sequence and reset * all other sequences that were active * * @param {string} nextAction * @returns {Function} */ function _increaseSequence(nextAction) { return function() { _nextExpectedAction = nextAction; ++_sequenceLevels[combo]; _resetSequenceTimer(); }; } /** * wraps the specified callback inside of another function in order * to reset all sequence counters as soon as this sequence is done * * @param {Event} e * @returns void */ function _callbackAndReset(e) { _fireCallback(callback, e, combo); // we should ignore the next key up if the action is key down // or keypress. this is so if you finish a sequence and // release the key the final key will not trigger a keyup if (action !== 'keyup') { _ignoreNextKeyup = _characterFromEvent(e); } // weird race condition if a sequence ends with the key // another sequence begins with setTimeout(_resetSequences, 10); } // loop through keys one at a time and bind the appropriate callback // function. for any key leading up to the final one it should // increase the sequence. after the final, it should reset all sequences // // if an action is specified in the original bind call then that will // be used throughout. otherwise we will pass the action that the // next key in the sequence should match. this allows a sequence // to mix and match keypress and keydown events depending on which // ones are better suited to the key provided for (var i = 0; i < keys.length; ++i) { var isFinal = i + 1 === keys.length; var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action); _bindSingle(keys[i], wrappedCallback, action, combo, i); } } /** * binds a single keyboard combination * * @param {string} combination * @param {Function} callback * @param {string=} action * @param {string=} sequenceName - name of sequence if part of sequence * @param {number=} level - what part of the sequence the command is * @returns void */ function _bindSingle(combination, callback, action, sequenceName, level) { // store a direct mapped reference for use with Mousetrap.trigger self._directMap[combination + ':' + action] = callback; // make sure multiple spaces in a row become a single space combination = combination.replace(/\s+/g, ' '); var sequence = combination.split(' '); var info; // if this pattern is a sequence of keys then run through this method // to reprocess each pattern one key at a time if (sequence.length > 1) { _bindSequence(combination, sequence, callback, action); return; } info = _getKeyInfo(combination, action); // make sure to initialize array if this is the first time // a callback is added for this key self._callbacks[info.key] = self._callbacks[info.key] || []; // remove an existing match if there is one _getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level); // add this call back to the array // if it is a sequence put it at the beginning // if not put it at the end // // this is important because the way these are processed expects // the sequence ones to come first self._callbacks[info.key][sequenceName ? 'unshift' : 'push']({ callback: callback, modifiers: info.modifiers, action: info.action, seq: sequenceName, level: level, combo: combination }); } /** * binds multiple combinations to the same callback * * @param {Array} combinations * @param {Function} callback * @param {string|undefined} action * @returns void */ self._bindMultiple = function(combinations, callback, action) { for (var i = 0; i < combinations.length; ++i) { _bindSingle(combinations[i], callback, action); } }; // start! _addEvent(targetElement, 'keypress', _handleKeyEvent); _addEvent(targetElement, 'keydown', _handleKeyEvent); _addEvent(targetElement, 'keyup', _handleKeyEvent); } /** * binds an event to mousetrap * * can be a single key, a combination of keys separated with +, * an array of keys, or a sequence of keys separated by spaces * * be sure to list the modifier keys first to make sure that the * correct key ends up getting bound (the last key in the pattern) * * @param {string|Array} keys * @param {Function} callback * @param {string=} action - 'keypress', 'keydown', or 'keyup' * @returns void */ Mousetrap.prototype.bind = function(keys, callback, action) { var self = this; keys = keys instanceof Array ? keys : [keys]; self._bindMultiple.call(self, keys, callback, action); return self; }; /** * unbinds an event to mousetrap * * the unbinding sets the callback function of the specified key combo * to an empty function and deletes the corresponding key in the * _directMap dict. * * TODO: actually remove this from the _callbacks dictionary instead * of binding an empty function * * the keycombo+action has to be exactly the same as * it was defined in the bind method * * @param {string|Array} keys * @param {string} action * @returns void */ Mousetrap.prototype.unbind = function(keys, action) { var self = this; return self.bind.call(self, keys, function() {}, action); }; /** * triggers an event that has already been bound * * @param {string} keys * @param {string=} action * @returns void */ Mousetrap.prototype.trigger = function(keys, action) { var self = this; if (self._directMap[keys + ':' + action]) { self._directMap[keys + ':' + action]({}, keys); } return self; }; /** * resets the library back to its initial state. this is useful * if you want to clear out the current keyboard shortcuts and bind * new ones - for example if you switch to another page * * @returns void */ Mousetrap.prototype.reset = function() { var self = this; self._callbacks = {}; self._directMap = {}; return self; }; /** * should we stop this event before firing off callbacks * * @param {Event} e * @param {Element} element * @return {boolean} */ Mousetrap.prototype.stopCallback = function(e, element) { var self = this; // if the element has the class "mousetrap" then no need to stop if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) { return false; } if (_belongsTo(element, self.target)) { return false; } // Events originating from a shadow DOM are re-targetted and `e.target` is the shadow host, // not the initial event target in the shadow tree. Note that not all events cross the // shadow boundary. // For shadow trees with `mode: 'open'`, the initial event target is the first element in // the event’s composed path. For shadow trees with `mode: 'closed'`, the initial event // target cannot be obtained. if ('composedPath' in e && typeof e.composedPath === 'function') { // For open shadow trees, update `element` so that the following check works. var initialEventTarget = e.composedPath()[0]; if (initialEventTarget !== e.target) { element = initialEventTarget; } } // stop for input, select, and textarea return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable; }; /** * exposes _handleKey publicly so it can be overwritten by extensions */ Mousetrap.prototype.handleKey = function() { var self = this; return self._handleKey.apply(self, arguments); }; /** * allow custom key mappings */ Mousetrap.addKeycodes = function(object) { for (var key in object) { if (object.hasOwnProperty(key)) { _MAP[key] = object[key]; } } _REVERSE_MAP = null; }; /** * Init the global mousetrap functions * * This method is needed to allow the global mousetrap functions to work * now that mousetrap is a constructor function. */ Mousetrap.init = function() { var documentMousetrap = Mousetrap(document); for (var method in documentMousetrap) { if (method.charAt(0) !== '_') { Mousetrap[method] = (function(method) { return function() { return documentMousetrap[method].apply(documentMousetrap, arguments); }; } (method)); } } }; Mousetrap.init(); // expose mousetrap to the global object window.Mousetrap = Mousetrap; // expose as a common js module if ( true && module.exports) { module.exports = Mousetrap; } // expose mousetrap as an AMD module if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return Mousetrap; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } }) (typeof window !== 'undefined' ? window : null, typeof window !== 'undefined' ? document : null); /***/ }), /***/ 3758: /***/ (function(module) { /*! * clipboard.js v2.0.11 * https://clipboardjs.com/ * * Licensed MIT © Zeno Rocha */ (function webpackUniversalModuleDefinition(root, factory) { if(true) module.exports = factory(); else {} })(this, function() { return /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 686: /***/ (function(__unused_webpack_module, __nested_webpack_exports__, __nested_webpack_require_623__) { "use strict"; // EXPORTS __nested_webpack_require_623__.d(__nested_webpack_exports__, { "default": function() { return /* binding */ clipboard; } }); // EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js var tiny_emitter = __nested_webpack_require_623__(279); var tiny_emitter_default = /*#__PURE__*/__nested_webpack_require_623__.n(tiny_emitter); // EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js var listen = __nested_webpack_require_623__(370); var listen_default = /*#__PURE__*/__nested_webpack_require_623__.n(listen); // EXTERNAL MODULE: ./node_modules/select/src/select.js var src_select = __nested_webpack_require_623__(817); var select_default = /*#__PURE__*/__nested_webpack_require_623__.n(src_select); ;// CONCATENATED MODULE: ./src/common/command.js /** * Executes a given operation type. * @param {String} type * @return {Boolean} */ function command(type) { try { return document.execCommand(type); } catch (err) { return false; } } ;// CONCATENATED MODULE: ./src/actions/cut.js /** * Cut action wrapper. * @param {String|HTMLElement} target * @return {String} */ var ClipboardActionCut = function ClipboardActionCut(target) { var selectedText = select_default()(target); command('cut'); return selectedText; }; /* harmony default export */ var actions_cut = (ClipboardActionCut); ;// CONCATENATED MODULE: ./src/common/create-fake-element.js /** * Creates a fake textarea element with a value. * @param {String} value * @return {HTMLElement} */ function createFakeElement(value) { var isRTL = document.documentElement.getAttribute('dir') === 'rtl'; var fakeElement = document.createElement('textarea'); // Prevent zooming on iOS fakeElement.style.fontSize = '12pt'; // Reset box model fakeElement.style.border = '0'; fakeElement.style.padding = '0'; fakeElement.style.margin = '0'; // Move element out of screen horizontally fakeElement.style.position = 'absolute'; fakeElement.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically var yPosition = window.pageYOffset || document.documentElement.scrollTop; fakeElement.style.top = "".concat(yPosition, "px"); fakeElement.setAttribute('readonly', ''); fakeElement.value = value; return fakeElement; } ;// CONCATENATED MODULE: ./src/actions/copy.js /** * Create fake copy action wrapper using a fake element. * @param {String} target * @param {Object} options * @return {String} */ var fakeCopyAction = function fakeCopyAction(value, options) { var fakeElement = createFakeElement(value); options.container.appendChild(fakeElement); var selectedText = select_default()(fakeElement); command('copy'); fakeElement.remove(); return selectedText; }; /** * Copy action wrapper. * @param {String|HTMLElement} target * @param {Object} options * @return {String} */ var ClipboardActionCopy = function ClipboardActionCopy(target) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { container: document.body }; var selectedText = ''; if (typeof target === 'string') { selectedText = fakeCopyAction(target, options); } else if (target instanceof HTMLInputElement && !['text', 'search', 'url', 'tel', 'password'].includes(target === null || target === void 0 ? void 0 : target.type)) { // If input type doesn't support `setSelectionRange`. Simulate it. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange selectedText = fakeCopyAction(target.value, options); } else { selectedText = select_default()(target); command('copy'); } return selectedText; }; /* harmony default export */ var actions_copy = (ClipboardActionCopy); ;// CONCATENATED MODULE: ./src/actions/default.js function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /** * Inner function which performs selection from either `text` or `target` * properties and then executes copy or cut operations. * @param {Object} options */ var ClipboardActionDefault = function ClipboardActionDefault() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // Defines base properties passed from constructor. var _options$action = options.action, action = _options$action === void 0 ? 'copy' : _options$action, container = options.container, target = options.target, text = options.text; // Sets the `action` to be performed which can be either 'copy' or 'cut'. if (action !== 'copy' && action !== 'cut') { throw new Error('Invalid "action" value, use either "copy" or "cut"'); } // Sets the `target` property using an element that will be have its content copied. if (target !== undefined) { if (target && _typeof(target) === 'object' && target.nodeType === 1) { if (action === 'copy' && target.hasAttribute('disabled')) { throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); } if (action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); } } else { throw new Error('Invalid "target" value, use a valid Element'); } } // Define selection strategy based on `text` property. if (text) { return actions_copy(text, { container: container }); } // Defines which selection strategy based on `target` property. if (target) { return action === 'cut' ? actions_cut(target) : actions_copy(target, { container: container }); } }; /* harmony default export */ var actions_default = (ClipboardActionDefault); ;// CONCATENATED MODULE: ./src/clipboard.js function clipboard_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return clipboard_typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Helper function to retrieve attribute value. * @param {String} suffix * @param {Element} element */ function getAttributeValue(suffix, element) { var attribute = "data-clipboard-".concat(suffix); if (!element.hasAttribute(attribute)) { return; } return element.getAttribute(attribute); } /** * Base class which takes one or more elements, adds event listeners to them, * and instantiates a new `ClipboardAction` on each click. */ var Clipboard = /*#__PURE__*/function (_Emitter) { _inherits(Clipboard, _Emitter); var _super = _createSuper(Clipboard); /** * @param {String|HTMLElement|HTMLCollection|NodeList} trigger * @param {Object} options */ function Clipboard(trigger, options) { var _this; _classCallCheck(this, Clipboard); _this = _super.call(this); _this.resolveOptions(options); _this.listenClick(trigger); return _this; } /** * Defines if attributes would be resolved using internal setter functions * or custom functions that were passed in the constructor. * @param {Object} options */ _createClass(Clipboard, [{ key: "resolveOptions", value: function resolveOptions() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; this.action = typeof options.action === 'function' ? options.action : this.defaultAction; this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; this.text = typeof options.text === 'function' ? options.text : this.defaultText; this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body; } /** * Adds a click event listener to the passed trigger. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger */ }, { key: "listenClick", value: function listenClick(trigger) { var _this2 = this; this.listener = listen_default()(trigger, 'click', function (e) { return _this2.onClick(e); }); } /** * Defines a new `ClipboardAction` on each click event. * @param {Event} e */ }, { key: "onClick", value: function onClick(e) { var trigger = e.delegateTarget || e.currentTarget; var action = this.action(trigger) || 'copy'; var text = actions_default({ action: action, container: this.container, target: this.target(trigger), text: this.text(trigger) }); // Fires an event based on the copy operation result. this.emit(text ? 'success' : 'error', { action: action, text: text, trigger: trigger, clearSelection: function clearSelection() { if (trigger) { trigger.focus(); } window.getSelection().removeAllRanges(); } }); } /** * Default `action` lookup function. * @param {Element} trigger */ }, { key: "defaultAction", value: function defaultAction(trigger) { return getAttributeValue('action', trigger); } /** * Default `target` lookup function. * @param {Element} trigger */ }, { key: "defaultTarget", value: function defaultTarget(trigger) { var selector = getAttributeValue('target', trigger); if (selector) { return document.querySelector(selector); } } /** * Allow fire programmatically a copy action * @param {String|HTMLElement} target * @param {Object} options * @returns Text copied. */ }, { key: "defaultText", /** * Default `text` lookup function. * @param {Element} trigger */ value: function defaultText(trigger) { return getAttributeValue('text', trigger); } /** * Destroy lifecycle. */ }, { key: "destroy", value: function destroy() { this.listener.destroy(); } }], [{ key: "copy", value: function copy(target) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { container: document.body }; return actions_copy(target, options); } /** * Allow fire programmatically a cut action * @param {String|HTMLElement} target * @returns Text cutted. */ }, { key: "cut", value: function cut(target) { return actions_cut(target); } /** * Returns the support of the given action, or all actions if no action is * given. * @param {String} [action] */ }, { key: "isSupported", value: function isSupported() { var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut']; var actions = typeof action === 'string' ? [action] : action; var support = !!document.queryCommandSupported; actions.forEach(function (action) { support = support && !!document.queryCommandSupported(action); }); return support; } }]); return Clipboard; }((tiny_emitter_default())); /* harmony default export */ var clipboard = (Clipboard); /***/ }), /***/ 828: /***/ (function(module) { var DOCUMENT_NODE_TYPE = 9; /** * A polyfill for Element.matches() */ if (typeof Element !== 'undefined' && !Element.prototype.matches) { var proto = Element.prototype; proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; } /** * Finds the closest parent that matches a selector. * * @param {Element} element * @param {String} selector * @return {Function} */ function closest (element, selector) { while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { if (typeof element.matches === 'function' && element.matches(selector)) { return element; } element = element.parentNode; } } module.exports = closest; /***/ }), /***/ 438: /***/ (function(module, __unused_webpack_exports, __nested_webpack_require_15749__) { var closest = __nested_webpack_require_15749__(828); /** * Delegates event to a selector. * * @param {Element} element * @param {String} selector * @param {String} type * @param {Function} callback * @param {Boolean} useCapture * @return {Object} */ function _delegate(element, selector, type, callback, useCapture) { var listenerFn = listener.apply(this, arguments); element.addEventListener(type, listenerFn, useCapture); return { destroy: function() { element.removeEventListener(type, listenerFn, useCapture); } } } /** * Delegates event to a selector. * * @param {Element|String|Array} [elements] * @param {String} selector * @param {String} type * @param {Function} callback * @param {Boolean} useCapture * @return {Object} */ function delegate(elements, selector, type, callback, useCapture) { // Handle the regular Element usage if (typeof elements.addEventListener === 'function') { return _delegate.apply(null, arguments); } // Handle Element-less usage, it defaults to global delegation if (typeof type === 'function') { // Use `document` as the first parameter, then apply arguments // This is a short way to .unshift `arguments` without running into deoptimizations return _delegate.bind(null, document).apply(null, arguments); } // Handle Selector-based usage if (typeof elements === 'string') { elements = document.querySelectorAll(elements); } // Handle Array-like based usage return Array.prototype.map.call(elements, function (element) { return _delegate(element, selector, type, callback, useCapture); }); } /** * Finds closest match and invokes callback. * * @param {Element} element * @param {String} selector * @param {String} type * @param {Function} callback * @return {Function} */ function listener(element, selector, type, callback) { return function(e) { e.delegateTarget = closest(e.target, selector); if (e.delegateTarget) { callback.call(element, e); } } } module.exports = delegate; /***/ }), /***/ 879: /***/ (function(__unused_webpack_module, exports) { /** * Check if argument is a HTML element. * * @param {Object} value * @return {Boolean} */ exports.node = function(value) { return value !== undefined && value instanceof HTMLElement && value.nodeType === 1; }; /** * Check if argument is a list of HTML elements. * * @param {Object} value * @return {Boolean} */ exports.nodeList = function(value) { var type = Object.prototype.toString.call(value); return value !== undefined && (type === '[object NodeList]' || type === '[object HTMLCollection]') && ('length' in value) && (value.length === 0 || exports.node(value[0])); }; /** * Check if argument is a string. * * @param {Object} value * @return {Boolean} */ exports.string = function(value) { return typeof value === 'string' || value instanceof String; }; /** * Check if argument is a function. * * @param {Object} value * @return {Boolean} */ exports.fn = function(value) { var type = Object.prototype.toString.call(value); return type === '[object Function]'; }; /***/ }), /***/ 370: /***/ (function(module, __unused_webpack_exports, __nested_webpack_require_19113__) { var is = __nested_webpack_require_19113__(879); var delegate = __nested_webpack_require_19113__(438); /** * Validates all params and calls the right * listener function based on its target type. * * @param {String|HTMLElement|HTMLCollection|NodeList} target * @param {String} type * @param {Function} callback * @return {Object} */ function listen(target, type, callback) { if (!target && !type && !callback) { throw new Error('Missing required arguments'); } if (!is.string(type)) { throw new TypeError('Second argument must be a String'); } if (!is.fn(callback)) { throw new TypeError('Third argument must be a Function'); } if (is.node(target)) { return listenNode(target, type, callback); } else if (is.nodeList(target)) { return listenNodeList(target, type, callback); } else if (is.string(target)) { return listenSelector(target, type, callback); } else { throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList'); } } /** * Adds an event listener to a HTML element * and returns a remove listener function. * * @param {HTMLElement} node * @param {String} type * @param {Function} callback * @return {Object} */ function listenNode(node, type, callback) { node.addEventListener(type, callback); return { destroy: function() { node.removeEventListener(type, callback); } } } /** * Add an event listener to a list of HTML elements * and returns a remove listener function. * * @param {NodeList|HTMLCollection} nodeList * @param {String} type * @param {Function} callback * @return {Object} */ function listenNodeList(nodeList, type, callback) { Array.prototype.forEach.call(nodeList, function(node) { node.addEventListener(type, callback); }); return { destroy: function() { Array.prototype.forEach.call(nodeList, function(node) { node.removeEventListener(type, callback); }); } } } /** * Add an event listener to a selector * and returns a remove listener function. * * @param {String} selector * @param {String} type * @param {Function} callback * @return {Object} */ function listenSelector(selector, type, callback) { return delegate(document.body, selector, type, callback); } module.exports = listen; /***/ }), /***/ 817: /***/ (function(module) { function select(element) { var selectedText; if (element.nodeName === 'SELECT') { element.focus(); selectedText = element.value; } else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { var isReadOnly = element.hasAttribute('readonly'); if (!isReadOnly) { element.setAttribute('readonly', ''); } element.select(); element.setSelectionRange(0, element.value.length); if (!isReadOnly) { element.removeAttribute('readonly'); } selectedText = element.value; } else { if (element.hasAttribute('contenteditable')) { element.focus(); } var selection = window.getSelection(); var range = document.createRange(); range.selectNodeContents(element); selection.removeAllRanges(); selection.addRange(range); selectedText = selection.toString(); } return selectedText; } module.exports = select; /***/ }), /***/ 279: /***/ (function(module) { function E () { // Keep this empty so it's easier to inherit from // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) } E.prototype = { on: function (name, callback, ctx) { var e = this.e || (this.e = {}); (e[name] || (e[name] = [])).push({ fn: callback, ctx: ctx }); return this; }, once: function (name, callback, ctx) { var self = this; function listener () { self.off(name, listener); callback.apply(ctx, arguments); }; listener._ = callback return this.on(name, listener, ctx); }, emit: function (name) { var data = [].slice.call(arguments, 1); var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); var i = 0; var len = evtArr.length; for (i; i < len; i++) { evtArr[i].fn.apply(evtArr[i].ctx, data); } return this; }, off: function (name, callback) { var e = this.e || (this.e = {}); var evts = e[name]; var liveEvents = []; if (evts && callback) { for (var i = 0, len = evts.length; i < len; i++) { if (evts[i].fn !== callback && evts[i].fn._ !== callback) liveEvents.push(evts[i]); } } // Remove event from queue to prevent memory leak // Suggested by https://github.com/lazd // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 (liveEvents.length) ? e[name] = liveEvents : delete e[name]; return this; } }; module.exports = E; module.exports.TinyEmitter = E; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __nested_webpack_require_24495__(moduleId) { /******/ // Check if module is in cache /******/ if(__webpack_module_cache__[moduleId]) { /******/ return __webpack_module_cache__[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_24495__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ !function() { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __nested_webpack_require_24495__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function() { return module['default']; } : /******/ function() { return module; }; /******/ __nested_webpack_require_24495__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ }(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ !function() { /******/ // define getter functions for harmony exports /******/ __nested_webpack_require_24495__.d = function(exports, definition) { /******/ for(var key in definition) { /******/ if(__nested_webpack_require_24495__.o(definition, key) && !__nested_webpack_require_24495__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ }(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ !function() { /******/ __nested_webpack_require_24495__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } /******/ }(); /******/ /************************************************************************/ /******/ // module exports must be returned from runtime so entry inlining is disabled /******/ // startup /******/ // Load entry module and return exports /******/ return __nested_webpack_require_24495__(686); /******/ })() .default; }); /***/ }), /***/ 5760: /***/ (() => { /** * adds a bindGlobal method to Mousetrap that allows you to * bind specific keyboard shortcuts that will still work * inside a text input field * * usage: * Mousetrap.bindGlobal('ctrl+s', _saveChanges); */ /* global Mousetrap:true */ (function(Mousetrap) { if (! Mousetrap) { return; } var _globalCallbacks = {}; var _originalStopCallback = Mousetrap.prototype.stopCallback; Mousetrap.prototype.stopCallback = function(e, element, combo, sequence) { var self = this; if (self.paused) { return true; } if (_globalCallbacks[combo] || _globalCallbacks[sequence]) { return false; } return _originalStopCallback.call(self, e, element, combo); }; Mousetrap.prototype.bindGlobal = function(keys, callback, action) { var self = this; self.bind(keys, callback, action); if (keys instanceof Array) { for (var i = 0; i < keys.length; i++) { _globalCallbacks[keys[i]] = true; } return; } _globalCallbacks[keys] = true; }; Mousetrap.init(); }) (typeof Mousetrap !== "undefined" ? Mousetrap : undefined); /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { __experimentalUseDialog: () => (/* reexport */ use_dialog), __experimentalUseDragging: () => (/* reexport */ useDragging), __experimentalUseDropZone: () => (/* reexport */ useDropZone), __experimentalUseFixedWindowList: () => (/* reexport */ useFixedWindowList), __experimentalUseFocusOutside: () => (/* reexport */ useFocusOutside), compose: () => (/* reexport */ higher_order_compose), createHigherOrderComponent: () => (/* reexport */ createHigherOrderComponent), debounce: () => (/* reexport */ debounce), ifCondition: () => (/* reexport */ if_condition), observableMap: () => (/* reexport */ observableMap), pipe: () => (/* reexport */ higher_order_pipe), pure: () => (/* reexport */ higher_order_pure), throttle: () => (/* reexport */ throttle), useAsyncList: () => (/* reexport */ use_async_list), useConstrainedTabbing: () => (/* reexport */ use_constrained_tabbing), useCopyOnClick: () => (/* reexport */ useCopyOnClick), useCopyToClipboard: () => (/* reexport */ useCopyToClipboard), useDebounce: () => (/* reexport */ useDebounce), useDebouncedInput: () => (/* reexport */ useDebouncedInput), useDisabled: () => (/* reexport */ useDisabled), useEvent: () => (/* reexport */ useEvent), useFocusOnMount: () => (/* reexport */ useFocusOnMount), useFocusReturn: () => (/* reexport */ use_focus_return), useFocusableIframe: () => (/* reexport */ useFocusableIframe), useInstanceId: () => (/* reexport */ use_instance_id), useIsomorphicLayoutEffect: () => (/* reexport */ use_isomorphic_layout_effect), useKeyboardShortcut: () => (/* reexport */ use_keyboard_shortcut), useMediaQuery: () => (/* reexport */ useMediaQuery), useMergeRefs: () => (/* reexport */ useMergeRefs), useObservableValue: () => (/* reexport */ useObservableValue), usePrevious: () => (/* reexport */ usePrevious), useReducedMotion: () => (/* reexport */ use_reduced_motion), useRefEffect: () => (/* reexport */ useRefEffect), useResizeObserver: () => (/* reexport */ use_resize_observer_useResizeObserver), useStateWithHistory: () => (/* reexport */ useStateWithHistory), useThrottle: () => (/* reexport */ useThrottle), useViewportMatch: () => (/* reexport */ use_viewport_match), useWarnOnChange: () => (/* reexport */ use_warn_on_change), withGlobalEvents: () => (/* reexport */ withGlobalEvents), withInstanceId: () => (/* reexport */ with_instance_id), withSafeTimeout: () => (/* reexport */ with_safe_timeout), withState: () => (/* reexport */ withState) }); ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/pascal-case/dist.es2015/index.js function pascalCaseTransform(input, index) { var firstChar = input.charAt(0); var lowerChars = input.substr(1).toLowerCase(); if (index > 0 && firstChar >= "0" && firstChar <= "9") { return "_" + firstChar + lowerChars; } return "" + firstChar.toUpperCase() + lowerChars; } function pascalCaseTransformMerge(input) { return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase(); } function pascalCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options)); } ;// ./node_modules/@wordpress/compose/build-module/utils/create-higher-order-component/index.js /** * External dependencies */ /** * Given a function mapping a component to an enhanced component and modifier * name, returns the enhanced component augmented with a generated displayName. * * @param mapComponent Function mapping component to enhanced component. * @param modifierName Seed name from which to generated display name. * * @return Component class with generated display name assigned. */ function createHigherOrderComponent(mapComponent, modifierName) { return Inner => { const Outer = mapComponent(Inner); Outer.displayName = hocName(modifierName, Inner); return Outer; }; } /** * Returns a displayName for a higher-order component, given a wrapper name. * * @example * hocName( 'MyMemo', Widget ) === 'MyMemo(Widget)'; * hocName( 'MyMemo',
) === 'MyMemo(Component)'; * * @param name Name assigned to higher-order component's wrapper component. * @param Inner Wrapped component inside higher-order component. * @return Wrapped name of higher-order component. */ const hocName = (name, Inner) => { const inner = Inner.displayName || Inner.name || 'Component'; const outer = pascalCase(name !== null && name !== void 0 ? name : ''); return `${outer}(${inner})`; }; ;// ./node_modules/@wordpress/compose/build-module/utils/debounce/index.js /** * Parts of this source were derived and modified from lodash, * released under the MIT license. * * https://github.com/lodash/lodash * * Copyright JS Foundation and other contributors * * Based on Underscore.js, copyright Jeremy Ashkenas, * DocumentCloud and Investigative Reporters & Editors * * This software consists of voluntary contributions made by many * individuals. For exact contribution history, see the revision history * available at https://github.com/lodash/lodash * * The following license applies to all parts of this software except as * documented below: * * ==== * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * A simplified and properly typed version of lodash's `debounce`, that * always uses timers instead of sometimes using rAF. * * Creates a debounced function that delays invoking `func` until after `wait` * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel delayed * `func` invocations and a `flush` method to immediately invoke them. Provide * `options` to indicate whether `func` should be invoked on the leading and/or * trailing edge of the `wait` timeout. The `func` is invoked with the last * arguments provided to the debounced function. Subsequent calls to the debounced * function return the result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the debounced function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until the next tick, similar to `setTimeout` with a timeout of `0`. * * @param {Function} func The function to debounce. * @param {number} wait The number of milliseconds to delay. * @param {Partial< DebounceOptions >} options The options object. * @param {boolean} options.leading Specify invoking on the leading edge of the timeout. * @param {number} options.maxWait The maximum time `func` is allowed to be delayed before it's invoked. * @param {boolean} options.trailing Specify invoking on the trailing edge of the timeout. * * @return Returns the new debounced function. */ const debounce = (func, wait, options) => { let lastArgs; let lastThis; let maxWait = 0; let result; let timerId; let lastCallTime; let lastInvokeTime = 0; let leading = false; let maxing = false; let trailing = true; if (options) { leading = !!options.leading; maxing = 'maxWait' in options; if (options.maxWait !== undefined) { maxWait = Math.max(options.maxWait, wait); } trailing = 'trailing' in options ? !!options.trailing : trailing; } function invokeFunc(time) { const args = lastArgs; const thisArg = lastThis; lastArgs = undefined; lastThis = undefined; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function startTimer(pendingFunc, waitTime) { timerId = setTimeout(pendingFunc, waitTime); } function cancelTimer() { if (timerId !== undefined) { clearTimeout(timerId); } } function leadingEdge(time) { // Reset any `maxWait` timer. lastInvokeTime = time; // Start the timer for the trailing edge. startTimer(timerExpired, wait); // Invoke the leading edge. return leading ? invokeFunc(time) : result; } function getTimeSinceLastCall(time) { return time - (lastCallTime || 0); } function remainingWait(time) { const timeSinceLastCall = getTimeSinceLastCall(time); const timeSinceLastInvoke = time - lastInvokeTime; const timeWaiting = wait - timeSinceLastCall; return maxing ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time) { const timeSinceLastCall = getTimeSinceLastCall(time); const timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; } function timerExpired() { const time = Date.now(); if (shouldInvoke(time)) { return trailingEdge(time); } // Restart the timer. startTimer(timerExpired, remainingWait(time)); return undefined; } function clearTimer() { timerId = undefined; } function trailingEdge(time) { clearTimer(); // Only invoke if we have `lastArgs` which means `func` has been // debounced at least once. if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = undefined; return result; } function cancel() { cancelTimer(); lastInvokeTime = 0; clearTimer(); lastArgs = lastCallTime = lastThis = undefined; } function flush() { return pending() ? trailingEdge(Date.now()) : result; } function pending() { return timerId !== undefined; } function debounced(...args) { const time = Date.now(); const isInvoking = shouldInvoke(time); lastArgs = args; lastThis = this; lastCallTime = time; if (isInvoking) { if (!pending()) { return leadingEdge(lastCallTime); } if (maxing) { // Handle invocations in a tight loop. startTimer(timerExpired, wait); return invokeFunc(lastCallTime); } } if (!pending()) { startTimer(timerExpired, wait); } return result; } debounced.cancel = cancel; debounced.flush = flush; debounced.pending = pending; return debounced; }; ;// ./node_modules/@wordpress/compose/build-module/utils/throttle/index.js /** * Parts of this source were derived and modified from lodash, * released under the MIT license. * * https://github.com/lodash/lodash * * Copyright JS Foundation and other contributors * * Based on Underscore.js, copyright Jeremy Ashkenas, * DocumentCloud and Investigative Reporters & Editors * * This software consists of voluntary contributions made by many * individuals. For exact contribution history, see the revision history * available at https://github.com/lodash/lodash * * The following license applies to all parts of this software except as * documented below: * * ==== * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * Internal dependencies */ /** * A simplified and properly typed version of lodash's `throttle`, that * always uses timers instead of sometimes using rAF. * * Creates a throttled function that only invokes `func` at most once per * every `wait` milliseconds. The throttled function comes with a `cancel` * method to cancel delayed `func` invocations and a `flush` method to * immediately invoke them. Provide `options` to indicate whether `func` * should be invoked on the leading and/or trailing edge of the `wait` * timeout. The `func` is invoked with the last arguments provided to the * throttled function. Subsequent calls to the throttled function return * the result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the throttled function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until the next tick, similar to `setTimeout` with a timeout of `0`. * * @param {Function} func The function to throttle. * @param {number} wait The number of milliseconds to throttle invocations to. * @param {Partial< ThrottleOptions >} options The options object. * @param {boolean} options.leading Specify invoking on the leading edge of the timeout. * @param {boolean} options.trailing Specify invoking on the trailing edge of the timeout. * @return Returns the new throttled function. */ const throttle = (func, wait, options) => { let leading = true; let trailing = true; if (options) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } return debounce(func, wait, { leading, trailing, maxWait: wait }); }; ;// ./node_modules/@wordpress/compose/build-module/utils/observable-map/index.js /** * A constructor (factory) for `ObservableMap`, a map-like key/value data structure * where the individual entries are observable: using the `subscribe` method, you can * subscribe to updates for a particular keys. Each subscriber always observes one * specific key and is not notified about any unrelated changes (for different keys) * in the `ObservableMap`. * * @template K The type of the keys in the map. * @template V The type of the values in the map. * @return A new instance of the `ObservableMap` type. */ function observableMap() { const map = new Map(); const listeners = new Map(); function callListeners(name) { const list = listeners.get(name); if (!list) { return; } for (const listener of list) { listener(); } } return { get(name) { return map.get(name); }, set(name, value) { map.set(name, value); callListeners(name); }, delete(name) { map.delete(name); callListeners(name); }, subscribe(name, listener) { let list = listeners.get(name); if (!list) { list = new Set(); listeners.set(name, list); } list.add(listener); return () => { list.delete(listener); if (list.size === 0) { listeners.delete(name); } }; } }; } ;// ./node_modules/@wordpress/compose/build-module/higher-order/pipe.js /** * Parts of this source were derived and modified from lodash, * released under the MIT license. * * https://github.com/lodash/lodash * * Copyright JS Foundation and other contributors * * Based on Underscore.js, copyright Jeremy Ashkenas, * DocumentCloud and Investigative Reporters & Editors * * This software consists of voluntary contributions made by many * individuals. For exact contribution history, see the revision history * available at https://github.com/lodash/lodash * * The following license applies to all parts of this software except as * documented below: * * ==== * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * Creates a pipe function. * * Allows to choose whether to perform left-to-right or right-to-left composition. * * @see https://lodash.com/docs/4#flow * * @param {boolean} reverse True if right-to-left, false for left-to-right composition. */ const basePipe = (reverse = false) => (...funcs) => (...args) => { const functions = funcs.flat(); if (reverse) { functions.reverse(); } return functions.reduce((prev, func) => [func(...prev)], args)[0]; }; /** * Composes multiple higher-order components into a single higher-order component. Performs left-to-right function * composition, where each successive invocation is supplied the return value of the previous. * * This is inspired by `lodash`'s `flow` function. * * @see https://lodash.com/docs/4#flow */ const pipe = basePipe(); /* harmony default export */ const higher_order_pipe = (pipe); ;// ./node_modules/@wordpress/compose/build-module/higher-order/compose.js /** * Internal dependencies */ /** * Composes multiple higher-order components into a single higher-order component. Performs right-to-left function * composition, where each successive invocation is supplied the return value of the previous. * * This is inspired by `lodash`'s `flowRight` function. * * @see https://lodash.com/docs/4#flow-right */ const compose = basePipe(true); /* harmony default export */ const higher_order_compose = (compose); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/compose/build-module/higher-order/if-condition/index.js /** * External dependencies */ /** * Internal dependencies */ /** * Higher-order component creator, creating a new component which renders if * the given condition is satisfied or with the given optional prop name. * * @example * ```ts * type Props = { foo: string }; * const Component = ( props: Props ) =>
{ props.foo }
; * const ConditionalComponent = ifCondition( ( props: Props ) => props.foo.length !== 0 )( Component ); * ; // => null * ; // =>
bar
; * ``` * * @param predicate Function to test condition. * * @return Higher-order component. */ function ifCondition(predicate) { return createHigherOrderComponent(WrappedComponent => props => { if (!predicate(props)) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props }); }, 'ifCondition'); } /* harmony default export */ const if_condition = (ifCondition); ;// external ["wp","isShallowEqual"] const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// ./node_modules/@wordpress/compose/build-module/higher-order/pure/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Given a component returns the enhanced component augmented with a component * only re-rendering when its props/state change * * @deprecated Use `memo` or `PureComponent` instead. */ const pure = createHigherOrderComponent(function (WrappedComponent) { if (WrappedComponent.prototype instanceof external_wp_element_namespaceObject.Component) { return class extends WrappedComponent { shouldComponentUpdate(nextProps, nextState) { return !external_wp_isShallowEqual_default()(nextProps, this.props) || !external_wp_isShallowEqual_default()(nextState, this.state); } }; } return class extends external_wp_element_namespaceObject.Component { shouldComponentUpdate(nextProps) { return !external_wp_isShallowEqual_default()(nextProps, this.props); } render() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...this.props }); } }; }, 'pure'); /* harmony default export */ const higher_order_pure = (pure); ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// ./node_modules/@wordpress/compose/build-module/higher-order/with-global-events/listener.js /** * Class responsible for orchestrating event handling on the global window, * binding a single event to be shared across all handling instances, and * removing the handler when no instances are listening for the event. */ class Listener { constructor() { /** @type {any} */ this.listeners = {}; this.handleEvent = this.handleEvent.bind(this); } add(/** @type {any} */eventType, /** @type {any} */instance) { if (!this.listeners[eventType]) { // Adding first listener for this type, so bind event. window.addEventListener(eventType, this.handleEvent); this.listeners[eventType] = []; } this.listeners[eventType].push(instance); } remove(/** @type {any} */eventType, /** @type {any} */instance) { if (!this.listeners[eventType]) { return; } this.listeners[eventType] = this.listeners[eventType].filter((/** @type {any} */listener) => listener !== instance); if (!this.listeners[eventType].length) { // Removing last listener for this type, so unbind event. window.removeEventListener(eventType, this.handleEvent); delete this.listeners[eventType]; } } handleEvent(/** @type {any} */event) { this.listeners[event.type]?.forEach((/** @type {any} */instance) => { instance.handleEvent(event); }); } } /* harmony default export */ const listener = (Listener); ;// ./node_modules/@wordpress/compose/build-module/higher-order/with-global-events/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Listener instance responsible for managing document event handling. */ const with_global_events_listener = new listener(); /* eslint-disable jsdoc/no-undefined-types */ /** * Higher-order component creator which, given an object of DOM event types and * values corresponding to a callback function name on the component, will * create or update a window event handler to invoke the callback when an event * occurs. On behalf of the consuming developer, the higher-order component * manages unbinding when the component unmounts, and binding at most a single * event handler for the entire application. * * @deprecated * * @param {Record} eventTypesToHandlers Object with keys of DOM * event type, the value a * name of the function on * the original component's * instance which handles * the event. * * @return {any} Higher-order component. */ function withGlobalEvents(eventTypesToHandlers) { external_wp_deprecated_default()('wp.compose.withGlobalEvents', { since: '5.7', alternative: 'useEffect' }); // @ts-ignore We don't need to fix the type-related issues because this is deprecated. return createHigherOrderComponent(WrappedComponent => { class Wrapper extends external_wp_element_namespaceObject.Component { constructor(/** @type {any} */props) { super(props); this.handleEvent = this.handleEvent.bind(this); this.handleRef = this.handleRef.bind(this); } componentDidMount() { Object.keys(eventTypesToHandlers).forEach(eventType => { with_global_events_listener.add(eventType, this); }); } componentWillUnmount() { Object.keys(eventTypesToHandlers).forEach(eventType => { with_global_events_listener.remove(eventType, this); }); } handleEvent(/** @type {any} */event) { const handler = eventTypesToHandlers[(/** @type {keyof GlobalEventHandlersEventMap} */ event.type /* eslint-enable jsdoc/no-undefined-types */)]; if (typeof this.wrappedRef[handler] === 'function') { this.wrappedRef[handler](event); } } handleRef(/** @type {any} */el) { this.wrappedRef = el; // Any component using `withGlobalEvents` that is not setting a `ref` // will cause `this.props.forwardedRef` to be `null`, so we need this // check. if (this.props.forwardedRef) { this.props.forwardedRef(el); } } render() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...this.props.ownProps, ref: this.handleRef }); } } return (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapper, { ownProps: props, forwardedRef: ref }); }); }, 'withGlobalEvents'); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js /** * WordPress dependencies */ const instanceMap = new WeakMap(); /** * Creates a new id for a given object. * * @param object Object reference to create an id for. * @return The instance id (index). */ function createId(object) { const instances = instanceMap.get(object) || 0; instanceMap.set(object, instances + 1); return instances; } /** * Specify the useInstanceId *function* signatures. * * More accurately, useInstanceId distinguishes between three different * signatures: * * 1. When only object is given, the returned value is a number * 2. When object and prefix is given, the returned value is a string * 3. When preferredId is given, the returned value is the type of preferredId * * @param object Object reference to create an id for. */ /** * Provides a unique instance ID. * * @param object Object reference to create an id for. * @param [prefix] Prefix for the unique id. * @param [preferredId] Default ID to use. * @return The unique instance id. */ function useInstanceId(object, prefix, preferredId) { return (0,external_wp_element_namespaceObject.useMemo)(() => { if (preferredId) { return preferredId; } const id = createId(object); return prefix ? `${prefix}-${id}` : id; }, [object, preferredId, prefix]); } /* harmony default export */ const use_instance_id = (useInstanceId); ;// ./node_modules/@wordpress/compose/build-module/higher-order/with-instance-id/index.js /** * Internal dependencies */ /** * A Higher Order Component used to provide a unique instance ID by component. */ const withInstanceId = createHigherOrderComponent(WrappedComponent => { return props => { const instanceId = use_instance_id(WrappedComponent); // @ts-ignore return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, instanceId: instanceId }); }; }, 'instanceId'); /* harmony default export */ const with_instance_id = (withInstanceId); ;// ./node_modules/@wordpress/compose/build-module/higher-order/with-safe-timeout/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * We cannot use the `Window['setTimeout']` and `Window['clearTimeout']` * types here because those functions include functionality that is not handled * by this component, like the ability to pass extra arguments. * * In the case of this component, we only handle the simplest case where * `setTimeout` only accepts a function (not a string) and an optional delay. */ /** * A higher-order component used to provide and manage delayed function calls * that ought to be bound to a component's lifecycle. */ const withSafeTimeout = createHigherOrderComponent(OriginalComponent => { return class WrappedComponent extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.timeouts = []; this.setTimeout = this.setTimeout.bind(this); this.clearTimeout = this.clearTimeout.bind(this); } componentWillUnmount() { this.timeouts.forEach(clearTimeout); } setTimeout(fn, delay) { const id = setTimeout(() => { fn(); this.clearTimeout(id); }, delay); this.timeouts.push(id); return id; } clearTimeout(id) { clearTimeout(id); this.timeouts = this.timeouts.filter(timeoutId => timeoutId !== id); } render() { return ( /*#__PURE__*/ // @ts-ignore (0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalComponent, { ...this.props, setTimeout: this.setTimeout, clearTimeout: this.clearTimeout }) ); } }; }, 'withSafeTimeout'); /* harmony default export */ const with_safe_timeout = (withSafeTimeout); ;// ./node_modules/@wordpress/compose/build-module/higher-order/with-state/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * A Higher Order Component used to provide and manage internal component state * via props. * * @deprecated Use `useState` instead. * * @param {any} initialState Optional initial state of the component. * * @return {any} A higher order component wrapper accepting a component that takes the state props + its own props + `setState` and returning a component that only accepts the own props. */ function withState(initialState = {}) { external_wp_deprecated_default()('wp.compose.withState', { since: '5.8', alternative: 'wp.element.useState' }); return createHigherOrderComponent(OriginalComponent => { return class WrappedComponent extends external_wp_element_namespaceObject.Component { constructor(/** @type {any} */props) { super(props); this.setState = this.setState.bind(this); this.state = initialState; } render() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalComponent, { ...this.props, ...this.state, setState: this.setState }); } }; }, 'withState'); } ;// external ["wp","dom"] const external_wp_dom_namespaceObject = window["wp"]["dom"]; ;// ./node_modules/@wordpress/compose/build-module/hooks/use-ref-effect/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Effect-like ref callback. Just like with `useEffect`, this allows you to * return a cleanup function to be run if the ref changes or one of the * dependencies changes. The ref is provided as an argument to the callback * functions. The main difference between this and `useEffect` is that * the `useEffect` callback is not called when the ref changes, but this is. * Pass the returned ref callback as the component's ref and merge multiple refs * with `useMergeRefs`. * * It's worth noting that if the dependencies array is empty, there's not * strictly a need to clean up event handlers for example, because the node is * to be removed. It *is* necessary if you add dependencies because the ref * callback will be called multiple times for the same node. * * @param callback Callback with ref as argument. * @param dependencies Dependencies of the callback. * * @return Ref callback. */ function useRefEffect(callback, dependencies) { const cleanupRef = (0,external_wp_element_namespaceObject.useRef)(); return (0,external_wp_element_namespaceObject.useCallback)(node => { if (node) { cleanupRef.current = callback(node); } else if (cleanupRef.current) { cleanupRef.current(); } }, dependencies); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-constrained-tabbing/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * In Dialogs/modals, the tabbing must be constrained to the content of * the wrapper element. This hook adds the behavior to the returned ref. * * @return {import('react').RefCallback} Element Ref. * * @example * ```js * import { useConstrainedTabbing } from '@wordpress/compose'; * * const ConstrainedTabbingExample = () => { * const constrainedTabbingRef = useConstrainedTabbing() * return ( *
*
* ); * } * ``` */ function useConstrainedTabbing() { return useRefEffect((/** @type {HTMLElement} */node) => { function onKeyDown(/** @type {KeyboardEvent} */event) { const { key, shiftKey, target } = event; if (key !== 'Tab') { return; } const action = shiftKey ? 'findPrevious' : 'findNext'; const nextElement = external_wp_dom_namespaceObject.focus.tabbable[action](/** @type {HTMLElement} */target) || null; // When the target element contains the element that is about to // receive focus, for example when the target is a tabbable // container, browsers may disagree on where to move focus next. // In this case we can't rely on native browsers behavior. We need // to manage focus instead. // See https://github.com/WordPress/gutenberg/issues/46041. if (/** @type {HTMLElement} */target.contains(nextElement)) { event.preventDefault(); nextElement?.focus(); return; } // If the element that is about to receive focus is inside the // area, rely on native browsers behavior and let tabbing follow // the native tab sequence. if (node.contains(nextElement)) { return; } // If the element that is about to receive focus is outside the // area, move focus to a div and insert it at the start or end of // the area, depending on the direction. Without preventing default // behaviour, the browser will then move focus to the next element. const domAction = shiftKey ? 'append' : 'prepend'; const { ownerDocument } = node; const trap = ownerDocument.createElement('div'); trap.tabIndex = -1; node[domAction](trap); // Remove itself when the trap loses focus. trap.addEventListener('blur', () => node.removeChild(trap)); trap.focus(); } node.addEventListener('keydown', onKeyDown); return () => { node.removeEventListener('keydown', onKeyDown); }; }, []); } /* harmony default export */ const use_constrained_tabbing = (useConstrainedTabbing); // EXTERNAL MODULE: ./node_modules/clipboard/dist/clipboard.js var dist_clipboard = __webpack_require__(3758); var clipboard_default = /*#__PURE__*/__webpack_require__.n(dist_clipboard); ;// ./node_modules/@wordpress/compose/build-module/hooks/use-copy-on-click/index.js /** * External dependencies */ /** * WordPress dependencies */ /* eslint-disable jsdoc/no-undefined-types */ /** * Copies the text to the clipboard when the element is clicked. * * @deprecated * * @param {import('react').RefObject>} ref Reference with the element. * @param {string|Function} text The text to copy. * @param {number} [timeout] Optional timeout to reset the returned * state. 4 seconds by default. * * @return {boolean} Whether or not the text has been copied. Resets after the * timeout. */ function useCopyOnClick(ref, text, timeout = 4000) { /* eslint-enable jsdoc/no-undefined-types */ external_wp_deprecated_default()('wp.compose.useCopyOnClick', { since: '5.8', alternative: 'wp.compose.useCopyToClipboard' }); /** @type {import('react').MutableRefObject} */ const clipboardRef = (0,external_wp_element_namespaceObject.useRef)(); const [hasCopied, setHasCopied] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { /** @type {number | undefined} */ let timeoutId; if (!ref.current) { return; } // Clipboard listens to click events. clipboardRef.current = new (clipboard_default())(ref.current, { text: () => typeof text === 'function' ? text() : text }); clipboardRef.current.on('success', ({ clearSelection, trigger }) => { // Clearing selection will move focus back to the triggering button, // ensuring that it is not reset to the body, and further that it is // kept within the rendered node. clearSelection(); // Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680 if (trigger) { /** @type {HTMLElement} */trigger.focus(); } if (timeout) { setHasCopied(true); clearTimeout(timeoutId); timeoutId = setTimeout(() => setHasCopied(false), timeout); } }); return () => { if (clipboardRef.current) { clipboardRef.current.destroy(); } clearTimeout(timeoutId); }; }, [text, timeout, setHasCopied]); return hasCopied; } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-copy-to-clipboard/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * @template T * @param {T} value * @return {import('react').RefObject} The updated ref */ function useUpdatedRef(value) { const ref = (0,external_wp_element_namespaceObject.useRef)(value); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { ref.current = value; }, [value]); return ref; } /** * Copies the given text to the clipboard when the element is clicked. * * @template {HTMLElement} TElementType * @param {string | (() => string)} text The text to copy. Use a function if not * already available and expensive to compute. * @param {Function} onSuccess Called when to text is copied. * * @return {import('react').Ref} A ref to assign to the target element. */ function useCopyToClipboard(text, onSuccess) { // Store the dependencies as refs and continuously update them so they're // fresh when the callback is called. const textRef = useUpdatedRef(text); const onSuccessRef = useUpdatedRef(onSuccess); return useRefEffect(node => { // Clipboard listens to click events. const clipboard = new (clipboard_default())(node, { text() { return typeof textRef.current === 'function' ? textRef.current() : textRef.current || ''; } }); clipboard.on('success', ({ clearSelection }) => { // Clearing selection will move focus back to the triggering // button, ensuring that it is not reset to the body, and // further that it is kept within the rendered node. clearSelection(); if (onSuccessRef.current) { onSuccessRef.current(); } }); return () => { clipboard.destroy(); }; }, []); } ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/compose/build-module/hooks/use-focus-on-mount/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Hook used to focus the first tabbable element on mount. * * @param {boolean | 'firstElement'} focusOnMount Focus on mount mode. * @return {import('react').RefCallback} Ref callback. * * @example * ```js * import { useFocusOnMount } from '@wordpress/compose'; * * const WithFocusOnMount = () => { * const ref = useFocusOnMount() * return ( *
*
* ); * } * ``` */ function useFocusOnMount(focusOnMount = 'firstElement') { const focusOnMountRef = (0,external_wp_element_namespaceObject.useRef)(focusOnMount); /** * Sets focus on a DOM element. * * @param {HTMLElement} target The DOM element to set focus to. * @return {void} */ const setFocus = target => { target.focus({ // When focusing newly mounted dialogs, // the position of the popover is often not right on the first render // This prevents the layout shifts when focusing the dialogs. preventScroll: true }); }; /** @type {import('react').MutableRefObject | undefined>} */ const timerIdRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { focusOnMountRef.current = focusOnMount; }, [focusOnMount]); return useRefEffect(node => { var _node$ownerDocument$a; if (!node || focusOnMountRef.current === false) { return; } if (node.contains((_node$ownerDocument$a = node.ownerDocument?.activeElement) !== null && _node$ownerDocument$a !== void 0 ? _node$ownerDocument$a : null)) { return; } if (focusOnMountRef.current !== 'firstElement') { setFocus(node); return; } timerIdRef.current = setTimeout(() => { const firstTabbable = external_wp_dom_namespaceObject.focus.tabbable.find(node)[0]; if (firstTabbable) { setFocus(firstTabbable); } }, 0); return () => { if (timerIdRef.current) { clearTimeout(timerIdRef.current); } }; }, []); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-focus-return/index.js /** * WordPress dependencies */ /** @type {Element|null} */ let origin = null; /** * Adds the unmount behavior of returning focus to the element which had it * previously as is expected for roles like menus or dialogs. * * @param {() => void} [onFocusReturn] Overrides the default return behavior. * @return {import('react').RefCallback} Element Ref. * * @example * ```js * import { useFocusReturn } from '@wordpress/compose'; * * const WithFocusReturn = () => { * const ref = useFocusReturn() * return ( *
*
* ); * } * ``` */ function useFocusReturn(onFocusReturn) { /** @type {import('react').MutableRefObject} */ const ref = (0,external_wp_element_namespaceObject.useRef)(null); /** @type {import('react').MutableRefObject} */ const focusedBeforeMount = (0,external_wp_element_namespaceObject.useRef)(null); const onFocusReturnRef = (0,external_wp_element_namespaceObject.useRef)(onFocusReturn); (0,external_wp_element_namespaceObject.useEffect)(() => { onFocusReturnRef.current = onFocusReturn; }, [onFocusReturn]); return (0,external_wp_element_namespaceObject.useCallback)(node => { if (node) { var _activeDocument$activ; // Set ref to be used when unmounting. ref.current = node; // Only set when the node mounts. if (focusedBeforeMount.current) { return; } const activeDocument = node.ownerDocument.activeElement instanceof window.HTMLIFrameElement ? node.ownerDocument.activeElement.contentDocument : node.ownerDocument; focusedBeforeMount.current = (_activeDocument$activ = activeDocument?.activeElement) !== null && _activeDocument$activ !== void 0 ? _activeDocument$activ : null; } else if (focusedBeforeMount.current) { const isFocused = ref.current?.contains(ref.current?.ownerDocument.activeElement); if (ref.current?.isConnected && !isFocused) { var _origin; (_origin = origin) !== null && _origin !== void 0 ? _origin : origin = focusedBeforeMount.current; return; } // Defer to the component's own explicit focus return behavior, if // specified. This allows for support that the `onFocusReturn` // decides to allow the default behavior to occur under some // conditions. if (onFocusReturnRef.current) { onFocusReturnRef.current(); } else { /** @type {null|HTMLElement} */(!focusedBeforeMount.current.isConnected ? origin : focusedBeforeMount.current)?.focus(); } origin = null; } }, []); } /* harmony default export */ const use_focus_return = (useFocusReturn); ;// ./node_modules/@wordpress/compose/build-module/hooks/use-focus-outside/index.js /** * WordPress dependencies */ /** * Input types which are classified as button types, for use in considering * whether element is a (focus-normalized) button. */ const INPUT_BUTTON_TYPES = ['button', 'submit']; /** * List of HTML button elements subject to focus normalization * * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus */ /** * Returns true if the given element is a button element subject to focus * normalization, or false otherwise. * * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus * * @param eventTarget The target from a mouse or touch event. * * @return Whether the element is a button element subject to focus normalization. */ function isFocusNormalizedButton(eventTarget) { if (!(eventTarget instanceof window.HTMLElement)) { return false; } switch (eventTarget.nodeName) { case 'A': case 'BUTTON': return true; case 'INPUT': return INPUT_BUTTON_TYPES.includes(eventTarget.type); } return false; } /** * A react hook that can be used to check whether focus has moved outside the * element the event handlers are bound to. * * @param onFocusOutside A callback triggered when focus moves outside * the element the event handlers are bound to. * * @return An object containing event handlers. Bind the event handlers to a * wrapping element element to capture when focus moves outside that element. */ function useFocusOutside(onFocusOutside) { const currentOnFocusOutsideRef = (0,external_wp_element_namespaceObject.useRef)(onFocusOutside); (0,external_wp_element_namespaceObject.useEffect)(() => { currentOnFocusOutsideRef.current = onFocusOutside; }, [onFocusOutside]); const preventBlurCheckRef = (0,external_wp_element_namespaceObject.useRef)(false); const blurCheckTimeoutIdRef = (0,external_wp_element_namespaceObject.useRef)(); /** * Cancel a blur check timeout. */ const cancelBlurCheck = (0,external_wp_element_namespaceObject.useCallback)(() => { clearTimeout(blurCheckTimeoutIdRef.current); }, []); // Cancel blur checks on unmount. (0,external_wp_element_namespaceObject.useEffect)(() => { return () => cancelBlurCheck(); }, []); // Cancel a blur check if the callback or ref is no longer provided. (0,external_wp_element_namespaceObject.useEffect)(() => { if (!onFocusOutside) { cancelBlurCheck(); } }, [onFocusOutside, cancelBlurCheck]); /** * Handles a mousedown or mouseup event to respectively assign and * unassign a flag for preventing blur check on button elements. Some * browsers, namely Firefox and Safari, do not emit a focus event on * button elements when clicked, while others do. The logic here * intends to normalize this as treating click on buttons as focus. * * @param event * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus */ const normalizeButtonFocus = (0,external_wp_element_namespaceObject.useCallback)(event => { const { type, target } = event; const isInteractionEnd = ['mouseup', 'touchend'].includes(type); if (isInteractionEnd) { preventBlurCheckRef.current = false; } else if (isFocusNormalizedButton(target)) { preventBlurCheckRef.current = true; } }, []); /** * A callback triggered when a blur event occurs on the element the handler * is bound to. * * Calls the `onFocusOutside` callback in an immediate timeout if focus has * move outside the bound element and is still within the document. */ const queueBlurCheck = (0,external_wp_element_namespaceObject.useCallback)(event => { // React does not allow using an event reference asynchronously // due to recycling behavior, except when explicitly persisted. event.persist(); // Skip blur check if clicking button. See `normalizeButtonFocus`. if (preventBlurCheckRef.current) { return; } // The usage of this attribute should be avoided. The only use case // would be when we load modals that are not React components and // therefore don't exist in the React tree. An example is opening // the Media Library modal from another dialog. // This attribute should contain a selector of the related target // we want to ignore, because we still need to trigger the blur event // on all other cases. const ignoreForRelatedTarget = event.target.getAttribute('data-unstable-ignore-focus-outside-for-relatedtarget'); if (ignoreForRelatedTarget && event.relatedTarget?.closest(ignoreForRelatedTarget)) { return; } blurCheckTimeoutIdRef.current = setTimeout(() => { // If document is not focused then focus should remain // inside the wrapped component and therefore we cancel // this blur event thereby leaving focus in place. // https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus. if (!document.hasFocus()) { event.preventDefault(); return; } if ('function' === typeof currentOnFocusOutsideRef.current) { currentOnFocusOutsideRef.current(event); } }, 0); }, []); return { onFocus: cancelBlurCheck, onMouseDown: normalizeButtonFocus, onMouseUp: normalizeButtonFocus, onTouchStart: normalizeButtonFocus, onTouchEnd: normalizeButtonFocus, onBlur: queueBlurCheck }; } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-merge-refs/index.js /** * WordPress dependencies */ /* eslint-disable jsdoc/valid-types */ /** * @template T * @typedef {T extends import('react').Ref ? R : never} TypeFromRef */ /* eslint-enable jsdoc/valid-types */ /** * @template T * @param {import('react').Ref} ref * @param {T} value */ function assignRef(ref, value) { if (typeof ref === 'function') { ref(value); } else if (ref && ref.hasOwnProperty('current')) { /* eslint-disable jsdoc/no-undefined-types */ /** @type {import('react').MutableRefObject} */ref.current = value; /* eslint-enable jsdoc/no-undefined-types */ } } /** * Merges refs into one ref callback. * * It also ensures that the merged ref callbacks are only called when they * change (as a result of a `useCallback` dependency update) OR when the ref * value changes, just as React does when passing a single ref callback to the * component. * * As expected, if you pass a new function on every render, the ref callback * will be called after every render. * * If you don't wish a ref callback to be called after every render, wrap it * with `useCallback( callback, dependencies )`. When a dependency changes, the * old ref callback will be called with `null` and the new ref callback will be * called with the same value. * * To make ref callbacks easier to use, you can also pass the result of * `useRefEffect`, which makes cleanup easier by allowing you to return a * cleanup function instead of handling `null`. * * It's also possible to _disable_ a ref (and its behaviour) by simply not * passing the ref. * * ```jsx * const ref = useRefEffect( ( node ) => { * node.addEventListener( ... ); * return () => { * node.removeEventListener( ... ); * }; * }, [ ...dependencies ] ); * const otherRef = useRef(); * const mergedRefs useMergeRefs( [ * enabled && ref, * otherRef, * ] ); * return
; * ``` * * @template {import('react').Ref} TRef * @param {Array} refs The refs to be merged. * * @return {import('react').RefCallback>} The merged ref callback. */ function useMergeRefs(refs) { const element = (0,external_wp_element_namespaceObject.useRef)(); const isAttachedRef = (0,external_wp_element_namespaceObject.useRef)(false); const didElementChangeRef = (0,external_wp_element_namespaceObject.useRef)(false); /* eslint-disable jsdoc/no-undefined-types */ /** @type {import('react').MutableRefObject} */ /* eslint-enable jsdoc/no-undefined-types */ const previousRefsRef = (0,external_wp_element_namespaceObject.useRef)([]); const currentRefsRef = (0,external_wp_element_namespaceObject.useRef)(refs); // Update on render before the ref callback is called, so the ref callback // always has access to the current refs. currentRefsRef.current = refs; // If any of the refs change, call the previous ref with `null` and the new // ref with the node, except when the element changes in the same cycle, in // which case the ref callbacks will already have been called. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (didElementChangeRef.current === false && isAttachedRef.current === true) { refs.forEach((ref, index) => { const previousRef = previousRefsRef.current[index]; if (ref !== previousRef) { assignRef(previousRef, null); assignRef(ref, element.current); } }); } previousRefsRef.current = refs; }, refs); // No dependencies, must be reset after every render so ref callbacks are // correctly called after a ref change. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { didElementChangeRef.current = false; }); // There should be no dependencies so that `callback` is only called when // the node changes. return (0,external_wp_element_namespaceObject.useCallback)(value => { // Update the element so it can be used when calling ref callbacks on a // dependency change. assignRef(element, value); didElementChangeRef.current = true; isAttachedRef.current = value !== null; // When an element changes, the current ref callback should be called // with the new element and the previous one with `null`. const refsToAssign = value ? currentRefsRef.current : previousRefsRef.current; // Update the latest refs. for (const ref of refsToAssign) { assignRef(ref, value); } }, []); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-dialog/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns a ref and props to apply to a dialog wrapper to enable the following behaviors: * - constrained tabbing. * - focus on mount. * - return focus on unmount. * - focus outside. * * @param options Dialog Options. */ function useDialog(options) { const currentOptions = (0,external_wp_element_namespaceObject.useRef)(); const { constrainTabbing = options.focusOnMount !== false } = options; (0,external_wp_element_namespaceObject.useEffect)(() => { currentOptions.current = options; }, Object.values(options)); const constrainedTabbingRef = use_constrained_tabbing(); const focusOnMountRef = useFocusOnMount(options.focusOnMount); const focusReturnRef = use_focus_return(); const focusOutsideProps = useFocusOutside(event => { // This unstable prop is here only to manage backward compatibility // for the Popover component otherwise, the onClose should be enough. if (currentOptions.current?.__unstableOnClose) { currentOptions.current.__unstableOnClose('focus-outside', event); } else if (currentOptions.current?.onClose) { currentOptions.current.onClose(); } }); const closeOnEscapeRef = (0,external_wp_element_namespaceObject.useCallback)(node => { if (!node) { return; } node.addEventListener('keydown', event => { // Close on escape. if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented && currentOptions.current?.onClose) { event.preventDefault(); currentOptions.current.onClose(); } }); }, []); return [useMergeRefs([constrainTabbing ? constrainedTabbingRef : null, options.focusOnMount !== false ? focusReturnRef : null, options.focusOnMount !== false ? focusOnMountRef : null, closeOnEscapeRef]), { ...focusOutsideProps, tabIndex: -1 }]; } /* harmony default export */ const use_dialog = (useDialog); ;// ./node_modules/@wordpress/compose/build-module/hooks/use-disabled/index.js /** * Internal dependencies */ /** * In some circumstances, such as block previews, all focusable DOM elements * (input fields, links, buttons, etc.) need to be disabled. This hook adds the * behavior to disable nested DOM elements to the returned ref. * * If you can, prefer the use of the inert HTML attribute. * * @param {Object} config Configuration object. * @param {boolean=} config.isDisabled Whether the element should be disabled. * @return {import('react').RefCallback} Element Ref. * * @example * ```js * import { useDisabled } from '@wordpress/compose'; * * const DisabledExample = () => { * const disabledRef = useDisabled(); * return ( * * ); * }; * ``` */ function useDisabled({ isDisabled: isDisabledProp = false } = {}) { return useRefEffect(node => { if (isDisabledProp) { return; } const defaultView = node?.ownerDocument?.defaultView; if (!defaultView) { return; } /** A variable keeping track of the previous updates in order to restore them. */ const updates = []; const disable = () => { node.childNodes.forEach(child => { if (!(child instanceof defaultView.HTMLElement)) { return; } if (!child.getAttribute('inert')) { child.setAttribute('inert', 'true'); updates.push(() => { child.removeAttribute('inert'); }); } }); }; // Debounce re-disable since disabling process itself will incur // additional mutations which should be ignored. const debouncedDisable = debounce(disable, 0, { leading: true }); disable(); /** @type {MutationObserver | undefined} */ const observer = new window.MutationObserver(debouncedDisable); observer.observe(node, { childList: true }); return () => { if (observer) { observer.disconnect(); } debouncedDisable.cancel(); updates.forEach(update => update()); }; }, [isDisabledProp]); } ;// ./node_modules/@wordpress/compose/build-module/hooks/use-event/index.js /** * WordPress dependencies */ /** * Any function. */ /** * Creates a stable callback function that has access to the latest state and * can be used within event handlers and effect callbacks. Throws when used in * the render phase. * * @param callback The callback function to wrap. * * @example * * ```tsx * function Component( props ) { * const onClick = useEvent( props.onClick ); * useEffect( () => { * onClick(); * // Won't trigger the effect again when props.onClick is updated. * }, [ onClick ] ); * // Won't re-render Button when props.onClick is updated (if `Button` is * // wrapped in `React.memo`). * return * ); * }; * ``` * * @return {WPBlockType | undefined} The previous block value, if it has been successfully * unregistered; otherwise `undefined`. */ function unregisterBlockType(name) { const oldBlock = (0,external_wp_data_namespaceObject.select)(store).getBlockType(name); if (!oldBlock) { true ? external_wp_warning_default()('Block "' + name + '" is not registered.') : 0; return; } (0,external_wp_data_namespaceObject.dispatch)(store).removeBlockTypes(name); return oldBlock; } /** * Assigns name of block for handling non-block content. * * @param {string} blockName Block name. */ function setFreeformContentHandlerName(blockName) { (0,external_wp_data_namespaceObject.dispatch)(store).setFreeformFallbackBlockName(blockName); } /** * Retrieves name of block handling non-block content, or undefined if no * handler has been defined. * * @return {?string} Block name. */ function getFreeformContentHandlerName() { return (0,external_wp_data_namespaceObject.select)(store).getFreeformFallbackBlockName(); } /** * Retrieves name of block used for handling grouping interactions. * * @return {?string} Block name. */ function getGroupingBlockName() { return (0,external_wp_data_namespaceObject.select)(store).getGroupingBlockName(); } /** * Assigns name of block handling unregistered block types. * * @param {string} blockName Block name. */ function setUnregisteredTypeHandlerName(blockName) { (0,external_wp_data_namespaceObject.dispatch)(store).setUnregisteredFallbackBlockName(blockName); } /** * Retrieves name of block handling unregistered block types, or undefined if no * handler has been defined. * * @return {?string} Block name. */ function getUnregisteredTypeHandlerName() { return (0,external_wp_data_namespaceObject.select)(store).getUnregisteredFallbackBlockName(); } /** * Assigns the default block name. * * @param {string} name Block name. * * @example * ```js * import { setDefaultBlockName } from '@wordpress/blocks'; * * const ExampleComponent = () => { * * return ( * * ); * }; * ``` */ function setDefaultBlockName(name) { (0,external_wp_data_namespaceObject.dispatch)(store).setDefaultBlockName(name); } /** * Assigns name of block for handling block grouping interactions. * * This function lets you select a different block to group other blocks in instead of the * default `core/group` block. This function must be used in a component or when the DOM is fully * loaded. See https://developer.wordpress.org/block-editor/reference-guides/packages/packages-dom-ready/ * * @param {string} name Block name. * * @example * ```js * import { setGroupingBlockName } from '@wordpress/blocks'; * * const ExampleComponent = () => { * * return ( * * ); * }; * ``` */ function setGroupingBlockName(name) { (0,external_wp_data_namespaceObject.dispatch)(store).setGroupingBlockName(name); } /** * Retrieves the default block name. * * @return {?string} Block name. */ function getDefaultBlockName() { return (0,external_wp_data_namespaceObject.select)(store).getDefaultBlockName(); } /** * Returns a registered block type. * * @param {string} name Block name. * * @return {?Object} Block type. */ function getBlockType(name) { return (0,external_wp_data_namespaceObject.select)(store)?.getBlockType(name); } /** * Returns all registered blocks. * * @return {Array} Block settings. */ function getBlockTypes() { return (0,external_wp_data_namespaceObject.select)(store).getBlockTypes(); } /** * Returns the block support value for a feature, if defined. * * @param {(string|Object)} nameOrType Block name or type object * @param {string} feature Feature to retrieve * @param {*} defaultSupports Default value to return if not * explicitly defined * * @return {?*} Block support value */ function getBlockSupport(nameOrType, feature, defaultSupports) { return (0,external_wp_data_namespaceObject.select)(store).getBlockSupport(nameOrType, feature, defaultSupports); } /** * Returns true if the block defines support for a feature, or false otherwise. * * @param {(string|Object)} nameOrType Block name or type object. * @param {string} feature Feature to test. * @param {boolean} defaultSupports Whether feature is supported by * default if not explicitly defined. * * @return {boolean} Whether block supports feature. */ function hasBlockSupport(nameOrType, feature, defaultSupports) { return (0,external_wp_data_namespaceObject.select)(store).hasBlockSupport(nameOrType, feature, defaultSupports); } /** * Determines whether or not the given block is a reusable block. This is a * special block type that is used to point to a global block stored via the * API. * * @param {Object} blockOrType Block or Block Type to test. * * @return {boolean} Whether the given block is a reusable block. */ function isReusableBlock(blockOrType) { return blockOrType?.name === 'core/block'; } /** * Determines whether or not the given block is a template part. This is a * special block type that allows composing a page template out of reusable * design elements. * * @param {Object} blockOrType Block or Block Type to test. * * @return {boolean} Whether the given block is a template part. */ function isTemplatePart(blockOrType) { return blockOrType?.name === 'core/template-part'; } /** * Returns an array with the child blocks of a given block. * * @param {string} blockName Name of block (example: “latest-posts”). * * @return {Array} Array of child block names. */ const getChildBlockNames = blockName => { return (0,external_wp_data_namespaceObject.select)(store).getChildBlockNames(blockName); }; /** * Returns a boolean indicating if a block has child blocks or not. * * @param {string} blockName Name of block (example: “latest-posts”). * * @return {boolean} True if a block contains child blocks and false otherwise. */ const hasChildBlocks = blockName => { return (0,external_wp_data_namespaceObject.select)(store).hasChildBlocks(blockName); }; /** * Returns a boolean indicating if a block has at least one child block with inserter support. * * @param {string} blockName Block type name. * * @return {boolean} True if a block contains at least one child blocks with inserter support * and false otherwise. */ const hasChildBlocksWithInserterSupport = blockName => { return (0,external_wp_data_namespaceObject.select)(store).hasChildBlocksWithInserterSupport(blockName); }; /** * Registers a new block style for the given block types. * * For more information on connecting the styles with CSS * [the official documentation](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/#styles). * * @param {string|Array} blockNames Name of blocks e.g. “core/latest-posts” or `["core/group", "core/columns"]`. * @param {Object} styleVariation Object containing `name` which is the class name applied to the block and `label` which identifies the variation to the user. * * @example * ```js * import { __ } from '@wordpress/i18n'; * import { registerBlockStyle } from '@wordpress/blocks'; * import { Button } from '@wordpress/components'; * * * const ExampleComponent = () => { * return ( * * ); * }; * ``` */ const registerBlockStyle = (blockNames, styleVariation) => { (0,external_wp_data_namespaceObject.dispatch)(store).addBlockStyles(blockNames, styleVariation); }; /** * Unregisters a block style for the given block. * * @param {string} blockName Name of block (example: “core/latest-posts”). * @param {string} styleVariationName Name of class applied to the block. * * @example * ```js * import { __ } from '@wordpress/i18n'; * import { unregisterBlockStyle } from '@wordpress/blocks'; * import { Button } from '@wordpress/components'; * * const ExampleComponent = () => { * return ( * * ); * }; * ``` */ const unregisterBlockStyle = (blockName, styleVariationName) => { (0,external_wp_data_namespaceObject.dispatch)(store).removeBlockStyles(blockName, styleVariationName); }; /** * Returns an array with the variations of a given block type. * Ignored from documentation as the recommended usage is via useSelect from @wordpress/data. * * @ignore * * @param {string} blockName Name of block (example: “core/columns”). * @param {WPBlockVariationScope} [scope] Block variation scope name. * * @return {(WPBlockVariation[]|void)} Block variations. */ const getBlockVariations = (blockName, scope) => { return (0,external_wp_data_namespaceObject.select)(store).getBlockVariations(blockName, scope); }; /** * Registers a new block variation for the given block type. * * For more information on block variations see * [the official documentation ](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-variations/). * * @param {string} blockName Name of the block (example: “core/columns”). * @param {WPBlockVariation} variation Object describing a block variation. * * @example * ```js * import { __ } from '@wordpress/i18n'; * import { registerBlockVariation } from '@wordpress/blocks'; * import { Button } from '@wordpress/components'; * * const ExampleComponent = () => { * return ( * * ); * }; * ``` */ const registerBlockVariation = (blockName, variation) => { if (typeof variation.name !== 'string') { true ? external_wp_warning_default()('Variation names must be unique strings.') : 0; } (0,external_wp_data_namespaceObject.dispatch)(store).addBlockVariations(blockName, variation); }; /** * Unregisters a block variation defined for the given block type. * * @param {string} blockName Name of the block (example: “core/columns”). * @param {string} variationName Name of the variation defined for the block. * * @example * ```js * import { __ } from '@wordpress/i18n'; * import { unregisterBlockVariation } from '@wordpress/blocks'; * import { Button } from '@wordpress/components'; * * const ExampleComponent = () => { * return ( * * ); * }; * ``` */ const unregisterBlockVariation = (blockName, variationName) => { (0,external_wp_data_namespaceObject.dispatch)(store).removeBlockVariations(blockName, variationName); }; /** * Registers a new block bindings source with an object defining its * behavior. Once registered, the source is available to be connected * to the supported block attributes. * * @since 6.7.0 Introduced in WordPress core. * * @param {Object} source Properties of the source to be registered. * @param {string} source.name The unique and machine-readable name. * @param {string} [source.label] Human-readable label. Optional when it is defined in the server. * @param {Array} [source.usesContext] Optional array of context needed by the source only in the editor. * @param {Function} [source.getValues] Optional function to get the values from the source. * @param {Function} [source.setValues] Optional function to update multiple values connected to the source. * @param {Function} [source.canUserEditValue] Optional function to determine if the user can edit the value. * * @example * ```js * import { _x } from '@wordpress/i18n'; * import { registerBlockBindingsSource } from '@wordpress/blocks' * * registerBlockBindingsSource( { * name: 'plugin/my-custom-source', * label: _x( 'My Custom Source', 'block bindings source' ), * usesContext: [ 'postType' ], * getValues: getSourceValues, * setValues: updateMyCustomValuesInBatch, * canUserEditValue: () => true, * } ); * ``` */ const registerBlockBindingsSource = source => { const { name, label, usesContext, getValues, setValues, canUserEditValue, getFieldsList } = source; const existingSource = unlock((0,external_wp_data_namespaceObject.select)(store)).getBlockBindingsSource(name); /* * Check if the source has been already registered on the client. * If any property expected to be "client-only" is defined, return a warning. */ const serverProps = ['label', 'usesContext']; for (const prop in existingSource) { if (!serverProps.includes(prop) && existingSource[prop]) { true ? external_wp_warning_default()('Block bindings source "' + name + '" is already registered.') : 0; return; } } // Check the `name` property is correct. if (!name) { true ? external_wp_warning_default()('Block bindings source must contain a name.') : 0; return; } if (typeof name !== 'string') { true ? external_wp_warning_default()('Block bindings source name must be a string.') : 0; return; } if (/[A-Z]+/.test(name)) { true ? external_wp_warning_default()('Block bindings source name must not contain uppercase characters.') : 0; return; } if (!/^[a-z0-9/-]+$/.test(name)) { true ? external_wp_warning_default()('Block bindings source name must contain only valid characters: lowercase characters, hyphens, or digits. Example: my-plugin/my-custom-source.') : 0; return; } if (!/^[a-z0-9-]+\/[a-z0-9-]+$/.test(name)) { true ? external_wp_warning_default()('Block bindings source name must contain a namespace and valid characters. Example: my-plugin/my-custom-source.') : 0; return; } // Check the `label` property is correct. if (!label && !existingSource?.label) { true ? external_wp_warning_default()('Block bindings source must contain a label.') : 0; return; } if (label && typeof label !== 'string') { true ? external_wp_warning_default()('Block bindings source label must be a string.') : 0; return; } if (label && existingSource?.label && label !== existingSource?.label) { true ? external_wp_warning_default()('Block bindings "' + name + '" source label was overridden.') : 0; } // Check the `usesContext` property is correct. if (usesContext && !Array.isArray(usesContext)) { true ? external_wp_warning_default()('Block bindings source usesContext must be an array.') : 0; return; } // Check the `getValues` property is correct. if (getValues && typeof getValues !== 'function') { true ? external_wp_warning_default()('Block bindings source getValues must be a function.') : 0; return; } // Check the `setValues` property is correct. if (setValues && typeof setValues !== 'function') { true ? external_wp_warning_default()('Block bindings source setValues must be a function.') : 0; return; } // Check the `canUserEditValue` property is correct. if (canUserEditValue && typeof canUserEditValue !== 'function') { true ? external_wp_warning_default()('Block bindings source canUserEditValue must be a function.') : 0; return; } // Check the `getFieldsList` property is correct. if (getFieldsList && typeof getFieldsList !== 'function') { // eslint-disable-next-line no-console true ? external_wp_warning_default()('Block bindings source getFieldsList must be a function.') : 0; return; } return unlock((0,external_wp_data_namespaceObject.dispatch)(store)).addBlockBindingsSource(source); }; /** * Unregisters a block bindings source by providing its name. * * @since 6.7.0 Introduced in WordPress core. * * @param {string} name The name of the block bindings source to unregister. * * @example * ```js * import { unregisterBlockBindingsSource } from '@wordpress/blocks'; * * unregisterBlockBindingsSource( 'plugin/my-custom-source' ); * ``` */ function unregisterBlockBindingsSource(name) { const oldSource = getBlockBindingsSource(name); if (!oldSource) { true ? external_wp_warning_default()('Block bindings source "' + name + '" is not registered.') : 0; return; } unlock((0,external_wp_data_namespaceObject.dispatch)(store)).removeBlockBindingsSource(name); } /** * Returns a registered block bindings source by its name. * * @since 6.7.0 Introduced in WordPress core. * * @param {string} name Block bindings source name. * * @return {?Object} Block bindings source. */ function getBlockBindingsSource(name) { return unlock((0,external_wp_data_namespaceObject.select)(store)).getBlockBindingsSource(name); } /** * Returns all registered block bindings sources. * * @since 6.7.0 Introduced in WordPress core. * * @return {Array} Block bindings sources. */ function getBlockBindingsSources() { return unlock((0,external_wp_data_namespaceObject.select)(store)).getAllBlockBindingsSources(); } ;// ./node_modules/@wordpress/blocks/build-module/api/utils.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ k([names, a11y]); /** * Array of icon colors containing a color to be used if the icon color * was not explicitly set but the icon background color was. * * @type {Object} */ const ICON_COLORS = ['#191e23', '#f8f9f9']; /** * Determines whether the block's attributes are equal to the default attributes * which means the block is unmodified. * * @param {WPBlock} block Block Object * * @return {boolean} Whether the block is an unmodified block. */ function isUnmodifiedBlock(block) { var _getBlockType$attribu; return Object.entries((_getBlockType$attribu = getBlockType(block.name)?.attributes) !== null && _getBlockType$attribu !== void 0 ? _getBlockType$attribu : {}).every(([key, definition]) => { const value = block.attributes[key]; // Every attribute that has a default must match the default. if (definition.hasOwnProperty('default')) { return value === definition.default; } // The rich text type is a bit different from the rest because it // has an implicit default value of an empty RichTextData instance, // so check the length of the value. if (definition.type === 'rich-text') { return !value?.length; } // Every attribute that doesn't have a default should be undefined. return value === undefined; }); } /** * Determines whether the block is a default block and its attributes are equal * to the default attributes which means the block is unmodified. * * @param {WPBlock} block Block Object * * @return {boolean} Whether the block is an unmodified default block. */ function isUnmodifiedDefaultBlock(block) { return block.name === getDefaultBlockName() && isUnmodifiedBlock(block); } /** * Function that checks if the parameter is a valid icon. * * @param {*} icon Parameter to be checked. * * @return {boolean} True if the parameter is a valid icon and false otherwise. */ function isValidIcon(icon) { return !!icon && (typeof icon === 'string' || (0,external_wp_element_namespaceObject.isValidElement)(icon) || typeof icon === 'function' || icon instanceof external_wp_element_namespaceObject.Component); } /** * Function that receives an icon as set by the blocks during the registration * and returns a new icon object that is normalized so we can rely on just on possible icon structure * in the codebase. * * @param {WPBlockTypeIconRender} icon Render behavior of a block type icon; * one of a Dashicon slug, an element, or a * component. * * @return {WPBlockTypeIconDescriptor} Object describing the icon. */ function normalizeIconObject(icon) { icon = icon || BLOCK_ICON_DEFAULT; if (isValidIcon(icon)) { return { src: icon }; } if ('background' in icon) { const colordBgColor = w(icon.background); const getColorContrast = iconColor => colordBgColor.contrast(iconColor); const maxContrast = Math.max(...ICON_COLORS.map(getColorContrast)); return { ...icon, foreground: icon.foreground ? icon.foreground : ICON_COLORS.find(iconColor => getColorContrast(iconColor) === maxContrast), shadowColor: colordBgColor.alpha(0.3).toRgbString() }; } return icon; } /** * Normalizes block type passed as param. When string is passed then * it converts it to the matching block type object. * It passes the original object otherwise. * * @param {string|Object} blockTypeOrName Block type or name. * * @return {?Object} Block type. */ function normalizeBlockType(blockTypeOrName) { if (typeof blockTypeOrName === 'string') { return getBlockType(blockTypeOrName); } return blockTypeOrName; } /** * Get the label for the block, usually this is either the block title, * or the value of the block's `label` function when that's specified. * * @param {Object} blockType The block type. * @param {Object} attributes The values of the block's attributes. * @param {Object} context The intended use for the label. * * @return {string} The block label. */ function getBlockLabel(blockType, attributes, context = 'visual') { const { __experimentalLabel: getLabel, title } = blockType; const label = getLabel && getLabel(attributes, { context }); if (!label) { return title; } if (label.toPlainText) { return label.toPlainText(); } // Strip any HTML (i.e. RichText formatting) before returning. return (0,external_wp_dom_namespaceObject.__unstableStripHTML)(label); } /** * Get a label for the block for use by screenreaders, this is more descriptive * than the visual label and includes the block title and the value of the * `getLabel` function if it's specified. * * @param {?Object} blockType The block type. * @param {Object} attributes The values of the block's attributes. * @param {?number} position The position of the block in the block list. * @param {string} [direction='vertical'] The direction of the block layout. * * @return {string} The block label. */ function getAccessibleBlockLabel(blockType, attributes, position, direction = 'vertical') { // `title` is already localized, `label` is a user-supplied value. const title = blockType?.title; const label = blockType ? getBlockLabel(blockType, attributes, 'accessibility') : ''; const hasPosition = position !== undefined; // getBlockLabel returns the block title as a fallback when there's no label, // if it did return the title, this function needs to avoid adding the // title twice within the accessible label. Use this `hasLabel` boolean to // handle that. const hasLabel = label && label !== title; if (hasPosition && direction === 'vertical') { if (hasLabel) { return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */ (0,external_wp_i18n_namespaceObject.__)('%1$s Block. Row %2$d. %3$s'), title, position, label); } return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: accessibility text. 1: The block title. 2: The block row number. */ (0,external_wp_i18n_namespaceObject.__)('%1$s Block. Row %2$d'), title, position); } else if (hasPosition && direction === 'horizontal') { if (hasLabel) { return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */ (0,external_wp_i18n_namespaceObject.__)('%1$s Block. Column %2$d. %3$s'), title, position, label); } return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: accessibility text. 1: The block title. 2: The block column number. */ (0,external_wp_i18n_namespaceObject.__)('%1$s Block. Column %2$d'), title, position); } if (hasLabel) { return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: accessibility text. %1: The block title. %2: The block label. */ (0,external_wp_i18n_namespaceObject.__)('%1$s Block. %2$s'), title, label); } return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: accessibility text. %s: The block title. */ (0,external_wp_i18n_namespaceObject.__)('%s Block'), title); } function getDefault(attributeSchema) { if (attributeSchema.default !== undefined) { return attributeSchema.default; } if (attributeSchema.type === 'rich-text') { return new external_wp_richText_namespaceObject.RichTextData(); } } /** * Check if a block is registered. * * @param {string} name The block's name. * * @return {boolean} Whether the block is registered. */ function isBlockRegistered(name) { return getBlockType(name) !== undefined; } /** * Ensure attributes contains only values defined by block type, and merge * default values for missing attributes. * * @param {string} name The block's name. * @param {Object} attributes The block's attributes. * @return {Object} The sanitized attributes. */ function __experimentalSanitizeBlockAttributes(name, attributes) { // Get the type definition associated with a registered block. const blockType = getBlockType(name); if (undefined === blockType) { throw new Error(`Block type '${name}' is not registered.`); } return Object.entries(blockType.attributes).reduce((accumulator, [key, schema]) => { const value = attributes[key]; if (undefined !== value) { if (schema.type === 'rich-text') { if (value instanceof external_wp_richText_namespaceObject.RichTextData) { accumulator[key] = value; } else if (typeof value === 'string') { accumulator[key] = external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value); } } else if (schema.type === 'string' && value instanceof external_wp_richText_namespaceObject.RichTextData) { accumulator[key] = value.toHTMLString(); } else { accumulator[key] = value; } } else { const _default = getDefault(schema); if (undefined !== _default) { accumulator[key] = _default; } } if (['node', 'children'].indexOf(schema.source) !== -1) { // Ensure value passed is always an array, which we're expecting in // the RichText component to handle the deprecated value. if (typeof accumulator[key] === 'string') { accumulator[key] = [accumulator[key]]; } else if (!Array.isArray(accumulator[key])) { accumulator[key] = []; } } return accumulator; }, {}); } /** * Filter block attributes by `role` and return their names. * * @param {string} name Block attribute's name. * @param {string} role The role of a block attribute. * * @return {string[]} The attribute names that have the provided role. */ function getBlockAttributesNamesByRole(name, role) { const attributes = getBlockType(name)?.attributes; if (!attributes) { return []; } const attributesNames = Object.keys(attributes); if (!role) { return attributesNames; } return attributesNames.filter(attributeName => { const attribute = attributes[attributeName]; if (attribute?.role === role) { return true; } if (attribute?.__experimentalRole === role) { external_wp_deprecated_default()('__experimentalRole attribute', { since: '6.7', version: '6.8', alternative: 'role attribute', hint: `Check the block.json of the ${name} block.` }); return true; } return false; }); } const __experimentalGetBlockAttributesNamesByRole = (...args) => { external_wp_deprecated_default()('__experimentalGetBlockAttributesNamesByRole', { since: '6.7', version: '6.8', alternative: 'getBlockAttributesNamesByRole' }); return getBlockAttributesNamesByRole(...args); }; /** * Checks if a block is a content block by examining its attributes. * A block is considered a content block if it has at least one attribute * with a role of 'content'. * * @param {string} name The name of the block to check. * @return {boolean} Whether the block is a content block. */ function isContentBlock(name) { const attributes = getBlockType(name)?.attributes; if (!attributes) { return false; } return !!Object.keys(attributes)?.some(attributeKey => { const attribute = attributes[attributeKey]; return attribute?.role === 'content' || attribute?.__experimentalRole === 'content'; }); } /** * Return a new object with the specified keys omitted. * * @param {Object} object Original object. * @param {Array} keys Keys to be omitted. * * @return {Object} Object with omitted keys. */ function omit(object, keys) { return Object.fromEntries(Object.entries(object).filter(([key]) => !keys.includes(key))); } ;// ./node_modules/@wordpress/blocks/build-module/store/reducer.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * @typedef {Object} WPBlockCategory * * @property {string} slug Unique category slug. * @property {string} title Category label, for display in user interface. */ /** * Default set of categories. * * @type {WPBlockCategory[]} */ const DEFAULT_CATEGORIES = [{ slug: 'text', title: (0,external_wp_i18n_namespaceObject.__)('Text') }, { slug: 'media', title: (0,external_wp_i18n_namespaceObject.__)('Media') }, { slug: 'design', title: (0,external_wp_i18n_namespaceObject.__)('Design') }, { slug: 'widgets', title: (0,external_wp_i18n_namespaceObject.__)('Widgets') }, { slug: 'theme', title: (0,external_wp_i18n_namespaceObject.__)('Theme') }, { slug: 'embed', title: (0,external_wp_i18n_namespaceObject.__)('Embeds') }, { slug: 'reusable', title: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks') }]; // Key block types by their name. function keyBlockTypesByName(types) { return types.reduce((newBlockTypes, block) => ({ ...newBlockTypes, [block.name]: block }), {}); } // Filter items to ensure they're unique by their name. function getUniqueItemsByName(items) { return items.reduce((acc, currentItem) => { if (!acc.some(item => item.name === currentItem.name)) { acc.push(currentItem); } return acc; }, []); } function bootstrappedBlockTypes(state = {}, action) { switch (action.type) { case 'ADD_BOOTSTRAPPED_BLOCK_TYPE': const { name, blockType } = action; const serverDefinition = state[name]; let newDefinition; // Don't overwrite if already set. It covers the case when metadata // was initialized from the server. if (serverDefinition) { // The `blockHooks` prop is not yet included in the server provided // definitions and needs to be polyfilled. This can be removed when the // minimum supported WordPress is >= 6.4. if (serverDefinition.blockHooks === undefined && blockType.blockHooks) { newDefinition = { ...serverDefinition, ...newDefinition, blockHooks: blockType.blockHooks }; } // The `allowedBlocks` prop is not yet included in the server provided // definitions and needs to be polyfilled. This can be removed when the // minimum supported WordPress is >= 6.5. if (serverDefinition.allowedBlocks === undefined && blockType.allowedBlocks) { newDefinition = { ...serverDefinition, ...newDefinition, allowedBlocks: blockType.allowedBlocks }; } } else { newDefinition = Object.fromEntries(Object.entries(blockType).filter(([, value]) => value !== null && value !== undefined).map(([key, value]) => [camelCase(key), value])); newDefinition.name = name; } if (newDefinition) { return { ...state, [name]: newDefinition }; } return state; case 'REMOVE_BLOCK_TYPES': return omit(state, action.names); } return state; } /** * Reducer managing the unprocessed block types in a form passed when registering the by block. * It's for internal use only. It allows recomputing the processed block types on-demand after block type filters * get added or removed. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function unprocessedBlockTypes(state = {}, action) { switch (action.type) { case 'ADD_UNPROCESSED_BLOCK_TYPE': return { ...state, [action.name]: action.blockType }; case 'REMOVE_BLOCK_TYPES': return omit(state, action.names); } return state; } /** * Reducer managing the processed block types with all filters applied. * The state is derived from the `unprocessedBlockTypes` reducer. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function blockTypes(state = {}, action) { switch (action.type) { case 'ADD_BLOCK_TYPES': return { ...state, ...keyBlockTypesByName(action.blockTypes) }; case 'REMOVE_BLOCK_TYPES': return omit(state, action.names); } return state; } /** * Reducer managing the block styles. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function blockStyles(state = {}, action) { var _state$action$blockNa; switch (action.type) { case 'ADD_BLOCK_TYPES': return { ...state, ...Object.fromEntries(Object.entries(keyBlockTypesByName(action.blockTypes)).map(([name, blockType]) => { var _blockType$styles, _state$blockType$name; return [name, getUniqueItemsByName([...((_blockType$styles = blockType.styles) !== null && _blockType$styles !== void 0 ? _blockType$styles : []).map(style => ({ ...style, source: 'block' })), ...((_state$blockType$name = state[blockType.name]) !== null && _state$blockType$name !== void 0 ? _state$blockType$name : []).filter(({ source }) => 'block' !== source)])]; })) }; case 'ADD_BLOCK_STYLES': const updatedStyles = {}; action.blockNames.forEach(blockName => { var _state$blockName; updatedStyles[blockName] = getUniqueItemsByName([...((_state$blockName = state[blockName]) !== null && _state$blockName !== void 0 ? _state$blockName : []), ...action.styles]); }); return { ...state, ...updatedStyles }; case 'REMOVE_BLOCK_STYLES': return { ...state, [action.blockName]: ((_state$action$blockNa = state[action.blockName]) !== null && _state$action$blockNa !== void 0 ? _state$action$blockNa : []).filter(style => action.styleNames.indexOf(style.name) === -1) }; } return state; } /** * Reducer managing the block variations. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function blockVariations(state = {}, action) { var _state$action$blockNa2, _state$action$blockNa3; switch (action.type) { case 'ADD_BLOCK_TYPES': return { ...state, ...Object.fromEntries(Object.entries(keyBlockTypesByName(action.blockTypes)).map(([name, blockType]) => { var _blockType$variations, _state$blockType$name2; return [name, getUniqueItemsByName([...((_blockType$variations = blockType.variations) !== null && _blockType$variations !== void 0 ? _blockType$variations : []).map(variation => ({ ...variation, source: 'block' })), ...((_state$blockType$name2 = state[blockType.name]) !== null && _state$blockType$name2 !== void 0 ? _state$blockType$name2 : []).filter(({ source }) => 'block' !== source)])]; })) }; case 'ADD_BLOCK_VARIATIONS': return { ...state, [action.blockName]: getUniqueItemsByName([...((_state$action$blockNa2 = state[action.blockName]) !== null && _state$action$blockNa2 !== void 0 ? _state$action$blockNa2 : []), ...action.variations]) }; case 'REMOVE_BLOCK_VARIATIONS': return { ...state, [action.blockName]: ((_state$action$blockNa3 = state[action.blockName]) !== null && _state$action$blockNa3 !== void 0 ? _state$action$blockNa3 : []).filter(variation => action.variationNames.indexOf(variation.name) === -1) }; } return state; } /** * Higher-order Reducer creating a reducer keeping track of given block name. * * @param {string} setActionType Action type. * * @return {Function} Reducer. */ function createBlockNameSetterReducer(setActionType) { return (state = null, action) => { switch (action.type) { case 'REMOVE_BLOCK_TYPES': if (action.names.indexOf(state) !== -1) { return null; } return state; case setActionType: return action.name || null; } return state; }; } const defaultBlockName = createBlockNameSetterReducer('SET_DEFAULT_BLOCK_NAME'); const freeformFallbackBlockName = createBlockNameSetterReducer('SET_FREEFORM_FALLBACK_BLOCK_NAME'); const unregisteredFallbackBlockName = createBlockNameSetterReducer('SET_UNREGISTERED_FALLBACK_BLOCK_NAME'); const groupingBlockName = createBlockNameSetterReducer('SET_GROUPING_BLOCK_NAME'); /** * Reducer managing the categories * * @param {WPBlockCategory[]} state Current state. * @param {Object} action Dispatched action. * * @return {WPBlockCategory[]} Updated state. */ function categories(state = DEFAULT_CATEGORIES, action) { switch (action.type) { case 'SET_CATEGORIES': // Ensure, that categories are unique by slug. const uniqueCategories = new Map(); (action.categories || []).forEach(category => { uniqueCategories.set(category.slug, category); }); return [...uniqueCategories.values()]; case 'UPDATE_CATEGORY': { if (!action.category || !Object.keys(action.category).length) { return state; } const categoryToChange = state.find(({ slug }) => slug === action.slug); if (categoryToChange) { return state.map(category => { if (category.slug === action.slug) { return { ...category, ...action.category }; } return category; }); } } } return state; } function collections(state = {}, action) { switch (action.type) { case 'ADD_BLOCK_COLLECTION': return { ...state, [action.namespace]: { title: action.title, icon: action.icon } }; case 'REMOVE_BLOCK_COLLECTION': return omit(state, action.namespace); } return state; } /** * Merges usesContext with existing values, potentially defined in the server registration. * * @param {string[]} existingUsesContext Existing `usesContext`. * @param {string[]} newUsesContext Newly added `usesContext`. * @return {string[]|undefined} Merged `usesContext`. */ function getMergedUsesContext(existingUsesContext = [], newUsesContext = []) { const mergedArrays = Array.from(new Set(existingUsesContext.concat(newUsesContext))); return mergedArrays.length > 0 ? mergedArrays : undefined; } function blockBindingsSources(state = {}, action) { switch (action.type) { case 'ADD_BLOCK_BINDINGS_SOURCE': // Only open this API in Gutenberg and for `core/post-meta` for the moment. let getFieldsList; if (false) {} else if (action.name === 'core/post-meta') { getFieldsList = action.getFieldsList; } return { ...state, [action.name]: { label: action.label || state[action.name]?.label, usesContext: getMergedUsesContext(state[action.name]?.usesContext, action.usesContext), getValues: action.getValues, setValues: action.setValues, // Only set `canUserEditValue` if `setValues` is also defined. canUserEditValue: action.setValues && action.canUserEditValue, getFieldsList } }; case 'REMOVE_BLOCK_BINDINGS_SOURCE': return omit(state, action.name); } return state; } /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ bootstrappedBlockTypes, unprocessedBlockTypes, blockTypes, blockStyles, blockVariations, defaultBlockName, freeformFallbackBlockName, unregisteredFallbackBlockName, groupingBlockName, categories, collections, blockBindingsSources })); // EXTERNAL MODULE: ./node_modules/remove-accents/index.js var remove_accents = __webpack_require__(9681); var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); ;// ./node_modules/@wordpress/blocks/build-module/store/utils.js /** * Helper util to return a value from a certain path of the object. * Path is specified as either: * - a string of properties, separated by dots, for example: "x.y". * - an array of properties, for example `[ 'x', 'y' ]`. * You can also specify a default value in case the result is nullish. * * @param {Object} object Input object. * @param {string|Array} path Path to the object property. * @param {*} defaultValue Default value if the value at the specified path is nullish. * @return {*} Value of the object property at the specified path. */ const getValueFromObjectPath = (object, path, defaultValue) => { var _value; const normalizedPath = Array.isArray(path) ? path : path.split('.'); let value = object; normalizedPath.forEach(fieldName => { value = value?.[fieldName]; }); return (_value = value) !== null && _value !== void 0 ? _value : defaultValue; }; function utils_isObject(candidate) { return typeof candidate === 'object' && candidate.constructor === Object && candidate !== null; } /** * Determine whether a set of object properties matches a given object. * * Given an object of block attributes and an object of variation attributes, * this function checks recursively whether all the variation attributes are * present in the block attributes object. * * @param {Object} blockAttributes The object to inspect. * @param {Object} variationAttributes The object of property values to match. * @return {boolean} Whether the block attributes match the variation attributes. */ function matchesAttributes(blockAttributes, variationAttributes) { if (utils_isObject(blockAttributes) && utils_isObject(variationAttributes)) { return Object.entries(variationAttributes).every(([key, value]) => matchesAttributes(blockAttributes?.[key], value)); } return blockAttributes === variationAttributes; } ;// ./node_modules/@wordpress/blocks/build-module/store/private-selectors.js /** * WordPress dependencies */ /** * Internal dependencies */ const ROOT_BLOCK_SUPPORTS = ['background', 'backgroundColor', 'color', 'linkColor', 'captionColor', 'buttonColor', 'headingColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'padding', 'contentSize', 'wideSize', 'blockGap', 'textDecoration', 'textTransform', 'letterSpacing']; /** * Filters the list of supported styles for a given element. * * @param {string[]} blockSupports list of supported styles. * @param {string|undefined} name block name. * @param {string|undefined} element element name. * * @return {string[]} filtered list of supported styles. */ function filterElementBlockSupports(blockSupports, name, element) { return blockSupports.filter(support => { if (support === 'fontSize' && element === 'heading') { return false; } // This is only available for links if (support === 'textDecoration' && !name && element !== 'link') { return false; } // This is only available for heading, button, caption and text if (support === 'textTransform' && !name && !(['heading', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(element) || element === 'button' || element === 'caption' || element === 'text')) { return false; } // This is only available for heading, button, caption and text if (support === 'letterSpacing' && !name && !(['heading', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(element) || element === 'button' || element === 'caption' || element === 'text')) { return false; } // Text columns is only available for blocks. if (support === 'textColumns' && !name) { return false; } return true; }); } /** * Returns the list of supported styles for a given block name and element. */ const getSupportedStyles = (0,external_wp_data_namespaceObject.createSelector)((state, name, element) => { if (!name) { return filterElementBlockSupports(ROOT_BLOCK_SUPPORTS, name, element); } const blockType = selectors_getBlockType(state, name); if (!blockType) { return []; } const supportKeys = []; // Check for blockGap support. // Block spacing support doesn't map directly to a single style property, so needs to be handled separately. if (blockType?.supports?.spacing?.blockGap) { supportKeys.push('blockGap'); } // check for shadow support if (blockType?.supports?.shadow) { supportKeys.push('shadow'); } Object.keys(__EXPERIMENTAL_STYLE_PROPERTY).forEach(styleName => { if (!__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) { return; } // Opting out means that, for certain support keys like background color, // blocks have to explicitly set the support value false. If the key is // unset, we still enable it. if (__EXPERIMENTAL_STYLE_PROPERTY[styleName].requiresOptOut) { if (__EXPERIMENTAL_STYLE_PROPERTY[styleName].support[0] in blockType.supports && getValueFromObjectPath(blockType.supports, __EXPERIMENTAL_STYLE_PROPERTY[styleName].support) !== false) { supportKeys.push(styleName); return; } } if (getValueFromObjectPath(blockType.supports, __EXPERIMENTAL_STYLE_PROPERTY[styleName].support, false)) { supportKeys.push(styleName); } }); return filterElementBlockSupports(supportKeys, name, element); }, (state, name) => [state.blockTypes[name]]); /** * Returns the bootstrapped block type metadata for a give block name. * * @param {Object} state Data state. * @param {string} name Block name. * * @return {Object} Bootstrapped block type metadata for a block. */ function getBootstrappedBlockType(state, name) { return state.bootstrappedBlockTypes[name]; } /** * Returns all the unprocessed (before applying the `registerBlockType` filter) * block type settings as passed during block registration. * * @param {Object} state Data state. * * @return {Array} Unprocessed block type settings for all blocks. */ function getUnprocessedBlockTypes(state) { return state.unprocessedBlockTypes; } /** * Returns all the block bindings sources registered. * * @param {Object} state Data state. * * @return {Object} All the registered sources and their properties. */ function getAllBlockBindingsSources(state) { return state.blockBindingsSources; } /** * Returns a specific block bindings source. * * @param {Object} state Data state. * @param {string} sourceName Name of the source to get. * * @return {Object} The specific block binding source and its properties. */ function private_selectors_getBlockBindingsSource(state, sourceName) { return state.blockBindingsSources[sourceName]; } /** * Determines if any of the block type's attributes have * the content role attribute. * * @param {Object} state Data state. * @param {string} blockTypeName Block type name. * @return {boolean} Whether block type has content role attribute. */ const hasContentRoleAttribute = (state, blockTypeName) => { const blockType = selectors_getBlockType(state, blockTypeName); if (!blockType) { return false; } return Object.values(blockType.attributes).some(({ role, __experimentalRole }) => { if (role === 'content') { return true; } if (__experimentalRole === 'content') { external_wp_deprecated_default()('__experimentalRole attribute', { since: '6.7', version: '6.8', alternative: 'role attribute', hint: `Check the block.json of the ${blockTypeName} block.` }); return true; } return false; }); }; ;// ./node_modules/@wordpress/blocks/build-module/store/selectors.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */ /** @typedef {import('../api/registration').WPBlockVariationScope} WPBlockVariationScope */ /** @typedef {import('./reducer').WPBlockCategory} WPBlockCategory */ /** * Given a block name or block type object, returns the corresponding * normalized block type object. * * @param {Object} state Blocks state. * @param {(string|Object)} nameOrType Block name or type object * * @return {Object} Block type object. */ const getNormalizedBlockType = (state, nameOrType) => 'string' === typeof nameOrType ? selectors_getBlockType(state, nameOrType) : nameOrType; /** * Returns all the available block types. * * @param {Object} state Data state. * * @example * ```js * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const blockTypes = useSelect( * ( select ) => select( blocksStore ).getBlockTypes(), * [] * ); * * return ( *
    * { blockTypes.map( ( block ) => ( *
  • { block.title }
  • * ) ) } *
* ); * }; * ``` * * @return {Array} Block Types. */ const selectors_getBlockTypes = (0,external_wp_data_namespaceObject.createSelector)(state => Object.values(state.blockTypes), state => [state.blockTypes]); /** * Returns a block type by name. * * @param {Object} state Data state. * @param {string} name Block type name. * * @example * ```js * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const paragraphBlock = useSelect( ( select ) => * ( select ) => select( blocksStore ).getBlockType( 'core/paragraph' ), * [] * ); * * return ( *
    * { paragraphBlock && * Object.entries( paragraphBlock.supports ).map( * ( blockSupportsEntry ) => { * const [ propertyName, value ] = blockSupportsEntry; * return ( *
  • { `${ propertyName } : ${ value }` }
  • * ); * } * ) } *
* ); * }; * ``` * * @return {?Object} Block Type. */ function selectors_getBlockType(state, name) { return state.blockTypes[name]; } /** * Returns block styles by block name. * * @param {Object} state Data state. * @param {string} name Block type name. * * @example * ```js * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const buttonBlockStyles = useSelect( ( select ) => * select( blocksStore ).getBlockStyles( 'core/button' ), * [] * ); * * return ( *
    * { buttonBlockStyles && * buttonBlockStyles.map( ( style ) => ( *
  • { style.label }
  • * ) ) } *
* ); * }; * ``` * * @return {Array?} Block Styles. */ function getBlockStyles(state, name) { return state.blockStyles[name]; } /** * Returns block variations by block name. * * @param {Object} state Data state. * @param {string} blockName Block type name. * @param {WPBlockVariationScope} [scope] Block variation scope name. * * @example * ```js * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const socialLinkVariations = useSelect( ( select ) => * select( blocksStore ).getBlockVariations( 'core/social-link' ), * [] * ); * * return ( *
    * { socialLinkVariations && * socialLinkVariations.map( ( variation ) => ( *
  • { variation.title }
  • * ) ) } *
* ); * }; * ``` * * @return {(WPBlockVariation[]|void)} Block variations. */ const selectors_getBlockVariations = (0,external_wp_data_namespaceObject.createSelector)((state, blockName, scope) => { const variations = state.blockVariations[blockName]; if (!variations || !scope) { return variations; } return variations.filter(variation => { // For backward compatibility reasons, variation's scope defaults to // `block` and `inserter` when not set. return (variation.scope || ['block', 'inserter']).includes(scope); }); }, (state, blockName) => [state.blockVariations[blockName]]); /** * Returns the active block variation for a given block based on its attributes. * Variations are determined by their `isActive` property. * Which is either an array of block attribute keys or a function. * * In case of an array of block attribute keys, the `attributes` are compared * to the variation's attributes using strict equality check. * * In case of function type, the function should accept a block's attributes * and the variation's attributes and determines if a variation is active. * A function that accepts a block's attributes and the variation's attributes and determines if a variation is active. * * @param {Object} state Data state. * @param {string} blockName Name of block (example: “core/columns”). * @param {Object} attributes Block attributes used to determine active variation. * @param {WPBlockVariationScope} [scope] Block variation scope name. * * @example * ```js * import { __ } from '@wordpress/i18n'; * import { store as blocksStore } from '@wordpress/blocks'; * import { store as blockEditorStore } from '@wordpress/block-editor'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * // This example assumes that a core/embed block is the first block in the Block Editor. * const activeBlockVariation = useSelect( ( select ) => { * // Retrieve the list of blocks. * const [ firstBlock ] = select( blockEditorStore ).getBlocks() * * // Return the active block variation for the first block. * return select( blocksStore ).getActiveBlockVariation( * firstBlock.name, * firstBlock.attributes * ); * }, [] ); * * return activeBlockVariation && activeBlockVariation.name === 'spotify' ? ( *

{ __( 'Spotify variation' ) }

* ) : ( *

{ __( 'Other variation' ) }

* ); * }; * ``` * * @return {(WPBlockVariation|undefined)} Active block variation. */ function getActiveBlockVariation(state, blockName, attributes, scope) { const variations = selectors_getBlockVariations(state, blockName, scope); if (!variations) { return variations; } const blockType = selectors_getBlockType(state, blockName); const attributeKeys = Object.keys(blockType?.attributes || {}); let match; let maxMatchedAttributes = 0; for (const variation of variations) { if (Array.isArray(variation.isActive)) { const definedAttributes = variation.isActive.filter(attribute => { // We support nested attribute paths, e.g. `layout.type`. // In this case, we need to check if the part before the // first dot is a known attribute. const topLevelAttribute = attribute.split('.')[0]; return attributeKeys.includes(topLevelAttribute); }); const definedAttributesLength = definedAttributes.length; if (definedAttributesLength === 0) { continue; } const isMatch = definedAttributes.every(attribute => { const variationAttributeValue = getValueFromObjectPath(variation.attributes, attribute); if (variationAttributeValue === undefined) { return false; } let blockAttributeValue = getValueFromObjectPath(attributes, attribute); if (blockAttributeValue instanceof external_wp_richText_namespaceObject.RichTextData) { blockAttributeValue = blockAttributeValue.toHTMLString(); } return matchesAttributes(blockAttributeValue, variationAttributeValue); }); if (isMatch && definedAttributesLength > maxMatchedAttributes) { match = variation; maxMatchedAttributes = definedAttributesLength; } } else if (variation.isActive?.(attributes, variation.attributes)) { // If isActive is a function, we cannot know how many attributes it matches. // This means that we cannot compare the specificity of our matches, // and simply return the best match we have found. return match || variation; } } return match; } /** * Returns the default block variation for the given block type. * When there are multiple variations annotated as the default one, * the last added item is picked. This simplifies registering overrides. * When there is no default variation set, it returns the first item. * * @param {Object} state Data state. * @param {string} blockName Block type name. * @param {WPBlockVariationScope} [scope] Block variation scope name. * * @example * ```js * import { __, sprintf } from '@wordpress/i18n'; * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const defaultEmbedBlockVariation = useSelect( ( select ) => * select( blocksStore ).getDefaultBlockVariation( 'core/embed' ), * [] * ); * * return ( * defaultEmbedBlockVariation && ( *

* { sprintf( * __( 'core/embed default variation: %s' ), * defaultEmbedBlockVariation.title * ) } *

* ) * ); * }; * ``` * * @return {?WPBlockVariation} The default block variation. */ function getDefaultBlockVariation(state, blockName, scope) { const variations = selectors_getBlockVariations(state, blockName, scope); const defaultVariation = [...variations].reverse().find(({ isDefault }) => !!isDefault); return defaultVariation || variations[0]; } /** * Returns all the available block categories. * * @param {Object} state Data state. * * @example * ```js * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect, } from '@wordpress/data'; * * const ExampleComponent = () => { * const blockCategories = useSelect( ( select ) => * select( blocksStore ).getCategories(), * [] * ); * * return ( *
    * { blockCategories.map( ( category ) => ( *
  • { category.title }
  • * ) ) } *
* ); * }; * ``` * * @return {WPBlockCategory[]} Categories list. */ function getCategories(state) { return state.categories; } /** * Returns all the available collections. * * @param {Object} state Data state. * * @example * ```js * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const blockCollections = useSelect( ( select ) => * select( blocksStore ).getCollections(), * [] * ); * * return ( *
    * { Object.values( blockCollections ).length > 0 && * Object.values( blockCollections ).map( ( collection ) => ( *
  • { collection.title }
  • * ) ) } *
* ); * }; * ``` * * @return {Object} Collections list. */ function getCollections(state) { return state.collections; } /** * Returns the name of the default block name. * * @param {Object} state Data state. * * @example * ```js * import { __, sprintf } from '@wordpress/i18n'; * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const defaultBlockName = useSelect( ( select ) => * select( blocksStore ).getDefaultBlockName(), * [] * ); * * return ( * defaultBlockName && ( *

* { sprintf( __( 'Default block name: %s' ), defaultBlockName ) } *

* ) * ); * }; * ``` * * @return {?string} Default block name. */ function selectors_getDefaultBlockName(state) { return state.defaultBlockName; } /** * Returns the name of the block for handling non-block content. * * @param {Object} state Data state. * * @example * ```js * import { __, sprintf } from '@wordpress/i18n'; * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const freeformFallbackBlockName = useSelect( ( select ) => * select( blocksStore ).getFreeformFallbackBlockName(), * [] * ); * * return ( * freeformFallbackBlockName && ( *

* { sprintf( __( * 'Freeform fallback block name: %s' ), * freeformFallbackBlockName * ) } *

* ) * ); * }; * ``` * * @return {?string} Name of the block for handling non-block content. */ function getFreeformFallbackBlockName(state) { return state.freeformFallbackBlockName; } /** * Returns the name of the block for handling unregistered blocks. * * @param {Object} state Data state. * * @example * ```js * import { __, sprintf } from '@wordpress/i18n'; * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const unregisteredFallbackBlockName = useSelect( ( select ) => * select( blocksStore ).getUnregisteredFallbackBlockName(), * [] * ); * * return ( * unregisteredFallbackBlockName && ( *

* { sprintf( __( * 'Unregistered fallback block name: %s' ), * unregisteredFallbackBlockName * ) } *

* ) * ); * }; * ``` * * @return {?string} Name of the block for handling unregistered blocks. */ function getUnregisteredFallbackBlockName(state) { return state.unregisteredFallbackBlockName; } /** * Returns the name of the block for handling the grouping of blocks. * * @param {Object} state Data state. * * @example * ```js * import { __, sprintf } from '@wordpress/i18n'; * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const groupingBlockName = useSelect( ( select ) => * select( blocksStore ).getGroupingBlockName(), * [] * ); * * return ( * groupingBlockName && ( *

* { sprintf( * __( 'Default grouping block name: %s' ), * groupingBlockName * ) } *

* ) * ); * }; * ``` * * @return {?string} Name of the block for handling the grouping of blocks. */ function selectors_getGroupingBlockName(state) { return state.groupingBlockName; } /** * Returns an array with the child blocks of a given block. * * @param {Object} state Data state. * @param {string} blockName Block type name. * * @example * ```js * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const childBlockNames = useSelect( ( select ) => * select( blocksStore ).getChildBlockNames( 'core/navigation' ), * [] * ); * * return ( *
    * { childBlockNames && * childBlockNames.map( ( child ) => ( *
  • { child }
  • * ) ) } *
* ); * }; * ``` * * @return {Array} Array of child block names. */ const selectors_getChildBlockNames = (0,external_wp_data_namespaceObject.createSelector)((state, blockName) => { return selectors_getBlockTypes(state).filter(blockType => { return blockType.parent?.includes(blockName); }).map(({ name }) => name); }, state => [state.blockTypes]); /** * Returns the block support value for a feature, if defined. * * @param {Object} state Data state. * @param {(string|Object)} nameOrType Block name or type object * @param {Array|string} feature Feature to retrieve * @param {*} defaultSupports Default value to return if not * explicitly defined * * @example * ```js * import { __, sprintf } from '@wordpress/i18n'; * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const paragraphBlockSupportValue = useSelect( ( select ) => * select( blocksStore ).getBlockSupport( 'core/paragraph', 'anchor' ), * [] * ); * * return ( *

* { sprintf( * __( 'core/paragraph supports.anchor value: %s' ), * paragraphBlockSupportValue * ) } *

* ); * }; * ``` * * @return {?*} Block support value */ const selectors_getBlockSupport = (state, nameOrType, feature, defaultSupports) => { const blockType = getNormalizedBlockType(state, nameOrType); if (!blockType?.supports) { return defaultSupports; } return getValueFromObjectPath(blockType.supports, feature, defaultSupports); }; /** * Returns true if the block defines support for a feature, or false otherwise. * * @param {Object} state Data state. * @param {(string|Object)} nameOrType Block name or type object. * @param {string} feature Feature to test. * @param {boolean} defaultSupports Whether feature is supported by * default if not explicitly defined. * * @example * ```js * import { __, sprintf } from '@wordpress/i18n'; * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const paragraphBlockSupportClassName = useSelect( ( select ) => * select( blocksStore ).hasBlockSupport( 'core/paragraph', 'className' ), * [] * ); * * return ( *

* { sprintf( * __( 'core/paragraph supports custom class name?: %s' ), * paragraphBlockSupportClassName * ) } * /p> * ); * }; * ``` * * @return {boolean} Whether block supports feature. */ function selectors_hasBlockSupport(state, nameOrType, feature, defaultSupports) { return !!selectors_getBlockSupport(state, nameOrType, feature, defaultSupports); } /** * Normalizes a search term string: removes accents, converts to lowercase, removes extra whitespace. * * @param {string|null|undefined} term Search term to normalize. * @return {string} Normalized search term. */ function getNormalizedSearchTerm(term) { return remove_accents_default()(term !== null && term !== void 0 ? term : '').toLowerCase().trim(); } /** * Returns true if the block type by the given name or object value matches a * search term, or false otherwise. * * @param {Object} state Blocks state. * @param {(string|Object)} nameOrType Block name or type object. * @param {string} searchTerm Search term by which to filter. * * @example * ```js * import { __, sprintf } from '@wordpress/i18n'; * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const termFound = useSelect( * ( select ) => * select( blocksStore ).isMatchingSearchTerm( * 'core/navigation', * 'theme' * ), * [] * ); * * return ( *

* { sprintf( * __( * 'Search term was found in the title, keywords, category or description in block.json: %s' * ), * termFound * ) } *

* ); * }; * ``` * * @return {Object[]} Whether block type matches search term. */ function isMatchingSearchTerm(state, nameOrType, searchTerm = '') { const blockType = getNormalizedBlockType(state, nameOrType); const normalizedSearchTerm = getNormalizedSearchTerm(searchTerm); const isSearchMatch = candidate => getNormalizedSearchTerm(candidate).includes(normalizedSearchTerm); return isSearchMatch(blockType.title) || blockType.keywords?.some(isSearchMatch) || isSearchMatch(blockType.category) || typeof blockType.description === 'string' && isSearchMatch(blockType.description); } /** * Returns a boolean indicating if a block has child blocks or not. * * @param {Object} state Data state. * @param {string} blockName Block type name. * * @example * ```js * import { __, sprintf } from '@wordpress/i18n'; * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const navigationBlockHasChildBlocks = useSelect( ( select ) => * select( blocksStore ).hasChildBlocks( 'core/navigation' ), * [] * ); * * return ( *

* { sprintf( * __( 'core/navigation has child blocks: %s' ), * navigationBlockHasChildBlocks * ) } *

* ); * }; * ``` * * @return {boolean} True if a block contains child blocks and false otherwise. */ const selectors_hasChildBlocks = (state, blockName) => { return selectors_getChildBlockNames(state, blockName).length > 0; }; /** * Returns a boolean indicating if a block has at least one child block with inserter support. * * @param {Object} state Data state. * @param {string} blockName Block type name. * * @example * ```js * import { __, sprintf } from '@wordpress/i18n'; * import { store as blocksStore } from '@wordpress/blocks'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const navigationBlockHasChildBlocksWithInserterSupport = useSelect( ( select ) => * select( blocksStore ).hasChildBlocksWithInserterSupport( * 'core/navigation' * ), * [] * ); * * return ( *

* { sprintf( * __( 'core/navigation has child blocks with inserter support: %s' ), * navigationBlockHasChildBlocksWithInserterSupport * ) } *

* ); * }; * ``` * * @return {boolean} True if a block contains at least one child blocks with inserter support * and false otherwise. */ const selectors_hasChildBlocksWithInserterSupport = (state, blockName) => { return selectors_getChildBlockNames(state, blockName).some(childBlockName => { return selectors_hasBlockSupport(state, childBlockName, 'inserter', true); }); }; const __experimentalHasContentRoleAttribute = (...args) => { external_wp_deprecated_default()('__experimentalHasContentRoleAttribute', { since: '6.7', version: '6.8', hint: 'This is a private selector.' }); return hasContentRoleAttribute(...args); }; ;// ./node_modules/is-plain-object/dist/is-plain-object.mjs /*! * is-plain-object * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function is_plain_object_isObject(o) { return Object.prototype.toString.call(o) === '[object Object]'; } function isPlainObject(o) { var ctor,prot; if (is_plain_object_isObject(o) === false) return false; // If has modified constructor ctor = o.constructor; if (ctor === undefined) return true; // If has modified prototype prot = ctor.prototype; if (is_plain_object_isObject(prot) === false) return false; // If constructor does not have an Object-specific method if (prot.hasOwnProperty('isPrototypeOf') === false) { return false; } // Most likely a plain Object return true; } // EXTERNAL MODULE: ./node_modules/react-is/index.js var react_is = __webpack_require__(8529); ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// ./node_modules/@wordpress/blocks/build-module/store/process-block-type.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('../api/registration').WPBlockType} WPBlockType */ /** * Mapping of legacy category slugs to their latest normal values, used to * accommodate updates of the default set of block categories. * * @type {Record} */ const LEGACY_CATEGORY_MAPPING = { common: 'text', formatting: 'text', layout: 'design' }; /** * Merge block variations bootstrapped from the server and client. * * When a variation is registered in both places, its properties are merged. * * @param {Array} bootstrappedVariations - A block type variations from the server. * @param {Array} clientVariations - A block type variations from the client. * @return {Array} The merged array of block variations. */ function mergeBlockVariations(bootstrappedVariations = [], clientVariations = []) { const result = [...bootstrappedVariations]; clientVariations.forEach(clientVariation => { const index = result.findIndex(bootstrappedVariation => bootstrappedVariation.name === clientVariation.name); if (index !== -1) { result[index] = { ...result[index], ...clientVariation }; } else { result.push(clientVariation); } }); return result; } /** * Takes the unprocessed block type settings, merges them with block type metadata * and applies all the existing filters for the registered block type. * Next, it validates all the settings and performs additional processing to the block type definition. * * @param {string} name Block name. * @param {WPBlockType} blockSettings Unprocessed block type settings. * * @return {WPBlockType | undefined} The block, if it has been processed and can be registered; otherwise `undefined`. */ const processBlockType = (name, blockSettings) => ({ select }) => { const bootstrappedBlockType = select.getBootstrappedBlockType(name); const blockType = { name, icon: BLOCK_ICON_DEFAULT, keywords: [], attributes: {}, providesContext: {}, usesContext: [], selectors: {}, supports: {}, styles: [], blockHooks: {}, save: () => null, ...bootstrappedBlockType, ...blockSettings, // blockType.variations can be defined as a filePath. variations: mergeBlockVariations(Array.isArray(bootstrappedBlockType?.variations) ? bootstrappedBlockType.variations : [], Array.isArray(blockSettings?.variations) ? blockSettings.variations : []) }; const settings = (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.registerBlockType', blockType, name, null); if (settings.description && typeof settings.description !== 'string') { external_wp_deprecated_default()('Declaring non-string block descriptions', { since: '6.2' }); } if (settings.deprecated) { settings.deprecated = settings.deprecated.map(deprecation => Object.fromEntries(Object.entries( // Only keep valid deprecation keys. (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.registerBlockType', // Merge deprecation keys with pre-filter settings // so that filters that depend on specific keys being // present don't fail. { // Omit deprecation keys here so that deprecations // can opt out of specific keys like "supports". ...omit(blockType, DEPRECATED_ENTRY_KEYS), ...deprecation }, blockType.name, deprecation)).filter(([key]) => DEPRECATED_ENTRY_KEYS.includes(key)))); } if (!isPlainObject(settings)) { true ? external_wp_warning_default()('Block settings must be a valid object.') : 0; return; } if (typeof settings.save !== 'function') { true ? external_wp_warning_default()('The "save" property must be a valid function.') : 0; return; } if ('edit' in settings && !(0,react_is.isValidElementType)(settings.edit)) { true ? external_wp_warning_default()('The "edit" property must be a valid component.') : 0; return; } // Canonicalize legacy categories to equivalent fallback. if (LEGACY_CATEGORY_MAPPING.hasOwnProperty(settings.category)) { settings.category = LEGACY_CATEGORY_MAPPING[settings.category]; } if ('category' in settings && !select.getCategories().some(({ slug }) => slug === settings.category)) { true ? external_wp_warning_default()('The block "' + name + '" is registered with an invalid category "' + settings.category + '".') : 0; delete settings.category; } if (!('title' in settings) || settings.title === '') { true ? external_wp_warning_default()('The block "' + name + '" must have a title.') : 0; return; } if (typeof settings.title !== 'string') { true ? external_wp_warning_default()('Block titles must be strings.') : 0; return; } settings.icon = normalizeIconObject(settings.icon); if (!isValidIcon(settings.icon.src)) { true ? external_wp_warning_default()('The icon passed is invalid. ' + 'The icon should be a string, an element, a function, or an object following the specifications documented in https://developer.wordpress.org/block-editor/developers/block-api/block-registration/#icon-optional') : 0; return; } if (typeof settings?.parent === 'string' || settings?.parent instanceof String) { settings.parent = [settings.parent]; true ? external_wp_warning_default()('Parent must be undefined or an array of strings (block types), but it is a string.') : 0; // Intentionally continue: // // While string values were never supported, they appeared to work with some unintended side-effects // that have been fixed by [#66250](https://github.com/WordPress/gutenberg/pull/66250). // // To be backwards-compatible, this code that automatically migrates strings to arrays. } if (!Array.isArray(settings?.parent) && settings?.parent !== undefined) { true ? external_wp_warning_default()('Parent must be undefined or an array of block types, but it is ', settings.parent) : 0; return; } if (1 === settings?.parent?.length && name === settings.parent[0]) { true ? external_wp_warning_default()('Block "' + name + '" cannot be a parent of itself. Please remove the block name from the parent list.') : 0; return; } return settings; }; ;// ./node_modules/@wordpress/blocks/build-module/store/actions.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */ /** @typedef {import('../api/registration').WPBlockType} WPBlockType */ /** @typedef {import('./reducer').WPBlockCategory} WPBlockCategory */ /** * Returns an action object used in signalling that block types have been added. * Ignored from documentation as the recommended usage for this action through registerBlockType from @wordpress/blocks. * * @ignore * * @param {WPBlockType|WPBlockType[]} blockTypes Object or array of objects representing blocks to added. * * * @return {Object} Action object. */ function addBlockTypes(blockTypes) { return { type: 'ADD_BLOCK_TYPES', blockTypes: Array.isArray(blockTypes) ? blockTypes : [blockTypes] }; } /** * Signals that all block types should be computed again. * It uses stored unprocessed block types and all the most recent list of registered filters. * * It addresses the issue where third party block filters get registered after third party blocks. A sample sequence: * 1. Filter A. * 2. Block B. * 3. Block C. * 4. Filter D. * 5. Filter E. * 6. Block F. * 7. Filter G. * In this scenario some filters would not get applied for all blocks because they are registered too late. */ function reapplyBlockTypeFilters() { return ({ dispatch, select }) => { const processedBlockTypes = []; for (const [name, settings] of Object.entries(select.getUnprocessedBlockTypes())) { const result = dispatch(processBlockType(name, settings)); if (result) { processedBlockTypes.push(result); } } if (!processedBlockTypes.length) { return; } dispatch.addBlockTypes(processedBlockTypes); }; } function __experimentalReapplyBlockFilters() { external_wp_deprecated_default()('wp.data.dispatch( "core/blocks" ).__experimentalReapplyBlockFilters', { since: '6.4', alternative: 'reapplyBlockFilters' }); return reapplyBlockTypeFilters(); } /** * Returns an action object used to remove a registered block type. * Ignored from documentation as the recommended usage for this action through unregisterBlockType from @wordpress/blocks. * * @ignore * * @param {string|string[]} names Block name or array of block names to be removed. * * * @return {Object} Action object. */ function removeBlockTypes(names) { return { type: 'REMOVE_BLOCK_TYPES', names: Array.isArray(names) ? names : [names] }; } /** * Returns an action object used in signalling that new block styles have been added. * Ignored from documentation as the recommended usage for this action through registerBlockStyle from @wordpress/blocks. * * @param {string|Array} blockNames Block names to register new styles for. * @param {Array|Object} styles Block style object or array of block style objects. * * @ignore * * @return {Object} Action object. */ function addBlockStyles(blockNames, styles) { return { type: 'ADD_BLOCK_STYLES', styles: Array.isArray(styles) ? styles : [styles], blockNames: Array.isArray(blockNames) ? blockNames : [blockNames] }; } /** * Returns an action object used in signalling that block styles have been removed. * Ignored from documentation as the recommended usage for this action through unregisterBlockStyle from @wordpress/blocks. * * @ignore * * @param {string} blockName Block name. * @param {Array|string} styleNames Block style names or array of block style names. * * @return {Object} Action object. */ function removeBlockStyles(blockName, styleNames) { return { type: 'REMOVE_BLOCK_STYLES', styleNames: Array.isArray(styleNames) ? styleNames : [styleNames], blockName }; } /** * Returns an action object used in signalling that new block variations have been added. * Ignored from documentation as the recommended usage for this action through registerBlockVariation from @wordpress/blocks. * * @ignore * * @param {string} blockName Block name. * @param {WPBlockVariation|WPBlockVariation[]} variations Block variations. * * @return {Object} Action object. */ function addBlockVariations(blockName, variations) { return { type: 'ADD_BLOCK_VARIATIONS', variations: Array.isArray(variations) ? variations : [variations], blockName }; } /** * Returns an action object used in signalling that block variations have been removed. * Ignored from documentation as the recommended usage for this action through unregisterBlockVariation from @wordpress/blocks. * * @ignore * * @param {string} blockName Block name. * @param {string|string[]} variationNames Block variation names. * * @return {Object} Action object. */ function removeBlockVariations(blockName, variationNames) { return { type: 'REMOVE_BLOCK_VARIATIONS', variationNames: Array.isArray(variationNames) ? variationNames : [variationNames], blockName }; } /** * Returns an action object used to set the default block name. * Ignored from documentation as the recommended usage for this action through setDefaultBlockName from @wordpress/blocks. * * @ignore * * @param {string} name Block name. * * @return {Object} Action object. */ function actions_setDefaultBlockName(name) { return { type: 'SET_DEFAULT_BLOCK_NAME', name }; } /** * Returns an action object used to set the name of the block used as a fallback * for non-block content. * Ignored from documentation as the recommended usage for this action through setFreeformContentHandlerName from @wordpress/blocks. * * @ignore * * @param {string} name Block name. * * @return {Object} Action object. */ function setFreeformFallbackBlockName(name) { return { type: 'SET_FREEFORM_FALLBACK_BLOCK_NAME', name }; } /** * Returns an action object used to set the name of the block used as a fallback * for unregistered blocks. * Ignored from documentation as the recommended usage for this action through setUnregisteredTypeHandlerName from @wordpress/blocks. * * @ignore * * @param {string} name Block name. * * @return {Object} Action object. */ function setUnregisteredFallbackBlockName(name) { return { type: 'SET_UNREGISTERED_FALLBACK_BLOCK_NAME', name }; } /** * Returns an action object used to set the name of the block used * when grouping other blocks * eg: in "Group/Ungroup" interactions * Ignored from documentation as the recommended usage for this action through setGroupingBlockName from @wordpress/blocks. * * @ignore * * @param {string} name Block name. * * @return {Object} Action object. */ function actions_setGroupingBlockName(name) { return { type: 'SET_GROUPING_BLOCK_NAME', name }; } /** * Returns an action object used to set block categories. * Ignored from documentation as the recommended usage for this action through setCategories from @wordpress/blocks. * * @ignore * * @param {WPBlockCategory[]} categories Block categories. * * @return {Object} Action object. */ function setCategories(categories) { return { type: 'SET_CATEGORIES', categories }; } /** * Returns an action object used to update a category. * Ignored from documentation as the recommended usage for this action through updateCategory from @wordpress/blocks. * * @ignore * * @param {string} slug Block category slug. * @param {Object} category Object containing the category properties that should be updated. * * @return {Object} Action object. */ function updateCategory(slug, category) { return { type: 'UPDATE_CATEGORY', slug, category }; } /** * Returns an action object used to add block collections * Ignored from documentation as the recommended usage for this action through registerBlockCollection from @wordpress/blocks. * * @ignore * * @param {string} namespace The namespace of the blocks to put in the collection * @param {string} title The title to display in the block inserter * @param {Object} icon (optional) The icon to display in the block inserter * * @return {Object} Action object. */ function addBlockCollection(namespace, title, icon) { return { type: 'ADD_BLOCK_COLLECTION', namespace, title, icon }; } /** * Returns an action object used to remove block collections * Ignored from documentation as the recommended usage for this action through unregisterBlockCollection from @wordpress/blocks. * * @ignore * * @param {string} namespace The namespace of the blocks to put in the collection * * @return {Object} Action object. */ function removeBlockCollection(namespace) { return { type: 'REMOVE_BLOCK_COLLECTION', namespace }; } ;// ./node_modules/@wordpress/blocks/build-module/store/private-actions.js /** * Internal dependencies */ /** @typedef {import('../api/registration').WPBlockType} WPBlockType */ /** * Add bootstrapped block type metadata to the store. These metadata usually come from * the `block.json` file and are either statically bootstrapped from the server, or * passed as the `metadata` parameter to the `registerBlockType` function. * * @param {string} name Block name. * @param {WPBlockType} blockType Block type metadata. */ function addBootstrappedBlockType(name, blockType) { return { type: 'ADD_BOOTSTRAPPED_BLOCK_TYPE', name, blockType }; } /** * Add unprocessed block type settings to the store. These data are passed as the * `settings` parameter to the client-side `registerBlockType` function. * * @param {string} name Block name. * @param {WPBlockType} blockType Unprocessed block type settings. */ function addUnprocessedBlockType(name, blockType) { return ({ dispatch }) => { dispatch({ type: 'ADD_UNPROCESSED_BLOCK_TYPE', name, blockType }); const processedBlockType = dispatch(processBlockType(name, blockType)); if (!processedBlockType) { return; } dispatch.addBlockTypes(processedBlockType); }; } /** * Adds new block bindings source. * * @param {string} source Name of the source to register. */ function addBlockBindingsSource(source) { return { type: 'ADD_BLOCK_BINDINGS_SOURCE', name: source.name, label: source.label, usesContext: source.usesContext, getValues: source.getValues, setValues: source.setValues, canUserEditValue: source.canUserEditValue, getFieldsList: source.getFieldsList }; } /** * Removes existing block bindings source. * * @param {string} name Name of the source to remove. */ function removeBlockBindingsSource(name) { return { type: 'REMOVE_BLOCK_BINDINGS_SOURCE', name }; } ;// ./node_modules/@wordpress/blocks/build-module/store/constants.js const STORE_NAME = 'core/blocks'; ;// ./node_modules/@wordpress/blocks/build-module/store/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Store definition for the blocks namespace. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore * * @type {Object} */ const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { reducer: reducer, selectors: selectors_namespaceObject, actions: actions_namespaceObject }); (0,external_wp_data_namespaceObject.register)(store); unlock(store).registerPrivateSelectors(private_selectors_namespaceObject); unlock(store).registerPrivateActions(private_actions_namespaceObject); ;// ./node_modules/@wordpress/blocks/node_modules/uuid/dist/esm-browser/native.js const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); /* harmony default export */ const esm_browser_native = ({ randomUUID }); ;// ./node_modules/@wordpress/blocks/node_modules/uuid/dist/esm-browser/rng.js // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). let getRandomValues; const rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. 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/@wordpress/blocks/node_modules/uuid/dist/esm-browser/stringify.js /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).slice(1)); } function unsafeStringify(arr, offset = 0) { // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; } function stringify(arr, offset = 0) { const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one // of the following: // - One or more input array values don't map to a hex octet (leading to // "undefined" in the uuid) // - Invalid input values for the RFC `version` or `variant` fields if (!validate(uuid)) { throw TypeError('Stringified UUID is invalid'); } return uuid; } /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify))); ;// ./node_modules/@wordpress/blocks/node_modules/uuid/dist/esm-browser/v4.js function v4(options, buf, offset) { if (esm_browser_native.randomUUID && !buf && !options) { return esm_browser_native.randomUUID(); } options = options || {}; const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (let i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return unsafeStringify(rnds); } /* harmony default export */ const esm_browser_v4 = (v4); ;// ./node_modules/@wordpress/blocks/build-module/api/factory.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns a block object given its type and attributes. * * @param {string} name Block name. * @param {Object} attributes Block attributes. * @param {?Array} innerBlocks Nested blocks. * * @return {Object} Block object. */ function createBlock(name, attributes = {}, innerBlocks = []) { if (!isBlockRegistered(name)) { return createBlock('core/missing', { originalName: name, originalContent: '', originalUndelimitedContent: '' }); } const sanitizedAttributes = __experimentalSanitizeBlockAttributes(name, attributes); const clientId = esm_browser_v4(); // Blocks are stored with a unique ID, the assigned type name, the block // attributes, and their inner blocks. return { clientId, name, isValid: true, attributes: sanitizedAttributes, innerBlocks }; } /** * Given an array of InnerBlocks templates or Block Objects, * returns an array of created Blocks from them. * It handles the case of having InnerBlocks as Blocks by * converting them to the proper format to continue recursively. * * @param {Array} innerBlocksOrTemplate Nested blocks or InnerBlocks templates. * * @return {Object[]} Array of Block objects. */ function createBlocksFromInnerBlocksTemplate(innerBlocksOrTemplate = []) { return innerBlocksOrTemplate.map(innerBlock => { const innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [innerBlock.name, innerBlock.attributes, innerBlock.innerBlocks]; const [name, attributes, innerBlocks = []] = innerBlockTemplate; return createBlock(name, attributes, createBlocksFromInnerBlocksTemplate(innerBlocks)); }); } /** * Given a block object, returns a copy of the block object while sanitizing its attributes, * optionally merging new attributes and/or replacing its inner blocks. * * @param {Object} block Block instance. * @param {Object} mergeAttributes Block attributes. * @param {?Array} newInnerBlocks Nested blocks. * * @return {Object} A cloned block. */ function __experimentalCloneSanitizedBlock(block, mergeAttributes = {}, newInnerBlocks) { const { name } = block; if (!isBlockRegistered(name)) { return createBlock('core/missing', { originalName: name, originalContent: '', originalUndelimitedContent: '' }); } const clientId = esm_browser_v4(); const sanitizedAttributes = __experimentalSanitizeBlockAttributes(name, { ...block.attributes, ...mergeAttributes }); return { ...block, clientId, attributes: sanitizedAttributes, innerBlocks: newInnerBlocks || block.innerBlocks.map(innerBlock => __experimentalCloneSanitizedBlock(innerBlock)) }; } /** * Given a block object, returns a copy of the block object, * optionally merging new attributes and/or replacing its inner blocks. * * @param {Object} block Block instance. * @param {Object} mergeAttributes Block attributes. * @param {?Array} newInnerBlocks Nested blocks. * * @return {Object} A cloned block. */ function cloneBlock(block, mergeAttributes = {}, newInnerBlocks) { const clientId = esm_browser_v4(); return { ...block, clientId, attributes: { ...block.attributes, ...mergeAttributes }, innerBlocks: newInnerBlocks || block.innerBlocks.map(innerBlock => cloneBlock(innerBlock)) }; } /** * Returns a boolean indicating whether a transform is possible based on * various bits of context. * * @param {Object} transform The transform object to validate. * @param {string} direction Is this a 'from' or 'to' transform. * @param {Array} blocks The blocks to transform from. * * @return {boolean} Is the transform possible? */ const isPossibleTransformForSource = (transform, direction, blocks) => { if (!blocks.length) { return false; } // If multiple blocks are selected, only multi block transforms // or wildcard transforms are allowed. const isMultiBlock = blocks.length > 1; const firstBlockName = blocks[0].name; const isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock; if (!isValidForMultiBlocks) { return false; } // Check non-wildcard transforms to ensure that transform is valid // for a block selection of multiple blocks of different types. if (!isWildcardBlockTransform(transform) && !blocks.every(block => block.name === firstBlockName)) { return false; } // Only consider 'block' type transforms as valid. const isBlockType = transform.type === 'block'; if (!isBlockType) { return false; } // Check if the transform's block name matches the source block (or is a wildcard) // only if this is a transform 'from'. const sourceBlock = blocks[0]; const hasMatchingName = direction !== 'from' || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform); if (!hasMatchingName) { return false; } // Don't allow single Grouping blocks to be transformed into // a Grouping block. if (!isMultiBlock && direction === 'from' && isContainerGroupBlock(sourceBlock.name) && isContainerGroupBlock(transform.blockName)) { return false; } // If the transform has a `isMatch` function specified, check that it returns true. if (!maybeCheckTransformIsMatch(transform, blocks)) { return false; } return true; }; /** * Returns block types that the 'blocks' can be transformed into, based on * 'from' transforms on other blocks. * * @param {Array} blocks The blocks to transform from. * * @return {Array} Block types that the blocks can be transformed into. */ const getBlockTypesForPossibleFromTransforms = blocks => { if (!blocks.length) { return []; } const allBlockTypes = getBlockTypes(); // filter all blocks to find those with a 'from' transform. const blockTypesWithPossibleFromTransforms = allBlockTypes.filter(blockType => { const fromTransforms = getBlockTransforms('from', blockType.name); return !!findTransform(fromTransforms, transform => { return isPossibleTransformForSource(transform, 'from', blocks); }); }); return blockTypesWithPossibleFromTransforms; }; /** * Returns block types that the 'blocks' can be transformed into, based on * the source block's own 'to' transforms. * * @param {Array} blocks The blocks to transform from. * * @return {Array} Block types that the source can be transformed into. */ const getBlockTypesForPossibleToTransforms = blocks => { if (!blocks.length) { return []; } const sourceBlock = blocks[0]; const blockType = getBlockType(sourceBlock.name); const transformsTo = blockType ? getBlockTransforms('to', blockType.name) : []; // filter all 'to' transforms to find those that are possible. const possibleTransforms = transformsTo.filter(transform => { return transform && isPossibleTransformForSource(transform, 'to', blocks); }); // Build a list of block names using the possible 'to' transforms. const blockNames = possibleTransforms.map(transformation => transformation.blocks).flat(); // Map block names to block types. return blockNames.map(getBlockType); }; /** * Determines whether transform is a "block" type * and if so whether it is a "wildcard" transform * ie: targets "any" block type * * @param {Object} t the Block transform object * * @return {boolean} whether transform is a wildcard transform */ const isWildcardBlockTransform = t => t && t.type === 'block' && Array.isArray(t.blocks) && t.blocks.includes('*'); /** * Determines whether the given Block is the core Block which * acts as a container Block for other Blocks as part of the * Grouping mechanics * * @param {string} name the name of the Block to test against * * @return {boolean} whether or not the Block is the container Block type */ const isContainerGroupBlock = name => name === getGroupingBlockName(); /** * Returns an array of block types that the set of blocks received as argument * can be transformed into. * * @param {Array} blocks Blocks array. * * @return {Array} Block types that the blocks argument can be transformed to. */ function getPossibleBlockTransformations(blocks) { if (!blocks.length) { return []; } const blockTypesForFromTransforms = getBlockTypesForPossibleFromTransforms(blocks); const blockTypesForToTransforms = getBlockTypesForPossibleToTransforms(blocks); return [...new Set([...blockTypesForFromTransforms, ...blockTypesForToTransforms])]; } /** * Given an array of transforms, returns the highest-priority transform where * the predicate function returns a truthy value. A higher-priority transform * is one with a lower priority value (i.e. first in priority order). Returns * null if the transforms set is empty or the predicate function returns a * falsey value for all entries. * * @param {Object[]} transforms Transforms to search. * @param {Function} predicate Function returning true on matching transform. * * @return {?Object} Highest-priority transform candidate. */ function findTransform(transforms, predicate) { // The hooks library already has built-in mechanisms for managing priority // queue, so leverage via locally-defined instance. const hooks = (0,external_wp_hooks_namespaceObject.createHooks)(); for (let i = 0; i < transforms.length; i++) { const candidate = transforms[i]; if (predicate(candidate)) { hooks.addFilter('transform', 'transform/' + i.toString(), result => result ? result : candidate, candidate.priority); } } // Filter name is arbitrarily chosen but consistent with above aggregation. return hooks.applyFilters('transform', null); } /** * Returns normal block transforms for a given transform direction, optionally * for a specific block by name, or an empty array if there are no transforms. * If no block name is provided, returns transforms for all blocks. A normal * transform object includes `blockName` as a property. * * @param {string} direction Transform direction ("to", "from"). * @param {string|Object} blockTypeOrName Block type or name. * * @return {Array} Block transforms for direction. */ function getBlockTransforms(direction, blockTypeOrName) { // When retrieving transforms for all block types, recurse into self. if (blockTypeOrName === undefined) { return getBlockTypes().map(({ name }) => getBlockTransforms(direction, name)).flat(); } // Validate that block type exists and has array of direction. const blockType = normalizeBlockType(blockTypeOrName); const { name: blockName, transforms } = blockType || {}; if (!transforms || !Array.isArray(transforms[direction])) { return []; } const usingMobileTransformations = transforms.supportedMobileTransforms && Array.isArray(transforms.supportedMobileTransforms); const filteredTransforms = usingMobileTransformations ? transforms[direction].filter(t => { if (t.type === 'raw') { return true; } if (t.type === 'prefix') { return true; } if (!t.blocks || !t.blocks.length) { return false; } if (isWildcardBlockTransform(t)) { return true; } return t.blocks.every(transformBlockName => transforms.supportedMobileTransforms.includes(transformBlockName)); }) : transforms[direction]; // Map transforms to normal form. return filteredTransforms.map(transform => ({ ...transform, blockName, usingMobileTransformations })); } /** * Checks that a given transforms isMatch method passes for given source blocks. * * @param {Object} transform A transform object. * @param {Array} blocks Blocks array. * * @return {boolean} True if given blocks are a match for the transform. */ function maybeCheckTransformIsMatch(transform, blocks) { if (typeof transform.isMatch !== 'function') { return true; } const sourceBlock = blocks[0]; const attributes = transform.isMultiBlock ? blocks.map(block => block.attributes) : sourceBlock.attributes; const block = transform.isMultiBlock ? blocks : sourceBlock; return transform.isMatch(attributes, block); } /** * Switch one or more blocks into one or more blocks of the new block type. * * @param {Array|Object} blocks Blocks array or block object. * @param {string} name Block name. * * @return {?Array} Array of blocks or null. */ function switchToBlockType(blocks, name) { const blocksArray = Array.isArray(blocks) ? blocks : [blocks]; const isMultiBlock = blocksArray.length > 1; const firstBlock = blocksArray[0]; const sourceName = firstBlock.name; // Find the right transformation by giving priority to the "to" // transformation. const transformationsFrom = getBlockTransforms('from', name); const transformationsTo = getBlockTransforms('to', sourceName); const transformation = findTransform(transformationsTo, t => t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(name) !== -1) && (!isMultiBlock || t.isMultiBlock) && maybeCheckTransformIsMatch(t, blocksArray)) || findTransform(transformationsFrom, t => t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || t.isMultiBlock) && maybeCheckTransformIsMatch(t, blocksArray)); // Stop if there is no valid transformation. if (!transformation) { return null; } let transformationResults; if (transformation.isMultiBlock) { if ('__experimentalConvert' in transformation) { transformationResults = transformation.__experimentalConvert(blocksArray); } else { transformationResults = transformation.transform(blocksArray.map(currentBlock => currentBlock.attributes), blocksArray.map(currentBlock => currentBlock.innerBlocks)); } } else if ('__experimentalConvert' in transformation) { transformationResults = transformation.__experimentalConvert(firstBlock); } else { transformationResults = transformation.transform(firstBlock.attributes, firstBlock.innerBlocks); } // Ensure that the transformation function returned an object or an array // of objects. if (transformationResults === null || typeof transformationResults !== 'object') { return null; } // If the transformation function returned a single object, we want to work // with an array instead. transformationResults = Array.isArray(transformationResults) ? transformationResults : [transformationResults]; // Ensure that every block object returned by the transformation has a // valid block type. if (transformationResults.some(result => !getBlockType(result.name))) { return null; } const hasSwitchedBlock = transformationResults.some(result => result.name === name); // Ensure that at least one block object returned by the transformation has // the expected "destination" block type. if (!hasSwitchedBlock) { return null; } const ret = transformationResults.map((result, index, results) => { /** * Filters an individual transform result from block transformation. * All of the original blocks are passed, since transformations are * many-to-many, not one-to-one. * * @param {Object} transformedBlock The transformed block. * @param {Object[]} blocks Original blocks transformed. * @param {Object[]} index Index of the transformed block on the array of results. * @param {Object[]} results An array all the blocks that resulted from the transformation. */ return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.switchToBlockType.transformedBlock', result, blocks, index, results); }); return ret; } /** * Create a block object from the example API. * * @param {string} name * @param {Object} example * * @return {Object} block. */ const getBlockFromExample = (name, example) => { var _example$innerBlocks; return createBlock(name, example.attributes, ((_example$innerBlocks = example.innerBlocks) !== null && _example$innerBlocks !== void 0 ? _example$innerBlocks : []).map(innerBlock => getBlockFromExample(innerBlock.name, innerBlock))); }; ;// external ["wp","blockSerializationDefaultParser"] const external_wp_blockSerializationDefaultParser_namespaceObject = window["wp"]["blockSerializationDefaultParser"]; ;// external ["wp","autop"] const external_wp_autop_namespaceObject = window["wp"]["autop"]; ;// external ["wp","isShallowEqual"] const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); ;// ./node_modules/@wordpress/blocks/build-module/api/parser/serialize-raw-block.js /** * Internal dependencies */ /** * @typedef {Object} Options Serialization options. * @property {boolean} [isCommentDelimited=true] Whether to output HTML comments around blocks. */ /** @typedef {import("./").WPRawBlock} WPRawBlock */ /** * Serializes a block node into the native HTML-comment-powered block format. * CAVEAT: This function is intended for re-serializing blocks as parsed by * valid parsers and skips any validation steps. This is NOT a generic * serialization function for in-memory blocks. For most purposes, see the * following functions available in the `@wordpress/blocks` package: * * @see serializeBlock * @see serialize * * For more on the format of block nodes as returned by valid parsers: * * @see `@wordpress/block-serialization-default-parser` package * @see `@wordpress/block-serialization-spec-parser` package * * @param {WPRawBlock} rawBlock A block node as returned by a valid parser. * @param {Options} [options={}] Serialization options. * * @return {string} An HTML string representing a block. */ function serializeRawBlock(rawBlock, options = {}) { const { isCommentDelimited = true } = options; const { blockName, attrs = {}, innerBlocks = [], innerContent = [] } = rawBlock; let childIndex = 0; const content = innerContent.map(item => // `null` denotes a nested block, otherwise we have an HTML fragment. item !== null ? item : serializeRawBlock(innerBlocks[childIndex++], options)).join('\n').replace(/\n+/g, '\n').trim(); return isCommentDelimited ? getCommentDelimitedContent(blockName, attrs, content) : content; } ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/blocks/build-module/api/serializer.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('./parser').WPBlock} WPBlock */ /** * @typedef {Object} WPBlockSerializationOptions Serialization Options. * * @property {boolean} isInnerBlocks Whether we are serializing inner blocks. */ /** * Returns the block's default classname from its name. * * @param {string} blockName The block name. * * @return {string} The block's default class. */ function getBlockDefaultClassName(blockName) { // Generated HTML classes for blocks follow the `wp-block-{name}` nomenclature. // Blocks provided by WordPress drop the prefixes 'core/' or 'core-' (historically used in 'core-embed/'). const className = 'wp-block-' + blockName.replace(/\//, '-').replace(/^core-/, ''); return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getBlockDefaultClassName', className, blockName); } /** * Returns the block's default menu item classname from its name. * * @param {string} blockName The block name. * * @return {string} The block's default menu item class. */ function getBlockMenuDefaultClassName(blockName) { // Generated HTML classes for blocks follow the `editor-block-list-item-{name}` nomenclature. // Blocks provided by WordPress drop the prefixes 'core/' or 'core-' (historically used in 'core-embed/'). const className = 'editor-block-list-item-' + blockName.replace(/\//, '-').replace(/^core-/, ''); return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getBlockMenuDefaultClassName', className, blockName); } const blockPropsProvider = {}; const innerBlocksPropsProvider = {}; /** * Call within a save function to get the props for the block wrapper. * * @param {Object} props Optional. Props to pass to the element. */ function getBlockProps(props = {}) { const { blockType, attributes } = blockPropsProvider; return getBlockProps.skipFilters ? props : (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getSaveContent.extraProps', { ...props }, blockType, attributes); } /** * Call within a save function to get the props for the inner blocks wrapper. * * @param {Object} props Optional. Props to pass to the element. */ function getInnerBlocksProps(props = {}) { const { innerBlocks } = innerBlocksPropsProvider; // Allow a different component to be passed to getSaveElement to handle // inner blocks, bypassing the default serialisation. if (!Array.isArray(innerBlocks)) { return { ...props, children: innerBlocks }; } // Value is an array of blocks, so defer to block serializer. const html = serialize(innerBlocks, { isInnerBlocks: true }); // Use special-cased raw HTML tag to avoid default escaping. const children = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: html }); return { ...props, children }; } /** * Given a block type containing a save render implementation and attributes, returns the * enhanced element to be saved or string when raw HTML expected. * * @param {string|Object} blockTypeOrName Block type or name. * @param {Object} attributes Block attributes. * @param {?Array} innerBlocks Nested blocks. * * @return {Object|string} Save element or raw HTML string. */ function getSaveElement(blockTypeOrName, attributes, innerBlocks = []) { const blockType = normalizeBlockType(blockTypeOrName); if (!blockType?.save) { return null; } let { save } = blockType; // Component classes are unsupported for save since serialization must // occur synchronously. For improved interoperability with higher-order // components which often return component class, emulate basic support. if (save.prototype instanceof external_wp_element_namespaceObject.Component) { const instance = new save({ attributes }); save = instance.render.bind(instance); } blockPropsProvider.blockType = blockType; blockPropsProvider.attributes = attributes; innerBlocksPropsProvider.innerBlocks = innerBlocks; let element = save({ attributes, innerBlocks }); if (element !== null && typeof element === 'object' && (0,external_wp_hooks_namespaceObject.hasFilter)('blocks.getSaveContent.extraProps') && !(blockType.apiVersion > 1)) { /** * Filters the props applied to the block save result element. * * @param {Object} props Props applied to save element. * @param {WPBlock} blockType Block type definition. * @param {Object} attributes Block attributes. */ const props = (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getSaveContent.extraProps', { ...element.props }, blockType, attributes); if (!external_wp_isShallowEqual_default()(props, element.props)) { element = (0,external_wp_element_namespaceObject.cloneElement)(element, props); } } /** * Filters the save result of a block during serialization. * * @param {Element} element Block save result. * @param {WPBlock} blockType Block type definition. * @param {Object} attributes Block attributes. */ return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getSaveElement', element, blockType, attributes); } /** * Given a block type containing a save render implementation and attributes, returns the * static markup to be saved. * * @param {string|Object} blockTypeOrName Block type or name. * @param {Object} attributes Block attributes. * @param {?Array} innerBlocks Nested blocks. * * @return {string} Save content. */ function getSaveContent(blockTypeOrName, attributes, innerBlocks) { const blockType = normalizeBlockType(blockTypeOrName); return (0,external_wp_element_namespaceObject.renderToString)(getSaveElement(blockType, attributes, innerBlocks)); } /** * Returns attributes which are to be saved and serialized into the block * comment delimiter. * * When a block exists in memory it contains as its attributes both those * parsed the block comment delimiter _and_ those which matched from the * contents of the block. * * This function returns only those attributes which are needed to persist and * which cannot be matched from the block content. * * @param {Object} blockType Block type. * @param {Object} attributes Attributes from in-memory block data. * * @return {Object} Subset of attributes for comment serialization. */ function getCommentAttributes(blockType, attributes) { var _blockType$attributes; return Object.entries((_blockType$attributes = blockType.attributes) !== null && _blockType$attributes !== void 0 ? _blockType$attributes : {}).reduce((accumulator, [key, attributeSchema]) => { const value = attributes[key]; // Ignore undefined values. if (undefined === value) { return accumulator; } // Ignore all attributes but the ones with an "undefined" source // "undefined" source refers to attributes saved in the block comment. if (attributeSchema.source !== undefined) { return accumulator; } // Ignore all local attributes if (attributeSchema.role === 'local') { return accumulator; } if (attributeSchema.__experimentalRole === 'local') { external_wp_deprecated_default()('__experimentalRole attribute', { since: '6.7', version: '6.8', alternative: 'role attribute', hint: `Check the block.json of the ${blockType?.name} block.` }); return accumulator; } // Ignore default value. if ('default' in attributeSchema && JSON.stringify(attributeSchema.default) === JSON.stringify(value)) { return accumulator; } // Otherwise, include in comment set. accumulator[key] = value; return accumulator; }, {}); } /** * Given an attributes object, returns a string in the serialized attributes * format prepared for post content. * * @param {Object} attributes Attributes object. * * @return {string} Serialized attributes. */ function serializeAttributes(attributes) { return JSON.stringify(attributes) // Don't break HTML comments. .replace(/--/g, '\\u002d\\u002d') // Don't break non-standard-compliant tools. .replace(//g, '\\u003e').replace(/&/g, '\\u0026') // Bypass server stripslashes behavior which would unescape stringify's // escaping of quotation mark. // // See: https://developer.wordpress.org/reference/functions/wp_kses_stripslashes/ .replace(/\\"/g, '\\u0022'); } /** * Given a block object, returns the Block's Inner HTML markup. * * @param {Object} block Block instance. * * @return {string} HTML. */ function getBlockInnerHTML(block) { // If block was parsed as invalid or encounters an error while generating // save content, use original content instead to avoid content loss. If a // block contains nested content, exempt it from this condition because we // otherwise have no access to its original content and content loss would // still occur. let saveContent = block.originalContent; if (block.isValid || block.innerBlocks.length) { try { saveContent = getSaveContent(block.name, block.attributes, block.innerBlocks); } catch (error) {} } return saveContent; } /** * Returns the content of a block, including comment delimiters. * * @param {string} rawBlockName Block name. * @param {Object} attributes Block attributes. * @param {string} content Block save content. * * @return {string} Comment-delimited block content. */ function getCommentDelimitedContent(rawBlockName, attributes, content) { const serializedAttributes = attributes && Object.entries(attributes).length ? serializeAttributes(attributes) + ' ' : ''; // Strip core blocks of their namespace prefix. const blockName = rawBlockName?.startsWith('core/') ? rawBlockName.slice(5) : rawBlockName; // @todo make the `wp:` prefix potentially configurable. if (!content) { return ``; } return `\n` + content + `\n`; } /** * Returns the content of a block, including comment delimiters, determining * serialized attributes and content form from the current state of the block. * * @param {WPBlock} block Block instance. * @param {WPBlockSerializationOptions} options Serialization options. * * @return {string} Serialized block. */ function serializeBlock(block, { isInnerBlocks = false } = {}) { if (!block.isValid && block.__unstableBlockSource) { return serializeRawBlock(block.__unstableBlockSource); } const blockName = block.name; const saveContent = getBlockInnerHTML(block); if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) { return saveContent; } const blockType = getBlockType(blockName); if (!blockType) { return saveContent; } const saveAttributes = getCommentAttributes(blockType, block.attributes); return getCommentDelimitedContent(blockName, saveAttributes, saveContent); } function __unstableSerializeAndClean(blocks) { // A single unmodified default block is assumed to // be equivalent to an empty post. if (blocks.length === 1 && isUnmodifiedDefaultBlock(blocks[0])) { blocks = []; } let content = serialize(blocks); // For compatibility, treat a post consisting of a // single freeform block as legacy content and apply // pre-block-editor removep'd content formatting. if (blocks.length === 1 && blocks[0].name === getFreeformContentHandlerName() && blocks[0].name === 'core/freeform') { content = (0,external_wp_autop_namespaceObject.removep)(content); } return content; } /** * Takes a block or set of blocks and returns the serialized post content. * * @param {Array} blocks Block(s) to serialize. * @param {WPBlockSerializationOptions} options Serialization options. * * @return {string} The post content. */ function serialize(blocks, options) { const blocksArray = Array.isArray(blocks) ? blocks : [blocks]; return blocksArray.map(block => serializeBlock(block, options)).join('\n\n'); } ;// ./node_modules/simple-html-tokenizer/dist/es6/index.js /** * generated from https://raw.githubusercontent.com/w3c/html/26b5126f96f736f796b9e29718138919dd513744/entities.json * do not edit */ var namedCharRefs = { Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾̳", Acirc: "Â", acirc: "â", acute: "´", Acy: "А", acy: "а", AElig: "Æ", aelig: "æ", af: "\u2061", Afr: "𝔄", afr: "𝔞", Agrave: "À", agrave: "à", alefsym: "ℵ", aleph: "ℵ", Alpha: "Α", alpha: "α", Amacr: "Ā", amacr: "ā", amalg: "⨿", amp: "&", AMP: "&", andand: "⩕", And: "⩓", and: "∧", andd: "⩜", andslope: "⩘", andv: "⩚", ang: "∠", ange: "⦤", angle: "∠", angmsdaa: "⦨", angmsdab: "⦩", angmsdac: "⦪", angmsdad: "⦫", angmsdae: "⦬", angmsdaf: "⦭", angmsdag: "⦮", angmsdah: "⦯", angmsd: "∡", angrt: "∟", angrtvb: "⊾", angrtvbd: "⦝", angsph: "∢", angst: "Å", angzarr: "⍼", Aogon: "Ą", aogon: "ą", Aopf: "𝔸", aopf: "𝕒", apacir: "⩯", ap: "≈", apE: "⩰", ape: "≊", apid: "≋", apos: "'", ApplyFunction: "\u2061", approx: "≈", approxeq: "≊", Aring: "Å", aring: "å", Ascr: "𝒜", ascr: "𝒶", Assign: "≔", ast: "*", asymp: "≈", asympeq: "≍", Atilde: "Ã", atilde: "ã", Auml: "Ä", auml: "ä", awconint: "∳", awint: "⨑", backcong: "≌", backepsilon: "϶", backprime: "‵", backsim: "∽", backsimeq: "⋍", Backslash: "∖", Barv: "⫧", barvee: "⊽", barwed: "⌅", Barwed: "⌆", barwedge: "⌅", bbrk: "⎵", bbrktbrk: "⎶", bcong: "≌", Bcy: "Б", bcy: "б", bdquo: "„", becaus: "∵", because: "∵", Because: "∵", bemptyv: "⦰", bepsi: "϶", bernou: "ℬ", Bernoullis: "ℬ", Beta: "Β", beta: "β", beth: "ℶ", between: "≬", Bfr: "𝔅", bfr: "𝔟", bigcap: "⋂", bigcirc: "◯", bigcup: "⋃", bigodot: "⨀", bigoplus: "⨁", bigotimes: "⨂", bigsqcup: "⨆", bigstar: "★", bigtriangledown: "▽", bigtriangleup: "△", biguplus: "⨄", bigvee: "⋁", bigwedge: "⋀", bkarow: "⤍", blacklozenge: "⧫", blacksquare: "▪", blacktriangle: "▴", blacktriangledown: "▾", blacktriangleleft: "◂", blacktriangleright: "▸", blank: "␣", blk12: "▒", blk14: "░", blk34: "▓", block: "█", bne: "=⃥", bnequiv: "≡⃥", bNot: "⫭", bnot: "⌐", Bopf: "𝔹", bopf: "𝕓", bot: "⊥", bottom: "⊥", bowtie: "⋈", boxbox: "⧉", boxdl: "┐", boxdL: "╕", boxDl: "╖", boxDL: "╗", boxdr: "┌", boxdR: "╒", boxDr: "╓", boxDR: "╔", boxh: "─", boxH: "═", boxhd: "┬", boxHd: "╤", boxhD: "╥", boxHD: "╦", boxhu: "┴", boxHu: "╧", boxhU: "╨", boxHU: "╩", boxminus: "⊟", boxplus: "⊞", boxtimes: "⊠", boxul: "┘", boxuL: "╛", boxUl: "╜", boxUL: "╝", boxur: "└", boxuR: "╘", boxUr: "╙", boxUR: "╚", boxv: "│", boxV: "║", boxvh: "┼", boxvH: "╪", boxVh: "╫", boxVH: "╬", boxvl: "┤", boxvL: "╡", boxVl: "╢", boxVL: "╣", boxvr: "├", boxvR: "╞", boxVr: "╟", boxVR: "╠", bprime: "‵", breve: "˘", Breve: "˘", brvbar: "¦", bscr: "𝒷", Bscr: "ℬ", bsemi: "⁏", bsim: "∽", bsime: "⋍", bsolb: "⧅", bsol: "\\", bsolhsub: "⟈", bull: "•", bullet: "•", bump: "≎", bumpE: "⪮", bumpe: "≏", Bumpeq: "≎", bumpeq: "≏", Cacute: "Ć", cacute: "ć", capand: "⩄", capbrcup: "⩉", capcap: "⩋", cap: "∩", Cap: "⋒", capcup: "⩇", capdot: "⩀", CapitalDifferentialD: "ⅅ", caps: "∩︀", caret: "⁁", caron: "ˇ", Cayleys: "ℭ", ccaps: "⩍", Ccaron: "Č", ccaron: "č", Ccedil: "Ç", ccedil: "ç", Ccirc: "Ĉ", ccirc: "ĉ", Cconint: "∰", ccups: "⩌", ccupssm: "⩐", Cdot: "Ċ", cdot: "ċ", cedil: "¸", Cedilla: "¸", cemptyv: "⦲", cent: "¢", centerdot: "·", CenterDot: "·", cfr: "𝔠", Cfr: "ℭ", CHcy: "Ч", chcy: "ч", check: "✓", checkmark: "✓", Chi: "Χ", chi: "χ", circ: "ˆ", circeq: "≗", circlearrowleft: "↺", circlearrowright: "↻", circledast: "⊛", circledcirc: "⊚", circleddash: "⊝", CircleDot: "⊙", circledR: "®", circledS: "Ⓢ", CircleMinus: "⊖", CirclePlus: "⊕", CircleTimes: "⊗", cir: "○", cirE: "⧃", cire: "≗", cirfnint: "⨐", cirmid: "⫯", cirscir: "⧂", ClockwiseContourIntegral: "∲", CloseCurlyDoubleQuote: "”", CloseCurlyQuote: "’", clubs: "♣", clubsuit: "♣", colon: ":", Colon: "∷", Colone: "⩴", colone: "≔", coloneq: "≔", comma: ",", commat: "@", comp: "∁", compfn: "∘", complement: "∁", complexes: "ℂ", cong: "≅", congdot: "⩭", Congruent: "≡", conint: "∮", Conint: "∯", ContourIntegral: "∮", copf: "𝕔", Copf: "ℂ", coprod: "∐", Coproduct: "∐", copy: "©", COPY: "©", copysr: "℗", CounterClockwiseContourIntegral: "∳", crarr: "↵", cross: "✗", Cross: "⨯", Cscr: "𝒞", cscr: "𝒸", csub: "⫏", csube: "⫑", csup: "⫐", csupe: "⫒", ctdot: "⋯", cudarrl: "⤸", cudarrr: "⤵", cuepr: "⋞", cuesc: "⋟", cularr: "↶", cularrp: "⤽", cupbrcap: "⩈", cupcap: "⩆", CupCap: "≍", cup: "∪", Cup: "⋓", cupcup: "⩊", cupdot: "⊍", cupor: "⩅", cups: "∪︀", curarr: "↷", curarrm: "⤼", curlyeqprec: "⋞", curlyeqsucc: "⋟", curlyvee: "⋎", curlywedge: "⋏", curren: "¤", curvearrowleft: "↶", curvearrowright: "↷", cuvee: "⋎", cuwed: "⋏", cwconint: "∲", cwint: "∱", cylcty: "⌭", dagger: "†", Dagger: "‡", daleth: "ℸ", darr: "↓", Darr: "↡", dArr: "⇓", dash: "‐", Dashv: "⫤", dashv: "⊣", dbkarow: "⤏", dblac: "˝", Dcaron: "Ď", dcaron: "ď", Dcy: "Д", dcy: "д", ddagger: "‡", ddarr: "⇊", DD: "ⅅ", dd: "ⅆ", DDotrahd: "⤑", ddotseq: "⩷", deg: "°", Del: "∇", Delta: "Δ", delta: "δ", demptyv: "⦱", dfisht: "⥿", Dfr: "𝔇", dfr: "𝔡", dHar: "⥥", dharl: "⇃", dharr: "⇂", DiacriticalAcute: "´", DiacriticalDot: "˙", DiacriticalDoubleAcute: "˝", DiacriticalGrave: "`", DiacriticalTilde: "˜", diam: "⋄", diamond: "⋄", Diamond: "⋄", diamondsuit: "♦", diams: "♦", die: "¨", DifferentialD: "ⅆ", digamma: "ϝ", disin: "⋲", div: "÷", divide: "÷", divideontimes: "⋇", divonx: "⋇", DJcy: "Ђ", djcy: "ђ", dlcorn: "⌞", dlcrop: "⌍", dollar: "$", Dopf: "𝔻", dopf: "𝕕", Dot: "¨", dot: "˙", DotDot: "⃜", doteq: "≐", doteqdot: "≑", DotEqual: "≐", dotminus: "∸", dotplus: "∔", dotsquare: "⊡", doublebarwedge: "⌆", DoubleContourIntegral: "∯", DoubleDot: "¨", DoubleDownArrow: "⇓", DoubleLeftArrow: "⇐", DoubleLeftRightArrow: "⇔", DoubleLeftTee: "⫤", DoubleLongLeftArrow: "⟸", DoubleLongLeftRightArrow: "⟺", DoubleLongRightArrow: "⟹", DoubleRightArrow: "⇒", DoubleRightTee: "⊨", DoubleUpArrow: "⇑", DoubleUpDownArrow: "⇕", DoubleVerticalBar: "∥", DownArrowBar: "⤓", downarrow: "↓", DownArrow: "↓", Downarrow: "⇓", DownArrowUpArrow: "⇵", DownBreve: "̑", downdownarrows: "⇊", downharpoonleft: "⇃", downharpoonright: "⇂", DownLeftRightVector: "⥐", DownLeftTeeVector: "⥞", DownLeftVectorBar: "⥖", DownLeftVector: "↽", DownRightTeeVector: "⥟", DownRightVectorBar: "⥗", DownRightVector: "⇁", DownTeeArrow: "↧", DownTee: "⊤", drbkarow: "⤐", drcorn: "⌟", drcrop: "⌌", Dscr: "𝒟", dscr: "𝒹", DScy: "Ѕ", dscy: "ѕ", dsol: "⧶", Dstrok: "Đ", dstrok: "đ", dtdot: "⋱", dtri: "▿", dtrif: "▾", duarr: "⇵", duhar: "⥯", dwangle: "⦦", DZcy: "Џ", dzcy: "џ", dzigrarr: "⟿", Eacute: "É", eacute: "é", easter: "⩮", Ecaron: "Ě", ecaron: "ě", Ecirc: "Ê", ecirc: "ê", ecir: "≖", ecolon: "≕", Ecy: "Э", ecy: "э", eDDot: "⩷", Edot: "Ė", edot: "ė", eDot: "≑", ee: "ⅇ", efDot: "≒", Efr: "𝔈", efr: "𝔢", eg: "⪚", Egrave: "È", egrave: "è", egs: "⪖", egsdot: "⪘", el: "⪙", Element: "∈", elinters: "⏧", ell: "ℓ", els: "⪕", elsdot: "⪗", Emacr: "Ē", emacr: "ē", empty: "∅", emptyset: "∅", EmptySmallSquare: "◻", emptyv: "∅", EmptyVerySmallSquare: "▫", emsp13: " ", emsp14: " ", emsp: " ", ENG: "Ŋ", eng: "ŋ", ensp: " ", Eogon: "Ę", eogon: "ę", Eopf: "𝔼", eopf: "𝕖", epar: "⋕", eparsl: "⧣", eplus: "⩱", epsi: "ε", Epsilon: "Ε", epsilon: "ε", epsiv: "ϵ", eqcirc: "≖", eqcolon: "≕", eqsim: "≂", eqslantgtr: "⪖", eqslantless: "⪕", Equal: "⩵", equals: "=", EqualTilde: "≂", equest: "≟", Equilibrium: "⇌", equiv: "≡", equivDD: "⩸", eqvparsl: "⧥", erarr: "⥱", erDot: "≓", escr: "ℯ", Escr: "ℰ", esdot: "≐", Esim: "⩳", esim: "≂", Eta: "Η", eta: "η", ETH: "Ð", eth: "ð", Euml: "Ë", euml: "ë", euro: "€", excl: "!", exist: "∃", Exists: "∃", expectation: "ℰ", exponentiale: "ⅇ", ExponentialE: "ⅇ", fallingdotseq: "≒", Fcy: "Ф", fcy: "ф", female: "♀", ffilig: "ffi", fflig: "ff", ffllig: "ffl", Ffr: "𝔉", ffr: "𝔣", filig: "fi", FilledSmallSquare: "◼", FilledVerySmallSquare: "▪", fjlig: "fj", flat: "♭", fllig: "fl", fltns: "▱", fnof: "ƒ", Fopf: "𝔽", fopf: "𝕗", forall: "∀", ForAll: "∀", fork: "⋔", forkv: "⫙", Fouriertrf: "ℱ", fpartint: "⨍", frac12: "½", frac13: "⅓", frac14: "¼", frac15: "⅕", frac16: "⅙", frac18: "⅛", frac23: "⅔", frac25: "⅖", frac34: "¾", frac35: "⅗", frac38: "⅜", frac45: "⅘", frac56: "⅚", frac58: "⅝", frac78: "⅞", frasl: "⁄", frown: "⌢", fscr: "𝒻", Fscr: "ℱ", gacute: "ǵ", Gamma: "Γ", gamma: "γ", Gammad: "Ϝ", gammad: "ϝ", gap: "⪆", Gbreve: "Ğ", gbreve: "ğ", Gcedil: "Ģ", Gcirc: "Ĝ", gcirc: "ĝ", Gcy: "Г", gcy: "г", Gdot: "Ġ", gdot: "ġ", ge: "≥", gE: "≧", gEl: "⪌", gel: "⋛", geq: "≥", geqq: "≧", geqslant: "⩾", gescc: "⪩", ges: "⩾", gesdot: "⪀", gesdoto: "⪂", gesdotol: "⪄", gesl: "⋛︀", gesles: "⪔", Gfr: "𝔊", gfr: "𝔤", gg: "≫", Gg: "⋙", ggg: "⋙", gimel: "ℷ", GJcy: "Ѓ", gjcy: "ѓ", gla: "⪥", gl: "≷", glE: "⪒", glj: "⪤", gnap: "⪊", gnapprox: "⪊", gne: "⪈", gnE: "≩", gneq: "⪈", gneqq: "≩", gnsim: "⋧", Gopf: "𝔾", gopf: "𝕘", grave: "`", GreaterEqual: "≥", GreaterEqualLess: "⋛", GreaterFullEqual: "≧", GreaterGreater: "⪢", GreaterLess: "≷", GreaterSlantEqual: "⩾", GreaterTilde: "≳", Gscr: "𝒢", gscr: "ℊ", gsim: "≳", gsime: "⪎", gsiml: "⪐", gtcc: "⪧", gtcir: "⩺", gt: ">", GT: ">", Gt: "≫", gtdot: "⋗", gtlPar: "⦕", gtquest: "⩼", gtrapprox: "⪆", gtrarr: "⥸", gtrdot: "⋗", gtreqless: "⋛", gtreqqless: "⪌", gtrless: "≷", gtrsim: "≳", gvertneqq: "≩︀", gvnE: "≩︀", Hacek: "ˇ", hairsp: " ", half: "½", hamilt: "ℋ", HARDcy: "Ъ", hardcy: "ъ", harrcir: "⥈", harr: "↔", hArr: "⇔", harrw: "↭", Hat: "^", hbar: "ℏ", Hcirc: "Ĥ", hcirc: "ĥ", hearts: "♥", heartsuit: "♥", hellip: "…", hercon: "⊹", hfr: "𝔥", Hfr: "ℌ", HilbertSpace: "ℋ", hksearow: "⤥", hkswarow: "⤦", hoarr: "⇿", homtht: "∻", hookleftarrow: "↩", hookrightarrow: "↪", hopf: "𝕙", Hopf: "ℍ", horbar: "―", HorizontalLine: "─", hscr: "𝒽", Hscr: "ℋ", hslash: "ℏ", Hstrok: "Ħ", hstrok: "ħ", HumpDownHump: "≎", HumpEqual: "≏", hybull: "⁃", hyphen: "‐", Iacute: "Í", iacute: "í", ic: "\u2063", Icirc: "Î", icirc: "î", Icy: "И", icy: "и", Idot: "İ", IEcy: "Е", iecy: "е", iexcl: "¡", iff: "⇔", ifr: "𝔦", Ifr: "ℑ", Igrave: "Ì", igrave: "ì", ii: "ⅈ", iiiint: "⨌", iiint: "∭", iinfin: "⧜", iiota: "℩", IJlig: "IJ", ijlig: "ij", Imacr: "Ī", imacr: "ī", image: "ℑ", ImaginaryI: "ⅈ", imagline: "ℐ", imagpart: "ℑ", imath: "ı", Im: "ℑ", imof: "⊷", imped: "Ƶ", Implies: "⇒", incare: "℅", in: "∈", infin: "∞", infintie: "⧝", inodot: "ı", intcal: "⊺", int: "∫", Int: "∬", integers: "ℤ", Integral: "∫", intercal: "⊺", Intersection: "⋂", intlarhk: "⨗", intprod: "⨼", InvisibleComma: "\u2063", InvisibleTimes: "\u2062", IOcy: "Ё", iocy: "ё", Iogon: "Į", iogon: "į", Iopf: "𝕀", iopf: "𝕚", Iota: "Ι", iota: "ι", iprod: "⨼", iquest: "¿", iscr: "𝒾", Iscr: "ℐ", isin: "∈", isindot: "⋵", isinE: "⋹", isins: "⋴", isinsv: "⋳", isinv: "∈", it: "\u2062", Itilde: "Ĩ", itilde: "ĩ", Iukcy: "І", iukcy: "і", Iuml: "Ï", iuml: "ï", Jcirc: "Ĵ", jcirc: "ĵ", Jcy: "Й", jcy: "й", Jfr: "𝔍", jfr: "𝔧", jmath: "ȷ", Jopf: "𝕁", jopf: "𝕛", Jscr: "𝒥", jscr: "𝒿", Jsercy: "Ј", jsercy: "ј", Jukcy: "Є", jukcy: "є", Kappa: "Κ", kappa: "κ", kappav: "ϰ", Kcedil: "Ķ", kcedil: "ķ", Kcy: "К", kcy: "к", Kfr: "𝔎", kfr: "𝔨", kgreen: "ĸ", KHcy: "Х", khcy: "х", KJcy: "Ќ", kjcy: "ќ", Kopf: "𝕂", kopf: "𝕜", Kscr: "𝒦", kscr: "𝓀", lAarr: "⇚", Lacute: "Ĺ", lacute: "ĺ", laemptyv: "⦴", lagran: "ℒ", Lambda: "Λ", lambda: "λ", lang: "⟨", Lang: "⟪", langd: "⦑", langle: "⟨", lap: "⪅", Laplacetrf: "ℒ", laquo: "«", larrb: "⇤", larrbfs: "⤟", larr: "←", Larr: "↞", lArr: "⇐", larrfs: "⤝", larrhk: "↩", larrlp: "↫", larrpl: "⤹", larrsim: "⥳", larrtl: "↢", latail: "⤙", lAtail: "⤛", lat: "⪫", late: "⪭", lates: "⪭︀", lbarr: "⤌", lBarr: "⤎", lbbrk: "❲", lbrace: "{", lbrack: "[", lbrke: "⦋", lbrksld: "⦏", lbrkslu: "⦍", Lcaron: "Ľ", lcaron: "ľ", Lcedil: "Ļ", lcedil: "ļ", lceil: "⌈", lcub: "{", Lcy: "Л", lcy: "л", ldca: "⤶", ldquo: "“", ldquor: "„", ldrdhar: "⥧", ldrushar: "⥋", ldsh: "↲", le: "≤", lE: "≦", LeftAngleBracket: "⟨", LeftArrowBar: "⇤", leftarrow: "←", LeftArrow: "←", Leftarrow: "⇐", LeftArrowRightArrow: "⇆", leftarrowtail: "↢", LeftCeiling: "⌈", LeftDoubleBracket: "⟦", LeftDownTeeVector: "⥡", LeftDownVectorBar: "⥙", LeftDownVector: "⇃", LeftFloor: "⌊", leftharpoondown: "↽", leftharpoonup: "↼", leftleftarrows: "⇇", leftrightarrow: "↔", LeftRightArrow: "↔", Leftrightarrow: "⇔", leftrightarrows: "⇆", leftrightharpoons: "⇋", leftrightsquigarrow: "↭", LeftRightVector: "⥎", LeftTeeArrow: "↤", LeftTee: "⊣", LeftTeeVector: "⥚", leftthreetimes: "⋋", LeftTriangleBar: "⧏", LeftTriangle: "⊲", LeftTriangleEqual: "⊴", LeftUpDownVector: "⥑", LeftUpTeeVector: "⥠", LeftUpVectorBar: "⥘", LeftUpVector: "↿", LeftVectorBar: "⥒", LeftVector: "↼", lEg: "⪋", leg: "⋚", leq: "≤", leqq: "≦", leqslant: "⩽", lescc: "⪨", les: "⩽", lesdot: "⩿", lesdoto: "⪁", lesdotor: "⪃", lesg: "⋚︀", lesges: "⪓", lessapprox: "⪅", lessdot: "⋖", lesseqgtr: "⋚", lesseqqgtr: "⪋", LessEqualGreater: "⋚", LessFullEqual: "≦", LessGreater: "≶", lessgtr: "≶", LessLess: "⪡", lesssim: "≲", LessSlantEqual: "⩽", LessTilde: "≲", lfisht: "⥼", lfloor: "⌊", Lfr: "𝔏", lfr: "𝔩", lg: "≶", lgE: "⪑", lHar: "⥢", lhard: "↽", lharu: "↼", lharul: "⥪", lhblk: "▄", LJcy: "Љ", ljcy: "љ", llarr: "⇇", ll: "≪", Ll: "⋘", llcorner: "⌞", Lleftarrow: "⇚", llhard: "⥫", lltri: "◺", Lmidot: "Ŀ", lmidot: "ŀ", lmoustache: "⎰", lmoust: "⎰", lnap: "⪉", lnapprox: "⪉", lne: "⪇", lnE: "≨", lneq: "⪇", lneqq: "≨", lnsim: "⋦", loang: "⟬", loarr: "⇽", lobrk: "⟦", longleftarrow: "⟵", LongLeftArrow: "⟵", Longleftarrow: "⟸", longleftrightarrow: "⟷", LongLeftRightArrow: "⟷", Longleftrightarrow: "⟺", longmapsto: "⟼", longrightarrow: "⟶", LongRightArrow: "⟶", Longrightarrow: "⟹", looparrowleft: "↫", looparrowright: "↬", lopar: "⦅", Lopf: "𝕃", lopf: "𝕝", loplus: "⨭", lotimes: "⨴", lowast: "∗", lowbar: "_", LowerLeftArrow: "↙", LowerRightArrow: "↘", loz: "◊", lozenge: "◊", lozf: "⧫", lpar: "(", lparlt: "⦓", lrarr: "⇆", lrcorner: "⌟", lrhar: "⇋", lrhard: "⥭", lrm: "\u200e", lrtri: "⊿", lsaquo: "‹", lscr: "𝓁", Lscr: "ℒ", lsh: "↰", Lsh: "↰", lsim: "≲", lsime: "⪍", lsimg: "⪏", lsqb: "[", lsquo: "‘", lsquor: "‚", Lstrok: "Ł", lstrok: "ł", ltcc: "⪦", ltcir: "⩹", lt: "<", LT: "<", Lt: "≪", ltdot: "⋖", lthree: "⋋", ltimes: "⋉", ltlarr: "⥶", ltquest: "⩻", ltri: "◃", ltrie: "⊴", ltrif: "◂", ltrPar: "⦖", lurdshar: "⥊", luruhar: "⥦", lvertneqq: "≨︀", lvnE: "≨︀", macr: "¯", male: "♂", malt: "✠", maltese: "✠", Map: "⤅", map: "↦", mapsto: "↦", mapstodown: "↧", mapstoleft: "↤", mapstoup: "↥", marker: "▮", mcomma: "⨩", Mcy: "М", mcy: "м", mdash: "—", mDDot: "∺", measuredangle: "∡", MediumSpace: " ", Mellintrf: "ℳ", Mfr: "𝔐", mfr: "𝔪", mho: "℧", micro: "µ", midast: "*", midcir: "⫰", mid: "∣", middot: "·", minusb: "⊟", minus: "−", minusd: "∸", minusdu: "⨪", MinusPlus: "∓", mlcp: "⫛", mldr: "…", mnplus: "∓", models: "⊧", Mopf: "𝕄", mopf: "𝕞", mp: "∓", mscr: "𝓂", Mscr: "ℳ", mstpos: "∾", Mu: "Μ", mu: "μ", multimap: "⊸", mumap: "⊸", nabla: "∇", Nacute: "Ń", nacute: "ń", nang: "∠⃒", nap: "≉", napE: "⩰̸", napid: "≋̸", napos: "ʼn", napprox: "≉", natural: "♮", naturals: "ℕ", natur: "♮", nbsp: " ", nbump: "≎̸", nbumpe: "≏̸", ncap: "⩃", Ncaron: "Ň", ncaron: "ň", Ncedil: "Ņ", ncedil: "ņ", ncong: "≇", ncongdot: "⩭̸", ncup: "⩂", Ncy: "Н", ncy: "н", ndash: "–", nearhk: "⤤", nearr: "↗", neArr: "⇗", nearrow: "↗", ne: "≠", nedot: "≐̸", NegativeMediumSpace: "​", NegativeThickSpace: "​", NegativeThinSpace: "​", NegativeVeryThinSpace: "​", nequiv: "≢", nesear: "⤨", nesim: "≂̸", NestedGreaterGreater: "≫", NestedLessLess: "≪", NewLine: "\u000a", nexist: "∄", nexists: "∄", Nfr: "𝔑", nfr: "𝔫", ngE: "≧̸", nge: "≱", ngeq: "≱", ngeqq: "≧̸", ngeqslant: "⩾̸", nges: "⩾̸", nGg: "⋙̸", ngsim: "≵", nGt: "≫⃒", ngt: "≯", ngtr: "≯", nGtv: "≫̸", nharr: "↮", nhArr: "⇎", nhpar: "⫲", ni: "∋", nis: "⋼", nisd: "⋺", niv: "∋", NJcy: "Њ", njcy: "њ", nlarr: "↚", nlArr: "⇍", nldr: "‥", nlE: "≦̸", nle: "≰", nleftarrow: "↚", nLeftarrow: "⇍", nleftrightarrow: "↮", nLeftrightarrow: "⇎", nleq: "≰", nleqq: "≦̸", nleqslant: "⩽̸", nles: "⩽̸", nless: "≮", nLl: "⋘̸", nlsim: "≴", nLt: "≪⃒", nlt: "≮", nltri: "⋪", nltrie: "⋬", nLtv: "≪̸", nmid: "∤", NoBreak: "\u2060", NonBreakingSpace: " ", nopf: "𝕟", Nopf: "ℕ", Not: "⫬", not: "¬", NotCongruent: "≢", NotCupCap: "≭", NotDoubleVerticalBar: "∦", NotElement: "∉", NotEqual: "≠", NotEqualTilde: "≂̸", NotExists: "∄", NotGreater: "≯", NotGreaterEqual: "≱", NotGreaterFullEqual: "≧̸", NotGreaterGreater: "≫̸", NotGreaterLess: "≹", NotGreaterSlantEqual: "⩾̸", NotGreaterTilde: "≵", NotHumpDownHump: "≎̸", NotHumpEqual: "≏̸", notin: "∉", notindot: "⋵̸", notinE: "⋹̸", notinva: "∉", notinvb: "⋷", notinvc: "⋶", NotLeftTriangleBar: "⧏̸", NotLeftTriangle: "⋪", NotLeftTriangleEqual: "⋬", NotLess: "≮", NotLessEqual: "≰", NotLessGreater: "≸", NotLessLess: "≪̸", NotLessSlantEqual: "⩽̸", NotLessTilde: "≴", NotNestedGreaterGreater: "⪢̸", NotNestedLessLess: "⪡̸", notni: "∌", notniva: "∌", notnivb: "⋾", notnivc: "⋽", NotPrecedes: "⊀", NotPrecedesEqual: "⪯̸", NotPrecedesSlantEqual: "⋠", NotReverseElement: "∌", NotRightTriangleBar: "⧐̸", NotRightTriangle: "⋫", NotRightTriangleEqual: "⋭", NotSquareSubset: "⊏̸", NotSquareSubsetEqual: "⋢", NotSquareSuperset: "⊐̸", NotSquareSupersetEqual: "⋣", NotSubset: "⊂⃒", NotSubsetEqual: "⊈", NotSucceeds: "⊁", NotSucceedsEqual: "⪰̸", NotSucceedsSlantEqual: "⋡", NotSucceedsTilde: "≿̸", NotSuperset: "⊃⃒", NotSupersetEqual: "⊉", NotTilde: "≁", NotTildeEqual: "≄", NotTildeFullEqual: "≇", NotTildeTilde: "≉", NotVerticalBar: "∤", nparallel: "∦", npar: "∦", nparsl: "⫽⃥", npart: "∂̸", npolint: "⨔", npr: "⊀", nprcue: "⋠", nprec: "⊀", npreceq: "⪯̸", npre: "⪯̸", nrarrc: "⤳̸", nrarr: "↛", nrArr: "⇏", nrarrw: "↝̸", nrightarrow: "↛", nRightarrow: "⇏", nrtri: "⋫", nrtrie: "⋭", nsc: "⊁", nsccue: "⋡", nsce: "⪰̸", Nscr: "𝒩", nscr: "𝓃", nshortmid: "∤", nshortparallel: "∦", nsim: "≁", nsime: "≄", nsimeq: "≄", nsmid: "∤", nspar: "∦", nsqsube: "⋢", nsqsupe: "⋣", nsub: "⊄", nsubE: "⫅̸", nsube: "⊈", nsubset: "⊂⃒", nsubseteq: "⊈", nsubseteqq: "⫅̸", nsucc: "⊁", nsucceq: "⪰̸", nsup: "⊅", nsupE: "⫆̸", nsupe: "⊉", nsupset: "⊃⃒", nsupseteq: "⊉", nsupseteqq: "⫆̸", ntgl: "≹", Ntilde: "Ñ", ntilde: "ñ", ntlg: "≸", ntriangleleft: "⋪", ntrianglelefteq: "⋬", ntriangleright: "⋫", ntrianglerighteq: "⋭", Nu: "Ν", nu: "ν", num: "#", numero: "№", numsp: " ", nvap: "≍⃒", nvdash: "⊬", nvDash: "⊭", nVdash: "⊮", nVDash: "⊯", nvge: "≥⃒", nvgt: ">⃒", nvHarr: "⤄", nvinfin: "⧞", nvlArr: "⤂", nvle: "≤⃒", nvlt: "<⃒", nvltrie: "⊴⃒", nvrArr: "⤃", nvrtrie: "⊵⃒", nvsim: "∼⃒", nwarhk: "⤣", nwarr: "↖", nwArr: "⇖", nwarrow: "↖", nwnear: "⤧", Oacute: "Ó", oacute: "ó", oast: "⊛", Ocirc: "Ô", ocirc: "ô", ocir: "⊚", Ocy: "О", ocy: "о", odash: "⊝", Odblac: "Ő", odblac: "ő", odiv: "⨸", odot: "⊙", odsold: "⦼", OElig: "Œ", oelig: "œ", ofcir: "⦿", Ofr: "𝔒", ofr: "𝔬", ogon: "˛", Ograve: "Ò", ograve: "ò", ogt: "⧁", ohbar: "⦵", ohm: "Ω", oint: "∮", olarr: "↺", olcir: "⦾", olcross: "⦻", oline: "‾", olt: "⧀", Omacr: "Ō", omacr: "ō", Omega: "Ω", omega: "ω", Omicron: "Ο", omicron: "ο", omid: "⦶", ominus: "⊖", Oopf: "𝕆", oopf: "𝕠", opar: "⦷", OpenCurlyDoubleQuote: "“", OpenCurlyQuote: "‘", operp: "⦹", oplus: "⊕", orarr: "↻", Or: "⩔", or: "∨", ord: "⩝", order: "ℴ", orderof: "ℴ", ordf: "ª", ordm: "º", origof: "⊶", oror: "⩖", orslope: "⩗", orv: "⩛", oS: "Ⓢ", Oscr: "𝒪", oscr: "ℴ", Oslash: "Ø", oslash: "ø", osol: "⊘", Otilde: "Õ", otilde: "õ", otimesas: "⨶", Otimes: "⨷", otimes: "⊗", Ouml: "Ö", ouml: "ö", ovbar: "⌽", OverBar: "‾", OverBrace: "⏞", OverBracket: "⎴", OverParenthesis: "⏜", para: "¶", parallel: "∥", par: "∥", parsim: "⫳", parsl: "⫽", part: "∂", PartialD: "∂", Pcy: "П", pcy: "п", percnt: "%", period: ".", permil: "‰", perp: "⊥", pertenk: "‱", Pfr: "𝔓", pfr: "𝔭", Phi: "Φ", phi: "φ", phiv: "ϕ", phmmat: "ℳ", phone: "☎", Pi: "Π", pi: "π", pitchfork: "⋔", piv: "ϖ", planck: "ℏ", planckh: "ℎ", plankv: "ℏ", plusacir: "⨣", plusb: "⊞", pluscir: "⨢", plus: "+", plusdo: "∔", plusdu: "⨥", pluse: "⩲", PlusMinus: "±", plusmn: "±", plussim: "⨦", plustwo: "⨧", pm: "±", Poincareplane: "ℌ", pointint: "⨕", popf: "𝕡", Popf: "ℙ", pound: "£", prap: "⪷", Pr: "⪻", pr: "≺", prcue: "≼", precapprox: "⪷", prec: "≺", preccurlyeq: "≼", Precedes: "≺", PrecedesEqual: "⪯", PrecedesSlantEqual: "≼", PrecedesTilde: "≾", preceq: "⪯", precnapprox: "⪹", precneqq: "⪵", precnsim: "⋨", pre: "⪯", prE: "⪳", precsim: "≾", prime: "′", Prime: "″", primes: "ℙ", prnap: "⪹", prnE: "⪵", prnsim: "⋨", prod: "∏", Product: "∏", profalar: "⌮", profline: "⌒", profsurf: "⌓", prop: "∝", Proportional: "∝", Proportion: "∷", propto: "∝", prsim: "≾", prurel: "⊰", Pscr: "𝒫", pscr: "𝓅", Psi: "Ψ", psi: "ψ", puncsp: " ", Qfr: "𝔔", qfr: "𝔮", qint: "⨌", qopf: "𝕢", Qopf: "ℚ", qprime: "⁗", Qscr: "𝒬", qscr: "𝓆", quaternions: "ℍ", quatint: "⨖", quest: "?", questeq: "≟", quot: "\"", QUOT: "\"", rAarr: "⇛", race: "∽̱", Racute: "Ŕ", racute: "ŕ", radic: "√", raemptyv: "⦳", rang: "⟩", Rang: "⟫", rangd: "⦒", range: "⦥", rangle: "⟩", raquo: "»", rarrap: "⥵", rarrb: "⇥", rarrbfs: "⤠", rarrc: "⤳", rarr: "→", Rarr: "↠", rArr: "⇒", rarrfs: "⤞", rarrhk: "↪", rarrlp: "↬", rarrpl: "⥅", rarrsim: "⥴", Rarrtl: "⤖", rarrtl: "↣", rarrw: "↝", ratail: "⤚", rAtail: "⤜", ratio: "∶", rationals: "ℚ", rbarr: "⤍", rBarr: "⤏", RBarr: "⤐", rbbrk: "❳", rbrace: "}", rbrack: "]", rbrke: "⦌", rbrksld: "⦎", rbrkslu: "⦐", Rcaron: "Ř", rcaron: "ř", Rcedil: "Ŗ", rcedil: "ŗ", rceil: "⌉", rcub: "}", Rcy: "Р", rcy: "р", rdca: "⤷", rdldhar: "⥩", rdquo: "”", rdquor: "”", rdsh: "↳", real: "ℜ", realine: "ℛ", realpart: "ℜ", reals: "ℝ", Re: "ℜ", rect: "▭", reg: "®", REG: "®", ReverseElement: "∋", ReverseEquilibrium: "⇋", ReverseUpEquilibrium: "⥯", rfisht: "⥽", rfloor: "⌋", rfr: "𝔯", Rfr: "ℜ", rHar: "⥤", rhard: "⇁", rharu: "⇀", rharul: "⥬", Rho: "Ρ", rho: "ρ", rhov: "ϱ", RightAngleBracket: "⟩", RightArrowBar: "⇥", rightarrow: "→", RightArrow: "→", Rightarrow: "⇒", RightArrowLeftArrow: "⇄", rightarrowtail: "↣", RightCeiling: "⌉", RightDoubleBracket: "⟧", RightDownTeeVector: "⥝", RightDownVectorBar: "⥕", RightDownVector: "⇂", RightFloor: "⌋", rightharpoondown: "⇁", rightharpoonup: "⇀", rightleftarrows: "⇄", rightleftharpoons: "⇌", rightrightarrows: "⇉", rightsquigarrow: "↝", RightTeeArrow: "↦", RightTee: "⊢", RightTeeVector: "⥛", rightthreetimes: "⋌", RightTriangleBar: "⧐", RightTriangle: "⊳", RightTriangleEqual: "⊵", RightUpDownVector: "⥏", RightUpTeeVector: "⥜", RightUpVectorBar: "⥔", RightUpVector: "↾", RightVectorBar: "⥓", RightVector: "⇀", ring: "˚", risingdotseq: "≓", rlarr: "⇄", rlhar: "⇌", rlm: "\u200f", rmoustache: "⎱", rmoust: "⎱", rnmid: "⫮", roang: "⟭", roarr: "⇾", robrk: "⟧", ropar: "⦆", ropf: "𝕣", Ropf: "ℝ", roplus: "⨮", rotimes: "⨵", RoundImplies: "⥰", rpar: ")", rpargt: "⦔", rppolint: "⨒", rrarr: "⇉", Rrightarrow: "⇛", rsaquo: "›", rscr: "𝓇", Rscr: "ℛ", rsh: "↱", Rsh: "↱", rsqb: "]", rsquo: "’", rsquor: "’", rthree: "⋌", rtimes: "⋊", rtri: "▹", rtrie: "⊵", rtrif: "▸", rtriltri: "⧎", RuleDelayed: "⧴", ruluhar: "⥨", rx: "℞", Sacute: "Ś", sacute: "ś", sbquo: "‚", scap: "⪸", Scaron: "Š", scaron: "š", Sc: "⪼", sc: "≻", sccue: "≽", sce: "⪰", scE: "⪴", Scedil: "Ş", scedil: "ş", Scirc: "Ŝ", scirc: "ŝ", scnap: "⪺", scnE: "⪶", scnsim: "⋩", scpolint: "⨓", scsim: "≿", Scy: "С", scy: "с", sdotb: "⊡", sdot: "⋅", sdote: "⩦", searhk: "⤥", searr: "↘", seArr: "⇘", searrow: "↘", sect: "§", semi: ";", seswar: "⤩", setminus: "∖", setmn: "∖", sext: "✶", Sfr: "𝔖", sfr: "𝔰", sfrown: "⌢", sharp: "♯", SHCHcy: "Щ", shchcy: "щ", SHcy: "Ш", shcy: "ш", ShortDownArrow: "↓", ShortLeftArrow: "←", shortmid: "∣", shortparallel: "∥", ShortRightArrow: "→", ShortUpArrow: "↑", shy: "\u00ad", Sigma: "Σ", sigma: "σ", sigmaf: "ς", sigmav: "ς", sim: "∼", simdot: "⩪", sime: "≃", simeq: "≃", simg: "⪞", simgE: "⪠", siml: "⪝", simlE: "⪟", simne: "≆", simplus: "⨤", simrarr: "⥲", slarr: "←", SmallCircle: "∘", smallsetminus: "∖", smashp: "⨳", smeparsl: "⧤", smid: "∣", smile: "⌣", smt: "⪪", smte: "⪬", smtes: "⪬︀", SOFTcy: "Ь", softcy: "ь", solbar: "⌿", solb: "⧄", sol: "/", Sopf: "𝕊", sopf: "𝕤", spades: "♠", spadesuit: "♠", spar: "∥", sqcap: "⊓", sqcaps: "⊓︀", sqcup: "⊔", sqcups: "⊔︀", Sqrt: "√", sqsub: "⊏", sqsube: "⊑", sqsubset: "⊏", sqsubseteq: "⊑", sqsup: "⊐", sqsupe: "⊒", sqsupset: "⊐", sqsupseteq: "⊒", square: "□", Square: "□", SquareIntersection: "⊓", SquareSubset: "⊏", SquareSubsetEqual: "⊑", SquareSuperset: "⊐", SquareSupersetEqual: "⊒", SquareUnion: "⊔", squarf: "▪", squ: "□", squf: "▪", srarr: "→", Sscr: "𝒮", sscr: "𝓈", ssetmn: "∖", ssmile: "⌣", sstarf: "⋆", Star: "⋆", star: "☆", starf: "★", straightepsilon: "ϵ", straightphi: "ϕ", strns: "¯", sub: "⊂", Sub: "⋐", subdot: "⪽", subE: "⫅", sube: "⊆", subedot: "⫃", submult: "⫁", subnE: "⫋", subne: "⊊", subplus: "⪿", subrarr: "⥹", subset: "⊂", Subset: "⋐", subseteq: "⊆", subseteqq: "⫅", SubsetEqual: "⊆", subsetneq: "⊊", subsetneqq: "⫋", subsim: "⫇", subsub: "⫕", subsup: "⫓", succapprox: "⪸", succ: "≻", succcurlyeq: "≽", Succeeds: "≻", SucceedsEqual: "⪰", SucceedsSlantEqual: "≽", SucceedsTilde: "≿", succeq: "⪰", succnapprox: "⪺", succneqq: "⪶", succnsim: "⋩", succsim: "≿", SuchThat: "∋", sum: "∑", Sum: "∑", sung: "♪", sup1: "¹", sup2: "²", sup3: "³", sup: "⊃", Sup: "⋑", supdot: "⪾", supdsub: "⫘", supE: "⫆", supe: "⊇", supedot: "⫄", Superset: "⊃", SupersetEqual: "⊇", suphsol: "⟉", suphsub: "⫗", suplarr: "⥻", supmult: "⫂", supnE: "⫌", supne: "⊋", supplus: "⫀", supset: "⊃", Supset: "⋑", supseteq: "⊇", supseteqq: "⫆", supsetneq: "⊋", supsetneqq: "⫌", supsim: "⫈", supsub: "⫔", supsup: "⫖", swarhk: "⤦", swarr: "↙", swArr: "⇙", swarrow: "↙", swnwar: "⤪", szlig: "ß", Tab: "\u0009", target: "⌖", Tau: "Τ", tau: "τ", tbrk: "⎴", Tcaron: "Ť", tcaron: "ť", Tcedil: "Ţ", tcedil: "ţ", Tcy: "Т", tcy: "т", tdot: "⃛", telrec: "⌕", Tfr: "𝔗", tfr: "𝔱", there4: "∴", therefore: "∴", Therefore: "∴", Theta: "Θ", theta: "θ", thetasym: "ϑ", thetav: "ϑ", thickapprox: "≈", thicksim: "∼", ThickSpace: "  ", ThinSpace: " ", thinsp: " ", thkap: "≈", thksim: "∼", THORN: "Þ", thorn: "þ", tilde: "˜", Tilde: "∼", TildeEqual: "≃", TildeFullEqual: "≅", TildeTilde: "≈", timesbar: "⨱", timesb: "⊠", times: "×", timesd: "⨰", tint: "∭", toea: "⤨", topbot: "⌶", topcir: "⫱", top: "⊤", Topf: "𝕋", topf: "𝕥", topfork: "⫚", tosa: "⤩", tprime: "‴", trade: "™", TRADE: "™", triangle: "▵", triangledown: "▿", triangleleft: "◃", trianglelefteq: "⊴", triangleq: "≜", triangleright: "▹", trianglerighteq: "⊵", tridot: "◬", trie: "≜", triminus: "⨺", TripleDot: "⃛", triplus: "⨹", trisb: "⧍", tritime: "⨻", trpezium: "⏢", Tscr: "𝒯", tscr: "𝓉", TScy: "Ц", tscy: "ц", TSHcy: "Ћ", tshcy: "ћ", Tstrok: "Ŧ", tstrok: "ŧ", twixt: "≬", twoheadleftarrow: "↞", twoheadrightarrow: "↠", Uacute: "Ú", uacute: "ú", uarr: "↑", Uarr: "↟", uArr: "⇑", Uarrocir: "⥉", Ubrcy: "Ў", ubrcy: "ў", Ubreve: "Ŭ", ubreve: "ŭ", Ucirc: "Û", ucirc: "û", Ucy: "У", ucy: "у", udarr: "⇅", Udblac: "Ű", udblac: "ű", udhar: "⥮", ufisht: "⥾", Ufr: "𝔘", ufr: "𝔲", Ugrave: "Ù", ugrave: "ù", uHar: "⥣", uharl: "↿", uharr: "↾", uhblk: "▀", ulcorn: "⌜", ulcorner: "⌜", ulcrop: "⌏", ultri: "◸", Umacr: "Ū", umacr: "ū", uml: "¨", UnderBar: "_", UnderBrace: "⏟", UnderBracket: "⎵", UnderParenthesis: "⏝", Union: "⋃", UnionPlus: "⊎", Uogon: "Ų", uogon: "ų", Uopf: "𝕌", uopf: "𝕦", UpArrowBar: "⤒", uparrow: "↑", UpArrow: "↑", Uparrow: "⇑", UpArrowDownArrow: "⇅", updownarrow: "↕", UpDownArrow: "↕", Updownarrow: "⇕", UpEquilibrium: "⥮", upharpoonleft: "↿", upharpoonright: "↾", uplus: "⊎", UpperLeftArrow: "↖", UpperRightArrow: "↗", upsi: "υ", Upsi: "ϒ", upsih: "ϒ", Upsilon: "Υ", upsilon: "υ", UpTeeArrow: "↥", UpTee: "⊥", upuparrows: "⇈", urcorn: "⌝", urcorner: "⌝", urcrop: "⌎", Uring: "Ů", uring: "ů", urtri: "◹", Uscr: "𝒰", uscr: "𝓊", utdot: "⋰", Utilde: "Ũ", utilde: "ũ", utri: "▵", utrif: "▴", uuarr: "⇈", Uuml: "Ü", uuml: "ü", uwangle: "⦧", vangrt: "⦜", varepsilon: "ϵ", varkappa: "ϰ", varnothing: "∅", varphi: "ϕ", varpi: "ϖ", varpropto: "∝", varr: "↕", vArr: "⇕", varrho: "ϱ", varsigma: "ς", varsubsetneq: "⊊︀", varsubsetneqq: "⫋︀", varsupsetneq: "⊋︀", varsupsetneqq: "⫌︀", vartheta: "ϑ", vartriangleleft: "⊲", vartriangleright: "⊳", vBar: "⫨", Vbar: "⫫", vBarv: "⫩", Vcy: "В", vcy: "в", vdash: "⊢", vDash: "⊨", Vdash: "⊩", VDash: "⊫", Vdashl: "⫦", veebar: "⊻", vee: "∨", Vee: "⋁", veeeq: "≚", vellip: "⋮", verbar: "|", Verbar: "‖", vert: "|", Vert: "‖", VerticalBar: "∣", VerticalLine: "|", VerticalSeparator: "❘", VerticalTilde: "≀", VeryThinSpace: " ", Vfr: "𝔙", vfr: "𝔳", vltri: "⊲", vnsub: "⊂⃒", vnsup: "⊃⃒", Vopf: "𝕍", vopf: "𝕧", vprop: "∝", vrtri: "⊳", Vscr: "𝒱", vscr: "𝓋", vsubnE: "⫋︀", vsubne: "⊊︀", vsupnE: "⫌︀", vsupne: "⊋︀", Vvdash: "⊪", vzigzag: "⦚", Wcirc: "Ŵ", wcirc: "ŵ", wedbar: "⩟", wedge: "∧", Wedge: "⋀", wedgeq: "≙", weierp: "℘", Wfr: "𝔚", wfr: "𝔴", Wopf: "𝕎", wopf: "𝕨", wp: "℘", wr: "≀", wreath: "≀", Wscr: "𝒲", wscr: "𝓌", xcap: "⋂", xcirc: "◯", xcup: "⋃", xdtri: "▽", Xfr: "𝔛", xfr: "𝔵", xharr: "⟷", xhArr: "⟺", Xi: "Ξ", xi: "ξ", xlarr: "⟵", xlArr: "⟸", xmap: "⟼", xnis: "⋻", xodot: "⨀", Xopf: "𝕏", xopf: "𝕩", xoplus: "⨁", xotime: "⨂", xrarr: "⟶", xrArr: "⟹", Xscr: "𝒳", xscr: "𝓍", xsqcup: "⨆", xuplus: "⨄", xutri: "△", xvee: "⋁", xwedge: "⋀", Yacute: "Ý", yacute: "ý", YAcy: "Я", yacy: "я", Ycirc: "Ŷ", ycirc: "ŷ", Ycy: "Ы", ycy: "ы", yen: "¥", Yfr: "𝔜", yfr: "𝔶", YIcy: "Ї", yicy: "ї", Yopf: "𝕐", yopf: "𝕪", Yscr: "𝒴", yscr: "𝓎", YUcy: "Ю", yucy: "ю", yuml: "ÿ", Yuml: "Ÿ", Zacute: "Ź", zacute: "ź", Zcaron: "Ž", zcaron: "ž", Zcy: "З", zcy: "з", Zdot: "Ż", zdot: "ż", zeetrf: "ℨ", ZeroWidthSpace: "​", Zeta: "Ζ", zeta: "ζ", zfr: "𝔷", Zfr: "ℨ", ZHcy: "Ж", zhcy: "ж", zigrarr: "⇝", zopf: "𝕫", Zopf: "ℤ", Zscr: "𝒵", zscr: "𝓏", zwj: "\u200d", zwnj: "\u200c" }; var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/; var CHARCODE = /^#([0-9]+)$/; var NAMED = /^([A-Za-z0-9]+)$/; var EntityParser = /** @class */ (function () { function EntityParser(named) { this.named = named; } EntityParser.prototype.parse = function (entity) { if (!entity) { return; } var matches = entity.match(HEXCHARCODE); if (matches) { return String.fromCharCode(parseInt(matches[1], 16)); } matches = entity.match(CHARCODE); if (matches) { return String.fromCharCode(parseInt(matches[1], 10)); } matches = entity.match(NAMED); if (matches) { return this.named[matches[1]]; } }; return EntityParser; }()); var WSP = /[\t\n\f ]/; var ALPHA = /[A-Za-z]/; var CRLF = /\r\n?/g; function isSpace(char) { return WSP.test(char); } function isAlpha(char) { return ALPHA.test(char); } function preprocessInput(input) { return input.replace(CRLF, '\n'); } var EventedTokenizer = /** @class */ (function () { function EventedTokenizer(delegate, entityParser, mode) { if (mode === void 0) { mode = 'precompile'; } this.delegate = delegate; this.entityParser = entityParser; this.mode = mode; this.state = "beforeData" /* beforeData */; this.line = -1; this.column = -1; this.input = ''; this.index = -1; this.tagNameBuffer = ''; this.states = { beforeData: function () { var char = this.peek(); if (char === '<' && !this.isIgnoredEndTag()) { this.transitionTo("tagOpen" /* tagOpen */); this.markTagStart(); this.consume(); } else { if (this.mode === 'precompile' && char === '\n') { var tag = this.tagNameBuffer.toLowerCase(); if (tag === 'pre' || tag === 'textarea') { this.consume(); } } this.transitionTo("data" /* data */); this.delegate.beginData(); } }, data: function () { var char = this.peek(); var tag = this.tagNameBuffer; if (char === '<' && !this.isIgnoredEndTag()) { this.delegate.finishData(); this.transitionTo("tagOpen" /* tagOpen */); this.markTagStart(); this.consume(); } else if (char === '&' && tag !== 'script' && tag !== 'style') { this.consume(); this.delegate.appendToData(this.consumeCharRef() || '&'); } else { this.consume(); this.delegate.appendToData(char); } }, tagOpen: function () { var char = this.consume(); if (char === '!') { this.transitionTo("markupDeclarationOpen" /* markupDeclarationOpen */); } else if (char === '/') { this.transitionTo("endTagOpen" /* endTagOpen */); } else if (char === '@' || char === ':' || isAlpha(char)) { this.transitionTo("tagName" /* tagName */); this.tagNameBuffer = ''; this.delegate.beginStartTag(); this.appendToTagName(char); } }, markupDeclarationOpen: function () { var char = this.consume(); if (char === '-' && this.peek() === '-') { this.consume(); this.transitionTo("commentStart" /* commentStart */); this.delegate.beginComment(); } else { var maybeDoctype = char.toUpperCase() + this.input.substring(this.index, this.index + 6).toUpperCase(); if (maybeDoctype === 'DOCTYPE') { this.consume(); this.consume(); this.consume(); this.consume(); this.consume(); this.consume(); this.transitionTo("doctype" /* doctype */); if (this.delegate.beginDoctype) this.delegate.beginDoctype(); } } }, doctype: function () { var char = this.consume(); if (isSpace(char)) { this.transitionTo("beforeDoctypeName" /* beforeDoctypeName */); } }, beforeDoctypeName: function () { var char = this.consume(); if (isSpace(char)) { return; } else { this.transitionTo("doctypeName" /* doctypeName */); if (this.delegate.appendToDoctypeName) this.delegate.appendToDoctypeName(char.toLowerCase()); } }, doctypeName: function () { var char = this.consume(); if (isSpace(char)) { this.transitionTo("afterDoctypeName" /* afterDoctypeName */); } else if (char === '>') { if (this.delegate.endDoctype) this.delegate.endDoctype(); this.transitionTo("beforeData" /* beforeData */); } else { if (this.delegate.appendToDoctypeName) this.delegate.appendToDoctypeName(char.toLowerCase()); } }, afterDoctypeName: function () { var char = this.consume(); if (isSpace(char)) { return; } else if (char === '>') { if (this.delegate.endDoctype) this.delegate.endDoctype(); this.transitionTo("beforeData" /* beforeData */); } else { var nextSixChars = char.toUpperCase() + this.input.substring(this.index, this.index + 5).toUpperCase(); var isPublic = nextSixChars.toUpperCase() === 'PUBLIC'; var isSystem = nextSixChars.toUpperCase() === 'SYSTEM'; if (isPublic || isSystem) { this.consume(); this.consume(); this.consume(); this.consume(); this.consume(); this.consume(); } if (isPublic) { this.transitionTo("afterDoctypePublicKeyword" /* afterDoctypePublicKeyword */); } else if (isSystem) { this.transitionTo("afterDoctypeSystemKeyword" /* afterDoctypeSystemKeyword */); } } }, afterDoctypePublicKeyword: function () { var char = this.peek(); if (isSpace(char)) { this.transitionTo("beforeDoctypePublicIdentifier" /* beforeDoctypePublicIdentifier */); this.consume(); } else if (char === '"') { this.transitionTo("doctypePublicIdentifierDoubleQuoted" /* doctypePublicIdentifierDoubleQuoted */); this.consume(); } else if (char === "'") { this.transitionTo("doctypePublicIdentifierSingleQuoted" /* doctypePublicIdentifierSingleQuoted */); this.consume(); } else if (char === '>') { this.consume(); if (this.delegate.endDoctype) this.delegate.endDoctype(); this.transitionTo("beforeData" /* beforeData */); } }, doctypePublicIdentifierDoubleQuoted: function () { var char = this.consume(); if (char === '"') { this.transitionTo("afterDoctypePublicIdentifier" /* afterDoctypePublicIdentifier */); } else if (char === '>') { if (this.delegate.endDoctype) this.delegate.endDoctype(); this.transitionTo("beforeData" /* beforeData */); } else { if (this.delegate.appendToDoctypePublicIdentifier) this.delegate.appendToDoctypePublicIdentifier(char); } }, doctypePublicIdentifierSingleQuoted: function () { var char = this.consume(); if (char === "'") { this.transitionTo("afterDoctypePublicIdentifier" /* afterDoctypePublicIdentifier */); } else if (char === '>') { if (this.delegate.endDoctype) this.delegate.endDoctype(); this.transitionTo("beforeData" /* beforeData */); } else { if (this.delegate.appendToDoctypePublicIdentifier) this.delegate.appendToDoctypePublicIdentifier(char); } }, afterDoctypePublicIdentifier: function () { var char = this.consume(); if (isSpace(char)) { this.transitionTo("betweenDoctypePublicAndSystemIdentifiers" /* betweenDoctypePublicAndSystemIdentifiers */); } else if (char === '>') { if (this.delegate.endDoctype) this.delegate.endDoctype(); this.transitionTo("beforeData" /* beforeData */); } else if (char === '"') { this.transitionTo("doctypeSystemIdentifierDoubleQuoted" /* doctypeSystemIdentifierDoubleQuoted */); } else if (char === "'") { this.transitionTo("doctypeSystemIdentifierSingleQuoted" /* doctypeSystemIdentifierSingleQuoted */); } }, betweenDoctypePublicAndSystemIdentifiers: function () { var char = this.consume(); if (isSpace(char)) { return; } else if (char === '>') { if (this.delegate.endDoctype) this.delegate.endDoctype(); this.transitionTo("beforeData" /* beforeData */); } else if (char === '"') { this.transitionTo("doctypeSystemIdentifierDoubleQuoted" /* doctypeSystemIdentifierDoubleQuoted */); } else if (char === "'") { this.transitionTo("doctypeSystemIdentifierSingleQuoted" /* doctypeSystemIdentifierSingleQuoted */); } }, doctypeSystemIdentifierDoubleQuoted: function () { var char = this.consume(); if (char === '"') { this.transitionTo("afterDoctypeSystemIdentifier" /* afterDoctypeSystemIdentifier */); } else if (char === '>') { if (this.delegate.endDoctype) this.delegate.endDoctype(); this.transitionTo("beforeData" /* beforeData */); } else { if (this.delegate.appendToDoctypeSystemIdentifier) this.delegate.appendToDoctypeSystemIdentifier(char); } }, doctypeSystemIdentifierSingleQuoted: function () { var char = this.consume(); if (char === "'") { this.transitionTo("afterDoctypeSystemIdentifier" /* afterDoctypeSystemIdentifier */); } else if (char === '>') { if (this.delegate.endDoctype) this.delegate.endDoctype(); this.transitionTo("beforeData" /* beforeData */); } else { if (this.delegate.appendToDoctypeSystemIdentifier) this.delegate.appendToDoctypeSystemIdentifier(char); } }, afterDoctypeSystemIdentifier: function () { var char = this.consume(); if (isSpace(char)) { return; } else if (char === '>') { if (this.delegate.endDoctype) this.delegate.endDoctype(); this.transitionTo("beforeData" /* beforeData */); } }, commentStart: function () { var char = this.consume(); if (char === '-') { this.transitionTo("commentStartDash" /* commentStartDash */); } else if (char === '>') { this.delegate.finishComment(); this.transitionTo("beforeData" /* beforeData */); } else { this.delegate.appendToCommentData(char); this.transitionTo("comment" /* comment */); } }, commentStartDash: function () { var char = this.consume(); if (char === '-') { this.transitionTo("commentEnd" /* commentEnd */); } else if (char === '>') { this.delegate.finishComment(); this.transitionTo("beforeData" /* beforeData */); } else { this.delegate.appendToCommentData('-'); this.transitionTo("comment" /* comment */); } }, comment: function () { var char = this.consume(); if (char === '-') { this.transitionTo("commentEndDash" /* commentEndDash */); } else { this.delegate.appendToCommentData(char); } }, commentEndDash: function () { var char = this.consume(); if (char === '-') { this.transitionTo("commentEnd" /* commentEnd */); } else { this.delegate.appendToCommentData('-' + char); this.transitionTo("comment" /* comment */); } }, commentEnd: function () { var char = this.consume(); if (char === '>') { this.delegate.finishComment(); this.transitionTo("beforeData" /* beforeData */); } else { this.delegate.appendToCommentData('--' + char); this.transitionTo("comment" /* comment */); } }, tagName: function () { var char = this.consume(); if (isSpace(char)) { this.transitionTo("beforeAttributeName" /* beforeAttributeName */); } else if (char === '/') { this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); } else if (char === '>') { this.delegate.finishTag(); this.transitionTo("beforeData" /* beforeData */); } else { this.appendToTagName(char); } }, endTagName: function () { var char = this.consume(); if (isSpace(char)) { this.transitionTo("beforeAttributeName" /* beforeAttributeName */); this.tagNameBuffer = ''; } else if (char === '/') { this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); this.tagNameBuffer = ''; } else if (char === '>') { this.delegate.finishTag(); this.transitionTo("beforeData" /* beforeData */); this.tagNameBuffer = ''; } else { this.appendToTagName(char); } }, beforeAttributeName: function () { var char = this.peek(); if (isSpace(char)) { this.consume(); return; } else if (char === '/') { this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); this.consume(); } else if (char === '>') { this.consume(); this.delegate.finishTag(); this.transitionTo("beforeData" /* beforeData */); } else if (char === '=') { this.delegate.reportSyntaxError('attribute name cannot start with equals sign'); this.transitionTo("attributeName" /* attributeName */); this.delegate.beginAttribute(); this.consume(); this.delegate.appendToAttributeName(char); } else { this.transitionTo("attributeName" /* attributeName */); this.delegate.beginAttribute(); } }, attributeName: function () { var char = this.peek(); if (isSpace(char)) { this.transitionTo("afterAttributeName" /* afterAttributeName */); this.consume(); } else if (char === '/') { this.delegate.beginAttributeValue(false); this.delegate.finishAttributeValue(); this.consume(); this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); } else if (char === '=') { this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */); this.consume(); } else if (char === '>') { this.delegate.beginAttributeValue(false); this.delegate.finishAttributeValue(); this.consume(); this.delegate.finishTag(); this.transitionTo("beforeData" /* beforeData */); } else if (char === '"' || char === "'" || char === '<') { this.delegate.reportSyntaxError(char + ' is not a valid character within attribute names'); this.consume(); this.delegate.appendToAttributeName(char); } else { this.consume(); this.delegate.appendToAttributeName(char); } }, afterAttributeName: function () { var char = this.peek(); if (isSpace(char)) { this.consume(); return; } else if (char === '/') { this.delegate.beginAttributeValue(false); this.delegate.finishAttributeValue(); this.consume(); this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); } else if (char === '=') { this.consume(); this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */); } else if (char === '>') { this.delegate.beginAttributeValue(false); this.delegate.finishAttributeValue(); this.consume(); this.delegate.finishTag(); this.transitionTo("beforeData" /* beforeData */); } else { this.delegate.beginAttributeValue(false); this.delegate.finishAttributeValue(); this.transitionTo("attributeName" /* attributeName */); this.delegate.beginAttribute(); this.consume(); this.delegate.appendToAttributeName(char); } }, beforeAttributeValue: function () { var char = this.peek(); if (isSpace(char)) { this.consume(); } else if (char === '"') { this.transitionTo("attributeValueDoubleQuoted" /* attributeValueDoubleQuoted */); this.delegate.beginAttributeValue(true); this.consume(); } else if (char === "'") { this.transitionTo("attributeValueSingleQuoted" /* attributeValueSingleQuoted */); this.delegate.beginAttributeValue(true); this.consume(); } else if (char === '>') { this.delegate.beginAttributeValue(false); this.delegate.finishAttributeValue(); this.consume(); this.delegate.finishTag(); this.transitionTo("beforeData" /* beforeData */); } else { this.transitionTo("attributeValueUnquoted" /* attributeValueUnquoted */); this.delegate.beginAttributeValue(false); this.consume(); this.delegate.appendToAttributeValue(char); } }, attributeValueDoubleQuoted: function () { var char = this.consume(); if (char === '"') { this.delegate.finishAttributeValue(); this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */); } else if (char === '&') { this.delegate.appendToAttributeValue(this.consumeCharRef() || '&'); } else { this.delegate.appendToAttributeValue(char); } }, attributeValueSingleQuoted: function () { var char = this.consume(); if (char === "'") { this.delegate.finishAttributeValue(); this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */); } else if (char === '&') { this.delegate.appendToAttributeValue(this.consumeCharRef() || '&'); } else { this.delegate.appendToAttributeValue(char); } }, attributeValueUnquoted: function () { var char = this.peek(); if (isSpace(char)) { this.delegate.finishAttributeValue(); this.consume(); this.transitionTo("beforeAttributeName" /* beforeAttributeName */); } else if (char === '/') { this.delegate.finishAttributeValue(); this.consume(); this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); } else if (char === '&') { this.consume(); this.delegate.appendToAttributeValue(this.consumeCharRef() || '&'); } else if (char === '>') { this.delegate.finishAttributeValue(); this.consume(); this.delegate.finishTag(); this.transitionTo("beforeData" /* beforeData */); } else { this.consume(); this.delegate.appendToAttributeValue(char); } }, afterAttributeValueQuoted: function () { var char = this.peek(); if (isSpace(char)) { this.consume(); this.transitionTo("beforeAttributeName" /* beforeAttributeName */); } else if (char === '/') { this.consume(); this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); } else if (char === '>') { this.consume(); this.delegate.finishTag(); this.transitionTo("beforeData" /* beforeData */); } else { this.transitionTo("beforeAttributeName" /* beforeAttributeName */); } }, selfClosingStartTag: function () { var char = this.peek(); if (char === '>') { this.consume(); this.delegate.markTagAsSelfClosing(); this.delegate.finishTag(); this.transitionTo("beforeData" /* beforeData */); } else { this.transitionTo("beforeAttributeName" /* beforeAttributeName */); } }, endTagOpen: function () { var char = this.consume(); if (char === '@' || char === ':' || isAlpha(char)) { this.transitionTo("endTagName" /* endTagName */); this.tagNameBuffer = ''; this.delegate.beginEndTag(); this.appendToTagName(char); } } }; this.reset(); } EventedTokenizer.prototype.reset = function () { this.transitionTo("beforeData" /* beforeData */); this.input = ''; this.tagNameBuffer = ''; this.index = 0; this.line = 1; this.column = 0; this.delegate.reset(); }; EventedTokenizer.prototype.transitionTo = function (state) { this.state = state; }; EventedTokenizer.prototype.tokenize = function (input) { this.reset(); this.tokenizePart(input); this.tokenizeEOF(); }; EventedTokenizer.prototype.tokenizePart = function (input) { this.input += preprocessInput(input); while (this.index < this.input.length) { var handler = this.states[this.state]; if (handler !== undefined) { handler.call(this); } else { throw new Error("unhandled state " + this.state); } } }; EventedTokenizer.prototype.tokenizeEOF = function () { this.flushData(); }; EventedTokenizer.prototype.flushData = function () { if (this.state === 'data') { this.delegate.finishData(); this.transitionTo("beforeData" /* beforeData */); } }; EventedTokenizer.prototype.peek = function () { return this.input.charAt(this.index); }; EventedTokenizer.prototype.consume = function () { var char = this.peek(); this.index++; if (char === '\n') { this.line++; this.column = 0; } else { this.column++; } return char; }; EventedTokenizer.prototype.consumeCharRef = function () { var endIndex = this.input.indexOf(';', this.index); if (endIndex === -1) { return; } var entity = this.input.slice(this.index, endIndex); var chars = this.entityParser.parse(entity); if (chars) { var count = entity.length; // consume the entity chars while (count) { this.consume(); count--; } // consume the `;` this.consume(); return chars; } }; EventedTokenizer.prototype.markTagStart = function () { this.delegate.tagOpen(); }; EventedTokenizer.prototype.appendToTagName = function (char) { this.tagNameBuffer += char; this.delegate.appendToTagName(char); }; EventedTokenizer.prototype.isIgnoredEndTag = function () { var tag = this.tagNameBuffer; return (tag === 'title' && this.input.substring(this.index, this.index + 8) !== '') || (tag === 'style' && this.input.substring(this.index, this.index + 8) !== '') || (tag === 'script' && this.input.substring(this.index, this.index + 9) !== ''); }; return EventedTokenizer; }()); var Tokenizer = /** @class */ (function () { function Tokenizer(entityParser, options) { if (options === void 0) { options = {}; } this.options = options; this.token = null; this.startLine = 1; this.startColumn = 0; this.tokens = []; this.tokenizer = new EventedTokenizer(this, entityParser, options.mode); this._currentAttribute = undefined; } Tokenizer.prototype.tokenize = function (input) { this.tokens = []; this.tokenizer.tokenize(input); return this.tokens; }; Tokenizer.prototype.tokenizePart = function (input) { this.tokens = []; this.tokenizer.tokenizePart(input); return this.tokens; }; Tokenizer.prototype.tokenizeEOF = function () { this.tokens = []; this.tokenizer.tokenizeEOF(); return this.tokens[0]; }; Tokenizer.prototype.reset = function () { this.token = null; this.startLine = 1; this.startColumn = 0; }; Tokenizer.prototype.current = function () { var token = this.token; if (token === null) { throw new Error('token was unexpectedly null'); } if (arguments.length === 0) { return token; } for (var i = 0; i < arguments.length; i++) { if (token.type === arguments[i]) { return token; } } throw new Error("token type was unexpectedly " + token.type); }; Tokenizer.prototype.push = function (token) { this.token = token; this.tokens.push(token); }; Tokenizer.prototype.currentAttribute = function () { return this._currentAttribute; }; Tokenizer.prototype.addLocInfo = function () { if (this.options.loc) { this.current().loc = { start: { line: this.startLine, column: this.startColumn }, end: { line: this.tokenizer.line, column: this.tokenizer.column } }; } this.startLine = this.tokenizer.line; this.startColumn = this.tokenizer.column; }; // Data Tokenizer.prototype.beginDoctype = function () { this.push({ type: "Doctype" /* Doctype */, name: '', }); }; Tokenizer.prototype.appendToDoctypeName = function (char) { this.current("Doctype" /* Doctype */).name += char; }; Tokenizer.prototype.appendToDoctypePublicIdentifier = function (char) { var doctype = this.current("Doctype" /* Doctype */); if (doctype.publicIdentifier === undefined) { doctype.publicIdentifier = char; } else { doctype.publicIdentifier += char; } }; Tokenizer.prototype.appendToDoctypeSystemIdentifier = function (char) { var doctype = this.current("Doctype" /* Doctype */); if (doctype.systemIdentifier === undefined) { doctype.systemIdentifier = char; } else { doctype.systemIdentifier += char; } }; Tokenizer.prototype.endDoctype = function () { this.addLocInfo(); }; Tokenizer.prototype.beginData = function () { this.push({ type: "Chars" /* Chars */, chars: '' }); }; Tokenizer.prototype.appendToData = function (char) { this.current("Chars" /* Chars */).chars += char; }; Tokenizer.prototype.finishData = function () { this.addLocInfo(); }; // Comment Tokenizer.prototype.beginComment = function () { this.push({ type: "Comment" /* Comment */, chars: '' }); }; Tokenizer.prototype.appendToCommentData = function (char) { this.current("Comment" /* Comment */).chars += char; }; Tokenizer.prototype.finishComment = function () { this.addLocInfo(); }; // Tags - basic Tokenizer.prototype.tagOpen = function () { }; Tokenizer.prototype.beginStartTag = function () { this.push({ type: "StartTag" /* StartTag */, tagName: '', attributes: [], selfClosing: false }); }; Tokenizer.prototype.beginEndTag = function () { this.push({ type: "EndTag" /* EndTag */, tagName: '' }); }; Tokenizer.prototype.finishTag = function () { this.addLocInfo(); }; Tokenizer.prototype.markTagAsSelfClosing = function () { this.current("StartTag" /* StartTag */).selfClosing = true; }; // Tags - name Tokenizer.prototype.appendToTagName = function (char) { this.current("StartTag" /* StartTag */, "EndTag" /* EndTag */).tagName += char; }; // Tags - attributes Tokenizer.prototype.beginAttribute = function () { this._currentAttribute = ['', '', false]; }; Tokenizer.prototype.appendToAttributeName = function (char) { this.currentAttribute()[0] += char; }; Tokenizer.prototype.beginAttributeValue = function (isQuoted) { this.currentAttribute()[2] = isQuoted; }; Tokenizer.prototype.appendToAttributeValue = function (char) { this.currentAttribute()[1] += char; }; Tokenizer.prototype.finishAttributeValue = function () { this.current("StartTag" /* StartTag */).attributes.push(this._currentAttribute); }; Tokenizer.prototype.reportSyntaxError = function (message) { this.current().syntaxError = message; }; return Tokenizer; }()); function tokenize(input, options) { var tokenizer = new Tokenizer(new EntityParser(namedCharRefs), options); return tokenizer.tokenize(input); } // EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js var es6 = __webpack_require__(7734); var es6_default = /*#__PURE__*/__webpack_require__.n(es6); ;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// ./node_modules/@wordpress/blocks/build-module/api/validation/logger.js /** * @typedef LoggerItem * @property {Function} log Which logger recorded the message * @property {Array} args White arguments were supplied to the logger */ function createLogger() { /** * Creates a log handler with block validation prefix. * * @param {Function} logger Original logger function. * * @return {Function} Augmented logger function. */ function createLogHandler(logger) { let log = (message, ...args) => logger('Block validation: ' + message, ...args); // In test environments, pre-process string substitutions to improve // readability of error messages. We'd prefer to avoid pulling in this // dependency in runtime environments, and it can be dropped by a combo // of Webpack env substitution + UglifyJS dead code elimination. if (false) {} return log; } return { // eslint-disable-next-line no-console error: createLogHandler(console.error), // eslint-disable-next-line no-console warning: createLogHandler(console.warn), getItems() { return []; } }; } function createQueuedLogger() { /** * The list of enqueued log actions to print. * * @type {Array} */ const queue = []; const logger = createLogger(); return { error(...args) { queue.push({ log: logger.error, args }); }, warning(...args) { queue.push({ log: logger.warning, args }); }, getItems() { return queue; } }; } ;// ./node_modules/@wordpress/blocks/build-module/api/validation/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('../parser').WPBlock} WPBlock */ /** @typedef {import('../registration').WPBlockType} WPBlockType */ /** @typedef {import('./logger').LoggerItem} LoggerItem */ const identity = x => x; /** * Globally matches any consecutive whitespace * * @type {RegExp} */ const REGEXP_WHITESPACE = /[\t\n\r\v\f ]+/g; /** * Matches a string containing only whitespace * * @type {RegExp} */ const REGEXP_ONLY_WHITESPACE = /^[\t\n\r\v\f ]*$/; /** * Matches a CSS URL type value * * @type {RegExp} */ const REGEXP_STYLE_URL_TYPE = /^url\s*\(['"\s]*(.*?)['"\s]*\)$/; /** * Boolean attributes are attributes whose presence as being assigned is * meaningful, even if only empty. * * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 * * Object.keys( Array.from( document.querySelectorAll( '#attributes-1 > tbody > tr' ) ) * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 ) * .reduce( ( result, tr ) => Object.assign( result, { * [ tr.firstChild.textContent.trim() ]: true * } ), {} ) ).sort(); * * @type {Array} */ const BOOLEAN_ATTRIBUTES = ['allowfullscreen', 'allowpaymentrequest', 'allowusermedia', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'default', 'defer', 'disabled', 'download', 'formnovalidate', 'hidden', 'ismap', 'itemscope', 'loop', 'multiple', 'muted', 'nomodule', 'novalidate', 'open', 'playsinline', 'readonly', 'required', 'reversed', 'selected', 'typemustmatch']; /** * Enumerated attributes are attributes which must be of a specific value form. * Like boolean attributes, these are meaningful if specified, even if not of a * valid enumerated value. * * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 * * Object.keys( Array.from( document.querySelectorAll( '#attributes-1 > tbody > tr' ) ) * .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) ) * .reduce( ( result, tr ) => Object.assign( result, { * [ tr.firstChild.textContent.trim() ]: true * } ), {} ) ).sort(); * * @type {Array} */ const ENUMERATED_ATTRIBUTES = ['autocapitalize', 'autocomplete', 'charset', 'contenteditable', 'crossorigin', 'decoding', 'dir', 'draggable', 'enctype', 'formenctype', 'formmethod', 'http-equiv', 'inputmode', 'kind', 'method', 'preload', 'scope', 'shape', 'spellcheck', 'translate', 'type', 'wrap']; /** * Meaningful attributes are those who cannot be safely ignored when omitted in * one HTML markup string and not another. * * @type {Array} */ const MEANINGFUL_ATTRIBUTES = [...BOOLEAN_ATTRIBUTES, ...ENUMERATED_ATTRIBUTES]; /** * Array of functions which receive a text string on which to apply normalizing * behavior for consideration in text token equivalence, carefully ordered from * least-to-most expensive operations. * * @type {Array} */ const TEXT_NORMALIZATIONS = [identity, getTextWithCollapsedWhitespace]; /** * Regular expression matching a named character reference. In lieu of bundling * a full set of references, the pattern covers the minimal necessary to test * positively against the full set. * * "The ampersand must be followed by one of the names given in the named * character references section, using the same case." * * Tested against "12.5 Named character references": * * ``` * const references = Array.from( document.querySelectorAll( * '#named-character-references-table tr[id^=entity-] td:first-child' * ) ).map( ( code ) => code.textContent ) * references.every( ( reference ) => /^[\da-z]+$/i.test( reference ) ) * ``` * * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references * @see https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references * * @type {RegExp} */ const REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i; /** * Regular expression matching a decimal character reference. * * "The ampersand must be followed by a U+0023 NUMBER SIGN character (#), * followed by one or more ASCII digits, representing a base-ten integer" * * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references * * @type {RegExp} */ const REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/; /** * Regular expression matching a hexadecimal character reference. * * "The ampersand must be followed by a U+0023 NUMBER SIGN character (#), which * must be followed by either a U+0078 LATIN SMALL LETTER X character (x) or a * U+0058 LATIN CAPITAL LETTER X character (X), which must then be followed by * one or more ASCII hex digits, representing a hexadecimal integer" * * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references * * @type {RegExp} */ const REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i; /** * Returns true if the given string is a valid character reference segment, or * false otherwise. The text should be stripped of `&` and `;` demarcations. * * @param {string} text Text to test. * * @return {boolean} Whether text is valid character reference. */ function isValidCharacterReference(text) { return REGEXP_NAMED_CHARACTER_REFERENCE.test(text) || REGEXP_DECIMAL_CHARACTER_REFERENCE.test(text) || REGEXP_HEXADECIMAL_CHARACTER_REFERENCE.test(text); } /** * Substitute EntityParser class for `simple-html-tokenizer` which uses the * implementation of `decodeEntities` from `html-entities`, in order to avoid * bundling a massive named character reference. * * @see https://github.com/tildeio/simple-html-tokenizer/tree/HEAD/src/entity-parser.ts */ class DecodeEntityParser { /** * Returns a substitute string for an entity string sequence between `&` * and `;`, or undefined if no substitution should occur. * * @param {string} entity Entity fragment discovered in HTML. * * @return {string | undefined} Entity substitute value. */ parse(entity) { if (isValidCharacterReference(entity)) { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)('&' + entity + ';'); } } } /** * Given a specified string, returns an array of strings split by consecutive * whitespace, ignoring leading or trailing whitespace. * * @param {string} text Original text. * * @return {string[]} Text pieces split on whitespace. */ function getTextPiecesSplitOnWhitespace(text) { return text.trim().split(REGEXP_WHITESPACE); } /** * Given a specified string, returns a new trimmed string where all consecutive * whitespace is collapsed to a single space. * * @param {string} text Original text. * * @return {string} Trimmed text with consecutive whitespace collapsed. */ function getTextWithCollapsedWhitespace(text) { // This is an overly simplified whitespace comparison. The specification is // more prescriptive of whitespace behavior in inline and block contexts. // // See: https://medium.com/@patrickbrosset/when-does-white-space-matter-in-html-b90e8a7cdd33 return getTextPiecesSplitOnWhitespace(text).join(' '); } /** * Returns attribute pairs of the given StartTag token, including only pairs * where the value is non-empty or the attribute is a boolean attribute, an * enumerated attribute, or a custom data- attribute. * * @see MEANINGFUL_ATTRIBUTES * * @param {Object} token StartTag token. * * @return {Array[]} Attribute pairs. */ function getMeaningfulAttributePairs(token) { return token.attributes.filter(pair => { const [key, value] = pair; return value || key.indexOf('data-') === 0 || MEANINGFUL_ATTRIBUTES.includes(key); }); } /** * Returns true if two text tokens (with `chars` property) are equivalent, or * false otherwise. * * @param {Object} actual Actual token. * @param {Object} expected Expected token. * @param {Object} logger Validation logger object. * * @return {boolean} Whether two text tokens are equivalent. */ function isEquivalentTextTokens(actual, expected, logger = createLogger()) { // This function is intentionally written as syntactically "ugly" as a hot // path optimization. Text is progressively normalized in order from least- // to-most operationally expensive, until the earliest point at which text // can be confidently inferred as being equal. let actualChars = actual.chars; let expectedChars = expected.chars; for (let i = 0; i < TEXT_NORMALIZATIONS.length; i++) { const normalize = TEXT_NORMALIZATIONS[i]; actualChars = normalize(actualChars); expectedChars = normalize(expectedChars); if (actualChars === expectedChars) { return true; } } logger.warning('Expected text `%s`, saw `%s`.', expected.chars, actual.chars); return false; } /** * Given a CSS length value, returns a normalized CSS length value for strict equality * comparison. * * @param {string} value CSS length value. * * @return {string} Normalized CSS length value. */ function getNormalizedLength(value) { if (0 === parseFloat(value)) { return '0'; } // Normalize strings with floats to always include a leading zero. if (value.indexOf('.') === 0) { return '0' + value; } return value; } /** * Given a style value, returns a normalized style value for strict equality * comparison. * * @param {string} value Style value. * * @return {string} Normalized style value. */ function getNormalizedStyleValue(value) { const textPieces = getTextPiecesSplitOnWhitespace(value); const normalizedPieces = textPieces.map(getNormalizedLength); const result = normalizedPieces.join(' '); return result // Normalize URL type to omit whitespace or quotes. .replace(REGEXP_STYLE_URL_TYPE, 'url($1)'); } /** * Given a style attribute string, returns an object of style properties. * * @param {string} text Style attribute. * * @return {Object} Style properties. */ function getStyleProperties(text) { const pairs = text // Trim ending semicolon (avoid including in split) .replace(/;?\s*$/, '') // Split on property assignment. .split(';') // For each property assignment... .map(style => { // ...split further into key-value pairs. const [key, ...valueParts] = style.split(':'); const value = valueParts.join(':'); return [key.trim(), getNormalizedStyleValue(value.trim())]; }); return Object.fromEntries(pairs); } /** * Attribute-specific equality handlers * * @type {Object} */ const isEqualAttributesOfName = { class: (actual, expected) => { // Class matches if members are the same, even if out of order or // superfluous whitespace between. const [actualPieces, expectedPieces] = [actual, expected].map(getTextPiecesSplitOnWhitespace); const actualDiff = actualPieces.filter(c => !expectedPieces.includes(c)); const expectedDiff = expectedPieces.filter(c => !actualPieces.includes(c)); return actualDiff.length === 0 && expectedDiff.length === 0; }, style: (actual, expected) => { return es6_default()(...[actual, expected].map(getStyleProperties)); }, // For each boolean attribute, mere presence of attribute in both is enough // to assume equivalence. ...Object.fromEntries(BOOLEAN_ATTRIBUTES.map(attribute => [attribute, () => true])) }; /** * Given two sets of attribute tuples, returns true if the attribute sets are * equivalent. * * @param {Array[]} actual Actual attributes tuples. * @param {Array[]} expected Expected attributes tuples. * @param {Object} logger Validation logger object. * * @return {boolean} Whether attributes are equivalent. */ function isEqualTagAttributePairs(actual, expected, logger = createLogger()) { // Attributes is tokenized as tuples. Their lengths should match. This also // avoids us needing to check both attributes sets, since if A has any keys // which do not exist in B, we know the sets to be different. if (actual.length !== expected.length) { logger.warning('Expected attributes %o, instead saw %o.', expected, actual); return false; } // Attributes are not guaranteed to occur in the same order. For validating // actual attributes, first convert the set of expected attribute values to // an object, for lookup by key. const expectedAttributes = {}; for (let i = 0; i < expected.length; i++) { expectedAttributes[expected[i][0].toLowerCase()] = expected[i][1]; } for (let i = 0; i < actual.length; i++) { const [name, actualValue] = actual[i]; const nameLower = name.toLowerCase(); // As noted above, if missing member in B, assume different. if (!expectedAttributes.hasOwnProperty(nameLower)) { logger.warning('Encountered unexpected attribute `%s`.', name); return false; } const expectedValue = expectedAttributes[nameLower]; const isEqualAttributes = isEqualAttributesOfName[nameLower]; if (isEqualAttributes) { // Defer custom attribute equality handling. if (!isEqualAttributes(actualValue, expectedValue)) { logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue); return false; } } else if (actualValue !== expectedValue) { // Otherwise strict inequality should bail. logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue); return false; } } return true; } /** * Token-type-specific equality handlers * * @type {Object} */ const isEqualTokensOfType = { StartTag: (actual, expected, logger = createLogger()) => { if (actual.tagName !== expected.tagName && // Optimization: Use short-circuit evaluation to defer case- // insensitive check on the assumption that the majority case will // have exactly equal tag names. actual.tagName.toLowerCase() !== expected.tagName.toLowerCase()) { logger.warning('Expected tag name `%s`, instead saw `%s`.', expected.tagName, actual.tagName); return false; } return isEqualTagAttributePairs(...[actual, expected].map(getMeaningfulAttributePairs), logger); }, Chars: isEquivalentTextTokens, Comment: isEquivalentTextTokens }; /** * Given an array of tokens, returns the first token which is not purely * whitespace. * * Mutates the tokens array. * * @param {Object[]} tokens Set of tokens to search. * * @return {Object | undefined} Next non-whitespace token. */ function getNextNonWhitespaceToken(tokens) { let token; while (token = tokens.shift()) { if (token.type !== 'Chars') { return token; } if (!REGEXP_ONLY_WHITESPACE.test(token.chars)) { return token; } } } /** * Tokenize an HTML string, gracefully handling any errors thrown during * underlying tokenization. * * @param {string} html HTML string to tokenize. * @param {Object} logger Validation logger object. * * @return {Object[]|null} Array of valid tokenized HTML elements, or null on error */ function getHTMLTokens(html, logger = createLogger()) { try { return new Tokenizer(new DecodeEntityParser()).tokenize(html); } catch (e) { logger.warning('Malformed HTML detected: %s', html); } return null; } /** * Returns true if the next HTML token closes the current token. * * @param {Object} currentToken Current token to compare with. * @param {Object|undefined} nextToken Next token to compare against. * * @return {boolean} true if `nextToken` closes `currentToken`, false otherwise */ function isClosedByToken(currentToken, nextToken) { // Ensure this is a self closed token. if (!currentToken.selfClosing) { return false; } // Check token names and determine if nextToken is the closing tag for currentToken. if (nextToken && nextToken.tagName === currentToken.tagName && nextToken.type === 'EndTag') { return true; } return false; } /** * Returns true if the given HTML strings are effectively equivalent, or * false otherwise. Invalid HTML is not considered equivalent, even if the * strings directly match. * * @param {string} actual Actual HTML string. * @param {string} expected Expected HTML string. * @param {Object} logger Validation logger object. * * @return {boolean} Whether HTML strings are equivalent. */ function isEquivalentHTML(actual, expected, logger = createLogger()) { // Short-circuit if markup is identical. if (actual === expected) { return true; } // Tokenize input content and reserialized save content. const [actualTokens, expectedTokens] = [actual, expected].map(html => getHTMLTokens(html, logger)); // If either is malformed then stop comparing - the strings are not equivalent. if (!actualTokens || !expectedTokens) { return false; } let actualToken, expectedToken; while (actualToken = getNextNonWhitespaceToken(actualTokens)) { expectedToken = getNextNonWhitespaceToken(expectedTokens); // Inequal if exhausted all expected tokens. if (!expectedToken) { logger.warning('Expected end of content, instead saw %o.', actualToken); return false; } // Inequal if next non-whitespace token of each set are not same type. if (actualToken.type !== expectedToken.type) { logger.warning('Expected token of type `%s` (%o), instead saw `%s` (%o).', expectedToken.type, expectedToken, actualToken.type, actualToken); return false; } // Defer custom token type equality handling, otherwise continue and // assume as equal. const isEqualTokens = isEqualTokensOfType[actualToken.type]; if (isEqualTokens && !isEqualTokens(actualToken, expectedToken, logger)) { return false; } // Peek at the next tokens (actual and expected) to see if they close // a self-closing tag. if (isClosedByToken(actualToken, expectedTokens[0])) { // Consume the next expected token that closes the current actual // self-closing token. getNextNonWhitespaceToken(expectedTokens); } else if (isClosedByToken(expectedToken, actualTokens[0])) { // Consume the next actual token that closes the current expected // self-closing token. getNextNonWhitespaceToken(actualTokens); } } if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) { // If any non-whitespace tokens remain in expected token set, this // indicates inequality. logger.warning('Expected %o, instead saw end of content.', expectedToken); return false; } return true; } /** * Returns an object with `isValid` property set to `true` if the parsed block * is valid given the input content. A block is considered valid if, when serialized * with assumed attributes, the content matches the original value. If block is * invalid, this function returns all validations issues as well. * * @param {string|Object} blockTypeOrName Block type. * @param {Object} attributes Parsed block attributes. * @param {string} originalBlockContent Original block content. * @param {Object} logger Validation logger object. * * @return {Object} Whether block is valid and contains validation messages. */ /** * Returns an object with `isValid` property set to `true` if the parsed block * is valid given the input content. A block is considered valid if, when serialized * with assumed attributes, the content matches the original value. If block is * invalid, this function returns all validations issues as well. * * @param {WPBlock} block block object. * @param {WPBlockType|string} [blockTypeOrName = block.name] Block type or name, inferred from block if not given. * * @return {[boolean,Array]} validation results. */ function validateBlock(block, blockTypeOrName = block.name) { const isFallbackBlock = block.name === getFreeformContentHandlerName() || block.name === getUnregisteredTypeHandlerName(); // Shortcut to avoid costly validation. if (isFallbackBlock) { return [true, []]; } const logger = createQueuedLogger(); const blockType = normalizeBlockType(blockTypeOrName); let generatedBlockContent; try { generatedBlockContent = getSaveContent(blockType, block.attributes); } catch (error) { logger.error('Block validation failed because an error occurred while generating block content:\n\n%s', error.toString()); return [false, logger.getItems()]; } const isValid = isEquivalentHTML(block.originalContent, generatedBlockContent, logger); if (!isValid) { logger.error('Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, generatedBlockContent, block.originalContent); } return [isValid, logger.getItems()]; } /** * Returns true if the parsed block is valid given the input content. A block * is considered valid if, when serialized with assumed attributes, the content * matches the original value. * * Logs to console in development environments when invalid. * * @deprecated Use validateBlock instead to avoid data loss. * * @param {string|Object} blockTypeOrName Block type. * @param {Object} attributes Parsed block attributes. * @param {string} originalBlockContent Original block content. * * @return {boolean} Whether block is valid. */ function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) { external_wp_deprecated_default()('isValidBlockContent introduces opportunity for data loss', { since: '12.6', plugin: 'Gutenberg', alternative: 'validateBlock' }); const blockType = normalizeBlockType(blockTypeOrName); const block = { name: blockType.name, attributes, innerBlocks: [], originalContent: originalBlockContent }; const [isValid] = validateBlock(block, blockType); return isValid; } ;// ./node_modules/@wordpress/blocks/build-module/api/parser/convert-legacy-block.js /** * Convert legacy blocks to their canonical form. This function is used * both in the parser level for previous content and to convert such blocks * used in Custom Post Types templates. * * @param {string} name The block's name * @param {Object} attributes The block's attributes * * @return {[string, Object]} The block's name and attributes, changed accordingly if a match was found */ function convertLegacyBlockNameAndAttributes(name, attributes) { const newAttributes = { ...attributes }; // Convert 'core/cover-image' block in existing content to 'core/cover'. if ('core/cover-image' === name) { name = 'core/cover'; } // Convert 'core/text' blocks in existing content to 'core/paragraph'. if ('core/text' === name || 'core/cover-text' === name) { name = 'core/paragraph'; } // Convert derivative blocks such as 'core/social-link-wordpress' to the // canonical form 'core/social-link'. if (name && name.indexOf('core/social-link-') === 0) { // Capture `social-link-wordpress` into `{"service":"wordpress"}` newAttributes.service = name.substring(17); name = 'core/social-link'; } // Convert derivative blocks such as 'core-embed/instagram' to the // canonical form 'core/embed'. if (name && name.indexOf('core-embed/') === 0) { // Capture `core-embed/instagram` into `{"providerNameSlug":"instagram"}` const providerSlug = name.substring(11); const deprecated = { speaker: 'speaker-deck', polldaddy: 'crowdsignal' }; newAttributes.providerNameSlug = providerSlug in deprecated ? deprecated[providerSlug] : providerSlug; // This is needed as the `responsive` attribute was passed // in a different way before the refactoring to block variations. if (!['amazon-kindle', 'wordpress'].includes(providerSlug)) { newAttributes.responsive = true; } name = 'core/embed'; } // Convert Post Comment blocks in existing content to Comment blocks. // TODO: Remove these checks when WordPress 6.0 is released. if (name === 'core/post-comment-author') { name = 'core/comment-author-name'; } if (name === 'core/post-comment-content') { name = 'core/comment-content'; } if (name === 'core/post-comment-date') { name = 'core/comment-date'; } if (name === 'core/comments-query-loop') { name = 'core/comments'; const { className = '' } = newAttributes; if (!className.includes('wp-block-comments-query-loop')) { newAttributes.className = ['wp-block-comments-query-loop', className].join(' '); } // Note that we also had to add a deprecation to the block in order // for the ID change to work. } if (name === 'core/post-comments') { name = 'core/comments'; newAttributes.legacy = true; } // Column count was stored as a string from WP 6.3-6.6. Convert it to a number. if (attributes.layout?.type === 'grid' && typeof attributes.layout?.columnCount === 'string') { newAttributes.layout = { ...newAttributes.layout, columnCount: parseInt(attributes.layout.columnCount, 10) }; } // Column span and row span were stored as strings in WP 6.6. Convert them to numbers. if (typeof attributes.style?.layout?.columnSpan === 'string') { const columnSpanNumber = parseInt(attributes.style.layout.columnSpan, 10); newAttributes.style = { ...newAttributes.style, layout: { ...newAttributes.style.layout, columnSpan: isNaN(columnSpanNumber) ? undefined : columnSpanNumber } }; } if (typeof attributes.style?.layout?.rowSpan === 'string') { const rowSpanNumber = parseInt(attributes.style.layout.rowSpan, 10); newAttributes.style = { ...newAttributes.style, layout: { ...newAttributes.style.layout, rowSpan: isNaN(rowSpanNumber) ? undefined : rowSpanNumber } }; } // The following code is only relevant for the Gutenberg plugin. // It's a stand-alone if statement for dead-code elimination. if (false) {} return [name, newAttributes]; } ;// ./node_modules/hpq/es/get-path.js /** * Given object and string of dot-delimited path segments, returns value at * path or undefined if path cannot be resolved. * * @param {Object} object Lookup object * @param {string} path Path to resolve * @return {?*} Resolved value */ function getPath(object, path) { var segments = path.split('.'); var segment; while (segment = segments.shift()) { if (!(segment in object)) { return; } object = object[segment]; } return object; } ;// ./node_modules/hpq/es/index.js /** * Internal dependencies */ /** * Function returning a DOM document created by `createHTMLDocument`. The same * document is returned between invocations. * * @return {Document} DOM document. */ var getDocument = function () { var doc; return function () { if (!doc) { doc = document.implementation.createHTMLDocument(''); } return doc; }; }(); /** * Given a markup string or DOM element, creates an object aligning with the * shape of the matchers object, or the value returned by the matcher. * * @param {(string|Element)} source Source content * @param {(Object|Function)} matchers Matcher function or object of matchers * @return {(Object|*)} Matched value(s), shaped by object */ function parse(source, matchers) { if (!matchers) { return; } // Coerce to element if ('string' === typeof source) { var doc = getDocument(); doc.body.innerHTML = source; source = doc.body; } // Return singular value if ('function' === typeof matchers) { return matchers(source); } // Bail if we can't handle matchers if (Object !== matchers.constructor) { return; } // Shape result by matcher object return Object.keys(matchers).reduce(function (memo, key) { memo[key] = parse(source, matchers[key]); return memo; }, {}); } /** * Generates a function which matches node of type selector, returning an * attribute by property if the attribute exists. If no selector is passed, * returns property of the query element. * * @param {?string} selector Optional selector * @param {string} name Property name * @return {*} Property value */ function prop(selector, name) { if (1 === arguments.length) { name = selector; selector = undefined; } return function (node) { var match = node; if (selector) { match = node.querySelector(selector); } if (match) { return getPath(match, name); } }; } /** * Generates a function which matches node of type selector, returning an * attribute by name if the attribute exists. If no selector is passed, * returns attribute of the query element. * * @param {?string} selector Optional selector * @param {string} name Attribute name * @return {?string} Attribute value */ function attr(selector, name) { if (1 === arguments.length) { name = selector; selector = undefined; } return function (node) { var attributes = prop(selector, 'attributes')(node); if (attributes && attributes.hasOwnProperty(name)) { return attributes[name].value; } }; } /** * Convenience for `prop( selector, 'innerHTML' )`. * * @see prop() * * @param {?string} selector Optional selector * @return {string} Inner HTML */ function html(selector) { return prop(selector, 'innerHTML'); } /** * Convenience for `prop( selector, 'textContent' )`. * * @see prop() * * @param {?string} selector Optional selector * @return {string} Text content */ function es_text(selector) { return prop(selector, 'textContent'); } /** * Creates a new matching context by first finding elements matching selector * using querySelectorAll before then running another `parse` on `matchers` * scoped to the matched elements. * * @see parse() * * @param {string} selector Selector to match * @param {(Object|Function)} matchers Matcher function or object of matchers * @return {Array.<*,Object>} Array of matched value(s) */ function query(selector, matchers) { return function (node) { var matches = node.querySelectorAll(selector); return [].map.call(matches, function (match) { return parse(match, matchers); }); }; } ;// ./node_modules/memize/dist/index.js /** * Memize options object. * * @typedef MemizeOptions * * @property {number} [maxSize] Maximum size of the cache. */ /** * Internal cache entry. * * @typedef MemizeCacheNode * * @property {?MemizeCacheNode|undefined} [prev] Previous node. * @property {?MemizeCacheNode|undefined} [next] Next node. * @property {Array<*>} args Function arguments for cache * entry. * @property {*} val Function result. */ /** * Properties of the enhanced function for controlling cache. * * @typedef MemizeMemoizedFunction * * @property {()=>void} clear Clear the cache. */ /** * Accepts a function to be memoized, and returns a new memoized function, with * optional options. * * @template {(...args: any[]) => any} F * * @param {F} fn Function to memoize. * @param {MemizeOptions} [options] Options object. * * @return {((...args: Parameters) => ReturnType) & MemizeMemoizedFunction} Memoized function. */ function memize(fn, options) { var size = 0; /** @type {?MemizeCacheNode|undefined} */ var head; /** @type {?MemizeCacheNode|undefined} */ var tail; options = options || {}; function memoized(/* ...args */) { var node = head, len = arguments.length, args, i; searchCache: while (node) { // Perform a shallow equality test to confirm that whether the node // under test is a candidate for the arguments passed. Two arrays // are shallowly equal if their length matches and each entry is // strictly equal between the two sets. Avoid abstracting to a // function which could incur an arguments leaking deoptimization. // Check whether node arguments match arguments length if (node.args.length !== arguments.length) { node = node.next; continue; } // Check whether node arguments match arguments values for (i = 0; i < len; i++) { if (node.args[i] !== arguments[i]) { node = node.next; continue searchCache; } } // At this point we can assume we've found a match // Surface matched node to head if not already if (node !== head) { // As tail, shift to previous. Must only shift if not also // head, since if both head and tail, there is no previous. if (node === tail) { tail = node.prev; } // Adjust siblings to point to each other. If node was tail, // this also handles new tail's empty `next` assignment. /** @type {MemizeCacheNode} */ (node.prev).next = node.next; if (node.next) { node.next.prev = node.prev; } node.next = head; node.prev = null; /** @type {MemizeCacheNode} */ (head).prev = node; head = node; } // Return immediately return node.val; } // No cached value found. Continue to insertion phase: // Create a copy of arguments (avoid leaking deoptimization) args = new Array(len); for (i = 0; i < len; i++) { args[i] = arguments[i]; } node = { args: args, // Generate the result from original function val: fn.apply(null, args), }; // Don't need to check whether node is already head, since it would // have been returned above already if it was // Shift existing head down list if (head) { head.prev = node; node.next = head; } else { // If no head, follows that there's no tail (at initial or reset) tail = node; } // Trim tail if we're reached max size and are pending cache insertion if (size === /** @type {MemizeOptions} */ (options).maxSize) { tail = /** @type {MemizeCacheNode} */ (tail).prev; /** @type {MemizeCacheNode} */ (tail).next = null; } else { size++; } head = node; return node.val; } memoized.clear = function () { head = null; tail = null; size = 0; }; // Ignore reason: There's not a clear solution to create an intersection of // the function with additional properties, where the goal is to retain the // function signature of the incoming argument and add control properties // on the return value. // @ts-ignore return memoized; } ;// ./node_modules/@wordpress/blocks/build-module/api/matchers.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function matchers_html(selector, multilineTag) { return domNode => { let match = domNode; if (selector) { match = domNode.querySelector(selector); } if (!match) { return ''; } if (multilineTag) { let value = ''; const length = match.children.length; for (let index = 0; index < length; index++) { const child = match.children[index]; if (child.nodeName.toLowerCase() !== multilineTag) { continue; } value += child.outerHTML; } return value; } return match.innerHTML; }; } const richText = (selector, preserveWhiteSpace) => el => { const target = selector ? el.querySelector(selector) : el; return target ? external_wp_richText_namespaceObject.RichTextData.fromHTMLElement(target, { preserveWhiteSpace }) : external_wp_richText_namespaceObject.RichTextData.empty(); }; ;// ./node_modules/@wordpress/blocks/build-module/api/node.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * A representation of a single node within a block's rich text value. If * representing a text node, the value is simply a string of the node value. * As representing an element node, it is an object of: * * 1. `type` (string): Tag name. * 2. `props` (object): Attributes and children array of WPBlockNode. * * @typedef {string|Object} WPBlockNode */ /** * Given a single node and a node type (e.g. `'br'`), returns true if the node * corresponds to that type, false otherwise. * * @param {WPBlockNode} node Block node to test * @param {string} type Node to type to test against. * * @return {boolean} Whether node is of intended type. */ function isNodeOfType(node, type) { external_wp_deprecated_default()('wp.blocks.node.isNodeOfType', { since: '6.1', version: '6.3', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/' }); return node && node.type === type; } /** * Given an object implementing the NamedNodeMap interface, returns a plain * object equivalent value of name, value key-value pairs. * * @see https://dom.spec.whatwg.org/#interface-namednodemap * * @param {NamedNodeMap} nodeMap NamedNodeMap to convert to object. * * @return {Object} Object equivalent value of NamedNodeMap. */ function getNamedNodeMapAsObject(nodeMap) { const result = {}; for (let i = 0; i < nodeMap.length; i++) { const { name, value } = nodeMap[i]; result[name] = value; } return result; } /** * Given a DOM Element or Text node, returns an equivalent block node. Throws * if passed any node type other than element or text. * * @throws {TypeError} If non-element/text node is passed. * * @param {Node} domNode DOM node to convert. * * @return {WPBlockNode} Block node equivalent to DOM node. */ function fromDOM(domNode) { external_wp_deprecated_default()('wp.blocks.node.fromDOM', { since: '6.1', version: '6.3', alternative: 'wp.richText.create', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/' }); if (domNode.nodeType === domNode.TEXT_NODE) { return domNode.nodeValue; } if (domNode.nodeType !== domNode.ELEMENT_NODE) { throw new TypeError('A block node can only be created from a node of type text or ' + 'element.'); } return { type: domNode.nodeName.toLowerCase(), props: { ...getNamedNodeMapAsObject(domNode.attributes), children: children_fromDOM(domNode.childNodes) } }; } /** * Given a block node, returns its HTML string representation. * * @param {WPBlockNode} node Block node to convert to string. * * @return {string} String HTML representation of block node. */ function toHTML(node) { external_wp_deprecated_default()('wp.blocks.node.toHTML', { since: '6.1', version: '6.3', alternative: 'wp.richText.toHTMLString', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/' }); return children_toHTML([node]); } /** * Given a selector, returns an hpq matcher generating a WPBlockNode value * matching the selector result. * * @param {string} selector DOM selector. * * @return {Function} hpq matcher. */ function matcher(selector) { external_wp_deprecated_default()('wp.blocks.node.matcher', { since: '6.1', version: '6.3', alternative: 'html source', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/' }); return domNode => { let match = domNode; if (selector) { match = domNode.querySelector(selector); } try { return fromDOM(match); } catch (error) { return null; } }; } /** * Object of utility functions used in managing block attribute values of * source `node`. * * @see https://github.com/WordPress/gutenberg/pull/10439 * * @deprecated since 4.0. The `node` source should not be used, and can be * replaced by the `html` source. * * @private */ /* harmony default export */ const node = ({ isNodeOfType, fromDOM, toHTML, matcher }); ;// ./node_modules/@wordpress/blocks/build-module/api/children.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * A representation of a block's rich text value. * * @typedef {WPBlockNode[]} WPBlockChildren */ /** * Given block children, returns a serialize-capable WordPress element. * * @param {WPBlockChildren} children Block children object to convert. * * @return {Element} A serialize-capable element. */ function getSerializeCapableElement(children) { // The fact that block children are compatible with the element serializer is // merely an implementation detail that currently serves to be true, but // should not be mistaken as being a guarantee on the external API. The // public API only offers guarantees to work with strings (toHTML) and DOM // elements (fromDOM), and should provide utilities to manipulate the value // rather than expect consumers to inspect or construct its shape (concat). return children; } /** * Given block children, returns an array of block nodes. * * @param {WPBlockChildren} children Block children object to convert. * * @return {Array} An array of individual block nodes. */ function getChildrenArray(children) { external_wp_deprecated_default()('wp.blocks.children.getChildrenArray', { since: '6.1', version: '6.3', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/' }); // The fact that block children are compatible with the element serializer // is merely an implementation detail that currently serves to be true, but // should not be mistaken as being a guarantee on the external API. return children; } /** * Given two or more block nodes, returns a new block node representing a * concatenation of its values. * * @param {...WPBlockChildren} blockNodes Block nodes to concatenate. * * @return {WPBlockChildren} Concatenated block node. */ function concat(...blockNodes) { external_wp_deprecated_default()('wp.blocks.children.concat', { since: '6.1', version: '6.3', alternative: 'wp.richText.concat', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/' }); const result = []; for (let i = 0; i < blockNodes.length; i++) { const blockNode = Array.isArray(blockNodes[i]) ? blockNodes[i] : [blockNodes[i]]; for (let j = 0; j < blockNode.length; j++) { const child = blockNode[j]; const canConcatToPreviousString = typeof child === 'string' && typeof result[result.length - 1] === 'string'; if (canConcatToPreviousString) { result[result.length - 1] += child; } else { result.push(child); } } } return result; } /** * Given an iterable set of DOM nodes, returns equivalent block children. * Ignores any non-element/text nodes included in set. * * @param {Iterable.} domNodes Iterable set of DOM nodes to convert. * * @return {WPBlockChildren} Block children equivalent to DOM nodes. */ function children_fromDOM(domNodes) { external_wp_deprecated_default()('wp.blocks.children.fromDOM', { since: '6.1', version: '6.3', alternative: 'wp.richText.create', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/' }); const result = []; for (let i = 0; i < domNodes.length; i++) { try { result.push(fromDOM(domNodes[i])); } catch (error) { // Simply ignore if DOM node could not be converted. } } return result; } /** * Given a block node, returns its HTML string representation. * * @param {WPBlockChildren} children Block node(s) to convert to string. * * @return {string} String HTML representation of block node. */ function children_toHTML(children) { external_wp_deprecated_default()('wp.blocks.children.toHTML', { since: '6.1', version: '6.3', alternative: 'wp.richText.toHTMLString', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/' }); const element = getSerializeCapableElement(children); return (0,external_wp_element_namespaceObject.renderToString)(element); } /** * Given a selector, returns an hpq matcher generating a WPBlockChildren value * matching the selector result. * * @param {string} selector DOM selector. * * @return {Function} hpq matcher. */ function children_matcher(selector) { external_wp_deprecated_default()('wp.blocks.children.matcher', { since: '6.1', version: '6.3', alternative: 'html source', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/' }); return domNode => { let match = domNode; if (selector) { match = domNode.querySelector(selector); } if (match) { return children_fromDOM(match.childNodes); } return []; }; } /** * Object of utility functions used in managing block attribute values of * source `children`. * * @see https://github.com/WordPress/gutenberg/pull/10439 * * @deprecated since 4.0. The `children` source should not be used, and can be * replaced by the `html` source. * * @private */ /* harmony default export */ const children = ({ concat, getChildrenArray, fromDOM: children_fromDOM, toHTML: children_toHTML, matcher: children_matcher }); ;// ./node_modules/@wordpress/blocks/build-module/api/parser/get-block-attributes.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Higher-order hpq matcher which enhances an attribute matcher to return true * or false depending on whether the original matcher returns undefined. This * is useful for boolean attributes (e.g. disabled) whose attribute values may * be technically falsey (empty string), though their mere presence should be * enough to infer as true. * * @param {Function} matcher Original hpq matcher. * * @return {Function} Enhanced hpq matcher. */ const toBooleanAttributeMatcher = matcher => value => matcher(value) !== undefined; /** * Returns true if value is of the given JSON schema type, or false otherwise. * * @see http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.25 * * @param {*} value Value to test. * @param {string} type Type to test. * * @return {boolean} Whether value is of type. */ function isOfType(value, type) { switch (type) { case 'rich-text': return value instanceof external_wp_richText_namespaceObject.RichTextData; case 'string': return typeof value === 'string'; case 'boolean': return typeof value === 'boolean'; case 'object': return !!value && value.constructor === Object; case 'null': return value === null; case 'array': return Array.isArray(value); case 'integer': case 'number': return typeof value === 'number'; } return true; } /** * Returns true if value is of an array of given JSON schema types, or false * otherwise. * * @see http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.25 * * @param {*} value Value to test. * @param {string[]} types Types to test. * * @return {boolean} Whether value is of types. */ function isOfTypes(value, types) { return types.some(type => isOfType(value, type)); } /** * Given an attribute key, an attribute's schema, a block's raw content and the * commentAttributes returns the attribute value depending on its source * definition of the given attribute key. * * @param {string} attributeKey Attribute key. * @param {Object} attributeSchema Attribute's schema. * @param {Node} innerDOM Parsed DOM of block's inner HTML. * @param {Object} commentAttributes Block's comment attributes. * @param {string} innerHTML Raw HTML from block node's innerHTML property. * * @return {*} Attribute value. */ function getBlockAttribute(attributeKey, attributeSchema, innerDOM, commentAttributes, innerHTML) { let value; switch (attributeSchema.source) { // An undefined source means that it's an attribute serialized to the // block's "comment". case undefined: value = commentAttributes ? commentAttributes[attributeKey] : undefined; break; // raw source means that it's the original raw block content. case 'raw': value = innerHTML; break; case 'attribute': case 'property': case 'html': case 'text': case 'rich-text': case 'children': case 'node': case 'query': case 'tag': value = parseWithAttributeSchema(innerDOM, attributeSchema); break; } if (!isValidByType(value, attributeSchema.type) || !isValidByEnum(value, attributeSchema.enum)) { // Reject the value if it is not valid. Reverting to the undefined // value ensures the default is respected, if applicable. value = undefined; } if (value === undefined) { value = getDefault(attributeSchema); } return value; } /** * Returns true if value is valid per the given block attribute schema type * definition, or false otherwise. * * @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1 * * @param {*} value Value to test. * @param {?(Array|string)} type Block attribute schema type. * * @return {boolean} Whether value is valid. */ function isValidByType(value, type) { return type === undefined || isOfTypes(value, Array.isArray(type) ? type : [type]); } /** * Returns true if value is valid per the given block attribute schema enum * definition, or false otherwise. * * @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.2 * * @param {*} value Value to test. * @param {?Array} enumSet Block attribute schema enum. * * @return {boolean} Whether value is valid. */ function isValidByEnum(value, enumSet) { return !Array.isArray(enumSet) || enumSet.includes(value); } /** * Returns an hpq matcher given a source object. * * @param {Object} sourceConfig Attribute Source object. * * @return {Function} A hpq Matcher. */ const matcherFromSource = memize(sourceConfig => { switch (sourceConfig.source) { case 'attribute': { let matcher = attr(sourceConfig.selector, sourceConfig.attribute); if (sourceConfig.type === 'boolean') { matcher = toBooleanAttributeMatcher(matcher); } return matcher; } case 'html': return matchers_html(sourceConfig.selector, sourceConfig.multiline); case 'text': return es_text(sourceConfig.selector); case 'rich-text': return richText(sourceConfig.selector, sourceConfig.__unstablePreserveWhiteSpace); case 'children': return children_matcher(sourceConfig.selector); case 'node': return matcher(sourceConfig.selector); case 'query': const subMatchers = Object.fromEntries(Object.entries(sourceConfig.query).map(([key, subSourceConfig]) => [key, matcherFromSource(subSourceConfig)])); return query(sourceConfig.selector, subMatchers); case 'tag': { const matcher = prop(sourceConfig.selector, 'nodeName'); return domNode => matcher(domNode)?.toLowerCase(); } default: // eslint-disable-next-line no-console console.error(`Unknown source type "${sourceConfig.source}"`); } }); /** * Parse a HTML string into DOM tree. * * @param {string|Node} innerHTML HTML string or already parsed DOM node. * * @return {Node} Parsed DOM node. */ function parseHtml(innerHTML) { return parse(innerHTML, h => h); } /** * Given a block's raw content and an attribute's schema returns the attribute's * value depending on its source. * * @param {string|Node} innerHTML Block's raw content. * @param {Object} attributeSchema Attribute's schema. * * @return {*} Attribute value. */ function parseWithAttributeSchema(innerHTML, attributeSchema) { return matcherFromSource(attributeSchema)(parseHtml(innerHTML)); } /** * Returns the block attributes of a registered block node given its type. * * @param {string|Object} blockTypeOrName Block type or name. * @param {string|Node} innerHTML Raw block content. * @param {?Object} attributes Known block attributes (from delimiters). * * @return {Object} All block attributes. */ function getBlockAttributes(blockTypeOrName, innerHTML, attributes = {}) { var _blockType$attributes; const doc = parseHtml(innerHTML); const blockType = normalizeBlockType(blockTypeOrName); const blockAttributes = Object.fromEntries(Object.entries((_blockType$attributes = blockType.attributes) !== null && _blockType$attributes !== void 0 ? _blockType$attributes : {}).map(([key, schema]) => [key, getBlockAttribute(key, schema, doc, attributes, innerHTML)])); return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getBlockAttributes', blockAttributes, blockType, innerHTML, attributes); } ;// ./node_modules/@wordpress/blocks/build-module/api/parser/fix-custom-classname.js /** * Internal dependencies */ const CLASS_ATTR_SCHEMA = { type: 'string', source: 'attribute', selector: '[data-custom-class-name] > *', attribute: 'class' }; /** * Given an HTML string, returns an array of class names assigned to the root * element in the markup. * * @param {string} innerHTML Markup string from which to extract classes. * * @return {string[]} Array of class names assigned to the root element. */ function getHTMLRootElementClasses(innerHTML) { const parsed = parseWithAttributeSchema(`
${innerHTML}
`, CLASS_ATTR_SCHEMA); return parsed ? parsed.trim().split(/\s+/) : []; } /** * Given a parsed set of block attributes, if the block supports custom class * names and an unknown class (per the block's serialization behavior) is * found, the unknown classes are treated as custom classes. This prevents the * block from being considered as invalid. * * @param {Object} blockAttributes Original block attributes. * @param {Object} blockType Block type settings. * @param {string} innerHTML Original block markup. * * @return {Object} Filtered block attributes. */ function fixCustomClassname(blockAttributes, blockType, innerHTML) { if (!hasBlockSupport(blockType, 'customClassName', true)) { return blockAttributes; } const modifiedBlockAttributes = { ...blockAttributes }; // To determine difference, serialize block given the known set of // attributes, with the exception of `className`. This will determine // the default set of classes. From there, any difference in innerHTML // can be considered as custom classes. const { className: omittedClassName, ...attributesSansClassName } = modifiedBlockAttributes; const serialized = getSaveContent(blockType, attributesSansClassName); const defaultClasses = getHTMLRootElementClasses(serialized); const actualClasses = getHTMLRootElementClasses(innerHTML); const customClasses = actualClasses.filter(className => !defaultClasses.includes(className)); if (customClasses.length) { modifiedBlockAttributes.className = customClasses.join(' '); } else if (serialized) { delete modifiedBlockAttributes.className; } return modifiedBlockAttributes; } ;// ./node_modules/@wordpress/blocks/build-module/api/parser/fix-aria-label.js /** * Internal dependencies */ const ARIA_LABEL_ATTR_SCHEMA = { type: 'string', source: 'attribute', selector: '[data-aria-label] > *', attribute: 'aria-label' }; /** * Given an HTML string, returns the aria-label attribute assigned to * the root element in the markup. * * @param {string} innerHTML Markup string from which to extract the aria-label. * * @return {string} The aria-label assigned to the root element. */ function getHTMLRootElementAriaLabel(innerHTML) { const parsed = parseWithAttributeSchema(`
${innerHTML}
`, ARIA_LABEL_ATTR_SCHEMA); return parsed; } /** * Given a parsed set of block attributes, if the block supports ariaLabel * and an aria-label attribute is found, the aria-label attribute is assigned * to the block attributes. * * @param {Object} blockAttributes Original block attributes. * @param {Object} blockType Block type settings. * @param {string} innerHTML Original block markup. * * @return {Object} Filtered block attributes. */ function fixAriaLabel(blockAttributes, blockType, innerHTML) { if (!hasBlockSupport(blockType, 'ariaLabel', false)) { return blockAttributes; } const modifiedBlockAttributes = { ...blockAttributes }; const ariaLabel = getHTMLRootElementAriaLabel(innerHTML); if (ariaLabel) { modifiedBlockAttributes.ariaLabel = ariaLabel; } return modifiedBlockAttributes; } ;// ./node_modules/@wordpress/blocks/build-module/api/parser/apply-built-in-validation-fixes.js /** * Internal dependencies */ /** * Attempts to fix block invalidation by applying build-in validation fixes * like moving all extra classNames to the className attribute. * * @param {WPBlock} block block object. * @param {import('../registration').WPBlockType} blockType Block type. This is normalize not necessary and * can be inferred from the block name, * but it's here for performance reasons. * * @return {WPBlock} Fixed block object */ function applyBuiltInValidationFixes(block, blockType) { const { attributes, originalContent } = block; let updatedBlockAttributes = attributes; // Fix block invalidation for className attribute. updatedBlockAttributes = fixCustomClassname(attributes, blockType, originalContent); // Fix block invalidation for ariaLabel attribute. updatedBlockAttributes = fixAriaLabel(updatedBlockAttributes, blockType, originalContent); return { ...block, attributes: updatedBlockAttributes }; } ;// ./node_modules/@wordpress/blocks/build-module/api/parser/apply-block-deprecated-versions.js /** * Internal dependencies */ /** * Function that takes no arguments and always returns false. * * @return {boolean} Always returns false. */ function stubFalse() { return false; } /** * Given a block object, returns a new copy of the block with any applicable * deprecated migrations applied, or the original block if it was both valid * and no eligible migrations exist. * * @param {import(".").WPBlock} block Parsed and invalid block object. * @param {import(".").WPRawBlock} rawBlock Raw block object. * @param {import('../registration').WPBlockType} blockType Block type. This is normalize not necessary and * can be inferred from the block name, * but it's here for performance reasons. * * @return {import(".").WPBlock} Migrated block object. */ function applyBlockDeprecatedVersions(block, rawBlock, blockType) { const parsedAttributes = rawBlock.attrs; const { deprecated: deprecatedDefinitions } = blockType; // Bail early if there are no registered deprecations to be handled. if (!deprecatedDefinitions || !deprecatedDefinitions.length) { return block; } // By design, blocks lack any sort of version tracking. Instead, to process // outdated content the system operates a queue out of all the defined // attribute shapes and tries each definition until the input produces a // valid result. This mechanism seeks to avoid polluting the user-space with // machine-specific code. An invalid block is thus a block that could not be // matched successfully with any of the registered deprecation definitions. for (let i = 0; i < deprecatedDefinitions.length; i++) { // A block can opt into a migration even if the block is valid by // defining `isEligible` on its deprecation. If the block is both valid // and does not opt to migrate, skip. const { isEligible = stubFalse } = deprecatedDefinitions[i]; if (block.isValid && !isEligible(parsedAttributes, block.innerBlocks, { blockNode: rawBlock, block })) { continue; } // Block type properties which could impact either serialization or // parsing are not considered in the deprecated block type by default, // and must be explicitly provided. const deprecatedBlockType = Object.assign(omit(blockType, DEPRECATED_ENTRY_KEYS), deprecatedDefinitions[i]); let migratedBlock = { ...block, attributes: getBlockAttributes(deprecatedBlockType, block.originalContent, parsedAttributes) }; // Ignore the deprecation if it produces a block which is not valid. let [isValid] = validateBlock(migratedBlock, deprecatedBlockType); // If the migrated block is not valid initially, try the built-in fixes. if (!isValid) { migratedBlock = applyBuiltInValidationFixes(migratedBlock, deprecatedBlockType); [isValid] = validateBlock(migratedBlock, deprecatedBlockType); } // An invalid block does not imply incorrect HTML but the fact block // source information could be lost on re-serialization. if (!isValid) { continue; } let migratedInnerBlocks = migratedBlock.innerBlocks; let migratedAttributes = migratedBlock.attributes; // A block may provide custom behavior to assign new attributes and/or // inner blocks. const { migrate } = deprecatedBlockType; if (migrate) { let migrated = migrate(migratedAttributes, block.innerBlocks); if (!Array.isArray(migrated)) { migrated = [migrated]; } [migratedAttributes = parsedAttributes, migratedInnerBlocks = block.innerBlocks] = migrated; } block = { ...block, attributes: migratedAttributes, innerBlocks: migratedInnerBlocks, isValid: true, validationIssues: [] }; } return block; } ;// ./node_modules/@wordpress/blocks/build-module/api/parser/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * The raw structure of a block includes its attributes, inner * blocks, and inner HTML. It is important to distinguish inner blocks from * the HTML content of the block as only the latter is relevant for block * validation and edit operations. * * @typedef WPRawBlock * * @property {string=} blockName Block name * @property {Object=} attrs Block raw or comment attributes. * @property {string} innerHTML HTML content of the block. * @property {(string|null)[]} innerContent Content without inner blocks. * @property {WPRawBlock[]} innerBlocks Inner Blocks. */ /** * Fully parsed block object. * * @typedef WPBlock * * @property {string} name Block name * @property {Object} attributes Block raw or comment attributes. * @property {WPBlock[]} innerBlocks Inner Blocks. * @property {string} originalContent Original content of the block before validation fixes. * @property {boolean} isValid Whether the block is valid. * @property {Object[]} validationIssues Validation issues. * @property {WPRawBlock} [__unstableBlockSource] Un-processed original copy of block if created through parser. */ /** * @typedef {Object} ParseOptions * @property {boolean?} __unstableSkipMigrationLogs If a block is migrated from a deprecated version, skip logging the migration details. * @property {boolean?} __unstableSkipAutop Whether to skip autop when processing freeform content. */ /** * Convert legacy blocks to their canonical form. This function is used * both in the parser level for previous content and to convert such blocks * used in Custom Post Types templates. * * @param {WPRawBlock} rawBlock * * @return {WPRawBlock} The block's name and attributes, changed accordingly if a match was found */ function convertLegacyBlocks(rawBlock) { const [correctName, correctedAttributes] = convertLegacyBlockNameAndAttributes(rawBlock.blockName, rawBlock.attrs); return { ...rawBlock, blockName: correctName, attrs: correctedAttributes }; } /** * Normalize the raw block by applying the fallback block name if none given, * sanitize the parsed HTML... * * @param {WPRawBlock} rawBlock The raw block object. * @param {ParseOptions?} options Extra options for handling block parsing. * * @return {WPRawBlock} The normalized block object. */ function normalizeRawBlock(rawBlock, options) { const fallbackBlockName = getFreeformContentHandlerName(); // If the grammar parsing don't produce any block name, use the freeform block. const rawBlockName = rawBlock.blockName || getFreeformContentHandlerName(); const rawAttributes = rawBlock.attrs || {}; const rawInnerBlocks = rawBlock.innerBlocks || []; let rawInnerHTML = rawBlock.innerHTML.trim(); // Fallback content may be upgraded from classic content expecting implicit // automatic paragraphs, so preserve them. Assumes wpautop is idempotent, // meaning there are no negative consequences to repeated autop calls. if (rawBlockName === fallbackBlockName && rawBlockName === 'core/freeform' && !options?.__unstableSkipAutop) { rawInnerHTML = (0,external_wp_autop_namespaceObject.autop)(rawInnerHTML).trim(); } return { ...rawBlock, blockName: rawBlockName, attrs: rawAttributes, innerHTML: rawInnerHTML, innerBlocks: rawInnerBlocks }; } /** * Uses the "unregistered blockType" to create a block object. * * @param {WPRawBlock} rawBlock block. * * @return {WPRawBlock} The unregistered block object. */ function createMissingBlockType(rawBlock) { const unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || getFreeformContentHandlerName(); // Preserve undelimited content for use by the unregistered type // handler. A block node's `innerHTML` isn't enough, as that field only // carries the block's own HTML and not its nested blocks. const originalUndelimitedContent = serializeRawBlock(rawBlock, { isCommentDelimited: false }); // Preserve full block content for use by the unregistered type // handler, block boundaries included. const originalContent = serializeRawBlock(rawBlock, { isCommentDelimited: true }); return { blockName: unregisteredFallbackBlock, attrs: { originalName: rawBlock.blockName, originalContent, originalUndelimitedContent }, innerHTML: rawBlock.blockName ? originalContent : rawBlock.innerHTML, innerBlocks: rawBlock.innerBlocks, innerContent: rawBlock.innerContent }; } /** * Validates a block and wraps with validation meta. * * The name here is regrettable but `validateBlock` is already taken. * * @param {WPBlock} unvalidatedBlock * @param {import('../registration').WPBlockType} blockType * @return {WPBlock} validated block, with auto-fixes if initially invalid */ function applyBlockValidation(unvalidatedBlock, blockType) { // Attempt to validate the block. const [isValid] = validateBlock(unvalidatedBlock, blockType); if (isValid) { return { ...unvalidatedBlock, isValid, validationIssues: [] }; } // If the block is invalid, attempt some built-in fixes // like custom classNames handling. const fixedBlock = applyBuiltInValidationFixes(unvalidatedBlock, blockType); // Attempt to validate the block once again after the built-in fixes. const [isFixedValid, validationIssues] = validateBlock(fixedBlock, blockType); return { ...fixedBlock, isValid: isFixedValid, validationIssues }; } /** * Given a raw block returned by grammar parsing, returns a fully parsed block. * * @param {WPRawBlock} rawBlock The raw block object. * @param {ParseOptions} options Extra options for handling block parsing. * * @return {WPBlock | undefined} Fully parsed block. */ function parseRawBlock(rawBlock, options) { let normalizedBlock = normalizeRawBlock(rawBlock, options); // During the lifecycle of the project, we renamed some old blocks // and transformed others to new blocks. To avoid breaking existing content, // we added this function to properly parse the old content. normalizedBlock = convertLegacyBlocks(normalizedBlock); // Try finding the type for known block name. let blockType = getBlockType(normalizedBlock.blockName); // If not blockType is found for the specified name, fallback to the "unregisteredBlockType". if (!blockType) { normalizedBlock = createMissingBlockType(normalizedBlock); blockType = getBlockType(normalizedBlock.blockName); } // If it's an empty freeform block or there's no blockType (no missing block handler) // Then, just ignore the block. // It might be a good idea to throw a warning here. // TODO: I'm unsure about the unregisteredFallbackBlock check, // it might ignore some dynamic unregistered third party blocks wrongly. const isFallbackBlock = normalizedBlock.blockName === getFreeformContentHandlerName() || normalizedBlock.blockName === getUnregisteredTypeHandlerName(); if (!blockType || !normalizedBlock.innerHTML && isFallbackBlock) { return; } // Parse inner blocks recursively. const parsedInnerBlocks = normalizedBlock.innerBlocks.map(innerBlock => parseRawBlock(innerBlock, options)) // See https://github.com/WordPress/gutenberg/pull/17164. .filter(innerBlock => !!innerBlock); // Get the fully parsed block. const parsedBlock = createBlock(normalizedBlock.blockName, getBlockAttributes(blockType, normalizedBlock.innerHTML, normalizedBlock.attrs), parsedInnerBlocks); parsedBlock.originalContent = normalizedBlock.innerHTML; const validatedBlock = applyBlockValidation(parsedBlock, blockType); const { validationIssues } = validatedBlock; // Run the block deprecation and migrations. // This is performed on both invalid and valid blocks because // migration using the `migrate` functions should run even // if the output is deemed valid. const updatedBlock = applyBlockDeprecatedVersions(validatedBlock, normalizedBlock, blockType); if (!updatedBlock.isValid) { // Preserve the original unprocessed version of the block // that we received (no fixes, no deprecations) so that // we can save it as close to exactly the same way as // we loaded it. This is important to avoid corruption // and data loss caused by block implementations trying // to process data that isn't fully recognized. updatedBlock.__unstableBlockSource = rawBlock; } if (!validatedBlock.isValid && updatedBlock.isValid && !options?.__unstableSkipMigrationLogs) { /* eslint-disable no-console */ console.groupCollapsed('Updated Block: %s', blockType.name); console.info('Block successfully updated for `%s` (%o).\n\nNew content generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, getSaveContent(blockType, updatedBlock.attributes), updatedBlock.originalContent); console.groupEnd(); /* eslint-enable no-console */ } else if (!validatedBlock.isValid && !updatedBlock.isValid) { validationIssues.forEach(({ log, args }) => log(...args)); } return updatedBlock; } /** * Utilizes an optimized token-driven parser based on the Gutenberg grammar spec * defined through a parsing expression grammar to take advantage of the regular * cadence provided by block delimiters -- composed syntactically through HTML * comments -- which, given a general HTML document as an input, returns a block * list array representation. * * This is a recursive-descent parser that scans linearly once through the input * document. Instead of directly recursing it utilizes a trampoline mechanism to * prevent stack overflow. This initial pass is mainly interested in separating * and isolating the blocks serialized in the document and manifestly not in the * content within the blocks. * * @see * https://developer.wordpress.org/block-editor/packages/packages-block-serialization-default-parser/ * * @param {string} content The post content. * @param {ParseOptions} options Extra options for handling block parsing. * * @return {Array} Block list. */ function parser_parse(content, options) { return (0,external_wp_blockSerializationDefaultParser_namespaceObject.parse)(content).reduce((accumulator, rawBlock) => { const block = parseRawBlock(rawBlock, options); if (block) { accumulator.push(block); } return accumulator; }, []); } ;// ./node_modules/@wordpress/blocks/build-module/api/raw-handling/get-raw-transforms.js /** * Internal dependencies */ function getRawTransforms() { return getBlockTransforms('from').filter(({ type }) => type === 'raw').map(transform => { return transform.isMatch ? transform : { ...transform, isMatch: node => transform.selector && node.matches(transform.selector) }; }); } ;// ./node_modules/@wordpress/blocks/build-module/api/raw-handling/html-to-blocks.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Converts HTML directly to blocks. Looks for a matching transform for each * top-level tag. The HTML should be filtered to not have any text between * top-level tags and formatted in a way that blocks can handle the HTML. * * @param {string} html HTML to convert. * @param {Function} handler The handler calling htmlToBlocks: either rawHandler * or pasteHandler. * * @return {Array} An array of blocks. */ function htmlToBlocks(html, handler) { const doc = document.implementation.createHTMLDocument(''); doc.body.innerHTML = html; return Array.from(doc.body.children).flatMap(node => { const rawTransform = findTransform(getRawTransforms(), ({ isMatch }) => isMatch(node)); if (!rawTransform) { // Until the HTML block is supported in the native version, we'll parse it // instead of creating the block to generate it as an unsupported block. if (external_wp_element_namespaceObject.Platform.isNative) { return parser_parse(`${node.outerHTML}`); } return createBlock( // Should not be hardcoded. 'core/html', getBlockAttributes('core/html', node.outerHTML)); } const { transform, blockName } = rawTransform; if (transform) { const block = transform(node, handler); if (node.hasAttribute('class')) { block.attributes.className = node.getAttribute('class'); } return block; } return createBlock(blockName, getBlockAttributes(blockName, node.outerHTML)); }); } ;// ./node_modules/@wordpress/blocks/build-module/api/raw-handling/normalise-blocks.js /** * WordPress dependencies */ function normaliseBlocks(HTML, options = {}) { const decuDoc = document.implementation.createHTMLDocument(''); const accuDoc = document.implementation.createHTMLDocument(''); const decu = decuDoc.body; const accu = accuDoc.body; decu.innerHTML = HTML; while (decu.firstChild) { const node = decu.firstChild; // Text nodes: wrap in a paragraph, or append to previous. if (node.nodeType === node.TEXT_NODE) { if ((0,external_wp_dom_namespaceObject.isEmpty)(node)) { decu.removeChild(node); } else { if (!accu.lastChild || accu.lastChild.nodeName !== 'P') { accu.appendChild(accuDoc.createElement('P')); } accu.lastChild.appendChild(node); } // Element nodes. } else if (node.nodeType === node.ELEMENT_NODE) { // BR nodes: create a new paragraph on double, or append to previous. if (node.nodeName === 'BR') { if (node.nextSibling && node.nextSibling.nodeName === 'BR') { accu.appendChild(accuDoc.createElement('P')); decu.removeChild(node.nextSibling); } // Don't append to an empty paragraph. if (accu.lastChild && accu.lastChild.nodeName === 'P' && accu.lastChild.hasChildNodes()) { accu.lastChild.appendChild(node); } else { decu.removeChild(node); } } else if (node.nodeName === 'P') { // Only append non-empty paragraph nodes. if ((0,external_wp_dom_namespaceObject.isEmpty)(node) && !options.raw) { decu.removeChild(node); } else { accu.appendChild(node); } } else if ((0,external_wp_dom_namespaceObject.isPhrasingContent)(node)) { if (!accu.lastChild || accu.lastChild.nodeName !== 'P') { accu.appendChild(accuDoc.createElement('P')); } accu.lastChild.appendChild(node); } else { accu.appendChild(node); } } else { decu.removeChild(node); } } return accu.innerHTML; } ;// ./node_modules/@wordpress/blocks/build-module/api/raw-handling/special-comment-converter.js /** * WordPress dependencies */ /** * Looks for `` and `` comments and * replaces them with a custom element representing a future block. * * The custom element is a way to bypass the rest of the `raw-handling` * transforms, which would eliminate other kinds of node with which to carry * ``'s data: nodes with `data` attributes, empty paragraphs, etc. * * The custom element is then expected to be recognized by any registered * block's `raw` transform. * * @param {Node} node The node to be processed. * @param {Document} doc The document of the node. * @return {void} */ function specialCommentConverter(node, doc) { if (node.nodeType !== node.COMMENT_NODE) { return; } if (node.nodeValue !== 'nextpage' && node.nodeValue.indexOf('more') !== 0) { return; } const block = special_comment_converter_createBlock(node, doc); // If our `` comment is in the middle of a paragraph, we should // split the paragraph in two and insert the more block in between. If it's // inside an empty paragraph, we should still move it out of the paragraph // and remove the paragraph. If there's no paragraph, fall back to simply // replacing the comment. if (!node.parentNode || node.parentNode.nodeName !== 'P') { (0,external_wp_dom_namespaceObject.replace)(node, block); } else { const childNodes = Array.from(node.parentNode.childNodes); const nodeIndex = childNodes.indexOf(node); const wrapperNode = node.parentNode.parentNode || doc.body; const paragraphBuilder = (acc, child) => { if (!acc) { acc = doc.createElement('p'); } acc.appendChild(child); return acc; }; // Split the original parent node and insert our more block [childNodes.slice(0, nodeIndex).reduce(paragraphBuilder, null), block, childNodes.slice(nodeIndex + 1).reduce(paragraphBuilder, null)].forEach(element => element && wrapperNode.insertBefore(element, node.parentNode)); // Remove the old parent paragraph (0,external_wp_dom_namespaceObject.remove)(node.parentNode); } } function special_comment_converter_createBlock(commentNode, doc) { if (commentNode.nodeValue === 'nextpage') { return createNextpage(doc); } // Grab any custom text in the comment. const customText = commentNode.nodeValue.slice(4).trim(); /* * When a `` comment is found, we need to look for any * `` sibling, but it may not be a direct sibling * (whitespace typically lies in between) */ let sibling = commentNode; let noTeaser = false; while (sibling = sibling.nextSibling) { if (sibling.nodeType === sibling.COMMENT_NODE && sibling.nodeValue === 'noteaser') { noTeaser = true; (0,external_wp_dom_namespaceObject.remove)(sibling); break; } } return createMore(customText, noTeaser, doc); } function createMore(customText, noTeaser, doc) { const node = doc.createElement('wp-block'); node.dataset.block = 'core/more'; if (customText) { node.dataset.customText = customText; } if (noTeaser) { // "Boolean" data attribute. node.dataset.noTeaser = ''; } return node; } function createNextpage(doc) { const node = doc.createElement('wp-block'); node.dataset.block = 'core/nextpage'; return node; } ;// ./node_modules/@wordpress/blocks/build-module/api/raw-handling/list-reducer.js /** * WordPress dependencies */ function isList(node) { return node.nodeName === 'OL' || node.nodeName === 'UL'; } function shallowTextContent(element) { return Array.from(element.childNodes).map(({ nodeValue = '' }) => nodeValue).join(''); } function listReducer(node) { if (!isList(node)) { return; } const list = node; const prevElement = node.previousElementSibling; // Merge with previous list if: // * There is a previous list of the same type. // * There is only one list item. if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) { // Move all child nodes, including any text nodes, if any. while (list.firstChild) { prevElement.appendChild(list.firstChild); } list.parentNode.removeChild(list); } const parentElement = node.parentNode; // Nested list with empty parent item. if (parentElement && parentElement.nodeName === 'LI' && parentElement.children.length === 1 && !/\S/.test(shallowTextContent(parentElement))) { const parentListItem = parentElement; const prevListItem = parentListItem.previousElementSibling; const parentList = parentListItem.parentNode; if (prevListItem) { prevListItem.appendChild(list); parentList.removeChild(parentListItem); } } // Invalid: OL/UL > OL/UL. if (parentElement && isList(parentElement)) { const prevListItem = node.previousElementSibling; if (prevListItem) { prevListItem.appendChild(node); } else { (0,external_wp_dom_namespaceObject.unwrap)(node); } } } ;// ./node_modules/@wordpress/blocks/build-module/api/raw-handling/blockquote-normaliser.js /** * Internal dependencies */ function blockquoteNormaliser(options) { return node => { if (node.nodeName !== 'BLOCKQUOTE') { return; } node.innerHTML = normaliseBlocks(node.innerHTML, options); }; } ;// ./node_modules/@wordpress/blocks/build-module/api/raw-handling/figure-content-reducer.js /** * WordPress dependencies */ /** * Whether or not the given node is figure content. * * @param {Node} node The node to check. * @param {Object} schema The schema to use. * * @return {boolean} True if figure content, false if not. */ function isFigureContent(node, schema) { var _schema$figure$childr; const tag = node.nodeName.toLowerCase(); // We are looking for tags that can be a child of the figure tag, excluding // `figcaption` and any phrasing content. if (tag === 'figcaption' || (0,external_wp_dom_namespaceObject.isTextContent)(node)) { return false; } return tag in ((_schema$figure$childr = schema?.figure?.children) !== null && _schema$figure$childr !== void 0 ? _schema$figure$childr : {}); } /** * Whether or not the given node can have an anchor. * * @param {Node} node The node to check. * @param {Object} schema The schema to use. * * @return {boolean} True if it can, false if not. */ function canHaveAnchor(node, schema) { var _schema$figure$childr2; const tag = node.nodeName.toLowerCase(); return tag in ((_schema$figure$childr2 = schema?.figure?.children?.a?.children) !== null && _schema$figure$childr2 !== void 0 ? _schema$figure$childr2 : {}); } /** * Wraps the given element in a figure element. * * @param {Element} element The element to wrap. * @param {Element} beforeElement The element before which to place the figure. */ function wrapFigureContent(element, beforeElement = element) { const figure = element.ownerDocument.createElement('figure'); beforeElement.parentNode.insertBefore(figure, beforeElement); figure.appendChild(element); } /** * This filter takes figure content out of paragraphs, wraps it in a figure * element, and moves any anchors with it if needed. * * @param {Node} node The node to filter. * @param {Document} doc The document of the node. * @param {Object} schema The schema to use. * * @return {void} */ function figureContentReducer(node, doc, schema) { if (!isFigureContent(node, schema)) { return; } let nodeToInsert = node; const parentNode = node.parentNode; // If the figure content can have an anchor and its parent is an anchor with // only the figure content, take the anchor out instead of just the content. if (canHaveAnchor(node, schema) && parentNode.nodeName === 'A' && parentNode.childNodes.length === 1) { nodeToInsert = node.parentNode; } const wrapper = nodeToInsert.closest('p,div'); // If wrapped in a paragraph or div, only extract if it's aligned or if // there is no text content. // Otherwise, if directly at the root, wrap in a figure element. if (wrapper) { // In jsdom-jscore, 'node.classList' can be undefined. // In this case, default to extract as it offers a better UI experience on mobile. if (!node.classList) { wrapFigureContent(nodeToInsert, wrapper); } else if (node.classList.contains('alignright') || node.classList.contains('alignleft') || node.classList.contains('aligncenter') || !wrapper.textContent.trim()) { wrapFigureContent(nodeToInsert, wrapper); } } else { wrapFigureContent(nodeToInsert); } } ;// external ["wp","shortcode"] const external_wp_shortcode_namespaceObject = window["wp"]["shortcode"]; ;// ./node_modules/@wordpress/blocks/build-module/api/raw-handling/shortcode-converter.js /** * WordPress dependencies */ /** * Internal dependencies */ const castArray = maybeArray => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; const beforeLineRegexp = /(\n|

)\s*$/; const afterLineRegexp = /^\s*(\n|<\/p>)/; function segmentHTMLToShortcodeBlock(HTML, lastIndex = 0, excludedBlockNames = []) { // Get all matches. const transformsFrom = getBlockTransforms('from'); const transformation = findTransform(transformsFrom, transform => excludedBlockNames.indexOf(transform.blockName) === -1 && transform.type === 'shortcode' && castArray(transform.tag).some(tag => (0,external_wp_shortcode_namespaceObject.regexp)(tag).test(HTML))); if (!transformation) { return [HTML]; } const transformTags = castArray(transformation.tag); const transformTag = transformTags.find(tag => (0,external_wp_shortcode_namespaceObject.regexp)(tag).test(HTML)); let match; const previousIndex = lastIndex; if (match = (0,external_wp_shortcode_namespaceObject.next)(transformTag, HTML, lastIndex)) { lastIndex = match.index + match.content.length; const beforeHTML = HTML.substr(0, match.index); const afterHTML = HTML.substr(lastIndex); // If the shortcode content does not contain HTML and the shortcode is // not on a new line (or in paragraph from Markdown converter), // consider the shortcode as inline text, and thus skip conversion for // this segment. if (!match.shortcode.content?.includes('<') && !(beforeLineRegexp.test(beforeHTML) && afterLineRegexp.test(afterHTML))) { return segmentHTMLToShortcodeBlock(HTML, lastIndex); } // If a transformation's `isMatch` predicate fails for the inbound // shortcode, try again by excluding the current block type. // // This is the only call to `segmentHTMLToShortcodeBlock` that should // ever carry over `excludedBlockNames`. Other calls in the module // should skip that argument as a way to reset the exclusion state, so // that one `isMatch` fail in an HTML fragment doesn't prevent any // valid matches in subsequent fragments. if (transformation.isMatch && !transformation.isMatch(match.shortcode.attrs)) { return segmentHTMLToShortcodeBlock(HTML, previousIndex, [...excludedBlockNames, transformation.blockName]); } let blocks = []; if (typeof transformation.transform === 'function') { // Passing all of `match` as second argument is intentionally broad // but shouldn't be too relied upon. // // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926 blocks = [].concat(transformation.transform(match.shortcode.attrs, match)); // Applying the built-in fixes can enhance the attributes with missing content like "className". blocks = blocks.map(block => { block.originalContent = match.shortcode.content; return applyBuiltInValidationFixes(block, getBlockType(block.name)); }); } else { const attributes = Object.fromEntries(Object.entries(transformation.attributes).filter(([, schema]) => schema.shortcode) // Passing all of `match` as second argument is intentionally broad // but shouldn't be too relied upon. // // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926 .map(([key, schema]) => [key, schema.shortcode(match.shortcode.attrs, match)])); const blockType = getBlockType(transformation.blockName); if (!blockType) { return [HTML]; } const transformationBlockType = { ...blockType, attributes: transformation.attributes }; let block = createBlock(transformation.blockName, getBlockAttributes(transformationBlockType, match.shortcode.content, attributes)); // Applying the built-in fixes can enhance the attributes with missing content like "className". block.originalContent = match.shortcode.content; block = applyBuiltInValidationFixes(block, transformationBlockType); blocks = [block]; } return [...segmentHTMLToShortcodeBlock(beforeHTML.replace(beforeLineRegexp, '')), ...blocks, ...segmentHTMLToShortcodeBlock(afterHTML.replace(afterLineRegexp, ''))]; } return [HTML]; } /* harmony default export */ const shortcode_converter = (segmentHTMLToShortcodeBlock); ;// ./node_modules/@wordpress/blocks/build-module/api/raw-handling/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ function getBlockContentSchemaFromTransforms(transforms, context) { const phrasingContentSchema = (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)(context); const schemaArgs = { phrasingContentSchema, isPaste: context === 'paste' }; const schemas = transforms.map(({ isMatch, blockName, schema }) => { const hasAnchorSupport = hasBlockSupport(blockName, 'anchor'); schema = typeof schema === 'function' ? schema(schemaArgs) : schema; // If the block does not has anchor support and the transform does not // provides an isMatch we can return the schema right away. if (!hasAnchorSupport && !isMatch) { return schema; } if (!schema) { return {}; } return Object.fromEntries(Object.entries(schema).map(([key, value]) => { let attributes = value.attributes || []; // If the block supports the "anchor" functionality, it needs to keep its ID attribute. if (hasAnchorSupport) { attributes = [...attributes, 'id']; } return [key, { ...value, attributes, isMatch: isMatch ? isMatch : undefined }]; })); }); function mergeTagNameSchemaProperties(objValue, srcValue, key) { switch (key) { case 'children': { if (objValue === '*' || srcValue === '*') { return '*'; } return { ...objValue, ...srcValue }; } case 'attributes': case 'require': { return [...(objValue || []), ...(srcValue || [])]; } case 'isMatch': { // If one of the values being merge is undefined (matches everything), // the result of the merge will be undefined. if (!objValue || !srcValue) { return undefined; } // When merging two isMatch functions, the result is a new function // that returns if one of the source functions returns true. return (...args) => { return objValue(...args) || srcValue(...args); }; } } } // A tagName schema is an object with children, attributes, require, and // isMatch properties. function mergeTagNameSchemas(a, b) { for (const key in b) { a[key] = a[key] ? mergeTagNameSchemaProperties(a[key], b[key], key) : { ...b[key] }; } return a; } // A schema is an object with tagName schemas by tag name. function mergeSchemas(a, b) { for (const key in b) { a[key] = a[key] ? mergeTagNameSchemas(a[key], b[key]) : { ...b[key] }; } return a; } return schemas.reduce(mergeSchemas, {}); } /** * Gets the block content schema, which is extracted and merged from all * registered blocks with raw transforms. * * @param {string} context Set to "paste" when in paste context, where the * schema is more strict. * * @return {Object} A complete block content schema. */ function getBlockContentSchema(context) { return getBlockContentSchemaFromTransforms(getRawTransforms(), context); } /** * Checks whether HTML can be considered plain text. That is, it does not contain * any elements that are not line breaks. * * @param {string} HTML The HTML to check. * * @return {boolean} Whether the HTML can be considered plain text. */ function isPlain(HTML) { return !/<(?!br[ />])/i.test(HTML); } /** * Given node filters, deeply filters and mutates a NodeList. * * @param {NodeList} nodeList The nodeList to filter. * @param {Array} filters An array of functions that can mutate with the provided node. * @param {Document} doc The document of the nodeList. * @param {Object} schema The schema to use. */ function deepFilterNodeList(nodeList, filters, doc, schema) { Array.from(nodeList).forEach(node => { deepFilterNodeList(node.childNodes, filters, doc, schema); filters.forEach(item => { // Make sure the node is still attached to the document. if (!doc.contains(node)) { return; } item(node, doc, schema); }); }); } /** * Given node filters, deeply filters HTML tags. * Filters from the deepest nodes to the top. * * @param {string} HTML The HTML to filter. * @param {Array} filters An array of functions that can mutate with the provided node. * @param {Object} schema The schema to use. * * @return {string} The filtered HTML. */ function deepFilterHTML(HTML, filters = [], schema) { const doc = document.implementation.createHTMLDocument(''); doc.body.innerHTML = HTML; deepFilterNodeList(doc.body.childNodes, filters, doc, schema); return doc.body.innerHTML; } /** * Gets a sibling within text-level context. * * @param {Element} node The subject node. * @param {string} which "next" or "previous". */ function getSibling(node, which) { const sibling = node[`${which}Sibling`]; if (sibling && (0,external_wp_dom_namespaceObject.isPhrasingContent)(sibling)) { return sibling; } const { parentNode } = node; if (!parentNode || !(0,external_wp_dom_namespaceObject.isPhrasingContent)(parentNode)) { return; } return getSibling(parentNode, which); } ;// ./node_modules/@wordpress/blocks/build-module/api/raw-handling/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function deprecatedGetPhrasingContentSchema(context) { external_wp_deprecated_default()('wp.blocks.getPhrasingContentSchema', { since: '5.6', alternative: 'wp.dom.getPhrasingContentSchema' }); return (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)(context); } /** * Converts an HTML string to known blocks. * * @param {Object} $1 * @param {string} $1.HTML The HTML to convert. * * @return {Array} A list of blocks. */ function rawHandler({ HTML = '' }) { // If we detect block delimiters, parse entirely as blocks. if (HTML.indexOf(')?/i, ''); HTML = HTML.replace(/(?:\s*)?<\/body>\s*<\/html>\s*$/i, ''); // If we detect block delimiters in HTML, parse entirely as blocks. if (mode !== 'INLINE') { // Check plain text if there is no HTML. const content = HTML ? HTML : plainText; if (content.indexOf('/g, spaceRegExp: / | /gi, HTMLEntityRegExp: /&\S+?;/g, // \u2014 = em-dash. connectorRegExp: /--|\u2014/g, // Characters to be removed from input text. removeRegExp: new RegExp(['[', // Basic Latin (extract) '\u0021-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E', // Latin-1 Supplement (extract) '\u0080-\u00BF\u00D7\u00F7', /* * The following range consists of: * General Punctuation * Superscripts and Subscripts * Currency Symbols * Combining Diacritical Marks for Symbols * Letterlike Symbols * Number Forms * Arrows * Mathematical Operators * Miscellaneous Technical * Control Pictures * Optical Character Recognition * Enclosed Alphanumerics * Box Drawing * Block Elements * Geometric Shapes * Miscellaneous Symbols * Dingbats * Miscellaneous Mathematical Symbols-A * Supplemental Arrows-A * Braille Patterns * Supplemental Arrows-B * Miscellaneous Mathematical Symbols-B * Supplemental Mathematical Operators * Miscellaneous Symbols and Arrows */ '\u2000-\u2BFF', // Supplemental Punctuation. '\u2E00-\u2E7F', ']'].join(''), 'g'), // Remove UTF-16 surrogate points, see https://en.wikipedia.org/wiki/UTF-16#U.2BD800_to_U.2BDFFF astralRegExp: /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, wordsRegExp: /\S\s+/g, characters_excluding_spacesRegExp: /\S/g, /* * Match anything that is not a formatting character, excluding: * \f = form feed * \n = new line * \r = carriage return * \t = tab * \v = vertical tab * \u00AD = soft hyphen * \u2028 = line separator * \u2029 = paragraph separator */ characters_including_spacesRegExp: /[^\f\n\r\t\v\u00AD\u2028\u2029]/g, l10n: { type: 'words' } }; ;// ./node_modules/@wordpress/wordcount/build-module/stripTags.js /** * Replaces items matched in the regex with new line * * @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions * @param {string} text The string being counted. * * @return {string} The manipulated text. */ function stripTags(settings, text) { return text.replace(settings.HTMLRegExp, '\n'); } ;// ./node_modules/@wordpress/wordcount/build-module/transposeAstralsToCountableChar.js /** * Replaces items matched in the regex with character. * * @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions * @param {string} text The string being counted. * * @return {string} The manipulated text. */ function transposeAstralsToCountableChar(settings, text) { return text.replace(settings.astralRegExp, 'a'); } ;// ./node_modules/@wordpress/wordcount/build-module/stripHTMLEntities.js /** * Removes items matched in the regex. * * @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions * @param {string} text The string being counted. * * @return {string} The manipulated text. */ function stripHTMLEntities(settings, text) { return text.replace(settings.HTMLEntityRegExp, ''); } ;// ./node_modules/@wordpress/wordcount/build-module/stripConnectors.js /** * Replaces items matched in the regex with spaces. * * @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions * @param {string} text The string being counted. * * @return {string} The manipulated text. */ function stripConnectors(settings, text) { return text.replace(settings.connectorRegExp, ' '); } ;// ./node_modules/@wordpress/wordcount/build-module/stripRemovables.js /** * Removes items matched in the regex. * * @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions * @param {string} text The string being counted. * * @return {string} The manipulated text. */ function stripRemovables(settings, text) { return text.replace(settings.removeRegExp, ''); } ;// ./node_modules/@wordpress/wordcount/build-module/stripHTMLComments.js /** * Removes items matched in the regex. * * @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions * @param {string} text The string being counted. * * @return {string} The manipulated text. */ function stripHTMLComments(settings, text) { return text.replace(settings.HTMLcommentRegExp, ''); } ;// ./node_modules/@wordpress/wordcount/build-module/stripShortcodes.js /** * Replaces items matched in the regex with a new line. * * @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions * @param {string} text The string being counted. * * @return {string} The manipulated text. */ function stripShortcodes(settings, text) { if (settings.shortcodesRegExp) { return text.replace(settings.shortcodesRegExp, '\n'); } return text; } ;// ./node_modules/@wordpress/wordcount/build-module/stripSpaces.js /** * Replaces items matched in the regex with spaces. * * @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions * @param {string} text The string being counted. * * @return {string} The manipulated text. */ function stripSpaces(settings, text) { return text.replace(settings.spaceRegExp, ' '); } ;// ./node_modules/@wordpress/wordcount/build-module/transposeHTMLEntitiesToCountableChars.js /** * Replaces items matched in the regex with a single character. * * @param {import('./index').WPWordCountSettings} settings The main settings object containing regular expressions * @param {string} text The string being counted. * * @return {string} The manipulated text. */ function transposeHTMLEntitiesToCountableChars(settings, text) { return text.replace(settings.HTMLEntityRegExp, 'a'); } ;// ./node_modules/@wordpress/wordcount/build-module/index.js /** * Internal dependencies */ /** * @typedef {import('./defaultSettings').WPWordCountDefaultSettings} WPWordCountSettings * @typedef {import('./defaultSettings').WPWordCountUserSettings} WPWordCountUserSettings */ /** * Possible ways of counting. * * @typedef {'words'|'characters_excluding_spaces'|'characters_including_spaces'} WPWordCountStrategy */ /** * Private function to manage the settings. * * @param {WPWordCountStrategy} type The type of count to be done. * @param {WPWordCountUserSettings} userSettings Custom settings for the count. * * @return {WPWordCountSettings} The combined settings object to be used. */ function loadSettings(type, userSettings) { var _settings$l10n$shortc; const settings = Object.assign({}, defaultSettings, userSettings); settings.shortcodes = (_settings$l10n$shortc = settings.l10n?.shortcodes) !== null && _settings$l10n$shortc !== void 0 ? _settings$l10n$shortc : []; if (settings.shortcodes && settings.shortcodes.length) { settings.shortcodesRegExp = new RegExp('\\[\\/?(?:' + settings.shortcodes.join('|') + ')[^\\]]*?\\]', 'g'); } settings.type = type; if (settings.type !== 'characters_excluding_spaces' && settings.type !== 'characters_including_spaces') { settings.type = 'words'; } return settings; } /** * Count the words in text * * @param {string} text The text being processed * @param {RegExp} regex The regular expression pattern being matched * @param {WPWordCountSettings} settings Settings object containing regular expressions for each strip function * * @return {number} Count of words. */ function countWords(text, regex, settings) { var _text$match$length; text = [stripTags.bind(null, settings), stripHTMLComments.bind(null, settings), stripShortcodes.bind(null, settings), stripSpaces.bind(null, settings), stripHTMLEntities.bind(null, settings), stripConnectors.bind(null, settings), stripRemovables.bind(null, settings)].reduce((result, fn) => fn(result), text); text = text + '\n'; return (_text$match$length = text.match(regex)?.length) !== null && _text$match$length !== void 0 ? _text$match$length : 0; } /** * Count the characters in text * * @param {string} text The text being processed * @param {RegExp} regex The regular expression pattern being matched * @param {WPWordCountSettings} settings Settings object containing regular expressions for each strip function * * @return {number} Count of characters. */ function countCharacters(text, regex, settings) { var _text$match$length2; text = [stripTags.bind(null, settings), stripHTMLComments.bind(null, settings), stripShortcodes.bind(null, settings), transposeAstralsToCountableChar.bind(null, settings), stripSpaces.bind(null, settings), transposeHTMLEntitiesToCountableChars.bind(null, settings)].reduce((result, fn) => fn(result), text); text = text + '\n'; return (_text$match$length2 = text.match(regex)?.length) !== null && _text$match$length2 !== void 0 ? _text$match$length2 : 0; } /** * Count some words. * * @param {string} text The text being processed * @param {WPWordCountStrategy} type The type of count. Accepts 'words', 'characters_excluding_spaces', or 'characters_including_spaces'. * @param {WPWordCountUserSettings} userSettings Custom settings object. * * @example * ```js * import { count } from '@wordpress/wordcount'; * const numberOfWords = count( 'Words to count', 'words', {} ) * ``` * * @return {number} The word or character count. */ function count(text, type, userSettings) { const settings = loadSettings(type, userSettings); let matchRegExp; switch (settings.type) { case 'words': matchRegExp = settings.wordsRegExp; return countWords(text, matchRegExp, settings); case 'characters_including_spaces': matchRegExp = settings.characters_including_spacesRegExp; return countCharacters(text, matchRegExp, settings); case 'characters_excluding_spaces': matchRegExp = settings.characters_excluding_spacesRegExp; return countCharacters(text, matchRegExp, settings); default: return 0; } } (window.wp = window.wp || {}).wordcount = __webpack_exports__; /******/ })() ;PK{MZ*data-controls.min.jsnu[/*! This file is auto-generated */ (()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{__unstableAwaitPromise:()=>p,apiFetch:()=>i,controls:()=>u,dispatch:()=>d,select:()=>a,syncSelect:()=>l});const o=window.wp.apiFetch;var r=e.n(o);const n=window.wp.data,s=window.wp.deprecated;var c=e.n(s);function i(e){return{type:"API_FETCH",request:e}}function a(e,t,...o){return c()("`select` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `resolveSelect` control in `@wordpress/data`"}),n.controls.resolveSelect(e,t,...o)}function l(e,t,...o){return c()("`syncSelect` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `select` control in `@wordpress/data`"}),n.controls.select(e,t,...o)}function d(e,t,...o){return c()("`dispatch` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `dispatch` control in `@wordpress/data`"}),n.controls.dispatch(e,t,...o)}const p=function(e){return{type:"AWAIT_PROMISE",promise:e}},u={AWAIT_PROMISE:({promise:e})=>e,API_FETCH:({request:e})=>r()(e)};(window.wp=window.wp||{}).dataControls=t})();PK{MZN( nux.min.jsnu[/*! This file is auto-generated */ (()=>{"use strict";var e={n:i=>{var n=i&&i.__esModule?()=>i.default:()=>i;return e.d(n,{a:n}),n},d:(i,n)=>{for(var t in n)e.o(n,t)&&!e.o(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:n[t]})},o:(e,i)=>Object.prototype.hasOwnProperty.call(e,i),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},i={};e.r(i),e.d(i,{DotTip:()=>P,store:()=>m});var n={};e.r(n),e.d(n,{disableTips:()=>l,dismissTip:()=>u,enableTips:()=>a,triggerGuide:()=>p});var t={};e.r(t),e.d(t,{areTipsEnabled:()=>T,getAssociatedGuide:()=>w,isTipVisible:()=>f});const s=window.wp.deprecated;var r=e.n(s);const o=window.wp.data;const c=(0,o.combineReducers)({areTipsEnabled:function(e=!0,i){switch(i.type){case"DISABLE_TIPS":return!1;case"ENABLE_TIPS":return!0}return e},dismissedTips:function(e={},i){switch(i.type){case"DISMISS_TIP":return{...e,[i.id]:!0};case"ENABLE_TIPS":return{}}return e}}),d=(0,o.combineReducers)({guides:function(e=[],i){return"TRIGGER_GUIDE"===i.type?[...e,i.tipIds]:e},preferences:c});function p(e){return{type:"TRIGGER_GUIDE",tipIds:e}}function u(e){return{type:"DISMISS_TIP",id:e}}function l(){return{type:"DISABLE_TIPS"}}function a(){return{type:"ENABLE_TIPS"}}const w=(0,o.createSelector)(((e,i)=>{for(const n of e.guides)if(n.includes(i)){const i=n.filter((i=>!Object.keys(e.preferences.dismissedTips).includes(i))),[t=null,s=null]=i;return{tipIds:n,currentTipId:t,nextTipId:s}}return null}),(e=>[e.guides,e.preferences.dismissedTips]));function f(e,i){if(!e.preferences.areTipsEnabled)return!1;if(e.preferences.dismissedTips?.hasOwnProperty(i))return!1;const n=w(e,i);return!n||n.currentTipId===i}function T(e){return e.preferences.areTipsEnabled}const b="core/nux",m=(0,o.createReduxStore)(b,{reducer:d,actions:n,selectors:t,persist:["preferences"]});(0,o.registerStore)(b,{reducer:d,actions:n,selectors:t,persist:["preferences"]});const I=window.wp.compose,S=window.wp.components,_=window.wp.i18n,x=window.wp.element,g=window.wp.primitives,h=window.ReactJSXRuntime,y=(0,h.jsx)(g.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,h.jsx)(g.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"})});function E(e){e.stopPropagation()}const P=(0,I.compose)((0,o.withSelect)(((e,{tipId:i})=>{const{isTipVisible:n,getAssociatedGuide:t}=e(m),s=t(i);return{isVisible:n(i),hasNextTip:!(!s||!s.nextTipId)}})),(0,o.withDispatch)(((e,{tipId:i})=>{const{dismissTip:n,disableTips:t}=e(m);return{onDismiss(){n(i)},onDisable(){t()}}})))((function({position:e="middle right",children:i,isVisible:n,hasNextTip:t,onDismiss:s,onDisable:r}){const o=(0,x.useRef)(null),c=(0,x.useCallback)((e=>{o.current&&(o.current.contains(e.relatedTarget)||r())}),[r,o]);return n?(0,h.jsxs)(S.Popover,{className:"nux-dot-tip",position:e,focusOnMount:!0,role:"dialog","aria-label":(0,_.__)("Editor tips"),onClick:E,onFocusOutside:c,children:[(0,h.jsx)("p",{children:i}),(0,h.jsx)("p",{children:(0,h.jsx)(S.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:s,children:t?(0,_.__)("See next tip"):(0,_.__)("Got it")})}),(0,h.jsx)(S.Button,{size:"small",className:"nux-dot-tip__disable",icon:y,label:(0,_.__)("Disable tips"),onClick:r})]}):null}));r()("wp.nux",{since:"5.4",hint:"wp.components.Guide can be used to show a user guide.",version:"6.2"}),(window.wp=window.wp||{}).nux=i})();PK{MZ__keyboard-shortcuts.jsnu[/******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { ShortcutProvider: () => (/* reexport */ ShortcutProvider), __unstableUseShortcutEventMatch: () => (/* reexport */ useShortcutEventMatch), store: () => (/* reexport */ store), useShortcut: () => (/* reexport */ useShortcut) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { registerShortcut: () => (registerShortcut), unregisterShortcut: () => (unregisterShortcut) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { getAllShortcutKeyCombinations: () => (getAllShortcutKeyCombinations), getAllShortcutRawKeyCombinations: () => (getAllShortcutRawKeyCombinations), getCategoryShortcuts: () => (getCategoryShortcuts), getShortcutAliases: () => (getShortcutAliases), getShortcutDescription: () => (getShortcutDescription), getShortcutKeyCombination: () => (getShortcutKeyCombination), getShortcutRepresentation: () => (getShortcutRepresentation) }); ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/reducer.js /** * Reducer returning the registered shortcuts * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function reducer(state = {}, action) { switch (action.type) { case 'REGISTER_SHORTCUT': return { ...state, [action.name]: { category: action.category, keyCombination: action.keyCombination, aliases: action.aliases, description: action.description } }; case 'UNREGISTER_SHORTCUT': const { [action.name]: actionName, ...remainingState } = state; return remainingState; } return state; } /* harmony default export */ const store_reducer = (reducer); ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js /** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */ /** * Keyboard key combination. * * @typedef {Object} WPShortcutKeyCombination * * @property {string} character Character. * @property {WPKeycodeModifier|undefined} modifier Modifier. */ /** * Configuration of a registered keyboard shortcut. * * @typedef {Object} WPShortcutConfig * * @property {string} name Shortcut name. * @property {string} category Shortcut category. * @property {string} description Shortcut description. * @property {WPShortcutKeyCombination} keyCombination Shortcut key combination. * @property {WPShortcutKeyCombination[]} [aliases] Shortcut aliases. */ /** * Returns an action object used to register a new keyboard shortcut. * * @param {WPShortcutConfig} config Shortcut config. * * @example * *```js * import { useEffect } from 'react'; * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; * import { useSelect, useDispatch } from '@wordpress/data'; * import { __ } from '@wordpress/i18n'; * * const ExampleComponent = () => { * const { registerShortcut } = useDispatch( keyboardShortcutsStore ); * * useEffect( () => { * registerShortcut( { * name: 'custom/my-custom-shortcut', * category: 'my-category', * description: __( 'My custom shortcut' ), * keyCombination: { * modifier: 'primary', * character: 'j', * }, * } ); * }, [] ); * * const shortcut = useSelect( * ( select ) => * select( keyboardShortcutsStore ).getShortcutKeyCombination( * 'custom/my-custom-shortcut' * ), * [] * ); * * return shortcut ? ( *

{ __( 'Shortcut is registered.' ) }

* ) : ( *

{ __( 'Shortcut is not registered.' ) }

* ); * }; *``` * @return {Object} action. */ function registerShortcut({ name, category, description, keyCombination, aliases }) { return { type: 'REGISTER_SHORTCUT', name, category, keyCombination, aliases, description }; } /** * Returns an action object used to unregister a keyboard shortcut. * * @param {string} name Shortcut name. * * @example * *```js * import { useEffect } from 'react'; * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; * import { useSelect, useDispatch } from '@wordpress/data'; * import { __ } from '@wordpress/i18n'; * * const ExampleComponent = () => { * const { unregisterShortcut } = useDispatch( keyboardShortcutsStore ); * * useEffect( () => { * unregisterShortcut( 'core/editor/next-region' ); * }, [] ); * * const shortcut = useSelect( * ( select ) => * select( keyboardShortcutsStore ).getShortcutKeyCombination( * 'core/editor/next-region' * ), * [] * ); * * return shortcut ? ( *

{ __( 'Shortcut is not unregistered.' ) }

* ) : ( *

{ __( 'Shortcut is unregistered.' ) }

* ); * }; *``` * @return {Object} action. */ function unregisterShortcut(name) { return { type: 'UNREGISTER_SHORTCUT', name }; } ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js /** * WordPress dependencies */ /** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */ /** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */ /** * Shared reference to an empty array for cases where it is important to avoid * returning a new array reference on every invocation. * * @type {Array} */ const EMPTY_ARRAY = []; /** * Shortcut formatting methods. * * @property {WPKeycodeHandlerByModifier} display Display formatting. * @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting. * @property {WPKeycodeHandlerByModifier} ariaLabel ARIA label formatting. */ const FORMATTING_METHODS = { display: external_wp_keycodes_namespaceObject.displayShortcut, raw: external_wp_keycodes_namespaceObject.rawShortcut, ariaLabel: external_wp_keycodes_namespaceObject.shortcutAriaLabel }; /** * Returns a string representing the key combination. * * @param {?WPShortcutKeyCombination} shortcut Key combination. * @param {keyof FORMATTING_METHODS} representation Type of representation * (display, raw, ariaLabel). * * @return {?string} Shortcut representation. */ function getKeyCombinationRepresentation(shortcut, representation) { if (!shortcut) { return null; } return shortcut.modifier ? FORMATTING_METHODS[representation][shortcut.modifier](shortcut.character) : shortcut.character; } /** * Returns the main key combination for a given shortcut name. * * @param {Object} state Global state. * @param {string} name Shortcut name. * * @example * *```js * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; * import { useSelect } from '@wordpress/data'; * import { createInterpolateElement } from '@wordpress/element'; * import { sprintf } from '@wordpress/i18n'; * const ExampleComponent = () => { * const {character, modifier} = useSelect( * ( select ) => * select( keyboardShortcutsStore ).getShortcutKeyCombination( * 'core/editor/next-region' * ), * [] * ); * * return ( *
* { createInterpolateElement( * sprintf( * 'Character: %s / Modifier: %s', * character, * modifier * ), * { * code: , * } * ) } *
* ); * }; *``` * * @return {WPShortcutKeyCombination?} Key combination. */ function getShortcutKeyCombination(state, name) { return state[name] ? state[name].keyCombination : null; } /** * Returns a string representing the main key combination for a given shortcut name. * * @param {Object} state Global state. * @param {string} name Shortcut name. * @param {keyof FORMATTING_METHODS} representation Type of representation * (display, raw, ariaLabel). * @example * *```js * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; * import { useSelect } from '@wordpress/data'; * import { sprintf } from '@wordpress/i18n'; * * const ExampleComponent = () => { * const {display, raw, ariaLabel} = useSelect( * ( select ) =>{ * return { * display: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region' ), * raw: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region','raw' ), * ariaLabel: select( keyboardShortcutsStore ).getShortcutRepresentation('core/editor/next-region', 'ariaLabel') * } * }, * [] * ); * * return ( *
    *
  • { sprintf( 'display string: %s', display ) }
  • *
  • { sprintf( 'raw string: %s', raw ) }
  • *
  • { sprintf( 'ariaLabel string: %s', ariaLabel ) }
  • *
* ); * }; *``` * * @return {?string} Shortcut representation. */ function getShortcutRepresentation(state, name, representation = 'display') { const shortcut = getShortcutKeyCombination(state, name); return getKeyCombinationRepresentation(shortcut, representation); } /** * Returns the shortcut description given its name. * * @param {Object} state Global state. * @param {string} name Shortcut name. * * @example * *```js * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; * import { useSelect } from '@wordpress/data'; * import { __ } from '@wordpress/i18n'; * const ExampleComponent = () => { * const shortcutDescription = useSelect( * ( select ) => * select( keyboardShortcutsStore ).getShortcutDescription( 'core/editor/next-region' ), * [] * ); * * return shortcutDescription ? ( *
{ shortcutDescription }
* ) : ( *
{ __( 'No description.' ) }
* ); * }; *``` * @return {?string} Shortcut description. */ function getShortcutDescription(state, name) { return state[name] ? state[name].description : null; } /** * Returns the aliases for a given shortcut name. * * @param {Object} state Global state. * @param {string} name Shortcut name. * @example * *```js * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; * import { useSelect } from '@wordpress/data'; * import { createInterpolateElement } from '@wordpress/element'; * import { sprintf } from '@wordpress/i18n'; * const ExampleComponent = () => { * const shortcutAliases = useSelect( * ( select ) => * select( keyboardShortcutsStore ).getShortcutAliases( * 'core/editor/next-region' * ), * [] * ); * * return ( * shortcutAliases.length > 0 && ( *
    * { shortcutAliases.map( ( { character, modifier }, index ) => ( *
  • * { createInterpolateElement( * sprintf( * 'Character: %s / Modifier: %s', * character, * modifier * ), * { * code: , * } * ) } *
  • * ) ) } *
* ) * ); * }; *``` * * @return {WPShortcutKeyCombination[]} Key combinations. */ function getShortcutAliases(state, name) { return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY; } /** * Returns the shortcuts that include aliases for a given shortcut name. * * @param {Object} state Global state. * @param {string} name Shortcut name. * @example * *```js * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; * import { useSelect } from '@wordpress/data'; * import { createInterpolateElement } from '@wordpress/element'; * import { sprintf } from '@wordpress/i18n'; * * const ExampleComponent = () => { * const allShortcutKeyCombinations = useSelect( * ( select ) => * select( keyboardShortcutsStore ).getAllShortcutKeyCombinations( * 'core/editor/next-region' * ), * [] * ); * * return ( * allShortcutKeyCombinations.length > 0 && ( *
    * { allShortcutKeyCombinations.map( * ( { character, modifier }, index ) => ( *
  • * { createInterpolateElement( * sprintf( * 'Character: %s / Modifier: %s', * character, * modifier * ), * { * code: , * } * ) } *
  • * ) * ) } *
* ) * ); * }; *``` * * @return {WPShortcutKeyCombination[]} Key combinations. */ const getAllShortcutKeyCombinations = (0,external_wp_data_namespaceObject.createSelector)((state, name) => { return [getShortcutKeyCombination(state, name), ...getShortcutAliases(state, name)].filter(Boolean); }, (state, name) => [state[name]]); /** * Returns the raw representation of all the keyboard combinations of a given shortcut name. * * @param {Object} state Global state. * @param {string} name Shortcut name. * * @example * *```js * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; * import { useSelect } from '@wordpress/data'; * import { createInterpolateElement } from '@wordpress/element'; * import { sprintf } from '@wordpress/i18n'; * * const ExampleComponent = () => { * const allShortcutRawKeyCombinations = useSelect( * ( select ) => * select( keyboardShortcutsStore ).getAllShortcutRawKeyCombinations( * 'core/editor/next-region' * ), * [] * ); * * return ( * allShortcutRawKeyCombinations.length > 0 && ( *
    * { allShortcutRawKeyCombinations.map( * ( shortcutRawKeyCombination, index ) => ( *
  • * { createInterpolateElement( * sprintf( * ' %s', * shortcutRawKeyCombination * ), * { * code: , * } * ) } *
  • * ) * ) } *
* ) * ); * }; *``` * * @return {string[]} Shortcuts. */ const getAllShortcutRawKeyCombinations = (0,external_wp_data_namespaceObject.createSelector)((state, name) => { return getAllShortcutKeyCombinations(state, name).map(combination => getKeyCombinationRepresentation(combination, 'raw')); }, (state, name) => [state[name]]); /** * Returns the shortcut names list for a given category name. * * @param {Object} state Global state. * @param {string} name Category name. * @example * *```js * import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; * import { useSelect } from '@wordpress/data'; * * const ExampleComponent = () => { * const categoryShortcuts = useSelect( * ( select ) => * select( keyboardShortcutsStore ).getCategoryShortcuts( * 'block' * ), * [] * ); * * return ( * categoryShortcuts.length > 0 && ( *
    * { categoryShortcuts.map( ( categoryShortcut ) => ( *
  • { categoryShortcut }
  • * ) ) } *
* ) * ); * }; *``` * @return {string[]} Shortcut names. */ const getCategoryShortcuts = (0,external_wp_data_namespaceObject.createSelector)((state, categoryName) => { return Object.entries(state).filter(([, shortcut]) => shortcut.category === categoryName).map(([name]) => name); }, state => [state]); ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const STORE_NAME = 'core/keyboard-shortcuts'; /** * Store definition for the keyboard shortcuts namespace. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore * * @type {Object} */ const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { reducer: store_reducer, actions: actions_namespaceObject, selectors: selectors_namespaceObject }); (0,external_wp_data_namespaceObject.register)(store); ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut-event-match.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns a function to check if a keyboard event matches a shortcut name. * * @return {Function} A function to check if a keyboard event matches a * predefined shortcut combination. */ function useShortcutEventMatch() { const { getAllShortcutKeyCombinations } = (0,external_wp_data_namespaceObject.useSelect)(store); /** * A function to check if a keyboard event matches a predefined shortcut * combination. * * @param {string} name Shortcut name. * @param {KeyboardEvent} event Event to check. * * @return {boolean} True if the event matches any shortcuts, false if not. */ function isMatch(name, event) { return getAllShortcutKeyCombinations(name).some(({ modifier, character }) => { return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character); }); } return isMatch; } ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/context.js /** * WordPress dependencies */ const globalShortcuts = new Set(); const globalListener = event => { for (const keyboardShortcut of globalShortcuts) { keyboardShortcut(event); } }; const context = (0,external_wp_element_namespaceObject.createContext)({ add: shortcut => { if (globalShortcuts.size === 0) { document.addEventListener('keydown', globalListener); } globalShortcuts.add(shortcut); }, delete: shortcut => { globalShortcuts.delete(shortcut); if (globalShortcuts.size === 0) { document.removeEventListener('keydown', globalListener); } } }); ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Attach a keyboard shortcut handler. * * @param {string} name Shortcut name. * @param {Function} callback Shortcut callback. * @param {Object} options Shortcut options. * @param {boolean} options.isDisabled Whether to disable to shortut. */ function useShortcut(name, callback, { isDisabled = false } = {}) { const shortcuts = (0,external_wp_element_namespaceObject.useContext)(context); const isMatch = useShortcutEventMatch(); const callbackRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { callbackRef.current = callback; }, [callback]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isDisabled) { return; } function _callback(event) { if (isMatch(name, event)) { callbackRef.current(event); } } shortcuts.add(_callback); return () => { shortcuts.delete(_callback); }; }, [name, isDisabled, shortcuts]); } ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/components/shortcut-provider.js /** * WordPress dependencies */ /** * Internal dependencies */ const { Provider } = context; /** * Handles callbacks added to context by `useShortcut`. * Adding a provider allows to register contextual shortcuts * that are only active when a certain part of the UI is focused. * * @param {Object} props Props to pass to `div`. * * @return {Element} Component. */ function ShortcutProvider(props) { const [keyboardShortcuts] = (0,external_wp_element_namespaceObject.useState)(() => new Set()); function onKeyDown(event) { if (props.onKeyDown) { props.onKeyDown(event); } for (const keyboardShortcut of keyboardShortcuts) { keyboardShortcut(event); } } /* eslint-disable jsx-a11y/no-static-element-interactions */ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { value: keyboardShortcuts, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, onKeyDown: onKeyDown }) }); /* eslint-enable jsx-a11y/no-static-element-interactions */ } ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/index.js (window.wp = window.wp || {}).keyboardShortcuts = __webpack_exports__; /******/ })() ;PK{MZ>u keyboard-shortcuts.min.jsnu[/*! This file is auto-generated */ (()=>{"use strict";var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ShortcutProvider:()=>K,__unstableUseShortcutEventMatch:()=>R,store:()=>h,useShortcut:()=>T});var o={};e.r(o),e.d(o,{registerShortcut:()=>c,unregisterShortcut:()=>a});var n={};e.r(n),e.d(n,{getAllShortcutKeyCombinations:()=>m,getAllShortcutRawKeyCombinations:()=>p,getCategoryShortcuts:()=>b,getShortcutAliases:()=>w,getShortcutDescription:()=>f,getShortcutKeyCombination:()=>y,getShortcutRepresentation:()=>S});const r=window.wp.data;const i=function(e={},t){switch(t.type){case"REGISTER_SHORTCUT":return{...e,[t.name]:{category:t.category,keyCombination:t.keyCombination,aliases:t.aliases,description:t.description}};case"UNREGISTER_SHORTCUT":const{[t.name]:o,...n}=e;return n}return e};function c({name:e,category:t,description:o,keyCombination:n,aliases:r}){return{type:"REGISTER_SHORTCUT",name:e,category:t,keyCombination:n,aliases:r,description:o}}function a(e){return{type:"UNREGISTER_SHORTCUT",name:e}}const s=window.wp.keycodes,u=[],d={display:s.displayShortcut,raw:s.rawShortcut,ariaLabel:s.shortcutAriaLabel};function l(e,t){return e?e.modifier?d[t][e.modifier](e.character):e.character:null}function y(e,t){return e[t]?e[t].keyCombination:null}function S(e,t,o="display"){return l(y(e,t),o)}function f(e,t){return e[t]?e[t].description:null}function w(e,t){return e[t]&&e[t].aliases?e[t].aliases:u}const m=(0,r.createSelector)(((e,t)=>[y(e,t),...w(e,t)].filter(Boolean)),((e,t)=>[e[t]])),p=(0,r.createSelector)(((e,t)=>m(e,t).map((e=>l(e,"raw")))),((e,t)=>[e[t]])),b=(0,r.createSelector)(((e,t)=>Object.entries(e).filter((([,e])=>e.category===t)).map((([e])=>e))),(e=>[e])),h=(0,r.createReduxStore)("core/keyboard-shortcuts",{reducer:i,actions:o,selectors:n});(0,r.register)(h);const g=window.wp.element;function R(){const{getAllShortcutKeyCombinations:e}=(0,r.useSelect)(h);return function(t,o){return e(t).some((({modifier:e,character:t})=>s.isKeyboardEvent[e](o,t)))}}const C=new Set,v=e=>{for(const t of C)t(e)},E=(0,g.createContext)({add:e=>{0===C.size&&document.addEventListener("keydown",v),C.add(e)},delete:e=>{C.delete(e),0===C.size&&document.removeEventListener("keydown",v)}});function T(e,t,{isDisabled:o=!1}={}){const n=(0,g.useContext)(E),r=R(),i=(0,g.useRef)();(0,g.useEffect)((()=>{i.current=t}),[t]),(0,g.useEffect)((()=>{if(!o)return n.add(t),()=>{n.delete(t)};function t(t){r(e,t)&&i.current(t)}}),[e,o,n])}const k=window.ReactJSXRuntime,{Provider:O}=E;function K(e){const[t]=(0,g.useState)((()=>new Set));return(0,k.jsx)(O,{value:t,children:(0,k.jsx)("div",{...e,onKeyDown:function(o){e.onKeyDown&&e.onKeyDown(o);for(const e of t)e(o)}})})}(window.wp=window.wp||{}).keyboardShortcuts=t})();PK{MZ%1dom.jsnu[/******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { __unstableStripHTML: () => (/* reexport */ stripHTML), computeCaretRect: () => (/* reexport */ computeCaretRect), documentHasSelection: () => (/* reexport */ documentHasSelection), documentHasTextSelection: () => (/* reexport */ documentHasTextSelection), documentHasUncollapsedSelection: () => (/* reexport */ documentHasUncollapsedSelection), focus: () => (/* binding */ build_module_focus), getFilesFromDataTransfer: () => (/* reexport */ getFilesFromDataTransfer), getOffsetParent: () => (/* reexport */ getOffsetParent), getPhrasingContentSchema: () => (/* reexport */ getPhrasingContentSchema), getRectangleFromRange: () => (/* reexport */ getRectangleFromRange), getScrollContainer: () => (/* reexport */ getScrollContainer), insertAfter: () => (/* reexport */ insertAfter), isEmpty: () => (/* reexport */ isEmpty), isEntirelySelected: () => (/* reexport */ isEntirelySelected), isFormElement: () => (/* reexport */ isFormElement), isHorizontalEdge: () => (/* reexport */ isHorizontalEdge), isNumberInput: () => (/* reexport */ isNumberInput), isPhrasingContent: () => (/* reexport */ isPhrasingContent), isRTL: () => (/* reexport */ isRTL), isSelectionForward: () => (/* reexport */ isSelectionForward), isTextContent: () => (/* reexport */ isTextContent), isTextField: () => (/* reexport */ isTextField), isVerticalEdge: () => (/* reexport */ isVerticalEdge), placeCaretAtHorizontalEdge: () => (/* reexport */ placeCaretAtHorizontalEdge), placeCaretAtVerticalEdge: () => (/* reexport */ placeCaretAtVerticalEdge), remove: () => (/* reexport */ remove), removeInvalidHTML: () => (/* reexport */ removeInvalidHTML), replace: () => (/* reexport */ replace), replaceTag: () => (/* reexport */ replaceTag), safeHTML: () => (/* reexport */ safeHTML), unwrap: () => (/* reexport */ unwrap), wrap: () => (/* reexport */ wrap) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/dom/build-module/focusable.js var focusable_namespaceObject = {}; __webpack_require__.r(focusable_namespaceObject); __webpack_require__.d(focusable_namespaceObject, { find: () => (find) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/dom/build-module/tabbable.js var tabbable_namespaceObject = {}; __webpack_require__.r(tabbable_namespaceObject); __webpack_require__.d(tabbable_namespaceObject, { find: () => (tabbable_find), findNext: () => (findNext), findPrevious: () => (findPrevious), isTabbableIndex: () => (isTabbableIndex) }); ;// ./node_modules/@wordpress/dom/build-module/focusable.js /** * References: * * Focusable: * - https://www.w3.org/TR/html5/editing.html#focus-management * * Sequential focus navigation: * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute * * Disabled elements: * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements * * getClientRects algorithm (requiring layout box): * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface * * AREA elements associated with an IMG: * - https://w3c.github.io/html/editing.html#data-model */ /** * Returns a CSS selector used to query for focusable elements. * * @param {boolean} sequential If set, only query elements that are sequentially * focusable. Non-interactive elements with a * negative `tabindex` are focusable but not * sequentially focusable. * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute * * @return {string} CSS selector. */ function buildSelector(sequential) { return [sequential ? '[tabindex]:not([tabindex^="-"])' : '[tabindex]', 'a[href]', 'button:not([disabled])', 'input:not([type="hidden"]):not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'iframe:not([tabindex^="-"])', 'object', 'embed', 'area[href]', '[contenteditable]:not([contenteditable=false])'].join(','); } /** * Returns true if the specified element is visible (i.e. neither display: none * nor visibility: hidden). * * @param {HTMLElement} element DOM element to test. * * @return {boolean} Whether element is visible. */ function isVisible(element) { return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0; } /** * Returns true if the specified area element is a valid focusable element, or * false otherwise. Area is only focusable if within a map where a named map * referenced by an image somewhere in the document. * * @param {HTMLAreaElement} element DOM area element to test. * * @return {boolean} Whether area element is valid for focus. */ function isValidFocusableArea(element) { /** @type {HTMLMapElement | null} */ const map = element.closest('map[name]'); if (!map) { return false; } /** @type {HTMLImageElement | null} */ const img = element.ownerDocument.querySelector('img[usemap="#' + map.name + '"]'); return !!img && isVisible(img); } /** * Returns all focusable elements within a given context. * * @param {Element} context Element in which to search. * @param {Object} options * @param {boolean} [options.sequential] If set, only return elements that are * sequentially focusable. * Non-interactive elements with a * negative `tabindex` are focusable but * not sequentially focusable. * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute * * @return {HTMLElement[]} Focusable elements. */ function find(context, { sequential = false } = {}) { /** @type {NodeListOf} */ const elements = context.querySelectorAll(buildSelector(sequential)); return Array.from(elements).filter(element => { if (!isVisible(element)) { return false; } const { nodeName } = element; if ('AREA' === nodeName) { return isValidFocusableArea(/** @type {HTMLAreaElement} */element); } return true; }); } ;// ./node_modules/@wordpress/dom/build-module/tabbable.js /** * Internal dependencies */ /** * Returns the tab index of the given element. In contrast with the tabIndex * property, this normalizes the default (0) to avoid browser inconsistencies, * operating under the assumption that this function is only ever called with a * focusable node. * * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1190261 * * @param {Element} element Element from which to retrieve. * * @return {number} Tab index of element (default 0). */ function getTabIndex(element) { const tabIndex = element.getAttribute('tabindex'); return tabIndex === null ? 0 : parseInt(tabIndex, 10); } /** * Returns true if the specified element is tabbable, or false otherwise. * * @param {Element} element Element to test. * * @return {boolean} Whether element is tabbable. */ function isTabbableIndex(element) { return getTabIndex(element) !== -1; } /** @typedef {HTMLElement & { type?: string, checked?: boolean, name?: string }} MaybeHTMLInputElement */ /** * Returns a stateful reducer function which constructs a filtered array of * tabbable elements, where at most one radio input is selected for a given * name, giving priority to checked input, falling back to the first * encountered. * * @return {(acc: MaybeHTMLInputElement[], el: MaybeHTMLInputElement) => MaybeHTMLInputElement[]} Radio group collapse reducer. */ function createStatefulCollapseRadioGroup() { /** @type {Record} */ const CHOSEN_RADIO_BY_NAME = {}; return function collapseRadioGroup(/** @type {MaybeHTMLInputElement[]} */result, /** @type {MaybeHTMLInputElement} */element) { const { nodeName, type, checked, name } = element; // For all non-radio tabbables, construct to array by concatenating. if (nodeName !== 'INPUT' || type !== 'radio' || !name) { return result.concat(element); } const hasChosen = CHOSEN_RADIO_BY_NAME.hasOwnProperty(name); // Omit by skipping concatenation if the radio element is not chosen. const isChosen = checked || !hasChosen; if (!isChosen) { return result; } // At this point, if there had been a chosen element, the current // element is checked and should take priority. Retroactively remove // the element which had previously been considered the chosen one. if (hasChosen) { const hadChosenElement = CHOSEN_RADIO_BY_NAME[name]; result = result.filter(e => e !== hadChosenElement); } CHOSEN_RADIO_BY_NAME[name] = element; return result.concat(element); }; } /** * An array map callback, returning an object with the element value and its * array index location as properties. This is used to emulate a proper stable * sort where equal tabIndex should be left in order of their occurrence in the * document. * * @param {HTMLElement} element Element. * @param {number} index Array index of element. * * @return {{ element: HTMLElement, index: number }} Mapped object with element, index. */ function mapElementToObjectTabbable(element, index) { return { element, index }; } /** * An array map callback, returning an element of the given mapped object's * element value. * * @param {{ element: HTMLElement }} object Mapped object with element. * * @return {HTMLElement} Mapped object element. */ function mapObjectTabbableToElement(object) { return object.element; } /** * A sort comparator function used in comparing two objects of mapped elements. * * @see mapElementToObjectTabbable * * @param {{ element: HTMLElement, index: number }} a First object to compare. * @param {{ element: HTMLElement, index: number }} b Second object to compare. * * @return {number} Comparator result. */ function compareObjectTabbables(a, b) { const aTabIndex = getTabIndex(a.element); const bTabIndex = getTabIndex(b.element); if (aTabIndex === bTabIndex) { return a.index - b.index; } return aTabIndex - bTabIndex; } /** * Givin focusable elements, filters out tabbable element. * * @param {HTMLElement[]} focusables Focusable elements to filter. * * @return {HTMLElement[]} Tabbable elements. */ function filterTabbable(focusables) { return focusables.filter(isTabbableIndex).map(mapElementToObjectTabbable).sort(compareObjectTabbables).map(mapObjectTabbableToElement).reduce(createStatefulCollapseRadioGroup(), []); } /** * @param {Element} context * @return {HTMLElement[]} Tabbable elements within the context. */ function tabbable_find(context) { return filterTabbable(find(context)); } /** * Given a focusable element, find the preceding tabbable element. * * @param {Element} element The focusable element before which to look. Defaults * to the active element. * * @return {HTMLElement|undefined} Preceding tabbable element. */ function findPrevious(element) { return filterTabbable(find(element.ownerDocument.body)).reverse().find(focusable => // eslint-disable-next-line no-bitwise element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_PRECEDING); } /** * Given a focusable element, find the next tabbable element. * * @param {Element} element The focusable element after which to look. Defaults * to the active element. * * @return {HTMLElement|undefined} Next tabbable element. */ function findNext(element) { return filterTabbable(find(element.ownerDocument.body)).find(focusable => // eslint-disable-next-line no-bitwise element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_FOLLOWING); } ;// ./node_modules/@wordpress/dom/build-module/utils/assert-is-defined.js function assertIsDefined(val, name) { if (false) {} } ;// ./node_modules/@wordpress/dom/build-module/dom/get-rectangle-from-range.js /** * Internal dependencies */ /** * Get the rectangle of a given Range. Returns `null` if no suitable rectangle * can be found. * * @param {Range} range The range. * * @return {DOMRect?} The rectangle. */ function getRectangleFromRange(range) { // For uncollapsed ranges, get the rectangle that bounds the contents of the // range; this a rectangle enclosing the union of the bounding rectangles // for all the elements in the range. if (!range.collapsed) { const rects = Array.from(range.getClientRects()); // If there's just a single rect, return it. if (rects.length === 1) { return rects[0]; } // Ignore tiny selection at the edge of a range. const filteredRects = rects.filter(({ width }) => width > 1); // If it's full of tiny selections, return browser default. if (filteredRects.length === 0) { return range.getBoundingClientRect(); } if (filteredRects.length === 1) { return filteredRects[0]; } let { top: furthestTop, bottom: furthestBottom, left: furthestLeft, right: furthestRight } = filteredRects[0]; for (const { top, bottom, left, right } of filteredRects) { if (top < furthestTop) { furthestTop = top; } if (bottom > furthestBottom) { furthestBottom = bottom; } if (left < furthestLeft) { furthestLeft = left; } if (right > furthestRight) { furthestRight = right; } } return new window.DOMRect(furthestLeft, furthestTop, furthestRight - furthestLeft, furthestBottom - furthestTop); } const { startContainer } = range; const { ownerDocument } = startContainer; // Correct invalid "BR" ranges. The cannot contain any children. if (startContainer.nodeName === 'BR') { const { parentNode } = startContainer; assertIsDefined(parentNode, 'parentNode'); const index = /** @type {Node[]} */Array.from(parentNode.childNodes).indexOf(startContainer); assertIsDefined(ownerDocument, 'ownerDocument'); range = ownerDocument.createRange(); range.setStart(parentNode, index); range.setEnd(parentNode, index); } const rects = range.getClientRects(); // If we have multiple rectangles for a collapsed range, there's no way to // know which it is, so don't return anything. if (rects.length > 1) { return null; } let rect = rects[0]; // If the collapsed range starts (and therefore ends) at an element node, // `getClientRects` can be empty in some browsers. This can be resolved // by adding a temporary text node with zero-width space to the range. // // See: https://stackoverflow.com/a/6847328/995445 if (!rect || rect.height === 0) { assertIsDefined(ownerDocument, 'ownerDocument'); const padNode = ownerDocument.createTextNode('\u200b'); // Do not modify the live range. range = range.cloneRange(); range.insertNode(padNode); rect = range.getClientRects()[0]; assertIsDefined(padNode.parentNode, 'padNode.parentNode'); padNode.parentNode.removeChild(padNode); } return rect; } ;// ./node_modules/@wordpress/dom/build-module/dom/compute-caret-rect.js /** * Internal dependencies */ /** * Get the rectangle for the selection in a container. * * @param {Window} win The window of the selection. * * @return {DOMRect | null} The rectangle. */ function computeCaretRect(win) { const selection = win.getSelection(); assertIsDefined(selection, 'selection'); const range = selection.rangeCount ? selection.getRangeAt(0) : null; if (!range) { return null; } return getRectangleFromRange(range); } ;// ./node_modules/@wordpress/dom/build-module/dom/document-has-text-selection.js /** * Internal dependencies */ /** * Check whether the current document has selected text. This applies to ranges * of text in the document, and not selection inside `` and ` * * ); * ); * ``` */ const BaseControl = Object.assign(contextConnectWithoutRef(UnconnectedBaseControl, 'BaseControl'), { /** * `BaseControl.VisualLabel` is used to render a purely visual label inside a `BaseControl` component. * * It should only be used in cases where the children being rendered inside `BaseControl` are already accessibly labeled, * e.g., a button, but we want an additional visual label for that section equivalent to the labels `BaseControl` would * otherwise use if the `label` prop was passed. * * ```jsx * import { BaseControl } from '@wordpress/components'; * * const MyBaseControl = () => ( * * Author * * * ); * ``` */ VisualLabel }); /* harmony default export */ const base_control = (BaseControl); ;// ./node_modules/@wordpress/components/build-module/utils/deprecated-36px-size.js /** * WordPress dependencies */ function maybeWarnDeprecated36pxSize({ componentName, __next40pxDefaultSize, size, __shouldNotWarnDeprecated36pxSize }) { if (__shouldNotWarnDeprecated36pxSize || __next40pxDefaultSize || size !== undefined && size !== 'default') { return; } external_wp_deprecated_default()(`36px default size for wp.components.${componentName}`, { since: '6.8', version: '7.1', hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.' }); } ;// ./node_modules/@wordpress/components/build-module/input-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const input_control_noop = () => {}; function input_control_useUniqueId(idProp) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(InputControl); const id = `inspector-input-control-${instanceId}`; return idProp || id; } function UnforwardedInputControl(props, ref) { const { __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize, __unstableStateReducer: stateReducer = state => state, __unstableInputWidth, className, disabled = false, help, hideLabelFromVision = false, id: idProp, isPressEnterToChange = false, label, labelPosition = 'top', onChange = input_control_noop, onValidate = input_control_noop, onKeyDown = input_control_noop, prefix, size = 'default', style, suffix, value, ...restProps } = useDeprecated36pxDefaultSizeProp(props); const id = input_control_useUniqueId(idProp); const classes = dist_clsx('components-input-control', className); const draftHookProps = useDraft({ value, onBlur: restProps.onBlur, onChange }); const helpProp = !!help ? { 'aria-describedby': `${id}__help` } : {}; maybeWarnDeprecated36pxSize({ componentName: 'InputControl', __next40pxDefaultSize, size, __shouldNotWarnDeprecated36pxSize }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control, { className: classes, help: help, id: id, __nextHasNoMarginBottom: true, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(input_base, { __next40pxDefaultSize: __next40pxDefaultSize, __unstableInputWidth: __unstableInputWidth, disabled: disabled, gap: 3, hideLabelFromVision: hideLabelFromVision, id: id, justify: "left", label: label, labelPosition: labelPosition, prefix: prefix, size: size, style: style, suffix: suffix, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(input_field, { ...restProps, ...helpProp, __next40pxDefaultSize: __next40pxDefaultSize, className: "components-input-control__input", disabled: disabled, id: id, isPressEnterToChange: isPressEnterToChange, onKeyDown: onKeyDown, onValidate: onValidate, paddingInlineStart: prefix ? space(1) : undefined, paddingInlineEnd: suffix ? space(1) : undefined, ref: ref, size: size, stateReducer: stateReducer, ...draftHookProps }) }) }); } /** * InputControl components let users enter and edit text. This is an experimental component * intended to (in time) merge with or replace `TextControl`. * * ```jsx * import { __experimentalInputControl as InputControl } from '@wordpress/components'; * import { useState } from 'react'; * * const Example = () => { * const [ value, setValue ] = useState( '' ); * * return ( * setValue( nextValue ?? '' ) } * /> * ); * }; * ``` */ const InputControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedInputControl); /* harmony default export */ const input_control = (InputControl); ;// ./node_modules/@wordpress/components/build-module/dashicon/index.js /** * @typedef OwnProps * * @property {import('./types').IconKey} icon Icon name * @property {string} [className] Class name * @property {number} [size] Size of the icon */ /** * Internal dependencies */ function Dashicon({ icon, className, size = 20, style = {}, ...extraProps }) { const iconClass = ['dashicon', 'dashicons', 'dashicons-' + icon, className].filter(Boolean).join(' '); // For retro-compatibility reasons (for example if people are overriding icon size with CSS), we add inline styles just if the size is different to the default const sizeStyles = // using `!=` to catch both 20 and "20" // eslint-disable-next-line eqeqeq 20 != size ? { fontSize: `${size}px`, width: `${size}px`, height: `${size}px` } : {}; const styles = { ...sizeStyles, ...style }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: iconClass, style: styles, ...extraProps }); } /* harmony default export */ const dashicon = (Dashicon); ;// ./node_modules/@wordpress/components/build-module/icon/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Renders a raw icon without any initial styling or wrappers. * * ```jsx * import { wordpress } from '@wordpress/icons'; * * * ``` */ function Icon({ icon = null, size = 'string' === typeof icon ? 20 : 24, ...additionalProps }) { if ('string' === typeof icon) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dashicon, { icon: icon, size: size, ...additionalProps }); } if ((0,external_wp_element_namespaceObject.isValidElement)(icon) && dashicon === icon.type) { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { ...additionalProps }); } if ('function' === typeof icon) { return (0,external_wp_element_namespaceObject.createElement)(icon, { size, ...additionalProps }); } if (icon && (icon.type === 'svg' || icon.type === external_wp_primitives_namespaceObject.SVG)) { const appliedProps = { ...icon.props, width: size, height: size, ...additionalProps }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { ...appliedProps }); } if ((0,external_wp_element_namespaceObject.isValidElement)(icon)) { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { // @ts-ignore Just forwarding the size prop along size, ...additionalProps }); } return icon; } /* harmony default export */ const build_module_icon = (Icon); ;// ./node_modules/@wordpress/components/build-module/button/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const disabledEventsOnDisabledButton = ['onMouseDown', 'onClick']; function button_useDeprecatedProps({ __experimentalIsFocusable, isDefault, isPrimary, isSecondary, isTertiary, isLink, isPressed, isSmall, size, variant, describedBy, ...otherProps }) { let computedSize = size; let computedVariant = variant; const newProps = { accessibleWhenDisabled: __experimentalIsFocusable, // @todo Mark `isPressed` as deprecated 'aria-pressed': isPressed, description: describedBy }; if (isSmall) { var _computedSize; (_computedSize = computedSize) !== null && _computedSize !== void 0 ? _computedSize : computedSize = 'small'; } if (isPrimary) { var _computedVariant; (_computedVariant = computedVariant) !== null && _computedVariant !== void 0 ? _computedVariant : computedVariant = 'primary'; } if (isTertiary) { var _computedVariant2; (_computedVariant2 = computedVariant) !== null && _computedVariant2 !== void 0 ? _computedVariant2 : computedVariant = 'tertiary'; } if (isSecondary) { var _computedVariant3; (_computedVariant3 = computedVariant) !== null && _computedVariant3 !== void 0 ? _computedVariant3 : computedVariant = 'secondary'; } if (isDefault) { var _computedVariant4; external_wp_deprecated_default()('wp.components.Button `isDefault` prop', { since: '5.4', alternative: 'variant="secondary"' }); (_computedVariant4 = computedVariant) !== null && _computedVariant4 !== void 0 ? _computedVariant4 : computedVariant = 'secondary'; } if (isLink) { var _computedVariant5; (_computedVariant5 = computedVariant) !== null && _computedVariant5 !== void 0 ? _computedVariant5 : computedVariant = 'link'; } return { ...newProps, ...otherProps, size: computedSize, variant: computedVariant }; } function UnforwardedButton(props, ref) { const { __next40pxDefaultSize, accessibleWhenDisabled, isBusy, isDestructive, className, disabled, icon, iconPosition = 'left', iconSize, showTooltip, tooltipPosition, shortcut, label, children, size = 'default', text, variant, description, ...buttonOrAnchorProps } = button_useDeprecatedProps(props); const { href, target, 'aria-checked': ariaChecked, 'aria-pressed': ariaPressed, 'aria-selected': ariaSelected, ...additionalProps } = 'href' in buttonOrAnchorProps ? buttonOrAnchorProps : { href: undefined, target: undefined, ...buttonOrAnchorProps }; const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Button, 'components-button__description'); const hasChildren = 'string' === typeof children && !!children || Array.isArray(children) && children?.[0] && children[0] !== null && // Tooltip should not considered as a child children?.[0]?.props?.className !== 'components-tooltip'; const truthyAriaPressedValues = [true, 'true', 'mixed']; const classes = dist_clsx('components-button', className, { 'is-next-40px-default-size': __next40pxDefaultSize, 'is-secondary': variant === 'secondary', 'is-primary': variant === 'primary', 'is-small': size === 'small', 'is-compact': size === 'compact', 'is-tertiary': variant === 'tertiary', 'is-pressed': truthyAriaPressedValues.includes(ariaPressed), 'is-pressed-mixed': ariaPressed === 'mixed', 'is-busy': isBusy, 'is-link': variant === 'link', 'is-destructive': isDestructive, 'has-text': !!icon && (hasChildren || text), 'has-icon': !!icon }); const trulyDisabled = disabled && !accessibleWhenDisabled; const Tag = href !== undefined && !disabled ? 'a' : 'button'; const buttonProps = Tag === 'button' ? { type: 'button', disabled: trulyDisabled, 'aria-checked': ariaChecked, 'aria-pressed': ariaPressed, 'aria-selected': ariaSelected } : {}; const anchorProps = Tag === 'a' ? { href, target } : {}; const disableEventProps = {}; if (disabled && accessibleWhenDisabled) { // In this case, the button will be disabled, but still focusable and // perceivable by screen reader users. buttonProps['aria-disabled'] = true; anchorProps['aria-disabled'] = true; for (const disabledEvent of disabledEventsOnDisabledButton) { disableEventProps[disabledEvent] = event => { if (event) { event.stopPropagation(); event.preventDefault(); } }; } } // Should show the tooltip if... const shouldShowTooltip = !trulyDisabled && ( // An explicit tooltip is passed or... showTooltip && !!label || // There's a shortcut or... !!shortcut || // There's a label and... !!label && // The children are empty and... !children?.length && // The tooltip is not explicitly disabled. false !== showTooltip); const descriptionId = description ? instanceId : undefined; const describedById = additionalProps['aria-describedby'] || descriptionId; const commonProps = { className: classes, 'aria-label': additionalProps['aria-label'] || label, 'aria-describedby': describedById, ref }; const elementChildren = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [icon && iconPosition === 'left' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: icon, size: iconSize }), text && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: text }), children, icon && iconPosition === 'right' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: icon, size: iconSize })] }); const element = Tag === 'a' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { ...anchorProps, ...additionalProps, ...disableEventProps, ...commonProps, children: elementChildren }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { ...buttonProps, ...additionalProps, ...disableEventProps, ...commonProps, children: elementChildren }); // In order to avoid some React reconciliation issues, we are always rendering // the `Tooltip` component even when `shouldShowTooltip` is `false`. // In order to make sure that the tooltip doesn't show when it shouldn't, // we don't pass the props to the `Tooltip` component. const tooltipProps = shouldShowTooltip ? { text: children?.length && description ? description : label, shortcut, placement: tooltipPosition && // Convert legacy `position` values to be used with the new `placement` prop positionToPlacement(tooltipPosition) } : {}; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tooltip, { ...tooltipProps, children: element }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visually_hidden_component, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { id: descriptionId, children: description }) })] }); } /** * Lets users take actions and make choices with a single click or tap. * * ```jsx * import { Button } from '@wordpress/components'; * const Mybutton = () => ( * * ); * ``` */ const Button = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedButton); /* harmony default export */ const build_module_button = (Button); ;// ./node_modules/@wordpress/components/build-module/number-control/styles/number-control-styles.js function number_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ var number_control_styles_ref = true ? { name: "euqsgg", styles: "input[type='number']::-webkit-outer-spin-button,input[type='number']::-webkit-inner-spin-button{-webkit-appearance:none!important;margin:0!important;}input[type='number']{-moz-appearance:textfield;}" } : 0; const htmlArrowStyles = ({ hideHTMLArrows }) => { if (!hideHTMLArrows) { return ``; } return number_control_styles_ref; }; const number_control_styles_Input = /*#__PURE__*/emotion_styled_base_browser_esm(input_control, true ? { target: "ep09it41" } : 0)(htmlArrowStyles, ";" + ( true ? "" : 0)); const SpinButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? { target: "ep09it40" } : 0)("&&&&&{color:", COLORS.theme.accent, ";}" + ( true ? "" : 0)); const smallSpinButtons = /*#__PURE__*/emotion_react_browser_esm_css("width:", space(5), ";min-width:", space(5), ";height:", space(5), ";" + ( true ? "" : 0), true ? "" : 0); const styles = { smallSpinButtons }; ;// ./node_modules/@wordpress/components/build-module/utils/math.js /** * Parses and retrieves a number value. * * @param {unknown} value The incoming value. * * @return {number} The parsed number value. */ function getNumber(value) { const number = Number(value); return isNaN(number) ? 0 : number; } /** * Safely adds 2 values. * * @param {Array} args Values to add together. * * @return {number} The sum of values. */ function add(...args) { return args.reduce(/** @type {(sum:number, arg: number|string) => number} */ (sum, arg) => sum + getNumber(arg), 0); } /** * Safely subtracts 2 values. * * @param {Array} args Values to subtract together. * * @return {number} The difference of the values. */ function subtract(...args) { return args.reduce(/** @type {(diff:number, arg: number|string, index:number) => number} */ (diff, arg, index) => { const value = getNumber(arg); return index === 0 ? value : diff - value; }, 0); } /** * Determines the decimal position of a number value. * * @param {number} value The number to evaluate. * * @return {number} The number of decimal places. */ function getPrecision(value) { const split = (value + '').split('.'); return split[1] !== undefined ? split[1].length : 0; } /** * Clamps a value based on a min/max range. * * @param {number} value The value. * @param {number} min The minimum range. * @param {number} max The maximum range. * * @return {number} The clamped value. */ function math_clamp(value, min, max) { const baseValue = getNumber(value); return Math.max(min, Math.min(baseValue, max)); } /** * Clamps a value based on a min/max range with rounding * * @param {number | string} value The value. * @param {number} min The minimum range. * @param {number} max The maximum range. * @param {number} step A multiplier for the value. * * @return {number} The rounded and clamped value. */ function roundClamp(value = 0, min = Infinity, max = Infinity, step = 1) { const baseValue = getNumber(value); const stepValue = getNumber(step); const precision = getPrecision(step); const rounded = Math.round(baseValue / stepValue) * stepValue; const clampedValue = math_clamp(rounded, min, max); return precision ? getNumber(clampedValue.toFixed(precision)) : clampedValue; } ;// ./node_modules/@wordpress/components/build-module/h-stack/utils.js /** * External dependencies */ /** * Internal dependencies */ const H_ALIGNMENTS = { bottom: { align: 'flex-end', justify: 'center' }, bottomLeft: { align: 'flex-end', justify: 'flex-start' }, bottomRight: { align: 'flex-end', justify: 'flex-end' }, center: { align: 'center', justify: 'center' }, edge: { align: 'center', justify: 'space-between' }, left: { align: 'center', justify: 'flex-start' }, right: { align: 'center', justify: 'flex-end' }, stretch: { align: 'stretch' }, top: { align: 'flex-start', justify: 'center' }, topLeft: { align: 'flex-start', justify: 'flex-start' }, topRight: { align: 'flex-start', justify: 'flex-end' } }; const V_ALIGNMENTS = { bottom: { justify: 'flex-end', align: 'center' }, bottomLeft: { justify: 'flex-end', align: 'flex-start' }, bottomRight: { justify: 'flex-end', align: 'flex-end' }, center: { justify: 'center', align: 'center' }, edge: { justify: 'space-between', align: 'center' }, left: { justify: 'center', align: 'flex-start' }, right: { justify: 'center', align: 'flex-end' }, stretch: { align: 'stretch' }, top: { justify: 'flex-start', align: 'center' }, topLeft: { justify: 'flex-start', align: 'flex-start' }, topRight: { justify: 'flex-start', align: 'flex-end' } }; function getAlignmentProps(alignment, direction = 'row') { if (!isValueDefined(alignment)) { return {}; } const isVertical = direction === 'column'; const props = isVertical ? V_ALIGNMENTS : H_ALIGNMENTS; const alignmentProps = alignment in props ? props[alignment] : { align: alignment }; return alignmentProps; } ;// ./node_modules/@wordpress/components/build-module/utils/get-valid-children.js /** * External dependencies */ /** * WordPress dependencies */ /** * Gets a collection of available children elements from a React component's children prop. * * @param children * * @return An array of available children. */ function getValidChildren(children) { if (typeof children === 'string') { return [children]; } return external_wp_element_namespaceObject.Children.toArray(children).filter(child => (0,external_wp_element_namespaceObject.isValidElement)(child)); } ;// ./node_modules/@wordpress/components/build-module/h-stack/hook.js /** * External dependencies */ /** * Internal dependencies */ function useHStack(props) { const { alignment = 'edge', children, direction, spacing = 2, ...otherProps } = useContextSystem(props, 'HStack'); const align = getAlignmentProps(alignment, direction); const validChildren = getValidChildren(children); const clonedChildren = validChildren.map((child, index) => { const _isSpacer = hasConnectNamespace(child, ['Spacer']); if (_isSpacer) { const childElement = child; const _key = childElement.key || `hstack-${index}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_item_component, { isBlock: true, ...childElement.props }, _key); } return child; }); const propsForFlex = { children: clonedChildren, direction, justify: 'center', ...align, ...otherProps, gap: spacing }; // Omit `isColumn` because it's not used in HStack. const { isColumn, ...flexProps } = useFlex(propsForFlex); return flexProps; } ;// ./node_modules/@wordpress/components/build-module/h-stack/component.js /** * Internal dependencies */ function UnconnectedHStack(props, forwardedRef) { const hStackProps = useHStack(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...hStackProps, ref: forwardedRef }); } /** * `HStack` (Horizontal Stack) arranges child elements in a horizontal line. * * `HStack` can render anything inside. * * ```jsx * import { * __experimentalHStack as HStack, * __experimentalText as Text, * } from `@wordpress/components`; * * function Example() { * return ( * * Code * is * Poetry * * ); * } * ``` */ const HStack = contextConnect(UnconnectedHStack, 'HStack'); /* harmony default export */ const h_stack_component = (HStack); ;// ./node_modules/@wordpress/components/build-module/number-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const number_control_noop = () => {}; function UnforwardedNumberControl(props, forwardedRef) { const { __unstableStateReducer: stateReducerProp, className, dragDirection = 'n', hideHTMLArrows = false, spinControls = hideHTMLArrows ? 'none' : 'native', isDragEnabled = true, isShiftStepEnabled = true, label, max = Infinity, min = -Infinity, required = false, shiftStep = 10, step = 1, spinFactor = 1, type: typeProp = 'number', value: valueProp, size = 'default', suffix, onChange = number_control_noop, __shouldNotWarnDeprecated36pxSize, ...restProps } = useDeprecated36pxDefaultSizeProp(props); maybeWarnDeprecated36pxSize({ componentName: 'NumberControl', size, __next40pxDefaultSize: restProps.__next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize }); if (hideHTMLArrows) { external_wp_deprecated_default()('wp.components.NumberControl hideHTMLArrows prop ', { alternative: 'spinControls="none"', since: '6.2', version: '6.3' }); } const inputRef = (0,external_wp_element_namespaceObject.useRef)(); const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([inputRef, forwardedRef]); const isStepAny = step === 'any'; const baseStep = isStepAny ? 1 : ensureNumber(step); const baseSpin = ensureNumber(spinFactor) * baseStep; const baseValue = roundClamp(0, min, max, baseStep); const constrainValue = (value, stepOverride) => { // When step is "any" clamp the value, otherwise round and clamp it. // Use '' + to convert to string for use in input value attribute. return isStepAny ? '' + Math.min(max, Math.max(min, ensureNumber(value))) : '' + roundClamp(value, min, max, stepOverride !== null && stepOverride !== void 0 ? stepOverride : baseStep); }; const autoComplete = typeProp === 'number' ? 'off' : undefined; const classes = dist_clsx('components-number-control', className); const cx = useCx(); const spinButtonClasses = cx(size === 'small' && styles.smallSpinButtons); const spinValue = (value, direction, event) => { event?.preventDefault(); const shift = event?.shiftKey && isShiftStepEnabled; const delta = shift ? ensureNumber(shiftStep) * baseSpin : baseSpin; let nextValue = isValueEmpty(value) ? baseValue : value; if (direction === 'up') { nextValue = add(nextValue, delta); } else if (direction === 'down') { nextValue = subtract(nextValue, delta); } return constrainValue(nextValue, shift ? delta : undefined); }; /** * "Middleware" function that intercepts updates from InputControl. * This allows us to tap into actions to transform the (next) state for * InputControl. * * @return The updated state to apply to InputControl */ const numberControlStateReducer = (state, action) => { const nextState = { ...state }; const { type, payload } = action; const event = payload.event; const currentValue = nextState.value; /** * Handles custom UP and DOWN Keyboard events */ if (type === PRESS_UP || type === PRESS_DOWN) { nextState.value = spinValue(currentValue, type === PRESS_UP ? 'up' : 'down', event); } /** * Handles drag to update events */ if (type === DRAG && isDragEnabled) { const [x, y] = payload.delta; const enableShift = payload.shiftKey && isShiftStepEnabled; const modifier = enableShift ? ensureNumber(shiftStep) * baseSpin : baseSpin; let directionModifier; let delta; switch (dragDirection) { case 'n': delta = y; directionModifier = -1; break; case 'e': delta = x; directionModifier = (0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1; break; case 's': delta = y; directionModifier = 1; break; case 'w': delta = x; directionModifier = (0,external_wp_i18n_namespaceObject.isRTL)() ? 1 : -1; break; } if (delta !== 0) { delta = Math.ceil(Math.abs(delta)) * Math.sign(delta); const distance = delta * modifier * directionModifier; nextState.value = constrainValue( // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined add(currentValue, distance), enableShift ? modifier : undefined); } } /** * Handles commit (ENTER key press or blur) */ if (type === PRESS_ENTER || type === COMMIT) { const applyEmptyValue = required === false && currentValue === ''; nextState.value = applyEmptyValue ? currentValue : // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined constrainValue(currentValue); } return nextState; }; const buildSpinButtonClickHandler = direction => event => onChange(String(spinValue(valueProp, direction, event)), { // Set event.target to the so that consumers can use // e.g. event.target.validity. event: { ...event, target: inputRef.current } }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(number_control_styles_Input, { autoComplete: autoComplete, inputMode: "numeric", ...restProps, className: classes, dragDirection: dragDirection, hideHTMLArrows: spinControls !== 'native', isDragEnabled: isDragEnabled, label: label, max: max === Infinity ? undefined : max, min: min === -Infinity ? undefined : min, ref: mergedRef, required: required, step: step, type: typeProp // @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components , value: valueProp, __unstableStateReducer: (state, action) => { var _stateReducerProp; const baseState = numberControlStateReducer(state, action); return (_stateReducerProp = stateReducerProp?.(baseState, action)) !== null && _stateReducerProp !== void 0 ? _stateReducerProp : baseState; }, size: size, __shouldNotWarnDeprecated36pxSize: true, suffix: spinControls === 'custom' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [suffix, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spacer_component, { marginBottom: 0, marginRight: 2, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, { spacing: 1, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpinButton, { className: spinButtonClasses, icon: library_plus, size: "small", label: (0,external_wp_i18n_namespaceObject.__)('Increment'), onClick: buildSpinButtonClickHandler('up') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpinButton, { className: spinButtonClasses, icon: library_reset, size: "small", label: (0,external_wp_i18n_namespaceObject.__)('Decrement'), onClick: buildSpinButtonClickHandler('down') })] }) })] }) : suffix, onChange: onChange }); } const NumberControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedNumberControl); /* harmony default export */ const number_control = (NumberControl); ;// ./node_modules/@wordpress/components/build-module/angle-picker-control/styles/angle-picker-control-styles.js function angle_picker_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const CIRCLE_SIZE = 32; const INNER_CIRCLE_SIZE = 6; const CircleRoot = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eln3bjz3" } : 0)("border-radius:", config_values.radiusRound, ";border:", config_values.borderWidth, " solid ", COLORS.ui.border, ";box-sizing:border-box;cursor:grab;height:", CIRCLE_SIZE, "px;overflow:hidden;width:", CIRCLE_SIZE, "px;:active{cursor:grabbing;}" + ( true ? "" : 0)); const CircleIndicatorWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eln3bjz2" } : 0)( true ? { name: "1r307gh", styles: "box-sizing:border-box;position:relative;width:100%;height:100%;:focus-visible{outline:none;}" } : 0); const CircleIndicator = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eln3bjz1" } : 0)("background:", COLORS.theme.accent, ";border-radius:", config_values.radiusRound, ";box-sizing:border-box;display:block;left:50%;top:4px;transform:translateX( -50% );position:absolute;width:", INNER_CIRCLE_SIZE, "px;height:", INNER_CIRCLE_SIZE, "px;" + ( true ? "" : 0)); const UnitText = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? { target: "eln3bjz0" } : 0)("color:", COLORS.theme.accent, ";margin-right:", space(3), ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/components/build-module/angle-picker-control/angle-circle.js /** * WordPress dependencies */ /** * Internal dependencies */ function AngleCircle({ value, onChange, ...props }) { const angleCircleRef = (0,external_wp_element_namespaceObject.useRef)(null); const angleCircleCenterRef = (0,external_wp_element_namespaceObject.useRef)(); const previousCursorValueRef = (0,external_wp_element_namespaceObject.useRef)(); const setAngleCircleCenter = () => { if (angleCircleRef.current === null) { return; } const rect = angleCircleRef.current.getBoundingClientRect(); angleCircleCenterRef.current = { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 }; }; const changeAngleToPosition = event => { if (event === undefined) { return; } // Prevent (drag) mouse events from selecting and accidentally // triggering actions from other elements. event.preventDefault(); // Input control needs to lose focus and by preventDefault above, it doesn't. event.target?.focus(); if (angleCircleCenterRef.current !== undefined && onChange !== undefined) { const { x: centerX, y: centerY } = angleCircleCenterRef.current; onChange(getAngle(centerX, centerY, event.clientX, event.clientY)); } }; const { startDrag, isDragging } = (0,external_wp_compose_namespaceObject.__experimentalUseDragging)({ onDragStart: event => { setAngleCircleCenter(); changeAngleToPosition(event); }, onDragMove: changeAngleToPosition, onDragEnd: changeAngleToPosition }); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isDragging) { if (previousCursorValueRef.current === undefined) { previousCursorValueRef.current = document.body.style.cursor; } document.body.style.cursor = 'grabbing'; } else { document.body.style.cursor = previousCursorValueRef.current || ''; previousCursorValueRef.current = undefined; } }, [isDragging]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CircleRoot, { ref: angleCircleRef, onMouseDown: startDrag, className: "components-angle-picker-control__angle-circle", ...props, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CircleIndicatorWrapper, { style: value ? { transform: `rotate(${value}deg)` } : undefined, className: "components-angle-picker-control__angle-circle-indicator-wrapper", tabIndex: -1, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CircleIndicator, { className: "components-angle-picker-control__angle-circle-indicator" }) }) }); } function getAngle(centerX, centerY, pointX, pointY) { const y = pointY - centerY; const x = pointX - centerX; const angleInRadians = Math.atan2(y, x); const angleInDeg = Math.round(angleInRadians * (180 / Math.PI)) + 90; if (angleInDeg < 0) { return 360 + angleInDeg; } return angleInDeg; } /* harmony default export */ const angle_circle = (AngleCircle); ;// ./node_modules/@wordpress/components/build-module/angle-picker-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedAnglePickerControl(props, ref) { const { className, label = (0,external_wp_i18n_namespaceObject.__)('Angle'), onChange, value, ...restProps } = props; const handleOnNumberChange = unprocessedValue => { if (onChange === undefined) { return; } const inputValue = unprocessedValue !== undefined && unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : 0; onChange(inputValue); }; const classes = dist_clsx('components-angle-picker-control', className); const unitText = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UnitText, { children: "\xB0" }); const [prefixedUnitText, suffixedUnitText] = (0,external_wp_i18n_namespaceObject.isRTL)() ? [unitText, null] : [null, unitText]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(flex_component, { ...restProps, ref: ref, className: classes, gap: 2, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_block_component, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(number_control, { __next40pxDefaultSize: true, label: label, className: "components-angle-picker-control__input-field", max: 360, min: 0, onChange: handleOnNumberChange, step: "1", value: value, spinControls: "none", prefix: prefixedUnitText, suffix: suffixedUnitText }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spacer_component, { marginBottom: "1", marginTop: "auto", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(angle_circle, { "aria-hidden": "true", value: value, onChange: onChange }) })] }); } /** * `AnglePickerControl` is a React component to render a UI that allows users to * pick an angle. Users can choose an angle in a visual UI with the mouse by * dragging an angle indicator inside a circle or by directly inserting the * desired angle in a text field. * * ```jsx * import { useState } from '@wordpress/element'; * import { AnglePickerControl } from '@wordpress/components'; * * function Example() { * const [ angle, setAngle ] = useState( 0 ); * return ( * * ); * } * ``` */ const AnglePickerControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedAnglePickerControl); /* harmony default export */ const angle_picker_control = (AnglePickerControl); // EXTERNAL MODULE: ./node_modules/remove-accents/index.js var remove_accents = __webpack_require__(9681); var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); ;// external ["wp","richText"] const external_wp_richText_namespaceObject = window["wp"]["richText"]; ;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/components/build-module/utils/strings.js /** * External dependencies */ /** * All unicode characters that we consider "dash-like": * - `\u007e`: ~ (tilde) * - `\u00ad`: ­ (soft hyphen) * - `\u2053`: ⁓ (swung dash) * - `\u207b`: ⁻ (superscript minus) * - `\u208b`: ₋ (subscript minus) * - `\u2212`: − (minus sign) * - `\\p{Pd}`: any other Unicode dash character */ const ALL_UNICODE_DASH_CHARACTERS = new RegExp(/[\u007e\u00ad\u2053\u207b\u208b\u2212\p{Pd}]/gu); const normalizeTextString = value => { return remove_accents_default()(value).toLocaleLowerCase().replace(ALL_UNICODE_DASH_CHARACTERS, '-'); }; /** * Converts any string to kebab case. * Backwards compatible with Lodash's `_.kebabCase()`. * Backwards compatible with `_wp_to_kebab_case()`. * * @see https://lodash.com/docs/4.17.15#kebabCase * @see https://developer.wordpress.org/reference/functions/_wp_to_kebab_case/ * * @param str String to convert. * @return Kebab-cased string */ function kebabCase(str) { var _str$toString; let input = (_str$toString = str?.toString?.()) !== null && _str$toString !== void 0 ? _str$toString : ''; // See https://github.com/lodash/lodash/blob/b185fcee26b2133bd071f4aaca14b455c2ed1008/lodash.js#L4970 input = input.replace(/['\u2019]/, ''); return paramCase(input, { splitRegexp: [/(?!(?:1ST|2ND|3RD|[4-9]TH)(?![a-z]))([a-z0-9])([A-Z])/g, // fooBar => foo-bar, 3Bar => 3-bar /(?!(?:1st|2nd|3rd|[4-9]th)(?![a-z]))([0-9])([a-z])/g, // 3bar => 3-bar /([A-Za-z])([0-9])/g, // Foo3 => foo-3, foo3 => foo-3 /([A-Z])([A-Z][a-z])/g // FOOBar => foo-bar ] }); } /** * Escapes the RegExp special characters. * * @param string Input string. * * @return Regex-escaped string. */ function escapeRegExp(string) { return string.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&'); } ;// ./node_modules/@wordpress/components/build-module/autocomplete/get-default-use-items.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function filterOptions(search, options = [], maxResults = 10) { const filtered = []; for (let i = 0; i < options.length; i++) { const option = options[i]; // Merge label into keywords. let { keywords = [] } = option; if ('string' === typeof option.label) { keywords = [...keywords, option.label]; } const isMatch = keywords.some(keyword => search.test(remove_accents_default()(keyword))); if (!isMatch) { continue; } filtered.push(option); // Abort early if max reached. if (filtered.length === maxResults) { break; } } return filtered; } function getDefaultUseItems(autocompleter) { return filterValue => { const [items, setItems] = (0,external_wp_element_namespaceObject.useState)([]); /* * We support both synchronous and asynchronous retrieval of completer options * but internally treat all as async so we maintain a single, consistent code path. * * Because networks can be slow, and the internet is wonderfully unpredictable, * we don't want two promises updating the state at once. This ensures that only * the most recent promise will act on `optionsData`. This doesn't use the state * because `setState` is batched, and so there's no guarantee that setting * `activePromise` in the state would result in it actually being in `this.state` * before the promise resolves and we check to see if this is the active promise or not. */ (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const { options, isDebounced } = autocompleter; const loadOptions = (0,external_wp_compose_namespaceObject.debounce)(() => { const promise = Promise.resolve(typeof options === 'function' ? options(filterValue) : options).then(optionsData => { if (promise.canceled) { return; } const keyedOptions = optionsData.map((optionData, optionIndex) => ({ key: `${autocompleter.name}-${optionIndex}`, value: optionData, label: autocompleter.getOptionLabel(optionData), keywords: autocompleter.getOptionKeywords ? autocompleter.getOptionKeywords(optionData) : [], isDisabled: autocompleter.isOptionDisabled ? autocompleter.isOptionDisabled(optionData) : false })); // Create a regular expression to filter the options. const search = new RegExp('(?:\\b|\\s|^)' + escapeRegExp(filterValue), 'i'); setItems(filterOptions(search, keyedOptions)); }); return promise; }, isDebounced ? 250 : 0); const promise = loadOptions(); return () => { loadOptions.cancel(); if (promise) { promise.canceled = true; } }; }, [filterValue]); return [items]; }; } ;// ./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs /** * Provides data to position an inner element of the floating element so that it * appears centered to the reference element. * This wraps the core `arrow` middleware to allow React refs as the element. * @see https://floating-ui.com/docs/arrow */ const floating_ui_react_dom_arrow = options => { function isRef(value) { return {}.hasOwnProperty.call(value, 'current'); } return { name: 'arrow', options, fn(state) { const { element, padding } = typeof options === 'function' ? options(state) : options; if (element && isRef(element)) { if (element.current != null) { return floating_ui_dom_arrow({ element: element.current, padding }).fn(state); } return {}; } if (element) { return floating_ui_dom_arrow({ element, padding }).fn(state); } return {}; } }; }; var index = typeof document !== 'undefined' ? external_React_.useLayoutEffect : external_React_.useEffect; // Fork of `fast-deep-equal` that only does the comparisons we need and compares // functions function deepEqual(a, b) { if (a === b) { return true; } if (typeof a !== typeof b) { return false; } if (typeof a === 'function' && a.toString() === b.toString()) { return true; } let length; let i; let keys; if (a && b && typeof a === 'object') { if (Array.isArray(a)) { length = a.length; if (length !== b.length) return false; for (i = length; i-- !== 0;) { if (!deepEqual(a[i], b[i])) { return false; } } return true; } keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) { return false; } for (i = length; i-- !== 0;) { if (!{}.hasOwnProperty.call(b, keys[i])) { return false; } } for (i = length; i-- !== 0;) { const key = keys[i]; if (key === '_owner' && a.$$typeof) { continue; } if (!deepEqual(a[key], b[key])) { return false; } } return true; } // biome-ignore lint/suspicious/noSelfCompare: in source return a !== a && b !== b; } function getDPR(element) { if (typeof window === 'undefined') { return 1; } const win = element.ownerDocument.defaultView || window; return win.devicePixelRatio || 1; } function floating_ui_react_dom_roundByDPR(element, value) { const dpr = getDPR(element); return Math.round(value * dpr) / dpr; } function useLatestRef(value) { const ref = external_React_.useRef(value); index(() => { ref.current = value; }); return ref; } /** * Provides data to position a floating element. * @see https://floating-ui.com/docs/useFloating */ function useFloating(options) { if (options === void 0) { options = {}; } const { placement = 'bottom', strategy = 'absolute', middleware = [], platform, elements: { reference: externalReference, floating: externalFloating } = {}, transform = true, whileElementsMounted, open } = options; const [data, setData] = external_React_.useState({ x: 0, y: 0, strategy, placement, middlewareData: {}, isPositioned: false }); const [latestMiddleware, setLatestMiddleware] = external_React_.useState(middleware); if (!deepEqual(latestMiddleware, middleware)) { setLatestMiddleware(middleware); } const [_reference, _setReference] = external_React_.useState(null); const [_floating, _setFloating] = external_React_.useState(null); const setReference = external_React_.useCallback(node => { if (node !== referenceRef.current) { referenceRef.current = node; _setReference(node); } }, []); const setFloating = external_React_.useCallback(node => { if (node !== floatingRef.current) { floatingRef.current = node; _setFloating(node); } }, []); const referenceEl = externalReference || _reference; const floatingEl = externalFloating || _floating; const referenceRef = external_React_.useRef(null); const floatingRef = external_React_.useRef(null); const dataRef = external_React_.useRef(data); const hasWhileElementsMounted = whileElementsMounted != null; const whileElementsMountedRef = useLatestRef(whileElementsMounted); const platformRef = useLatestRef(platform); const update = external_React_.useCallback(() => { if (!referenceRef.current || !floatingRef.current) { return; } const config = { placement, strategy, middleware: latestMiddleware }; if (platformRef.current) { config.platform = platformRef.current; } floating_ui_dom_computePosition(referenceRef.current, floatingRef.current, config).then(data => { const fullData = { ...data, isPositioned: true }; if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { dataRef.current = fullData; external_ReactDOM_namespaceObject.flushSync(() => { setData(fullData); }); } }); }, [latestMiddleware, placement, strategy, platformRef]); index(() => { if (open === false && dataRef.current.isPositioned) { dataRef.current.isPositioned = false; setData(data => ({ ...data, isPositioned: false })); } }, [open]); const isMountedRef = external_React_.useRef(false); index(() => { isMountedRef.current = true; return () => { isMountedRef.current = false; }; }, []); // biome-ignore lint/correctness/useExhaustiveDependencies: `hasWhileElementsMounted` is intentionally included. index(() => { if (referenceEl) referenceRef.current = referenceEl; if (floatingEl) floatingRef.current = floatingEl; if (referenceEl && floatingEl) { if (whileElementsMountedRef.current) { return whileElementsMountedRef.current(referenceEl, floatingEl, update); } update(); } }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]); const refs = external_React_.useMemo(() => ({ reference: referenceRef, floating: floatingRef, setReference, setFloating }), [setReference, setFloating]); const elements = external_React_.useMemo(() => ({ reference: referenceEl, floating: floatingEl }), [referenceEl, floatingEl]); const floatingStyles = external_React_.useMemo(() => { const initialStyles = { position: strategy, left: 0, top: 0 }; if (!elements.floating) { return initialStyles; } const x = floating_ui_react_dom_roundByDPR(elements.floating, data.x); const y = floating_ui_react_dom_roundByDPR(elements.floating, data.y); if (transform) { return { ...initialStyles, transform: "translate(" + x + "px, " + y + "px)", ...(getDPR(elements.floating) >= 1.5 && { willChange: 'transform' }) }; } return { position: strategy, left: x, top: y }; }, [strategy, transform, elements.floating, data.x, data.y]); return external_React_.useMemo(() => ({ ...data, update, refs, elements, floatingStyles }), [data, update, refs, elements, floatingStyles]); } ;// ./node_modules/@wordpress/icons/build-module/library/close.js /** * WordPress dependencies */ const close_close = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.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" }) }); /* harmony default export */ const library_close = (close_close); ;// ./node_modules/@wordpress/components/build-module/scroll-lock/index.js /** * WordPress dependencies */ /* * Setting `overflow: hidden` on html and body elements resets body scroll in iOS. * Save scroll top so we can restore it after locking scroll. * * NOTE: It would be cleaner and possibly safer to find a localized solution such * as preventing default on certain touchmove events. */ let previousScrollTop = 0; function setLocked(locked) { const scrollingElement = document.scrollingElement || document.body; if (locked) { previousScrollTop = scrollingElement.scrollTop; } const methodName = locked ? 'add' : 'remove'; scrollingElement.classList[methodName]('lockscroll'); // Adding the class to the document element seems to be necessary in iOS. document.documentElement.classList[methodName]('lockscroll'); if (!locked) { scrollingElement.scrollTop = previousScrollTop; } } let lockCounter = 0; /** * ScrollLock is a content-free React component for declaratively preventing * scroll bleed from modal UI to the page body. This component applies a * `lockscroll` class to the `document.documentElement` and * `document.scrollingElement` elements to stop the body from scrolling. When it * is present, the lock is applied. * * ```jsx * import { ScrollLock, Button } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyScrollLock = () => { * const [ isScrollLocked, setIsScrollLocked ] = useState( false ); * * const toggleLock = () => { * setIsScrollLocked( ( locked ) => ! locked ) ); * }; * * return ( *
* * { isScrollLocked && } *

* Scroll locked: * { isScrollLocked ? 'Yes' : 'No' } *

*
* ); * }; * ``` */ function ScrollLock() { (0,external_wp_element_namespaceObject.useEffect)(() => { if (lockCounter === 0) { setLocked(true); } ++lockCounter; return () => { if (lockCounter === 1) { setLocked(false); } --lockCounter; }; }, []); return null; } /* harmony default export */ const scroll_lock = (ScrollLock); ;// ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js /** * WordPress dependencies */ /** * Internal dependencies */ const initialContextValue = { slots: (0,external_wp_compose_namespaceObject.observableMap)(), fills: (0,external_wp_compose_namespaceObject.observableMap)(), registerSlot: () => { true ? external_wp_warning_default()('Components must be wrapped within `SlotFillProvider`. ' + 'See https://developer.wordpress.org/block-editor/components/slot-fill/') : 0; }, updateSlot: () => {}, unregisterSlot: () => {}, registerFill: () => {}, unregisterFill: () => {}, // This helps the provider know if it's using the default context value or not. isDefault: true }; const SlotFillContext = (0,external_wp_element_namespaceObject.createContext)(initialContextValue); /* harmony default export */ const slot_fill_context = (SlotFillContext); ;// ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js /** * WordPress dependencies */ /** * Internal dependencies */ function useSlot(name) { const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context); const slot = (0,external_wp_compose_namespaceObject.useObservableValue)(registry.slots, name); return { ...slot }; } ;// ./node_modules/@wordpress/components/build-module/slot-fill/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const initialValue = { slots: (0,external_wp_compose_namespaceObject.observableMap)(), fills: (0,external_wp_compose_namespaceObject.observableMap)(), registerSlot: () => {}, unregisterSlot: () => {}, registerFill: () => {}, unregisterFill: () => {}, updateFill: () => {} }; const context_SlotFillContext = (0,external_wp_element_namespaceObject.createContext)(initialValue); /* harmony default export */ const context = (context_SlotFillContext); ;// ./node_modules/@wordpress/components/build-module/slot-fill/fill.js /** * WordPress dependencies */ /** * Internal dependencies */ function Fill({ name, children }) { const registry = (0,external_wp_element_namespaceObject.useContext)(context); const instanceRef = (0,external_wp_element_namespaceObject.useRef)({}); const childrenRef = (0,external_wp_element_namespaceObject.useRef)(children); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { childrenRef.current = children; }, [children]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const instance = instanceRef.current; registry.registerFill(name, instance, childrenRef.current); return () => registry.unregisterFill(name, instance); }, [registry, name]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { registry.updateFill(name, instanceRef.current, childrenRef.current); }); return null; } ;// ./node_modules/@wordpress/components/build-module/slot-fill/slot.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Whether the argument is a function. * * @param maybeFunc The argument to check. * @return True if the argument is a function, false otherwise. */ function isFunction(maybeFunc) { return typeof maybeFunc === 'function'; } function addKeysToChildren(children) { return external_wp_element_namespaceObject.Children.map(children, (child, childIndex) => { if (!child || typeof child === 'string') { return child; } let childKey = childIndex; if (typeof child === 'object' && 'key' in child && child?.key) { childKey = child.key; } return (0,external_wp_element_namespaceObject.cloneElement)(child, { key: childKey }); }); } function Slot(props) { var _useObservableValue; const registry = (0,external_wp_element_namespaceObject.useContext)(context); const instanceRef = (0,external_wp_element_namespaceObject.useRef)({}); const { name, children, fillProps = {} } = props; (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const instance = instanceRef.current; registry.registerSlot(name, instance); return () => registry.unregisterSlot(name, instance); }, [registry, name]); let fills = (_useObservableValue = (0,external_wp_compose_namespaceObject.useObservableValue)(registry.fills, name)) !== null && _useObservableValue !== void 0 ? _useObservableValue : []; const currentSlot = (0,external_wp_compose_namespaceObject.useObservableValue)(registry.slots, name); // Fills should only be rendered in the currently registered instance of the slot. if (currentSlot !== instanceRef.current) { fills = []; } const renderedFills = fills.map(fill => { const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children; return addKeysToChildren(fillChildren); }).filter( // In some cases fills are rendered only when some conditions apply. // This ensures that we only use non-empty fills when rendering, i.e., // it allows us to render wrappers only when the fills are actually present. element => !(0,external_wp_element_namespaceObject.isEmptyElement)(element)); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: isFunction(children) ? children(renderedFills) : renderedFills }); } /* harmony default export */ const slot = (Slot); ;// ./node_modules/@wordpress/components/node_modules/uuid/dist/esm-browser/native.js const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); /* harmony default export */ const esm_browser_native = ({ randomUUID }); ;// ./node_modules/@wordpress/components/node_modules/uuid/dist/esm-browser/rng.js // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). let getRandomValues; const rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. 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/@wordpress/components/node_modules/uuid/dist/esm-browser/stringify.js /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).slice(1)); } function unsafeStringify(arr, offset = 0) { // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; } function stringify_stringify(arr, offset = 0) { const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one // of the following: // - One or more input array values don't map to a hex octet (leading to // "undefined" in the uuid) // - Invalid input values for the RFC `version` or `variant` fields if (!validate(uuid)) { throw TypeError('Stringified UUID is invalid'); } return uuid; } /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify_stringify))); ;// ./node_modules/@wordpress/components/node_modules/uuid/dist/esm-browser/v4.js function v4(options, buf, offset) { if (esm_browser_native.randomUUID && !buf && !options) { return esm_browser_native.randomUUID(); } options = options || {}; const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (let i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return unsafeStringify(rnds); } /* harmony default export */ const esm_browser_v4 = (v4); ;// ./node_modules/@wordpress/components/build-module/style-provider/index.js /** * External dependencies */ /** * Internal dependencies */ const uuidCache = new Set(); // Use a weak map so that when the container is detached it's automatically // dereferenced to avoid memory leak. const containerCacheMap = new WeakMap(); const memoizedCreateCacheWithContainer = container => { if (containerCacheMap.has(container)) { return containerCacheMap.get(container); } // Emotion only accepts alphabetical and hyphenated keys so we just // strip the numbers from the UUID. It _should_ be fine. let key = esm_browser_v4().replace(/[0-9]/g, ''); while (uuidCache.has(key)) { key = esm_browser_v4().replace(/[0-9]/g, ''); } uuidCache.add(key); const cache = emotion_cache_browser_esm({ container, key }); containerCacheMap.set(container, cache); return cache; }; function StyleProvider(props) { const { children, document } = props; if (!document) { return null; } const cache = memoizedCreateCacheWithContainer(document.head); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CacheProvider, { value: cache, children: children }); } /* harmony default export */ const style_provider = (StyleProvider); ;// ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/fill.js /** * WordPress dependencies */ /** * Internal dependencies */ function fill_Fill({ name, children }) { var _slot$fillProps; const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context); const slot = (0,external_wp_compose_namespaceObject.useObservableValue)(registry.slots, name); const instanceRef = (0,external_wp_element_namespaceObject.useRef)({}); // We register fills so we can keep track of their existence. // Slots can use the `useSlotFills` hook to know if there're already fills // registered so they can choose to render themselves or not. (0,external_wp_element_namespaceObject.useEffect)(() => { const instance = instanceRef.current; registry.registerFill(name, instance); return () => registry.unregisterFill(name, instance); }, [registry, name]); if (!slot || !slot.ref.current) { return null; } // When using a `Fill`, the `children` will be rendered in the document of the // `Slot`. This means that we need to wrap the `children` in a `StyleProvider` // to make sure we're referencing the right document/iframe (instead of the // context of the `Fill`'s parent). const wrappedChildren = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_provider, { document: slot.ref.current.ownerDocument, children: typeof children === 'function' ? children((_slot$fillProps = slot.fillProps) !== null && _slot$fillProps !== void 0 ? _slot$fillProps : {}) : children }); return (0,external_wp_element_namespaceObject.createPortal)(wrappedChildren, slot.ref.current); } ;// ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function slot_Slot(props, forwardedRef) { const { name, fillProps = {}, as, // `children` is not allowed. However, if it is passed, // it will be displayed as is, so remove `children`. children, ...restProps } = props; const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context); const ref = (0,external_wp_element_namespaceObject.useRef)(null); // We don't want to unregister and register the slot whenever // `fillProps` change, which would cause the fill to be re-mounted. Instead, // we can just update the slot (see hook below). // For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973 const fillPropsRef = (0,external_wp_element_namespaceObject.useRef)(fillProps); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { fillPropsRef.current = fillProps; }, [fillProps]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { registry.registerSlot(name, ref, fillPropsRef.current); return () => registry.unregisterSlot(name, ref); }, [registry, name]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { registry.updateSlot(name, ref, fillPropsRef.current); }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { as: as, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([forwardedRef, ref]), ...restProps }); } /* harmony default export */ const bubbles_virtually_slot = ((0,external_wp_element_namespaceObject.forwardRef)(slot_Slot)); ;// external ["wp","isShallowEqual"] const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); ;// ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js /** * WordPress dependencies */ /** * Internal dependencies */ function createSlotRegistry() { const slots = (0,external_wp_compose_namespaceObject.observableMap)(); const fills = (0,external_wp_compose_namespaceObject.observableMap)(); const registerSlot = (name, ref, fillProps) => { slots.set(name, { ref, fillProps }); }; const unregisterSlot = (name, ref) => { const slot = slots.get(name); if (!slot) { return; } // Make sure we're not unregistering a slot registered by another element // See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412 if (slot.ref !== ref) { return; } slots.delete(name); }; const updateSlot = (name, ref, fillProps) => { const slot = slots.get(name); if (!slot) { return; } if (slot.ref !== ref) { return; } if (external_wp_isShallowEqual_default()(slot.fillProps, fillProps)) { return; } slots.set(name, { ref, fillProps }); }; const registerFill = (name, ref) => { fills.set(name, [...(fills.get(name) || []), ref]); }; const unregisterFill = (name, ref) => { const fillsForName = fills.get(name); if (!fillsForName) { return; } fills.set(name, fillsForName.filter(fillRef => fillRef !== ref)); }; return { slots, fills, registerSlot, updateSlot, unregisterSlot, registerFill, unregisterFill }; } function SlotFillProvider({ children }) { const [registry] = (0,external_wp_element_namespaceObject.useState)(createSlotRegistry); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(slot_fill_context.Provider, { value: registry, children: children }); } ;// ./node_modules/@wordpress/components/build-module/slot-fill/provider.js /** * WordPress dependencies */ /** * Internal dependencies */ function provider_createSlotRegistry() { const slots = (0,external_wp_compose_namespaceObject.observableMap)(); const fills = (0,external_wp_compose_namespaceObject.observableMap)(); function registerSlot(name, instance) { slots.set(name, instance); } function unregisterSlot(name, instance) { // If a previous instance of a Slot by this name unmounts, do nothing, // as the slot and its fills should only be removed for the current // known instance. if (slots.get(name) !== instance) { return; } slots.delete(name); } function registerFill(name, instance, children) { fills.set(name, [...(fills.get(name) || []), { instance, children }]); } function unregisterFill(name, instance) { const fillsForName = fills.get(name); if (!fillsForName) { return; } fills.set(name, fillsForName.filter(fill => fill.instance !== instance)); } function updateFill(name, instance, children) { const fillsForName = fills.get(name); if (!fillsForName) { return; } const fillForInstance = fillsForName.find(f => f.instance === instance); if (!fillForInstance) { return; } if (fillForInstance.children === children) { return; } fills.set(name, fillsForName.map(f => { if (f.instance === instance) { // Replace with new record with updated `children`. return { instance, children }; } return f; })); } return { slots, fills, registerSlot, unregisterSlot, registerFill, unregisterFill, updateFill }; } function provider_SlotFillProvider({ children }) { const [contextValue] = (0,external_wp_element_namespaceObject.useState)(provider_createSlotRegistry); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, { value: contextValue, children: children }); } /* harmony default export */ const provider = (provider_SlotFillProvider); ;// ./node_modules/@wordpress/components/build-module/slot-fill/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function slot_fill_Fill(props) { // We're adding both Fills here so they can register themselves before // their respective slot has been registered. Only the Fill that has a slot // will render. The other one will return null. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { ...props }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fill_Fill, { ...props })] }); } function UnforwardedSlot(props, ref) { const { bubblesVirtually, ...restProps } = props; if (bubblesVirtually) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(bubbles_virtually_slot, { ...restProps, ref: ref }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(slot, { ...restProps }); } const slot_fill_Slot = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSlot); function Provider({ children, passthrough = false }) { const parent = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context); if (!parent.isDefault && passthrough) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: children }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(provider, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SlotFillProvider, { children: children }) }); } Provider.displayName = 'SlotFillProvider'; function createSlotFill(key) { const baseName = typeof key === 'symbol' ? key.description : key; const FillComponent = props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(slot_fill_Fill, { name: key, ...props }); FillComponent.displayName = `${baseName}Fill`; const SlotComponent = props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(slot_fill_Slot, { name: key, ...props }); SlotComponent.displayName = `${baseName}Slot`; /** * @deprecated 6.8.0 * Please use `slotFill.name` instead of `slotFill.Slot.__unstableName`. */ SlotComponent.__unstableName = key; return { name: key, Fill: FillComponent, Slot: SlotComponent }; } ;// ./node_modules/@wordpress/components/build-module/popover/overlay-middlewares.js /** * External dependencies */ function overlayMiddlewares() { return [{ name: 'overlay', fn({ rects }) { return rects.reference; } }, floating_ui_dom_size({ apply({ rects, elements }) { var _elements$floating; const { firstElementChild } = (_elements$floating = elements.floating) !== null && _elements$floating !== void 0 ? _elements$floating : {}; // Only HTMLElement instances have the `style` property. if (!(firstElementChild instanceof HTMLElement)) { return; } // Reduce the height of the popover to the available space. Object.assign(firstElementChild.style, { width: `${rects.reference.width}px`, height: `${rects.reference.height}px` }); } })]; } ;// ./node_modules/@wordpress/components/build-module/popover/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Name of slot in which popover should fill. * * @type {string} */ const SLOT_NAME = 'Popover'; // An SVG displaying a triangle facing down, filled with a solid // color and bordered in such a way to create an arrow-like effect. // Keeping the SVG's viewbox squared simplify the arrow positioning // calculations. const ArrowTriangle = () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 100 100", className: "components-popover__triangle", role: "presentation", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { className: "components-popover__triangle-bg", d: "M 0 0 L 50 50 L 100 0" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { className: "components-popover__triangle-border", d: "M 0 0 L 50 50 L 100 0", vectorEffect: "non-scaling-stroke" })] }); const slotNameContext = (0,external_wp_element_namespaceObject.createContext)(undefined); const fallbackContainerClassname = 'components-popover__fallback-container'; const getPopoverFallbackContainer = () => { let container = document.body.querySelector('.' + fallbackContainerClassname); if (!container) { container = document.createElement('div'); container.className = fallbackContainerClassname; document.body.append(container); } return container; }; const UnforwardedPopover = (props, forwardedRef) => { const { animate = true, headerTitle, constrainTabbing, onClose, children, className, noArrow = true, position, placement: placementProp = 'bottom-start', offset: offsetProp = 0, focusOnMount = 'firstElement', anchor, expandOnMobile, onFocusOutside, __unstableSlotName = SLOT_NAME, flip = true, resize = true, shift = false, inline = false, variant, style: contentStyle, // Deprecated props __unstableForcePosition, anchorRef, anchorRect, getAnchorRect, isAlternate, // Rest ...contentProps } = useContextSystem(props, 'Popover'); let computedFlipProp = flip; let computedResizeProp = resize; if (__unstableForcePosition !== undefined) { external_wp_deprecated_default()('`__unstableForcePosition` prop in wp.components.Popover', { since: '6.1', version: '6.3', alternative: '`flip={ false }` and `resize={ false }`' }); // Back-compat, set the `flip` and `resize` props // to `false` to replicate `__unstableForcePosition`. computedFlipProp = !__unstableForcePosition; computedResizeProp = !__unstableForcePosition; } if (anchorRef !== undefined) { external_wp_deprecated_default()('`anchorRef` prop in wp.components.Popover', { since: '6.1', alternative: '`anchor` prop' }); } if (anchorRect !== undefined) { external_wp_deprecated_default()('`anchorRect` prop in wp.components.Popover', { since: '6.1', alternative: '`anchor` prop' }); } if (getAnchorRect !== undefined) { external_wp_deprecated_default()('`getAnchorRect` prop in wp.components.Popover', { since: '6.1', alternative: '`anchor` prop' }); } const computedVariant = isAlternate ? 'toolbar' : variant; if (isAlternate !== undefined) { external_wp_deprecated_default()('`isAlternate` prop in wp.components.Popover', { since: '6.2', alternative: "`variant` prop with the `'toolbar'` value" }); } const arrowRef = (0,external_wp_element_namespaceObject.useRef)(null); const [fallbackReferenceElement, setFallbackReferenceElement] = (0,external_wp_element_namespaceObject.useState)(null); const anchorRefFallback = (0,external_wp_element_namespaceObject.useCallback)(node => { setFallbackReferenceElement(node); }, []); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const isExpanded = expandOnMobile && isMobileViewport; const hasArrow = !isExpanded && !noArrow; const normalizedPlacementFromProps = position ? positionToPlacement(position) : placementProp; const middleware = [...(placementProp === 'overlay' ? overlayMiddlewares() : []), offset(offsetProp), computedFlipProp && floating_ui_dom_flip(), computedResizeProp && floating_ui_dom_size({ apply(sizeProps) { var _refs$floating$curren; const { firstElementChild } = (_refs$floating$curren = refs.floating.current) !== null && _refs$floating$curren !== void 0 ? _refs$floating$curren : {}; // Only HTMLElement instances have the `style` property. if (!(firstElementChild instanceof HTMLElement)) { return; } // Reduce the height of the popover to the available space. Object.assign(firstElementChild.style, { maxHeight: `${sizeProps.availableHeight}px`, overflow: 'auto' }); } }), shift && floating_ui_dom_shift({ crossAxis: true, limiter: floating_ui_dom_limitShift(), padding: 1 // Necessary to avoid flickering at the edge of the viewport. }), floating_ui_react_dom_arrow({ element: arrowRef })]; const slotName = (0,external_wp_element_namespaceObject.useContext)(slotNameContext) || __unstableSlotName; const slot = useSlot(slotName); let onDialogClose; if (onClose || onFocusOutside) { onDialogClose = (type, event) => { // Ideally the popover should have just a single onClose prop and // not three props that potentially do the same thing. if (type === 'focus-outside' && onFocusOutside) { onFocusOutside(event); } else if (onClose) { onClose(); } }; } const [dialogRef, dialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ constrainTabbing, focusOnMount, __unstableOnClose: onDialogClose, // @ts-expect-error The __unstableOnClose property needs to be deprecated first (see https://github.com/WordPress/gutenberg/pull/27675) onClose: onDialogClose }); const { // Positioning coordinates x, y, // Object with "regular" refs to both "reference" and "floating" refs, // Type of CSS position property to use (absolute or fixed) strategy, update, placement: computedPlacement, middlewareData: { arrow: arrowData } } = useFloating({ placement: normalizedPlacementFromProps === 'overlay' ? undefined : normalizedPlacementFromProps, middleware, whileElementsMounted: (referenceParam, floatingParam, updateParam) => autoUpdate(referenceParam, floatingParam, updateParam, { layoutShift: false, animationFrame: true }) }); const arrowCallbackRef = (0,external_wp_element_namespaceObject.useCallback)(node => { arrowRef.current = node; update(); }, [update]); // When any of the possible anchor "sources" change, // recompute the reference element (real or virtual) and its owner document. const anchorRefTop = anchorRef?.top; const anchorRefBottom = anchorRef?.bottom; const anchorRefStartContainer = anchorRef?.startContainer; const anchorRefCurrent = anchorRef?.current; (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const resultingReferenceElement = getReferenceElement({ anchor, anchorRef, anchorRect, getAnchorRect, fallbackReferenceElement }); refs.setReference(resultingReferenceElement); }, [anchor, anchorRef, anchorRefTop, anchorRefBottom, anchorRefStartContainer, anchorRefCurrent, anchorRect, getAnchorRect, fallbackReferenceElement, refs]); const mergedFloatingRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([refs.setFloating, dialogRef, forwardedRef]); const style = isExpanded ? undefined : { position: strategy, top: 0, left: 0, // `x` and `y` are framer-motion specific props and are shorthands // for `translateX` and `translateY`. Currently it is not possible // to use `translateX` and `translateY` because those values would // be overridden by the return value of the // `placementToMotionAnimationProps` function. x: computePopoverPosition(x), y: computePopoverPosition(y) }; const shouldReduceMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const shouldAnimate = animate && !isExpanded && !shouldReduceMotion; const [animationFinished, setAnimationFinished] = (0,external_wp_element_namespaceObject.useState)(false); const { style: motionInlineStyles, ...otherMotionProps } = (0,external_wp_element_namespaceObject.useMemo)(() => placementToMotionAnimationProps(computedPlacement), [computedPlacement]); const animationProps = shouldAnimate ? { style: { ...contentStyle, ...motionInlineStyles, ...style }, onAnimationComplete: () => setAnimationFinished(true), ...otherMotionProps } : { animate: false, style: { ...contentStyle, ...style } }; // When Floating UI has finished positioning and Framer Motion has finished animating // the popover, add the `is-positioned` class to signal that all transitions have finished. const isPositioned = (!shouldAnimate || animationFinished) && x !== null && y !== null; let content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(motion.div, { className: dist_clsx(className, { 'is-expanded': isExpanded, 'is-positioned': isPositioned, // Use the 'alternate' classname for 'toolbar' variant for back compat. [`is-${computedVariant === 'toolbar' ? 'alternate' : computedVariant}`]: computedVariant }), ...animationProps, ...contentProps, ref: mergedFloatingRef, ...dialogProps, tabIndex: -1, children: [isExpanded && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(scroll_lock, {}), isExpanded && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-popover__header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-popover__header-title", children: headerTitle }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { className: "components-popover__close", size: "small", icon: library_close, onClick: onClose, label: (0,external_wp_i18n_namespaceObject.__)('Close') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-popover__content", children: children }), hasArrow && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: arrowCallbackRef, className: ['components-popover__arrow', `is-${computedPlacement.split('-')[0]}`].join(' '), style: { left: typeof arrowData?.x !== 'undefined' && Number.isFinite(arrowData.x) ? `${arrowData.x}px` : '', top: typeof arrowData?.y !== 'undefined' && Number.isFinite(arrowData.y) ? `${arrowData.y}px` : '' }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ArrowTriangle, {}) })] }); const shouldRenderWithinSlot = slot.ref && !inline; const hasAnchor = anchorRef || anchorRect || anchor; if (shouldRenderWithinSlot) { content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(slot_fill_Fill, { name: slotName, children: content }); } else if (!inline) { content = (0,external_wp_element_namespaceObject.createPortal)(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleProvider, { document: document, children: content }), getPopoverFallbackContainer()); } if (hasAnchor) { return content; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { ref: anchorRefFallback }), content] }); }; /** * `Popover` renders its content in a floating modal. If no explicit anchor is passed via props, it anchors to its parent element by default. * * ```jsx * import { Button, Popover } from '@wordpress/components'; * import { useState } from '@wordpress/element'; * * const MyPopover = () => { * const [ isVisible, setIsVisible ] = useState( false ); * const toggleVisible = () => { * setIsVisible( ( state ) => ! state ); * }; * * return ( * * ); * }; * ``` * */ const popover_Popover = contextConnect(UnforwardedPopover, 'Popover'); function PopoverSlot({ name = SLOT_NAME }, ref) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(slot_fill_Slot, { bubblesVirtually: true, name: name, className: "popover-slot", ref: ref }); } // @ts-expect-error For Legacy Reasons popover_Popover.Slot = (0,external_wp_element_namespaceObject.forwardRef)(PopoverSlot); // @ts-expect-error For Legacy Reasons popover_Popover.__unstableSlotNameProvider = slotNameContext.Provider; /* harmony default export */ const popover = (popover_Popover); ;// ./node_modules/@wordpress/components/build-module/autocomplete/autocompleter-ui.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ListBox({ items, onSelect, selectedIndex, instanceId, listBoxId, className, Component = 'div' }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { id: listBoxId, role: "listbox", className: "components-autocomplete__results", children: items.map((option, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { id: `components-autocomplete-item-${instanceId}-${option.key}`, role: "option", __next40pxDefaultSize: true, "aria-selected": index === selectedIndex, accessibleWhenDisabled: true, disabled: option.isDisabled, className: dist_clsx('components-autocomplete__result', className, { // Unused, for backwards compatibility. 'is-selected': index === selectedIndex }), variant: index === selectedIndex ? 'primary' : undefined, onClick: () => onSelect(option), children: option.label }, option.key)) }); } function getAutoCompleterUI(autocompleter) { var _autocompleter$useIte; const useItems = (_autocompleter$useIte = autocompleter.useItems) !== null && _autocompleter$useIte !== void 0 ? _autocompleter$useIte : getDefaultUseItems(autocompleter); function AutocompleterUI({ filterValue, instanceId, listBoxId, className, selectedIndex, onChangeOptions, onSelect, onReset, reset, contentRef }) { const [items] = useItems(filterValue); const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({ editableContentElement: contentRef.current }); const [needsA11yCompat, setNeedsA11yCompat] = (0,external_wp_element_namespaceObject.useState)(false); const popoverRef = (0,external_wp_element_namespaceObject.useRef)(null); const popoverRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([popoverRef, (0,external_wp_compose_namespaceObject.useRefEffect)(node => { if (!contentRef.current) { return; } // If the popover is rendered in a different document than // the content, we need to duplicate the options list in the // content document so that it's available to the screen // readers, which check the DOM ID based aria-* attributes. setNeedsA11yCompat(node.ownerDocument !== contentRef.current.ownerDocument); }, [contentRef])]); useOnClickOutside(popoverRef, reset); const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); function announce(options) { if (!debouncedSpeak) { return; } if (!!options.length) { if (filterValue) { debouncedSpeak((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', options.length), options.length), 'assertive'); } else { debouncedSpeak((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)('Initial %d result loaded. Type to filter all available results. Use up and down arrow keys to navigate.', 'Initial %d results loaded. Type to filter all available results. Use up and down arrow keys to navigate.', options.length), options.length), 'assertive'); } } else { debouncedSpeak((0,external_wp_i18n_namespaceObject.__)('No results.'), 'assertive'); } } (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { onChangeOptions(items); announce(items); // We want to avoid introducing unexpected side effects. // See https://github.com/WordPress/gutenberg/pull/41820 }, [items]); if (items.length === 0) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(popover, { focusOnMount: false, onClose: onReset, placement: "top-start", className: "components-autocomplete__popover", anchor: popoverAnchor, ref: popoverRefs, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListBox, { items: items, onSelect: onSelect, selectedIndex: selectedIndex, instanceId: instanceId, listBoxId: listBoxId, className: className }) }), contentRef.current && needsA11yCompat && (0,external_ReactDOM_namespaceObject.createPortal)(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListBox, { items: items, onSelect: onSelect, selectedIndex: selectedIndex, instanceId: instanceId, listBoxId: listBoxId, className: className, Component: visually_hidden_component }), contentRef.current.ownerDocument.body)] }); } return AutocompleterUI; } function useOnClickOutside(ref, handler) { (0,external_wp_element_namespaceObject.useEffect)(() => { const listener = event => { // Do nothing if clicking ref's element or descendent elements, or if the ref is not referencing an element if (!ref.current || ref.current.contains(event.target)) { return; } handler(event); }; document.addEventListener('mousedown', listener); document.addEventListener('touchstart', listener); return () => { document.removeEventListener('mousedown', listener); document.removeEventListener('touchstart', listener); }; }, [handler, ref]); } ;// ./node_modules/@wordpress/components/build-module/autocomplete/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const getNodeText = node => { if (node === null) { return ''; } switch (typeof node) { case 'string': case 'number': return node.toString(); break; case 'boolean': return ''; break; case 'object': { if (node instanceof Array) { return node.map(getNodeText).join(''); } if ('props' in node) { return getNodeText(node.props.children); } break; } default: return ''; } return ''; }; const EMPTY_FILTERED_OPTIONS = []; // Used for generating the instance ID const AUTOCOMPLETE_HOOK_REFERENCE = {}; function useAutocomplete({ record, onChange, onReplace, completers, contentRef }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(AUTOCOMPLETE_HOOK_REFERENCE); const [selectedIndex, setSelectedIndex] = (0,external_wp_element_namespaceObject.useState)(0); const [filteredOptions, setFilteredOptions] = (0,external_wp_element_namespaceObject.useState)(EMPTY_FILTERED_OPTIONS); const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); const [autocompleter, setAutocompleter] = (0,external_wp_element_namespaceObject.useState)(null); const [AutocompleterUI, setAutocompleterUI] = (0,external_wp_element_namespaceObject.useState)(null); const backspacingRef = (0,external_wp_element_namespaceObject.useRef)(false); function insertCompletion(replacement) { if (autocompleter === null) { return; } const end = record.start; const start = end - autocompleter.triggerPrefix.length - filterValue.length; const toInsert = (0,external_wp_richText_namespaceObject.create)({ html: (0,external_wp_element_namespaceObject.renderToString)(replacement) }); onChange((0,external_wp_richText_namespaceObject.insert)(record, toInsert, start, end)); } function select(option) { const { getOptionCompletion } = autocompleter || {}; if (option.isDisabled) { return; } if (getOptionCompletion) { const completion = getOptionCompletion(option.value, filterValue); const isCompletionObject = obj => { return obj !== null && typeof obj === 'object' && 'action' in obj && obj.action !== undefined && 'value' in obj && obj.value !== undefined; }; const completionObject = isCompletionObject(completion) ? completion : { action: 'insert-at-caret', value: completion }; if ('replace' === completionObject.action) { onReplace([completionObject.value]); // When replacing, the component will unmount, so don't reset // state (below) on an unmounted component. return; } else if ('insert-at-caret' === completionObject.action) { insertCompletion(completionObject.value); } } // Reset autocomplete state after insertion rather than before // so insertion events don't cause the completion menu to redisplay. reset(); } function reset() { setSelectedIndex(0); setFilteredOptions(EMPTY_FILTERED_OPTIONS); setFilterValue(''); setAutocompleter(null); setAutocompleterUI(null); } /** * Load options for an autocompleter. * * @param {Array} options */ function onChangeOptions(options) { setSelectedIndex(options.length === filteredOptions.length ? selectedIndex : 0); setFilteredOptions(options); } function handleKeyDown(event) { backspacingRef.current = event.key === 'Backspace'; if (!autocompleter) { return; } if (filteredOptions.length === 0) { return; } if (event.defaultPrevented) { return; } switch (event.key) { case 'ArrowUp': { const newIndex = (selectedIndex === 0 ? filteredOptions.length : selectedIndex) - 1; setSelectedIndex(newIndex); // See the related PR as to why this is necessary: https://github.com/WordPress/gutenberg/pull/54902. if ((0,external_wp_keycodes_namespaceObject.isAppleOS)()) { (0,external_wp_a11y_namespaceObject.speak)(getNodeText(filteredOptions[newIndex].label), 'assertive'); } break; } case 'ArrowDown': { const newIndex = (selectedIndex + 1) % filteredOptions.length; setSelectedIndex(newIndex); if ((0,external_wp_keycodes_namespaceObject.isAppleOS)()) { (0,external_wp_a11y_namespaceObject.speak)(getNodeText(filteredOptions[newIndex].label), 'assertive'); } break; } case 'Escape': setAutocompleter(null); setAutocompleterUI(null); event.preventDefault(); break; case 'Enter': select(filteredOptions[selectedIndex]); break; case 'ArrowLeft': case 'ArrowRight': reset(); return; default: return; } // Any handled key should prevent original behavior. This relies on // the early return in the default case. event.preventDefault(); } // textContent is a primitive (string), memoizing is not strictly necessary // but this is a preemptive performance improvement, since the autocompleter // is a potential bottleneck for the editor type metric. const textContent = (0,external_wp_element_namespaceObject.useMemo)(() => { if ((0,external_wp_richText_namespaceObject.isCollapsed)(record)) { return (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(record, 0)); } return ''; }, [record]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!textContent) { if (autocompleter) { reset(); } return; } // Find the completer with the highest triggerPrefix index in the // textContent. const completer = completers.reduce((lastTrigger, currentCompleter) => { const triggerIndex = textContent.lastIndexOf(currentCompleter.triggerPrefix); const lastTriggerIndex = lastTrigger !== null ? textContent.lastIndexOf(lastTrigger.triggerPrefix) : -1; return triggerIndex > lastTriggerIndex ? currentCompleter : lastTrigger; }, null); if (!completer) { if (autocompleter) { reset(); } return; } const { allowContext, triggerPrefix } = completer; const triggerIndex = textContent.lastIndexOf(triggerPrefix); const textWithoutTrigger = textContent.slice(triggerIndex + triggerPrefix.length); const tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit. // This is a final barrier to prevent the effect from completing with // an extremely long string, which causes the editor to slow-down // significantly. This could happen, for example, if `matchingWhileBackspacing` // is true and one of the "words" end up being too long. If that's the case, // it will be caught by this guard. if (tooDistantFromTrigger) { return; } const mismatch = filteredOptions.length === 0; const wordsFromTrigger = textWithoutTrigger.split(/\s/); // We need to allow the effect to run when not backspacing and if there // was a mismatch. i.e when typing a trigger + the match string or when // clicking in an existing trigger word on the page. We do that if we // detect that we have one word from trigger in the current textual context. // // Ex.: "Some text @a" <-- "@a" will be detected as the trigger word and // allow the effect to run. It will run until there's a mismatch. const hasOneTriggerWord = wordsFromTrigger.length === 1; // This is used to allow the effect to run when backspacing and if // "touching" a word that "belongs" to a trigger. We consider a "trigger // word" any word up to the limit of 3 from the trigger character. // Anything beyond that is ignored if there's a mismatch. This allows // us to "escape" a mismatch when backspacing, but still imposing some // sane limits. // // Ex: "Some text @marcelo sekkkk" <--- "kkkk" caused a mismatch, but // if the user presses backspace here, it will show the completion popup again. const matchingWhileBackspacing = backspacingRef.current && wordsFromTrigger.length <= 3; if (mismatch && !(matchingWhileBackspacing || hasOneTriggerWord)) { if (autocompleter) { reset(); } return; } const textAfterSelection = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(record, undefined, (0,external_wp_richText_namespaceObject.getTextContent)(record).length)); if (allowContext && !allowContext(textContent.slice(0, triggerIndex), textAfterSelection)) { if (autocompleter) { reset(); } return; } if (/^\s/.test(textWithoutTrigger) || /\s\s+$/.test(textWithoutTrigger)) { if (autocompleter) { reset(); } return; } if (!/[\u0000-\uFFFF]*$/.test(textWithoutTrigger)) { if (autocompleter) { reset(); } return; } const safeTrigger = escapeRegExp(completer.triggerPrefix); const text = remove_accents_default()(textContent); const match = text.slice(text.lastIndexOf(completer.triggerPrefix)).match(new RegExp(`${safeTrigger}([\u0000-\uFFFF]*)$`)); const query = match && match[1]; setAutocompleter(completer); setAutocompleterUI(() => completer !== autocompleter ? getAutoCompleterUI(completer) : AutocompleterUI); setFilterValue(query === null ? '' : query); // We want to avoid introducing unexpected side effects. // See https://github.com/WordPress/gutenberg/pull/41820 }, [textContent]); const { key: selectedKey = '' } = filteredOptions[selectedIndex] || {}; const { className } = autocompleter || {}; const isExpanded = !!autocompleter && filteredOptions.length > 0; const listBoxId = isExpanded ? `components-autocomplete-listbox-${instanceId}` : undefined; const activeId = isExpanded ? `components-autocomplete-item-${instanceId}-${selectedKey}` : null; const hasSelection = record.start !== undefined; return { listBoxId, activeId, onKeyDown: withIgnoreIMEEvents(handleKeyDown), popover: hasSelection && AutocompleterUI && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AutocompleterUI, { className: className, filterValue: filterValue, instanceId: instanceId, listBoxId: listBoxId, selectedIndex: selectedIndex, onChangeOptions: onChangeOptions, onSelect: select, value: record, contentRef: contentRef, reset: reset }) }; } function useLastDifferentValue(value) { const history = (0,external_wp_element_namespaceObject.useRef)(new Set()); history.current.add(value); // Keep the history size to 2. if (history.current.size > 2) { history.current.delete(Array.from(history.current)[0]); } return Array.from(history.current)[0]; } function useAutocompleteProps(options) { const ref = (0,external_wp_element_namespaceObject.useRef)(null); const onKeyDownRef = (0,external_wp_element_namespaceObject.useRef)(); const { record } = options; const previousRecord = useLastDifferentValue(record); const { popover, listBoxId, activeId, onKeyDown } = useAutocomplete({ ...options, contentRef: ref }); onKeyDownRef.current = onKeyDown; const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_compose_namespaceObject.useRefEffect)(element => { function _onKeyDown(event) { onKeyDownRef.current?.(event); } element.addEventListener('keydown', _onKeyDown); return () => { element.removeEventListener('keydown', _onKeyDown); }; }, [])]); // We only want to show the popover if the user has typed something. const didUserInput = record.text !== previousRecord?.text; if (!didUserInput) { return { ref: mergedRefs }; } return { ref: mergedRefs, children: popover, 'aria-autocomplete': listBoxId ? 'list' : undefined, 'aria-owns': listBoxId, 'aria-activedescendant': activeId }; } function Autocomplete({ children, isSelected, ...options }) { const { popover, ...props } = useAutocomplete(options); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [children(props), isSelected && popover] }); } ;// ./node_modules/@wordpress/components/build-module/base-control/hooks.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Generate props for the `BaseControl` and the inner control itself. * * Namely, it takes care of generating a unique `id`, properly associating it with the `label` and `help` elements. * * @param props */ function useBaseControlProps(props) { const { help, id: preferredId, ...restProps } = props; const uniqueId = (0,external_wp_compose_namespaceObject.useInstanceId)(base_control, 'wp-components-base-control', preferredId); return { baseControlProps: { id: uniqueId, help, ...restProps }, controlProps: { id: uniqueId, ...(!!help ? { 'aria-describedby': `${uniqueId}__help` } : {}) } }; } ;// ./node_modules/@wordpress/icons/build-module/library/link.js /** * WordPress dependencies */ const link_link = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.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" }) }); /* harmony default export */ const library_link = (link_link); ;// ./node_modules/@wordpress/icons/build-module/library/link-off.js /** * WordPress dependencies */ const linkOff = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z" }) }); /* harmony default export */ const link_off = (linkOff); ;// ./node_modules/@wordpress/components/build-module/border-box-control/styles.js function border_box_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const borderBoxControl = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0); const linkedBorderControl = () => /*#__PURE__*/emotion_react_browser_esm_css("flex:1;", rtl({ marginRight: '24px' })(), ";" + ( true ? "" : 0), true ? "" : 0); const wrapper = true ? { name: "bjn8wh", styles: "position:relative" } : 0; const borderBoxControlLinkedButton = size => { return /*#__PURE__*/emotion_react_browser_esm_css("position:absolute;top:", size === '__unstable-large' ? '8px' : '3px', ";", rtl({ right: 0 })(), " line-height:0;" + ( true ? "" : 0), true ? "" : 0); }; const borderBoxStyleWithFallback = border => { const { color = COLORS.gray[200], style = 'solid', width = config_values.borderWidth } = border || {}; const clampedWidth = width !== config_values.borderWidth ? `clamp(1px, ${width}, 10px)` : width; const hasVisibleBorder = !!width && width !== '0' || !!color; const borderStyle = hasVisibleBorder ? style || 'solid' : style; return `${color} ${borderStyle} ${clampedWidth}`; }; const borderBoxControlVisualizer = (borders, size) => { return /*#__PURE__*/emotion_react_browser_esm_css("position:absolute;top:", size === '__unstable-large' ? '20px' : '15px', ";right:", size === '__unstable-large' ? '39px' : '29px', ";bottom:", size === '__unstable-large' ? '20px' : '15px', ";left:", size === '__unstable-large' ? '39px' : '29px', ";border-top:", borderBoxStyleWithFallback(borders?.top), ";border-bottom:", borderBoxStyleWithFallback(borders?.bottom), ";", rtl({ borderLeft: borderBoxStyleWithFallback(borders?.left) })(), " ", rtl({ borderRight: borderBoxStyleWithFallback(borders?.right) })(), ";" + ( true ? "" : 0), true ? "" : 0); }; const borderBoxControlSplitControls = size => /*#__PURE__*/emotion_react_browser_esm_css("position:relative;flex:1;width:", size === '__unstable-large' ? undefined : '80%', ";" + ( true ? "" : 0), true ? "" : 0); const centeredBorderControl = true ? { name: "1nwbfnf", styles: "grid-column:span 2;margin:0 auto" } : 0; const rightBorderControl = () => /*#__PURE__*/emotion_react_browser_esm_css(rtl({ marginLeft: 'auto' })(), ";" + ( true ? "" : 0), true ? "" : 0); ;// ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-linked-button/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useBorderBoxControlLinkedButton(props) { const { className, size = 'default', ...otherProps } = useContextSystem(props, 'BorderBoxControlLinkedButton'); // Generate class names. const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(borderBoxControlLinkedButton(size), className); }, [className, cx, size]); return { ...otherProps, className: classes }; } ;// ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-linked-button/component.js /** * WordPress dependencies */ /** * Internal dependencies */ const BorderBoxControlLinkedButton = (props, forwardedRef) => { const { className, isLinked, ...buttonProps } = useBorderBoxControlLinkedButton(props); const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink sides') : (0,external_wp_i18n_namespaceObject.__)('Link sides'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, { ...buttonProps, size: "small", icon: isLinked ? library_link : link_off, iconSize: 24, label: label, ref: forwardedRef, className: className }); }; const ConnectedBorderBoxControlLinkedButton = contextConnect(BorderBoxControlLinkedButton, 'BorderBoxControlLinkedButton'); /* harmony default export */ const border_box_control_linked_button_component = (ConnectedBorderBoxControlLinkedButton); ;// ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-visualizer/hook.js /** * WordPress dependencies */ /** * Internal dependencies */ function useBorderBoxControlVisualizer(props) { const { className, value, size = 'default', ...otherProps } = useContextSystem(props, 'BorderBoxControlVisualizer'); // Generate class names. const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => { return cx(borderBoxControlVisualizer(value, size), className); }, [cx, className, value, size]); return { ...otherProps, className: classes, value }; } ;// ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-visualizer/component.js /** * Internal dependencies */ const BorderBoxControlVisualizer = (props, forwardedRef) => { const { value, ...otherProps } = useBorderBoxControlVisualizer(props); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { ...otherProps, ref: forwardedRef }); }; const ConnectedBorderBoxControlVisualizer = contextConnect(BorderBoxControlVisualizer, 'BorderBoxControlVisualizer'); /* harmony default export */ const border_box_control_visualizer_component = (ConnectedBorderBoxControlVisualizer); ;// ./node_modules/@wordpress/icons/build-module/library/line-solid.js /** * WordPress dependencies */ const lineSolid = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5 11.25h14v1.5H5z" }) }); /* harmony default export */ const line_solid = (lineSolid); ;// ./node_modules/@wordpress/icons/build-module/library/line-dashed.js /** * WordPress dependencies */ const lineDashed = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", d: "M5 11.25h3v1.5H5v-1.5zm5.5 0h3v1.5h-3v-1.5zm8.5 0h-3v1.5h3v-1.5z", clipRule: "evenodd" }) }); /* harmony default export */ const line_dashed = (lineDashed); ;// ./node_modules/@wordpress/icons/build-module/library/line-dotted.js /** * WordPress dependencies */ const lineDotted = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", d: "M5.25 11.25h1.5v1.5h-1.5v-1.5zm3 0h1.5v1.5h-1.5v-1.5zm4.5 0h-1.5v1.5h1.5v-1.5zm1.5 0h1.5v1.5h-1.5v-1.5zm4.5 0h-1.5v1.5h1.5v-1.5z", clipRule: "evenodd" }) }); /* harmony default export */ const line_dotted = (lineDotted); ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/styles.js function toggle_group_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const toggleGroupControl = ({ isBlock, isDeselectable, size }) => /*#__PURE__*/emotion_react_browser_esm_css("background:", COLORS.ui.background, ";border:1px solid transparent;border-radius:", config_values.radiusSmall, ";display:inline-flex;min-width:0;position:relative;", toggleGroupControlSize(size), " ", !isDeselectable && enclosingBorders(isBlock), "@media not ( prefers-reduced-motion ){&[data-indicator-animated]::before{transition-property:transform,border-radius;transition-duration:0.2s;transition-timing-function:ease-out;}}&::before{content:'';position:absolute;pointer-events:none;background:", COLORS.theme.foreground, ";outline:2px solid transparent;outline-offset:-3px;--antialiasing-factor:100;border-radius:calc(\n\t\t\t\t", config_values.radiusXSmall, " /\n\t\t\t\t\t(\n\t\t\t\t\t\tvar( --selected-width, 0 ) /\n\t\t\t\t\t\t\tvar( --antialiasing-factor )\n\t\t\t\t\t)\n\t\t\t)/", config_values.radiusXSmall, ";left:-1px;width:calc( var( --antialiasing-factor ) * 1px );height:calc( var( --selected-height, 0 ) * 1px );transform-origin:left top;transform:translateX( calc( var( --selected-left, 0 ) * 1px ) ) scaleX(\n\t\t\t\tcalc(\n\t\t\t\t\tvar( --selected-width, 0 ) / var( --antialiasing-factor )\n\t\t\t\t)\n\t\t\t);}" + ( true ? "" : 0), true ? "" : 0); const enclosingBorders = isBlock => { const enclosingBorder = /*#__PURE__*/emotion_react_browser_esm_css("border-color:", COLORS.ui.border, ";" + ( true ? "" : 0), true ? "" : 0); return /*#__PURE__*/emotion_react_browser_esm_css(isBlock && enclosingBorder, " &:hover{border-color:", COLORS.ui.borderHover, ";}&:focus-within{border-color:", COLORS.ui.borderFocus, ";box-shadow:", config_values.controlBoxShadowFocus, ";z-index:1;outline:2px solid transparent;outline-offset:-2px;}" + ( true ? "" : 0), true ? "" : 0); }; var styles_ref = true ? { name: "1aqh2c7", styles: "min-height:40px;padding:3px" } : 0; var _ref2 = true ? { name: "1ndywgm", styles: "min-height:36px;padding:2px" } : 0; const toggleGroupControlSize = size => { const styles = { default: _ref2, '__unstable-large': styles_ref }; return styles[size]; }; const toggle_group_control_styles_block = true ? { name: "7whenc", styles: "display:flex;width:100%" } : 0; const VisualLabelWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "eakva830" } : 0)( true ? { name: "zjik7", styles: "display:flex" } : 0); ;// ./node_modules/@ariakit/core/esm/radio/radio-store.js "use client"; // src/radio/radio-store.ts function createRadioStore(_a = {}) { var props = _3YLGPPWQ_objRest(_a, []); var _a2; const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState(); const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true) })); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), { value: defaultValue( props.value, syncState == null ? void 0 : syncState.value, props.defaultValue, null ) }); const radio = createStore(initialState, composite, props.store); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite), radio), { setValue: (value) => radio.setState("value", value) }); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/4BXJGRNH.js "use client"; // src/radio/radio-store.ts function useRadioStoreProps(store, update, props) { store = useCompositeStoreProps(store, update, props); useStoreProps(store, props, "value", "setValue"); return store; } function useRadioStore(props = {}) { const [store, update] = YV4JVR4I_useStore(createRadioStore, props); return useRadioStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/UVUMR3WP.js "use client"; // src/radio/radio-context.tsx var UVUMR3WP_ctx = createStoreContext( [CompositeContextProvider], [CompositeScopedContextProvider] ); var useRadioContext = UVUMR3WP_ctx.useContext; var useRadioScopedContext = UVUMR3WP_ctx.useScopedContext; var useRadioProviderContext = UVUMR3WP_ctx.useProviderContext; var RadioContextProvider = UVUMR3WP_ctx.ContextProvider; var RadioScopedContextProvider = UVUMR3WP_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/radio/radio-group.js "use client"; // src/radio/radio-group.tsx var radio_group_TagName = "div"; var useRadioGroup = createHook( function useRadioGroup2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = useRadioProviderContext(); store = store || context; invariant( store, false && 0 ); props = useWrapElement( props, (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RadioScopedContextProvider, { value: store, children: element }), [store] ); props = _3YLGPPWQ_spreadValues({ role: "radiogroup" }, props); props = useComposite(_3YLGPPWQ_spreadValues({ store }, props)); return props; } ); var RadioGroup = forwardRef2(function RadioGroup2(props) { const htmlProps = useRadioGroup(props); return LMDWO4NN_createElement(radio_group_TagName, htmlProps); }); ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const ToggleGroupControlContext = (0,external_wp_element_namespaceObject.createContext)({}); const useToggleGroupControlContext = () => (0,external_wp_element_namespaceObject.useContext)(ToggleGroupControlContext); /* harmony default export */ const toggle_group_control_context = (ToggleGroupControlContext); ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/utils.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Used to determine, via an internal heuristics, whether an `undefined` value * received for the `value` prop should be interpreted as the component being * used in uncontrolled mode, or as an "empty" value for controlled mode. * * @param valueProp The received `value` */ function useComputeControlledOrUncontrolledValue(valueProp) { const isInitialRenderRef = (0,external_wp_element_namespaceObject.useRef)(true); const prevValueProp = (0,external_wp_compose_namespaceObject.usePrevious)(valueProp); const prevIsControlledRef = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isInitialRenderRef.current) { isInitialRenderRef.current = false; } }, []); // Assume the component is being used in controlled mode on the first re-render // that has a different `valueProp` from the previous render. const isControlled = prevIsControlledRef.current || !isInitialRenderRef.current && prevValueProp !== valueProp; (0,external_wp_element_namespaceObject.useEffect)(() => { prevIsControlledRef.current = isControlled; }, [isControlled]); if (isControlled) { // When in controlled mode, use `''` instead of `undefined` return { value: valueProp !== null && valueProp !== void 0 ? valueProp : '', defaultValue: undefined }; } // When in uncontrolled mode, the `value` should be intended as the initial value return { value: undefined, defaultValue: valueProp }; } ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/as-radio-group.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedToggleGroupControlAsRadioGroup({ children, isAdaptiveWidth, label, onChange: onChangeProp, size, value: valueProp, id: idProp, setSelectedElement, ...otherProps }, forwardedRef) { const generatedId = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleGroupControlAsRadioGroup, 'toggle-group-control-as-radio-group'); const baseId = idProp || generatedId; // Use a heuristic to understand if the component is being used in controlled // or uncontrolled mode, and consequently: // - when controlled, convert `undefined` values to `''` (ie. "no value") // - use the `value` prop as the `defaultValue` when uncontrolled const { value, defaultValue } = useComputeControlledOrUncontrolledValue(valueProp); // `useRadioStore`'s `setValue` prop can be called with `null`, while // the component's `onChange` prop only expects `undefined` const wrappedOnChangeProp = onChangeProp ? v => { onChangeProp(v !== null && v !== void 0 ? v : undefined); } : undefined; const radio = useRadioStore({ defaultValue, value, setValue: wrappedOnChangeProp, rtl: (0,external_wp_i18n_namespaceObject.isRTL)() }); const selectedValue = useStoreState(radio, 'value'); const setValue = radio.setValue; // Ensures that the active id is also reset after the value is "reset" by the consumer. (0,external_wp_element_namespaceObject.useEffect)(() => { if (selectedValue === '') { radio.setActiveId(undefined); } }, [radio, selectedValue]); const groupContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ activeItemIsNotFirstItem: () => radio.getState().activeId !== radio.first(), baseId, isBlock: !isAdaptiveWidth, size, // @ts-expect-error - This is wrong and we should fix it. value: selectedValue, // @ts-expect-error - This is wrong and we should fix it. setValue, setSelectedElement }), [baseId, isAdaptiveWidth, radio, selectedValue, setSelectedElement, setValue, size]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_context.Provider, { value: groupContextValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RadioGroup, { store: radio, "aria-label": label, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, {}), ...otherProps, id: baseId, ref: forwardedRef, children: children }) }); } const ToggleGroupControlAsRadioGroup = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlAsRadioGroup); ;// ./node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-value.js /** * WordPress dependencies */ /** * Simplified and improved implementation of useControlledState. * * @param props * @param props.defaultValue * @param props.value * @param props.onChange * @return The controlled value and the value setter. */ function useControlledValue({ defaultValue, onChange, value: valueProp }) { const hasValue = typeof valueProp !== 'undefined'; const initialValue = hasValue ? valueProp : defaultValue; const [state, setState] = (0,external_wp_element_namespaceObject.useState)(initialValue); const value = hasValue ? valueProp : state; let setValue; if (hasValue && typeof onChange === 'function') { setValue = onChange; } else if (!hasValue && typeof onChange === 'function') { setValue = nextValue => { onChange(nextValue); setState(nextValue); }; } else { setValue = setState; } return [value, setValue]; } ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/as-button-group.js /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedToggleGroupControlAsButtonGroup({ children, isAdaptiveWidth, label, onChange, size, value: valueProp, id: idProp, setSelectedElement, ...otherProps }, forwardedRef) { const generatedId = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleGroupControlAsButtonGroup, 'toggle-group-control-as-button-group'); const baseId = idProp || generatedId; // Use a heuristic to understand if the component is being used in controlled // or uncontrolled mode, and consequently: // - when controlled, convert `undefined` values to `''` (ie. "no value") // - use the `value` prop as the `defaultValue` when uncontrolled const { value, defaultValue } = useComputeControlledOrUncontrolledValue(valueProp); const [selectedValue, setSelectedValue] = useControlledValue({ defaultValue, value, onChange }); const groupContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ baseId, value: selectedValue, setValue: setSelectedValue, isBlock: !isAdaptiveWidth, isDeselectable: true, size, setSelectedElement }), [baseId, selectedValue, setSelectedValue, isAdaptiveWidth, size, setSelectedElement]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_context.Provider, { value: groupContextValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, { "aria-label": label, ...otherProps, ref: forwardedRef, role: "group", children: children }) }); } const ToggleGroupControlAsButtonGroup = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlAsButtonGroup); ;// ./node_modules/@wordpress/components/build-module/utils/element-rect.js /* eslint-disable jsdoc/require-param */ /** * WordPress dependencies */ /** * The position and dimensions of an element, relative to its offset parent. */ /** * An `ElementOffsetRect` object with all values set to zero. */ const NULL_ELEMENT_OFFSET_RECT = { element: undefined, top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; /** * Returns the position and dimensions of an element, relative to its offset * parent, with subpixel precision. Values reflect the real measures before any * potential scaling distortions along the X and Y axes. * * Useful in contexts where plain `getBoundingClientRect` calls or `ResizeObserver` * entries are not suitable, such as when the element is transformed, and when * `element.offset` methods are not precise enough. * * **Note:** in some contexts, like when the scale is 0, this method will fail * because it's impossible to calculate a scaling ratio. When that happens, it * will return `undefined`. */ function getElementOffsetRect(element) { var _offsetParent$getBoun, _offsetParent$scrollL, _offsetParent$scrollT; // Position and dimension values computed with `getBoundingClientRect` have // subpixel precision, but are affected by distortions since they represent // the "real" measures, or in other words, the actual final values as rendered // by the browser. const rect = element.getBoundingClientRect(); if (rect.width === 0 || rect.height === 0) { return; } const offsetParent = element.offsetParent; const offsetParentRect = (_offsetParent$getBoun = offsetParent?.getBoundingClientRect()) !== null && _offsetParent$getBoun !== void 0 ? _offsetParent$getBoun : NULL_ELEMENT_OFFSET_RECT; const offsetParentScrollX = (_offsetParent$scrollL = offsetParent?.scrollLeft) !== null && _offsetParent$scrollL !== void 0 ? _offsetParent$scrollL : 0; const offsetParentScrollY = (_offsetParent$scrollT = offsetParent?.scrollTop) !== null && _offsetParent$scrollT !== void 0 ? _offsetParent$scrollT : 0; // Computed widths and heights have subpixel precision, and are not affected // by distortions. const computedWidth = parseFloat(getComputedStyle(element).width); const computedHeight = parseFloat(getComputedStyle(element).height); // We can obtain the current scale factor for the element by comparing "computed" // dimensions with the "real" ones. const scaleX = computedWidth / rect.width; const scaleY = computedHeight / rect.height; return { element, // To obtain the adjusted values for the position: // 1. Compute the element's position relative to the offset parent. // 2. Correct for the scale factor. // 3. Adjust for the scroll position of the offset parent. top: (rect.top - offsetParentRect?.top) * scaleY + offsetParentScrollY, right: (offsetParentRect?.right - rect.right) * scaleX - offsetParentScrollX, bottom: (offsetParentRect?.bottom - rect.bottom) * scaleY - offsetParentScrollY, left: (rect.left - offsetParentRect?.left) * scaleX + offsetParentScrollX, // Computed dimensions don't need any adjustments. width: computedWidth, height: computedHeight }; } const POLL_RATE = 100; /** * Tracks the position and dimensions of an element, relative to its offset * parent. The element can be changed dynamically. * * When no element is provided (`null` or `undefined`), the hook will return * a "null" rect, in which all values are `0` and `element` is `undefined`. * * **Note:** sometimes, the measurement will fail (see `getElementOffsetRect`'s * documentation for more details). When that happens, this hook will attempt * to measure again after a frame, and if that fails, it will poll every 100 * milliseconds until it succeeds. */ function useTrackElementOffsetRect(targetElement, deps = []) { const [indicatorPosition, setIndicatorPosition] = (0,external_wp_element_namespaceObject.useState)(NULL_ELEMENT_OFFSET_RECT); const intervalRef = (0,external_wp_element_namespaceObject.useRef)(); const measure = (0,external_wp_compose_namespaceObject.useEvent)(() => { // Check that the targetElement is still attached to the DOM, in case // it was removed since the last `measure` call. if (targetElement && targetElement.isConnected) { const elementOffsetRect = getElementOffsetRect(targetElement); if (elementOffsetRect) { setIndicatorPosition(elementOffsetRect); clearInterval(intervalRef.current); return true; } } else { clearInterval(intervalRef.current); } return false; }); const setElement = (0,external_wp_compose_namespaceObject.useResizeObserver)(() => { if (!measure()) { requestAnimationFrame(() => { if (!measure()) { intervalRef.current = setInterval(measure, POLL_RATE); } }); } }); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { setElement(targetElement); if (!targetElement) { setIndicatorPosition(NULL_ELEMENT_OFFSET_RECT); } }, [setElement, targetElement]); // Escape hatch to force a remeasurement when something else changes rather // than the target elements' ref or size (for example, the target element // can change its position within the tablist). (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { measure(); // `measure` is a stable function, so it's safe to omit it from the deps array. // deps can't be statically analyzed by ESLint }, deps); return indicatorPosition; } /* eslint-enable jsdoc/require-param */ ;// ./node_modules/@wordpress/components/build-module/utils/hooks/use-on-value-update.js /* eslint-disable jsdoc/require-param */ /** * WordPress dependencies */ /** * Context object for the `onUpdate` callback of `useOnValueUpdate`. */ /** * Calls the `onUpdate` callback when the `value` changes. */ function useOnValueUpdate( /** * The value to watch for changes. */ value, /** * Callback to fire when the value changes. */ onUpdate) { const previousValueRef = (0,external_wp_element_namespaceObject.useRef)(value); const updateCallbackEvent = (0,external_wp_compose_namespaceObject.useEvent)(onUpdate); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (previousValueRef.current !== value) { updateCallbackEvent({ previousValue: previousValueRef.current }); previousValueRef.current = value; } }, [updateCallbackEvent, value]); } /* eslint-enable jsdoc/require-param */ ;// ./node_modules/@wordpress/components/build-module/utils/hooks/use-animated-offset-rect.js /* eslint-disable jsdoc/require-param */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * A utility used to animate something in a container component based on the "offset * rect" (position relative to the container and size) of a subelement. For example, * this is useful to render an indicator for the selected option of a component, and * to animate it when the selected option changes. * * Takes in a container element and the up-to-date "offset rect" of the target * subelement, obtained with `useTrackElementOffsetRect`. Then it does the following: * * - Adds CSS variables with rect information to the container, so that the indicator * can be rendered and animated with them. These are kept up-to-date, enabling CSS * transitions on change. * - Sets an attribute (`data-subelement-animated` by default) when the tracked * element changes, so that the target (e.g. the indicator) can be animated to its * new size and position. * - Removes the attribute when the animation is done. * * The need for the attribute is due to the fact that the rect might update in * situations other than when the tracked element changes, e.g. the tracked element * might be resized. In such cases, there is no need to animate the indicator, and * the change in size or position of the indicator needs to be reflected immediately. */ function useAnimatedOffsetRect( /** * The container element. */ container, /** * The rect of the tracked element. */ rect, { prefix = 'subelement', dataAttribute = `${prefix}-animated`, transitionEndFilter = () => true, roundRect = false } = {}) { const setProperties = (0,external_wp_compose_namespaceObject.useEvent)(() => { Object.keys(rect).forEach(property => property !== 'element' && container?.style.setProperty(`--${prefix}-${property}`, String(roundRect ? Math.floor(rect[property]) : rect[property]))); }); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { setProperties(); }, [rect, setProperties]); useOnValueUpdate(rect.element, ({ previousValue }) => { // Only enable the animation when moving from one element to another. if (rect.element && previousValue) { container?.setAttribute(`data-${dataAttribute}`, ''); } }); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { function onTransitionEnd(event) { if (transitionEndFilter(event)) { container?.removeAttribute(`data-${dataAttribute}`); } } container?.addEventListener('transitionend', onTransitionEnd); return () => container?.removeEventListener('transitionend', onTransitionEnd); }, [dataAttribute, container, transitionEndFilter]); } /* eslint-enable jsdoc/require-param */ ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnconnectedToggleGroupControl(props, forwardedRef) { const { __nextHasNoMarginBottom = false, __next40pxDefaultSize = false, __shouldNotWarnDeprecated36pxSize, className, isAdaptiveWidth = false, isBlock = false, isDeselectable = false, label, hideLabelFromVision = false, help, onChange, size = 'default', value, children, ...otherProps } = useContextSystem(props, 'ToggleGroupControl'); const normalizedSize = __next40pxDefaultSize && size === 'default' ? '__unstable-large' : size; const [selectedElement, setSelectedElement] = (0,external_wp_element_namespaceObject.useState)(); const [controlElement, setControlElement] = (0,external_wp_element_namespaceObject.useState)(); const refs = (0,external_wp_compose_namespaceObject.useMergeRefs)([setControlElement, forwardedRef]); const selectedRect = useTrackElementOffsetRect(value !== null && value !== undefined ? selectedElement : undefined); useAnimatedOffsetRect(controlElement, selectedRect, { prefix: 'selected', dataAttribute: 'indicator-animated', transitionEndFilter: event => event.pseudoElement === '::before', roundRect: true }); const cx = useCx(); const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(toggleGroupControl({ isBlock, isDeselectable, size: normalizedSize }), isBlock && toggle_group_control_styles_block, className), [className, cx, isBlock, isDeselectable, normalizedSize]); const MainControl = isDeselectable ? ToggleGroupControlAsButtonGroup : ToggleGroupControlAsRadioGroup; maybeWarnDeprecated36pxSize({ componentName: 'ToggleGroupControl', size, __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(base_control, { help: help, __nextHasNoMarginBottom: __nextHasNoMarginBottom, __associatedWPComponentName: "ToggleGroupControl", children: [!hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(VisualLabelWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control.VisualLabel, { children: label }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MainControl, { ...otherProps, setSelectedElement: setSelectedElement, className: classes, isAdaptiveWidth: isAdaptiveWidth, label: label, onChange: onChange, ref: refs, size: normalizedSize, value: value, children: children })] }); } /** * `ToggleGroupControl` is a form component that lets users choose options * represented in horizontal segments. To render options for this control use * `ToggleGroupControlOption` component. * * This component is intended for selecting a single persistent value from a set of options, * similar to a how a radio button group would work. If you simply want a toggle to switch between views, * use a `TabPanel` instead. * * Only use this control when you know for sure the labels of items inside won't * wrap. For items with longer labels, you can consider a `SelectControl` or a * `CustomSelectControl` component instead. * * ```jsx * import { * __experimentalToggleGroupControl as ToggleGroupControl, * __experimentalToggleGroupControlOption as ToggleGroupControlOption, * } from '@wordpress/components'; * * function Example() { * return ( * * * * * ); * } * ``` */ const ToggleGroupControl = contextConnect(UnconnectedToggleGroupControl, 'ToggleGroupControl'); /* harmony default export */ const toggle_group_control_component = (ToggleGroupControl); ;// ./node_modules/@ariakit/react-core/esm/__chunks/NLEBE274.js "use client"; // src/radio/radio.tsx var NLEBE274_TagName = "input"; function getIsChecked(value, storeValue) { if (storeValue === void 0) return; if (value != null && storeValue != null) { return storeValue === value; } return !!storeValue; } function isNativeRadio(tagName, type) { return tagName === "input" && (!type || type === "radio"); } var useRadio = createHook(function useRadio2(_a) { var _b = _a, { store, name, value, checked } = _b, props = __objRest(_b, [ "store", "name", "value", "checked" ]); const context = useRadioContext(); store = store || context; const id = useId(props.id); const ref = (0,external_React_.useRef)(null); const isChecked = useStoreState( store, (state) => checked != null ? checked : getIsChecked(value, state == null ? void 0 : state.value) ); (0,external_React_.useEffect)(() => { if (!id) return; if (!isChecked) return; const isActiveItem = (store == null ? void 0 : store.getState().activeId) === id; if (isActiveItem) return; store == null ? void 0 : store.setActiveId(id); }, [store, isChecked, id]); const onChangeProp = props.onChange; const tagName = useTagName(ref, NLEBE274_TagName); const nativeRadio = isNativeRadio(tagName, props.type); const disabled = disabledFromProps(props); const [propertyUpdated, schedulePropertyUpdate] = useForceUpdate(); (0,external_React_.useEffect)(() => { const element = ref.current; if (!element) return; if (nativeRadio) return; if (isChecked !== void 0) { element.checked = isChecked; } if (name !== void 0) { element.name = name; } if (value !== void 0) { element.value = `${value}`; } }, [propertyUpdated, nativeRadio, isChecked, name, value]); const onChange = useEvent((event) => { if (disabled) { event.preventDefault(); event.stopPropagation(); return; } if ((store == null ? void 0 : store.getState().value) === value) return; if (!nativeRadio) { event.currentTarget.checked = true; schedulePropertyUpdate(); } onChangeProp == null ? void 0 : onChangeProp(event); if (event.defaultPrevented) return; store == null ? void 0 : store.setValue(value); }); const onClickProp = props.onClick; const onClick = useEvent((event) => { onClickProp == null ? void 0 : onClickProp(event); if (event.defaultPrevented) return; if (nativeRadio) return; onChange(event); }); const onFocusProp = props.onFocus; const onFocus = useEvent((event) => { onFocusProp == null ? void 0 : onFocusProp(event); if (event.defaultPrevented) return; if (!nativeRadio) return; if (!store) return; const { moves, activeId } = store.getState(); if (!moves) return; if (id && activeId !== id) return; onChange(event); }); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ id, role: !nativeRadio ? "radio" : void 0, type: nativeRadio ? "radio" : void 0, "aria-checked": isChecked }, props), { ref: useMergeRefs(ref, props.ref), onChange, onClick, onFocus }); props = useCompositeItem(_3YLGPPWQ_spreadValues({ store, clickOnEnter: !nativeRadio }, props)); return removeUndefinedValues(_3YLGPPWQ_spreadValues({ name: nativeRadio ? name : void 0, value: nativeRadio ? value : void 0, checked: isChecked }, props)); }); var Radio = memo2( forwardRef2(function Radio2(props) { const htmlProps = useRadio(props); return LMDWO4NN_createElement(NLEBE274_TagName, htmlProps); }) ); ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/styles.js function toggle_group_control_option_base_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const LabelView = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "et6ln9s1" } : 0)( true ? { name: "sln1fl", styles: "display:inline-flex;max-width:100%;min-width:0;position:relative" } : 0); const labelBlock = true ? { name: "82a6rk", styles: "flex:1" } : 0; const buttonView = ({ isDeselectable, isIcon, isPressed, size }) => /*#__PURE__*/emotion_react_browser_esm_css("align-items:center;appearance:none;background:transparent;border:none;border-radius:", config_values.radiusXSmall, ";color:", COLORS.theme.gray[700], ";fill:currentColor;cursor:pointer;display:flex;font-family:inherit;height:100%;justify-content:center;line-height:100%;outline:none;padding:0 12px;position:relative;text-align:center;@media not ( prefers-reduced-motion ){transition:background ", config_values.transitionDurationFast, " linear,color ", config_values.transitionDurationFast, " linear,font-weight 60ms linear;}user-select:none;width:100%;z-index:2;&::-moz-focus-inner{border:0;}&[disabled]{opacity:0.4;cursor:default;}&:active{background:", COLORS.ui.background, ";}", isDeselectable && deselectable, " ", isIcon && isIconStyles({ size }), " ", isPressed && pressed, ";" + ( true ? "" : 0), true ? "" : 0); const pressed = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.theme.foregroundInverted, ";&:active{background:transparent;}" + ( true ? "" : 0), true ? "" : 0); const deselectable = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.theme.foreground, ";&:focus{box-shadow:inset 0 0 0 1px ", COLORS.ui.background, ",0 0 0 ", config_values.borderWidthFocus, " ", COLORS.theme.accent, ";outline:2px solid transparent;}" + ( true ? "" : 0), true ? "" : 0); const ButtonContentView = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "et6ln9s0" } : 0)("display:flex;font-size:", config_values.fontSize, ";line-height:1;" + ( true ? "" : 0)); const isIconStyles = ({ size = 'default' }) => { const iconButtonSizes = { default: '30px', '__unstable-large': '32px' }; return /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.theme.foreground, ";height:", iconButtonSizes[size], ";aspect-ratio:1;padding-left:0;padding-right:0;" + ( true ? "" : 0), true ? "" : 0); }; ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { /* ButtonContentView */ "Rp": component_ButtonContentView, /* LabelView */ "y0": component_LabelView } = toggle_group_control_option_base_styles_namespaceObject; const WithToolTip = ({ showTooltip, text, children }) => { if (showTooltip && text) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tooltip, { text: text, placement: "top", children: children }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: children }); }; function ToggleGroupControlOptionBase(props, forwardedRef) { const toggleGroupControlContext = useToggleGroupControlContext(); const id = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleGroupControlOptionBase, toggleGroupControlContext.baseId || 'toggle-group-control-option-base'); const buttonProps = useContextSystem({ ...props, id }, 'ToggleGroupControlOptionBase'); const { isBlock = false, isDeselectable = false, size = 'default' } = toggleGroupControlContext; const { className, isIcon = false, value, children, showTooltip = false, disabled, ...otherButtonProps } = buttonProps; const isPressed = toggleGroupControlContext.value === value; const cx = useCx(); const labelViewClasses = (0,external_wp_element_namespaceObject.useMemo)(() => cx(isBlock && labelBlock), [cx, isBlock]); const itemClasses = (0,external_wp_element_namespaceObject.useMemo)(() => cx(buttonView({ isDeselectable, isIcon, isPressed, size }), className), [cx, isDeselectable, isIcon, isPressed, size, className]); const buttonOnClick = () => { if (isDeselectable && isPressed) { toggleGroupControlContext.setValue(undefined); } else { toggleGroupControlContext.setValue(value); } }; const commonProps = { ...otherButtonProps, className: itemClasses, 'data-value': value, ref: forwardedRef }; const labelRef = (0,external_wp_element_namespaceObject.useRef)(null); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (isPressed && labelRef.current) { toggleGroupControlContext.setSelectedElement(labelRef.current); } }, [isPressed, toggleGroupControlContext]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component_LabelView, { ref: labelRef, className: labelViewClasses, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WithToolTip, { showTooltip: showTooltip, text: otherButtonProps['aria-label'], children: isDeselectable ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { ...commonProps, disabled: disabled, "aria-pressed": isPressed, type: "button", onClick: buttonOnClick, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component_ButtonContentView, { children: children }) }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Radio, { disabled: disabled, onFocusVisible: () => { const selectedValueIsEmpty = toggleGroupControlContext.value === null || toggleGroupControlContext.value === ''; // Conditions ensure that the first visible focus to a radio group // without a selected option will not automatically select the option. if (!selectedValueIsEmpty || toggleGroupControlContext.activeItemIsNotFirstItem?.()) { toggleGroupControlContext.setValue(value); } }, render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { type: "button", ...commonProps }), value: value, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component_ButtonContentView, { children: children }) }) }) }); } /** * `ToggleGroupControlOptionBase` is a form component and is meant to be used as an internal, * generic component for any children of `ToggleGroupControl`. * * @example * ```jsx * import { * __experimentalToggleGroupControl as ToggleGroupControl, * __experimentalToggleGroupControlOptionBase as ToggleGroupControlOptionBase, * } from '@wordpress/components'; * * function Example() { * return ( * * * * * ); * } * ``` */ const ConnectedToggleGroupControlOptionBase = contextConnect(ToggleGroupControlOptionBase, 'ToggleGroupControlOptionBase'); /* harmony default export */ const toggle_group_control_option_base_component = (ConnectedToggleGroupControlOptionBase); ;// ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-icon/component.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedToggleGroupControlOptionIcon(props, ref) { const { icon, label, ...restProps } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_option_base_component, { ...restProps, isIcon: true, "aria-label": label, showTooltip: true, ref: ref, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: icon }) }); } /** * `ToggleGroupControlOptionIcon` is a form component which is meant to be used as a * child of `ToggleGroupControl` and displays an icon. * * ```jsx * * import { * __experimentalToggleGroupControl as ToggleGroupControl, * __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, * from '@wordpress/components'; * import { formatLowercase, formatUppercase } from '@wordpress/icons'; * * function Example() { * return ( * * * * * ); * } * ``` */ const ToggleGroupControlOptionIcon = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlOptionIcon); /* harmony default export */ const toggle_group_control_option_icon_component = (ToggleGroupControlOptionIcon); ;// ./node_modules/@wordpress/components/build-module/border-control/border-control-style-picker/component.js /** * WordPress dependencies */ /** * Internal dependencies */ const BORDER_STYLES = [{ label: (0,external_wp_i18n_namespaceObject.__)('Solid'), icon: line_solid, value: 'solid' }, { label: (0,external_wp_i18n_namespaceObject.__)('Dashed'), icon: line_dashed, value: 'dashed' }, { label: (0,external_wp_i18n_namespaceObject.__)('Dotted'), icon: line_dotted, value: 'dotted' }]; function UnconnectedBorderControlStylePicker({ onChange, ...restProps }, forwardedRef) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_component, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, ref: forwardedRef, isDeselectable: true, onChange: value => { onChange?.(value); }, ...restProps, children: BORDER_STYLES.map(borderStyle => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_group_control_option_icon_component, { value: borderStyle.value, icon: borderStyle.icon, label: borderStyle.label }, borderStyle.value)) }); } const BorderControlStylePicker = contextConnect(UnconnectedBorderControlStylePicker, 'BorderControlStylePicker'); /* harmony default export */ const border_control_style_picker_component = (BorderControlStylePicker); ;// ./node_modules/@wordpress/components/build-module/color-indicator/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function UnforwardedColorIndicator(props, forwardedRef) { const { className, colorValue, ...additionalProps } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: dist_clsx('component-color-indicator', className), style: { background: colorValue }, ref: forwardedRef, ...additionalProps }); } /** * ColorIndicator is a React component that renders a specific color in a * circle. It's often used to summarize a collection of used colors in a child * component. * * ```jsx * import { ColorIndicator } from '@wordpress/components'; * * const MyColorIndicator = () => ; * ``` */ const ColorIndicator = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedColorIndicator); /* harmony default export */ const color_indicator = (ColorIndicator); ;// ./node_modules/colord/plugins/a11y.mjs var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} ;// ./node_modules/@wordpress/components/build-module/dropdown/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const UnconnectedDropdown = (props, forwardedRef) => { const { renderContent, renderToggle, className, contentClassName, expandOnMobile, headerTitle, focusOnMount, popoverProps, onClose, onToggle, style, open, defaultOpen, // Deprecated props position, // From context system variant } = useContextSystem(props, 'Dropdown'); if (position !== undefined) { external_wp_deprecated_default()('`position` prop in wp.components.Dropdown', { since: '6.2', alternative: '`popoverProps.placement` prop', hint: 'Note that the `position` prop will override any values passed through the `popoverProps.placement` prop.' }); } // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [fallbackPopoverAnchor, setFallbackPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const containerRef = (0,external_wp_element_namespaceObject.useRef)(); const [isOpen, setIsOpen] = useControlledValue({ defaultValue: defaultOpen, value: open, onChange: onToggle }); /** * Closes the popover when focus leaves it unless the toggle was pressed or * focus has moved to a separate dialog. The former is to let the toggle * handle closing the popover and the latter is to preserve presence in * case a dialog has opened, allowing focus to return when it's dismissed. */ function closeIfFocusOutside() { if (!containerRef.current) { return; } const { ownerDocument } = containerRef.current; const dialog = ownerDocument?.activeElement?.closest('[role="dialog"]'); if (!containerRef.current.contains(ownerDocument.activeElement) && (!dialog || dialog.contains(containerRef.current))) { close(); } } function close() { onClose?.(); setIsOpen(false); } const args = { isOpen: !!isOpen, onToggle: () => setIsOpen(!isOpen), onClose: close }; const popoverPropsHaveAnchor = !!popoverProps?.anchor || // Note: `anchorRef`, `getAnchorRect` and `anchorRect` are deprecated and // be removed from `Popover` from WordPress 6.3 !!popoverProps?.anchorRef || !!popoverProps?.getAnchorRect || !!popoverProps?.anchorRect; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: className, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([containerRef, forwardedRef, setFallbackPopoverAnchor]) // Some UAs focus the closest focusable parent when the toggle is // clicked. Making this div focusable ensures such UAs will focus // it and `closeIfFocusOutside` can tell if the toggle was clicked. , tabIndex: -1, style: style, children: [renderToggle(args), isOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(popover, { position: position, onClose: close, onFocusOutside: closeIfFocusOutside, expandOnMobile: expandOnMobile, headerTitle: headerTitle, focusOnMount: focusOnMount // This value is used to ensure that the dropdowns // align with the editor header by default. , offset: 13, anchor: !popoverPropsHaveAnchor ? fallbackPopoverAnchor : undefined, variant: variant, ...popoverProps, className: dist_clsx('components-dropdown__content', popoverProps?.className, contentClassName), children: renderContent(args) })] }); }; /** * Renders a button that opens a floating content modal when clicked. * * ```jsx * import { Button, Dropdown } from '@wordpress/components'; * * const MyDropdown = () => ( * ( * * ) } * renderContent={ () =>
This is the content of the dropdown.
} * /> * ); * ``` */ const Dropdown = contextConnect(UnconnectedDropdown, 'Dropdown'); /* harmony default export */ const dropdown = (Dropdown); ;// ./node_modules/@wordpress/components/build-module/input-control/input-suffix-wrapper.js /** * External dependencies */ /** * Internal dependencies */ function UnconnectedInputControlSuffixWrapper(props, forwardedRef) { const derivedProps = useContextSystem(props, 'InputControlSuffixWrapper'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrefixSuffixWrapper, { ...derivedProps, ref: forwardedRef }); } /** * A convenience wrapper for the `suffix` when you want to apply * standard padding in accordance with the size variant. * * ```jsx * import { * __experimentalInputControl as InputControl, * __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper, * } from '@wordpress/components'; * * %} * /> * ``` */ const InputControlSuffixWrapper = contextConnect(UnconnectedInputControlSuffixWrapper, 'InputControlSuffixWrapper'); /* harmony default export */ const input_suffix_wrapper = (InputControlSuffixWrapper); ;// ./node_modules/@wordpress/components/build-module/select-control/styles/select-control-styles.js function select_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies */ /** * Internal dependencies */ const select_control_styles_disabledStyles = ({ disabled }) => { if (!disabled) { return ''; } return /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.ui.textDisabled, ";cursor:default;" + ( true ? "" : 0), true ? "" : 0); }; var select_control_styles_ref2 = true ? { name: "1lv1yo7", styles: "display:inline-flex" } : 0; const inputBaseVariantStyles = ({ variant }) => { if (variant === 'minimal') { return select_control_styles_ref2; } return ''; }; const StyledInputBase = /*#__PURE__*/emotion_styled_base_browser_esm(input_base, true ? { target: "e1mv6sxx3" } : 0)("color:", COLORS.theme.foreground, ";cursor:pointer;", select_control_styles_disabledStyles, " ", inputBaseVariantStyles, ";" + ( true ? "" : 0)); const select_control_styles_sizeStyles = ({ __next40pxDefaultSize, multiple, selectSize = 'default' }) => { if (multiple) { // When `multiple`, just use the native browser styles // without setting explicit height. return; } const sizes = { default: { height: 40, minHeight: 40, paddingTop: 0, paddingBottom: 0 }, small: { height: 24, minHeight: 24, paddingTop: 0, paddingBottom: 0 }, compact: { height: 32, minHeight: 32, paddingTop: 0, paddingBottom: 0 }, '__unstable-large': { height: 40, minHeight: 40, paddingTop: 0, paddingBottom: 0 } }; if (!__next40pxDefaultSize) { sizes.default = sizes.compact; } const style = sizes[selectSize] || sizes.default; return /*#__PURE__*/emotion_react_browser_esm_css(style, true ? "" : 0, true ? "" : 0); }; const chevronIconSize = 18; const sizePaddings = ({ __next40pxDefaultSize, multiple, selectSize = 'default' }) => { const padding = { default: config_values.controlPaddingX, small: config_values.controlPaddingXSmall, compact: config_values.controlPaddingXSmall, '__unstable-large': config_values.controlPaddingX }; if (!__next40pxDefaultSize) { padding.default = padding.compact; } const selectedPadding = padding[selectSize] || padding.default; return rtl({ paddingLeft: selectedPadding, paddingRight: selectedPadding + chevronIconSize, ...(multiple ? { paddingTop: selectedPadding, paddingBottom: selectedPadding } : {}) }); }; const overflowStyles = ({ multiple }) => { return { overflow: multiple ? 'auto' : 'hidden' }; }; var select_control_styles_ref = true ? { name: "n1jncc", styles: "field-sizing:content" } : 0; const variantStyles = ({ variant }) => { if (variant === 'minimal') { return select_control_styles_ref; } return ''; }; // TODO: Resolve need to use &&& to increase specificity // https://github.com/WordPress/gutenberg/issues/18483 const Select = /*#__PURE__*/emotion_styled_base_browser_esm("select", true ? { target: "e1mv6sxx2" } : 0)("&&&{appearance:none;background:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:currentColor;cursor:inherit;display:block;font-family:inherit;margin:0;width:100%;max-width:none;white-space:nowrap;text-overflow:ellipsis;", fontSizeStyles, ";", select_control_styles_sizeStyles, ";", sizePaddings, ";", overflowStyles, " ", variantStyles, ";}" + ( true ? "" : 0)); const DownArrowWrapper = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? { target: "e1mv6sxx1" } : 0)("margin-inline-end:", space(-1), ";line-height:0;path{fill:currentColor;}" + ( true ? "" : 0)); const InputControlSuffixWrapperWithClickThrough = /*#__PURE__*/emotion_styled_base_browser_esm(input_suffix_wrapper, true ? { target: "e1mv6sxx0" } : 0)("position:absolute;pointer-events:none;", rtl({ right: 0 }), ";" + ( true ? "" : 0)); ;// ./node_modules/@wordpress/icons/build-module/icon/index.js /** * WordPress dependencies */ /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ /** * Return an SVG icon. * * @param {IconProps} props icon is the SVG component to render * size is a number specifying the icon size in pixels * Other props will be passed to wrapped SVG component * @param {import('react').ForwardedRef} ref The forwarded ref to the SVG element. * * @return {JSX.Element} Icon component */ function icon_Icon({ icon, size = 24, ...props }, ref) { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { width: size, height: size, ...props, ref }); } /* harmony default export */ const icons_build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(icon_Icon)); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js /** * WordPress dependencies */ const chevronDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); /* harmony default export */ const chevron_down = (chevronDown); ;// ./node_modules/@wordpress/components/build-module/select-control/chevron-down.js /** * WordPress dependencies */ /** * Internal dependencies */ const SelectControlChevronDown = () => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InputControlSuffixWrapperWithClickThrough, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DownArrowWrapper, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_build_module_icon, { icon: chevron_down, size: chevronIconSize }) }) }); }; /* harmony default export */ const select_control_chevron_down = (SelectControlChevronDown); ;// ./node_modules/@wordpress/components/build-module/select-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function select_control_useUniqueId(idProp) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(SelectControl); const id = `inspector-select-control-${instanceId}`; return idProp || id; } function SelectOptions({ options }) { return options.map(({ id, label, value, ...optionProps }, index) => { const key = id || `${label}-${value}-${index}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("option", { value: value, ...optionProps, children: label }, key); }); } function UnforwardedSelectControl(props, ref) { const { className, disabled = false, help, hideLabelFromVision, id: idProp, label, multiple = false, onChange, options = [], size = 'default', value: valueProp, labelPosition = 'top', children, prefix, suffix, variant = 'default', __next40pxDefaultSize = false, __nextHasNoMarginBottom = false, __shouldNotWarnDeprecated36pxSize, ...restProps } = useDeprecated36pxDefaultSizeProp(props); const id = select_control_useUniqueId(idProp); const helpId = help ? `${id}__help` : undefined; // Disable reason: A select with an onchange throws a warning. if (!options?.length && !children) { return null; } const handleOnChange = event => { if (props.multiple) { const selectedOptions = Array.from(event.target.options).filter(({ selected }) => selected); const newValues = selectedOptions.map(({ value }) => value); props.onChange?.(newValues, { event }); return; } props.onChange?.(event.target.value, { event }); }; const classes = dist_clsx('components-select-control', className); maybeWarnDeprecated36pxSize({ componentName: 'SelectControl', __next40pxDefaultSize, size, __shouldNotWarnDeprecated36pxSize }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control, { help: help, id: id, __nextHasNoMarginBottom: __nextHasNoMarginBottom, __associatedWPComponentName: "SelectControl", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledInputBase, { className: classes, disabled: disabled, hideLabelFromVision: hideLabelFromVision, id: id, isBorderless: variant === 'minimal', label: label, size: size, suffix: suffix || !multiple && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(select_control_chevron_down, {}), prefix: prefix, labelPosition: labelPosition, __unstableInputWidth: variant === 'minimal' ? 'auto' : undefined, variant: variant, __next40pxDefaultSize: __next40pxDefaultSize, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Select, { ...restProps, __next40pxDefaultSize: __next40pxDefaultSize, "aria-describedby": helpId, className: "components-select-control__input", disabled: disabled, id: id, multiple: multiple, onChange: handleOnChange, ref: ref, selectSize: size, value: valueProp, variant: variant, children: children || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SelectOptions, { options: options }) }) }) }); } /** * `SelectControl` allows users to select from a single or multiple option menu. * It functions as a wrapper around the browser's native `,