diff --git a/package.json b/package.json index b91302a28e020..a976b26ea37ad 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "url": "https://develop.svn.wordpress.org/trunk" }, "gutenberg": { - "sha": "585cf86bb6f408b1dc61175f75db016aa4760653", + "sha": "d5ac60e6118060529737127d44a6fdc8abf57eb9", "ghcrRepo": "WordPress/gutenberg/gutenberg-wp-develop-build" }, "engines": { diff --git a/src/wp-includes/assets/script-loader-packages.php b/src/wp-includes/assets/script-loader-packages.php index 96d181286022e..50e8794c491c2 100644 --- a/src/wp-includes/assets/script-loader-packages.php +++ b/src/wp-includes/assets/script-loader-packages.php @@ -13,7 +13,7 @@ 'wp-i18n', 'wp-rich-text' ), - 'version' => 'a97786de6f13be9c6637' + 'version' => 'd4fe1eeb787c2fd5ee89' ), 'api-fetch.js' => array( 'dependencies' => array( @@ -65,7 +65,7 @@ 'wp-theme', 'wp-url' ), - 'version' => '110a088de3bda59ac5de' + 'version' => '43a9d7ab2fbaa04615a1' ), 'block-editor.js' => array( 'dependencies' => array( @@ -103,7 +103,7 @@ 'wp-url', 'wp-warning' ), - 'version' => '9041ae4f01562bcb4d33' + 'version' => '5a398d1da02bf80f3f98' ), 'block-library.js' => array( 'dependencies' => array( @@ -136,6 +136,7 @@ 'wp-private-apis', 'wp-rich-text', 'wp-server-side-render', + 'wp-shortcode', 'wp-theme', 'wp-upload-media', 'wp-url', @@ -147,7 +148,7 @@ 'import' => 'dynamic' ) ), - 'version' => '52817755f853f6ab7153' + 'version' => '9c1171e882b2ba2f7411' ), 'block-serialization-default-parser.js' => array( 'dependencies' => array( @@ -180,7 +181,7 @@ 'wp-shortcode', 'wp-warning' ), - 'version' => '9aea2a60e4a82baa898c' + 'version' => 'ece1f172d5b708916ebc' ), 'commands.js' => array( 'dependencies' => array( @@ -220,7 +221,7 @@ 'wp-rich-text', 'wp-warning' ), - 'version' => 'c74d7795ae739efd8470' + 'version' => '83936472a0d07a3a4c92' ), 'compose.js' => array( 'dependencies' => array( @@ -272,7 +273,7 @@ 'wp-url', 'wp-warning' ), - 'version' => '84dfcb788b38527ce29d' + 'version' => '21fd0114d22869dbe459' ), 'customize-widgets.js' => array( 'dependencies' => array( @@ -301,7 +302,7 @@ 'wp-theme', 'wp-widgets' ), - 'version' => '206784568d822411270a' + 'version' => '4da0091c281df82bd222' ), 'data.js' => array( 'dependencies' => array( @@ -314,7 +315,7 @@ 'wp-private-apis', 'wp-redux-routine' ), - 'version' => '148d59ef2548b2513db8' + 'version' => 'ee4e907a070c9780da2b' ), 'data-controls.js' => array( 'dependencies' => array( @@ -391,7 +392,7 @@ 'import' => 'static' ) ), - 'version' => 'c43a4fa8b00c3ba4431f' + 'version' => 'e5a1146f8586938ade23' ), 'edit-site.js' => array( 'dependencies' => array( @@ -440,7 +441,7 @@ 'import' => 'static' ) ), - 'version' => 'aa6e9b6786aea68585db' + 'version' => '25ce07d8e96c49452e7a' ), 'edit-widgets.js' => array( 'dependencies' => array( @@ -481,7 +482,7 @@ 'import' => 'static' ) ), - 'version' => '073d2e7bb4648840803a' + 'version' => '3382b8166d24bc8ebc42' ), 'editor.js' => array( 'dependencies' => array( @@ -531,7 +532,7 @@ 'import' => 'static' ) ), - 'version' => '9496d99a5f41ee4b8d8c' + 'version' => '3e365e98ba94f24ff5cf' ), 'element.js' => array( 'dependencies' => array( @@ -572,7 +573,7 @@ 'import' => 'dynamic' ) ), - 'version' => '6f640c16ab0835901167' + 'version' => 'b38d376fe79b3eac1578' ), 'hooks.js' => array( 'dependencies' => array( @@ -650,7 +651,7 @@ 'wp-url', 'wp-warning' ), - 'version' => '1ef9847260fd7de4188f' + 'version' => '597bd2b6e79b271e52c7' ), 'notices.js' => array( 'dependencies' => array( @@ -744,7 +745,7 @@ 'dependencies' => array( ), - 'version' => '7378f2cb5ba25f7aa9e5' + 'version' => 'ebe55c7ec838043537c7' ), 'react-i18n.js' => array( 'dependencies' => array( @@ -841,7 +842,7 @@ 'wp-element', 'wp-private-apis' ), - 'version' => '798ec32c86815d7e8a14' + 'version' => '3b1949512f2ec0c938bd' ), 'token-list.js' => array( 'dependencies' => array( @@ -872,7 +873,7 @@ 'import' => 'dynamic' ) ), - 'version' => '688c688a0ccf0f0d020b' + 'version' => '1399274c1ad48fc29498' ), 'url.js' => array( 'dependencies' => array( diff --git a/src/wp-includes/assets/script-modules-packages.php b/src/wp-includes/assets/script-modules-packages.php index b93f4f354fd1d..2c6038198b9fe 100644 --- a/src/wp-includes/assets/script-modules-packages.php +++ b/src/wp-includes/assets/script-modules-packages.php @@ -166,7 +166,7 @@ 'import' => 'static' ) ), - 'version' => '1ea95bd3abfe75ec1bbc' + 'version' => '5e02fdb03b9e05e7ba82' ), 'connectors/index.js' => array( 'dependencies' => array( @@ -179,6 +179,41 @@ ), 'version' => 'dce5e2b0fc240815717b' ), + 'content-types/index.js' => array( + 'dependencies' => array( + 'react', + 'react-dom', + 'react-jsx-runtime', + 'wp-components', + 'wp-compose', + 'wp-core-data', + 'wp-data', + 'wp-date', + 'wp-deprecated', + 'wp-element', + 'wp-i18n', + 'wp-is-shallow-equal', + 'wp-keycodes', + 'wp-notices', + 'wp-preferences', + 'wp-primitives', + 'wp-private-apis', + 'wp-theme', + 'wp-url', + 'wp-warning' + ), + 'module_dependencies' => array( + array( + 'id' => '@wordpress/a11y', + 'import' => 'static' + ), + array( + 'id' => '@wordpress/route', + 'import' => 'static' + ) + ), + 'version' => '9a35d0da8badd6a33cf8' + ), 'core-abilities/index.js' => array( 'dependencies' => array( 'wp-api-fetch', @@ -211,7 +246,7 @@ 'dependencies' => array( ), - 'version' => '4d2a3a72c7410d548881' + 'version' => 'efaa5193bbad9c60ffd1' ), 'interactivity-router/full-page.js' => array( 'dependencies' => array( @@ -273,7 +308,7 @@ 'wp-private-apis', 'wp-style-engine' ), - 'version' => '4dbbb677aac222671901' + 'version' => '8bd91519756b243fc835' ), 'route/index.js' => array( 'dependencies' => array( @@ -284,30 +319,6 @@ ), 'version' => '48a77bfa70722b4254e4' ), - 'user-taxonomies/index.js' => array( - 'dependencies' => array( - 'react', - 'react-dom', - 'react-jsx-runtime', - 'wp-components', - 'wp-compose', - 'wp-core-data', - 'wp-data', - 'wp-element', - 'wp-i18n', - 'wp-notices', - 'wp-primitives', - 'wp-private-apis', - 'wp-theme' - ), - 'module_dependencies' => array( - array( - 'id' => '@wordpress/a11y', - 'import' => 'static' - ) - ), - 'version' => '339ee65736f7a738a4ad' - ), 'vips/loader.js' => array( 'dependencies' => array( diff --git a/src/wp-includes/blocks/navigation.php b/src/wp-includes/blocks/navigation.php index 8602373837009..a530494ff36e7 100644 --- a/src/wp-includes/blocks/navigation.php +++ b/src/wp-includes/blocks/navigation.php @@ -425,7 +425,11 @@ private static function get_overlay_blocks_from_template_part( $overlay_template $full_template_part_id = $theme . '//' . $slug; $block_template = get_block_file_template( $full_template_part_id, 'wp_template_part' ); if ( isset( $block_template->content ) ) { - $parsed_blocks = parse_blocks( $block_template->content ); + // Expand shortcodes before parsing blocks, matching the order in + // `render_block_core_template_part()`. + $content = shortcode_unautop( $block_template->content ); + $content = do_shortcode( $content ); + $parsed_blocks = parse_blocks( $content ); $blocks = block_core_navigation_filter_out_empty_blocks( $parsed_blocks ); // Disable overlay menu for any navigation blocks within the overlay to prevent nested overlays. $blocks = static::disable_overlay_menu_for_nested_navigation_blocks( $blocks ); @@ -449,6 +453,12 @@ private static function get_overlay_blocks_from_template_part( $overlay_template // Re-serialize, and run Block Hooks algorithm to inject hooked blocks. $markup = serialize_blocks( $blocks ); $markup = apply_block_hooks_to_content_from_post_object( $markup, $template_part_post ); + + // Expand shortcodes before parsing blocks, matching the order in + // `render_block_core_template_part()`. + $markup = shortcode_unautop( $markup ); + $markup = do_shortcode( $markup ); + $blocks = parse_blocks( $markup ); // Disable overlay menu for any navigation blocks within the overlay to prevent nested overlays. diff --git a/src/wp-includes/build/constants.php b/src/wp-includes/build/constants.php index dd4ff3d3b0fe3..09f9b1d22697a 100644 --- a/src/wp-includes/build/constants.php +++ b/src/wp-includes/build/constants.php @@ -9,6 +9,6 @@ */ return array( - 'version' => '23.1.0', + 'version' => '23.2.0', 'build_url' => includes_url( 'build/' ), ); diff --git a/src/wp-includes/build/pages.php b/src/wp-includes/build/pages.php index 1d8e3b10f73a7..d9fa3cfef0f7f 100644 --- a/src/wp-includes/build/pages.php +++ b/src/wp-includes/build/pages.php @@ -6,15 +6,23 @@ * @package wp */ -require_once __DIR__ . '/pages/font-library/page.php'; -require_once __DIR__ . '/pages/font-library/page-wp-admin.php'; -require_once __DIR__ . '/pages/options-connectors/page.php'; -require_once __DIR__ . '/pages/options-connectors/page-wp-admin.php'; -require_once __DIR__ . '/pages/guidelines/page.php'; -require_once __DIR__ . '/pages/guidelines/page-wp-admin.php'; -require_once __DIR__ . '/pages/experiments/page.php'; -require_once __DIR__ . '/pages/experiments/page-wp-admin.php'; -require_once __DIR__ . '/pages/taxonomies/page.php'; -require_once __DIR__ . '/pages/taxonomies/page-wp-admin.php'; -require_once __DIR__ . '/pages/dashboard/page.php'; -require_once __DIR__ . '/pages/dashboard/page-wp-admin.php'; +foreach ( [ + __DIR__ . '/pages/media-editor/page.php', + __DIR__ . '/pages/media-editor/page-wp-admin.php', + __DIR__ . '/pages/font-library/page.php', + __DIR__ . '/pages/font-library/page-wp-admin.php', + __DIR__ . '/pages/options-connectors/page.php', + __DIR__ . '/pages/options-connectors/page-wp-admin.php', + __DIR__ . '/pages/guidelines/page.php', + __DIR__ . '/pages/guidelines/page-wp-admin.php', + __DIR__ . '/pages/experiments/page.php', + __DIR__ . '/pages/experiments/page-wp-admin.php', + __DIR__ . '/pages/content-types/page.php', + __DIR__ . '/pages/content-types/page-wp-admin.php', + __DIR__ . '/pages/dashboard/page.php', + __DIR__ . '/pages/dashboard/page-wp-admin.php', +] as $file ) { + if ( file_exists( $file ) ) { + require_once $file; + } +} diff --git a/src/wp-includes/build/pages/font-library/page-wp-admin.php b/src/wp-includes/build/pages/font-library/page-wp-admin.php index 4867edd329dc0..aa54ca9045668 100644 --- a/src/wp-includes/build/pages/font-library/page-wp-admin.php +++ b/src/wp-includes/build/pages/font-library/page-wp-admin.php @@ -196,6 +196,21 @@ function ( $handle ) { } } + /** + * Filters the boot script-module dependencies for the + * font-library-wp-admin page. + * + * Surfaces extending this page can append entries to the boot + * dependency list. Each entry is an array with 'import' (string + * 'static' or 'dynamic') and 'id' (script-module handle) keys. + * + * @param array $boot_dependencies Boot dependencies for the page. + */ + $boot_dependencies = apply_filters( + 'font-library-wp-admin_boot_dependencies', + $boot_dependencies + ); + // Dummy script module to ensure dependencies are loaded wp_register_script_module( 'font-library-wp-admin', diff --git a/src/wp-includes/build/pages/font-library/page.php b/src/wp-includes/build/pages/font-library/page.php index c7ce3cfa7fb67..f41ec1e443227 100644 --- a/src/wp-includes/build/pages/font-library/page.php +++ b/src/wp-includes/build/pages/font-library/page.php @@ -209,6 +209,21 @@ function ( $handle ) { } } + /** + * Filters the boot script-module dependencies for the + * font-library page. + * + * Surfaces extending this page can append entries to the boot + * dependency list. Each entry is an array with 'import' (string + * 'static' or 'dynamic') and 'id' (script-module handle) keys. + * + * @param array $boot_dependencies Boot dependencies for the page. + */ + $boot_dependencies = apply_filters( + 'font-library_boot_dependencies', + $boot_dependencies + ); + // Dummy script module to ensure dependencies are loaded wp_register_script_module( 'font-library', diff --git a/src/wp-includes/build/pages/options-connectors/page-wp-admin.php b/src/wp-includes/build/pages/options-connectors/page-wp-admin.php index 434708997ea0c..e5c7b8dce0544 100644 --- a/src/wp-includes/build/pages/options-connectors/page-wp-admin.php +++ b/src/wp-includes/build/pages/options-connectors/page-wp-admin.php @@ -196,6 +196,21 @@ function ( $handle ) { } } + /** + * Filters the boot script-module dependencies for the + * options-connectors-wp-admin page. + * + * Surfaces extending this page can append entries to the boot + * dependency list. Each entry is an array with 'import' (string + * 'static' or 'dynamic') and 'id' (script-module handle) keys. + * + * @param array $boot_dependencies Boot dependencies for the page. + */ + $boot_dependencies = apply_filters( + 'options-connectors-wp-admin_boot_dependencies', + $boot_dependencies + ); + // Dummy script module to ensure dependencies are loaded wp_register_script_module( 'options-connectors-wp-admin', diff --git a/src/wp-includes/build/pages/options-connectors/page.php b/src/wp-includes/build/pages/options-connectors/page.php index 95ee80c2900d0..6be01a05641c0 100644 --- a/src/wp-includes/build/pages/options-connectors/page.php +++ b/src/wp-includes/build/pages/options-connectors/page.php @@ -209,6 +209,21 @@ function ( $handle ) { } } + /** + * Filters the boot script-module dependencies for the + * options-connectors page. + * + * Surfaces extending this page can append entries to the boot + * dependency list. Each entry is an array with 'import' (string + * 'static' or 'dynamic') and 'id' (script-module handle) keys. + * + * @param array $boot_dependencies Boot dependencies for the page. + */ + $boot_dependencies = apply_filters( + 'options-connectors_boot_dependencies', + $boot_dependencies + ); + // Dummy script module to ensure dependencies are loaded wp_register_script_module( 'options-connectors', diff --git a/src/wp-includes/build/routes.php b/src/wp-includes/build/routes.php index bac9b0657e868..bb6177aee952e 100644 --- a/src/wp-includes/build/routes.php +++ b/src/wp-includes/build/routes.php @@ -111,6 +111,25 @@ function wp_register_options_connectors_wp_admin_page_routes() { } add_action( 'options-connectors-wp-admin_init', 'wp_register_options_connectors_wp_admin_page_routes' ); +// Page-specific route registration functions for content-types +/** + * Register routes for content-types page (full-page mode). + */ +function wp_register_content_types_page_routes() { + global $wp_content_types_routes_data; + wp_register_page_routes( $wp_content_types_routes_data, 'wp_register_content_types_route' ); +} +add_action( 'content-types_init', 'wp_register_content_types_page_routes' ); + +/** + * Register routes for content-types page (wp-admin mode). + */ +function wp_register_content_types_wp_admin_page_routes() { + global $wp_content_types_routes_data; + wp_register_page_routes( $wp_content_types_routes_data, 'wp_register_content_types_wp_admin_route' ); +} +add_action( 'content-types-wp-admin_init', 'wp_register_content_types_wp_admin_page_routes' ); + // Page-specific route registration functions for dashboard /** * Register routes for dashboard page (full-page mode). @@ -187,22 +206,22 @@ function wp_register_guidelines_wp_admin_page_routes() { } add_action( 'guidelines-wp-admin_init', 'wp_register_guidelines_wp_admin_page_routes' ); -// Page-specific route registration functions for taxonomies +// Page-specific route registration functions for media-editor /** - * Register routes for taxonomies page (full-page mode). + * Register routes for media-editor page (full-page mode). */ -function wp_register_taxonomies_page_routes() { - global $wp_taxonomies_routes_data; - wp_register_page_routes( $wp_taxonomies_routes_data, 'wp_register_taxonomies_route' ); +function wp_register_media_editor_page_routes() { + global $wp_media_editor_routes_data; + wp_register_page_routes( $wp_media_editor_routes_data, 'wp_register_media_editor_route' ); } -add_action( 'taxonomies_init', 'wp_register_taxonomies_page_routes' ); +add_action( 'media-editor_init', 'wp_register_media_editor_page_routes' ); /** - * Register routes for taxonomies page (wp-admin mode). + * Register routes for media-editor page (wp-admin mode). */ -function wp_register_taxonomies_wp_admin_page_routes() { - global $wp_taxonomies_routes_data; - wp_register_page_routes( $wp_taxonomies_routes_data, 'wp_register_taxonomies_wp_admin_route' ); +function wp_register_media_editor_wp_admin_page_routes() { + global $wp_media_editor_routes_data; + wp_register_page_routes( $wp_media_editor_routes_data, 'wp_register_media_editor_wp_admin_route' ); } -add_action( 'taxonomies-wp-admin_init', 'wp_register_taxonomies_wp_admin_page_routes' ); +add_action( 'media-editor-wp-admin_init', 'wp_register_media_editor_wp_admin_page_routes' ); diff --git a/src/wp-includes/build/routes/connectors-home/content.js b/src/wp-includes/build/routes/connectors-home/content.js index 2c1dafc85dd82..b3231790cb6d4 100644 --- a/src/wp-includes/build/routes/connectors-home/content.js +++ b/src/wp-includes/build/routes/connectors-home/content.js @@ -7,6 +7,10 @@ var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) @@ -52,6 +56,182 @@ var require_jsx_runtime = __commonJS({ } }); +// vendor-external:react-dom +var require_react_dom = __commonJS({ + "vendor-external:react-dom"(exports, module) { + module.exports = window.ReactDOM; + } +}); + +// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +var require_use_sync_external_store_shim_development = __commonJS({ + "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { + "use strict"; + (function() { + function is(x, y) { + return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; + } + function useSyncExternalStore$2(subscribe, getSnapshot) { + didWarnOld18Alpha || void 0 === React53.startTransition || (didWarnOld18Alpha = true, console.error( + "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release." + )); + var value = getSnapshot(); + if (!didWarnUncachedGetSnapshot) { + var cachedValue = getSnapshot(); + objectIs(value, cachedValue) || (console.error( + "The result of getSnapshot should be cached to avoid an infinite loop" + ), didWarnUncachedGetSnapshot = true); + } + cachedValue = useState14({ + inst: { value, getSnapshot } + }); + var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; + useLayoutEffect4( + function() { + inst.value = value; + inst.getSnapshot = getSnapshot; + checkIfSnapshotChanged(inst) && forceUpdate({ inst }); + }, + [subscribe, value, getSnapshot] + ); + useEffect15( + function() { + checkIfSnapshotChanged(inst) && forceUpdate({ inst }); + return subscribe(function() { + checkIfSnapshotChanged(inst) && forceUpdate({ inst }); + }); + }, + [subscribe] + ); + useDebugValue2(value); + return value; + } + function checkIfSnapshotChanged(inst) { + var latestGetSnapshot = inst.getSnapshot; + inst = inst.value; + try { + var nextValue = latestGetSnapshot(); + return !objectIs(inst, nextValue); + } catch (error2) { + return true; + } + } + function useSyncExternalStore$1(subscribe, getSnapshot) { + return getSnapshot(); + } + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); + var React53 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState14 = React53.useState, useEffect15 = React53.useEffect, useLayoutEffect4 = React53.useLayoutEffect, useDebugValue2 = React53.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; + exports.useSyncExternalStore = void 0 !== React53.useSyncExternalStore ? React53.useSyncExternalStore : shim; + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); + })(); + } +}); + +// node_modules/use-sync-external-store/shim/index.js +var require_shim = __commonJS({ + "node_modules/use-sync-external-store/shim/index.js"(exports, module) { + "use strict"; + if (false) { + module.exports = null; + } else { + module.exports = require_use_sync_external_store_shim_development(); + } + } +}); + +// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +var require_with_selector_development = __commonJS({ + "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { + "use strict"; + (function() { + function is(x, y) { + return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; + } + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); + var React53 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore2 = shim.useSyncExternalStore, useRef21 = React53.useRef, useEffect15 = React53.useEffect, useMemo17 = React53.useMemo, useDebugValue2 = React53.useDebugValue; + exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { + var instRef = useRef21(null); + if (null === instRef.current) { + var inst = { hasValue: false, value: null }; + instRef.current = inst; + } else inst = instRef.current; + instRef = useMemo17( + function() { + function memoizedSelector(nextSnapshot) { + if (!hasMemo) { + hasMemo = true; + memoizedSnapshot = nextSnapshot; + nextSnapshot = selector(nextSnapshot); + if (void 0 !== isEqual && inst.hasValue) { + var currentSelection = inst.value; + if (isEqual(currentSelection, nextSnapshot)) + return memoizedSelection = currentSelection; + } + return memoizedSelection = nextSnapshot; + } + currentSelection = memoizedSelection; + if (objectIs(memoizedSnapshot, nextSnapshot)) + return currentSelection; + var nextSelection = selector(nextSnapshot); + if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) + return memoizedSnapshot = nextSnapshot, currentSelection; + memoizedSnapshot = nextSnapshot; + return memoizedSelection = nextSelection; + } + var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; + return [ + function() { + return memoizedSelector(getSnapshot()); + }, + null === maybeGetServerSnapshot ? void 0 : function() { + return memoizedSelector(maybeGetServerSnapshot()); + } + ]; + }, + [getSnapshot, getServerSnapshot, selector, isEqual] + ); + var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]); + useEffect15( + function() { + inst.hasValue = true; + inst.value = value; + }, + [value] + ); + useDebugValue2(value); + return value; + }; + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); + })(); + } +}); + +// node_modules/use-sync-external-store/shim/with-selector.js +var require_with_selector = __commonJS({ + "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { + "use strict"; + if (false) { + module.exports = null; + } else { + module.exports = require_with_selector_development(); + } + } +}); + +// package-external:@wordpress/primitives +var require_primitives = __commonJS({ + "package-external:@wordpress/primitives"(exports, module) { + module.exports = window.wp.primitives; + } +}); + +// package-external:@wordpress/theme +var require_theme = __commonJS({ + "package-external:@wordpress/theme"(exports, module) { + module.exports = window.wp.theme; + } +}); + // package-external:@wordpress/private-apis var require_private_apis = __commonJS({ "package-external:@wordpress/private-apis"(exports, module) { @@ -111,7 +291,25 @@ function clsx() { var clsx_default = clsx; // packages/ui/build-module/badge/badge.mjs -var import_element2 = __toESM(require_element(), 1); +var import_element9 = __toESM(require_element(), 1); + +// node_modules/@base-ui/utils/esm/error.js +var set; +if (true) { + set = /* @__PURE__ */ new Set(); +} +function error(...messages) { + if (true) { + const messageKey = messages.join(" "); + if (!set.has(messageKey)) { + set.add(messageKey); + console.error(`Base UI: ${messageKey}`); + } + } +} + +// node_modules/@base-ui/utils/esm/useStableCallback.js +var React3 = __toESM(require_react(), 1); // node_modules/@base-ui/utils/esm/useRefWithInit.js var React2 = __toESM(require_react(), 1); @@ -124,23 +322,71 @@ function useRefWithInit(init, initArg) { return ref; } +// node_modules/@base-ui/utils/esm/useStableCallback.js +var useInsertionEffect = React3[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0, -3)]; +var useSafeInsertionEffect = ( + // React 17 doesn't have useInsertionEffect. + useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. + useInsertionEffect !== React3.useLayoutEffect ? useInsertionEffect : (fn) => fn() +); +function useStableCallback(callback) { + const stable = useRefWithInit(createStableCallback).current; + stable.next = callback; + useSafeInsertionEffect(stable.effect); + return stable.trampoline; +} +function createStableCallback() { + const stable = { + next: void 0, + callback: assertNotCalled, + trampoline: (...args) => stable.callback?.(...args), + effect: () => { + stable.callback = stable.next; + } + }; + return stable; +} +function assertNotCalled() { + if (true) { + throw ( + /* minify-error-disabled */ + new Error("Base UI: Cannot call an event handler while rendering.") + ); + } +} + +// node_modules/@base-ui/utils/esm/useIsoLayoutEffect.js +var React4 = __toESM(require_react(), 1); +var noop = () => { +}; +var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop; + // node_modules/@base-ui/utils/esm/warn.js -var set; +var set2; if (true) { - set = /* @__PURE__ */ new Set(); + set2 = /* @__PURE__ */ new Set(); } function warn(...messages) { if (true) { const messageKey = messages.join(" "); - if (!set.has(messageKey)) { - set.add(messageKey); + if (!set2.has(messageKey)) { + set2.add(messageKey); console.warn(`Base UI: ${messageKey}`); } } } -// node_modules/@base-ui/react/esm/internals/useRenderElement.js +// node_modules/@base-ui/react/esm/internals/direction-context/DirectionContext.js var React5 = __toESM(require_react(), 1); +var DirectionContext = /* @__PURE__ */ React5.createContext(void 0); +if (true) DirectionContext.displayName = "DirectionContext"; +function useDirection() { + const context = React5.useContext(DirectionContext); + return context?.direction ?? "ltr"; +} + +// node_modules/@base-ui/react/esm/internals/useRenderElement.js +var React8 = __toESM(require_react(), 1); // node_modules/@base-ui/utils/esm/useMergedRefs.js function useMergedRefs(a, b, c, d) { @@ -168,7 +414,7 @@ function didChange(forkRef, a, b, c, d) { return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; } function didChangeN(forkRef, newRefs) { - return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]); + return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); } function update(forkRef, refs) { forkRef.refs = refs; @@ -232,18 +478,18 @@ function update(forkRef, refs) { } // node_modules/@base-ui/utils/esm/getReactElementRef.js -var React4 = __toESM(require_react(), 1); +var React7 = __toESM(require_react(), 1); // node_modules/@base-ui/utils/esm/reactVersion.js -var React3 = __toESM(require_react(), 1); -var majorVersion = parseInt(React3.version, 10); +var React6 = __toESM(require_react(), 1); +var majorVersion = parseInt(React6.version, 10); function isReactVersionAtLeast(reactVersionToCheck) { return majorVersion >= reactVersionToCheck; } // node_modules/@base-ui/utils/esm/getReactElementRef.js function getReactElementRef(element) { - if (!/* @__PURE__ */ React4.isValidElement(element)) { + if (!/* @__PURE__ */ React7.isValidElement(element)) { return null; } const reactElement = element; @@ -269,6 +515,8 @@ function mergeObjects(a, b) { } // node_modules/@base-ui/utils/esm/empty.js +function NOOP() { +} var EMPTY_ARRAY = Object.freeze([]); var EMPTY_OBJECT = Object.freeze({}); @@ -479,12 +727,12 @@ function useRenderElementProps(componentProps, params = {}) { state = EMPTY_OBJECT, ref, props, - stateAttributesMapping, + stateAttributesMapping: stateAttributesMapping3, enabled = true } = params; const className = enabled ? resolveClassName(classNameProp, state) : void 0; const style = enabled ? resolveStyle(styleProp, state) : void 0; - const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT; + const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT; const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; if (typeof document !== "undefined") { @@ -528,158 +776,9510 @@ function evaluateRenderProp(element, render, props, state) { mergedProps.ref = props.ref; let newElement = render; if (newElement?.$$typeof === REACT_LAZY_TYPE) { - const children = React5.Children.toArray(render); + const children = React8.Children.toArray(render); newElement = children[0]; } if (true) { - if (!/* @__PURE__ */ React5.isValidElement(newElement)) { + if (!/* @__PURE__ */ React8.isValidElement(newElement)) { throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n")); } } - return /* @__PURE__ */ React5.cloneElement(newElement, mergedProps); + return /* @__PURE__ */ React8.cloneElement(newElement, mergedProps); } if (element) { if (typeof element === "string") { return renderTag(element, props); } } - throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); + throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); +} +function warnIfRenderPropLooksLikeComponent(renderFn) { + const functionName = renderFn.name; + if (functionName.length === 0) { + return; + } + if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { + return; + } + if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { + return; + } + warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={}` or `render={(props) => }` instead.", "https://base-ui.com/r/invalid-render-prop"); +} +function renderTag(Tag, props) { + if (Tag === "button") { + return /* @__PURE__ */ (0, import_react.createElement)("button", { + type: "button", + ...props, + key: props.key + }); + } + if (Tag === "img") { + return /* @__PURE__ */ (0, import_react.createElement)("img", { + alt: "", + ...props, + key: props.key + }); + } + return /* @__PURE__ */ React8.createElement(Tag, props); +} + +// node_modules/@base-ui/react/esm/internals/reason-parts.js +var reason_parts_exports = {}; +__export(reason_parts_exports, { + cancelOpen: () => cancelOpen, + chipRemovePress: () => chipRemovePress, + clearPress: () => clearPress, + closePress: () => closePress, + closeWatcher: () => closeWatcher, + decrementPress: () => decrementPress, + disabled: () => disabled, + drag: () => drag, + escapeKey: () => escapeKey, + focusOut: () => focusOut, + imperativeAction: () => imperativeAction, + incrementPress: () => incrementPress, + inputBlur: () => inputBlur, + inputChange: () => inputChange, + inputClear: () => inputClear, + inputPaste: () => inputPaste, + inputPress: () => inputPress, + itemPress: () => itemPress, + keyboard: () => keyboard, + linkPress: () => linkPress, + listNavigation: () => listNavigation, + none: () => none, + outsidePress: () => outsidePress, + pointer: () => pointer, + scrub: () => scrub, + siblingOpen: () => siblingOpen, + swipe: () => swipe, + trackPress: () => trackPress, + triggerFocus: () => triggerFocus, + triggerHover: () => triggerHover, + triggerPress: () => triggerPress, + wheel: () => wheel, + windowResize: () => windowResize +}); +var none = "none"; +var triggerPress = "trigger-press"; +var triggerHover = "trigger-hover"; +var triggerFocus = "trigger-focus"; +var outsidePress = "outside-press"; +var itemPress = "item-press"; +var closePress = "close-press"; +var linkPress = "link-press"; +var clearPress = "clear-press"; +var chipRemovePress = "chip-remove-press"; +var trackPress = "track-press"; +var incrementPress = "increment-press"; +var decrementPress = "decrement-press"; +var inputChange = "input-change"; +var inputClear = "input-clear"; +var inputBlur = "input-blur"; +var inputPaste = "input-paste"; +var inputPress = "input-press"; +var focusOut = "focus-out"; +var escapeKey = "escape-key"; +var closeWatcher = "close-watcher"; +var listNavigation = "list-navigation"; +var keyboard = "keyboard"; +var pointer = "pointer"; +var drag = "drag"; +var wheel = "wheel"; +var scrub = "scrub"; +var cancelOpen = "cancel-open"; +var siblingOpen = "sibling-open"; +var disabled = "disabled"; +var imperativeAction = "imperative-action"; +var swipe = "swipe"; +var windowResize = "window-resize"; + +// node_modules/@base-ui/react/esm/internals/createBaseUIEventDetails.js +function createChangeEventDetails(reason, event, trigger, customProperties) { + let canceled = false; + let allowPropagation = false; + const custom = customProperties ?? EMPTY_OBJECT; + const details = { + reason, + event: event ?? new Event("base-ui"), + cancel() { + canceled = true; + }, + allowPropagation() { + allowPropagation = true; + }, + get isCanceled() { + return canceled; + }, + get isPropagationAllowed() { + return allowPropagation; + }, + trigger, + ...custom + }; + return details; +} + +// node_modules/@base-ui/utils/esm/useId.js +var React10 = __toESM(require_react(), 1); + +// node_modules/@base-ui/utils/esm/safeReact.js +var React9 = __toESM(require_react(), 1); +var SafeReact = { + ...React9 +}; + +// node_modules/@base-ui/utils/esm/useId.js +var globalId = 0; +function useGlobalId(idOverride, prefix = "mui") { + const [defaultId, setDefaultId] = React10.useState(idOverride); + const id = idOverride || defaultId; + React10.useEffect(() => { + if (defaultId == null) { + globalId += 1; + setDefaultId(`${prefix}-${globalId}`); + } + }, [defaultId, prefix]); + return id; +} +var maybeReactUseId = SafeReact.useId; +function useId(idOverride, prefix) { + if (maybeReactUseId !== void 0) { + const reactId = maybeReactUseId(); + return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId); + } + return useGlobalId(idOverride, prefix); +} + +// node_modules/@base-ui/react/esm/internals/useBaseUiId.js +function useBaseUiId(idOverride) { + return useId(idOverride, "base-ui"); +} + +// node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js +var ReactDOM = __toESM(require_react_dom(), 1); + +// node_modules/@base-ui/utils/esm/useOnMount.js +var React11 = __toESM(require_react(), 1); +var EMPTY = []; +function useOnMount(fn) { + React11.useEffect(fn, EMPTY); +} + +// node_modules/@base-ui/utils/esm/useAnimationFrame.js +var EMPTY2 = null; +var LAST_RAF = globalThis.requestAnimationFrame; +var Scheduler = class { + /* This implementation uses an array as a backing data-structure for frame callbacks. + * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it + * never calls the native `cancelAnimationFrame` if there are no frames left. This can + * be much more efficient if there is a call pattern that alterns as + * "request-cancel-request-cancel-…". + * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation + * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ + callbacks = []; + callbacksCount = 0; + nextId = 1; + startId = 1; + isScheduled = false; + tick = (timestamp) => { + this.isScheduled = false; + const currentCallbacks = this.callbacks; + const currentCallbacksCount = this.callbacksCount; + this.callbacks = []; + this.callbacksCount = 0; + this.startId = this.nextId; + if (currentCallbacksCount > 0) { + for (let i = 0; i < currentCallbacks.length; i += 1) { + currentCallbacks[i]?.(timestamp); + } + } + }; + request(fn) { + const id = this.nextId; + this.nextId += 1; + this.callbacks.push(fn); + this.callbacksCount += 1; + const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); + if (!this.isScheduled || didRAFChange) { + requestAnimationFrame(this.tick); + this.isScheduled = true; + } + return id; + } + cancel(id) { + const index2 = id - this.startId; + if (index2 < 0 || index2 >= this.callbacks.length) { + return; + } + this.callbacks[index2] = null; + this.callbacksCount -= 1; + } +}; +var scheduler = new Scheduler(); +var AnimationFrame = class _AnimationFrame { + static create() { + return new _AnimationFrame(); + } + static request(fn) { + return scheduler.request(fn); + } + static cancel(id) { + return scheduler.cancel(id); + } + currentId = EMPTY2; + /** + * Executes `fn` after `delay`, clearing any previously scheduled call. + */ + request(fn) { + this.cancel(); + this.currentId = scheduler.request(() => { + this.currentId = EMPTY2; + fn(); + }); + } + cancel = () => { + if (this.currentId !== EMPTY2) { + scheduler.cancel(this.currentId); + this.currentId = EMPTY2; + } + }; + disposeEffect = () => { + return this.cancel; + }; +}; +function useAnimationFrame() { + const timeout = useRefWithInit(AnimationFrame.create).current; + useOnMount(timeout.disposeEffect); + return timeout; +} + +// node_modules/@base-ui/react/esm/utils/resolveRef.js +function resolveRef(maybeRef) { + if (maybeRef == null) { + return maybeRef; + } + return "current" in maybeRef ? maybeRef.current : maybeRef; +} + +// node_modules/@base-ui/react/esm/internals/stateAttributesMapping.js +var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) { + TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style"; + TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style"; + return TransitionStatusDataAttributes2; +})({}); +var STARTING_HOOK = { + [TransitionStatusDataAttributes.startingStyle]: "" +}; +var ENDING_HOOK = { + [TransitionStatusDataAttributes.endingStyle]: "" +}; +var transitionStatusMapping = { + transitionStatus(value) { + if (value === "starting") { + return STARTING_HOOK; + } + if (value === "ending") { + return ENDING_HOOK; + } + return null; + } +}; + +// node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js +function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) { + const frame = useAnimationFrame(); + return useStableCallback((fnToExecute, signal = null) => { + frame.cancel(); + const element = resolveRef(elementOrRef); + if (element == null) { + return; + } + const resolvedElement = element; + const done = () => { + ReactDOM.flushSync(fnToExecute); + }; + if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { + fnToExecute(); + return; + } + function exec() { + Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { + if (!signal?.aborted) { + done(); + } + }).catch(() => { + if (treatAbortedAsFinished) { + if (!signal?.aborted) { + done(); + } + return; + } + const currentAnimations = resolvedElement.getAnimations(); + if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { + exec(); + } + }); + } + if (waitForStartingStyleRemoved) { + const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle; + if (!resolvedElement.hasAttribute(startingStyleAttribute)) { + frame.request(exec); + return; + } + const attributeObserver = new MutationObserver(() => { + if (!resolvedElement.hasAttribute(startingStyleAttribute)) { + attributeObserver.disconnect(); + exec(); + } + }); + attributeObserver.observe(resolvedElement, { + attributes: true, + attributeFilter: [startingStyleAttribute] + }); + signal?.addEventListener("abort", () => attributeObserver.disconnect(), { + once: true + }); + return; + } + frame.request(exec); + }); +} + +// node_modules/@base-ui/react/esm/internals/useTransitionStatus.js +var React12 = __toESM(require_react(), 1); +function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) { + const [transitionStatus, setTransitionStatus] = React12.useState(open && enableIdleState ? "idle" : void 0); + const [mounted, setMounted] = React12.useState(open); + if (open && !mounted) { + setMounted(true); + setTransitionStatus("starting"); + } + if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { + setTransitionStatus("ending"); + } + if (!open && !mounted && transitionStatus === "ending") { + setTransitionStatus(void 0); + } + useIsoLayoutEffect(() => { + if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { + const frame = AnimationFrame.request(() => { + setTransitionStatus("ending"); + }); + return () => { + AnimationFrame.cancel(frame); + }; + } + return void 0; + }, [open, mounted, transitionStatus, deferEndingState]); + useIsoLayoutEffect(() => { + if (!open || enableIdleState) { + return void 0; + } + const frame = AnimationFrame.request(() => { + setTransitionStatus(void 0); + }); + return () => { + AnimationFrame.cancel(frame); + }; + }, [enableIdleState, open]); + useIsoLayoutEffect(() => { + if (!open || !enableIdleState) { + return void 0; + } + if (open && mounted && transitionStatus !== "idle") { + setTransitionStatus("starting"); + } + const frame = AnimationFrame.request(() => { + setTransitionStatus("idle"); + }); + return () => { + AnimationFrame.cancel(frame); + }; + }, [enableIdleState, open, mounted, transitionStatus]); + return { + mounted, + setMounted, + transitionStatus + }; +} + +// node_modules/@base-ui/react/esm/internals/use-button/useButton.js +var React15 = __toESM(require_react(), 1); + +// node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +function hasWindow() { + return typeof window !== "undefined"; +} +function getNodeName(node) { + if (isNode(node)) { + return (node.nodeName || "").toLowerCase(); + } + return "#document"; +} +function getWindow(node) { + var _node$ownerDocument; + return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; +} +function getDocumentElement(node) { + var _ref; + return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; +} +function isNode(value) { + if (!hasWindow()) { + return false; + } + return value instanceof Node || value instanceof getWindow(value).Node; +} +function isElement(value) { + if (!hasWindow()) { + return false; + } + return value instanceof Element || value instanceof getWindow(value).Element; +} +function isHTMLElement(value) { + if (!hasWindow()) { + return false; + } + return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; +} +function isShadowRoot(value) { + if (!hasWindow() || typeof ShadowRoot === "undefined") { + return false; + } + return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; +} +function isOverflowElement(element) { + const { + overflow, + overflowX, + overflowY, + display + } = getComputedStyle2(element); + return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; +} +function isTableElement(element) { + return /^(table|td|th)$/.test(getNodeName(element)); +} +function isTopLayer(element) { + try { + if (element.matches(":popover-open")) { + return true; + } + } catch (_e) { + } + try { + return element.matches(":modal"); + } catch (_e) { + return false; + } +} +var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; +var containRe = /paint|layout|strict|content/; +var isNotNone = (value) => !!value && value !== "none"; +var isWebKitValue; +function isContainingBlock(elementOrCss) { + const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; + return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || ""); +} +function getContainingBlock(element) { + let currentNode = getParentNode(element); + while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { + if (isContainingBlock(currentNode)) { + return currentNode; + } else if (isTopLayer(currentNode)) { + return null; + } + currentNode = getParentNode(currentNode); + } + return null; +} +function isWebKit() { + if (isWebKitValue == null) { + isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); + } + return isWebKitValue; +} +function isLastTraversableNode(node) { + return /^(html|body|#document)$/.test(getNodeName(node)); +} +function getComputedStyle2(element) { + return getWindow(element).getComputedStyle(element); +} +function getNodeScroll(element) { + if (isElement(element)) { + return { + scrollLeft: element.scrollLeft, + scrollTop: element.scrollTop + }; + } + return { + scrollLeft: element.scrollX, + scrollTop: element.scrollY + }; +} +function getParentNode(node) { + if (getNodeName(node) === "html") { + return node; + } + const result = ( + // Step into the shadow DOM of the parent of a slotted node. + node.assignedSlot || // DOM Element detected. + node.parentNode || // ShadowRoot detected. + isShadowRoot(node) && node.host || // Fallback. + getDocumentElement(node) + ); + return isShadowRoot(result) ? result.host : result; +} +function getNearestOverflowAncestor(node) { + const parentNode = getParentNode(node); + if (isLastTraversableNode(parentNode)) { + return node.ownerDocument ? node.ownerDocument.body : node.body; + } + if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { + return parentNode; + } + return getNearestOverflowAncestor(parentNode); +} +function getOverflowAncestors(node, list, traverseIframes) { + var _node$ownerDocument2; + if (list === void 0) { + list = []; + } + if (traverseIframes === void 0) { + traverseIframes = true; + } + const scrollableAncestor = getNearestOverflowAncestor(node); + const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); + const win = getWindow(scrollableAncestor); + if (isBody) { + const frameElement = getFrameElement(win); + return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); + } else { + return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); + } +} +function getFrameElement(win) { + return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; +} + +// node_modules/@base-ui/react/esm/internals/composite/root/CompositeRootContext.js +var React13 = __toESM(require_react(), 1); +var CompositeRootContext = /* @__PURE__ */ React13.createContext(void 0); +if (true) CompositeRootContext.displayName = "CompositeRootContext"; +function useCompositeRootContext(optional = false) { + const context = React13.useContext(CompositeRootContext); + if (context === void 0 && !optional) { + throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within ." : formatErrorMessage_default(16)); + } + return context; +} + +// node_modules/@base-ui/react/esm/utils/useFocusableWhenDisabled.js +var React14 = __toESM(require_react(), 1); +function useFocusableWhenDisabled(parameters) { + const { + focusableWhenDisabled, + disabled: disabled2, + composite = false, + tabIndex: tabIndexProp = 0, + isNativeButton + } = parameters; + const isFocusableComposite = composite && focusableWhenDisabled !== false; + const isNonFocusableComposite = composite && focusableWhenDisabled === false; + const props = React14.useMemo(() => { + const additionalProps = { + // allow Tabbing away from focusableWhenDisabled elements + onKeyDown(event) { + if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { + event.preventDefault(); + } + } + }; + if (!composite) { + additionalProps.tabIndex = tabIndexProp; + if (!isNativeButton && disabled2) { + additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; + } + } + if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { + additionalProps["aria-disabled"] = disabled2; + } + if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { + additionalProps.disabled = disabled2; + } + return additionalProps; + }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); + return { + props + }; +} + +// node_modules/@base-ui/react/esm/internals/use-button/useButton.js +function useButton(parameters = {}) { + const { + disabled: disabled2 = false, + focusableWhenDisabled, + tabIndex = 0, + native: isNativeButton = true, + composite: compositeProp + } = parameters; + const elementRef = React15.useRef(null); + const compositeRootContext = useCompositeRootContext(true); + const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; + const { + props: focusableWhenDisabledProps + } = useFocusableWhenDisabled({ + focusableWhenDisabled, + disabled: disabled2, + composite: isCompositeItem, + tabIndex, + isNativeButton + }); + if (true) { + React15.useEffect(() => { + if (!elementRef.current) { + return; + } + const isButtonTag = isButtonElement(elementRef.current); + if (isNativeButton) { + if (!isButtonTag) { + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; + const message = "A component that acts as a button expected a native