[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> block-directory.js (source)

   1  (function() {
   2  var wp;
   3  (wp ||= {}).blockDirectory = (() => {
   4    var __create = Object.create;
   5    var __defProp = Object.defineProperty;
   6    var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
   7    var __getOwnPropNames = Object.getOwnPropertyNames;
   8    var __getProtoOf = Object.getPrototypeOf;
   9    var __hasOwnProp = Object.prototype.hasOwnProperty;
  10    var __commonJS = (cb, mod) => function __require() {
  11      return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  12    };
  13    var __export = (target, all) => {
  14      for (var name in all)
  15        __defProp(target, name, { get: all[name], enumerable: true });
  16    };
  17    var __copyProps = (to, from, except, desc) => {
  18      if (from && typeof from === "object" || typeof from === "function") {
  19        for (let key of __getOwnPropNames(from))
  20          if (!__hasOwnProp.call(to, key) && key !== except)
  21            __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  22      }
  23      return to;
  24    };
  25    var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  26      // If the importer is in node compatibility mode or this is not an ESM
  27      // file that has been converted to a CommonJS file using a Babel-
  28      // compatible transform (i.e. "__esModule" has not been set), then set
  29      // "default" to the CommonJS "module.exports" for node compatibility.
  30      isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  31      mod
  32    ));
  33    var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  34  
  35    // package-external:@wordpress/plugins
  36    var require_plugins = __commonJS({
  37      "package-external:@wordpress/plugins"(exports, module) {
  38        module.exports = window.wp.plugins;
  39      }
  40    });
  41  
  42    // package-external:@wordpress/hooks
  43    var require_hooks = __commonJS({
  44      "package-external:@wordpress/hooks"(exports, module) {
  45        module.exports = window.wp.hooks;
  46      }
  47    });
  48  
  49    // package-external:@wordpress/blocks
  50    var require_blocks = __commonJS({
  51      "package-external:@wordpress/blocks"(exports, module) {
  52        module.exports = window.wp.blocks;
  53      }
  54    });
  55  
  56    // package-external:@wordpress/data
  57    var require_data = __commonJS({
  58      "package-external:@wordpress/data"(exports, module) {
  59        module.exports = window.wp.data;
  60      }
  61    });
  62  
  63    // package-external:@wordpress/element
  64    var require_element = __commonJS({
  65      "package-external:@wordpress/element"(exports, module) {
  66        module.exports = window.wp.element;
  67      }
  68    });
  69  
  70    // package-external:@wordpress/editor
  71    var require_editor = __commonJS({
  72      "package-external:@wordpress/editor"(exports, module) {
  73        module.exports = window.wp.editor;
  74      }
  75    });
  76  
  77    // package-external:@wordpress/block-editor
  78    var require_block_editor = __commonJS({
  79      "package-external:@wordpress/block-editor"(exports, module) {
  80        module.exports = window.wp.blockEditor;
  81      }
  82    });
  83  
  84    // package-external:@wordpress/i18n
  85    var require_i18n = __commonJS({
  86      "package-external:@wordpress/i18n"(exports, module) {
  87        module.exports = window.wp.i18n;
  88      }
  89    });
  90  
  91    // package-external:@wordpress/api-fetch
  92    var require_api_fetch = __commonJS({
  93      "package-external:@wordpress/api-fetch"(exports, module) {
  94        module.exports = window.wp.apiFetch;
  95      }
  96    });
  97  
  98    // package-external:@wordpress/notices
  99    var require_notices = __commonJS({
 100      "package-external:@wordpress/notices"(exports, module) {
 101        module.exports = window.wp.notices;
 102      }
 103    });
 104  
 105    // package-external:@wordpress/url
 106    var require_url = __commonJS({
 107      "package-external:@wordpress/url"(exports, module) {
 108        module.exports = window.wp.url;
 109      }
 110    });
 111  
 112    // package-external:@wordpress/compose
 113    var require_compose = __commonJS({
 114      "package-external:@wordpress/compose"(exports, module) {
 115        module.exports = window.wp.compose;
 116      }
 117    });
 118  
 119    // package-external:@wordpress/components
 120    var require_components = __commonJS({
 121      "package-external:@wordpress/components"(exports, module) {
 122        module.exports = window.wp.components;
 123      }
 124    });
 125  
 126    // package-external:@wordpress/core-data
 127    var require_core_data = __commonJS({
 128      "package-external:@wordpress/core-data"(exports, module) {
 129        module.exports = window.wp.coreData;
 130      }
 131    });
 132  
 133    // package-external:@wordpress/html-entities
 134    var require_html_entities = __commonJS({
 135      "package-external:@wordpress/html-entities"(exports, module) {
 136        module.exports = window.wp.htmlEntities;
 137      }
 138    });
 139  
 140    // vendor-external:react
 141    var require_react = __commonJS({
 142      "vendor-external:react"(exports, module) {
 143        module.exports = window.React;
 144      }
 145    });
 146  
 147    // vendor-external:react/jsx-runtime
 148    var require_jsx_runtime = __commonJS({
 149      "vendor-external:react/jsx-runtime"(exports, module) {
 150        module.exports = window.ReactJSXRuntime;
 151      }
 152    });
 153  
 154    // vendor-external:react-dom
 155    var require_react_dom = __commonJS({
 156      "vendor-external:react-dom"(exports, module) {
 157        module.exports = window.ReactDOM;
 158      }
 159    });
 160  
 161    // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
 162    var require_use_sync_external_store_shim_development = __commonJS({
 163      "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
 164        "use strict";
 165        (function() {
 166          function is(x, y) {
 167            return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
 168          }
 169          function useSyncExternalStore$2(subscribe, getSnapshot) {
 170            didWarnOld18Alpha || void 0 === React48.startTransition || (didWarnOld18Alpha = true, console.error(
 171              "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."
 172            ));
 173            var value = getSnapshot();
 174            if (!didWarnUncachedGetSnapshot) {
 175              var cachedValue = getSnapshot();
 176              objectIs(value, cachedValue) || (console.error(
 177                "The result of getSnapshot should be cached to avoid an infinite loop"
 178              ), didWarnUncachedGetSnapshot = true);
 179            }
 180            cachedValue = useState13({
 181              inst: { value, getSnapshot }
 182            });
 183            var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
 184            useLayoutEffect3(
 185              function() {
 186                inst.value = value;
 187                inst.getSnapshot = getSnapshot;
 188                checkIfSnapshotChanged(inst) && forceUpdate({ inst });
 189              },
 190              [subscribe, value, getSnapshot]
 191            );
 192            useEffect13(
 193              function() {
 194                checkIfSnapshotChanged(inst) && forceUpdate({ inst });
 195                return subscribe(function() {
 196                  checkIfSnapshotChanged(inst) && forceUpdate({ inst });
 197                });
 198              },
 199              [subscribe]
 200            );
 201            useDebugValue2(value);
 202            return value;
 203          }
 204          function checkIfSnapshotChanged(inst) {
 205            var latestGetSnapshot = inst.getSnapshot;
 206            inst = inst.value;
 207            try {
 208              var nextValue = latestGetSnapshot();
 209              return !objectIs(inst, nextValue);
 210            } catch (error) {
 211              return true;
 212            }
 213          }
 214          function useSyncExternalStore$1(subscribe, getSnapshot) {
 215            return getSnapshot();
 216          }
 217          "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
 218          var React48 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState13 = React48.useState, useEffect13 = React48.useEffect, useLayoutEffect3 = React48.useLayoutEffect, useDebugValue2 = React48.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
 219          exports.useSyncExternalStore = void 0 !== React48.useSyncExternalStore ? React48.useSyncExternalStore : shim;
 220          "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
 221        })();
 222      }
 223    });
 224  
 225    // node_modules/use-sync-external-store/shim/index.js
 226    var require_shim = __commonJS({
 227      "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
 228        "use strict";
 229        if (false) {
 230          module.exports = null;
 231        } else {
 232          module.exports = require_use_sync_external_store_shim_development();
 233        }
 234      }
 235    });
 236  
 237    // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
 238    var require_with_selector_development = __commonJS({
 239      "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) {
 240        "use strict";
 241        (function() {
 242          function is(x, y) {
 243            return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
 244          }
 245          "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
 246          var React48 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef18 = React48.useRef, useEffect13 = React48.useEffect, useMemo16 = React48.useMemo, useDebugValue2 = React48.useDebugValue;
 247          exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
 248            var instRef = useRef18(null);
 249            if (null === instRef.current) {
 250              var inst = { hasValue: false, value: null };
 251              instRef.current = inst;
 252            } else inst = instRef.current;
 253            instRef = useMemo16(
 254              function() {
 255                function memoizedSelector(nextSnapshot) {
 256                  if (!hasMemo) {
 257                    hasMemo = true;
 258                    memoizedSnapshot = nextSnapshot;
 259                    nextSnapshot = selector(nextSnapshot);
 260                    if (void 0 !== isEqual && inst.hasValue) {
 261                      var currentSelection = inst.value;
 262                      if (isEqual(currentSelection, nextSnapshot))
 263                        return memoizedSelection = currentSelection;
 264                    }
 265                    return memoizedSelection = nextSnapshot;
 266                  }
 267                  currentSelection = memoizedSelection;
 268                  if (objectIs(memoizedSnapshot, nextSnapshot))
 269                    return currentSelection;
 270                  var nextSelection = selector(nextSnapshot);
 271                  if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
 272                    return memoizedSnapshot = nextSnapshot, currentSelection;
 273                  memoizedSnapshot = nextSnapshot;
 274                  return memoizedSelection = nextSelection;
 275                }
 276                var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
 277                return [
 278                  function() {
 279                    return memoizedSelector(getSnapshot());
 280                  },
 281                  null === maybeGetServerSnapshot ? void 0 : function() {
 282                    return memoizedSelector(maybeGetServerSnapshot());
 283                  }
 284                ];
 285              },
 286              [getSnapshot, getServerSnapshot, selector, isEqual]
 287            );
 288            var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]);
 289            useEffect13(
 290              function() {
 291                inst.hasValue = true;
 292                inst.value = value;
 293              },
 294              [value]
 295            );
 296            useDebugValue2(value);
 297            return value;
 298          };
 299          "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
 300        })();
 301      }
 302    });
 303  
 304    // node_modules/use-sync-external-store/shim/with-selector.js
 305    var require_with_selector = __commonJS({
 306      "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) {
 307        "use strict";
 308        if (false) {
 309          module.exports = null;
 310        } else {
 311          module.exports = require_with_selector_development();
 312        }
 313      }
 314    });
 315  
 316    // package-external:@wordpress/theme
 317    var require_theme = __commonJS({
 318      "package-external:@wordpress/theme"(exports, module) {
 319        module.exports = window.wp.theme;
 320      }
 321    });
 322  
 323    // package-external:@wordpress/private-apis
 324    var require_private_apis = __commonJS({
 325      "package-external:@wordpress/private-apis"(exports, module) {
 326        module.exports = window.wp.privateApis;
 327      }
 328    });
 329  
 330    // package-external:@wordpress/primitives
 331    var require_primitives = __commonJS({
 332      "package-external:@wordpress/primitives"(exports, module) {
 333        module.exports = window.wp.primitives;
 334      }
 335    });
 336  
 337    // package-external:@wordpress/a11y
 338    var require_a11y = __commonJS({
 339      "package-external:@wordpress/a11y"(exports, module) {
 340        module.exports = window.wp.a11y;
 341      }
 342    });
 343  
 344    // packages/block-directory/build-module/index.mjs
 345    var index_exports = {};
 346    __export(index_exports, {
 347      store: () => store
 348    });
 349  
 350    // packages/block-directory/build-module/plugins/index.mjs
 351    var import_plugins = __toESM(require_plugins(), 1);
 352    var import_hooks = __toESM(require_hooks(), 1);
 353  
 354    // packages/block-directory/build-module/components/auto-block-uninstaller/index.mjs
 355    var import_blocks2 = __toESM(require_blocks(), 1);
 356    var import_data4 = __toESM(require_data(), 1);
 357    var import_element = __toESM(require_element(), 1);
 358    var import_editor = __toESM(require_editor(), 1);
 359  
 360    // packages/block-directory/build-module/store/index.mjs
 361    var import_data3 = __toESM(require_data(), 1);
 362  
 363    // packages/block-directory/build-module/store/reducer.mjs
 364    var import_data = __toESM(require_data(), 1);
 365    var downloadableBlocks = (state = {}, action) => {
 366      switch (action.type) {
 367        case "FETCH_DOWNLOADABLE_BLOCKS":
 368          return {
 369            ...state,
 370            [action.filterValue]: {
 371              isRequesting: true
 372            }
 373          };
 374        case "RECEIVE_DOWNLOADABLE_BLOCKS":
 375          return {
 376            ...state,
 377            [action.filterValue]: {
 378              results: action.downloadableBlocks,
 379              isRequesting: false
 380            }
 381          };
 382      }
 383      return state;
 384    };
 385    var blockManagement = (state = {
 386      installedBlockTypes: [],
 387      isInstalling: {}
 388    }, action) => {
 389      switch (action.type) {
 390        case "ADD_INSTALLED_BLOCK_TYPE":
 391          return {
 392            ...state,
 393            installedBlockTypes: [
 394              ...state.installedBlockTypes,
 395              action.item
 396            ]
 397          };
 398        case "REMOVE_INSTALLED_BLOCK_TYPE":
 399          return {
 400            ...state,
 401            installedBlockTypes: state.installedBlockTypes.filter(
 402              (blockType) => blockType.name !== action.item.name
 403            )
 404          };
 405        case "SET_INSTALLING_BLOCK":
 406          return {
 407            ...state,
 408            isInstalling: {
 409              ...state.isInstalling,
 410              [action.blockId]: action.isInstalling
 411            }
 412          };
 413      }
 414      return state;
 415    };
 416    var errorNotices = (state = {}, action) => {
 417      switch (action.type) {
 418        case "SET_ERROR_NOTICE":
 419          return {
 420            ...state,
 421            [action.blockId]: {
 422              message: action.message,
 423              isFatal: action.isFatal
 424            }
 425          };
 426        case "CLEAR_ERROR_NOTICE":
 427          const { [action.blockId]: blockId, ...restState } = state;
 428          return restState;
 429      }
 430      return state;
 431    };
 432    var reducer_default = (0, import_data.combineReducers)({
 433      downloadableBlocks,
 434      blockManagement,
 435      errorNotices
 436    });
 437  
 438    // packages/block-directory/build-module/store/selectors.mjs
 439    var selectors_exports = {};
 440    __export(selectors_exports, {
 441      getDownloadableBlocks: () => getDownloadableBlocks,
 442      getErrorNoticeForBlock: () => getErrorNoticeForBlock,
 443      getErrorNotices: () => getErrorNotices,
 444      getInstalledBlockTypes: () => getInstalledBlockTypes,
 445      getNewBlockTypes: () => getNewBlockTypes,
 446      getUnusedBlockTypes: () => getUnusedBlockTypes,
 447      isInstalling: () => isInstalling,
 448      isRequestingDownloadableBlocks: () => isRequestingDownloadableBlocks
 449    });
 450    var import_data2 = __toESM(require_data(), 1);
 451    var import_block_editor = __toESM(require_block_editor(), 1);
 452    var EMPTY_ARRAY = [];
 453    function isRequestingDownloadableBlocks(state, filterValue) {
 454      return state.downloadableBlocks[filterValue]?.isRequesting ?? false;
 455    }
 456    function getDownloadableBlocks(state, filterValue) {
 457      return state.downloadableBlocks[filterValue]?.results ?? EMPTY_ARRAY;
 458    }
 459    function getInstalledBlockTypes(state) {
 460      return state.blockManagement.installedBlockTypes;
 461    }
 462    var getNewBlockTypes = (0, import_data2.createRegistrySelector)(
 463      (select) => (0, import_data2.createSelector)(
 464        (state) => {
 465          const installedBlockTypes = getInstalledBlockTypes(state);
 466          if (!installedBlockTypes.length) {
 467            return EMPTY_ARRAY;
 468          }
 469          const { getBlockName, getClientIdsWithDescendants } = select(import_block_editor.store);
 470          const installedBlockNames = installedBlockTypes.map(
 471            (blockType) => blockType.name
 472          );
 473          const foundBlockNames = getClientIdsWithDescendants().flatMap(
 474            (clientId) => {
 475              const blockName = getBlockName(clientId);
 476              return installedBlockNames.includes(blockName) ? blockName : [];
 477            }
 478          );
 479          const newBlockTypes = installedBlockTypes.filter(
 480            (blockType) => foundBlockNames.includes(blockType.name)
 481          );
 482          return newBlockTypes.length > 0 ? newBlockTypes : EMPTY_ARRAY;
 483        },
 484        (state) => [
 485          getInstalledBlockTypes(state),
 486          select(import_block_editor.store).getClientIdsWithDescendants()
 487        ]
 488      )
 489    );
 490    var getUnusedBlockTypes = (0, import_data2.createRegistrySelector)(
 491      (select) => (0, import_data2.createSelector)(
 492        (state) => {
 493          const installedBlockTypes = getInstalledBlockTypes(state);
 494          if (!installedBlockTypes.length) {
 495            return EMPTY_ARRAY;
 496          }
 497          const { getBlockName, getClientIdsWithDescendants } = select(import_block_editor.store);
 498          const installedBlockNames = installedBlockTypes.map(
 499            (blockType) => blockType.name
 500          );
 501          const foundBlockNames = getClientIdsWithDescendants().flatMap(
 502            (clientId) => {
 503              const blockName = getBlockName(clientId);
 504              return installedBlockNames.includes(blockName) ? blockName : [];
 505            }
 506          );
 507          const unusedBlockTypes = installedBlockTypes.filter(
 508            (blockType) => !foundBlockNames.includes(blockType.name)
 509          );
 510          return unusedBlockTypes.length > 0 ? unusedBlockTypes : EMPTY_ARRAY;
 511        },
 512        (state) => [
 513          getInstalledBlockTypes(state),
 514          select(import_block_editor.store).getClientIdsWithDescendants()
 515        ]
 516      )
 517    );
 518    function isInstalling(state, blockId) {
 519      return state.blockManagement.isInstalling[blockId] || false;
 520    }
 521    function getErrorNotices(state) {
 522      return state.errorNotices;
 523    }
 524    function getErrorNoticeForBlock(state, blockId) {
 525      return state.errorNotices[blockId];
 526    }
 527  
 528    // packages/block-directory/build-module/store/actions.mjs
 529    var actions_exports = {};
 530    __export(actions_exports, {
 531      addInstalledBlockType: () => addInstalledBlockType,
 532      clearErrorNotice: () => clearErrorNotice,
 533      fetchDownloadableBlocks: () => fetchDownloadableBlocks,
 534      installBlockType: () => installBlockType,
 535      receiveDownloadableBlocks: () => receiveDownloadableBlocks,
 536      removeInstalledBlockType: () => removeInstalledBlockType,
 537      setErrorNotice: () => setErrorNotice,
 538      setIsInstalling: () => setIsInstalling,
 539      uninstallBlockType: () => uninstallBlockType
 540    });
 541    var import_blocks = __toESM(require_blocks(), 1);
 542    var import_i18n = __toESM(require_i18n(), 1);
 543    var import_api_fetch2 = __toESM(require_api_fetch(), 1);
 544    var import_notices = __toESM(require_notices(), 1);
 545    var import_url = __toESM(require_url(), 1);
 546  
 547    // packages/block-directory/build-module/store/load-assets.mjs
 548    var import_api_fetch = __toESM(require_api_fetch(), 1);
 549    var loadAsset = (el) => {
 550      return new Promise((resolve, reject) => {
 551        const newNode = document.createElement(el.nodeName);
 552        ["id", "rel", "src", "href", "type"].forEach((attr2) => {
 553          if (el[attr2]) {
 554            newNode[attr2] = el[attr2];
 555          }
 556        });
 557        if (el.innerHTML) {
 558          newNode.appendChild(document.createTextNode(el.innerHTML));
 559        }
 560        newNode.onload = () => resolve(true);
 561        newNode.onerror = () => reject(new Error("Error loading asset."));
 562        document.body.appendChild(newNode);
 563        if ("link" === newNode.nodeName.toLowerCase() || "script" === newNode.nodeName.toLowerCase() && !newNode.src) {
 564          resolve();
 565        }
 566      });
 567    };
 568    async function loadAssets() {
 569      const response = await (0, import_api_fetch.default)({
 570        url: document.location.href,
 571        parse: false
 572      });
 573      const data = await response.text();
 574      const doc = new window.DOMParser().parseFromString(data, "text/html");
 575      const newAssets = Array.from(
 576        doc.querySelectorAll('link[rel="stylesheet"],script')
 577      ).filter((asset) => asset.id && !document.getElementById(asset.id));
 578      for (const newAsset of newAssets) {
 579        await loadAsset(newAsset);
 580      }
 581    }
 582  
 583    // packages/block-directory/build-module/store/utils/get-plugin-url.mjs
 584    function getPluginUrl(block) {
 585      if (!block) {
 586        return false;
 587      }
 588      const link = block.links["wp:plugin"] || block.links.self;
 589      if (link && link.length) {
 590        return link[0].href;
 591      }
 592      return false;
 593    }
 594  
 595    // packages/block-directory/build-module/store/actions.mjs
 596    function fetchDownloadableBlocks(filterValue) {
 597      return { type: "FETCH_DOWNLOADABLE_BLOCKS", filterValue };
 598    }
 599    function receiveDownloadableBlocks(downloadableBlocks2, filterValue) {
 600      return {
 601        type: "RECEIVE_DOWNLOADABLE_BLOCKS",
 602        downloadableBlocks: downloadableBlocks2,
 603        filterValue
 604      };
 605    }
 606    var installBlockType = (block) => async ({ registry, dispatch }) => {
 607      const { id, name } = block;
 608      let success = false;
 609      dispatch.clearErrorNotice(id);
 610      try {
 611        dispatch.setIsInstalling(id, true);
 612        const url = getPluginUrl(block);
 613        let links = {};
 614        if (url) {
 615          await (0, import_api_fetch2.default)({
 616            method: "PUT",
 617            url,
 618            data: { status: "active" }
 619          });
 620        } else {
 621          const response = await (0, import_api_fetch2.default)({
 622            method: "POST",
 623            path: "wp/v2/plugins",
 624            data: { slug: id, status: "active" }
 625          });
 626          links = response._links;
 627        }
 628        dispatch.addInstalledBlockType({
 629          ...block,
 630          links: { ...block.links, ...links }
 631        });
 632        const metadataFields = [
 633          "api_version",
 634          "title",
 635          "category",
 636          "parent",
 637          "ancestor",
 638          "icon",
 639          "description",
 640          "keywords",
 641          "attributes",
 642          "provides_context",
 643          "uses_context",
 644          "selectors",
 645          "supports",
 646          "styles",
 647          "example",
 648          "variations",
 649          "allowed_blocks",
 650          "block_hooks"
 651        ];
 652        await (0, import_api_fetch2.default)({
 653          path: (0, import_url.addQueryArgs)(`/wp/v2/block-types/$name}`, {
 654            _fields: metadataFields
 655          })
 656        }).catch(() => {
 657        }).then((response) => {
 658          if (!response) {
 659            return;
 660          }
 661          (0, import_blocks.unstable__bootstrapServerSideBlockDefinitions)({
 662            [name]: Object.fromEntries(
 663              Object.entries(response).filter(
 664                ([key]) => metadataFields.includes(key)
 665              )
 666            )
 667          });
 668        });
 669        await loadAssets();
 670        const registeredBlocks = registry.select(import_blocks.store).getBlockTypes();
 671        if (!registeredBlocks.some((i) => i.name === name)) {
 672          throw new Error(
 673            (0, import_i18n.__)("Error registering block. Try reloading the page.")
 674          );
 675        }
 676        registry.dispatch(import_notices.store).createInfoNotice(
 677          (0, import_i18n.sprintf)(
 678            // translators: %s is the block title.
 679            (0, import_i18n.__)("Block %s installed and added."),
 680            block.title
 681          ),
 682          {
 683            speak: true,
 684            type: "snackbar"
 685          }
 686        );
 687        success = true;
 688      } catch (error) {
 689        let message = error.message || (0, import_i18n.__)("An error occurred.");
 690        let isFatal = error instanceof Error;
 691        const fatalAPIErrors = {
 692          folder_exists: (0, import_i18n.__)(
 693            "This block is already installed. Try reloading the page."
 694          ),
 695          unable_to_connect_to_filesystem: (0, import_i18n.__)(
 696            "Error installing block. You can reload the page and try again."
 697          )
 698        };
 699        if (fatalAPIErrors[error.code]) {
 700          isFatal = true;
 701          message = fatalAPIErrors[error.code];
 702        }
 703        dispatch.setErrorNotice(id, message, isFatal);
 704        registry.dispatch(import_notices.store).createErrorNotice(message, {
 705          speak: true,
 706          isDismissible: true
 707        });
 708      }
 709      dispatch.setIsInstalling(id, false);
 710      return success;
 711    };
 712    var uninstallBlockType = (block) => async ({ registry, dispatch }) => {
 713      try {
 714        const url = getPluginUrl(block);
 715        await (0, import_api_fetch2.default)({
 716          method: "PUT",
 717          url,
 718          data: { status: "inactive" }
 719        });
 720        await (0, import_api_fetch2.default)({
 721          method: "DELETE",
 722          url
 723        });
 724        dispatch.removeInstalledBlockType(block);
 725      } catch (error) {
 726        registry.dispatch(import_notices.store).createErrorNotice(
 727          error.message || (0, import_i18n.__)("An error occurred.")
 728        );
 729      }
 730    };
 731    function addInstalledBlockType(item) {
 732      return {
 733        type: "ADD_INSTALLED_BLOCK_TYPE",
 734        item
 735      };
 736    }
 737    function removeInstalledBlockType(item) {
 738      return {
 739        type: "REMOVE_INSTALLED_BLOCK_TYPE",
 740        item
 741      };
 742    }
 743    function setIsInstalling(blockId, isInstalling2) {
 744      return {
 745        type: "SET_INSTALLING_BLOCK",
 746        blockId,
 747        isInstalling: isInstalling2
 748      };
 749    }
 750    function setErrorNotice(blockId, message, isFatal = false) {
 751      return {
 752        type: "SET_ERROR_NOTICE",
 753        blockId,
 754        message,
 755        isFatal
 756      };
 757    }
 758    function clearErrorNotice(blockId) {
 759      return {
 760        type: "CLEAR_ERROR_NOTICE",
 761        blockId
 762      };
 763    }
 764  
 765    // packages/block-directory/build-module/store/resolvers.mjs
 766    var resolvers_exports = {};
 767    __export(resolvers_exports, {
 768      getDownloadableBlocks: () => getDownloadableBlocks2
 769    });
 770  
 771    // node_modules/tslib/tslib.es6.mjs
 772    var __assign = function() {
 773      __assign = Object.assign || function __assign2(t) {
 774        for (var s, i = 1, n = arguments.length; i < n; i++) {
 775          s = arguments[i];
 776          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
 777        }
 778        return t;
 779      };
 780      return __assign.apply(this, arguments);
 781    };
 782  
 783    // node_modules/lower-case/dist.es2015/index.js
 784    function lowerCase(str) {
 785      return str.toLowerCase();
 786    }
 787  
 788    // node_modules/no-case/dist.es2015/index.js
 789    var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
 790    var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
 791    function noCase(input, options) {
 792      if (options === void 0) {
 793        options = {};
 794      }
 795      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;
 796      var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
 797      var start = 0;
 798      var end = result.length;
 799      while (result.charAt(start) === "\0")
 800        start++;
 801      while (result.charAt(end - 1) === "\0")
 802        end--;
 803      return result.slice(start, end).split("\0").map(transform).join(delimiter);
 804    }
 805    function replace(input, re, value) {
 806      if (re instanceof RegExp)
 807        return input.replace(re, value);
 808      return re.reduce(function(input2, re2) {
 809        return input2.replace(re2, value);
 810      }, input);
 811    }
 812  
 813    // node_modules/pascal-case/dist.es2015/index.js
 814    function pascalCaseTransform(input, index2) {
 815      var firstChar = input.charAt(0);
 816      var lowerChars = input.substr(1).toLowerCase();
 817      if (index2 > 0 && firstChar >= "0" && firstChar <= "9") {
 818        return "_" + firstChar + lowerChars;
 819      }
 820      return "" + firstChar.toUpperCase() + lowerChars;
 821    }
 822    function pascalCase(input, options) {
 823      if (options === void 0) {
 824        options = {};
 825      }
 826      return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options));
 827    }
 828  
 829    // node_modules/camel-case/dist.es2015/index.js
 830    function camelCaseTransform(input, index2) {
 831      if (index2 === 0)
 832        return input.toLowerCase();
 833      return pascalCaseTransform(input, index2);
 834    }
 835    function camelCase(input, options) {
 836      if (options === void 0) {
 837        options = {};
 838      }
 839      return pascalCase(input, __assign({ transform: camelCaseTransform }, options));
 840    }
 841  
 842    // packages/block-directory/build-module/store/resolvers.mjs
 843    var import_api_fetch3 = __toESM(require_api_fetch(), 1);
 844    var getDownloadableBlocks2 = (filterValue) => async ({ dispatch }) => {
 845      if (!filterValue) {
 846        return;
 847      }
 848      try {
 849        dispatch(fetchDownloadableBlocks(filterValue));
 850        const results = await (0, import_api_fetch3.default)({
 851          path: `wp/v2/block-directory/search?term=$filterValue}`
 852        });
 853        const blocks = results.map(
 854          (result) => Object.fromEntries(
 855            Object.entries(result).map(([key, value]) => [
 856              camelCase(key),
 857              value
 858            ])
 859          )
 860        );
 861        dispatch(receiveDownloadableBlocks(blocks, filterValue));
 862      } catch {
 863        dispatch(receiveDownloadableBlocks([], filterValue));
 864      }
 865    };
 866  
 867    // packages/block-directory/build-module/store/index.mjs
 868    var STORE_NAME = "core/block-directory";
 869    var storeConfig = {
 870      reducer: reducer_default,
 871      selectors: selectors_exports,
 872      actions: actions_exports,
 873      resolvers: resolvers_exports
 874    };
 875    var store = (0, import_data3.createReduxStore)(STORE_NAME, storeConfig);
 876    (0, import_data3.register)(store);
 877  
 878    // packages/block-directory/build-module/components/auto-block-uninstaller/index.mjs
 879    function AutoBlockUninstaller() {
 880      const { uninstallBlockType: uninstallBlockType2 } = (0, import_data4.useDispatch)(store);
 881      const shouldRemoveBlockTypes = (0, import_data4.useSelect)((select) => {
 882        const { isAutosavingPost, isSavingPost } = select(import_editor.store);
 883        return isSavingPost() && !isAutosavingPost();
 884      }, []);
 885      const unusedBlockTypes = (0, import_data4.useSelect)(
 886        (select) => select(store).getUnusedBlockTypes(),
 887        []
 888      );
 889      (0, import_element.useEffect)(() => {
 890        if (shouldRemoveBlockTypes && unusedBlockTypes.length) {
 891          unusedBlockTypes.forEach((blockType) => {
 892            uninstallBlockType2(blockType);
 893            (0, import_blocks2.unregisterBlockType)(blockType.name);
 894          });
 895        }
 896      }, [shouldRemoveBlockTypes]);
 897      return null;
 898    }
 899  
 900    // packages/block-directory/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.mjs
 901    var import_block_editor3 = __toESM(require_block_editor(), 1);
 902    var import_compose = __toESM(require_compose(), 1);
 903    var import_element20 = __toESM(require_element(), 1);
 904  
 905    // packages/block-directory/build-module/components/downloadable-blocks-panel/index.mjs
 906    var import_i18n9 = __toESM(require_i18n(), 1);
 907    var import_components4 = __toESM(require_components(), 1);
 908    var import_core_data = __toESM(require_core_data(), 1);
 909    var import_data8 = __toESM(require_data(), 1);
 910    var import_blocks5 = __toESM(require_blocks(), 1);
 911  
 912    // packages/block-directory/build-module/components/downloadable-blocks-list/index.mjs
 913    var import_i18n6 = __toESM(require_i18n(), 1);
 914    var import_components2 = __toESM(require_components(), 1);
 915    var import_blocks4 = __toESM(require_blocks(), 1);
 916    var import_data7 = __toESM(require_data(), 1);
 917  
 918    // node_modules/clsx/dist/clsx.mjs
 919    function r(e) {
 920      var t, f, n = "";
 921      if ("string" == typeof e || "number" == typeof e) n += e;
 922      else if ("object" == typeof e) if (Array.isArray(e)) {
 923        var o = e.length;
 924        for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
 925      } else for (f in e) e[f] && (n && (n += " "), n += f);
 926      return n;
 927    }
 928    function clsx() {
 929      for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
 930      return n;
 931    }
 932    var clsx_default = clsx;
 933  
 934    // packages/block-directory/build-module/components/downloadable-block-list-item/index.mjs
 935    var import_i18n5 = __toESM(require_i18n(), 1);
 936    var import_components = __toESM(require_components(), 1);
 937    var import_element18 = __toESM(require_element(), 1);
 938    var import_html_entities = __toESM(require_html_entities(), 1);
 939    var import_blocks3 = __toESM(require_blocks(), 1);
 940    var import_data6 = __toESM(require_data(), 1);
 941  
 942    // node_modules/@base-ui/utils/safeReact.mjs
 943    var React = __toESM(require_react(), 1);
 944    var SafeReact = {
 945      ...React
 946    };
 947  
 948    // node_modules/@base-ui/utils/useRefWithInit.mjs
 949    var React2 = __toESM(require_react(), 1);
 950    var UNINITIALIZED = {};
 951    function useRefWithInit(init, initArg) {
 952      const ref = React2.useRef(UNINITIALIZED);
 953      if (ref.current === UNINITIALIZED) {
 954        ref.current = init(initArg);
 955      }
 956      return ref;
 957    }
 958  
 959    // node_modules/@base-ui/utils/useStableCallback.mjs
 960    var useInsertionEffect = SafeReact.useInsertionEffect;
 961    var useSafeInsertionEffect = (
 962      // React 17 doesn't have useInsertionEffect.
 963      useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
 964      useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn()
 965    );
 966    function useStableCallback(callback) {
 967      const stable = useRefWithInit(createStableCallback).current;
 968      stable.next = callback;
 969      useSafeInsertionEffect(stable.effect);
 970      return stable.trampoline;
 971    }
 972    function createStableCallback() {
 973      const stable = {
 974        next: void 0,
 975        callback: assertNotCalled,
 976        trampoline: (...args) => stable.callback?.(...args),
 977        effect: () => {
 978          stable.callback = stable.next;
 979        }
 980      };
 981      return stable;
 982    }
 983    function assertNotCalled() {
 984      if (true) {
 985        throw (
 986          /* minify-error-disabled */
 987          new Error("Base UI: Cannot call an event handler while rendering.")
 988        );
 989      }
 990    }
 991  
 992    // node_modules/@base-ui/utils/warn.mjs
 993    var set;
 994    if (true) {
 995      set = /* @__PURE__ */ new Set();
 996    }
 997    function warn(...messages) {
 998      if (true) {
 999        const messageKey = messages.join(" ");
1000        if (!set.has(messageKey)) {
1001          set.add(messageKey);
1002          console.warn(`Base UI: $messageKey}`);
1003        }
1004      }
1005    }
1006  
1007    // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs
1008    var React3 = __toESM(require_react(), 1);
1009    var noop = () => {
1010    };
1011    var useIsoLayoutEffect = typeof document !== "undefined" ? React3.useLayoutEffect : noop;
1012  
1013    // node_modules/@base-ui/react/internals/useRenderElement.mjs
1014    var React6 = __toESM(require_react(), 1);
1015  
1016    // node_modules/@base-ui/utils/useMergedRefs.mjs
1017    function useMergedRefs(a, b, c, d) {
1018      const forkRef = useRefWithInit(createForkRef).current;
1019      if (didChange(forkRef, a, b, c, d)) {
1020        update(forkRef, [a, b, c, d]);
1021      }
1022      return forkRef.callback;
1023    }
1024    function useMergedRefsN(refs) {
1025      const forkRef = useRefWithInit(createForkRef).current;
1026      if (didChangeN(forkRef, refs)) {
1027        update(forkRef, refs);
1028      }
1029      return forkRef.callback;
1030    }
1031    function createForkRef() {
1032      return {
1033        callback: null,
1034        cleanup: null,
1035        refs: []
1036      };
1037    }
1038    function didChange(forkRef, a, b, c, d) {
1039      return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
1040    }
1041    function didChangeN(forkRef, newRefs) {
1042      return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]);
1043    }
1044    function update(forkRef, refs) {
1045      forkRef.refs = refs;
1046      if (refs.every((ref) => ref == null)) {
1047        forkRef.callback = null;
1048        return;
1049      }
1050      forkRef.callback = (instance) => {
1051        if (forkRef.cleanup) {
1052          forkRef.cleanup();
1053          forkRef.cleanup = null;
1054        }
1055        if (instance != null) {
1056          const cleanupCallbacks = Array(refs.length).fill(null);
1057          for (let i = 0; i < refs.length; i += 1) {
1058            const ref = refs[i];
1059            if (ref == null) {
1060              continue;
1061            }
1062            switch (typeof ref) {
1063              case "function": {
1064                const refCleanup = ref(instance);
1065                if (typeof refCleanup === "function") {
1066                  cleanupCallbacks[i] = refCleanup;
1067                }
1068                break;
1069              }
1070              case "object": {
1071                ref.current = instance;
1072                break;
1073              }
1074              default:
1075            }
1076          }
1077          forkRef.cleanup = () => {
1078            for (let i = 0; i < refs.length; i += 1) {
1079              const ref = refs[i];
1080              if (ref == null) {
1081                continue;
1082              }
1083              switch (typeof ref) {
1084                case "function": {
1085                  const cleanupCallback = cleanupCallbacks[i];
1086                  if (typeof cleanupCallback === "function") {
1087                    cleanupCallback();
1088                  } else {
1089                    void ref(null);
1090                  }
1091                  break;
1092                }
1093                case "object": {
1094                  ref.current = null;
1095                  break;
1096                }
1097                default:
1098              }
1099            }
1100          };
1101        }
1102      };
1103    }
1104  
1105    // node_modules/@base-ui/utils/getReactElementRef.mjs
1106    var React5 = __toESM(require_react(), 1);
1107  
1108    // node_modules/@base-ui/utils/reactVersion.mjs
1109    var React4 = __toESM(require_react(), 1);
1110    var majorVersion = parseInt(React4.version, 10);
1111    function isReactVersionAtLeast(reactVersionToCheck) {
1112      return majorVersion >= reactVersionToCheck;
1113    }
1114  
1115    // node_modules/@base-ui/utils/getReactElementRef.mjs
1116    function getReactElementRef(element) {
1117      if (!/* @__PURE__ */ React5.isValidElement(element)) {
1118        return null;
1119      }
1120      const reactElement = element;
1121      const propsWithRef = reactElement.props;
1122      return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
1123    }
1124  
1125    // node_modules/@base-ui/utils/mergeObjects.mjs
1126    function mergeObjects(a, b) {
1127      if (a && !b) {
1128        return a;
1129      }
1130      if (!a && b) {
1131        return b;
1132      }
1133      if (a || b) {
1134        return {
1135          ...a,
1136          ...b
1137        };
1138      }
1139      return void 0;
1140    }
1141  
1142    // node_modules/@base-ui/utils/empty.mjs
1143    function NOOP() {
1144    }
1145    var EMPTY_ARRAY2 = Object.freeze([]);
1146    var EMPTY_OBJECT = Object.freeze({});
1147  
1148    // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs
1149    function getStateAttributesProps(state, customMapping) {
1150      const props = {};
1151      for (const key in state) {
1152        const value = state[key];
1153        if (customMapping?.hasOwnProperty(key)) {
1154          const customProps = customMapping[key](value);
1155          if (customProps != null) {
1156            Object.assign(props, customProps);
1157          }
1158          continue;
1159        }
1160        if (value === true) {
1161          props[`data-$key.toLowerCase()}`] = "";
1162        } else if (value) {
1163          props[`data-$key.toLowerCase()}`] = value.toString();
1164        }
1165      }
1166      return props;
1167    }
1168  
1169    // node_modules/@base-ui/react/utils/resolveClassName.mjs
1170    function resolveClassName(className, state) {
1171      return typeof className === "function" ? className(state) : className;
1172    }
1173  
1174    // node_modules/@base-ui/react/utils/resolveStyle.mjs
1175    function resolveStyle(style, state) {
1176      return typeof style === "function" ? style(state) : style;
1177    }
1178  
1179    // node_modules/@base-ui/react/merge-props/mergeProps.mjs
1180    var EMPTY_PROPS = {};
1181    function mergeProps(a, b, c, d, e) {
1182      if (!c && !d && !e && !a) {
1183        return createInitialMergedProps(b);
1184      }
1185      let merged = createInitialMergedProps(a);
1186      if (b) {
1187        merged = mergeInto(merged, b);
1188      }
1189      if (c) {
1190        merged = mergeInto(merged, c);
1191      }
1192      if (d) {
1193        merged = mergeInto(merged, d);
1194      }
1195      if (e) {
1196        merged = mergeInto(merged, e);
1197      }
1198      return merged;
1199    }
1200    function mergePropsN(props) {
1201      if (props.length === 0) {
1202        return EMPTY_PROPS;
1203      }
1204      if (props.length === 1) {
1205        return createInitialMergedProps(props[0]);
1206      }
1207      let merged = createInitialMergedProps(props[0]);
1208      for (let i = 1; i < props.length; i += 1) {
1209        merged = mergeInto(merged, props[i]);
1210      }
1211      return merged;
1212    }
1213    function createInitialMergedProps(inputProps) {
1214      if (isPropsGetter(inputProps)) {
1215        return {
1216          ...resolvePropsGetter(inputProps, EMPTY_PROPS)
1217        };
1218      }
1219      return copyInitialProps(inputProps);
1220    }
1221    function mergeInto(merged, inputProps) {
1222      if (isPropsGetter(inputProps)) {
1223        return resolvePropsGetter(inputProps, merged);
1224      }
1225      return mutablyMergeInto(merged, inputProps);
1226    }
1227    function copyInitialProps(inputProps) {
1228      const copiedProps = {
1229        ...inputProps
1230      };
1231      for (const propName in copiedProps) {
1232        const propValue = copiedProps[propName];
1233        if (isEventHandler(propName, propValue)) {
1234          copiedProps[propName] = wrapEventHandler(propValue);
1235        }
1236      }
1237      return copiedProps;
1238    }
1239    function mutablyMergeInto(mergedProps, externalProps) {
1240      if (!externalProps) {
1241        return mergedProps;
1242      }
1243      for (const propName in externalProps) {
1244        const externalPropValue = externalProps[propName];
1245        switch (propName) {
1246          case "style": {
1247            mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
1248            break;
1249          }
1250          case "className": {
1251            mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
1252            break;
1253          }
1254          default: {
1255            if (isEventHandler(propName, externalPropValue)) {
1256              mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
1257            } else {
1258              mergedProps[propName] = externalPropValue;
1259            }
1260          }
1261        }
1262      }
1263      return mergedProps;
1264    }
1265    function isEventHandler(key, value) {
1266      const code0 = key.charCodeAt(0);
1267      const code1 = key.charCodeAt(1);
1268      const code2 = key.charCodeAt(2);
1269      return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
1270    }
1271    function isPropsGetter(inputProps) {
1272      return typeof inputProps === "function";
1273    }
1274    function resolvePropsGetter(inputProps, previousProps) {
1275      if (isPropsGetter(inputProps)) {
1276        return inputProps(previousProps);
1277      }
1278      return inputProps ?? EMPTY_PROPS;
1279    }
1280    function mergeEventHandlers(ourHandler, theirHandler) {
1281      if (!theirHandler) {
1282        return ourHandler;
1283      }
1284      if (!ourHandler) {
1285        return wrapEventHandler(theirHandler);
1286      }
1287      return (...args) => {
1288        const event = args[0];
1289        if (isSyntheticEvent(event)) {
1290          const baseUIEvent = event;
1291          makeEventPreventable(baseUIEvent);
1292          const result2 = theirHandler(...args);
1293          if (!baseUIEvent.baseUIHandlerPrevented) {
1294            ourHandler?.(...args);
1295          }
1296          return result2;
1297        }
1298        const result = theirHandler(...args);
1299        ourHandler?.(...args);
1300        return result;
1301      };
1302    }
1303    function wrapEventHandler(handler) {
1304      if (!handler) {
1305        return handler;
1306      }
1307      return (...args) => {
1308        const event = args[0];
1309        if (isSyntheticEvent(event)) {
1310          makeEventPreventable(event);
1311        }
1312        return handler(...args);
1313      };
1314    }
1315    function makeEventPreventable(event) {
1316      event.preventBaseUIHandler = () => {
1317        event.baseUIHandlerPrevented = true;
1318      };
1319      return event;
1320    }
1321    function mergeClassNames(ourClassName, theirClassName) {
1322      if (theirClassName) {
1323        if (ourClassName) {
1324          return theirClassName + " " + ourClassName;
1325        }
1326        return theirClassName;
1327      }
1328      return ourClassName;
1329    }
1330    function isSyntheticEvent(event) {
1331      return event != null && typeof event === "object" && "nativeEvent" in event;
1332    }
1333  
1334    // node_modules/@base-ui/react/internals/useRenderElement.mjs
1335    var import_react = __toESM(require_react(), 1);
1336    function useRenderElement(element, componentProps, params = {}) {
1337      const renderProp = componentProps.render;
1338      const outProps = useRenderElementProps(componentProps, params);
1339      if (params.enabled === false) {
1340        return null;
1341      }
1342      const state = params.state ?? EMPTY_OBJECT;
1343      return evaluateRenderProp(element, renderProp, outProps, state);
1344    }
1345    function useRenderElementProps(componentProps, params = {}) {
1346      const {
1347        className: classNameProp,
1348        style: styleProp,
1349        render: renderProp
1350      } = componentProps;
1351      const {
1352        state = EMPTY_OBJECT,
1353        ref,
1354        props,
1355        stateAttributesMapping,
1356        enabled = true
1357      } = params;
1358      const className = enabled ? resolveClassName(classNameProp, state) : void 0;
1359      const style = enabled ? resolveStyle(styleProp, state) : void 0;
1360      const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;
1361      const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
1362      const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
1363      if (typeof document !== "undefined") {
1364        if (!enabled) {
1365          void useMergedRefs(null, null);
1366        } else if (Array.isArray(ref)) {
1367          outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
1368        } else {
1369          outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
1370        }
1371      }
1372      if (!enabled) {
1373        return EMPTY_OBJECT;
1374      }
1375      if (className !== void 0) {
1376        outProps.className = mergeClassNames(outProps.className, className);
1377      }
1378      if (style !== void 0) {
1379        outProps.style = mergeObjects(outProps.style, style);
1380      }
1381      return outProps;
1382    }
1383    function resolveRenderFunctionProps(props) {
1384      if (Array.isArray(props)) {
1385        return mergePropsN(props);
1386      }
1387      return mergeProps(void 0, props);
1388    }
1389    var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
1390    var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
1391    var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
1392    function evaluateRenderProp(element, render, props, state) {
1393      if (render) {
1394        if (typeof render === "function") {
1395          if (true) {
1396            warnIfRenderPropLooksLikeComponent(render);
1397          }
1398          return render(props, state);
1399        }
1400        const mergedProps = mergeProps(props, render.props);
1401        mergedProps.ref = props.ref;
1402        let newElement = render;
1403        if (newElement?.$$typeof === REACT_LAZY_TYPE) {
1404          const children = React6.Children.toArray(render);
1405          newElement = children[0];
1406        }
1407        if (true) {
1408          if (!/* @__PURE__ */ React6.isValidElement(newElement)) {
1409            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"));
1410          }
1411        }
1412        return /* @__PURE__ */ React6.cloneElement(newElement, mergedProps);
1413      }
1414      if (element) {
1415        if (typeof element === "string") {
1416          return renderTag(element, props);
1417        }
1418      }
1419      throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
1420    }
1421    function warnIfRenderPropLooksLikeComponent(renderFn) {
1422      const functionName = renderFn.name;
1423      if (functionName.length === 0) {
1424        return;
1425      }
1426      if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
1427        return;
1428      }
1429      if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
1430        return;
1431      }
1432      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={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
1433    }
1434    function renderTag(Tag, props) {
1435      if (Tag === "button") {
1436        return /* @__PURE__ */ (0, import_react.createElement)("button", {
1437          type: "button",
1438          ...props,
1439          key: props.key
1440        });
1441      }
1442      if (Tag === "img") {
1443        return /* @__PURE__ */ (0, import_react.createElement)("img", {
1444          alt: "",
1445          ...props,
1446          key: props.key
1447        });
1448      }
1449      return /* @__PURE__ */ React6.createElement(Tag, props);
1450    }
1451  
1452    // node_modules/@base-ui/utils/useId.mjs
1453    var React7 = __toESM(require_react(), 1);
1454    var globalId = 0;
1455    function useGlobalId(idOverride, prefix = "mui") {
1456      const [defaultId, setDefaultId] = React7.useState(idOverride);
1457      const id = idOverride || defaultId;
1458      React7.useEffect(() => {
1459        if (defaultId == null) {
1460          globalId += 1;
1461          setDefaultId(`$prefix}-$globalId}`);
1462        }
1463      }, [defaultId, prefix]);
1464      return id;
1465    }
1466    var maybeReactUseId = SafeReact.useId;
1467    function useId(idOverride, prefix) {
1468      if (maybeReactUseId !== void 0) {
1469        const reactId = maybeReactUseId();
1470        return idOverride ?? (prefix ? `$prefix}-$reactId}` : reactId);
1471      }
1472      return useGlobalId(idOverride, prefix);
1473    }
1474  
1475    // node_modules/@base-ui/react/internals/useBaseUiId.mjs
1476    function useBaseUiId(idOverride) {
1477      return useId(idOverride, "base-ui");
1478    }
1479  
1480    // node_modules/@base-ui/react/internals/reason-parts.mjs
1481    var reason_parts_exports = {};
1482    __export(reason_parts_exports, {
1483      cancelOpen: () => cancelOpen,
1484      chipRemovePress: () => chipRemovePress,
1485      clearPress: () => clearPress,
1486      closePress: () => closePress,
1487      closeWatcher: () => closeWatcher,
1488      decrementPress: () => decrementPress,
1489      disabled: () => disabled,
1490      drag: () => drag,
1491      escapeKey: () => escapeKey,
1492      focusOut: () => focusOut,
1493      imperativeAction: () => imperativeAction,
1494      incrementPress: () => incrementPress,
1495      initial: () => initial,
1496      inputBlur: () => inputBlur,
1497      inputChange: () => inputChange,
1498      inputClear: () => inputClear,
1499      inputPaste: () => inputPaste,
1500      inputPress: () => inputPress,
1501      itemPress: () => itemPress,
1502      keyboard: () => keyboard,
1503      linkPress: () => linkPress,
1504      listNavigation: () => listNavigation,
1505      missing: () => missing,
1506      none: () => none,
1507      outsidePress: () => outsidePress,
1508      pointer: () => pointer,
1509      scrub: () => scrub,
1510      siblingOpen: () => siblingOpen,
1511      swipe: () => swipe,
1512      trackPress: () => trackPress,
1513      triggerFocus: () => triggerFocus,
1514      triggerHover: () => triggerHover,
1515      triggerPress: () => triggerPress,
1516      wheel: () => wheel,
1517      windowResize: () => windowResize
1518    });
1519    var none = "none";
1520    var triggerPress = "trigger-press";
1521    var triggerHover = "trigger-hover";
1522    var triggerFocus = "trigger-focus";
1523    var outsidePress = "outside-press";
1524    var itemPress = "item-press";
1525    var closePress = "close-press";
1526    var linkPress = "link-press";
1527    var clearPress = "clear-press";
1528    var chipRemovePress = "chip-remove-press";
1529    var trackPress = "track-press";
1530    var incrementPress = "increment-press";
1531    var decrementPress = "decrement-press";
1532    var inputChange = "input-change";
1533    var inputClear = "input-clear";
1534    var inputBlur = "input-blur";
1535    var inputPaste = "input-paste";
1536    var inputPress = "input-press";
1537    var focusOut = "focus-out";
1538    var escapeKey = "escape-key";
1539    var closeWatcher = "close-watcher";
1540    var listNavigation = "list-navigation";
1541    var keyboard = "keyboard";
1542    var pointer = "pointer";
1543    var drag = "drag";
1544    var wheel = "wheel";
1545    var scrub = "scrub";
1546    var cancelOpen = "cancel-open";
1547    var siblingOpen = "sibling-open";
1548    var disabled = "disabled";
1549    var missing = "missing";
1550    var initial = "initial";
1551    var imperativeAction = "imperative-action";
1552    var swipe = "swipe";
1553    var windowResize = "window-resize";
1554  
1555    // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs
1556    function createChangeEventDetails(reason, event, trigger, customProperties) {
1557      let canceled = false;
1558      let allowPropagation = false;
1559      const custom = customProperties ?? EMPTY_OBJECT;
1560      const details = {
1561        reason,
1562        event: event ?? new Event("base-ui"),
1563        cancel() {
1564          canceled = true;
1565        },
1566        allowPropagation() {
1567          allowPropagation = true;
1568        },
1569        get isCanceled() {
1570          return canceled;
1571        },
1572        get isPropagationAllowed() {
1573          return allowPropagation;
1574        },
1575        trigger,
1576        ...custom
1577      };
1578      return details;
1579    }
1580  
1581    // node_modules/@base-ui/react/internals/useTransitionStatus.mjs
1582    var React9 = __toESM(require_react(), 1);
1583  
1584    // node_modules/@base-ui/utils/useOnMount.mjs
1585    var React8 = __toESM(require_react(), 1);
1586    function useOnMount(fn) {
1587      React8.useEffect(fn, EMPTY_ARRAY2);
1588    }
1589  
1590    // node_modules/@base-ui/utils/useAnimationFrame.mjs
1591    var EMPTY = null;
1592    var LAST_RAF = globalThis.requestAnimationFrame;
1593    var Scheduler = class {
1594      /* This implementation uses an array as a backing data-structure for frame callbacks.
1595       * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
1596       * never calls the native `cancelAnimationFrame` if there are no frames left. This can
1597       * be much more efficient if there is a call pattern that alterns as
1598       * "request-cancel-request-cancel-…".
1599       * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
1600       * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
1601      callbacks = [];
1602      callbacksCount = 0;
1603      nextId = 1;
1604      startId = 1;
1605      isScheduled = false;
1606      tick = (timestamp) => {
1607        this.isScheduled = false;
1608        const currentCallbacks = this.callbacks;
1609        const currentCallbacksCount = this.callbacksCount;
1610        this.callbacks = [];
1611        this.callbacksCount = 0;
1612        this.startId = this.nextId;
1613        if (currentCallbacksCount > 0) {
1614          for (let i = 0; i < currentCallbacks.length; i += 1) {
1615            currentCallbacks[i]?.(timestamp);
1616          }
1617        }
1618      };
1619      request(fn) {
1620        const id = this.nextId;
1621        this.nextId += 1;
1622        this.callbacks.push(fn);
1623        this.callbacksCount += 1;
1624        const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
1625        if (!this.isScheduled || didRAFChange) {
1626          requestAnimationFrame(this.tick);
1627          this.isScheduled = true;
1628        }
1629        return id;
1630      }
1631      cancel(id) {
1632        const index2 = id - this.startId;
1633        if (index2 < 0 || index2 >= this.callbacks.length) {
1634          return;
1635        }
1636        this.callbacks[index2] = null;
1637        this.callbacksCount -= 1;
1638      }
1639    };
1640    var scheduler = new Scheduler();
1641    var AnimationFrame = class _AnimationFrame {
1642      static create() {
1643        return new _AnimationFrame();
1644      }
1645      static request(fn) {
1646        return scheduler.request(fn);
1647      }
1648      static cancel(id) {
1649        return scheduler.cancel(id);
1650      }
1651      currentId = EMPTY;
1652      /**
1653       * Executes `fn` after `delay`, clearing any previously scheduled call.
1654       */
1655      request(fn) {
1656        this.cancel();
1657        this.currentId = scheduler.request(() => {
1658          this.currentId = EMPTY;
1659          fn();
1660        });
1661      }
1662      cancel = () => {
1663        if (this.currentId !== EMPTY) {
1664          scheduler.cancel(this.currentId);
1665          this.currentId = EMPTY;
1666        }
1667      };
1668      disposeEffect = () => {
1669        return this.cancel;
1670      };
1671    };
1672    function useAnimationFrame() {
1673      const timeout = useRefWithInit(AnimationFrame.create).current;
1674      useOnMount(timeout.disposeEffect);
1675      return timeout;
1676    }
1677  
1678    // node_modules/@base-ui/react/internals/useTransitionStatus.mjs
1679    function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) {
1680      const [transitionStatus, setTransitionStatus] = React9.useState(open && enableIdleState ? "idle" : void 0);
1681      const [mounted, setMounted] = React9.useState(open);
1682      if (open && !mounted) {
1683        setMounted(true);
1684        setTransitionStatus("starting");
1685      }
1686      if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) {
1687        setTransitionStatus("ending");
1688      }
1689      if (!open && !mounted && transitionStatus === "ending") {
1690        setTransitionStatus(void 0);
1691      }
1692      useIsoLayoutEffect(() => {
1693        if (!open && mounted && transitionStatus !== "ending" && deferEndingState) {
1694          const frame = AnimationFrame.request(() => {
1695            setTransitionStatus("ending");
1696          });
1697          return () => {
1698            AnimationFrame.cancel(frame);
1699          };
1700        }
1701        return void 0;
1702      }, [open, mounted, transitionStatus, deferEndingState]);
1703      useIsoLayoutEffect(() => {
1704        if (!open || enableIdleState) {
1705          return void 0;
1706        }
1707        const frame = AnimationFrame.request(() => {
1708          setTransitionStatus(void 0);
1709        });
1710        return () => {
1711          AnimationFrame.cancel(frame);
1712        };
1713      }, [enableIdleState, open]);
1714      useIsoLayoutEffect(() => {
1715        if (!open || !enableIdleState) {
1716          return void 0;
1717        }
1718        if (open && mounted && transitionStatus !== "idle") {
1719          setTransitionStatus("starting");
1720        }
1721        const frame = AnimationFrame.request(() => {
1722          setTransitionStatus("idle");
1723        });
1724        return () => {
1725          AnimationFrame.cancel(frame);
1726        };
1727      }, [enableIdleState, open, mounted, transitionStatus]);
1728      return {
1729        mounted,
1730        setMounted,
1731        transitionStatus
1732      };
1733    }
1734  
1735    // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs
1736    var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) {
1737      TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style";
1738      TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style";
1739      return TransitionStatusDataAttributes2;
1740    })({});
1741    var STARTING_HOOK = {
1742      "data-starting-style": ""
1743    };
1744    var ENDING_HOOK = {
1745      "data-ending-style": ""
1746    };
1747    var transitionStatusMapping = {
1748      transitionStatus(value) {
1749        if (value === "starting") {
1750          return STARTING_HOOK;
1751        }
1752        if (value === "ending") {
1753          return ENDING_HOOK;
1754        }
1755        return null;
1756      }
1757    };
1758  
1759    // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
1760    function hasWindow() {
1761      return typeof window !== "undefined";
1762    }
1763    function getNodeName(node) {
1764      if (isNode(node)) {
1765        return (node.nodeName || "").toLowerCase();
1766      }
1767      return "#document";
1768    }
1769    function getWindow(node) {
1770      var _node$ownerDocument;
1771      return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1772    }
1773    function getDocumentElement(node) {
1774      var _ref;
1775      return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1776    }
1777    function isNode(value) {
1778      if (!hasWindow()) {
1779        return false;
1780      }
1781      return value instanceof Node || value instanceof getWindow(value).Node;
1782    }
1783    function isElement(value) {
1784      if (!hasWindow()) {
1785        return false;
1786      }
1787      return value instanceof Element || value instanceof getWindow(value).Element;
1788    }
1789    function isHTMLElement(value) {
1790      if (!hasWindow()) {
1791        return false;
1792      }
1793      return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1794    }
1795    function isShadowRoot(value) {
1796      if (!hasWindow() || typeof ShadowRoot === "undefined") {
1797        return false;
1798      }
1799      return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1800    }
1801    function isOverflowElement(element) {
1802      const {
1803        overflow,
1804        overflowX,
1805        overflowY,
1806        display
1807      } = getComputedStyle2(element);
1808      return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
1809    }
1810    function isTableElement(element) {
1811      return /^(table|td|th)$/.test(getNodeName(element));
1812    }
1813    function isTopLayer(element) {
1814      try {
1815        if (element.matches(":popover-open")) {
1816          return true;
1817        }
1818      } catch (_e) {
1819      }
1820      try {
1821        return element.matches(":modal");
1822      } catch (_e) {
1823        return false;
1824      }
1825    }
1826    var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
1827    var containRe = /paint|layout|strict|content/;
1828    var isNotNone = (value) => !!value && value !== "none";
1829    var isWebKitValue;
1830    function isContainingBlock(elementOrCss) {
1831      const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
1832      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 || "");
1833    }
1834    function getContainingBlock(element) {
1835      let currentNode = getParentNode(element);
1836      while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1837        if (isContainingBlock(currentNode)) {
1838          return currentNode;
1839        } else if (isTopLayer(currentNode)) {
1840          return null;
1841        }
1842        currentNode = getParentNode(currentNode);
1843      }
1844      return null;
1845    }
1846    function isWebKit() {
1847      if (isWebKitValue == null) {
1848        isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
1849      }
1850      return isWebKitValue;
1851    }
1852    function isLastTraversableNode(node) {
1853      return /^(html|body|#document)$/.test(getNodeName(node));
1854    }
1855    function getComputedStyle2(element) {
1856      return getWindow(element).getComputedStyle(element);
1857    }
1858    function getNodeScroll(element) {
1859      if (isElement(element)) {
1860        return {
1861          scrollLeft: element.scrollLeft,
1862          scrollTop: element.scrollTop
1863        };
1864      }
1865      return {
1866        scrollLeft: element.scrollX,
1867        scrollTop: element.scrollY
1868      };
1869    }
1870    function getParentNode(node) {
1871      if (getNodeName(node) === "html") {
1872        return node;
1873      }
1874      const result = (
1875        // Step into the shadow DOM of the parent of a slotted node.
1876        node.assignedSlot || // DOM Element detected.
1877        node.parentNode || // ShadowRoot detected.
1878        isShadowRoot(node) && node.host || // Fallback.
1879        getDocumentElement(node)
1880      );
1881      return isShadowRoot(result) ? result.host : result;
1882    }
1883    function getNearestOverflowAncestor(node) {
1884      const parentNode = getParentNode(node);
1885      if (isLastTraversableNode(parentNode)) {
1886        return (node.ownerDocument || node).body;
1887      }
1888      if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1889        return parentNode;
1890      }
1891      return getNearestOverflowAncestor(parentNode);
1892    }
1893    function getOverflowAncestors(node, list, traverseIframes) {
1894      var _node$ownerDocument2;
1895      if (list === void 0) {
1896        list = [];
1897      }
1898      if (traverseIframes === void 0) {
1899        traverseIframes = true;
1900      }
1901      const scrollableAncestor = getNearestOverflowAncestor(node);
1902      const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1903      const win = getWindow(scrollableAncestor);
1904      if (isBody) {
1905        const frameElement = getFrameElement(win);
1906        return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1907      } else {
1908        return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1909      }
1910    }
1911    function getFrameElement(win) {
1912      return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1913    }
1914  
1915    // node_modules/@base-ui/utils/owner.mjs
1916    function ownerDocument(node) {
1917      return node?.ownerDocument || document;
1918    }
1919  
1920    // node_modules/@base-ui/utils/addEventListener.mjs
1921    function addEventListener(target, type, listener, options) {
1922      target.addEventListener(type, listener, options);
1923      return () => {
1924        target.removeEventListener(type, listener, options);
1925      };
1926    }
1927  
1928    // node_modules/@base-ui/utils/useValueAsRef.mjs
1929    function useValueAsRef(value) {
1930      const latest = useRefWithInit(createLatestRef, value).current;
1931      latest.next = value;
1932      useIsoLayoutEffect(latest.effect);
1933      return latest;
1934    }
1935    function createLatestRef(value) {
1936      const latest = {
1937        current: value,
1938        next: value,
1939        effect: () => {
1940          latest.current = latest.next;
1941        }
1942      };
1943      return latest;
1944    }
1945  
1946    // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
1947    var React10 = __toESM(require_react(), 1);
1948  
1949    // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
1950    var ReactDOM = __toESM(require_react_dom(), 1);
1951  
1952    // node_modules/@base-ui/react/utils/resolveRef.mjs
1953    function resolveRef(maybeRef) {
1954      if (maybeRef == null) {
1955        return maybeRef;
1956      }
1957      return "current" in maybeRef ? maybeRef.current : maybeRef;
1958    }
1959  
1960    // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
1961    function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false) {
1962      const frame = useAnimationFrame();
1963      return useStableCallback((fnToExecute, signal = null) => {
1964        frame.cancel();
1965        const element = resolveRef(elementOrRef);
1966        if (element == null) {
1967          return;
1968        }
1969        const resolvedElement = element;
1970        const done = () => {
1971          ReactDOM.flushSync(fnToExecute);
1972        };
1973        if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) {
1974          fnToExecute();
1975          return;
1976        }
1977        function exec() {
1978          Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => {
1979            if (!signal?.aborted) {
1980              done();
1981            }
1982          }, () => {
1983            if (signal?.aborted) {
1984              return;
1985            }
1986            const currentAnimations = resolvedElement.getAnimations();
1987            if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) {
1988              exec();
1989              return;
1990            }
1991            done();
1992          });
1993        }
1994        if (waitForStartingStyleRemoved) {
1995          const startingStyleAttribute = "data-starting-style";
1996          if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1997            frame.request(exec);
1998            return;
1999          }
2000          const attributeObserver = new MutationObserver(() => {
2001            if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
2002              attributeObserver.disconnect();
2003              exec();
2004            }
2005          });
2006          attributeObserver.observe(resolvedElement, {
2007            attributes: true,
2008            attributeFilter: [startingStyleAttribute]
2009          });
2010          signal?.addEventListener("abort", () => attributeObserver.disconnect(), {
2011            once: true
2012          });
2013          return;
2014        }
2015        frame.request(exec);
2016      });
2017    }
2018  
2019    // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
2020    function useOpenChangeComplete(parameters) {
2021      const {
2022        enabled = true,
2023        open,
2024        ref,
2025        onComplete: onCompleteParam
2026      } = parameters;
2027      const onComplete = useStableCallback(onCompleteParam);
2028      const runOnceAnimationsFinish = useAnimationsFinished(ref, open);
2029      React10.useEffect(() => {
2030        if (!enabled) {
2031          return void 0;
2032        }
2033        const abortController = new AbortController();
2034        runOnceAnimationsFinish(onComplete, abortController.signal);
2035        return () => {
2036          abortController.abort();
2037        };
2038      }, [enabled, open, onComplete, runOnceAnimationsFinish]);
2039    }
2040  
2041    // node_modules/@base-ui/utils/platform/parts.mjs
2042    var parts_exports = {};
2043    __export(parts_exports, {
2044      engine: () => engine_exports,
2045      env: () => env_exports,
2046      os: () => os_exports,
2047      screenReader: () => screen_reader_exports
2048    });
2049  
2050    // node_modules/@base-ui/utils/platform/os.mjs
2051    var os_exports = {};
2052    __export(os_exports, {
2053      android: () => android,
2054      apple: () => apple,
2055      ios: () => ios,
2056      linux: () => linux,
2057      mac: () => mac,
2058      windows: () => windows
2059    });
2060  
2061    // node_modules/@base-ui/utils/platform/shared.mjs
2062    function readRawData() {
2063      if (typeof navigator === "undefined") {
2064        return {
2065          userAgent: "",
2066          platform: "",
2067          maxTouchPoints: 0
2068        };
2069      }
2070      if (true) {
2071        const uaData = navigator.userAgentData;
2072        if (uaData && Array.isArray(uaData.brands)) {
2073          return {
2074            userAgent: uaData.brands.map(({
2075              brand,
2076              version: version2
2077            }) => `$brand}/$version2}`).join(" "),
2078            platform: uaData.platform ?? navigator.platform ?? "",
2079            maxTouchPoints: navigator.maxTouchPoints ?? 0
2080          };
2081        }
2082      }
2083      return {
2084        userAgent: navigator.userAgent,
2085        platform: navigator.platform ?? "",
2086        maxTouchPoints: navigator.maxTouchPoints ?? 0
2087      };
2088    }
2089    var {
2090      userAgent,
2091      platform,
2092      maxTouchPoints
2093    } = readRawData();
2094    var lowerUserAgent = userAgent.toLowerCase();
2095    var lowerPlatform = platform.toLowerCase();
2096  
2097    // node_modules/@base-ui/utils/platform/os.mjs
2098    var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1;
2099    var ANDROID_STRING = "android";
2100    var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING);
2101    var mac = !ios && lowerPlatform.startsWith("mac");
2102    var windows = lowerPlatform.startsWith("win");
2103    var linux = !android && /^(linux|chrome os)/.test(lowerPlatform);
2104    var apple = mac || ios;
2105  
2106    // node_modules/@base-ui/utils/platform/engine.mjs
2107    var engine_exports = {};
2108    __export(engine_exports, {
2109      blink: () => blink,
2110      gecko: () => gecko,
2111      webkit: () => webkit
2112    });
2113    var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none");
2114    var gecko = !webkit && lowerUserAgent.includes("firefox");
2115    var blink = !webkit && lowerUserAgent.includes("chrom");
2116  
2117    // node_modules/@base-ui/utils/platform/screen-reader.mjs
2118    var screen_reader_exports = {};
2119    __export(screen_reader_exports, {
2120      voiceOver: () => voiceOver
2121    });
2122    var voiceOver = apple;
2123  
2124    // node_modules/@base-ui/utils/platform/env.mjs
2125    var env_exports = {};
2126    __export(env_exports, {
2127      jsdom: () => jsdom
2128    });
2129    var jsdom = /jsdom|happydom/.test(lowerUserAgent);
2130  
2131    // node_modules/@base-ui/utils/useTimeout.mjs
2132    var EMPTY2 = 0;
2133    var Timeout = class _Timeout {
2134      static create() {
2135        return new _Timeout();
2136      }
2137      currentId = EMPTY2;
2138      /**
2139       * Executes `fn` after `delay`, clearing any previously scheduled call.
2140       */
2141      start(delay, fn) {
2142        this.clear();
2143        this.currentId = setTimeout(() => {
2144          this.currentId = EMPTY2;
2145          fn();
2146        }, delay);
2147      }
2148      isStarted() {
2149        return this.currentId !== EMPTY2;
2150      }
2151      clear = () => {
2152        if (this.currentId !== EMPTY2) {
2153          clearTimeout(this.currentId);
2154          this.currentId = EMPTY2;
2155        }
2156      };
2157      disposeEffect = () => {
2158        return this.clear;
2159      };
2160    };
2161    function useTimeout() {
2162      const timeout = useRefWithInit(Timeout.create).current;
2163      useOnMount(timeout.disposeEffect);
2164      return timeout;
2165    }
2166  
2167    // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
2168    var React11 = __toESM(require_react(), 1);
2169  
2170    // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs
2171    function isReactEvent(event) {
2172      return "nativeEvent" in event;
2173    }
2174    function isMouseLikePointerType(pointerType, strict) {
2175      const values = ["mouse", "pen"];
2176      if (!strict) {
2177        values.push("", void 0);
2178      }
2179      return values.includes(pointerType);
2180    }
2181    function isClickLikeEvent(event) {
2182      const type = event.type;
2183      return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup";
2184    }
2185  
2186    // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs
2187    var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable";
2188    var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
2189  
2190    // node_modules/@base-ui/react/internals/shadowDom.mjs
2191    function activeElement(doc) {
2192      let element = doc.activeElement;
2193      while (element?.shadowRoot?.activeElement != null) {
2194        element = element.shadowRoot.activeElement;
2195      }
2196      return element;
2197    }
2198    function contains(parent, child) {
2199      if (!parent || !child) {
2200        return false;
2201      }
2202      const rootNode = child.getRootNode?.();
2203      if (parent.contains(child)) {
2204        return true;
2205      }
2206      if (rootNode && isShadowRoot(rootNode)) {
2207        let next = child;
2208        while (next) {
2209          if (parent === next) {
2210            return true;
2211          }
2212          next = next.parentNode || next.host;
2213        }
2214      }
2215      return false;
2216    }
2217    function getTarget(event) {
2218      if ("composedPath" in event) {
2219        return event.composedPath()[0];
2220      }
2221      return event.target;
2222    }
2223  
2224    // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs
2225    function isTargetInsideEnabledTrigger(target, triggerElements) {
2226      if (!isElement(target)) {
2227        return false;
2228      }
2229      const targetElement = target;
2230      if (triggerElements.hasElement(targetElement)) {
2231        return !targetElement.hasAttribute("data-trigger-disabled");
2232      }
2233      for (const [, trigger] of triggerElements.entries()) {
2234        if (contains(trigger, targetElement)) {
2235          return !trigger.hasAttribute("data-trigger-disabled");
2236        }
2237      }
2238      return false;
2239    }
2240    function isEventTargetWithin(event, node) {
2241      if (node == null) {
2242        return false;
2243      }
2244      if ("composedPath" in event) {
2245        return event.composedPath().includes(node);
2246      }
2247      const eventAgain = event;
2248      return eventAgain.target != null && node.contains(eventAgain.target);
2249    }
2250    function isRootElement(element) {
2251      return element.matches("html,body");
2252    }
2253    function isTypeableElement(element) {
2254      return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
2255    }
2256    function isInteractiveElement(element) {
2257      return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null;
2258    }
2259    function matchesFocusVisible(element) {
2260      if (!element || parts_exports.env.jsdom) {
2261        return true;
2262      }
2263      try {
2264        return element.matches(":focus-visible");
2265      } catch (_e) {
2266        return true;
2267      }
2268    }
2269  
2270    // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs
2271    function resolveValue(value, pointerType) {
2272      if (pointerType != null && !isMouseLikePointerType(pointerType)) {
2273        return 0;
2274      }
2275      if (typeof value === "function") {
2276        return value();
2277      }
2278      return value;
2279    }
2280    function getDelay(value, prop, pointerType) {
2281      const result = resolveValue(value, pointerType);
2282      if (typeof result === "number") {
2283        return result;
2284      }
2285      return result?.[prop];
2286    }
2287    function getRestMs(value) {
2288      if (typeof value === "function") {
2289        return value();
2290      }
2291      return value;
2292    }
2293    function isClickLikeOpenEvent(openEventType, interactedInside) {
2294      return interactedInside || openEventType === "click" || openEventType === "mousedown";
2295    }
2296    function isHoverOpenEvent(openEventType) {
2297      return openEventType?.includes("mouse") && openEventType !== "mousedown";
2298    }
2299  
2300    // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
2301    var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
2302    var FloatingDelayGroupContext = /* @__PURE__ */ React11.createContext({
2303      hasProvider: false,
2304      timeoutMs: 0,
2305      delayRef: {
2306        current: 0
2307      },
2308      initialDelayRef: {
2309        current: 0
2310      },
2311      timeout: new Timeout(),
2312      currentIdRef: {
2313        current: null
2314      },
2315      currentContextRef: {
2316        current: null
2317      }
2318    });
2319    if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext";
2320    function resetDelayRef(delayRef, initialDelayRef) {
2321      delayRef.current = initialDelayRef.current;
2322    }
2323    function FloatingDelayGroup(props) {
2324      const {
2325        children,
2326        delay,
2327        timeoutMs = 0
2328      } = props;
2329      const delayRef = React11.useRef(delay);
2330      const initialDelayRef = React11.useRef(delay);
2331      const currentIdRef = React11.useRef(null);
2332      const currentContextRef = React11.useRef(null);
2333      const timeout = useTimeout();
2334      useIsoLayoutEffect(() => {
2335        initialDelayRef.current = delay;
2336        if (!currentIdRef.current) {
2337          delayRef.current = delay;
2338          return;
2339        }
2340        delayRef.current = {
2341          open: getDelay(delayRef.current, "open"),
2342          close: getDelay(delay, "close")
2343        };
2344      }, [delay, currentIdRef, delayRef, initialDelayRef]);
2345      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, {
2346        value: React11.useMemo(() => ({
2347          hasProvider: true,
2348          delayRef,
2349          initialDelayRef,
2350          currentIdRef,
2351          timeoutMs,
2352          currentContextRef,
2353          timeout
2354        }), [timeoutMs, timeout]),
2355        children
2356      });
2357    }
2358    function useDelayGroup(context, options = {
2359      open: false
2360    }) {
2361      const {
2362        open
2363      } = options;
2364      const store2 = "rootStore" in context ? context.rootStore : context;
2365      const floatingId = store2.useState("floatingId");
2366      const groupContext = React11.useContext(FloatingDelayGroupContext);
2367      const {
2368        currentIdRef,
2369        delayRef,
2370        timeoutMs,
2371        initialDelayRef,
2372        currentContextRef,
2373        hasProvider,
2374        timeout
2375      } = groupContext;
2376      const [isInstantPhase, setIsInstantPhase] = React11.useState(false);
2377      const openRef = React11.useRef(open);
2378      useIsoLayoutEffect(() => {
2379        openRef.current = open;
2380      }, [open]);
2381      useIsoLayoutEffect(() => {
2382        function unset() {
2383          currentContextRef.current?.setIsInstantPhase(false);
2384          currentIdRef.current = null;
2385          currentContextRef.current = null;
2386          delayRef.current = initialDelayRef.current;
2387          timeout.clear();
2388        }
2389        if (!currentIdRef.current) {
2390          return void 0;
2391        }
2392        if (!open && currentIdRef.current === floatingId) {
2393          setIsInstantPhase(false);
2394          if (timeoutMs) {
2395            const closingId = floatingId;
2396            timeout.start(timeoutMs, () => {
2397              if (store2.select("open") || currentIdRef.current && currentIdRef.current !== closingId) {
2398                return;
2399              }
2400              unset();
2401            });
2402            return () => {
2403              if (openRef.current || currentIdRef.current !== closingId) {
2404                timeout.clear();
2405              }
2406            };
2407          }
2408          unset();
2409        }
2410        return void 0;
2411      }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store2]);
2412      useIsoLayoutEffect(() => {
2413        if (!open) {
2414          return;
2415        }
2416        const prevContext = currentContextRef.current;
2417        const prevId = currentIdRef.current;
2418        timeout.clear();
2419        currentContextRef.current = {
2420          onOpenChange: store2.setOpen,
2421          setIsInstantPhase
2422        };
2423        currentIdRef.current = floatingId;
2424        delayRef.current = {
2425          open: 0,
2426          close: getDelay(initialDelayRef.current, "close")
2427        };
2428        if (prevId !== null && prevId !== floatingId) {
2429          setIsInstantPhase(true);
2430          prevContext?.setIsInstantPhase(true);
2431          prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none));
2432        } else {
2433          setIsInstantPhase(false);
2434          prevContext?.setIsInstantPhase(false);
2435        }
2436      }, [open, floatingId, store2, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]);
2437      useIsoLayoutEffect(() => {
2438        return () => {
2439          if (currentIdRef.current === floatingId) {
2440            currentContextRef.current = null;
2441            if (!openRef.current) {
2442              return;
2443            }
2444            currentIdRef.current = null;
2445            resetDelayRef(delayRef, initialDelayRef);
2446            timeout.clear();
2447          }
2448        };
2449      }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]);
2450      return React11.useMemo(() => ({
2451        hasProvider,
2452        delayRef,
2453        isInstantPhase
2454      }), [hasProvider, delayRef, isInstantPhase]);
2455    }
2456  
2457    // node_modules/@base-ui/utils/mergeCleanups.mjs
2458    function mergeCleanups(...cleanups) {
2459      return () => {
2460        for (let i = 0; i < cleanups.length; i += 1) {
2461          const cleanup = cleanups[i];
2462          if (cleanup) {
2463            cleanup();
2464          }
2465        }
2466      };
2467    }
2468  
2469    // node_modules/@base-ui/react/utils/FocusGuard.mjs
2470    var React12 = __toESM(require_react(), 1);
2471  
2472    // node_modules/@base-ui/utils/visuallyHidden.mjs
2473    var visuallyHiddenBase = {
2474      clipPath: "inset(50%)",
2475      overflow: "hidden",
2476      whiteSpace: "nowrap",
2477      border: 0,
2478      padding: 0,
2479      width: 1,
2480      height: 1,
2481      margin: -1
2482    };
2483    var visuallyHidden = {
2484      ...visuallyHiddenBase,
2485      position: "fixed",
2486      top: 0,
2487      left: 0
2488    };
2489    var visuallyHiddenInput = {
2490      ...visuallyHiddenBase,
2491      position: "absolute"
2492    };
2493  
2494    // node_modules/@base-ui/react/utils/FocusGuard.mjs
2495    var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
2496    var FocusGuard = /* @__PURE__ */ React12.forwardRef(function FocusGuard2(props, ref) {
2497      const [role, setRole] = React12.useState();
2498      useIsoLayoutEffect(() => {
2499        if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) {
2500          setRole("button");
2501        }
2502      }, []);
2503      const restProps = {
2504        tabIndex: 0,
2505        // Role is only for VoiceOver
2506        role
2507      };
2508      return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
2509        ...props,
2510        ref,
2511        style: visuallyHidden,
2512        "aria-hidden": role ? void 0 : true,
2513        ...restProps,
2514        "data-base-ui-focus-guard": ""
2515      });
2516    });
2517    if (true) FocusGuard.displayName = "FocusGuard";
2518  
2519    // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
2520    var min = Math.min;
2521    var max = Math.max;
2522    var round = Math.round;
2523    var floor = Math.floor;
2524    var createCoords = (v) => ({
2525      x: v,
2526      y: v
2527    });
2528    var oppositeSideMap = {
2529      left: "right",
2530      right: "left",
2531      bottom: "top",
2532      top: "bottom"
2533    };
2534    function clamp(start, value, end) {
2535      return max(start, min(value, end));
2536    }
2537    function evaluate(value, param) {
2538      return typeof value === "function" ? value(param) : value;
2539    }
2540    function getSide(placement) {
2541      return placement.split("-")[0];
2542    }
2543    function getAlignment(placement) {
2544      return placement.split("-")[1];
2545    }
2546    function getOppositeAxis(axis) {
2547      return axis === "x" ? "y" : "x";
2548    }
2549    function getAxisLength(axis) {
2550      return axis === "y" ? "height" : "width";
2551    }
2552    function getSideAxis(placement) {
2553      const firstChar = placement[0];
2554      return firstChar === "t" || firstChar === "b" ? "y" : "x";
2555    }
2556    function getAlignmentAxis(placement) {
2557      return getOppositeAxis(getSideAxis(placement));
2558    }
2559    function getAlignmentSides(placement, rects, rtl) {
2560      if (rtl === void 0) {
2561        rtl = false;
2562      }
2563      const alignment = getAlignment(placement);
2564      const alignmentAxis = getAlignmentAxis(placement);
2565      const length = getAxisLength(alignmentAxis);
2566      let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
2567      if (rects.reference[length] > rects.floating[length]) {
2568        mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
2569      }
2570      return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
2571    }
2572    function getExpandedPlacements(placement) {
2573      const oppositePlacement = getOppositePlacement(placement);
2574      return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
2575    }
2576    function getOppositeAlignmentPlacement(placement) {
2577      return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
2578    }
2579    var lrPlacement = ["left", "right"];
2580    var rlPlacement = ["right", "left"];
2581    var tbPlacement = ["top", "bottom"];
2582    var btPlacement = ["bottom", "top"];
2583    function getSideList(side, isStart, rtl) {
2584      switch (side) {
2585        case "top":
2586        case "bottom":
2587          if (rtl) return isStart ? rlPlacement : lrPlacement;
2588          return isStart ? lrPlacement : rlPlacement;
2589        case "left":
2590        case "right":
2591          return isStart ? tbPlacement : btPlacement;
2592        default:
2593          return [];
2594      }
2595    }
2596    function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
2597      const alignment = getAlignment(placement);
2598      let list = getSideList(getSide(placement), direction === "start", rtl);
2599      if (alignment) {
2600        list = list.map((side) => side + "-" + alignment);
2601        if (flipAlignment) {
2602          list = list.concat(list.map(getOppositeAlignmentPlacement));
2603        }
2604      }
2605      return list;
2606    }
2607    function getOppositePlacement(placement) {
2608      const side = getSide(placement);
2609      return oppositeSideMap[side] + placement.slice(side.length);
2610    }
2611    function expandPaddingObject(padding) {
2612      var _padding$top, _padding$right, _padding$bottom, _padding$left;
2613      return {
2614        top: (_padding$top = padding.top) != null ? _padding$top : 0,
2615        right: (_padding$right = padding.right) != null ? _padding$right : 0,
2616        bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
2617        left: (_padding$left = padding.left) != null ? _padding$left : 0
2618      };
2619    }
2620    function getPaddingObject(padding) {
2621      return typeof padding !== "number" ? expandPaddingObject(padding) : {
2622        top: padding,
2623        right: padding,
2624        bottom: padding,
2625        left: padding
2626      };
2627    }
2628    function rectToClientRect(rect) {
2629      const {
2630        x,
2631        y,
2632        width,
2633        height
2634      } = rect;
2635      return {
2636        width,
2637        height,
2638        top: y,
2639        left: x,
2640        right: x + width,
2641        bottom: y + height,
2642        x,
2643        y
2644      };
2645    }
2646  
2647    // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs
2648    function isHiddenByStyles(styles) {
2649      return styles.visibility === "hidden" || styles.visibility === "collapse";
2650    }
2651    function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) {
2652      if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {
2653        return false;
2654      }
2655      if (typeof element.checkVisibility === "function") {
2656        return element.checkVisibility();
2657      }
2658      return styles.display !== "none" && styles.display !== "contents";
2659    }
2660  
2661    // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs
2662    var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';
2663    function getParentElement(element) {
2664      const assignedSlot = element.assignedSlot;
2665      if (assignedSlot) {
2666        return assignedSlot;
2667      }
2668      if (element.parentElement) {
2669        return element.parentElement;
2670      }
2671      const rootNode = element.getRootNode();
2672      return isShadowRoot(rootNode) ? rootNode.host : null;
2673    }
2674    function getDetailsSummary(details) {
2675      for (const child of Array.from(details.children)) {
2676        if (getNodeName(child) === "summary") {
2677          return child;
2678        }
2679      }
2680      return null;
2681    }
2682    function isWithinOpenDetailsSummary(element, details) {
2683      const summary = getDetailsSummary(details);
2684      return !!summary && (element === summary || contains(summary, element));
2685    }
2686    function isFocusableCandidate(element) {
2687      const nodeName = element ? getNodeName(element) : "";
2688      return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== "summary" || element.parentElement != null && getNodeName(element.parentElement) === "details" && getDetailsSummary(element.parentElement) === element) && (nodeName !== "details" || getDetailsSummary(element) == null) && (nodeName !== "input" || element.type !== "hidden");
2689    }
2690    function isFocusableElement(element) {
2691      if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) {
2692        return false;
2693      }
2694      for (let current = element; current; current = getParentElement(current)) {
2695        const isAncestor = current !== element;
2696        const isSlot = getNodeName(current) === "slot";
2697        if (current.hasAttribute("inert")) {
2698          return false;
2699        }
2700        if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {
2701          return false;
2702        }
2703      }
2704      return true;
2705    }
2706    function isVisibleInTabbableTree(element, isAncestor) {
2707      const styles = getComputedStyle2(element);
2708      if (!isAncestor) {
2709        return isElementVisible(element, styles);
2710      }
2711      return styles.display !== "none";
2712    }
2713    function getTabIndex(element) {
2714      const tabIndex = element.tabIndex;
2715      if (tabIndex < 0) {
2716        const nodeName = getNodeName(element);
2717        if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) {
2718          return 0;
2719        }
2720      }
2721      return tabIndex;
2722    }
2723    function getNamedRadioInput(element) {
2724      if (getNodeName(element) !== "input") {
2725        return null;
2726      }
2727      const input = element;
2728      return input.type === "radio" && input.name !== "" ? input : null;
2729    }
2730    function isTabbableRadio(element, candidates) {
2731      const input = getNamedRadioInput(element);
2732      if (!input) {
2733        return true;
2734      }
2735      const checkedRadio = candidates.find((candidate) => {
2736        const radio = getNamedRadioInput(candidate);
2737        return radio?.name === input.name && radio.form === input.form && radio.checked;
2738      });
2739      if (checkedRadio) {
2740        return checkedRadio === input;
2741      }
2742      return candidates.find((candidate) => {
2743        const radio = getNamedRadioInput(candidate);
2744        return radio?.name === input.name && radio.form === input.form;
2745      }) === input;
2746    }
2747    function getComposedChildren(container) {
2748      if (isHTMLElement(container) && getNodeName(container) === "slot") {
2749        const assignedElements = container.assignedElements({
2750          flatten: true
2751        });
2752        if (assignedElements.length > 0) {
2753          return assignedElements;
2754        }
2755      }
2756      if (isHTMLElement(container) && container.shadowRoot) {
2757        return Array.from(container.shadowRoot.children);
2758      }
2759      return Array.from(container.children);
2760    }
2761    function appendCandidates(container, list) {
2762      getComposedChildren(container).forEach((child) => {
2763        if (isFocusableCandidate(child)) {
2764          list.push(child);
2765        }
2766        appendCandidates(child, list);
2767      });
2768    }
2769    function appendMatchingElements(container, selector, list) {
2770      getComposedChildren(container).forEach((child) => {
2771        if (isHTMLElement(child) && child.matches(selector)) {
2772          list.push(child);
2773        }
2774        appendMatchingElements(child, selector, list);
2775      });
2776    }
2777    function focusable(container) {
2778      const candidates = [];
2779      appendCandidates(container, candidates);
2780      return candidates.filter(isFocusableElement);
2781    }
2782    function tabbable(container) {
2783      const candidates = focusable(container);
2784      return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));
2785    }
2786    function getTabbableIn(container, dir) {
2787      const list = tabbable(container);
2788      const len = list.length;
2789      if (len === 0) {
2790        return void 0;
2791      }
2792      const active = activeElement(ownerDocument(container));
2793      const index2 = list.indexOf(active);
2794      const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir;
2795      return list[nextIndex];
2796    }
2797    function getNextTabbable(referenceElement) {
2798      return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;
2799    }
2800    function getPreviousTabbable(referenceElement) {
2801      return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;
2802    }
2803    function isOutsideEvent(event, container) {
2804      const containerElement = container || event.currentTarget;
2805      const relatedTarget = event.relatedTarget;
2806      return !relatedTarget || !contains(containerElement, relatedTarget);
2807    }
2808    function disableFocusInside(container) {
2809      const tabbableElements = tabbable(container);
2810      tabbableElements.forEach((element) => {
2811        element.dataset.tabindex = element.getAttribute("tabindex") || "";
2812        element.setAttribute("tabindex", "-1");
2813      });
2814    }
2815    function enableFocusInside(container) {
2816      const elements = [];
2817      appendMatchingElements(container, "[data-tabindex]", elements);
2818      elements.forEach((element) => {
2819        const tabindex = element.dataset.tabindex;
2820        delete element.dataset.tabindex;
2821        if (tabindex) {
2822          element.setAttribute("tabindex", tabindex);
2823        } else {
2824          element.removeAttribute("tabindex");
2825        }
2826      });
2827    }
2828  
2829    // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs
2830    function getNodeChildren(nodes, id, onlyOpenChildren = true) {
2831      const directChildren = nodes.filter((node) => node.parentId === id);
2832      return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);
2833    }
2834  
2835    // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs
2836    function createAttribute(name) {
2837      return `data-base-ui-$name}`;
2838    }
2839  
2840    // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
2841    var React13 = __toESM(require_react(), 1);
2842    var ReactDOM2 = __toESM(require_react_dom(), 1);
2843  
2844    // node_modules/@base-ui/react/internals/constants.mjs
2845    var DISABLED_TRANSITIONS_STYLE = {
2846      style: {
2847        transition: "none"
2848      }
2849    };
2850    var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
2851    var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
2852    var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
2853    var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
2854    var POPUP_COLLISION_AVOIDANCE = {
2855      fallbackAxisSide: "end"
2856    };
2857    var ownerVisuallyHidden = {
2858      clipPath: "inset(50%)",
2859      position: "fixed",
2860      top: 0,
2861      left: 0
2862    };
2863  
2864    // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
2865    var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
2866    var PortalContext = /* @__PURE__ */ React13.createContext(null);
2867    if (true) PortalContext.displayName = "PortalContext";
2868    var usePortalContext = () => React13.useContext(PortalContext);
2869    var attr = createAttribute("portal");
2870    function useFloatingPortalNode(props = {}) {
2871      const {
2872        ref,
2873        container: containerProp,
2874        componentProps = EMPTY_OBJECT,
2875        elementProps
2876      } = props;
2877      const uniqueId = useId();
2878      const portalContext = usePortalContext();
2879      const parentPortalNode = portalContext?.portalNode;
2880      const [containerElement, setContainerElement] = React13.useState(null);
2881      const [portalNode, setPortalNode] = React13.useState(null);
2882      const setPortalNodeRef = useStableCallback((node) => {
2883        if (node !== null) {
2884          setPortalNode(node);
2885        }
2886      });
2887      const containerRef = React13.useRef(null);
2888      useIsoLayoutEffect(() => {
2889        if (containerProp === null) {
2890          if (containerRef.current) {
2891            containerRef.current = null;
2892            setPortalNode(null);
2893            setContainerElement(null);
2894          }
2895          return;
2896        }
2897        const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;
2898        if (resolvedContainer == null) {
2899          if (containerRef.current) {
2900            containerRef.current = null;
2901            setPortalNode(null);
2902            setContainerElement(null);
2903          }
2904          return;
2905        }
2906        if (containerRef.current !== resolvedContainer) {
2907          containerRef.current = resolvedContainer;
2908          setPortalNode(null);
2909          setContainerElement(resolvedContainer);
2910        }
2911      }, [containerProp, parentPortalNode]);
2912      const portalElement = useRenderElement("div", componentProps, {
2913        ref: [ref, setPortalNodeRef],
2914        props: [{
2915          id: uniqueId,
2916          [attr]: ""
2917        }, elementProps]
2918      });
2919      const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null;
2920      return {
2921        node: portalNode,
2922        // `id` and `render` props can override or remove the generated ID. Use the exact
2923        // rendered value so `aria-owns` never points at an ID absent from the DOM.
2924        nodeId: /* @__PURE__ */ React13.isValidElement(portalElement) ? portalElement.props.id : void 0,
2925        subtree: portalSubtree
2926      };
2927    }
2928    var FloatingPortal = /* @__PURE__ */ React13.forwardRef(function FloatingPortal2(componentProps, forwardedRef) {
2929      const {
2930        render,
2931        className,
2932        style,
2933        children,
2934        container,
2935        ...elementProps
2936      } = componentProps;
2937      const {
2938        node: portalNode,
2939        nodeId: portalNodeId,
2940        subtree: portalSubtree
2941      } = useFloatingPortalNode({
2942        container,
2943        ref: forwardedRef,
2944        componentProps,
2945        elementProps
2946      });
2947      const beforeOutsideRef = React13.useRef(null);
2948      const afterOutsideRef = React13.useRef(null);
2949      const beforeInsideRef = React13.useRef(null);
2950      const afterInsideRef = React13.useRef(null);
2951      const [focusManagerState, setFocusManagerState] = React13.useState(null);
2952      const focusInsideDisabledRef = React13.useRef(false);
2953      const modal = focusManagerState?.modal;
2954      const open = focusManagerState?.open;
2955      const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;
2956      React13.useEffect(() => {
2957        if (!portalNode || modal) {
2958          return void 0;
2959        }
2960        function onFocus(event) {
2961          if (portalNode && event.relatedTarget && isOutsideEvent(event)) {
2962            if (event.type === "focusin") {
2963              if (focusInsideDisabledRef.current) {
2964                enableFocusInside(portalNode);
2965                focusInsideDisabledRef.current = false;
2966              }
2967            } else {
2968              disableFocusInside(portalNode);
2969              focusInsideDisabledRef.current = true;
2970            }
2971          }
2972        }
2973        return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true));
2974      }, [portalNode, modal]);
2975      useIsoLayoutEffect(() => {
2976        if (!portalNode || open !== true || !focusInsideDisabledRef.current) {
2977          return;
2978        }
2979        enableFocusInside(portalNode);
2980        focusInsideDisabledRef.current = false;
2981      }, [open, portalNode]);
2982      const portalContextValue = React13.useMemo(() => ({
2983        beforeOutsideRef,
2984        afterOutsideRef,
2985        beforeInsideRef,
2986        afterInsideRef,
2987        portalNode,
2988        setFocusManagerState
2989      }), [portalNode]);
2990      return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React13.Fragment, {
2991        children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, {
2992          value: portalContextValue,
2993          children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, {
2994            "data-type": "outside",
2995            ref: beforeOutsideRef,
2996            onFocus: (event) => {
2997              if (isOutsideEvent(event, portalNode)) {
2998                beforeInsideRef.current?.focus();
2999              } else {
3000                const domReference = focusManagerState ? focusManagerState.domReference : null;
3001                const prevTabbable = getPreviousTabbable(domReference);
3002                prevTabbable?.focus();
3003              }
3004            }
3005          }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", {
3006            "aria-owns": portalNodeId,
3007            style: ownerVisuallyHidden
3008          }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, {
3009            "data-type": "outside",
3010            ref: afterOutsideRef,
3011            onFocus: (event) => {
3012              if (isOutsideEvent(event, portalNode)) {
3013                afterInsideRef.current?.focus();
3014              } else {
3015                const domReference = focusManagerState ? focusManagerState.domReference : null;
3016                const nextTabbable = getNextTabbable(domReference);
3017                nextTabbable?.focus();
3018                if (focusManagerState?.closeOnFocusOut) {
3019                  focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent));
3020                }
3021              }
3022            }
3023          })]
3024        })]
3025      });
3026    });
3027    if (true) FloatingPortal.displayName = "FloatingPortal";
3028  
3029    // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
3030    var React14 = __toESM(require_react(), 1);
3031  
3032    // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs
3033    function createEventEmitter() {
3034      const map = /* @__PURE__ */ new Map();
3035      return {
3036        emit(event, data) {
3037          map.get(event)?.forEach((listener) => listener(data));
3038        },
3039        on(event, listener) {
3040          if (!map.has(event)) {
3041            map.set(event, /* @__PURE__ */ new Set());
3042          }
3043          map.get(event).add(listener);
3044        },
3045        off(event, listener) {
3046          map.get(event)?.delete(listener);
3047        }
3048      };
3049    }
3050  
3051    // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
3052    var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
3053    var FloatingNodeContext = /* @__PURE__ */ React14.createContext(null);
3054    if (true) FloatingNodeContext.displayName = "FloatingNodeContext";
3055    var FloatingTreeContext = /* @__PURE__ */ React14.createContext(null);
3056    if (true) FloatingTreeContext.displayName = "FloatingTreeContext";
3057    var useFloatingParentNodeId = () => React14.useContext(FloatingNodeContext)?.id || null;
3058    var useFloatingTree = (externalTree) => {
3059      const contextTree = React14.useContext(FloatingTreeContext);
3060      return externalTree ?? contextTree;
3061    };
3062  
3063    // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs
3064    var React15 = __toESM(require_react(), 1);
3065    function createVirtualElement(domElement, data) {
3066      let offsetX = null;
3067      let offsetY = null;
3068      let isAutoUpdateEvent = false;
3069      return {
3070        contextElement: domElement || void 0,
3071        getBoundingClientRect() {
3072          const domRect = domElement?.getBoundingClientRect() || {
3073            width: 0,
3074            height: 0,
3075            x: 0,
3076            y: 0
3077          };
3078          const isXAxis = data.axis === "x" || data.axis === "both";
3079          const isYAxis = data.axis === "y" || data.axis === "both";
3080          const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch";
3081          let width = domRect.width;
3082          let height = domRect.height;
3083          let x = domRect.x;
3084          let y = domRect.y;
3085          if (offsetX == null && data.x && isXAxis) {
3086            offsetX = domRect.x - data.x;
3087          }
3088          if (offsetY == null && data.y && isYAxis) {
3089            offsetY = domRect.y - data.y;
3090          }
3091          x -= offsetX || 0;
3092          y -= offsetY || 0;
3093          width = 0;
3094          height = 0;
3095          if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {
3096            width = data.axis === "y" ? domRect.width : 0;
3097            height = data.axis === "x" ? domRect.height : 0;
3098            x = isXAxis && data.x != null ? data.x : x;
3099            y = isYAxis && data.y != null ? data.y : y;
3100          } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {
3101            height = data.axis === "x" ? domRect.height : height;
3102            width = data.axis === "y" ? domRect.width : width;
3103          }
3104          isAutoUpdateEvent = true;
3105          return {
3106            width,
3107            height,
3108            x,
3109            y,
3110            top: y,
3111            right: x + width,
3112            bottom: y + height,
3113            left: x
3114          };
3115        }
3116      };
3117    }
3118    function isMouseBasedEvent(event) {
3119      return event != null && event.clientX != null;
3120    }
3121    function useClientPoint(context, props = {}) {
3122      const {
3123        enabled = true,
3124        axis = "both"
3125      } = props;
3126      const store2 = "rootStore" in context ? context.rootStore : context;
3127      const open = store2.useState("open");
3128      const floating = store2.useState("floatingElement");
3129      const domReference = store2.useState("domReferenceElement");
3130      const dataRef = store2.context.dataRef;
3131      const initialRef = React15.useRef(false);
3132      const cleanupListenerRef = React15.useRef(null);
3133      const [pointerType, setPointerType] = React15.useState();
3134      const [reactive, setReactive] = React15.useState([]);
3135      const resetReference = useStableCallback((reference2) => {
3136        store2.set("positionReference", reference2);
3137      });
3138      const setReference = useStableCallback((newX, newY, referenceElement) => {
3139        if (initialRef.current) {
3140          return;
3141        }
3142        if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) {
3143          return;
3144        }
3145        store2.set("positionReference", createVirtualElement(referenceElement ?? domReference, {
3146          x: newX,
3147          y: newY,
3148          axis,
3149          dataRef,
3150          pointerType
3151        }));
3152      });
3153      const handleReferenceEnterOrMove = useStableCallback((event) => {
3154        if (!open) {
3155          setReference(event.clientX, event.clientY, event.currentTarget);
3156        } else if (!cleanupListenerRef.current) {
3157          setReference(event.clientX, event.clientY, event.currentTarget);
3158          setReactive([]);
3159        }
3160      });
3161      const openCheck = isMouseLikePointerType(pointerType) ? floating : open;
3162      React15.useEffect(() => {
3163        if (!enabled) {
3164          resetReference(domReference);
3165          return void 0;
3166        }
3167        if (!openCheck) {
3168          return void 0;
3169        }
3170        function cleanupListener() {
3171          cleanupListenerRef.current?.();
3172          cleanupListenerRef.current = null;
3173        }
3174        const win = getWindow(floating);
3175        function handleMouseMove(event) {
3176          const target = getTarget(event);
3177          if (!contains(floating, target)) {
3178            setReference(event.clientX, event.clientY);
3179          } else {
3180            cleanupListener();
3181          }
3182        }
3183        if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) {
3184          cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove);
3185        } else {
3186          resetReference(domReference);
3187        }
3188        return cleanupListener;
3189      }, [openCheck, enabled, floating, dataRef, domReference, store2, setReference, resetReference, reactive]);
3190      React15.useEffect(() => () => {
3191        store2.set("positionReference", null);
3192      }, [store2]);
3193      React15.useEffect(() => {
3194        if (enabled && !floating) {
3195          initialRef.current = false;
3196        }
3197      }, [enabled, floating]);
3198      React15.useEffect(() => {
3199        if (!enabled && open) {
3200          initialRef.current = true;
3201        }
3202      }, [enabled, open]);
3203      const reference = React15.useMemo(() => {
3204        function setPointerTypeRef(event) {
3205          setPointerType(event.pointerType);
3206        }
3207        return {
3208          onPointerDown: setPointerTypeRef,
3209          onPointerEnter: setPointerTypeRef,
3210          onMouseMove: handleReferenceEnterOrMove,
3211          onMouseEnter: handleReferenceEnterOrMove
3212        };
3213      }, [handleReferenceEnterOrMove]);
3214      return React15.useMemo(() => enabled ? {
3215        reference,
3216        trigger: reference
3217      } : {}, [enabled, reference]);
3218    }
3219  
3220    // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs
3221    var React16 = __toESM(require_react(), 1);
3222    function alwaysFalse() {
3223      return false;
3224    }
3225    function normalizeProp(normalizable) {
3226      return {
3227        escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false,
3228        outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true
3229      };
3230    }
3231    function useDismiss(context, props = {}) {
3232      const {
3233        enabled = true,
3234        escapeKey: escapeKey2 = true,
3235        outsidePress: outsidePressProp = true,
3236        outsidePressEvent = "sloppy",
3237        referencePress = alwaysFalse,
3238        bubbles,
3239        externalTree
3240      } = props;
3241      const store2 = "rootStore" in context ? context.rootStore : context;
3242      const open = store2.useState("open");
3243      const floatingElement = store2.useState("floatingElement");
3244      const {
3245        dataRef
3246      } = store2.context;
3247      const tree = useFloatingTree(externalTree);
3248      const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false);
3249      const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp;
3250      const outsidePressEnabled = outsidePress2 !== false;
3251      const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);
3252      const {
3253        escapeKey: escapeKeyBubbles,
3254        outsidePress: outsidePressBubbles
3255      } = normalizeProp(bubbles);
3256      const pressStartedInsideRef = React16.useRef(false);
3257      const pressStartPreventedRef = React16.useRef(false);
3258      const suppressNextOutsideClickRef = React16.useRef(false);
3259      const isComposingRef = React16.useRef(false);
3260      const currentPointerTypeRef = React16.useRef("");
3261      const touchStateRef = React16.useRef(null);
3262      const cancelDismissOnEndTimeout = useTimeout();
3263      const clearInsideReactTreeTimeout = useTimeout();
3264      const clearInsideReactTree = useStableCallback(() => {
3265        clearInsideReactTreeTimeout.clear();
3266        dataRef.current.insideReactTree = false;
3267      });
3268      const hasBlockingChild = useStableCallback((bubbleKey) => {
3269        const nodeId = dataRef.current.floatingContext?.nodeId;
3270        const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
3271        return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]);
3272      });
3273      const isEventWithinOwnElements = useStableCallback((event) => {
3274        return isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement"));
3275      });
3276      const closeOnReferencePress = useStableCallback((event) => {
3277        if (!referencePress()) {
3278          return;
3279        }
3280        store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent));
3281      });
3282      const closeOnEscapeKeyDown = useStableCallback((event) => {
3283        if (!open || !enabled || !escapeKey2 || event.key !== "Escape") {
3284          return;
3285        }
3286        if (isComposingRef.current) {
3287          return;
3288        }
3289        if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) {
3290          return;
3291        }
3292        const native = isReactEvent(event) ? event.nativeEvent : event;
3293        const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native);
3294        store2.setOpen(false, eventDetails);
3295        if (!eventDetails.isCanceled) {
3296          event.preventDefault();
3297        }
3298        if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {
3299          event.stopPropagation();
3300        }
3301      });
3302      const markInsideReactTree = useStableCallback(() => {
3303        dataRef.current.insideReactTree = true;
3304        clearInsideReactTreeTimeout.start(0, clearInsideReactTree);
3305      });
3306      const markPressStartedInsideReactTree = useStableCallback((event) => {
3307        if (!open || !enabled || event.button !== 0) {
3308          return;
3309        }
3310        const target = getTarget(event.nativeEvent);
3311        if (!contains(store2.select("floatingElement"), target)) {
3312          return;
3313        }
3314        if (!pressStartedInsideRef.current) {
3315          pressStartedInsideRef.current = true;
3316          pressStartPreventedRef.current = false;
3317        }
3318      });
3319      const markInsidePressStartPrevented = useStableCallback((event) => {
3320        if (!open || !enabled) {
3321          return;
3322        }
3323        if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {
3324          return;
3325        }
3326        if (pressStartedInsideRef.current) {
3327          pressStartPreventedRef.current = true;
3328        }
3329      });
3330      React16.useEffect(() => {
3331        if (!open || !enabled) {
3332          return clearInsideReactTree;
3333        }
3334        dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
3335        dataRef.current.__outsidePressBubbles = outsidePressBubbles;
3336        const compositionTimeout = new Timeout();
3337        const preventedPressSuppressionTimeout = new Timeout();
3338        function handleCompositionStart() {
3339          compositionTimeout.clear();
3340          isComposingRef.current = true;
3341        }
3342        function handleCompositionEnd() {
3343          compositionTimeout.start(
3344            // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
3345            // Only apply to WebKit for the test to remain 0ms.
3346            parts_exports.engine.webkit ? 5 : 0,
3347            () => {
3348              isComposingRef.current = false;
3349            }
3350          );
3351        }
3352        function suppressImmediateOutsideClickAfterPreventedStart() {
3353          suppressNextOutsideClickRef.current = true;
3354          preventedPressSuppressionTimeout.start(0, () => {
3355            suppressNextOutsideClickRef.current = false;
3356          });
3357        }
3358        function resetPressStartState() {
3359          pressStartedInsideRef.current = false;
3360          pressStartPreventedRef.current = false;
3361        }
3362        function getOutsidePressEvent() {
3363          const type = currentPointerTypeRef.current;
3364          const computedType = type === "pen" || !type ? "mouse" : type;
3365          const outsidePressEventValue = getOutsidePressEventProp();
3366          const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue;
3367          if (typeof resolved === "string") {
3368            return resolved;
3369          }
3370          return resolved[computedType];
3371        }
3372        function shouldIgnoreEvent(event) {
3373          const computedOutsidePressEvent = getOutsidePressEvent();
3374          return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click";
3375        }
3376        function isEventWithinFloatingTree(event) {
3377          const nodeId = dataRef.current.floatingContext?.nodeId;
3378          const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating));
3379          return isEventWithinOwnElements(event) || targetIsInsideChildren;
3380        }
3381        function closeOnPressOutside(event) {
3382          if (shouldIgnoreEvent(event)) {
3383            if (event.type !== "click" && !isEventWithinOwnElements(event)) {
3384              preventedPressSuppressionTimeout.clear();
3385              suppressNextOutsideClickRef.current = false;
3386            }
3387            clearInsideReactTree();
3388            return;
3389          }
3390          if (dataRef.current.insideReactTree) {
3391            clearInsideReactTree();
3392            return;
3393          }
3394          const target = getTarget(event);
3395          const inertSelector = `[$createAttribute("inert")}]`;
3396          const targetRoot = isElement(target) ? target.getRootNode() : null;
3397          const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store2.select("floatingElement"))).querySelectorAll(inertSelector));
3398          const triggers = store2.context.triggerElements;
3399          if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) {
3400            return;
3401          }
3402          let targetRootAncestor = isElement(target) ? target : null;
3403          while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {
3404            const nextParent = getParentNode(targetRootAncestor);
3405            if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {
3406              break;
3407            }
3408            targetRootAncestor = nextParent;
3409          }
3410          if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
3411          !contains(target, store2.select("floatingElement")) && // If the target root element contains none of the markers, then the
3412          // element was injected after the floating element rendered.
3413          markers.every((marker) => !contains(targetRootAncestor, marker))) {
3414            return;
3415          }
3416          if (isHTMLElement(target) && !("touches" in event)) {
3417            const lastTraversableNode = isLastTraversableNode(target);
3418            const style = getComputedStyle2(target);
3419            const scrollRe = /auto|scroll/;
3420            const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
3421            const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
3422            const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
3423            const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
3424            const isRTL3 = style.direction === "rtl";
3425            const pressedVerticalScrollbar = canScrollY && (isRTL3 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);
3426            const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
3427            if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {
3428              return;
3429            }
3430          }
3431          if (isEventWithinFloatingTree(event)) {
3432            return;
3433          }
3434          if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) {
3435            preventedPressSuppressionTimeout.clear();
3436            suppressNextOutsideClickRef.current = false;
3437            return;
3438          }
3439          if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
3440            return;
3441          }
3442          if (hasBlockingChild("__outsidePressBubbles")) {
3443            return;
3444          }
3445          store2.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event));
3446          clearInsideReactTree();
3447        }
3448        function handlePointerDown(event) {
3449          if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) {
3450            return;
3451          }
3452          closeOnPressOutside(event);
3453        }
3454        function handleTouchStart(event) {
3455          if (getOutsidePressEvent() !== "sloppy" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) {
3456            return;
3457          }
3458          const touch = event.touches[0];
3459          if (touch) {
3460            touchStateRef.current = {
3461              startTime: Date.now(),
3462              startX: touch.clientX,
3463              startY: touch.clientY,
3464              dismissOnTouchEnd: false,
3465              dismissOnMouseDown: true
3466            };
3467            cancelDismissOnEndTimeout.start(1e3, () => {
3468              if (touchStateRef.current) {
3469                touchStateRef.current.dismissOnTouchEnd = false;
3470                touchStateRef.current.dismissOnMouseDown = false;
3471              }
3472            });
3473          }
3474        }
3475        function addTargetEventListenerOnce(event, listener) {
3476          const target = getTarget(event);
3477          if (!target) {
3478            return;
3479          }
3480          const unsubscribe2 = addEventListener(target, event.type, () => {
3481            listener(event);
3482            unsubscribe2();
3483          });
3484        }
3485        function handleTouchStartCapture(event) {
3486          currentPointerTypeRef.current = "touch";
3487          addTargetEventListenerOnce(event, handleTouchStart);
3488        }
3489        function closeOnPressOutsideCapture(event) {
3490          cancelDismissOnEndTimeout.clear();
3491          if (event.type === "pointerdown") {
3492            currentPointerTypeRef.current = event.pointerType;
3493          }
3494          if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {
3495            return;
3496          }
3497          addTargetEventListenerOnce(event, (targetEvent) => {
3498            if (targetEvent.type === "pointerdown") {
3499              handlePointerDown(targetEvent);
3500            } else {
3501              closeOnPressOutside(targetEvent);
3502            }
3503          });
3504        }
3505        function handlePressEndCapture(event) {
3506          if (!pressStartedInsideRef.current) {
3507            return;
3508          }
3509          const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;
3510          resetPressStartState();
3511          if (getOutsidePressEvent() !== "intentional") {
3512            return;
3513          }
3514          if (event.type === "pointercancel") {
3515            if (pressStartedInsideDefaultPrevented) {
3516              suppressImmediateOutsideClickAfterPreventedStart();
3517            }
3518            return;
3519          }
3520          if (isEventWithinFloatingTree(event)) {
3521            return;
3522          }
3523          if (pressStartedInsideDefaultPrevented) {
3524            suppressImmediateOutsideClickAfterPreventedStart();
3525            return;
3526          }
3527          if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
3528            return;
3529          }
3530          preventedPressSuppressionTimeout.clear();
3531          suppressNextOutsideClickRef.current = true;
3532          clearInsideReactTree();
3533        }
3534        function handleTouchMove(event) {
3535          if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
3536            return;
3537          }
3538          const touch = event.touches[0];
3539          if (!touch) {
3540            return;
3541          }
3542          const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);
3543          const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);
3544          const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
3545          if (distance > 5) {
3546            touchStateRef.current.dismissOnTouchEnd = true;
3547          }
3548          if (distance > 10) {
3549            closeOnPressOutside(event);
3550            cancelDismissOnEndTimeout.clear();
3551            touchStateRef.current = null;
3552          }
3553        }
3554        function handleTouchMoveCapture(event) {
3555          addTargetEventListenerOnce(event, handleTouchMove);
3556        }
3557        function handleTouchEnd(event) {
3558          if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
3559            return;
3560          }
3561          if (touchStateRef.current.dismissOnTouchEnd) {
3562            closeOnPressOutside(event);
3563          }
3564          cancelDismissOnEndTimeout.clear();
3565          touchStateRef.current = null;
3566        }
3567        function handleTouchEndCapture(event) {
3568          addTargetEventListenerOnce(event, handleTouchEnd);
3569        }
3570        const doc = ownerDocument(floatingElement);
3571        const unsubscribe = mergeCleanups(escapeKey2 && mergeCleanups(addEventListener(doc, "keydown", closeOnEscapeKeyDown), addEventListener(doc, "compositionstart", handleCompositionStart), addEventListener(doc, "compositionend", handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, "click", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerdown", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerup", handlePressEndCapture, true), addEventListener(doc, "pointercancel", handlePressEndCapture, true), addEventListener(doc, "mousedown", closeOnPressOutsideCapture, true), addEventListener(doc, "mouseup", handlePressEndCapture, true), addEventListener(doc, "touchstart", handleTouchStartCapture, true), addEventListener(doc, "touchmove", handleTouchMoveCapture, true), addEventListener(doc, "touchend", handleTouchEndCapture, true)));
3572        return () => {
3573          unsubscribe();
3574          compositionTimeout.clear();
3575          preventedPressSuppressionTimeout.clear();
3576          resetPressStartState();
3577          suppressNextOutsideClickRef.current = false;
3578          clearInsideReactTree();
3579        };
3580      }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store2, cancelDismissOnEndTimeout]);
3581      const reference = React16.useMemo(() => ({
3582        onKeyDown: closeOnEscapeKeyDown,
3583        onPointerDown: closeOnReferencePress,
3584        onClick: closeOnReferencePress
3585      }), [closeOnEscapeKeyDown, closeOnReferencePress]);
3586      const floating = React16.useMemo(() => ({
3587        onKeyDown: closeOnEscapeKeyDown,
3588        // `onMouseDown` may be blocked if `event.preventDefault()` is called in
3589        // `onPointerDown`, such as with <NumberField.ScrubArea>.
3590        // See https://github.com/mui/base-ui/pull/3379
3591        onPointerDown: markInsidePressStartPrevented,
3592        onMouseDown: markInsidePressStartPrevented,
3593        onClickCapture: markInsideReactTree,
3594        onMouseDownCapture(event) {
3595          markInsideReactTree();
3596          markPressStartedInsideReactTree(event);
3597        },
3598        onPointerDownCapture(event) {
3599          markInsideReactTree();
3600          markPressStartedInsideReactTree(event);
3601        },
3602        onMouseUpCapture: markInsideReactTree,
3603        onTouchEndCapture: markInsideReactTree,
3604        onTouchMoveCapture: markInsideReactTree
3605      }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);
3606      return React16.useMemo(() => enabled ? {
3607        reference,
3608        floating,
3609        trigger: reference
3610      } : {}, [enabled, reference, floating]);
3611    }
3612  
3613    // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
3614    var React24 = __toESM(require_react(), 1);
3615  
3616    // node_modules/@floating-ui/core/dist/floating-ui.core.mjs
3617    function computeCoordsFromPlacement(_ref, placement, rtl) {
3618      let {
3619        reference,
3620        floating
3621      } = _ref;
3622      const sideAxis = getSideAxis(placement);
3623      const alignmentAxis = getAlignmentAxis(placement);
3624      const alignLength = getAxisLength(alignmentAxis);
3625      const side = getSide(placement);
3626      const isVertical = sideAxis === "y";
3627      const commonX = reference.x + reference.width / 2 - floating.width / 2;
3628      const commonY = reference.y + reference.height / 2 - floating.height / 2;
3629      const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
3630      let coords;
3631      switch (side) {
3632        case "top":
3633          coords = {
3634            x: commonX,
3635            y: reference.y - floating.height
3636          };
3637          break;
3638        case "bottom":
3639          coords = {
3640            x: commonX,
3641            y: reference.y + reference.height
3642          };
3643          break;
3644        case "right":
3645          coords = {
3646            x: reference.x + reference.width,
3647            y: commonY
3648          };
3649          break;
3650        case "left":
3651          coords = {
3652            x: reference.x - floating.width,
3653            y: commonY
3654          };
3655          break;
3656        default:
3657          coords = {
3658            x: reference.x,
3659            y: reference.y
3660          };
3661      }
3662      const alignment = getAlignment(placement);
3663      if (alignment) {
3664        coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
3665      }
3666      return coords;
3667    }
3668    async function detectOverflow(state, options) {
3669      var _await$platform$isEle;
3670      if (options === void 0) {
3671        options = {};
3672      }
3673      const {
3674        x,
3675        y,
3676        platform: platform3,
3677        rects,
3678        elements,
3679        strategy
3680      } = state;
3681      const {
3682        boundary = "clippingAncestors",
3683        rootBoundary = "viewport",
3684        elementContext = "floating",
3685        altBoundary = false,
3686        padding = 0
3687      } = evaluate(options, state);
3688      const paddingObject = getPaddingObject(padding);
3689      const altContext = elementContext === "floating" ? "reference" : "floating";
3690      const element = elements[altBoundary ? altContext : elementContext];
3691      const clippingClientRect = rectToClientRect(await platform3.getClippingRect({
3692        element: ((_await$platform$isEle = await (platform3.isElement == null ? void 0 : platform3.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform3.getDocumentElement == null ? void 0 : platform3.getDocumentElement(elements.floating)),
3693        boundary,
3694        rootBoundary,
3695        strategy
3696      }));
3697      const rect = elementContext === "floating" ? {
3698        x,
3699        y,
3700        width: rects.floating.width,
3701        height: rects.floating.height
3702      } : rects.reference;
3703      const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating));
3704      const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) && await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || {
3705        x: 1,
3706        y: 1
3707      };
3708      const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({
3709        elements,
3710        rect,
3711        offsetParent,
3712        strategy
3713      }) : rect);
3714      return {
3715        top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
3716        bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
3717        left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
3718        right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
3719      };
3720    }
3721    var MAX_RESET_COUNT = 50;
3722    var computePosition = async (reference, floating, config) => {
3723      const {
3724        placement = "bottom",
3725        strategy = "absolute",
3726        middleware = [],
3727        platform: platform3
3728      } = config;
3729      const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : {
3730        ...platform3,
3731        detectOverflow
3732      };
3733      const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating));
3734      let rects = await platform3.getElementRects({
3735        reference,
3736        floating,
3737        strategy
3738      });
3739      let {
3740        x,
3741        y
3742      } = computeCoordsFromPlacement(rects, placement, rtl);
3743      let statefulPlacement = placement;
3744      let resetCount = 0;
3745      const middlewareData = {};
3746      for (let i = 0; i < middleware.length; i++) {
3747        const currentMiddleware = middleware[i];
3748        if (!currentMiddleware) {
3749          continue;
3750        }
3751        const {
3752          name,
3753          fn
3754        } = currentMiddleware;
3755        const {
3756          x: nextX,
3757          y: nextY,
3758          data,
3759          reset
3760        } = await fn({
3761          x,
3762          y,
3763          initialPlacement: placement,
3764          placement: statefulPlacement,
3765          strategy,
3766          middlewareData,
3767          rects,
3768          platform: platformWithDetectOverflow,
3769          elements: {
3770            reference,
3771            floating
3772          }
3773        });
3774        x = nextX != null ? nextX : x;
3775        y = nextY != null ? nextY : y;
3776        middlewareData[name] = {
3777          ...middlewareData[name],
3778          ...data
3779        };
3780        if (reset && resetCount < MAX_RESET_COUNT) {
3781          resetCount++;
3782          if (typeof reset === "object") {
3783            if (reset.placement) {
3784              statefulPlacement = reset.placement;
3785            }
3786            if (reset.rects) {
3787              rects = reset.rects === true ? await platform3.getElementRects({
3788                reference,
3789                floating,
3790                strategy
3791              }) : reset.rects;
3792            }
3793            ({
3794              x,
3795              y
3796            } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
3797          }
3798          i = -1;
3799        }
3800      }
3801      return {
3802        x,
3803        y,
3804        placement: statefulPlacement,
3805        strategy,
3806        middlewareData
3807      };
3808    };
3809    var flip = function(options) {
3810      if (options === void 0) {
3811        options = {};
3812      }
3813      return {
3814        name: "flip",
3815        options,
3816        async fn(state) {
3817          var _middlewareData$arrow, _middlewareData$flip;
3818          const {
3819            placement,
3820            middlewareData,
3821            rects,
3822            initialPlacement,
3823            platform: platform3,
3824            elements
3825          } = state;
3826          const {
3827            mainAxis: checkMainAxis = true,
3828            crossAxis: checkCrossAxis = true,
3829            fallbackPlacements: specifiedFallbackPlacements,
3830            fallbackStrategy = "bestFit",
3831            fallbackAxisSideDirection = "none",
3832            flipAlignment = true,
3833            ...detectOverflowOptions
3834          } = evaluate(options, state);
3835          if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
3836            return {};
3837          }
3838          const side = getSide(placement);
3839          const initialSideAxis = getSideAxis(initialPlacement);
3840          const isBasePlacement = getSide(initialPlacement) === initialPlacement;
3841          const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
3842          const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
3843          const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
3844          if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
3845            fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
3846          }
3847          const placements2 = [initialPlacement, ...fallbackPlacements];
3848          const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
3849          const overflows = [];
3850          let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
3851          if (checkMainAxis) {
3852            overflows.push(overflow[side]);
3853          }
3854          if (checkCrossAxis) {
3855            const sides2 = getAlignmentSides(placement, rects, rtl);
3856            overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
3857          }
3858          overflowsData = [...overflowsData, {
3859            placement,
3860            overflows
3861          }];
3862          if (!overflows.every((side2) => side2 <= 0)) {
3863            var _middlewareData$flip2, _overflowsData$filter;
3864            const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
3865            const nextPlacement = placements2[nextIndex];
3866            if (nextPlacement) {
3867              const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
3868              if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
3869              // overflows the main axis.
3870              overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
3871                return {
3872                  data: {
3873                    index: nextIndex,
3874                    overflows: overflowsData
3875                  },
3876                  reset: {
3877                    placement: nextPlacement
3878                  }
3879                };
3880              }
3881            }
3882            let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
3883            if (!resetPlacement) {
3884              switch (fallbackStrategy) {
3885                case "bestFit": {
3886                  var _overflowsData$filter2;
3887                  const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
3888                    if (hasFallbackAxisSideDirection) {
3889                      const currentSideAxis = getSideAxis(d.placement);
3890                      return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
3891                      // reading directions favoring greater width.
3892                      currentSideAxis === "y";
3893                    }
3894                    return true;
3895                  }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
3896                  if (placement2) {
3897                    resetPlacement = placement2;
3898                  }
3899                  break;
3900                }
3901                case "initialPlacement":
3902                  resetPlacement = initialPlacement;
3903                  break;
3904              }
3905            }
3906            if (placement !== resetPlacement) {
3907              return {
3908                reset: {
3909                  placement: resetPlacement
3910                }
3911              };
3912            }
3913          }
3914          return {};
3915        }
3916      };
3917    };
3918    var originSides = /* @__PURE__ */ new Set(["left", "top"]);
3919    async function convertValueToCoords(state, options) {
3920      const {
3921        placement,
3922        platform: platform3,
3923        elements
3924      } = state;
3925      const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
3926      const side = getSide(placement);
3927      const alignment = getAlignment(placement);
3928      const isVertical = getSideAxis(placement) === "y";
3929      const mainAxisMulti = originSides.has(side) ? -1 : 1;
3930      const crossAxisMulti = rtl && isVertical ? -1 : 1;
3931      const rawValue = evaluate(options, state);
3932      let {
3933        mainAxis,
3934        crossAxis,
3935        alignmentAxis
3936      } = typeof rawValue === "number" ? {
3937        mainAxis: rawValue,
3938        crossAxis: 0,
3939        alignmentAxis: null
3940      } : {
3941        mainAxis: rawValue.mainAxis || 0,
3942        crossAxis: rawValue.crossAxis || 0,
3943        alignmentAxis: rawValue.alignmentAxis
3944      };
3945      if (alignment && typeof alignmentAxis === "number") {
3946        crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
3947      }
3948      return isVertical ? {
3949        x: crossAxis * crossAxisMulti,
3950        y: mainAxis * mainAxisMulti
3951      } : {
3952        x: mainAxis * mainAxisMulti,
3953        y: crossAxis * crossAxisMulti
3954      };
3955    }
3956    var offset = function(options) {
3957      if (options === void 0) {
3958        options = 0;
3959      }
3960      return {
3961        name: "offset",
3962        options,
3963        async fn(state) {
3964          var _middlewareData$offse, _middlewareData$arrow;
3965          const {
3966            x,
3967            y,
3968            placement,
3969            middlewareData
3970          } = state;
3971          const diffCoords = await convertValueToCoords(state, options);
3972          if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
3973            return {};
3974          }
3975          return {
3976            x: x + diffCoords.x,
3977            y: y + diffCoords.y,
3978            data: {
3979              ...diffCoords,
3980              placement
3981            }
3982          };
3983        }
3984      };
3985    };
3986    var shift = function(options) {
3987      if (options === void 0) {
3988        options = {};
3989      }
3990      return {
3991        name: "shift",
3992        options,
3993        async fn(state) {
3994          const {
3995            x,
3996            y,
3997            placement,
3998            platform: platform3
3999          } = state;
4000          const {
4001            mainAxis: checkMainAxis = true,
4002            crossAxis: checkCrossAxis = false,
4003            limiter = {
4004              fn: (_ref) => {
4005                let {
4006                  x: x2,
4007                  y: y2
4008                } = _ref;
4009                return {
4010                  x: x2,
4011                  y: y2
4012                };
4013              }
4014            },
4015            ...detectOverflowOptions
4016          } = evaluate(options, state);
4017          const coords = {
4018            x,
4019            y
4020          };
4021          const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4022          const crossAxis = getSideAxis(placement);
4023          const mainAxis = getOppositeAxis(crossAxis);
4024          let mainAxisCoord = coords[mainAxis];
4025          let crossAxisCoord = coords[crossAxis];
4026          const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]);
4027          if (checkMainAxis) {
4028            mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
4029          }
4030          if (checkCrossAxis) {
4031            crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
4032          }
4033          const limitedCoords = limiter.fn({
4034            ...state,
4035            [mainAxis]: mainAxisCoord,
4036            [crossAxis]: crossAxisCoord
4037          });
4038          return {
4039            ...limitedCoords,
4040            data: {
4041              x: limitedCoords.x - x,
4042              y: limitedCoords.y - y,
4043              enabled: {
4044                [mainAxis]: checkMainAxis,
4045                [crossAxis]: checkCrossAxis
4046              }
4047            }
4048          };
4049        }
4050      };
4051    };
4052    var limitShift = function(options) {
4053      if (options === void 0) {
4054        options = {};
4055      }
4056      return {
4057        options,
4058        fn(state) {
4059          var _rawOffset$mainAxis, _rawOffset$crossAxis;
4060          const {
4061            x,
4062            y,
4063            placement,
4064            rects,
4065            middlewareData
4066          } = state;
4067          const {
4068            offset: offset4 = 0,
4069            mainAxis: checkMainAxis = true,
4070            crossAxis: checkCrossAxis = true
4071          } = evaluate(options, state);
4072          const coords = {
4073            x,
4074            y
4075          };
4076          const crossAxis = getSideAxis(placement);
4077          const mainAxis = getOppositeAxis(crossAxis);
4078          let mainAxisCoord = coords[mainAxis];
4079          let crossAxisCoord = coords[crossAxis];
4080          const rawOffset = evaluate(offset4, state);
4081          const computedOffset = typeof rawOffset === "number" ? {
4082            mainAxis: rawOffset,
4083            crossAxis: 0
4084          } : {
4085            mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,
4086            crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0
4087          };
4088          if (checkMainAxis) {
4089            const len = mainAxis === "y" ? "height" : "width";
4090            const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
4091            const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
4092            if (mainAxisCoord < limitMin) {
4093              mainAxisCoord = limitMin;
4094            } else if (mainAxisCoord > limitMax) {
4095              mainAxisCoord = limitMax;
4096            }
4097          }
4098          if (checkCrossAxis) {
4099            var _middlewareData$offse, _middlewareData$offse2;
4100            const len = mainAxis === "y" ? "width" : "height";
4101            const isOriginSide = originSides.has(getSide(placement));
4102            const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
4103            const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
4104            if (crossAxisCoord < limitMin) {
4105              crossAxisCoord = limitMin;
4106            } else if (crossAxisCoord > limitMax) {
4107              crossAxisCoord = limitMax;
4108            }
4109          }
4110          return {
4111            [mainAxis]: mainAxisCoord,
4112            [crossAxis]: crossAxisCoord
4113          };
4114        }
4115      };
4116    };
4117    var size = function(options) {
4118      if (options === void 0) {
4119        options = {};
4120      }
4121      return {
4122        name: "size",
4123        options,
4124        async fn(state) {
4125          const {
4126            placement,
4127            rects,
4128            platform: platform3,
4129            elements
4130          } = state;
4131          const {
4132            apply = () => {
4133            },
4134            ...detectOverflowOptions
4135          } = evaluate(options, state);
4136          const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4137          const side = getSide(placement);
4138          const alignment = getAlignment(placement);
4139          const isYAxis = getSideAxis(placement) === "y";
4140          const {
4141            width,
4142            height
4143          } = rects.floating;
4144          let heightSide;
4145          let widthSide;
4146          if (side === "top" || side === "bottom") {
4147            heightSide = side;
4148            widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
4149          } else {
4150            widthSide = side;
4151            heightSide = alignment === "end" ? "top" : "bottom";
4152          }
4153          const maximumClippingHeight = height - overflow.top - overflow.bottom;
4154          const maximumClippingWidth = width - overflow.left - overflow.right;
4155          const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
4156          const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
4157          const shiftData = state.middlewareData.shift;
4158          const noShift = !shiftData;
4159          let availableHeight = overflowAvailableHeight;
4160          let availableWidth = overflowAvailableWidth;
4161          if (shiftData != null && shiftData.enabled.x) {
4162            availableWidth = maximumClippingWidth;
4163          }
4164          if (shiftData != null && shiftData.enabled.y) {
4165            availableHeight = maximumClippingHeight;
4166          }
4167          if (noShift && !alignment) {
4168            if (isYAxis) {
4169              availableWidth = width - 2 * max(overflow.left, overflow.right);
4170            } else {
4171              availableHeight = height - 2 * max(overflow.top, overflow.bottom);
4172            }
4173          }
4174          await apply({
4175            ...state,
4176            availableWidth,
4177            availableHeight
4178          });
4179          const nextDimensions = await platform3.getDimensions(elements.floating);
4180          if (width !== nextDimensions.width || height !== nextDimensions.height) {
4181            return {
4182              reset: {
4183                rects: true
4184              }
4185            };
4186          }
4187          return {};
4188        }
4189      };
4190    };
4191  
4192    // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
4193    function getCssDimensions(element) {
4194      const css = getComputedStyle2(element);
4195      let width = parseFloat(css.width) || 0;
4196      let height = parseFloat(css.height) || 0;
4197      const hasOffset = isHTMLElement(element);
4198      const offsetWidth = hasOffset ? element.offsetWidth : width;
4199      const offsetHeight = hasOffset ? element.offsetHeight : height;
4200      const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
4201      if (shouldFallback) {
4202        width = offsetWidth;
4203        height = offsetHeight;
4204      }
4205      return {
4206        width,
4207        height,
4208        $: shouldFallback
4209      };
4210    }
4211    function unwrapElement(element) {
4212      return !isElement(element) ? element.contextElement : element;
4213    }
4214    function getScale(element) {
4215      const domElement = unwrapElement(element);
4216      if (!isHTMLElement(domElement)) {
4217        return createCoords(1);
4218      }
4219      const rect = domElement.getBoundingClientRect();
4220      const {
4221        width,
4222        height,
4223        $
4224      } = getCssDimensions(domElement);
4225      let x = ($ ? round(rect.width) : rect.width) / width;
4226      let y = ($ ? round(rect.height) : rect.height) / height;
4227      if (!x || !Number.isFinite(x)) {
4228        x = 1;
4229      }
4230      if (!y || !Number.isFinite(y)) {
4231        y = 1;
4232      }
4233      return {
4234        x,
4235        y
4236      };
4237    }
4238    var noOffsets = /* @__PURE__ */ createCoords(0);
4239    function getVisualOffsets(element) {
4240      const win = getWindow(element);
4241      if (!isWebKit() || !win.visualViewport) {
4242        return noOffsets;
4243      }
4244      return {
4245        x: win.visualViewport.offsetLeft,
4246        y: win.visualViewport.offsetTop
4247      };
4248    }
4249    function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
4250      if (isFixed === void 0) {
4251        isFixed = false;
4252      }
4253      return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
4254    }
4255    function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
4256      if (includeScale === void 0) {
4257        includeScale = false;
4258      }
4259      if (isFixedStrategy === void 0) {
4260        isFixedStrategy = false;
4261      }
4262      const clientRect = element.getBoundingClientRect();
4263      const domElement = unwrapElement(element);
4264      let scale = createCoords(1);
4265      if (includeScale) {
4266        if (offsetParent) {
4267          if (isElement(offsetParent)) {
4268            scale = getScale(offsetParent);
4269          }
4270        } else {
4271          scale = getScale(element);
4272        }
4273      }
4274      const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
4275      let x = (clientRect.left + visualOffsets.x) / scale.x;
4276      let y = (clientRect.top + visualOffsets.y) / scale.y;
4277      let width = clientRect.width / scale.x;
4278      let height = clientRect.height / scale.y;
4279      if (domElement && offsetParent) {
4280        const win = getWindow(domElement);
4281        const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
4282        let currentWin = win;
4283        let currentIFrame = getFrameElement(currentWin);
4284        while (currentIFrame && offsetWin !== currentWin) {
4285          const iframeScale = getScale(currentIFrame);
4286          const iframeRect = currentIFrame.getBoundingClientRect();
4287          const css = getComputedStyle2(currentIFrame);
4288          const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
4289          const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
4290          x *= iframeScale.x;
4291          y *= iframeScale.y;
4292          width *= iframeScale.x;
4293          height *= iframeScale.y;
4294          x += left;
4295          y += top;
4296          currentWin = getWindow(currentIFrame);
4297          currentIFrame = getFrameElement(currentWin);
4298        }
4299      }
4300      return rectToClientRect({
4301        width,
4302        height,
4303        x,
4304        y
4305      });
4306    }
4307    function getWindowScrollBarX(element, rect) {
4308      const leftScroll = getNodeScroll(element).scrollLeft;
4309      if (!rect) {
4310        return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
4311      }
4312      return rect.left + leftScroll;
4313    }
4314    function getHTMLOffset(documentElement, scroll) {
4315      const htmlRect = documentElement.getBoundingClientRect();
4316      const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
4317      const y = htmlRect.top + scroll.scrollTop;
4318      return {
4319        x,
4320        y
4321      };
4322    }
4323    function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
4324      let {
4325        elements,
4326        rect,
4327        offsetParent,
4328        strategy
4329      } = _ref;
4330      const isFixed = strategy === "fixed";
4331      const documentElement = getDocumentElement(offsetParent);
4332      const topLayer = elements ? isTopLayer(elements.floating) : false;
4333      if (offsetParent === documentElement || topLayer && isFixed) {
4334        return rect;
4335      }
4336      let scroll = {
4337        scrollLeft: 0,
4338        scrollTop: 0
4339      };
4340      let scale = createCoords(1);
4341      const offsets = createCoords(0);
4342      const isOffsetParentAnElement = isHTMLElement(offsetParent);
4343      if (isOffsetParentAnElement || !isFixed) {
4344        if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
4345          scroll = getNodeScroll(offsetParent);
4346        }
4347        if (isOffsetParentAnElement) {
4348          const offsetRect = getBoundingClientRect(offsetParent);
4349          scale = getScale(offsetParent);
4350          offsets.x = offsetRect.x + offsetParent.clientLeft;
4351          offsets.y = offsetRect.y + offsetParent.clientTop;
4352        }
4353      }
4354      const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
4355      return {
4356        width: rect.width * scale.x,
4357        height: rect.height * scale.y,
4358        x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
4359        y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
4360      };
4361    }
4362    function getClientRects(element) {
4363      return element.getClientRects ? Array.from(element.getClientRects()) : [];
4364    }
4365    function getDocumentRect(html) {
4366      const scroll = getNodeScroll(html);
4367      const body = html.ownerDocument.body;
4368      const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
4369      const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
4370      let x = -scroll.scrollLeft + getWindowScrollBarX(html);
4371      const y = -scroll.scrollTop;
4372      if (getComputedStyle2(body).direction === "rtl") {
4373        x += max(html.clientWidth, body.clientWidth) - width;
4374      }
4375      return {
4376        width,
4377        height,
4378        x,
4379        y
4380      };
4381    }
4382    var SCROLLBAR_MAX = 25;
4383    function getViewportRect(element, strategy, rootBoundary) {
4384      if (rootBoundary === void 0) {
4385        rootBoundary = "viewport";
4386      }
4387      const isLayoutViewport = rootBoundary === "layoutViewport";
4388      const win = getWindow(element);
4389      const html = getDocumentElement(element);
4390      const visualViewport = win.visualViewport;
4391      let width = html.clientWidth;
4392      let height = html.clientHeight;
4393      let x = 0;
4394      let y = 0;
4395      if (visualViewport) {
4396        const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed";
4397        if (isLayoutViewport) {
4398          if (!layoutRelativeClientCoords) {
4399            x = -visualViewport.offsetLeft;
4400            y = -visualViewport.offsetTop;
4401          }
4402        } else {
4403          width = visualViewport.width;
4404          height = visualViewport.height;
4405          if (layoutRelativeClientCoords) {
4406            x = visualViewport.offsetLeft;
4407            y = visualViewport.offsetTop;
4408          }
4409        }
4410      }
4411      const windowScrollbarX = getWindowScrollBarX(html);
4412      if (windowScrollbarX <= 0) {
4413        const doc = html.ownerDocument;
4414        const body = doc.body;
4415        const bodyStyles = getComputedStyle(body);
4416        const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
4417        const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
4418        const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth;
4419        if (gutter <= SCROLLBAR_MAX) {
4420          width -= gutter;
4421        }
4422      }
4423      return {
4424        width,
4425        height,
4426        x,
4427        y
4428      };
4429    }
4430    function getInnerBoundingClientRect(element, strategy) {
4431      const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
4432      const top = clientRect.top + element.clientTop;
4433      const left = clientRect.left + element.clientLeft;
4434      const scale = getScale(element);
4435      const width = element.clientWidth * scale.x;
4436      const height = element.clientHeight * scale.y;
4437      const x = left * scale.x;
4438      const y = top * scale.y;
4439      return {
4440        width,
4441        height,
4442        x,
4443        y
4444      };
4445    }
4446    function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
4447      let rect;
4448      if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") {
4449        rect = getViewportRect(element, strategy, clippingAncestor);
4450      } else if (clippingAncestor === "document") {
4451        rect = getDocumentRect(getDocumentElement(element));
4452      } else if (isElement(clippingAncestor)) {
4453        rect = getInnerBoundingClientRect(clippingAncestor, strategy);
4454      } else {
4455        const visualOffsets = getVisualOffsets(element);
4456        rect = {
4457          x: clippingAncestor.x - visualOffsets.x,
4458          y: clippingAncestor.y - visualOffsets.y,
4459          width: clippingAncestor.width,
4460          height: clippingAncestor.height
4461        };
4462      }
4463      return rectToClientRect(rect);
4464    }
4465    function getClippingElementAncestors(element, cache) {
4466      const cachedResult = cache.get(element);
4467      if (cachedResult) {
4468        return cachedResult;
4469      }
4470      let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
4471      let lastKeptComputedStyle = null;
4472      const elementIsFixed = getComputedStyle2(element).position === "fixed";
4473      let currentNode = elementIsFixed ? getParentNode(element) : element;
4474      while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
4475        const computedStyle = getComputedStyle2(currentNode);
4476        const currentNodeIsContaining = isContainingBlock(currentNode);
4477        const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : "";
4478        const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static");
4479        if (shouldDropCurrentNode) {
4480          result = result.filter((ancestor) => ancestor !== currentNode);
4481        } else {
4482          lastKeptComputedStyle = computedStyle;
4483        }
4484        currentNode = getParentNode(currentNode);
4485      }
4486      cache.set(element, result);
4487      return result;
4488    }
4489    function getClippingRect(_ref) {
4490      let {
4491        element,
4492        boundary,
4493        rootBoundary,
4494        strategy
4495      } = _ref;
4496      const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
4497      const clippingAncestors = [...elementClippingAncestors, rootBoundary];
4498      const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
4499      let top = firstRect.top;
4500      let right = firstRect.right;
4501      let bottom = firstRect.bottom;
4502      let left = firstRect.left;
4503      for (let i = 1; i < clippingAncestors.length; i++) {
4504        const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
4505        top = max(rect.top, top);
4506        right = min(rect.right, right);
4507        bottom = min(rect.bottom, bottom);
4508        left = max(rect.left, left);
4509      }
4510      return {
4511        width: right - left,
4512        height: bottom - top,
4513        x: left,
4514        y: top
4515      };
4516    }
4517    function getDimensions(element) {
4518      const {
4519        width,
4520        height
4521      } = getCssDimensions(element);
4522      return {
4523        width,
4524        height
4525      };
4526    }
4527    function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
4528      const isOffsetParentAnElement = isHTMLElement(offsetParent);
4529      const documentElement = getDocumentElement(offsetParent);
4530      const isFixed = strategy === "fixed";
4531      const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
4532      let scroll = {
4533        scrollLeft: 0,
4534        scrollTop: 0
4535      };
4536      const offsets = createCoords(0);
4537      if (isOffsetParentAnElement || !isFixed) {
4538        if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
4539          scroll = getNodeScroll(offsetParent);
4540        }
4541        if (isOffsetParentAnElement) {
4542          const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
4543          offsets.x = offsetRect.x + offsetParent.clientLeft;
4544          offsets.y = offsetRect.y + offsetParent.clientTop;
4545        }
4546      }
4547      if (!isOffsetParentAnElement && documentElement) {
4548        offsets.x = getWindowScrollBarX(documentElement);
4549      }
4550      const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
4551      const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
4552      const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
4553      return {
4554        x,
4555        y,
4556        width: rect.width,
4557        height: rect.height
4558      };
4559    }
4560    function isStaticPositioned(element) {
4561      return getComputedStyle2(element).position === "static";
4562    }
4563    function getTrueOffsetParent(element, polyfill) {
4564      if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
4565        return null;
4566      }
4567      if (polyfill) {
4568        return polyfill(element);
4569      }
4570      let rawOffsetParent = element.offsetParent;
4571      if (getDocumentElement(element) === rawOffsetParent) {
4572        rawOffsetParent = rawOffsetParent.ownerDocument.body;
4573      }
4574      return rawOffsetParent;
4575    }
4576    function getOffsetParent(element, polyfill) {
4577      const win = getWindow(element);
4578      if (isTopLayer(element)) {
4579        return win;
4580      }
4581      if (!isHTMLElement(element)) {
4582        let svgOffsetParent = getParentNode(element);
4583        while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
4584          if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
4585            return svgOffsetParent;
4586          }
4587          svgOffsetParent = getParentNode(svgOffsetParent);
4588        }
4589        return win;
4590      }
4591      let offsetParent = getTrueOffsetParent(element, polyfill);
4592      while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
4593        offsetParent = getTrueOffsetParent(offsetParent, polyfill);
4594      }
4595      if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
4596        return win;
4597      }
4598      return offsetParent || getContainingBlock(element) || win;
4599    }
4600    var getElementRects = async function(data) {
4601      const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
4602      const getDimensionsFn = this.getDimensions;
4603      const floatingDimensions = await getDimensionsFn(data.floating);
4604      return {
4605        reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
4606        floating: {
4607          x: 0,
4608          y: 0,
4609          width: floatingDimensions.width,
4610          height: floatingDimensions.height
4611        }
4612      };
4613    };
4614    function isRTL(element) {
4615      return getComputedStyle2(element).direction === "rtl";
4616    }
4617    var platform2 = {
4618      convertOffsetParentRelativeRectToViewportRelativeRect,
4619      getDocumentElement,
4620      getClippingRect,
4621      getOffsetParent,
4622      getElementRects,
4623      getClientRects,
4624      getDimensions,
4625      getScale,
4626      isElement,
4627      isRTL
4628    };
4629    function rectsAreEqual(a, b) {
4630      return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
4631    }
4632    function observeMove(element, onMove, ancestorResize) {
4633      let io = null;
4634      let timeoutId;
4635      const root = getDocumentElement(element);
4636      function cleanup() {
4637        var _io;
4638        clearTimeout(timeoutId);
4639        (_io = io) == null || _io.disconnect();
4640        io = null;
4641      }
4642      function refresh(skip, threshold) {
4643        if (skip === void 0) {
4644          skip = false;
4645        }
4646        if (threshold === void 0) {
4647          threshold = 1;
4648        }
4649        cleanup();
4650        const elementRectForRootMargin = element.getBoundingClientRect();
4651        const {
4652          left,
4653          top,
4654          width,
4655          height
4656        } = elementRectForRootMargin;
4657        if (!skip) {
4658          onMove();
4659        }
4660        if (!width || !height) {
4661          return;
4662        }
4663        const insetTop = floor(top);
4664        const insetRight = floor(root.clientWidth - (left + width));
4665        const insetBottom = floor(root.clientHeight - (top + height));
4666        const insetLeft = floor(left);
4667        const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
4668        const options = {
4669          rootMargin,
4670          threshold: max(0, min(1, threshold)) || 1
4671        };
4672        let isFirstUpdate = true;
4673        function handleObserve(entries) {
4674          const ratio = entries[0].intersectionRatio;
4675          if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
4676            return refresh();
4677          }
4678          if (ratio !== threshold) {
4679            if (!isFirstUpdate) {
4680              return refresh();
4681            }
4682            if (!ratio) {
4683              timeoutId = setTimeout(() => {
4684                refresh(false, 1e-7);
4685              }, 1e3);
4686            } else {
4687              refresh(false, ratio);
4688            }
4689          }
4690          isFirstUpdate = false;
4691        }
4692        try {
4693          io = new IntersectionObserver(handleObserve, {
4694            ...options,
4695            // Handle <iframe>s
4696            root: root.ownerDocument
4697          });
4698        } catch (_e) {
4699          io = new IntersectionObserver(handleObserve, options);
4700        }
4701        io.observe(element);
4702      }
4703      const win = getWindow(element);
4704      const handleResize = () => refresh(ancestorResize);
4705      win.addEventListener("resize", handleResize);
4706      refresh(true);
4707      return () => {
4708        win.removeEventListener("resize", handleResize);
4709        cleanup();
4710      };
4711    }
4712    function autoUpdate(reference, floating, update2, options) {
4713      if (options === void 0) {
4714        options = {};
4715      }
4716      const {
4717        ancestorScroll = true,
4718        ancestorResize = true,
4719        elementResize = typeof ResizeObserver === "function",
4720        layoutShift = typeof IntersectionObserver === "function",
4721        animationFrame = false
4722      } = options;
4723      const referenceEl = unwrapElement(reference);
4724      const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
4725      ancestors.forEach((ancestor) => {
4726        ancestorScroll && ancestor.addEventListener("scroll", update2);
4727        ancestorResize && ancestor.addEventListener("resize", update2);
4728      });
4729      const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2, ancestorResize) : null;
4730      let reobserveFrame = -1;
4731      let resizeObserver = null;
4732      if (elementResize) {
4733        resizeObserver = new ResizeObserver((_ref) => {
4734          let [firstEntry] = _ref;
4735          if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
4736            resizeObserver.unobserve(floating);
4737            cancelAnimationFrame(reobserveFrame);
4738            reobserveFrame = requestAnimationFrame(() => {
4739              var _resizeObserver;
4740              (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
4741            });
4742          }
4743          update2();
4744        });
4745        if (referenceEl && !animationFrame) {
4746          resizeObserver.observe(referenceEl);
4747        }
4748        if (floating) {
4749          resizeObserver.observe(floating);
4750        }
4751      }
4752      let frameId;
4753      let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
4754      if (animationFrame) {
4755        frameLoop();
4756      }
4757      function frameLoop() {
4758        const nextRefRect = getBoundingClientRect(reference);
4759        if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
4760          update2();
4761        }
4762        prevRefRect = nextRefRect;
4763        frameId = requestAnimationFrame(frameLoop);
4764      }
4765      update2();
4766      return () => {
4767        var _resizeObserver2;
4768        ancestors.forEach((ancestor) => {
4769          ancestorScroll && ancestor.removeEventListener("scroll", update2);
4770          ancestorResize && ancestor.removeEventListener("resize", update2);
4771        });
4772        cleanupIo == null || cleanupIo();
4773        (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
4774        resizeObserver = null;
4775        if (animationFrame) {
4776          cancelAnimationFrame(frameId);
4777        }
4778      };
4779    }
4780    var offset2 = offset;
4781    var shift2 = shift;
4782    var flip2 = flip;
4783    var size2 = size;
4784    var limitShift2 = limitShift;
4785    var computePosition2 = (reference, floating, options) => {
4786      const cache = /* @__PURE__ */ new Map();
4787      const mergedOptions = options != null ? options : {};
4788      const platformWithCache = {
4789        ...platform2,
4790        ...mergedOptions.platform,
4791        _c: cache
4792      };
4793      return computePosition(reference, floating, {
4794        ...mergedOptions,
4795        platform: platformWithCache
4796      });
4797    };
4798  
4799    // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
4800    var React17 = __toESM(require_react(), 1);
4801    var import_react2 = __toESM(require_react(), 1);
4802    var ReactDOM3 = __toESM(require_react_dom(), 1);
4803    var isClient = typeof document !== "undefined";
4804    var noop2 = function noop3() {
4805    };
4806    var index = isClient ? import_react2.useLayoutEffect : noop2;
4807    function deepEqual(a, b) {
4808      if (a === b) {
4809        return true;
4810      }
4811      if (typeof a !== typeof b) {
4812        return false;
4813      }
4814      if (typeof a === "function" && a.toString() === b.toString()) {
4815        return true;
4816      }
4817      let length;
4818      let i;
4819      let keys;
4820      if (a && b && typeof a === "object") {
4821        if (Array.isArray(a)) {
4822          length = a.length;
4823          if (length !== b.length) return false;
4824          for (i = length; i-- !== 0; ) {
4825            if (!deepEqual(a[i], b[i])) {
4826              return false;
4827            }
4828          }
4829          return true;
4830        }
4831        keys = Object.keys(a);
4832        length = keys.length;
4833        if (length !== Object.keys(b).length) {
4834          return false;
4835        }
4836        for (i = length; i-- !== 0; ) {
4837          if (!{}.hasOwnProperty.call(b, keys[i])) {
4838            return false;
4839          }
4840        }
4841        for (i = length; i-- !== 0; ) {
4842          const key = keys[i];
4843          if (key === "_owner" && a.$$typeof) {
4844            continue;
4845          }
4846          if (!deepEqual(a[key], b[key])) {
4847            return false;
4848          }
4849        }
4850        return true;
4851      }
4852      return a !== a && b !== b;
4853    }
4854    function getDPR(element) {
4855      if (typeof window === "undefined") {
4856        return 1;
4857      }
4858      const win = element.ownerDocument.defaultView || window;
4859      return win.devicePixelRatio || 1;
4860    }
4861    function roundByDPR(element, value) {
4862      const dpr = getDPR(element);
4863      return Math.round(value * dpr) / dpr;
4864    }
4865    function useLatestRef(value) {
4866      const ref = React17.useRef(value);
4867      index(() => {
4868        ref.current = value;
4869      });
4870      return ref;
4871    }
4872    function useFloating(options) {
4873      if (options === void 0) {
4874        options = {};
4875      }
4876      const {
4877        placement = "bottom",
4878        strategy = "absolute",
4879        middleware = [],
4880        platform: platform3,
4881        elements: {
4882          reference: externalReference,
4883          floating: externalFloating
4884        } = {},
4885        transform = true,
4886        whileElementsMounted,
4887        open
4888      } = options;
4889      const [data, setData] = React17.useState({
4890        x: 0,
4891        y: 0,
4892        strategy,
4893        placement,
4894        middlewareData: {},
4895        isPositioned: false
4896      });
4897      const [latestMiddleware, setLatestMiddleware] = React17.useState(middleware);
4898      if (!deepEqual(latestMiddleware, middleware)) {
4899        setLatestMiddleware(middleware);
4900      }
4901      const [_reference, _setReference] = React17.useState(null);
4902      const [_floating, _setFloating] = React17.useState(null);
4903      const setReference = React17.useCallback((node) => {
4904        if (node !== referenceRef.current) {
4905          referenceRef.current = node;
4906          _setReference(node);
4907        }
4908      }, []);
4909      const setFloating = React17.useCallback((node) => {
4910        if (node !== floatingRef.current) {
4911          floatingRef.current = node;
4912          _setFloating(node);
4913        }
4914      }, []);
4915      const referenceEl = externalReference || _reference;
4916      const floatingEl = externalFloating || _floating;
4917      const referenceRef = React17.useRef(null);
4918      const floatingRef = React17.useRef(null);
4919      const dataRef = React17.useRef(data);
4920      const hasWhileElementsMounted = whileElementsMounted != null;
4921      const whileElementsMountedRef = useLatestRef(whileElementsMounted);
4922      const platformRef = useLatestRef(platform3);
4923      const openRef = useLatestRef(open);
4924      const update2 = React17.useCallback(() => {
4925        if (!referenceRef.current || !floatingRef.current) {
4926          return;
4927        }
4928        const config = {
4929          placement,
4930          strategy,
4931          middleware: latestMiddleware
4932        };
4933        if (platformRef.current) {
4934          config.platform = platformRef.current;
4935        }
4936        computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => {
4937          const fullData = {
4938            ...data2,
4939            // The floating element's position may be recomputed while it's closed
4940            // but still mounted (such as when transitioning out). To ensure
4941            // `isPositioned` will be `false` initially on the next open, avoid
4942            // setting it to `true` when `open === false` (must be specified).
4943            isPositioned: openRef.current !== false
4944          };
4945          if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
4946            dataRef.current = fullData;
4947            ReactDOM3.flushSync(() => {
4948              setData(fullData);
4949            });
4950          }
4951        });
4952      }, [latestMiddleware, placement, strategy, platformRef, openRef]);
4953      index(() => {
4954        if (open === false && dataRef.current.isPositioned) {
4955          dataRef.current.isPositioned = false;
4956          setData((data2) => ({
4957            ...data2,
4958            isPositioned: false
4959          }));
4960        }
4961      }, [open]);
4962      const isMountedRef = React17.useRef(false);
4963      index(() => {
4964        isMountedRef.current = true;
4965        return () => {
4966          isMountedRef.current = false;
4967        };
4968      }, []);
4969      index(() => {
4970        if (referenceEl) referenceRef.current = referenceEl;
4971        if (floatingEl) floatingRef.current = floatingEl;
4972        if (referenceEl && floatingEl) {
4973          if (whileElementsMountedRef.current) {
4974            return whileElementsMountedRef.current(referenceEl, floatingEl, update2);
4975          }
4976          update2();
4977        }
4978      }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]);
4979      const refs = React17.useMemo(() => ({
4980        reference: referenceRef,
4981        floating: floatingRef,
4982        setReference,
4983        setFloating
4984      }), [setReference, setFloating]);
4985      const elements = React17.useMemo(() => ({
4986        reference: referenceEl,
4987        floating: floatingEl
4988      }), [referenceEl, floatingEl]);
4989      const floatingStyles = React17.useMemo(() => {
4990        const initialStyles = {
4991          position: strategy,
4992          left: 0,
4993          top: 0
4994        };
4995        if (!elements.floating) {
4996          return initialStyles;
4997        }
4998        const x = roundByDPR(elements.floating, data.x);
4999        const y = roundByDPR(elements.floating, data.y);
5000        if (transform) {
5001          return {
5002            ...initialStyles,
5003            transform: "translate(" + x + "px, " + y + "px)",
5004            ...getDPR(elements.floating) >= 1.5 && {
5005              willChange: "transform"
5006            }
5007          };
5008        }
5009        return {
5010          position: strategy,
5011          left: x,
5012          top: y
5013        };
5014      }, [strategy, transform, elements.floating, data.x, data.y]);
5015      return React17.useMemo(() => ({
5016        ...data,
5017        update: update2,
5018        refs,
5019        elements,
5020        floatingStyles
5021      }), [data, update2, refs, elements, floatingStyles]);
5022    }
5023    var offset3 = (options, deps) => {
5024      const result = offset2(options);
5025      return {
5026        name: result.name,
5027        fn: result.fn,
5028        options: [options, deps]
5029      };
5030    };
5031    var shift3 = (options, deps) => {
5032      const result = shift2(options);
5033      return {
5034        name: result.name,
5035        fn: result.fn,
5036        options: [options, deps]
5037      };
5038    };
5039    var limitShift3 = (options, deps) => {
5040      const result = limitShift2(options);
5041      return {
5042        fn: result.fn,
5043        options: [options, deps]
5044      };
5045    };
5046    var flip3 = (options, deps) => {
5047      const result = flip2(options);
5048      return {
5049        name: result.name,
5050        fn: result.fn,
5051        options: [options, deps]
5052      };
5053    };
5054    var size3 = (options, deps) => {
5055      const result = size2(options);
5056      return {
5057        name: result.name,
5058        fn: result.fn,
5059        options: [options, deps]
5060      };
5061    };
5062  
5063    // node_modules/@base-ui/react/utils/popups/popupHandle.mjs
5064    var BasePopupHandle = class {
5065      /**
5066       * Stores of every root currently using this handle, in attach order. A handle is meant to be used
5067       * by a single mounted root, but roots can transiently overlap (e.g. during an animated route
5068       * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of
5069       * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first.
5070       */
5071      attachedStores = [];
5072      /**
5073       * Store of the root that currently controls the handle: the most recently attached one still
5074       * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`.
5075       */
5076      attachedStoreValue = null;
5077      /**
5078       * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer.
5079       */
5080      storeListeners = /* @__PURE__ */ new Set();
5081      /**
5082       * Creates a handle backed by the store used while no root is attached.
5083       *
5084       * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached,
5085       * so they can render and register without a mounted root. Triggers register into whichever store
5086       * `store` currently resolves to, so while detached they live in this store's trigger map and
5087       * migrate themselves to the root's store (and back) as it attaches/detaches.
5088       * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces
5089       * `MenuHandle.open()` in warning text.
5090       * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is
5091       * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to,
5092       * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning.
5093       */
5094      constructor(fallbackStore, componentName, throwOnMissingTrigger = true) {
5095        this.fallbackStore = fallbackStore;
5096        this.componentName = componentName;
5097        this.throwOnMissingTrigger = throwOnMissingTrigger;
5098      }
5099      get attachedStore() {
5100        return this.attachedStoreValue;
5101      }
5102      /**
5103       * Store that detached triggers read from: the attached root's store, or an inert fallback store
5104       * used while no root is attached.
5105       * @internal
5106       */
5107      get store() {
5108        return this.attachedStoreValue ?? this.fallbackStore;
5109      }
5110      /**
5111       * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on
5112       * the handle during render because a handle can be shared by concurrent server-rendered requests.
5113       * @internal
5114       */
5115      get serverStore() {
5116        return this.fallbackStore;
5117      }
5118      /**
5119       * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind
5120       * when a root attaches or detaches. Returns a function that removes the listener.
5121       * @internal
5122       */
5123      subscribeStore(listener) {
5124        this.storeListeners.add(listener);
5125        return () => {
5126          this.storeListeners.delete(listener);
5127        };
5128      }
5129      /**
5130       * Points the handle at a root's store and notifies subscribers so detached triggers re-render and
5131       * re-register into it (their registration ref re-fires on the store-pointer change). Returns a
5132       * cleanup function that detaches the store again.
5133       * @internal
5134       */
5135      attachStore(newStore) {
5136        this.attachedStores.push(newStore);
5137        this.setActiveStore(newStore);
5138        if (true) {
5139          if (this.attachedStores.length > 1) {
5140            const dev = this;
5141            (dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => {
5142              if (this.attachedStores.length > 1) {
5143                console.warn("Base UI: A handle is attached to more than one mounted root at the same time. The most recently mounted root takes over and the previous one stops being controlled by the handle. A handle should be used by a single root that stays mounted for the lifetime of the handle.");
5144              }
5145            });
5146          }
5147        }
5148        return () => {
5149          const index2 = this.attachedStores.lastIndexOf(newStore);
5150          if (index2 !== -1) {
5151            this.attachedStores.splice(index2, 1);
5152          }
5153          this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null);
5154        };
5155      }
5156      /**
5157       * Sets the store that currently controls the handle and notifies subscribers when it changes, so
5158       * detached triggers re-render and migrate their registration to the new store.
5159       */
5160      setActiveStore(store2) {
5161        if (this.attachedStoreValue !== store2) {
5162          this.attachedStoreValue = store2;
5163          this.storeListeners.forEach((listener) => {
5164            listener();
5165          });
5166        }
5167      }
5168      /**
5169       * Opens the attached root's store and associates it with the trigger with the given id, or a
5170       * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public
5171       * `open()` method, which only narrows the parameter type.
5172       *
5173       * When a trigger id is given but no matching trigger is registered, anchored popups throw (see
5174       * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead.
5175       *
5176       * This method should only be called in an event handler or an effect (not during rendering).
5177       *
5178       * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open
5179       * without associating any trigger.
5180       */
5181      openByTrigger(triggerId) {
5182        const attachedStore = this.attachedStore;
5183        if (attachedStore === null) {
5184          if (true) {
5185            console.warn(`Base UI: $this.componentName}Handle.open() was called while no root using this handle is mounted. The call was ignored; mount a root with this handle before opening it imperatively.`);
5186          }
5187          return;
5188        }
5189        let triggerElement;
5190        if (triggerId) {
5191          for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) {
5192            triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId);
5193          }
5194          triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId);
5195        }
5196        if (triggerId && !triggerElement) {
5197          if (this.throwOnMissingTrigger) {
5198            throw new Error(true ? `Base UI: $this.componentName}Handle.open() was called with the trigger id "$triggerId}", but no matching trigger is registered with this handle. An anchored popup cannot open without a trigger to anchor to. Pass the id of a mounted $this.componentName}.Trigger that has this handle set on its "handle" prop.` : formatErrorMessage_default(99, this.componentName, triggerId, this.componentName));
5199          }
5200          if (true) {
5201            console.warn(`Base UI: $this.componentName}Handle.open: No trigger found with id "$triggerId}". The popup will open, but the trigger will not be associated with it.`);
5202          }
5203        }
5204        attachedStore.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement));
5205      }
5206      /**
5207       * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning)
5208       * while no root is attached. Shared by every concrete handle's public `close()` method.
5209       *
5210       * This method should only be called in an event handler or an effect (not during rendering).
5211       */
5212      closePopup() {
5213        const attachedStore = this.attachedStore;
5214        if (attachedStore === null) {
5215          if (true) {
5216            console.warn(`Base UI: $this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`);
5217          }
5218          return;
5219        }
5220        attachedStore.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction));
5221      }
5222    };
5223  
5224    // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
5225    var React22 = __toESM(require_react(), 1);
5226    var ReactDOM4 = __toESM(require_react_dom(), 1);
5227  
5228    // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
5229    var React21 = __toESM(require_react(), 1);
5230  
5231    // node_modules/@base-ui/utils/store/useStore.mjs
5232    var React19 = __toESM(require_react(), 1);
5233    var import_shim = __toESM(require_shim(), 1);
5234    var import_with_selector = __toESM(require_with_selector(), 1);
5235  
5236    // node_modules/@base-ui/utils/fastHooks.mjs
5237    var React18 = __toESM(require_react(), 1);
5238    var hooks = [];
5239    var currentInstance = void 0;
5240    function getInstance() {
5241      return currentInstance;
5242    }
5243    function register2(hook) {
5244      hooks.push(hook);
5245    }
5246    function fastComponent(fn) {
5247      const FastComponent = (props, forwardedRef) => {
5248        const instance = useRefWithInit(createInstance).current;
5249        let result;
5250        try {
5251          currentInstance = instance;
5252          for (const hook of hooks) {
5253            hook.before(instance);
5254          }
5255          result = fn(props, forwardedRef);
5256          for (const hook of hooks) {
5257            hook.after(instance);
5258          }
5259          instance.didInitialize = true;
5260        } finally {
5261          currentInstance = void 0;
5262        }
5263        return result;
5264      };
5265      FastComponent.displayName = fn.displayName || fn.name;
5266      return FastComponent;
5267    }
5268    function fastComponentRef(fn) {
5269      return /* @__PURE__ */ React18.forwardRef(fastComponent(fn));
5270    }
5271    function createInstance() {
5272      return {
5273        didInitialize: false
5274      };
5275    }
5276  
5277    // node_modules/@base-ui/utils/store/useStore.mjs
5278    var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);
5279    var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;
5280    function useStore(store2, selector, a1, a2, a3) {
5281      return useStoreImplementation(store2, selector, a1, a2, a3);
5282    }
5283    function useStoreR19(store2, selector, a1, a2, a3) {
5284      const getSelection = React19.useCallback(() => selector(store2.getSnapshot(), a1, a2, a3), [store2, selector, a1, a2, a3]);
5285      return (0, import_shim.useSyncExternalStore)(store2.subscribe, getSelection, getSelection);
5286    }
5287    register2({
5288      before(instance) {
5289        instance.syncIndex = 0;
5290        if (!instance.didInitialize) {
5291          instance.syncTick = 1;
5292          instance.syncHooks = [];
5293          instance.didChangeStore = true;
5294          instance.getSnapshot = () => {
5295            let didChange2 = false;
5296            for (let i = 0; i < instance.syncHooks.length; i += 1) {
5297              const hook = instance.syncHooks[i];
5298              const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);
5299              if (!Object.is(hook.value, value)) {
5300                didChange2 = true;
5301                hook.value = value;
5302              }
5303            }
5304            if (didChange2) {
5305              instance.syncTick += 1;
5306            }
5307            return instance.syncTick;
5308          };
5309        }
5310      },
5311      after(instance) {
5312        if (instance.syncHooks.length > 0) {
5313          if (instance.didChangeStore) {
5314            instance.didChangeStore = false;
5315            instance.subscribe = (onStoreChange) => {
5316              const stores = /* @__PURE__ */ new Set();
5317              for (const hook of instance.syncHooks) {
5318                stores.add(hook.store);
5319              }
5320              const unsubscribes = [];
5321              for (const store2 of stores) {
5322                unsubscribes.push(store2.subscribe(onStoreChange));
5323              }
5324              return () => {
5325                for (const unsubscribe of unsubscribes) {
5326                  unsubscribe();
5327                }
5328              };
5329            };
5330          }
5331          (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot);
5332        }
5333      }
5334    });
5335    function useStoreFast(store2, selector, a1, a2, a3) {
5336      const instance = getInstance();
5337      if (!instance) {
5338        return useStoreR19(store2, selector, a1, a2, a3);
5339      }
5340      const index2 = instance.syncIndex;
5341      instance.syncIndex += 1;
5342      let hook;
5343      if (!instance.didInitialize) {
5344        hook = {
5345          store: store2,
5346          selector,
5347          a1,
5348          a2,
5349          a3,
5350          value: selector(store2.getSnapshot(), a1, a2, a3)
5351        };
5352        instance.syncHooks.push(hook);
5353      } else {
5354        hook = instance.syncHooks[index2];
5355        if (hook.store !== store2 || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {
5356          if (hook.store !== store2) {
5357            instance.didChangeStore = true;
5358          }
5359          hook.store = store2;
5360          hook.selector = selector;
5361          hook.a1 = a1;
5362          hook.a2 = a2;
5363          hook.a3 = a3;
5364          hook.value = selector(store2.getSnapshot(), a1, a2, a3);
5365        }
5366      }
5367      return hook.value;
5368    }
5369    function useStoreLegacy(store2, selector, a1, a2, a3) {
5370      return (0, import_with_selector.useSyncExternalStoreWithSelector)(store2.subscribe, store2.getSnapshot, store2.getSnapshot, (state) => selector(state, a1, a2, a3));
5371    }
5372  
5373    // node_modules/@base-ui/utils/store/Store.mjs
5374    var Store = class {
5375      /**
5376       * The current state of the store.
5377       * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
5378       * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).
5379       * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
5380       *
5381       * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
5382       */
5383      // Internal state to handle recursive `setState()` calls
5384      constructor(state) {
5385        this.state = state;
5386        this.listeners = /* @__PURE__ */ new Set();
5387        this.updateTick = 0;
5388      }
5389      /**
5390       * Registers a listener that will be called whenever the store's state changes.
5391       *
5392       * @param fn The listener function to be called on state changes.
5393       * @returns A function to unsubscribe the listener.
5394       */
5395      subscribe = (fn) => {
5396        this.listeners.add(fn);
5397        return () => {
5398          this.listeners.delete(fn);
5399        };
5400      };
5401      /**
5402       * Returns the current state of the store.
5403       */
5404      getSnapshot = () => {
5405        return this.state;
5406      };
5407      /**
5408       * Updates the entire store's state and notifies all registered listeners.
5409       *
5410       * @param newState The new state to set for the store.
5411       */
5412      setState(newState) {
5413        if (this.state === newState) {
5414          return;
5415        }
5416        this.state = newState;
5417        this.updateTick += 1;
5418        const currentTick = this.updateTick;
5419        for (const listener of this.listeners) {
5420          if (currentTick !== this.updateTick) {
5421            return;
5422          }
5423          listener(newState);
5424        }
5425      }
5426      /**
5427       * Merges the provided changes into the current state and notifies listeners if there are changes.
5428       *
5429       * @param changes An object containing the changes to apply to the current state.
5430       */
5431      update(changes) {
5432        for (const key in changes) {
5433          if (!Object.is(this.state[key], changes[key])) {
5434            this.setState({
5435              ...this.state,
5436              ...changes
5437            });
5438            return;
5439          }
5440        }
5441      }
5442      /**
5443       * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
5444       *
5445       * @param key The key in the store's state to update.
5446       * @param value The new value to set for the specified key.
5447       */
5448      set(key, value) {
5449        if (!Object.is(this.state[key], value)) {
5450          this.setState({
5451            ...this.state,
5452            [key]: value
5453          });
5454        }
5455      }
5456      /**
5457       * Gives the state a new reference and updates all registered listeners.
5458       */
5459      notifyAll() {
5460        const newState = {
5461          ...this.state
5462        };
5463        this.setState(newState);
5464      }
5465      use(selector, a1, a2, a3) {
5466        return useStore(this, selector, a1, a2, a3);
5467      }
5468    };
5469  
5470    // node_modules/@base-ui/utils/store/ReactStore.mjs
5471    var React20 = __toESM(require_react(), 1);
5472    var ReactStore = class extends Store {
5473      /**
5474       * Creates a new ReactStore instance.
5475       *
5476       * @param state Initial state of the store.
5477       * @param context Non-reactive context values.
5478       * @param selectors Optional selectors for use with `useState`.
5479       */
5480      constructor(state, context = {}, selectors3) {
5481        super(state);
5482        this.context = context;
5483        this.selectors = selectors3;
5484      }
5485      /**
5486       * Non-reactive values such as refs, callbacks, etc.
5487       */
5488      /**
5489       * Synchronizes a single external value into the store.
5490       *
5491       * Note that the while the value in `state` is updated immediately, the value returned
5492       * by `useState` is updated before the next render (similarly to React's `useState`).
5493       */
5494      useSyncedValue(key, value) {
5495        React20.useDebugValue(key);
5496        const store2 = this;
5497        useIsoLayoutEffect(() => {
5498          if (store2.state[key] !== value) {
5499            store2.set(key, value);
5500          }
5501        }, [store2, key, value]);
5502      }
5503      /**
5504       * Synchronizes a single external value into the store and
5505       * cleans it up (sets to `undefined`) on unmount.
5506       *
5507       * Note that the while the value in `state` is updated immediately, the value returned
5508       * by `useState` is updated before the next render (similarly to React's `useState`).
5509       */
5510      useSyncedValueWithCleanup(key, value) {
5511        const store2 = this;
5512        useIsoLayoutEffect(() => {
5513          if (store2.state[key] !== value) {
5514            store2.set(key, value);
5515          }
5516          return () => {
5517            store2.set(key, void 0);
5518          };
5519        }, [store2, key, value]);
5520      }
5521      /**
5522       * Synchronizes multiple external values into the store.
5523       *
5524       * Note that the while the values in `state` are updated immediately, the values returned
5525       * by `useState` are updated before the next render (similarly to React's `useState`).
5526       */
5527      useSyncedValues(statePart) {
5528        const store2 = this;
5529        if (true) {
5530          React20.useDebugValue(statePart, (p) => Object.keys(p));
5531          const keys = React20.useRef(Object.keys(statePart)).current;
5532          const nextKeys = Object.keys(statePart);
5533          if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) {
5534            console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
5535          }
5536        }
5537        const dependencies = Object.values(statePart);
5538        useIsoLayoutEffect(() => {
5539          store2.update(statePart);
5540        }, [store2, ...dependencies]);
5541      }
5542      /**
5543       * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`
5544       * is non-undefined, the store's state at `key` is updated to match `controlled`.
5545       */
5546      useControlledProp(key, controlled) {
5547        React20.useDebugValue(key);
5548        const store2 = this;
5549        const isControlled = controlled !== void 0;
5550        useIsoLayoutEffect(() => {
5551          if (isControlled && !Object.is(store2.state[key], controlled)) {
5552            store2.setState({
5553              ...store2.state,
5554              [key]: controlled
5555            });
5556          }
5557        }, [store2, key, controlled, isControlled]);
5558        if (true) {
5559          const cache = this.controlledValues ??= /* @__PURE__ */ new Map();
5560          if (!cache.has(key)) {
5561            cache.set(key, isControlled);
5562          }
5563          const previouslyControlled = cache.get(key);
5564          if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) {
5565            console.error(`A component is changing the $isControlled ? "" : "un"}controlled state of $key.toString()} to be $isControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);
5566          }
5567        }
5568      }
5569      /** Gets the current value from the store using a selector with the provided key.
5570       *
5571       * @param key Key of the selector to use.
5572       */
5573      select(key, a1, a2, a3) {
5574        const selector = this.selectors[key];
5575        return selector(this.state, a1, a2, a3);
5576      }
5577      /**
5578       * Returns a value from the store's state using a selector function.
5579       * Used to subscribe to specific parts of the state.
5580       * This methods causes a rerender whenever the selected state changes.
5581       *
5582       * @param key Key of the selector to use.
5583       */
5584      useState(key, a1, a2, a3) {
5585        React20.useDebugValue(key);
5586        return useStore(this, this.selectors[key], a1, a2, a3);
5587      }
5588      /**
5589       * Wraps a function with `useStableCallback` to ensure it has a stable reference
5590       * and assigns it to the context.
5591       *
5592       * @param key Key of the event callback. Must be a function in the context.
5593       * @param fn Function to assign.
5594       */
5595      useContextCallback(key, fn) {
5596        React20.useDebugValue(key);
5597        const stableFunction = useStableCallback(fn ?? NOOP);
5598        this.context[key] = stableFunction;
5599      }
5600      /**
5601       * Returns a stable setter function for a specific key in the store's state.
5602       * It's commonly used to pass as a ref callback to React elements.
5603       *
5604       * @param key Key of the state to set.
5605       */
5606      useStateSetter(key) {
5607        const ref = React20.useRef(void 0);
5608        if (ref.current === void 0) {
5609          ref.current = (value) => {
5610            this.set(key, value);
5611          };
5612        }
5613        return ref.current;
5614      }
5615      /**
5616       * Observes changes derived from the store's selectors and calls the listener when the selected value changes.
5617       *
5618       * @param key Key of the selector to observe.
5619       * @param listener Listener function called when the selector result changes.
5620       */
5621      observe(selector, listener) {
5622        let selectFn;
5623        if (typeof selector === "function") {
5624          selectFn = selector;
5625        } else {
5626          selectFn = this.selectors[selector];
5627        }
5628        let prevValue = selectFn(this.state);
5629        listener(prevValue, prevValue, this);
5630        return this.subscribe((nextState) => {
5631          const nextValue = selectFn(nextState);
5632          if (!Object.is(prevValue, nextValue)) {
5633            const oldValue = prevValue;
5634            prevValue = nextValue;
5635            listener(nextValue, oldValue, this);
5636          }
5637        });
5638      }
5639    };
5640  
5641    // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs
5642    var selectors = {
5643      open: (state) => state.open,
5644      transitionStatus: (state) => state.transitionStatus,
5645      domReferenceElement: (state) => state.domReferenceElement,
5646      referenceElement: (state) => state.positionReference ?? state.referenceElement,
5647      floatingElement: (state) => state.floatingElement,
5648      floatingId: (state) => state.floatingId
5649    };
5650    var FloatingRootStore = class extends ReactStore {
5651      constructor(options) {
5652        const {
5653          syncOnly,
5654          nested,
5655          onOpenChange,
5656          triggerElements,
5657          ...initialState
5658        } = options;
5659        super({
5660          ...initialState,
5661          positionReference: initialState.referenceElement,
5662          domReferenceElement: initialState.referenceElement
5663        }, {
5664          onOpenChange,
5665          dataRef: {
5666            current: {}
5667          },
5668          events: createEventEmitter(),
5669          nested,
5670          triggerElements
5671        }, selectors);
5672        this.syncOnly = syncOnly;
5673      }
5674      /**
5675       * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.
5676       */
5677      syncOpenEvent = (newOpen, event) => {
5678        if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing
5679        // click events to upgrade a hover-open.
5680        event != null && isClickLikeEvent(event)) {
5681          this.context.dataRef.current.openEvent = newOpen ? event : void 0;
5682        }
5683      };
5684      /**
5685       * Runs the root-owned side effects for an open state change.
5686       */
5687      dispatchOpenChange = (newOpen, eventDetails) => {
5688        this.syncOpenEvent(newOpen, eventDetails.event);
5689        const details = {
5690          open: newOpen,
5691          reason: eventDetails.reason,
5692          nativeEvent: eventDetails.event,
5693          nested: this.context.nested,
5694          triggerElement: eventDetails.trigger
5695        };
5696        this.context.events.emit("openchange", details);
5697      };
5698      /**
5699       * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.
5700       *
5701       * @param newOpen The new open state.
5702       * @param eventDetails Details about the event that triggered the open state change.
5703       */
5704      setOpen = (newOpen, eventDetails) => {
5705        if (this.syncOnly) {
5706          this.context.onOpenChange?.(newOpen, eventDetails);
5707          return;
5708        }
5709        this.dispatchOpenChange(newOpen, eventDetails);
5710        this.context.onOpenChange?.(newOpen, eventDetails);
5711      };
5712    };
5713  
5714    // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
5715    function useSyncedFloatingRootContext(options) {
5716      const {
5717        popupStore,
5718        treatPopupAsFloatingElement = false,
5719        floatingRootContext: floatingRootContextProp,
5720        floatingId,
5721        nested,
5722        onOpenChange
5723      } = options;
5724      const open = popupStore.useState("open");
5725      const referenceElement = popupStore.useState("activeTriggerElement");
5726      const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement");
5727      const triggerElements = popupStore.context.triggerElements;
5728      const handleOpenChange = onOpenChange;
5729      const internalStoreRef = React21.useRef(null);
5730      if (floatingRootContextProp === void 0 && internalStoreRef.current === null) {
5731        internalStoreRef.current = new FloatingRootStore({
5732          open,
5733          transitionStatus: void 0,
5734          referenceElement,
5735          floatingElement,
5736          triggerElements,
5737          onOpenChange: handleOpenChange,
5738          floatingId,
5739          syncOnly: true,
5740          nested
5741        });
5742      }
5743      const store2 = floatingRootContextProp ?? internalStoreRef.current;
5744      popupStore.useSyncedValue("floatingId", floatingId);
5745      useIsoLayoutEffect(() => {
5746        const valuesToSync = {
5747          open,
5748          floatingId,
5749          referenceElement,
5750          floatingElement
5751        };
5752        if (isElement(referenceElement)) {
5753          valuesToSync.domReferenceElement = referenceElement;
5754        }
5755        if (store2.state.positionReference === store2.state.referenceElement) {
5756          valuesToSync.positionReference = referenceElement;
5757        }
5758        store2.update(valuesToSync);
5759      }, [open, floatingId, referenceElement, floatingElement, store2]);
5760      store2.context.onOpenChange = handleOpenChange;
5761      store2.context.nested = nested;
5762      return store2;
5763    }
5764  
5765    // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
5766    var FOCUSABLE_POPUP_PROPS = {
5767      tabIndex: -1,
5768      [FOCUSABLE_ATTRIBUTE]: ""
5769    };
5770    function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) {
5771      const floatingId = useId();
5772      const nested = useFloatingParentNodeId() != null;
5773      const store2 = useRefWithInit(() => createStore(floatingId, nested)).current;
5774      useSyncedFloatingRootContext({
5775        popupStore: store2,
5776        treatPopupAsFloatingElement,
5777        floatingRootContext: store2.state.floatingRootContext,
5778        floatingId,
5779        nested,
5780        onOpenChange: store2.setOpen
5781      });
5782      return store2;
5783    }
5784    function PopupHandleAttachment({
5785      handle,
5786      store: store2
5787    }) {
5788      useIsoLayoutEffect(() => {
5789        return handle.attachStore(store2);
5790      }, [handle, store2]);
5791      return null;
5792    }
5793    function useTriggerRegistration(id, store2) {
5794      const registeredElementIdRef = React22.useRef(null);
5795      const registeredElementRef = React22.useRef(null);
5796      return React22.useCallback((element) => {
5797        if (id === void 0) {
5798          return;
5799        }
5800        let shouldSyncTriggerCount = false;
5801        if (registeredElementIdRef.current !== null) {
5802          const registeredId = registeredElementIdRef.current;
5803          const registeredElement = registeredElementRef.current;
5804          const currentElement = store2.context.triggerElements.getById(registeredId);
5805          if (registeredElement && currentElement === registeredElement) {
5806            store2.context.triggerElements.delete(registeredId);
5807            shouldSyncTriggerCount = true;
5808          }
5809          registeredElementIdRef.current = null;
5810          registeredElementRef.current = null;
5811        }
5812        if (element !== null) {
5813          registeredElementIdRef.current = id;
5814          registeredElementRef.current = element;
5815          store2.context.triggerElements.add(id, element);
5816          shouldSyncTriggerCount = true;
5817        }
5818        if (shouldSyncTriggerCount) {
5819          const triggerCount = store2.context.triggerElements.size;
5820          if (store2.select("open") && store2.state.triggerCount !== triggerCount) {
5821            store2.set("triggerCount", triggerCount);
5822          }
5823        }
5824      }, [store2, id]);
5825    }
5826    function setPopupOpenState(state, open, trigger, preventUnmountOnClose = false) {
5827      if (open) {
5828        state.preventUnmountingOnClose = false;
5829      } else if (preventUnmountOnClose) {
5830        state.preventUnmountingOnClose = true;
5831      }
5832      const triggerId = trigger?.id ?? null;
5833      if (triggerId || open) {
5834        state.activeTriggerId = triggerId;
5835        state.activeTriggerElement = trigger ?? null;
5836      }
5837    }
5838    function attachPreventUnmountOnClose(eventDetails) {
5839      let preventUnmountOnClose = false;
5840      eventDetails.preventUnmountOnClose = () => {
5841        preventUnmountOnClose = true;
5842      };
5843      return () => preventUnmountOnClose;
5844    }
5845    function applyPopupOpenChange(store2, nextOpen, eventDetails, options = {}) {
5846      const reason = eventDetails.reason;
5847      const isHover = reason === reason_parts_exports.triggerHover;
5848      const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus;
5849      const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey);
5850      const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);
5851      store2.context.onOpenChange?.(nextOpen, eventDetails);
5852      if (eventDetails.isCanceled) {
5853        return;
5854      }
5855      options.onBeforeDispatch?.();
5856      store2.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
5857      const changeState = () => {
5858        const updatedState = {
5859          ...options.extraState,
5860          open: nextOpen
5861        };
5862        if (isFocusOpen) {
5863          updatedState.instantType = "focus";
5864        } else if (isDismissClose) {
5865          updatedState.instantType = "dismiss";
5866        } else if (isHover) {
5867          updatedState.instantType = void 0;
5868        }
5869        setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());
5870        store2.update(updatedState);
5871      };
5872      if (isHover) {
5873        ReactDOM4.flushSync(changeState);
5874      } else {
5875        changeState();
5876      }
5877    }
5878    function useTriggerDataForwarding(triggerId, triggerElementRef, store2, stateUpdates) {
5879      const isMountedByThisTrigger = store2.useState("isMountedByTrigger", triggerId);
5880      const baseRegisterTrigger = useTriggerRegistration(triggerId, store2);
5881      const applyTriggerData = useStableCallback((element) => {
5882        const open = store2.select("open");
5883        const activeTriggerId = store2.select("activeTriggerId");
5884        if (activeTriggerId === triggerId) {
5885          store2.update({
5886            activeTriggerElement: element,
5887            ...open ? stateUpdates : null
5888          });
5889          return;
5890        }
5891        if (activeTriggerId == null && open) {
5892          store2.update({
5893            activeTriggerId: triggerId,
5894            activeTriggerElement: element,
5895            ...stateUpdates
5896          });
5897        }
5898      });
5899      const registerTrigger = React22.useCallback((element) => {
5900        baseRegisterTrigger(element);
5901        if (element) {
5902          applyTriggerData(element);
5903        }
5904      }, [baseRegisterTrigger, applyTriggerData]);
5905      useIsoLayoutEffect(() => {
5906        if (isMountedByThisTrigger) {
5907          store2.update({
5908            activeTriggerElement: triggerElementRef.current,
5909            ...stateUpdates
5910          });
5911        }
5912      }, [isMountedByThisTrigger, store2, triggerElementRef, ...Object.values(stateUpdates)]);
5913      return {
5914        registerTrigger,
5915        isMountedByThisTrigger
5916      };
5917    }
5918    function useImplicitActiveTrigger(store2, options = {}) {
5919      const {
5920        closeOnActiveTriggerUnmount = false
5921      } = options;
5922      const resolvedActiveTriggerIdRef = React22.useRef(null);
5923      const open = store2.useState("open");
5924      const reactiveTriggerCount = store2.useState("triggerCount");
5925      const activeTriggerId = store2.useState("activeTriggerId");
5926      const reactiveActiveTriggerElement = store2.useState("activeTriggerElement");
5927      useIsoLayoutEffect(() => {
5928        if (!open) {
5929          resolvedActiveTriggerIdRef.current = null;
5930          if (store2.state.triggerCount !== 0) {
5931            store2.set("triggerCount", 0);
5932          }
5933          return;
5934        }
5935        const triggerCount = store2.context.triggerElements.size;
5936        const stateUpdates = {};
5937        if (store2.state.triggerCount !== triggerCount) {
5938          stateUpdates.triggerCount = triggerCount;
5939        }
5940        const currentActiveTriggerId = store2.select("activeTriggerId");
5941        let lostActiveTriggerId = null;
5942        if (currentActiveTriggerId) {
5943          const activeTriggerElement = store2.context.triggerElements.getById(currentActiveTriggerId);
5944          if (!activeTriggerElement) {
5945            for (const [triggerId, triggerElement] of store2.context.triggerElements.entries()) {
5946              if (triggerElement === store2.state.activeTriggerElement) {
5947                stateUpdates.activeTriggerId = triggerId;
5948                stateUpdates.activeTriggerElement = triggerElement;
5949                resolvedActiveTriggerIdRef.current = triggerId;
5950                break;
5951              }
5952            }
5953            if (stateUpdates.activeTriggerId === void 0) {
5954              if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) {
5955                lostActiveTriggerId = currentActiveTriggerId;
5956              } else {
5957                resolvedActiveTriggerIdRef.current = null;
5958              }
5959            }
5960          } else {
5961            resolvedActiveTriggerIdRef.current = currentActiveTriggerId;
5962            if (activeTriggerElement !== store2.state.activeTriggerElement) {
5963              stateUpdates.activeTriggerElement = activeTriggerElement;
5964            }
5965          }
5966        } else {
5967          resolvedActiveTriggerIdRef.current = null;
5968        }
5969        if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) {
5970          const iteratorResult = store2.context.triggerElements.entries().next();
5971          if (!iteratorResult.done) {
5972            const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;
5973            stateUpdates.activeTriggerId = implicitTriggerId;
5974            stateUpdates.activeTriggerElement = implicitTriggerElement;
5975            resolvedActiveTriggerIdRef.current = implicitTriggerId;
5976          }
5977        }
5978        if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) {
5979          store2.update(stateUpdates);
5980        }
5981        if (lostActiveTriggerId) {
5982          if (closeOnActiveTriggerUnmount) {
5983            queueMicrotask(() => {
5984              if (store2.select("open") && store2.select("activeTriggerId") === lostActiveTriggerId && !store2.context.triggerElements.getById(lostActiveTriggerId)) {
5985                const eventDetails = createChangeEventDetails(reason_parts_exports.none);
5986                store2.setOpen(false, eventDetails);
5987                if (!eventDetails.isCanceled) {
5988                  store2.update({
5989                    activeTriggerId: null,
5990                    activeTriggerElement: null
5991                  });
5992                }
5993              }
5994            });
5995          }
5996        }
5997      }, [open, store2, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]);
5998    }
5999    function useOpenStateTransitions(open, store2, onUnmount) {
6000      const {
6001        mounted,
6002        setMounted,
6003        transitionStatus
6004      } = useTransitionStatus(open);
6005      const preventUnmountingOnClose = store2.useState("preventUnmountingOnClose");
6006      const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose;
6007      store2.useSyncedValues({
6008        mounted,
6009        transitionStatus,
6010        preventUnmountingOnClose: syncedPreventUnmountingOnClose
6011      });
6012      const forceUnmount = useStableCallback(() => {
6013        setMounted(false);
6014        store2.update({
6015          activeTriggerId: null,
6016          activeTriggerElement: null,
6017          mounted: false,
6018          preventUnmountingOnClose: false
6019        });
6020        onUnmount?.();
6021        store2.context.onOpenChangeComplete?.(false);
6022      });
6023      useOpenChangeComplete({
6024        enabled: mounted && !open && !syncedPreventUnmountingOnClose,
6025        open,
6026        ref: store2.context.popupRef,
6027        onComplete() {
6028          if (!open) {
6029            forceUnmount();
6030          }
6031        }
6032      });
6033      return {
6034        forceUnmount,
6035        transitionStatus
6036      };
6037    }
6038    function usePopupInteractionProps(store2, statePart) {
6039      store2.useSyncedValues(statePart);
6040      useIsoLayoutEffect(() => () => {
6041        store2.update({
6042          activeTriggerProps: EMPTY_OBJECT,
6043          inactiveTriggerProps: EMPTY_OBJECT,
6044          popupProps: EMPTY_OBJECT
6045        });
6046      }, [store2]);
6047    }
6048  
6049    // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs
6050    var devElementIdsByMap;
6051    function getDevElementIds(map) {
6052      devElementIdsByMap ??= /* @__PURE__ */ new WeakMap();
6053      let elementIds = devElementIdsByMap.get(map);
6054      if (!elementIds) {
6055        elementIds = /* @__PURE__ */ new WeakMap();
6056        devElementIdsByMap.set(map, elementIds);
6057      }
6058      return elementIds;
6059    }
6060    var PopupTriggerMap = class {
6061      constructor() {
6062        this.idMap = /* @__PURE__ */ new Map();
6063      }
6064      /**
6065       * Adds a trigger element with the given ID.
6066       *
6067       * Note: The provided element is assumed to not be registered under multiple IDs.
6068       */
6069      add(id, element) {
6070        if (true) {
6071          const elementIds = getDevElementIds(this);
6072          const existingId = elementIds.get(element);
6073          if (existingId !== void 0 && existingId !== id) {
6074            throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.");
6075          }
6076          const previousElement = this.idMap.get(id);
6077          if (previousElement !== void 0 && previousElement !== element) {
6078            elementIds.delete(previousElement);
6079          }
6080          elementIds.set(element, id);
6081        }
6082        this.idMap.set(id, element);
6083      }
6084      /**
6085       * Removes the trigger element with the given ID.
6086       */
6087      delete(id) {
6088        if (true) {
6089          const element = this.idMap.get(id);
6090          if (element !== void 0) {
6091            devElementIdsByMap?.get(this)?.delete(element);
6092          }
6093        }
6094        this.idMap.delete(id);
6095      }
6096      /**
6097       * Whether the given element is registered as a trigger.
6098       */
6099      hasElement(element) {
6100        for (const registered of this.idMap.values()) {
6101          if (registered === element) {
6102            return true;
6103          }
6104        }
6105        return false;
6106      }
6107      /**
6108       * Whether there is a registered trigger element matching the given predicate.
6109       */
6110      hasMatchingElement(predicate) {
6111        for (const element of this.idMap.values()) {
6112          if (predicate(element)) {
6113            return true;
6114          }
6115        }
6116        return false;
6117      }
6118      /**
6119       * Returns the trigger element associated with the given ID, or undefined if no such element exists.
6120       */
6121      getById(id) {
6122        return this.idMap.get(id);
6123      }
6124      /**
6125       * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].
6126       */
6127      entries() {
6128        return this.idMap.entries();
6129      }
6130      /**
6131       * Returns an iterable of all registered trigger elements.
6132       */
6133      elements() {
6134        return this.idMap.values();
6135      }
6136      /**
6137       * Returns the number of registered trigger elements.
6138       */
6139      get size() {
6140        return this.idMap.size;
6141      }
6142    };
6143  
6144    // node_modules/@base-ui/react/floating-ui-react/utils/getEmptyRootContext.mjs
6145    function getEmptyRootContext() {
6146      return new FloatingRootStore({
6147        open: false,
6148        transitionStatus: void 0,
6149        floatingElement: null,
6150        referenceElement: null,
6151        triggerElements: new PopupTriggerMap(),
6152        floatingId: void 0,
6153        syncOnly: false,
6154        nested: false,
6155        onOpenChange: void 0
6156      });
6157    }
6158  
6159    // node_modules/@base-ui/react/utils/popups/store.mjs
6160    function createInitialPopupStoreState() {
6161      return {
6162        open: false,
6163        openProp: void 0,
6164        mounted: false,
6165        transitionStatus: void 0,
6166        floatingRootContext: getEmptyRootContext(),
6167        floatingId: void 0,
6168        triggerCount: 0,
6169        preventUnmountingOnClose: false,
6170        payload: void 0,
6171        activeTriggerId: null,
6172        activeTriggerElement: null,
6173        triggerIdProp: void 0,
6174        popupElement: null,
6175        positionerElement: null,
6176        activeTriggerProps: EMPTY_OBJECT,
6177        inactiveTriggerProps: EMPTY_OBJECT,
6178        popupProps: EMPTY_OBJECT
6179      };
6180    }
6181    function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) {
6182      return new FloatingRootStore({
6183        open: false,
6184        transitionStatus: void 0,
6185        floatingElement: null,
6186        referenceElement: null,
6187        triggerElements,
6188        floatingId,
6189        syncOnly: true,
6190        nested,
6191        onOpenChange: void 0
6192      });
6193    }
6194    var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId;
6195    var openSelector = (state) => state.openProp ?? state.open;
6196    var popupIdSelector = (state) => {
6197      const popupId = state.popupElement?.id ?? state.floatingId;
6198      return popupId || void 0;
6199    };
6200    function triggerOwnsOpenPopup(state, triggerId) {
6201      return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId;
6202    }
6203    function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) {
6204      if (triggerOwnsOpenPopup(state, triggerId)) {
6205        return true;
6206      }
6207      return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1;
6208    }
6209    var popupStoreSelectors = {
6210      open: openSelector,
6211      mounted: (state) => state.mounted,
6212      transitionStatus: (state) => state.transitionStatus,
6213      floatingRootContext: (state) => state.floatingRootContext,
6214      triggerCount: (state) => state.triggerCount,
6215      preventUnmountingOnClose: (state) => state.preventUnmountingOnClose,
6216      payload: (state) => state.payload,
6217      activeTriggerId: activeTriggerIdSelector,
6218      activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null,
6219      popupId: popupIdSelector,
6220      /**
6221       * Whether the trigger with the given ID was used to open the popup.
6222       */
6223      isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId,
6224      /**
6225       * Whether the popup is open and was activated by a trigger with the given ID.
6226       */
6227      isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId),
6228      /**
6229       * Whether the popup is mounted and was activated by a trigger with the given ID.
6230       */
6231      isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted,
6232      triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps,
6233      /**
6234       * Popup id for the trigger that currently owns the open popup.
6235       */
6236      triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0,
6237      popupProps: (state) => state.popupProps,
6238      popupElement: (state) => state.popupElement,
6239      positionerElement: (state) => state.positionerElement
6240    };
6241  
6242    // node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs
6243    var React23 = __toESM(require_react(), 1);
6244    var import_shim2 = __toESM(require_shim(), 1);
6245    function usePopupHandleStore(handle) {
6246      const subscribe = React23.useCallback((listener) => {
6247        if (handle === void 0) {
6248          return NOOP;
6249        }
6250        return handle.subscribeStore(listener);
6251      }, [handle]);
6252      const getSnapshot = React23.useCallback(() => {
6253        return handle === void 0 ? void 0 : handle.store;
6254      }, [handle]);
6255      return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore);
6256    }
6257  
6258    // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
6259    function useBaseUIFloating(options) {
6260      return useFloatingWithStore(options, options.rootContext);
6261    }
6262    function useFloatingWithStore(options, store2) {
6263      const {
6264        nodeId,
6265        externalTree
6266      } = options;
6267      const referenceElement = store2.useState("referenceElement");
6268      const floatingElement = store2.useState("floatingElement");
6269      const domReferenceElement = store2.useState("domReferenceElement");
6270      const open = store2.useState("open");
6271      const floatingId = store2.useState("floatingId");
6272      const [positionReference, setPositionReferenceRaw] = React24.useState(null);
6273      const [localDomReference, setLocalDomReference] = React24.useState(void 0);
6274      const [localFloatingElement, setLocalFloatingElement] = React24.useState(void 0);
6275      const domReferenceRef = React24.useRef(null);
6276      const tree = useFloatingTree(externalTree);
6277      const storeElements = React24.useMemo(() => ({
6278        reference: referenceElement,
6279        floating: floatingElement,
6280        domReference: domReferenceElement
6281      }), [referenceElement, floatingElement, domReferenceElement]);
6282      const position = useFloating({
6283        ...options,
6284        elements: {
6285          ...storeElements,
6286          ...positionReference && {
6287            reference: positionReference
6288          }
6289        }
6290      });
6291      const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;
6292      const syncedFloatingElement = localFloatingElement === void 0 ? store2.state.floatingElement : localFloatingElement;
6293      store2.useSyncedValue("referenceElement", localDomReference ?? null);
6294      store2.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement);
6295      store2.useSyncedValue("floatingElement", syncedFloatingElement);
6296      const setPositionReference = React24.useCallback((node) => {
6297        const computedPositionReference = isElement(node) ? {
6298          getBoundingClientRect: () => node.getBoundingClientRect(),
6299          getClientRects: () => node.getClientRects(),
6300          contextElement: node
6301        } : node;
6302        setPositionReferenceRaw(computedPositionReference);
6303        position.refs.setReference(computedPositionReference);
6304      }, [position.refs]);
6305      const setReference = React24.useCallback((node) => {
6306        if (isElement(node) || node === null) {
6307          domReferenceRef.current = node;
6308          setLocalDomReference(node);
6309        }
6310        if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
6311        // `null` to support `positionReference` + an unstable `reference`
6312        // callback ref.
6313        node !== null && !isElement(node)) {
6314          position.refs.setReference(node);
6315        }
6316      }, [position.refs, setLocalDomReference]);
6317      const setFloating = React24.useCallback((node) => {
6318        setLocalFloatingElement(node);
6319        position.refs.setFloating(node);
6320      }, [position.refs]);
6321      const refs = React24.useMemo(() => ({
6322        ...position.refs,
6323        setReference,
6324        setFloating,
6325        setPositionReference,
6326        domReference: domReferenceRef
6327      }), [position.refs, setReference, setFloating, setPositionReference]);
6328      const elements = React24.useMemo(() => ({
6329        ...position.elements,
6330        domReference: domReferenceElement
6331      }), [position.elements, domReferenceElement]);
6332      const context = React24.useMemo(() => ({
6333        ...position,
6334        dataRef: store2.context.dataRef,
6335        open,
6336        onOpenChange: store2.setOpen,
6337        events: store2.context.events,
6338        floatingId,
6339        refs,
6340        elements,
6341        nodeId,
6342        rootStore: store2
6343      }), [position, refs, elements, nodeId, store2, open, floatingId]);
6344      useIsoLayoutEffect(() => {
6345        if (domReferenceElement) {
6346          domReferenceRef.current = domReferenceElement;
6347        }
6348      }, [domReferenceElement]);
6349      useIsoLayoutEffect(() => {
6350        store2.context.dataRef.current.floatingContext = context;
6351        const node = tree?.nodesRef.current.find((n) => n.id === nodeId);
6352        if (node) {
6353          node.context = context;
6354        }
6355      });
6356      return React24.useMemo(() => ({
6357        ...position,
6358        context,
6359        refs,
6360        elements,
6361        rootStore: store2
6362      }), [position, refs, elements, context, store2]);
6363    }
6364  
6365    // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs
6366    var React25 = __toESM(require_react(), 1);
6367    var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit;
6368    function useFocus(context, props = {}) {
6369      const {
6370        enabled = true,
6371        delay
6372      } = props;
6373      const store2 = "rootStore" in context ? context.rootStore : context;
6374      const {
6375        events,
6376        dataRef
6377      } = store2.context;
6378      const blockFocusRef = React25.useRef(false);
6379      const blockedReferenceRef = React25.useRef(null);
6380      const keyboardModalityRef = React25.useRef(true);
6381      const timeout = useTimeout();
6382      React25.useEffect(() => {
6383        const domReference = store2.select("domReferenceElement");
6384        if (!enabled) {
6385          return void 0;
6386        }
6387        const win = getWindow(domReference);
6388        function onBlur() {
6389          const currentDomReference = store2.select("domReferenceElement");
6390          if (!store2.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) {
6391            blockFocusRef.current = true;
6392          }
6393        }
6394        function onKeyDown() {
6395          keyboardModalityRef.current = true;
6396        }
6397        function onPointerDown() {
6398          keyboardModalityRef.current = false;
6399        }
6400        return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true));
6401      }, [store2, enabled]);
6402      React25.useEffect(() => {
6403        if (!enabled) {
6404          return void 0;
6405        }
6406        function onOpenChangeLocal(details) {
6407          if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) {
6408            const referenceElement = store2.select("domReferenceElement");
6409            if (isElement(referenceElement)) {
6410              blockedReferenceRef.current = referenceElement;
6411              blockFocusRef.current = true;
6412            }
6413          }
6414        }
6415        events.on("openchange", onOpenChangeLocal);
6416        return () => {
6417          events.off("openchange", onOpenChangeLocal);
6418        };
6419      }, [events, enabled, store2]);
6420      const reference = React25.useMemo(() => {
6421        function resetBlockedFocus() {
6422          blockFocusRef.current = false;
6423          blockedReferenceRef.current = null;
6424        }
6425        return {
6426          onMouseLeave() {
6427            resetBlockedFocus();
6428          },
6429          onFocus(event) {
6430            const focusTarget = event.currentTarget;
6431            if (blockFocusRef.current) {
6432              if (blockedReferenceRef.current === focusTarget) {
6433                return;
6434              }
6435              resetBlockedFocus();
6436            }
6437            const target = getTarget(event.nativeEvent);
6438            if (isElement(target)) {
6439              if (isMacSafari && !event.relatedTarget) {
6440                if (!keyboardModalityRef.current && !isTypeableElement(target)) {
6441                  return;
6442                }
6443              } else if (!matchesFocusVisible(target)) {
6444                return;
6445              }
6446            }
6447            const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements);
6448            const {
6449              nativeEvent,
6450              currentTarget
6451            } = event;
6452            const delayValue = typeof delay === "function" ? delay() : delay;
6453            if (store2.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) {
6454              store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
6455              return;
6456            }
6457            timeout.start(delayValue, () => {
6458              if (blockFocusRef.current) {
6459                return;
6460              }
6461              store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
6462            });
6463          },
6464          onBlur(event) {
6465            resetBlockedFocus();
6466            const relatedTarget = event.relatedTarget;
6467            const nativeEvent = event.nativeEvent;
6468            const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
6469            timeout.start(0, () => {
6470              const domReference = store2.select("domReferenceElement");
6471              const activeEl = activeElement(ownerDocument(domReference));
6472              if (!relatedTarget && activeEl === domReference) {
6473                return;
6474              }
6475              if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) {
6476                return;
6477              }
6478              const nextFocusedElement = relatedTarget ?? activeEl;
6479              if (isTargetInsideEnabledTrigger(nextFocusedElement, store2.context.triggerElements)) {
6480                return;
6481              }
6482              store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent));
6483            });
6484          }
6485        };
6486      }, [dataRef, delay, store2, timeout]);
6487      return React25.useMemo(() => enabled ? {
6488        reference,
6489        trigger: reference
6490      } : {}, [enabled, reference]);
6491    }
6492  
6493    // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
6494    var React26 = __toESM(require_react(), 1);
6495  
6496    // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs
6497    var HoverInteraction = class _HoverInteraction {
6498      constructor() {
6499        this.pointerType = void 0;
6500        this.interactedInside = false;
6501        this.handler = void 0;
6502        this.blockMouseMove = true;
6503        this.performedPointerEventsMutation = false;
6504        this.pointerEventsScopeElement = null;
6505        this.pointerEventsReferenceElement = null;
6506        this.pointerEventsFloatingElement = null;
6507        this.restTimeoutPending = false;
6508        this.openChangeTimeout = new Timeout();
6509        this.restTimeout = new Timeout();
6510        this.handleCloseOptions = void 0;
6511      }
6512      static create() {
6513        return new _HoverInteraction();
6514      }
6515      dispose = () => {
6516        this.openChangeTimeout.clear();
6517        this.restTimeout.clear();
6518      };
6519      disposeEffect = () => {
6520        return this.dispose;
6521      };
6522    };
6523    var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap();
6524    function clearSafePolygonPointerEventsMutation(instance) {
6525      if (!instance.performedPointerEventsMutation) {
6526        return;
6527      }
6528      const scopeElement = instance.pointerEventsScopeElement;
6529      if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) {
6530        instance.pointerEventsScopeElement?.style.removeProperty("pointer-events");
6531        instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events");
6532        instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events");
6533        pointerEventsMutationOwnerByScopeElement.delete(scopeElement);
6534      }
6535      instance.performedPointerEventsMutation = false;
6536      instance.pointerEventsScopeElement = null;
6537      instance.pointerEventsReferenceElement = null;
6538      instance.pointerEventsFloatingElement = null;
6539    }
6540    function applySafePolygonPointerEventsMutation(instance, options) {
6541      const {
6542        scopeElement,
6543        referenceElement,
6544        floatingElement
6545      } = options;
6546      const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement);
6547      if (existingOwner && existingOwner !== instance) {
6548        clearSafePolygonPointerEventsMutation(existingOwner);
6549      }
6550      clearSafePolygonPointerEventsMutation(instance);
6551      instance.performedPointerEventsMutation = true;
6552      instance.pointerEventsScopeElement = scopeElement;
6553      instance.pointerEventsReferenceElement = referenceElement;
6554      instance.pointerEventsFloatingElement = floatingElement;
6555      pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);
6556      scopeElement.style.pointerEvents = "none";
6557      referenceElement.style.pointerEvents = "auto";
6558      floatingElement.style.pointerEvents = "auto";
6559    }
6560    function useHoverInteractionSharedState(store2) {
6561      const data = store2.context.dataRef.current;
6562      const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current;
6563      if (!data.hoverInteractionState) {
6564        data.hoverInteractionState = instance;
6565      }
6566      useOnMount(data.hoverInteractionState.disposeEffect);
6567      return data.hoverInteractionState;
6568    }
6569  
6570    // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
6571    function useHoverFloatingInteraction(context, parameters = {}) {
6572      const {
6573        enabled = true,
6574        closeDelay: closeDelayProp = 0,
6575        nodeId: nodeIdProp
6576      } = parameters;
6577      const store2 = "rootStore" in context ? context.rootStore : context;
6578      const open = store2.useState("open");
6579      const floatingElement = store2.useState("floatingElement");
6580      const domReferenceElement = store2.useState("domReferenceElement");
6581      const {
6582        dataRef
6583      } = store2.context;
6584      const tree = useFloatingTree();
6585      const parentId = useFloatingParentNodeId();
6586      const instance = useHoverInteractionSharedState(store2);
6587      const childClosedTimeout = useTimeout();
6588      const isClickLikeOpenEvent2 = useStableCallback(() => {
6589        return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
6590      });
6591      const isHoverOpen = useStableCallback(() => {
6592        return isHoverOpenEvent(dataRef.current.openEvent?.type);
6593      });
6594      const clearPointerEvents = useStableCallback(() => {
6595        clearSafePolygonPointerEventsMutation(instance);
6596      });
6597      useIsoLayoutEffect(() => {
6598        if (!open) {
6599          instance.pointerType = void 0;
6600          instance.restTimeoutPending = false;
6601          instance.interactedInside = false;
6602          clearPointerEvents();
6603        }
6604      }, [open, instance, clearPointerEvents]);
6605      React26.useEffect(() => {
6606        return clearPointerEvents;
6607      }, [clearPointerEvents]);
6608      useIsoLayoutEffect(() => {
6609        if (!enabled) {
6610          return void 0;
6611        }
6612        if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) {
6613          const ref = domReferenceElement;
6614          const floatingEl = floatingElement;
6615          const doc = ownerDocument(floatingElement);
6616          const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating;
6617          if (parentFloating) {
6618            parentFloating.style.pointerEvents = "";
6619          }
6620          const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null;
6621          const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null;
6622          const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body;
6623          applySafePolygonPointerEventsMutation(instance, {
6624            scopeElement,
6625            referenceElement: ref,
6626            floatingElement: floatingEl
6627          });
6628          return () => {
6629            clearPointerEvents();
6630          };
6631        }
6632        return void 0;
6633      }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);
6634      React26.useEffect(() => {
6635        if (!enabled) {
6636          return void 0;
6637        }
6638        function hasParentChildren() {
6639          return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0);
6640        }
6641        function closeWithDelay(event) {
6642          const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType);
6643          const close = () => {
6644            store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
6645            tree?.events.emit("floating.closed", event);
6646          };
6647          if (closeDelay) {
6648            instance.openChangeTimeout.start(closeDelay, close);
6649          } else {
6650            instance.openChangeTimeout.clear();
6651            close();
6652          }
6653        }
6654        function handleInteractInside(event) {
6655          const target = getTarget(event);
6656          if (!isInteractiveElement(target)) {
6657            instance.interactedInside = false;
6658            return;
6659          }
6660          instance.interactedInside = target?.closest("[aria-haspopup]") != null;
6661        }
6662        function onFloatingMouseEnter() {
6663          instance.openChangeTimeout.clear();
6664          childClosedTimeout.clear();
6665          tree?.events.off("floating.closed", onNodeClosed);
6666          clearPointerEvents();
6667        }
6668        function onFloatingMouseLeave(event) {
6669          if (hasParentChildren() && tree) {
6670            tree.events.on("floating.closed", onNodeClosed);
6671            return;
6672          }
6673          if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) {
6674            return;
6675          }
6676          const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp;
6677          const relatedTarget = event.relatedTarget;
6678          const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget));
6679          if (isMovingIntoDescendantFloating) {
6680            return;
6681          }
6682          if (instance.handler) {
6683            instance.handler(event);
6684            return;
6685          }
6686          clearPointerEvents();
6687          if (isHoverOpen() && !isClickLikeOpenEvent2()) {
6688            closeWithDelay(event);
6689          }
6690        }
6691        function onNodeClosed(event) {
6692          if (!tree || !parentId || hasParentChildren()) {
6693            return;
6694          }
6695          childClosedTimeout.start(0, () => {
6696            tree.events.off("floating.closed", onNodeClosed);
6697            store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
6698            tree.events.emit("floating.closed", event);
6699          });
6700        }
6701        const floating = floatingElement;
6702        return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => {
6703          tree?.events.off("floating.closed", onNodeClosed);
6704        });
6705      }, [enabled, floatingElement, store2, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]);
6706    }
6707  
6708    // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs
6709    var React27 = __toESM(require_react(), 1);
6710    var ReactDOM5 = __toESM(require_react_dom(), 1);
6711    var EMPTY_REF = {
6712      current: null
6713    };
6714    function useHoverReferenceInteraction(context, props = {}) {
6715      const {
6716        enabled = true,
6717        delay = 0,
6718        handleClose = null,
6719        mouseOnly = false,
6720        restMs = 0,
6721        move = true,
6722        triggerElementRef = EMPTY_REF,
6723        externalTree,
6724        isActiveTrigger = true,
6725        getHandleCloseContext,
6726        isClosing,
6727        shouldOpen: shouldOpenProp,
6728        guardStaleOpen = false
6729      } = props;
6730      const store2 = "rootStore" in context ? context.rootStore : context;
6731      const {
6732        dataRef,
6733        events
6734      } = store2.context;
6735      const tree = useFloatingTree(externalTree);
6736      const instance = useHoverInteractionSharedState(store2);
6737      const isHoverCloseActiveRef = React27.useRef(false);
6738      const handleCloseRef = useValueAsRef(handleClose);
6739      const delayRef = useValueAsRef(delay);
6740      const restMsRef = useValueAsRef(restMs);
6741      const enabledRef = useValueAsRef(enabled);
6742      const shouldOpenRef = useValueAsRef(shouldOpenProp);
6743      const isClosingRef = useValueAsRef(isClosing);
6744      const isClickLikeOpenEvent2 = useStableCallback(() => {
6745        return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
6746      });
6747      const checkShouldOpen = useStableCallback(() => {
6748        return shouldOpenRef.current?.() !== false;
6749      });
6750      const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => {
6751        const allTriggers = store2.context.triggerElements;
6752        if (allTriggers.hasElement(currentTarget)) {
6753          return !currentDomReference || !contains(currentDomReference, currentTarget);
6754        }
6755        if (!isElement(target)) {
6756          return false;
6757        }
6758        const targetElement = target;
6759        return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement));
6760      });
6761      const cleanupMouseMoveHandler = useStableCallback(() => {
6762        if (!instance.handler) {
6763          return;
6764        }
6765        const doc = ownerDocument(store2.select("domReferenceElement"));
6766        doc.removeEventListener("mousemove", instance.handler);
6767        instance.handler = void 0;
6768      });
6769      const clearPointerEvents = useStableCallback(() => {
6770        clearSafePolygonPointerEventsMutation(instance);
6771      });
6772      if (isActiveTrigger) {
6773        instance.handleCloseOptions = handleCloseRef.current?.__options;
6774      }
6775      React27.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);
6776      React27.useEffect(() => {
6777        if (!enabled) {
6778          return void 0;
6779        }
6780        function onOpenChangeLocal(details) {
6781          if (!details.open) {
6782            isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover;
6783            cleanupMouseMoveHandler();
6784            instance.openChangeTimeout.clear();
6785            instance.restTimeout.clear();
6786            instance.blockMouseMove = true;
6787            instance.restTimeoutPending = false;
6788          } else {
6789            isHoverCloseActiveRef.current = false;
6790          }
6791        }
6792        events.on("openchange", onOpenChangeLocal);
6793        return () => {
6794          events.off("openchange", onOpenChangeLocal);
6795        };
6796      }, [enabled, events, instance, cleanupMouseMoveHandler]);
6797      React27.useEffect(() => {
6798        if (!enabled) {
6799          return void 0;
6800        }
6801        function closeWithDelay(event, runElseBranch = true) {
6802          const closeDelay = getDelay(delayRef.current, "close", instance.pointerType);
6803          if (closeDelay) {
6804            instance.openChangeTimeout.start(closeDelay, () => {
6805              store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
6806              tree?.events.emit("floating.closed", event);
6807            });
6808          } else if (runElseBranch) {
6809            instance.openChangeTimeout.clear();
6810            store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
6811            tree?.events.emit("floating.closed", event);
6812          }
6813        }
6814        const trigger = triggerElementRef.current ?? (isActiveTrigger ? store2.select("domReferenceElement") : null);
6815        if (!isElement(trigger)) {
6816          return void 0;
6817        }
6818        function onMouseEnter(event) {
6819          instance.openChangeTimeout.clear();
6820          instance.blockMouseMove = false;
6821          if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
6822            return;
6823          }
6824          const restMsValue = getRestMs(restMsRef.current);
6825          const openDelay = getDelay(delayRef.current, "open", instance.pointerType);
6826          const eventTarget = getTarget(event);
6827          const currentTarget = event.currentTarget ?? null;
6828          const currentDomReference = store2.select("domReferenceElement");
6829          let triggerNode = currentTarget;
6830          if (isElement(eventTarget) && !store2.context.triggerElements.hasElement(eventTarget)) {
6831            for (const triggerElement of store2.context.triggerElements.elements()) {
6832              if (contains(triggerElement, eventTarget)) {
6833                triggerNode = triggerElement;
6834                break;
6835              }
6836            }
6837          }
6838          if (isElement(currentTarget) && isElement(currentDomReference) && !store2.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) {
6839            triggerNode = currentDomReference;
6840          }
6841          const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget);
6842          const isOpen = store2.select("open");
6843          const isInClosingTransition = isClosingRef.current?.() ?? store2.select("transitionStatus") === "ending";
6844          const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current;
6845          const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition;
6846          const isRestOnlyDelay = restMsValue > 0 && !openDelay;
6847          const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition;
6848          const shouldOpen = !isOpen || isOverInactive;
6849          if (shouldOpenImmediately) {
6850            if (checkShouldOpen()) {
6851              store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
6852            }
6853            return;
6854          }
6855          if (isRestOnlyDelay) {
6856            return;
6857          }
6858          if (openDelay) {
6859            instance.openChangeTimeout.start(openDelay, () => {
6860              if (shouldOpen && checkShouldOpen()) {
6861                store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
6862              }
6863            });
6864          } else if (shouldOpen) {
6865            if (checkShouldOpen()) {
6866              store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
6867            }
6868          }
6869        }
6870        function onMouseLeave(event) {
6871          if (isClickLikeOpenEvent2()) {
6872            clearPointerEvents();
6873            return;
6874          }
6875          cleanupMouseMoveHandler();
6876          const domReferenceElement = store2.select("domReferenceElement");
6877          const doc = ownerDocument(domReferenceElement);
6878          instance.restTimeout.clear();
6879          instance.restTimeoutPending = false;
6880          const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();
6881          if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) {
6882            return;
6883          }
6884          if (handleCloseRef.current && handleCloseContextBase) {
6885            if (!store2.select("open")) {
6886              instance.openChangeTimeout.clear();
6887            }
6888            const currentTrigger = triggerElementRef.current;
6889            instance.handler = handleCloseRef.current({
6890              ...handleCloseContextBase,
6891              tree,
6892              x: event.clientX,
6893              y: event.clientY,
6894              onClose() {
6895                clearPointerEvents();
6896                cleanupMouseMoveHandler();
6897                if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store2.select("domReferenceElement")) {
6898                  closeWithDelay(event, true);
6899                }
6900              }
6901            });
6902            doc.addEventListener("mousemove", instance.handler);
6903            instance.handler(event);
6904            return;
6905          }
6906          const shouldClose = instance.pointerType === "touch" ? !contains(store2.select("floatingElement"), event.relatedTarget) : true;
6907          if (shouldClose) {
6908            closeWithDelay(event);
6909          }
6910        }
6911        function onMouseOut(event) {
6912          if (contains(trigger, event.relatedTarget)) {
6913            return;
6914          }
6915          instance.openChangeTimeout.clear();
6916          instance.restTimeout.clear();
6917          instance.restTimeoutPending = false;
6918        }
6919        const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, "mouseout", onMouseOut) : void 0;
6920        if (move) {
6921          return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, {
6922            once: true
6923          }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard);
6924        }
6925        return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard);
6926      }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store2, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]);
6927      return React27.useMemo(() => {
6928        if (!enabled) {
6929          return void 0;
6930        }
6931        function setPointerRef(event) {
6932          instance.pointerType = event.pointerType;
6933        }
6934        return {
6935          onPointerDown: setPointerRef,
6936          onPointerEnter: setPointerRef,
6937          onMouseMove(event) {
6938            const {
6939              nativeEvent
6940            } = event;
6941            const trigger = event.currentTarget;
6942            const currentDomReference = store2.select("domReferenceElement");
6943            const currentOpen = store2.select("open");
6944            const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);
6945            if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
6946              return;
6947            }
6948            if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {
6949              const floatingElement = store2.select("floatingElement");
6950              if (floatingElement) {
6951                const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;
6952                applySafePolygonPointerEventsMutation(instance, {
6953                  scopeElement,
6954                  referenceElement: trigger,
6955                  floatingElement
6956                });
6957              }
6958            }
6959            const restMsValue = getRestMs(restMsRef.current);
6960            if (currentOpen && !isOverInactive || restMsValue === 0) {
6961              return;
6962            }
6963            if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) {
6964              return;
6965            }
6966            instance.restTimeout.clear();
6967            function handleMouseMove() {
6968              instance.restTimeoutPending = false;
6969              if (isClickLikeOpenEvent2()) {
6970                return;
6971              }
6972              const latestOpen = store2.select("open");
6973              if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) {
6974                store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger));
6975              }
6976            }
6977            if (instance.pointerType === "touch") {
6978              ReactDOM5.flushSync(() => {
6979                handleMouseMove();
6980              });
6981            } else if (isOverInactive && currentOpen) {
6982              handleMouseMove();
6983            } else {
6984              instance.restTimeoutPending = true;
6985              instance.restTimeout.start(restMsValue, handleMouseMove);
6986            }
6987          }
6988        };
6989      }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store2, restMsRef, checkShouldOpen]);
6990    }
6991  
6992    // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs
6993    var CURSOR_SPEED_THRESHOLD = 0.1;
6994    var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;
6995    var POLYGON_BUFFER = 0.5;
6996    function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) {
6997      return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi;
6998    }
6999    function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) {
7000      let isInsideValue = false;
7001      if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {
7002        isInsideValue = !isInsideValue;
7003      }
7004      if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {
7005        isInsideValue = !isInsideValue;
7006      }
7007      if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {
7008        isInsideValue = !isInsideValue;
7009      }
7010      if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {
7011        isInsideValue = !isInsideValue;
7012      }
7013      return isInsideValue;
7014    }
7015    function isInsideRect(pointX, pointY, rect) {
7016      return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height;
7017    }
7018    function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) {
7019      const minX = Math.min(x1, x2);
7020      const maxX = Math.max(x1, x2);
7021      const minY = Math.min(y1, y2);
7022      const maxY = Math.max(y1, y2);
7023      return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;
7024    }
7025    function safePolygon(options = {}) {
7026      const {
7027        blockPointerEvents = false
7028      } = options;
7029      const timeout = new Timeout();
7030      const fn = ({
7031        x,
7032        y,
7033        placement,
7034        elements,
7035        onClose,
7036        nodeId,
7037        tree
7038      }) => {
7039        const side = placement?.split("-")[0];
7040        let hasLanded = false;
7041        let lastX = null;
7042        let lastY = null;
7043        let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0;
7044        function isCursorMovingSlowly(nextX, nextY) {
7045          const currentTime = performance.now();
7046          const elapsedTime = currentTime - lastCursorTime;
7047          if (lastX === null || lastY === null || elapsedTime === 0) {
7048            lastX = nextX;
7049            lastY = nextY;
7050            lastCursorTime = currentTime;
7051            return false;
7052          }
7053          const deltaX = nextX - lastX;
7054          const deltaY = nextY - lastY;
7055          const distanceSquared = deltaX * deltaX + deltaY * deltaY;
7056          const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;
7057          lastX = nextX;
7058          lastY = nextY;
7059          lastCursorTime = currentTime;
7060          return distanceSquared < thresholdSquared;
7061        }
7062        function close() {
7063          timeout.clear();
7064          onClose();
7065        }
7066        return function onMouseMove(event) {
7067          timeout.clear();
7068          const domReference = elements.domReference;
7069          const floating = elements.floating;
7070          if (!domReference || !floating || side == null || x == null || y == null) {
7071            return void 0;
7072          }
7073          const {
7074            clientX,
7075            clientY
7076          } = event;
7077          const target = getTarget(event);
7078          const isLeave = event.type === "mouseleave";
7079          const isOverFloatingEl = contains(floating, target);
7080          const isOverReferenceEl = contains(domReference, target);
7081          if (isOverFloatingEl) {
7082            hasLanded = true;
7083            if (!isLeave) {
7084              return void 0;
7085            }
7086          }
7087          if (isOverReferenceEl) {
7088            hasLanded = false;
7089            if (!isLeave) {
7090              hasLanded = true;
7091              return void 0;
7092            }
7093          }
7094          if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) {
7095            return void 0;
7096          }
7097          function hasOpenChildNode() {
7098            return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0);
7099          }
7100          function closeIfNoOpenChild() {
7101            if (!hasOpenChildNode()) {
7102              close();
7103            }
7104          }
7105          if (hasOpenChildNode()) {
7106            return void 0;
7107          }
7108          const refRect = domReference.getBoundingClientRect();
7109          const rect = floating.getBoundingClientRect();
7110          const cursorLeaveFromRight = x > rect.right - rect.width / 2;
7111          const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;
7112          const isFloatingWider = rect.width > refRect.width;
7113          const isFloatingTaller = rect.height > refRect.height;
7114          const left = (isFloatingWider ? refRect : rect).left;
7115          const right = (isFloatingWider ? refRect : rect).right;
7116          const top = (isFloatingTaller ? refRect : rect).top;
7117          const bottom = (isFloatingTaller ? refRect : rect).bottom;
7118          if (side === "top" && y >= refRect.bottom - 1 || side === "bottom" && y <= refRect.top + 1 || side === "left" && x >= refRect.right - 1 || side === "right" && x <= refRect.left + 1) {
7119            closeIfNoOpenChild();
7120            return void 0;
7121          }
7122          let isInsideTroughRect = false;
7123          switch (side) {
7124            case "top":
7125              isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1);
7126              break;
7127            case "bottom":
7128              isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1);
7129              break;
7130            case "left":
7131              isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top);
7132              break;
7133            case "right":
7134              isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top);
7135              break;
7136            default:
7137          }
7138          if (isInsideTroughRect) {
7139            return void 0;
7140          }
7141          if (hasLanded && !isInsideRect(clientX, clientY, refRect)) {
7142            closeIfNoOpenChild();
7143            return void 0;
7144          }
7145          if (!isLeave && isCursorMovingSlowly(clientX, clientY)) {
7146            closeIfNoOpenChild();
7147            return void 0;
7148          }
7149          let isInsidePolygon = false;
7150          switch (side) {
7151            case "top": {
7152              const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7153              const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
7154              const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
7155              const cursorPointY = y + POLYGON_BUFFER + 1;
7156              const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top;
7157              const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER;
7158              isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
7159              break;
7160            }
7161            case "bottom": {
7162              const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7163              const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
7164              const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
7165              const cursorPointY = y - POLYGON_BUFFER;
7166              const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom;
7167              const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER;
7168              isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
7169              break;
7170            }
7171            case "left": {
7172              const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7173              const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
7174              const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
7175              const cursorPointX = x + POLYGON_BUFFER + 1;
7176              const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left;
7177              const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER;
7178              isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY);
7179              break;
7180            }
7181            case "right": {
7182              const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7183              const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
7184              const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
7185              const cursorPointX = x - POLYGON_BUFFER;
7186              const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right;
7187              const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER;
7188              isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom);
7189              break;
7190            }
7191            default:
7192          }
7193          if (!isInsidePolygon) {
7194            closeIfNoOpenChild();
7195          } else if (!hasLanded) {
7196            timeout.start(40, closeIfNoOpenChild);
7197          }
7198          return void 0;
7199        };
7200      };
7201      fn.__options = {
7202        ...options,
7203        blockPointerEvents
7204      };
7205      return fn;
7206    }
7207  
7208    // node_modules/@base-ui/react/utils/NullStore.mjs
7209    var NullStore = class extends ReactStore {
7210      // `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding
7211      // `setState` alone would neutralize them today. They are overridden explicitly so the store stays
7212      // inert even if a future base-class change stops routing a mutator through `setState`.
7213      setState(_newState) {
7214      }
7215      update(_changes) {
7216      }
7217      set(_key, _value) {
7218      }
7219      notifyAll() {
7220      }
7221    };
7222  
7223    // node_modules/@base-ui/react/utils/popupStateMapping.mjs
7224    var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) {
7225      CommonPopupDataAttributes2["open"] = "data-open";
7226      CommonPopupDataAttributes2["closed"] = "data-closed";
7227      CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle";
7228      CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle";
7229      CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden";
7230      CommonPopupDataAttributes2["side"] = "data-side";
7231      CommonPopupDataAttributes2["align"] = "data-align";
7232      return CommonPopupDataAttributes2;
7233    })({});
7234    var TRIGGER_HOOK = {
7235      "data-popup-open": ""
7236    };
7237    var POPUP_OPEN_HOOK = {
7238      "data-open": ""
7239    };
7240    var POPUP_CLOSED_HOOK = {
7241      "data-closed": ""
7242    };
7243    var ANCHOR_HIDDEN_HOOK = {
7244      "data-anchor-hidden": ""
7245    };
7246    var triggerOpenStateMapping = {
7247      open(value) {
7248        if (value) {
7249          return TRIGGER_HOOK;
7250        }
7251        return null;
7252      }
7253    };
7254    var popupStateMapping = {
7255      open(value) {
7256        if (value) {
7257          return POPUP_OPEN_HOOK;
7258        }
7259        return POPUP_CLOSED_HOOK;
7260      },
7261      anchorHidden(value) {
7262        if (value) {
7263          return ANCHOR_HIDDEN_HOOK;
7264        }
7265        return null;
7266      }
7267    };
7268    var popupTransitionStateMapping = {
7269      ...popupStateMapping,
7270      ...transitionStatusMapping
7271    };
7272  
7273    // node_modules/@base-ui/utils/inertValue.mjs
7274    function inertValue(value) {
7275      if (isReactVersionAtLeast(19)) {
7276        return value;
7277      }
7278      return value ? "true" : void 0;
7279    }
7280  
7281    // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs
7282    var React28 = __toESM(require_react(), 1);
7283    var DirectionContext = /* @__PURE__ */ React28.createContext(void 0);
7284    if (true) DirectionContext.displayName = "DirectionContext";
7285    function useDirection() {
7286      const context = React28.useContext(DirectionContext);
7287      return context?.direction ?? "ltr";
7288    }
7289  
7290    // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs
7291    var React29 = __toESM(require_react(), 1);
7292  
7293    // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs
7294    var baseArrow = (options) => ({
7295      name: "arrow",
7296      options,
7297      async fn(state) {
7298        const {
7299          x,
7300          y,
7301          placement,
7302          rects,
7303          platform: platform3,
7304          elements,
7305          middlewareData
7306        } = state;
7307        const {
7308          element,
7309          padding = 0,
7310          offsetParent = "real"
7311        } = evaluate(options, state) || {};
7312        if (element == null) {
7313          return {};
7314        }
7315        const paddingObject = getPaddingObject(padding);
7316        const coords = {
7317          x,
7318          y
7319        };
7320        const axis = getAlignmentAxis(placement);
7321        const length = getAxisLength(axis);
7322        const arrowDimensions = await platform3.getDimensions(element);
7323        const isYAxis = axis === "y";
7324        const minProp = isYAxis ? "top" : "left";
7325        const maxProp = isYAxis ? "bottom" : "right";
7326        const clientProp = isYAxis ? "clientHeight" : "clientWidth";
7327        const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
7328        const startDiff = coords[axis] - rects.reference[axis];
7329        const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating;
7330        let clientSize = elements.floating[clientProp] || rects.floating[length];
7331        if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) {
7332          clientSize = elements.floating[clientProp] || rects.floating[length];
7333        }
7334        const centerToReference = endDiff / 2 - startDiff / 2;
7335        const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
7336        const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);
7337        const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);
7338        const min2 = minPadding;
7339        const max2 = clientSize - arrowDimensions[length] - maxPadding;
7340        const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
7341        const offset4 = clamp(min2, center, max2);
7342        const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
7343        const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0;
7344        return {
7345          [axis]: coords[axis] + alignmentOffset,
7346          data: {
7347            [axis]: offset4,
7348            centerOffset: center - offset4 - alignmentOffset,
7349            ...shouldAddOffset && {
7350              alignmentOffset
7351            }
7352          },
7353          reset: shouldAddOffset
7354        };
7355      }
7356    });
7357    var arrow4 = (options, deps) => ({
7358      ...baseArrow(options),
7359      options: [options, deps]
7360    });
7361  
7362    // node_modules/@base-ui/react/utils/hideMiddleware.mjs
7363    var hide4 = {
7364      name: "hide",
7365      async fn(state) {
7366        const {
7367          width,
7368          height,
7369          x,
7370          y
7371        } = state.rects.reference;
7372        const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0;
7373        const overflow = await state.platform.detectOverflow(state, {
7374          elementContext: "reference"
7375        });
7376        const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0;
7377        return {
7378          data: {
7379            referenceHidden: referenceHidden || anchorHidden
7380          }
7381        };
7382      }
7383    };
7384  
7385    // node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs
7386    var DEFAULT_SIDES = {
7387      sideX: "left",
7388      sideY: "top"
7389    };
7390  
7391    // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs
7392    var AVAILABLE_WIDTH_VAR = "--available-width";
7393    var AVAILABLE_HEIGHT_VAR = "--available-height";
7394    function getLogicalSide(sideParam, renderedSide, isRtl) {
7395      const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end";
7396      const logicalRight = isRtl ? "inline-start" : "inline-end";
7397      const logicalLeft = isRtl ? "inline-end" : "inline-start";
7398      return {
7399        top: "top",
7400        right: isLogicalSideParam ? logicalRight : "right",
7401        bottom: "bottom",
7402        left: isLogicalSideParam ? logicalLeft : "left"
7403      }[renderedSide];
7404    }
7405    function getOffsetData(state, sideParam, isRtl) {
7406      const {
7407        rects,
7408        placement
7409      } = state;
7410      const data = {
7411        side: getLogicalSide(sideParam, getSide(placement), isRtl),
7412        align: getAlignment(placement) || "center",
7413        anchor: {
7414          width: rects.reference.width,
7415          height: rects.reference.height
7416        },
7417        positioner: {
7418          width: rects.floating.width,
7419          height: rects.floating.height
7420        }
7421      };
7422      return data;
7423    }
7424    function useAnchorPositioning(params) {
7425      return useAnchorPositioningWithHook(params, useBaseUIFloating);
7426    }
7427    function useAnchorPositioningWithHook(params, useFloatingHook) {
7428      const {
7429        // Public parameters
7430        anchor,
7431        positionMethod = "absolute",
7432        side: sideParam = "bottom",
7433        sideOffset = 0,
7434        align = "center",
7435        alignOffset = 0,
7436        collisionBoundary,
7437        collisionPadding: collisionPaddingParam = 5,
7438        sticky = false,
7439        arrowPadding = 5,
7440        disableAnchorTracking = false,
7441        inline: inlineMiddleware,
7442        // Private parameters
7443        keepMounted = false,
7444        floatingRootContext,
7445        mounted,
7446        collisionAvoidance,
7447        shift: shift4,
7448        nodeId,
7449        adaptiveOrigin: adaptiveOrigin2,
7450        lazyFlip = false,
7451        externalTree
7452      } = params;
7453      const [mountSide, setMountSide] = React29.useState(null);
7454      if (!mounted && mountSide !== null) {
7455        setMountSide(null);
7456      }
7457      const collisionAvoidanceSide = collisionAvoidance.side || "flip";
7458      const collisionAvoidanceAlign = collisionAvoidance.align || "flip";
7459      const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end";
7460      const shiftCrossAxis = shift4?.crossAxis ?? false;
7461      const shiftRootBoundary = shift4?.rootBoundary;
7462      const anchorFn = typeof anchor === "function" ? anchor : void 0;
7463      const anchorFnCallback = useStableCallback(anchorFn);
7464      const anchorDep = anchorFn ? anchorFnCallback : anchor;
7465      const anchorValueRef = useValueAsRef(anchor);
7466      const mountedRef = useValueAsRef(mounted);
7467      const direction = useDirection();
7468      const isRtl = direction === "rtl";
7469      const side = mountSide || {
7470        top: "top",
7471        right: "right",
7472        bottom: "bottom",
7473        left: "left",
7474        "inline-end": isRtl ? "left" : "right",
7475        "inline-start": isRtl ? "right" : "left"
7476      }[sideParam];
7477      const placement = align === "center" ? side : `$side}-$align}`;
7478      let collisionPadding = collisionPaddingParam;
7479      if (typeof collisionPadding === "number") {
7480        collisionPadding = {
7481          top: collisionPadding,
7482          right: collisionPadding,
7483          bottom: collisionPadding,
7484          left: collisionPadding
7485        };
7486      } else if (collisionPadding) {
7487        collisionPadding = {
7488          top: collisionPadding.top || 0,
7489          right: collisionPadding.right || 0,
7490          bottom: collisionPadding.bottom || 0,
7491          left: collisionPadding.left || 0
7492        };
7493      }
7494      const bias = 1;
7495      const biasTop = sideParam === "bottom" ? bias : 0;
7496      const biasBottom = sideParam === "top" ? bias : 0;
7497      const biasLeft = sideParam === "right" ? bias : 0;
7498      const biasRight = sideParam === "left" ? bias : 0;
7499      const commonCollisionProps = {
7500        boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary,
7501        padding: collisionPadding
7502      };
7503      const arrowRef = React29.useRef(null);
7504      const sideOffsetRef = useValueAsRef(sideOffset);
7505      const alignOffsetRef = useValueAsRef(alignOffset);
7506      const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0;
7507      const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0;
7508      const middleware = [];
7509      if (inlineMiddleware) {
7510        middleware.push(inlineMiddleware);
7511      }
7512      middleware.push(offset3((state) => {
7513        const data = getOffsetData(state, sideParam, isRtl);
7514        const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current;
7515        const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current;
7516        return {
7517          mainAxis: sideAxis,
7518          crossAxis: alignAxis,
7519          alignmentAxis: alignAxis
7520        };
7521      }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam]));
7522      const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift";
7523      const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift");
7524      const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({
7525        ...commonCollisionProps,
7526        // Ensure the popup flips if it's been limited by its --available-height and it resizes.
7527        // Since the size() padding is smaller than the flip() padding, flip() will take precedence.
7528        padding: {
7529          top: collisionPadding.top + bias + biasTop,
7530          right: collisionPadding.right + bias + biasRight,
7531          bottom: collisionPadding.bottom + bias + biasBottom,
7532          left: collisionPadding.left + bias + biasLeft
7533        },
7534        mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip",
7535        crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false,
7536        fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide
7537      });
7538      const shiftMiddleware = shiftDisabled ? null : shift3({
7539        ...commonCollisionProps,
7540        // Use the Layout Viewport to avoid shifting around when pinch-zooming.
7541        rootBoundary: shiftRootBoundary,
7542        mainAxis: collisionAvoidanceAlign !== "none",
7543        crossAxis: crossAxisShiftEnabled,
7544        limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => {
7545          if (!arrowRef.current) {
7546            return {};
7547          }
7548          const {
7549            width,
7550            height
7551          } = arrowRef.current.getBoundingClientRect();
7552          const sideAxis = getSideAxis(getSide(limitData.placement));
7553          const arrowSize = sideAxis === "y" ? width : height;
7554          const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;
7555          return {
7556            offset: arrowSize / 2 + offsetAmount / 2
7557          };
7558        })
7559      }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]);
7560      if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") {
7561        middleware.push(shiftMiddleware, flipMiddleware);
7562      } else {
7563        middleware.push(flipMiddleware, shiftMiddleware);
7564      }
7565      middleware.push(size3({
7566        ...commonCollisionProps,
7567        apply({
7568          elements: {
7569            floating
7570          },
7571          availableWidth,
7572          availableHeight,
7573          rects
7574        }) {
7575          if (!mountedRef.current) {
7576            return;
7577          }
7578          const floatingStyle = floating.style;
7579          floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `$availableWidth}px`);
7580          floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `$availableHeight}px`);
7581          const dpr = getWindow(floating).devicePixelRatio || 1;
7582          const {
7583            x: x2,
7584            y: y2,
7585            width,
7586            height
7587          } = rects.reference;
7588          const anchorWidth = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr;
7589          const anchorHeight = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr;
7590          floatingStyle.setProperty("--anchor-width", `$anchorWidth}px`);
7591          floatingStyle.setProperty("--anchor-height", `$anchorHeight}px`);
7592        }
7593      }), arrow4((state) => ({
7594        // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,
7595        // we'll create a fake element.
7596        element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"),
7597        padding: arrowPadding,
7598        offsetParent: "floating"
7599      }), [arrowPadding]), {
7600        name: "transformOrigin",
7601        fn(state) {
7602          const {
7603            elements: elements2,
7604            middlewareData: middlewareData2,
7605            placement: renderedPlacement2,
7606            rects,
7607            y: y2
7608          } = state;
7609          const currentRenderedSide = getSide(renderedPlacement2);
7610          const currentRenderedAxis = getSideAxis(currentRenderedSide);
7611          const arrowEl = arrowRef.current;
7612          const arrowX = middlewareData2.arrow?.x || 0;
7613          const arrowY = middlewareData2.arrow?.y || 0;
7614          const arrowWidth = arrowEl?.clientWidth || 0;
7615          const arrowHeight = arrowEl?.clientHeight || 0;
7616          const transformX = arrowX + arrowWidth / 2;
7617          const transformY = arrowY + arrowHeight / 2;
7618          const shiftY = Math.abs(middlewareData2.shift?.y || 0);
7619          const halfAnchorHeight = rects.reference.height / 2;
7620          const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;
7621          const isOverlappingAnchor = shiftY > sideOffsetValue;
7622          const adjacentTransformOrigin = {
7623            top: `$transformX}px calc(100% + $sideOffsetValue}px)`,
7624            bottom: `$transformX}px ${-sideOffsetValue}px`,
7625            left: `calc(100% + $sideOffsetValue}px) $transformY}px`,
7626            right: `${-sideOffsetValue}px $transformY}px`
7627          }[currentRenderedSide];
7628          const overlapTransformOrigin = `$transformX}px $rects.reference.y + halfAnchorHeight - y2}px`;
7629          elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin);
7630          return {};
7631        }
7632      }, hide4, adaptiveOrigin2);
7633      useIsoLayoutEffect(() => {
7634        if (!mounted && floatingRootContext) {
7635          floatingRootContext.update({
7636            referenceElement: null,
7637            floatingElement: null,
7638            domReferenceElement: null,
7639            positionReference: null
7640          });
7641        }
7642      }, [mounted, floatingRootContext]);
7643      const autoUpdateOptions = React29.useMemo(() => ({
7644        elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined",
7645        layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined"
7646      }), [disableAnchorTracking]);
7647      const {
7648        refs,
7649        elements,
7650        x,
7651        y,
7652        middlewareData,
7653        update: update2,
7654        placement: renderedPlacement,
7655        context,
7656        isPositioned,
7657        floatingStyles: originalFloatingStyles
7658      } = useFloatingHook({
7659        rootContext: floatingRootContext,
7660        open: keepMounted ? mounted : void 0,
7661        placement,
7662        middleware,
7663        strategy: positionMethod,
7664        whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions),
7665        nodeId,
7666        externalTree
7667      });
7668      const {
7669        sideX,
7670        sideY
7671      } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;
7672      const resolvedPosition = isPositioned ? positionMethod : "fixed";
7673      const floatingStyles = React29.useMemo(() => {
7674        let base;
7675        if (!isPositioned) {
7676          base = {
7677            position: resolvedPosition,
7678            top: 0,
7679            left: 0
7680          };
7681        } else if (adaptiveOrigin2) {
7682          base = {
7683            position: resolvedPosition,
7684            [sideX]: x,
7685            [sideY]: y
7686          };
7687        } else {
7688          base = {
7689            ...originalFloatingStyles,
7690            position: resolvedPosition
7691          };
7692        }
7693        base[AVAILABLE_WIDTH_VAR] = "100vw";
7694        base[AVAILABLE_HEIGHT_VAR] = "100vh";
7695        if (!isPositioned) {
7696          base.opacity = 0;
7697        }
7698        return base;
7699      }, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]);
7700      const registeredPositionReferenceRef = React29.useRef(null);
7701      useIsoLayoutEffect(() => {
7702        if (!mounted) {
7703          return;
7704        }
7705        const anchorValue = anchorValueRef.current;
7706        const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue;
7707        const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;
7708        const finalAnchor = unwrappedElement || null;
7709        if (finalAnchor !== registeredPositionReferenceRef.current) {
7710          refs.setPositionReference(finalAnchor);
7711          registeredPositionReferenceRef.current = finalAnchor;
7712        }
7713      }, [mounted, refs, anchorDep, anchorValueRef]);
7714      React29.useEffect(() => {
7715        if (!mounted) {
7716          return;
7717        }
7718        const anchorValue = anchorValueRef.current;
7719        if (typeof anchorValue === "function") {
7720          return;
7721        }
7722        if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {
7723          refs.setPositionReference(anchorValue.current);
7724          registeredPositionReferenceRef.current = anchorValue.current;
7725        }
7726      }, [mounted, refs, anchorDep, anchorValueRef]);
7727      React29.useEffect(() => {
7728        if (keepMounted && mounted && elements.reference && elements.floating) {
7729          return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions);
7730        }
7731        return void 0;
7732      }, [keepMounted, mounted, elements, update2, autoUpdateOptions]);
7733      const renderedSide = getSide(renderedPlacement);
7734      const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);
7735      const renderedAlign = getAlignment(renderedPlacement) || "center";
7736      const anchorHidden = Boolean(middlewareData.hide?.referenceHidden);
7737      useIsoLayoutEffect(() => {
7738        if (lazyFlip && mounted && isPositioned && renderedSide !== side) {
7739          setMountSide(renderedSide);
7740        }
7741      }, [lazyFlip, mounted, isPositioned, renderedSide, side]);
7742      const arrowStyles = React29.useMemo(() => ({
7743        position: "absolute",
7744        top: middlewareData.arrow?.y,
7745        left: middlewareData.arrow?.x
7746      }), [middlewareData.arrow]);
7747      const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;
7748      return React29.useMemo(() => ({
7749        positionerStyles: floatingStyles,
7750        arrowStyles,
7751        arrowRef,
7752        arrowUncentered,
7753        side: logicalRenderedSide,
7754        align: renderedAlign,
7755        physicalSide: renderedSide,
7756        anchorHidden,
7757        refs,
7758        context,
7759        isPositioned,
7760        update: update2
7761      }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]);
7762    }
7763    function isRef(param) {
7764      return param != null && "current" in param;
7765    }
7766  
7767    // node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs
7768    function getDisabledMountTransitionStyles(transitionStatus) {
7769      return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;
7770    }
7771  
7772    // node_modules/@base-ui/react/utils/usePositioner.mjs
7773    function usePositioner(componentProps, state, {
7774      styles,
7775      transitionStatus,
7776      props,
7777      refs,
7778      hidden,
7779      inert = false
7780    }) {
7781      const style = {
7782        ...styles
7783      };
7784      if (inert) {
7785        style.pointerEvents = "none";
7786      }
7787      return useRenderElement("div", componentProps, {
7788        state,
7789        ref: refs,
7790        props: [{
7791          role: "presentation",
7792          hidden,
7793          style
7794        }, getDisabledMountTransitionStyles(transitionStatus), props],
7795        stateAttributesMapping: popupStateMapping
7796      });
7797    }
7798  
7799    // node_modules/@base-ui/react/utils/usePopupViewport.mjs
7800    var React33 = __toESM(require_react(), 1);
7801    var ReactDOM6 = __toESM(require_react_dom(), 1);
7802  
7803    // node_modules/@base-ui/utils/usePreviousValue.mjs
7804    var React30 = __toESM(require_react(), 1);
7805    function usePreviousValue(value) {
7806      const [state, setState] = React30.useState({
7807        current: value,
7808        previous: null
7809      });
7810      if (!Object.is(value, state.current)) {
7811        setState({
7812          current: value,
7813          previous: state.current
7814        });
7815      }
7816      return state.previous;
7817    }
7818  
7819    // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
7820    var React31 = __toESM(require_react(), 1);
7821  
7822    // node_modules/@base-ui/react/utils/getCssDimensions.mjs
7823    function getCssDimensions2(element) {
7824      const css = getComputedStyle2(element);
7825      let width = parseFloat(css.width) || 0;
7826      let height = parseFloat(css.height) || 0;
7827      const hasOffset = isHTMLElement(element);
7828      const offsetWidth = hasOffset ? element.offsetWidth : width;
7829      const offsetHeight = hasOffset ? element.offsetHeight : height;
7830      const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
7831      if (shouldFallback) {
7832        width = offsetWidth;
7833        height = offsetHeight;
7834      }
7835      return {
7836        width,
7837        height
7838      };
7839    }
7840  
7841    // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
7842    function usePopupAutoResize(parameters) {
7843      const {
7844        popupElement,
7845        positionerElement,
7846        content,
7847        mounted,
7848        onMeasureLayout: onMeasureLayoutParam,
7849        onMeasureLayoutComplete: onMeasureLayoutCompleteParam,
7850        side,
7851        direction
7852      } = parameters;
7853      const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true);
7854      const animationFrame = useAnimationFrame();
7855      const committedDimensionsRef = React31.useRef(null);
7856      const isInitialRenderRef = React31.useRef(true);
7857      const restoreAnchoringStylesRef = React31.useRef(NOOP);
7858      const onMeasureLayout = useStableCallback(onMeasureLayoutParam);
7859      const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam);
7860      const anchoringStyles = React31.useMemo(() => getPopupAnchoringStyles(side, direction), [side, direction]);
7861      useIsoLayoutEffect(() => {
7862        if (!mounted) {
7863          restoreAnchoringStylesRef.current = NOOP;
7864          isInitialRenderRef.current = true;
7865          committedDimensionsRef.current = null;
7866          return void 0;
7867        }
7868        if (!popupElement || !positionerElement) {
7869          return void 0;
7870        }
7871        restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles);
7872        setPopupCssSize(popupElement, "auto");
7873        const restorePopupPosition = overrideElementStyle(popupElement, "position", "static");
7874        const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none");
7875        const restorePopupScale = overrideElementStyle(popupElement, "scale", "1");
7876        const restorePositionerAvailableSize = applyElementStyles(positionerElement, {
7877          "--available-width": "max-content",
7878          "--available-height": "max-content"
7879        });
7880        function restoreMeasurementOverrides() {
7881          restorePopupPosition();
7882          restorePopupTransform();
7883          restorePositionerAvailableSize();
7884        }
7885        function restoreMeasurementOverridesIncludingScale() {
7886          restoreMeasurementOverrides();
7887          restorePopupScale();
7888        }
7889        onMeasureLayout?.();
7890        if (isInitialRenderRef.current || committedDimensionsRef.current === null) {
7891          setPositionerCssSize(positionerElement, "max-content");
7892          const dimensions = getCssDimensions2(popupElement);
7893          committedDimensionsRef.current = dimensions;
7894          setPositionerCssSize(positionerElement, dimensions);
7895          restoreMeasurementOverridesIncludingScale();
7896          onMeasureLayoutComplete?.(null, dimensions);
7897          isInitialRenderRef.current = false;
7898          return () => {
7899            restoreAnchoringStylesRef.current();
7900            restoreAnchoringStylesRef.current = NOOP;
7901          };
7902        }
7903        setPositionerCssSize(positionerElement, "max-content");
7904        const previousDimensions = committedDimensionsRef.current;
7905        const newDimensions = getCssDimensions2(popupElement);
7906        committedDimensionsRef.current = newDimensions;
7907        setPopupCssSize(popupElement, previousDimensions);
7908        restoreMeasurementOverridesIncludingScale();
7909        onMeasureLayoutComplete?.(previousDimensions, newDimensions);
7910        setPositionerCssSize(positionerElement, newDimensions);
7911        const abortController = new AbortController();
7912        animationFrame.request(() => {
7913          setPopupCssSize(popupElement, newDimensions);
7914          runOnceAnimationsFinish(() => {
7915            popupElement.style.setProperty("--popup-width", "auto");
7916            popupElement.style.setProperty("--popup-height", "auto");
7917          }, abortController.signal);
7918        });
7919        return () => {
7920          abortController.abort();
7921          animationFrame.cancel();
7922          restoreAnchoringStylesRef.current();
7923          restoreAnchoringStylesRef.current = NOOP;
7924        };
7925      }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]);
7926    }
7927    function getPopupAnchoringStyles(side, direction) {
7928      const isPhysicalTop = side === "top";
7929      const isPhysicalLeft = side === "left" || side === (direction === "rtl" ? "inline-end" : "inline-start");
7930      if (!isPhysicalTop && !isPhysicalLeft) {
7931        return EMPTY_OBJECT;
7932      }
7933      return {
7934        position: "absolute",
7935        [isPhysicalTop ? "bottom" : "top"]: "0",
7936        [isPhysicalLeft ? "right" : "left"]: "0"
7937      };
7938    }
7939    function overrideElementStyle(element, property, value) {
7940      const originalValue = element.style.getPropertyValue(property);
7941      element.style.setProperty(property, value);
7942      return () => {
7943        element.style.setProperty(property, originalValue);
7944      };
7945    }
7946    function applyElementStyles(element, styles) {
7947      const restorers = [];
7948      for (const [key, value] of Object.entries(styles)) {
7949        restorers.push(overrideElementStyle(element, key, value));
7950      }
7951      return restorers.length ? () => {
7952        restorers.forEach((restore) => restore());
7953      } : NOOP;
7954    }
7955    function setPopupCssSize(popupElement, size4) {
7956      const width = size4 === "auto" ? "auto" : `$size4.width}px`;
7957      const height = size4 === "auto" ? "auto" : `$size4.height}px`;
7958      popupElement.style.setProperty("--popup-width", width);
7959      popupElement.style.setProperty("--popup-height", height);
7960    }
7961    function setPositionerCssSize(positionerElement, size4) {
7962      const width = size4 === "max-content" ? "max-content" : `$size4.width}px`;
7963      const height = size4 === "max-content" ? "max-content" : `$size4.height}px`;
7964      positionerElement.style.setProperty("--positioner-width", width);
7965      positionerElement.style.setProperty("--positioner-height", height);
7966    }
7967  
7968    // node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs
7969    var React32 = __toESM(require_react(), 1);
7970    var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
7971    var DirectionProvider = function DirectionProvider2(props) {
7972      const {
7973        direction = "ltr"
7974      } = props;
7975      const contextValue = React32.useMemo(() => ({
7976        direction
7977      }), [direction]);
7978      return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DirectionContext.Provider, {
7979        value: contextValue,
7980        children: props.children
7981      });
7982    };
7983    if (true) DirectionProvider.displayName = "DirectionProvider";
7984  
7985    // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs
7986    var adaptiveOrigin = {
7987      name: "adaptiveOrigin",
7988      async fn(state) {
7989        const {
7990          x: rawX,
7991          y: rawY,
7992          rects: {
7993            floating: floatRect
7994          },
7995          elements: {
7996            floating
7997          },
7998          platform: platform3,
7999          strategy,
8000          placement
8001        } = state;
8002        const win = getWindow(floating);
8003        const styles = win.getComputedStyle(floating);
8004        const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== "";
8005        if (!hasTransition) {
8006          return {
8007            x: rawX,
8008            y: rawY,
8009            data: DEFAULT_SIDES
8010          };
8011        }
8012        const offsetParent = await platform3.getOffsetParent?.(floating);
8013        let offsetDimensions = {
8014          width: 0,
8015          height: 0
8016        };
8017        if (strategy === "fixed" && win?.visualViewport) {
8018          offsetDimensions = {
8019            width: win.visualViewport.width,
8020            height: win.visualViewport.height
8021          };
8022        } else if (offsetParent === win) {
8023          const doc = ownerDocument(floating);
8024          offsetDimensions = {
8025            width: doc.documentElement.clientWidth,
8026            height: doc.documentElement.clientHeight
8027          };
8028        } else if (await platform3.isElement?.(offsetParent)) {
8029          offsetDimensions = await platform3.getDimensions(offsetParent);
8030        }
8031        const currentSide = getSide(placement);
8032        let x = rawX;
8033        let y = rawY;
8034        if (currentSide === "left") {
8035          x = offsetDimensions.width - (rawX + floatRect.width);
8036        }
8037        if (currentSide === "top") {
8038          y = offsetDimensions.height - (rawY + floatRect.height);
8039        }
8040        const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX;
8041        const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY;
8042        return {
8043          x,
8044          y,
8045          data: {
8046            sideX,
8047            sideY
8048          }
8049        };
8050      }
8051    };
8052  
8053    // node_modules/@base-ui/react/utils/usePopupViewport.mjs
8054    var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
8055    var popupViewportStateMapping = {
8056      activationDirection: (value) => value ? {
8057        "data-activation-direction": value
8058      } : null
8059    };
8060    function usePopupViewport(parameters) {
8061      const {
8062        store: store2,
8063        side,
8064        children
8065      } = parameters;
8066      const direction = useDirection();
8067      const activeTrigger = store2.useState("activeTriggerElement");
8068      const activeTriggerId = store2.useState("activeTriggerId");
8069      const open = store2.useState("open");
8070      const payload = store2.useState("payload");
8071      const mounted = store2.useState("mounted");
8072      const popupElement = store2.useState("popupElement");
8073      const positionerElement = store2.useState("positionerElement");
8074      const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null);
8075      const currentContentKey = usePopupContentKey(activeTriggerId, payload);
8076      const capturedNodeRef = React33.useRef(null);
8077      const [previousContentNode, setPreviousContentNode] = React33.useState(null);
8078      const [newTriggerOffset, setNewTriggerOffset] = React33.useState(null);
8079      const currentContainerRef = React33.useRef(null);
8080      const previousContainerRef = React33.useRef(null);
8081      const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true);
8082      const cleanupFrame = useAnimationFrame();
8083      const cleanupControllerRef = React33.useRef(null);
8084      const [previousContentDimensions, setPreviousContentDimensions] = React33.useState(null);
8085      const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React33.useState(false);
8086      useIsoLayoutEffect(() => {
8087        store2.set("adaptiveOrigin", adaptiveOrigin);
8088        return () => {
8089          store2.set("adaptiveOrigin", void 0);
8090        };
8091      }, [store2]);
8092      const handleMeasureLayout = useStableCallback(() => {
8093        currentContainerRef.current?.style.setProperty("animation", "none");
8094        currentContainerRef.current?.style.setProperty("transition", "none");
8095        previousContainerRef.current?.style.setProperty("display", "none");
8096      });
8097      const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => {
8098        currentContainerRef.current?.style.removeProperty("animation");
8099        currentContainerRef.current?.style.removeProperty("transition");
8100        previousContainerRef.current?.style.removeProperty("display");
8101        if (previousDimensions) {
8102          setPreviousContentDimensions(previousDimensions);
8103        }
8104      });
8105      const armViewportCleanup = useStableCallback(() => {
8106        cleanupControllerRef.current?.abort();
8107        const controller = new AbortController();
8108        cleanupControllerRef.current = controller;
8109        onAnimationsFinished(() => {
8110          setPreviousContentNode(null);
8111          setPreviousContentDimensions(null);
8112          capturedNodeRef.current = null;
8113        }, controller.signal);
8114      });
8115      const lastHandledTriggerRef = React33.useRef(null);
8116      useIsoLayoutEffect(() => {
8117        if (!open || !mounted) {
8118          lastHandledTriggerRef.current = null;
8119        }
8120      }, [open, mounted]);
8121      useIsoLayoutEffect(() => {
8122        if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
8123          setPreviousContentNode(capturedNodeRef.current);
8124          setShowStartingStyleAttribute(true);
8125          const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger);
8126          setNewTriggerOffset(offset4);
8127          lastHandledTriggerRef.current = activeTrigger;
8128        }
8129      }, [activeTrigger, previousActiveTrigger]);
8130      useIsoLayoutEffect(() => {
8131        if (previousContentNode == null) {
8132          return;
8133        }
8134        cleanupControllerRef.current?.abort();
8135        setShowStartingStyleAttribute(true);
8136        cleanupFrame.request(() => {
8137          ReactDOM6.flushSync(() => {
8138            setShowStartingStyleAttribute(false);
8139          });
8140          armViewportCleanup();
8141        });
8142      }, [currentContentKey, previousContentNode, armViewportCleanup, cleanupFrame]);
8143      useIsoLayoutEffect(() => {
8144        const source = currentContainerRef.current;
8145        if (!source) {
8146          return;
8147        }
8148        const wrapper = ownerDocument(source).createElement("div");
8149        for (const child of Array.from(source.childNodes)) {
8150          wrapper.appendChild(child.cloneNode(true));
8151        }
8152        capturedNodeRef.current = wrapper;
8153      });
8154      const isTransitioning = previousContentNode != null;
8155      let childrenToRender;
8156      if (!isTransitioning) {
8157        childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
8158          "data-current": true,
8159          ref: currentContainerRef,
8160          children
8161        }, currentContentKey);
8162      } else {
8163        childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React33.Fragment, {
8164          children: [/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
8165            "data-previous": true,
8166            inert: inertValue(true),
8167            ref: previousContainerRef,
8168            style: {
8169              ...previousContentDimensions ? {
8170                "--popup-width": `$previousContentDimensions.width}px`,
8171                "--popup-height": `$previousContentDimensions.height}px`
8172              } : null,
8173              position: "absolute"
8174            },
8175            "data-ending-style": showStartingStyleAttribute ? void 0 : ""
8176          }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
8177            "data-current": true,
8178            ref: currentContainerRef,
8179            "data-starting-style": showStartingStyleAttribute ? "" : void 0,
8180            children
8181          }, currentContentKey)]
8182        });
8183      }
8184      useIsoLayoutEffect(() => {
8185        const container = previousContainerRef.current;
8186        if (!container || !previousContentNode) {
8187          return;
8188        }
8189        container.replaceChildren(...Array.from(previousContentNode.childNodes));
8190      }, [previousContentNode]);
8191      usePopupAutoResize({
8192        popupElement,
8193        positionerElement,
8194        mounted,
8195        content: payload,
8196        onMeasureLayout: handleMeasureLayout,
8197        onMeasureLayoutComplete: handleMeasureLayoutComplete,
8198        side,
8199        direction
8200      });
8201      const state = {
8202        activationDirection: getActivationDirection(newTriggerOffset),
8203        transitioning: isTransitioning
8204      };
8205      return {
8206        children: childrenToRender,
8207        state
8208      };
8209    }
8210    function getActivationDirection(offset4) {
8211      if (!offset4) {
8212        return void 0;
8213      }
8214      return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`;
8215    }
8216    function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) {
8217      if (value > tolerance) {
8218        return positiveLabel;
8219      }
8220      if (value < -tolerance) {
8221        return negativeLabel;
8222      }
8223      return "";
8224    }
8225    function calculateRelativePosition(from, to) {
8226      const fromRect = from.getBoundingClientRect();
8227      const toRect = to.getBoundingClientRect();
8228      const fromCenter = {
8229        x: fromRect.left + fromRect.width / 2,
8230        y: fromRect.top + fromRect.height / 2
8231      };
8232      const toCenter = {
8233        x: toRect.left + toRect.width / 2,
8234        y: toRect.top + toRect.height / 2
8235      };
8236      return {
8237        horizontal: toCenter.x - fromCenter.x,
8238        vertical: toCenter.y - fromCenter.y
8239      };
8240    }
8241    function usePopupContentKey(activeTriggerId, payload) {
8242      const [contentKey, setContentKey] = React33.useState(0);
8243      const previousActiveTriggerIdRef = React33.useRef(activeTriggerId);
8244      const previousPayloadRef = React33.useRef(payload);
8245      const pendingPayloadUpdateRef = React33.useRef(false);
8246      useIsoLayoutEffect(() => {
8247        const previousActiveTriggerId = previousActiveTriggerIdRef.current;
8248        const previousPayload = previousPayloadRef.current;
8249        const triggerIdChanged = activeTriggerId !== previousActiveTriggerId;
8250        const payloadChanged = payload !== previousPayload;
8251        if (triggerIdChanged) {
8252          setContentKey((value) => value + 1);
8253          pendingPayloadUpdateRef.current = !payloadChanged;
8254        } else if (pendingPayloadUpdateRef.current && payloadChanged) {
8255          setContentKey((value) => value + 1);
8256          pendingPayloadUpdateRef.current = false;
8257        }
8258        previousActiveTriggerIdRef.current = activeTriggerId;
8259        previousPayloadRef.current = payload;
8260      }, [activeTriggerId, payload]);
8261      return `$activeTriggerId ?? "current"}-$contentKey}`;
8262    }
8263  
8264    // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs
8265    var React34 = __toESM(require_react(), 1);
8266    var ReactDOM7 = __toESM(require_react_dom(), 1);
8267    var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
8268    var FloatingPortalLite = /* @__PURE__ */ React34.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) {
8269      const {
8270        children,
8271        container,
8272        className,
8273        render,
8274        style,
8275        ...elementProps
8276      } = componentProps;
8277      const {
8278        node: portalNode,
8279        subtree: portalSubtree
8280      } = useFloatingPortalNode({
8281        container,
8282        ref: forwardedRef,
8283        componentProps,
8284        elementProps
8285      });
8286      if (!portalSubtree && !portalNode) {
8287        return null;
8288      }
8289      return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(React34.Fragment, {
8290        children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)]
8291      });
8292    });
8293    if (true) FloatingPortalLite.displayName = "FloatingPortalLite";
8294  
8295    // node_modules/@base-ui/react/tooltip/index.parts.mjs
8296    var index_parts_exports = {};
8297    __export(index_parts_exports, {
8298      Arrow: () => TooltipArrow,
8299      Handle: () => TooltipHandle,
8300      Popup: () => TooltipPopup,
8301      Portal: () => TooltipPortal,
8302      Positioner: () => TooltipPositioner,
8303      Provider: () => TooltipProvider,
8304      Root: () => TooltipRoot,
8305      Trigger: () => TooltipTrigger,
8306      Viewport: () => TooltipViewport,
8307      createHandle: () => createTooltipHandle
8308    });
8309  
8310    // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
8311    var React37 = __toESM(require_react(), 1);
8312  
8313    // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs
8314    var React35 = __toESM(require_react(), 1);
8315    var TooltipRootContext = /* @__PURE__ */ React35.createContext(void 0);
8316    if (true) TooltipRootContext.displayName = "TooltipRootContext";
8317    function useTooltipRootContext(optional) {
8318      const context = React35.useContext(TooltipRootContext);
8319      if (context === void 0 && !optional) {
8320        throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72));
8321      }
8322      return context;
8323    }
8324  
8325    // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs
8326    var React36 = __toESM(require_react(), 1);
8327    var selectors2 = {
8328      ...popupStoreSelectors,
8329      disabled: (state) => state.disabled,
8330      instantType: (state) => state.instantType,
8331      isInstantPhase: (state) => state.isInstantPhase,
8332      trackCursorAxis: (state) => state.trackCursorAxis,
8333      disableHoverablePopup: (state) => state.disableHoverablePopup,
8334      lastOpenChangeReason: (state) => state.openChangeReason,
8335      closeOnClick: (state) => state.closeOnClick,
8336      closeDelay: (state) => state.closeDelay,
8337      adaptiveOrigin: (state) => state.adaptiveOrigin
8338    };
8339    var TooltipStore = class extends ReactStore {
8340      constructor(initialState, floatingId, nested) {
8341        const triggerElements = new PopupTriggerMap();
8342        super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors2);
8343      }
8344      setOpen = (nextOpen, eventDetails) => {
8345        applyPopupOpenChange(this, nextOpen, eventDetails, {
8346          extraState: {
8347            openChangeReason: eventDetails.reason
8348          }
8349        });
8350      };
8351      // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change.
8352      cancelPendingOpen(event) {
8353        this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event));
8354      }
8355    };
8356    function createNullTooltipStore() {
8357      const triggerElements = new PopupTriggerMap();
8358      const store2 = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors2);
8359      return Object.assign(store2, {
8360        setOpen: NOOP,
8361        cancelPendingOpen: NOOP
8362      });
8363    }
8364    function createInitialState(initialState, triggerElements, floatingId, nested = false) {
8365      const state = {
8366        ...createInitialPopupStoreState(),
8367        disabled: false,
8368        instantType: void 0,
8369        isInstantPhase: false,
8370        trackCursorAxis: "none",
8371        disableHoverablePopup: false,
8372        openChangeReason: null,
8373        closeOnClick: true,
8374        closeDelay: 0,
8375        adaptiveOrigin: void 0,
8376        ...initialState
8377      };
8378      state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);
8379      return state;
8380    }
8381    function createInitialContext(triggerElements) {
8382      return {
8383        popupRef: /* @__PURE__ */ React36.createRef(),
8384        onOpenChange: void 0,
8385        onOpenChangeComplete: void 0,
8386        triggerElements
8387      };
8388    }
8389  
8390    // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
8391    var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
8392    var TooltipRoot = fastComponent(function TooltipRoot2(props) {
8393      const {
8394        disabled: disabled2 = false,
8395        defaultOpen = false,
8396        open: openProp,
8397        disableHoverablePopup = false,
8398        trackCursorAxis = "none",
8399        actionsRef,
8400        onOpenChange,
8401        onOpenChangeComplete,
8402        handle,
8403        triggerId: triggerIdProp,
8404        defaultTriggerId: defaultTriggerIdProp = null,
8405        children
8406      } = props;
8407      const store2 = usePopupRootStore((floatingId, nested) => new TooltipStore({
8408        open: defaultOpen,
8409        openProp,
8410        activeTriggerId: defaultTriggerIdProp,
8411        triggerIdProp
8412      }, floatingId, nested));
8413      store2.useControlledProp("openProp", openProp);
8414      store2.useControlledProp("triggerIdProp", triggerIdProp);
8415      store2.useContextCallback("onOpenChange", onOpenChange);
8416      store2.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
8417      const openState = store2.useState("open");
8418      const open = !disabled2 && openState;
8419      const activeTriggerId = store2.useState("activeTriggerId");
8420      const mounted = store2.useState("mounted");
8421      const payload = store2.useState("payload");
8422      store2.useSyncedValues({
8423        trackCursorAxis,
8424        disableHoverablePopup,
8425        disabled: disabled2
8426      });
8427      useImplicitActiveTrigger(store2, {
8428        closeOnActiveTriggerUnmount: true
8429      });
8430      const {
8431        forceUnmount,
8432        transitionStatus
8433      } = useOpenStateTransitions(open, store2);
8434      const isInstantPhase = store2.useState("isInstantPhase");
8435      const instantType = store2.useState("instantType");
8436      const lastOpenChangeReason = store2.useState("lastOpenChangeReason");
8437      const previousInstantTypeRef = React37.useRef(null);
8438      useIsoLayoutEffect(() => {
8439        if (openState && disabled2) {
8440          store2.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled));
8441        }
8442      }, [openState, disabled2, store2]);
8443      useIsoLayoutEffect(() => {
8444        if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) {
8445          if (instantType !== "delay") {
8446            previousInstantTypeRef.current = instantType;
8447          }
8448          store2.set("instantType", "delay");
8449        } else if (previousInstantTypeRef.current !== null) {
8450          store2.set("instantType", previousInstantTypeRef.current);
8451          previousInstantTypeRef.current = null;
8452        }
8453      }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store2]);
8454      useIsoLayoutEffect(() => {
8455        if (open) {
8456          if (activeTriggerId == null) {
8457            store2.set("payload", void 0);
8458          }
8459        }
8460      }, [store2, activeTriggerId, open]);
8461      React37.useImperativeHandle(actionsRef, () => ({
8462        unmount: forceUnmount,
8463        close: () => store2.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction))
8464      }), [forceUnmount, store2]);
8465      const shouldRenderInteractions = open || mounted || !disabled2 && trackCursorAxis !== "none";
8466      return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(TooltipRootContext.Provider, {
8467        value: store2,
8468        children: [handle && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PopupHandleAttachment, {
8469          handle,
8470          store: store2
8471        }), shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipInteractions, {
8472          store: store2,
8473          disabled: disabled2,
8474          trackCursorAxis
8475        }), typeof children === "function" ? children({
8476          payload
8477        }) : children]
8478      });
8479    });
8480    if (true) TooltipRoot.displayName = "TooltipRoot";
8481    function TooltipInteractions({
8482      store: store2,
8483      disabled: disabled2,
8484      trackCursorAxis
8485    }) {
8486      const floatingRootContext = store2.useState("floatingRootContext");
8487      const dismiss = useDismiss(floatingRootContext, {
8488        enabled: !disabled2,
8489        referencePress: () => store2.select("closeOnClick")
8490      });
8491      const clientPoint = useClientPoint(floatingRootContext, {
8492        enabled: !disabled2 && trackCursorAxis !== "none",
8493        axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis
8494      });
8495      const triggerProps = React37.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]);
8496      usePopupInteractionProps(store2, {
8497        activeTriggerProps: triggerProps,
8498        inactiveTriggerProps: triggerProps,
8499        popupProps: dismiss.floating ?? EMPTY_OBJECT
8500      });
8501      return null;
8502    }
8503  
8504    // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
8505    var React39 = __toESM(require_react(), 1);
8506  
8507    // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs
8508    var React38 = __toESM(require_react(), 1);
8509    var TooltipProviderContext = /* @__PURE__ */ React38.createContext(void 0);
8510    if (true) TooltipProviderContext.displayName = "TooltipProviderContext";
8511    function useTooltipProviderContext() {
8512      return React38.useContext(TooltipProviderContext);
8513    }
8514  
8515    // node_modules/@base-ui/react/tooltip/utils/constants.mjs
8516    var OPEN_DELAY = 600;
8517  
8518    // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
8519    var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger";
8520    function getTargetElement(event) {
8521      if ("composedPath" in event) {
8522        const path = event.composedPath();
8523        for (let i = 0; i < path.length; i += 1) {
8524          const element = path[i];
8525          if (isElement(element)) {
8526            return element;
8527          }
8528        }
8529      }
8530      const target = event.target;
8531      if (isElement(target)) {
8532        return target;
8533      }
8534      return null;
8535    }
8536    function closestEnabledTooltipTrigger(element) {
8537      let current = element;
8538      while (current) {
8539        const trigger = current.closest(`[$TOOLTIP_TRIGGER_IDENTIFIER}]`);
8540        if (trigger) {
8541          return trigger;
8542        }
8543        const root = current.getRootNode();
8544        current = "host" in root && isElement(root.host) ? root.host : null;
8545      }
8546      return null;
8547    }
8548    var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) {
8549      const {
8550        render,
8551        className,
8552        style,
8553        handle,
8554        payload,
8555        disabled: disabledProp,
8556        delay,
8557        closeOnClick = true,
8558        closeDelay,
8559        id: idProp,
8560        ...elementProps
8561      } = componentProps;
8562      const rootContext = useTooltipRootContext(true);
8563      const handleStore = usePopupHandleStore(handle);
8564      const store2 = handleStore ?? rootContext;
8565      if (!store2) {
8566        throw new Error(true ? "Base UI: <Tooltip.Trigger> must be either used within a <Tooltip.Root> component or provided with a handle." : formatErrorMessage_default(82));
8567      }
8568      const thisTriggerId = useBaseUiId(idProp);
8569      const isTriggerActive = store2.useState("isTriggerActive", thisTriggerId);
8570      const isOpenedByThisTrigger = store2.useState("isOpenedByTrigger", thisTriggerId);
8571      const floatingRootContext = store2.useState("floatingRootContext");
8572      const triggerElementRef = React39.useRef(null);
8573      const delayWithDefault = delay ?? OPEN_DELAY;
8574      const closeDelayWithDefault = closeDelay ?? 0;
8575      const {
8576        registerTrigger,
8577        isMountedByThisTrigger
8578      } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store2, {
8579        payload,
8580        closeOnClick,
8581        closeDelay: closeDelayWithDefault
8582      });
8583      const providerDelay = useTooltipProviderContext();
8584      const {
8585        delayRef,
8586        isInstantPhase,
8587        hasProvider
8588      } = useDelayGroup(floatingRootContext, {
8589        open: isOpenedByThisTrigger
8590      });
8591      const hoverInteraction = useHoverInteractionSharedState(floatingRootContext);
8592      store2.useSyncedValue("isInstantPhase", isInstantPhase);
8593      const rootDisabled = store2.useState("disabled");
8594      const disabled2 = disabledProp ?? rootDisabled;
8595      const disabledRef = useValueAsRef(disabled2);
8596      const trackCursorAxis = store2.useState("trackCursorAxis");
8597      const disableHoverablePopup = store2.useState("disableHoverablePopup");
8598      const isNestedTriggerHoveredRef = React39.useRef(false);
8599      const nestedTriggerOpenTimeout = useTimeout();
8600      const pointerTypeRef = React39.useRef(void 0);
8601      function getOpenDelay() {
8602        if (!hasProvider) {
8603          return delayWithDefault;
8604        }
8605        return getDelay(delayRef.current, "open") === 0 ? 0 : delay ?? providerDelay ?? OPEN_DELAY;
8606      }
8607      function isEnabledNestedTriggerTarget(target) {
8608        const triggerEl = triggerElementRef.current;
8609        if (!triggerEl || !target) {
8610          return false;
8611        }
8612        const nearestTrigger = closestEnabledTooltipTrigger(target);
8613        return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger);
8614      }
8615      function detectNestedTriggerHover(target) {
8616        const nestedTriggerHovered = isEnabledNestedTriggerTarget(target);
8617        isNestedTriggerHoveredRef.current = nestedTriggerHovered;
8618        if (nestedTriggerHovered) {
8619          hoverInteraction.openChangeTimeout.clear();
8620          hoverInteraction.restTimeout.clear();
8621          hoverInteraction.restTimeoutPending = false;
8622          nestedTriggerOpenTimeout.clear();
8623        }
8624        return nestedTriggerHovered;
8625      }
8626      const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
8627        enabled: !disabled2,
8628        mouseOnly: true,
8629        move: false,
8630        handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null,
8631        restMs: getOpenDelay,
8632        delay() {
8633          if (closeDelay == null && hasProvider) {
8634            return {
8635              close: getDelay(delayRef.current, "close")
8636            };
8637          }
8638          return {
8639            close: closeDelayWithDefault
8640          };
8641        },
8642        triggerElementRef,
8643        isActiveTrigger: isTriggerActive,
8644        isClosing: () => store2.select("transitionStatus") === "ending",
8645        shouldOpen() {
8646          return !isNestedTriggerHoveredRef.current;
8647        }
8648      });
8649      const focusProps = useFocus(floatingRootContext, {
8650        enabled: !disabled2
8651      }).reference;
8652      const handleNestedTriggerHover = (event) => {
8653        const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current;
8654        const target = getTargetElement(event);
8655        const nestedTriggerHovered = detectNestedTriggerHover(target);
8656        const triggerEl = triggerElementRef.current;
8657        const targetInsideTrigger = triggerEl && target && contains(triggerEl, target);
8658        if (nestedTriggerHovered && store2.select("open") && store2.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) {
8659          store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
8660          return;
8661        }
8662        if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store2.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences.
8663        isMouseLikePointerType(pointerTypeRef.current)) {
8664          const open = () => {
8665            if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store2.select("open")) {
8666              store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl));
8667            }
8668          };
8669          const openDelay = getOpenDelay();
8670          if (openDelay === 0) {
8671            nestedTriggerOpenTimeout.clear();
8672            open();
8673          } else {
8674            nestedTriggerOpenTimeout.start(openDelay, open);
8675          }
8676        }
8677      };
8678      const rootTriggerProps = store2.useState("triggerProps", isMountedByThisTrigger);
8679      const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none";
8680      const state = {
8681        open: isOpenedByThisTrigger
8682      };
8683      const element = useRenderElement("button", componentProps, {
8684        state,
8685        ref: [forwardedRef, registerTrigger, triggerElementRef],
8686        props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, {
8687          onMouseOver(event) {
8688            handleNestedTriggerHover(event.nativeEvent);
8689          },
8690          onFocus(event) {
8691            if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) {
8692              event.preventBaseUIHandler();
8693            }
8694          },
8695          onMouseLeave() {
8696            isNestedTriggerHoveredRef.current = false;
8697            nestedTriggerOpenTimeout.clear();
8698            pointerTypeRef.current = void 0;
8699          },
8700          onPointerEnter(event) {
8701            pointerTypeRef.current = event.pointerType;
8702          },
8703          onPointerDown(event) {
8704            pointerTypeRef.current = event.pointerType;
8705            store2.set("closeOnClick", closeOnClick);
8706            if (closeOnClick && !store2.select("open")) {
8707              store2.cancelPendingOpen(event.nativeEvent);
8708            }
8709          },
8710          onClick(event) {
8711            if (closeOnClick && !store2.select("open")) {
8712              store2.cancelPendingOpen(event.nativeEvent);
8713            }
8714          },
8715          id: thisTriggerId,
8716          "data-trigger-disabled": disabled2 ? "" : void 0,
8717          [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : ""
8718        }, elementProps],
8719        stateAttributesMapping: triggerOpenStateMapping
8720      });
8721      return element;
8722    });
8723    if (true) TooltipTrigger.displayName = "TooltipTrigger";
8724  
8725    // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
8726    var React41 = __toESM(require_react(), 1);
8727  
8728    // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs
8729    var React40 = __toESM(require_react(), 1);
8730    var TooltipPortalContext = /* @__PURE__ */ React40.createContext(void 0);
8731    if (true) TooltipPortalContext.displayName = "TooltipPortalContext";
8732    function useTooltipPortalContext() {
8733      const value = React40.useContext(TooltipPortalContext);
8734      if (value === void 0) {
8735        throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70));
8736      }
8737      return value;
8738    }
8739  
8740    // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
8741    var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
8742    var TooltipPortal = /* @__PURE__ */ React41.forwardRef(function TooltipPortal2(props, forwardedRef) {
8743      const {
8744        keepMounted = false,
8745        ...portalProps
8746      } = props;
8747      const store2 = useTooltipRootContext();
8748      const mounted = store2.useState("mounted");
8749      const shouldRender = mounted || keepMounted;
8750      if (!shouldRender) {
8751        return null;
8752      }
8753      return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPortalContext.Provider, {
8754        value: keepMounted,
8755        children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FloatingPortalLite, {
8756          ref: forwardedRef,
8757          ...portalProps
8758        })
8759      });
8760    });
8761    if (true) TooltipPortal.displayName = "TooltipPortal";
8762  
8763    // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
8764    var React43 = __toESM(require_react(), 1);
8765  
8766    // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs
8767    var React42 = __toESM(require_react(), 1);
8768    var TooltipPositionerContext = /* @__PURE__ */ React42.createContext(void 0);
8769    if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext";
8770    function useTooltipPositionerContext() {
8771      const context = React42.useContext(TooltipPositionerContext);
8772      if (context === void 0) {
8773        throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71));
8774      }
8775      return context;
8776    }
8777  
8778    // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
8779    var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
8780    var TooltipPositioner = /* @__PURE__ */ React43.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) {
8781      const {
8782        render,
8783        className,
8784        anchor,
8785        positionMethod = "absolute",
8786        side = "top",
8787        align = "center",
8788        sideOffset = 0,
8789        alignOffset = 0,
8790        collisionBoundary = "clipping-ancestors",
8791        collisionPadding = 5,
8792        arrowPadding = 5,
8793        sticky = false,
8794        disableAnchorTracking = false,
8795        collisionAvoidance = POPUP_COLLISION_AVOIDANCE,
8796        style,
8797        ...elementProps
8798      } = componentProps;
8799      const store2 = useTooltipRootContext();
8800      const keepMounted = useTooltipPortalContext();
8801      const open = store2.useState("open");
8802      const mounted = store2.useState("mounted");
8803      const trackCursorAxis = store2.useState("trackCursorAxis");
8804      const disableHoverablePopup = store2.useState("disableHoverablePopup");
8805      const floatingRootContext = store2.useState("floatingRootContext");
8806      const instantType = store2.useState("instantType");
8807      const transitionStatus = store2.useState("transitionStatus");
8808      const adaptiveOrigin2 = store2.useState("adaptiveOrigin");
8809      const positioning = useAnchorPositioning({
8810        anchor,
8811        positionMethod,
8812        floatingRootContext,
8813        mounted,
8814        side,
8815        sideOffset,
8816        align,
8817        alignOffset,
8818        collisionBoundary,
8819        collisionPadding,
8820        sticky,
8821        arrowPadding,
8822        disableAnchorTracking,
8823        keepMounted,
8824        collisionAvoidance,
8825        adaptiveOrigin: adaptiveOrigin2
8826      });
8827      const state = React43.useMemo(() => ({
8828        open,
8829        side: positioning.side,
8830        align: positioning.align,
8831        anchorHidden: positioning.anchorHidden,
8832        instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType
8833      }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]);
8834      const element = usePositioner(componentProps, state, {
8835        styles: positioning.positionerStyles,
8836        transitionStatus,
8837        props: elementProps,
8838        refs: [forwardedRef, store2.useStateSetter("positionerElement")],
8839        hidden: !mounted,
8840        inert: !open || trackCursorAxis === "both" || disableHoverablePopup
8841      });
8842      return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipPositionerContext.Provider, {
8843        value: positioning,
8844        children: element
8845      });
8846    });
8847    if (true) TooltipPositioner.displayName = "TooltipPositioner";
8848  
8849    // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs
8850    var React44 = __toESM(require_react(), 1);
8851    var TooltipPopup = /* @__PURE__ */ React44.forwardRef(function TooltipPopup2(componentProps, forwardedRef) {
8852      const {
8853        render,
8854        className,
8855        style,
8856        ...elementProps
8857      } = componentProps;
8858      const store2 = useTooltipRootContext();
8859      const {
8860        side,
8861        align
8862      } = useTooltipPositionerContext();
8863      const open = store2.useState("open");
8864      const instantType = store2.useState("instantType");
8865      const transitionStatus = store2.useState("transitionStatus");
8866      const popupProps = store2.useState("popupProps");
8867      const floatingContext = store2.useState("floatingRootContext");
8868      const disabled2 = store2.useState("disabled");
8869      const closeDelay = store2.useState("closeDelay");
8870      useOpenChangeComplete({
8871        open,
8872        ref: store2.context.popupRef,
8873        onComplete() {
8874          if (open) {
8875            store2.context.onOpenChangeComplete?.(true);
8876          }
8877        }
8878      });
8879      useHoverFloatingInteraction(floatingContext, {
8880        enabled: !disabled2,
8881        closeDelay
8882      });
8883      const setPopupElement = store2.useStateSetter("popupElement");
8884      const state = {
8885        open,
8886        side,
8887        align,
8888        instant: instantType,
8889        transitionStatus
8890      };
8891      const element = useRenderElement("div", componentProps, {
8892        state,
8893        ref: [forwardedRef, store2.context.popupRef, setPopupElement],
8894        props: [FOCUSABLE_POPUP_PROPS, popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps],
8895        stateAttributesMapping: popupTransitionStateMapping
8896      });
8897      return element;
8898    });
8899    if (true) TooltipPopup.displayName = "TooltipPopup";
8900  
8901    // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs
8902    var React45 = __toESM(require_react(), 1);
8903    var TooltipArrow = /* @__PURE__ */ React45.forwardRef(function TooltipArrow2(componentProps, forwardedRef) {
8904      const {
8905        render,
8906        className,
8907        style,
8908        ...elementProps
8909      } = componentProps;
8910      const store2 = useTooltipRootContext();
8911      const {
8912        arrowRef,
8913        side,
8914        align,
8915        arrowUncentered,
8916        arrowStyles
8917      } = useTooltipPositionerContext();
8918      const open = store2.useState("open");
8919      const instantType = store2.useState("instantType");
8920      const state = {
8921        open,
8922        side,
8923        align,
8924        uncentered: arrowUncentered,
8925        instant: instantType
8926      };
8927      const element = useRenderElement("div", componentProps, {
8928        state,
8929        ref: [forwardedRef, arrowRef],
8930        props: [{
8931          style: arrowStyles,
8932          "aria-hidden": true
8933        }, elementProps],
8934        stateAttributesMapping: popupStateMapping
8935      });
8936      return element;
8937    });
8938    if (true) TooltipArrow.displayName = "TooltipArrow";
8939  
8940    // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs
8941    var React46 = __toESM(require_react(), 1);
8942    var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
8943    var TooltipProvider = function TooltipProvider2(props) {
8944      const {
8945        delay,
8946        closeDelay,
8947        timeout = 400
8948      } = props;
8949      const delayValue = React46.useMemo(() => ({
8950        open: delay,
8951        close: closeDelay
8952      }), [delay, closeDelay]);
8953      return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipProviderContext.Provider, {
8954        value: delay,
8955        children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FloatingDelayGroup, {
8956          delay: delayValue,
8957          timeoutMs: timeout,
8958          children: props.children
8959        })
8960      });
8961    };
8962    if (true) TooltipProvider.displayName = "TooltipProvider";
8963  
8964    // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs
8965    var React47 = __toESM(require_react(), 1);
8966    var TooltipViewport = /* @__PURE__ */ React47.forwardRef(function TooltipViewport2(componentProps, forwardedRef) {
8967      const {
8968        render,
8969        className,
8970        style,
8971        children,
8972        ...elementProps
8973      } = componentProps;
8974      const store2 = useTooltipRootContext();
8975      const positioner = useTooltipPositionerContext();
8976      const instantType = store2.useState("instantType");
8977      const {
8978        children: childrenToRender,
8979        state: viewportState
8980      } = usePopupViewport({
8981        store: store2,
8982        side: positioner.side,
8983        children
8984      });
8985      const state = {
8986        activationDirection: viewportState.activationDirection,
8987        transitioning: viewportState.transitioning,
8988        instant: instantType
8989      };
8990      return useRenderElement("div", componentProps, {
8991        state,
8992        ref: forwardedRef,
8993        props: [elementProps, {
8994          children: childrenToRender
8995        }],
8996        stateAttributesMapping: popupViewportStateMapping
8997      });
8998    });
8999    if (true) TooltipViewport.displayName = "TooltipViewport";
9000  
9001    // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs
9002    var TooltipHandle = class extends BasePopupHandle {
9003      constructor() {
9004        super(createNullTooltipStore(), "Tooltip");
9005      }
9006      /**
9007       * Opens the tooltip and associates it with the trigger with the given id.
9008       *
9009       * This method should only be called in an event handler or an effect (not during rendering).
9010       *
9011       * @param triggerId ID of the trigger to associate with the tooltip. The trigger must be a matching
9012       * `Tooltip.Trigger` with this handle passed as a prop.
9013       */
9014      open(triggerId) {
9015        this.openByTrigger(triggerId);
9016      }
9017      /**
9018       * Closes the tooltip.
9019       *
9020       * This method should only be called in an event handler or an effect (not during rendering).
9021       */
9022      close() {
9023        this.closePopup();
9024      }
9025      /**
9026       * Whether the tooltip is currently open. Returns `false` while no root is attached to the handle.
9027       */
9028      get isOpen() {
9029        return this.attachedStore?.select("open") ?? false;
9030      }
9031    };
9032    function createTooltipHandle() {
9033      return new TooltipHandle();
9034    }
9035  
9036    // node_modules/@base-ui/react/use-render/useRender.mjs
9037    function useRender(params) {
9038      return useRenderElement(params.defaultTagName ?? "div", params, params);
9039    }
9040  
9041    // packages/ui/build-module/tooltip/index.mjs
9042    var tooltip_exports = {};
9043    __export(tooltip_exports, {
9044      Popup: () => Popup,
9045      Portal: () => Portal,
9046      Positioner: () => Positioner,
9047      Provider: () => Provider,
9048      Root: () => Root,
9049      Trigger: () => Trigger
9050    });
9051  
9052    // packages/ui/build-module/tooltip/popup.mjs
9053    var import_element14 = __toESM(require_element(), 1);
9054  
9055    // packages/ui/build-module/tooltip/portal.mjs
9056    var import_element11 = __toESM(require_element(), 1);
9057  
9058    // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs
9059    var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
9060    function getRuntime() {
9061      const globalScope = globalThis;
9062      if (globalScope.__wpStyleRuntime) {
9063        return globalScope.__wpStyleRuntime;
9064      }
9065      globalScope.__wpStyleRuntime = {
9066        documents: /* @__PURE__ */ new Map(),
9067        styles: /* @__PURE__ */ new Map(),
9068        injectedStyles: /* @__PURE__ */ new WeakMap()
9069      };
9070      if (typeof document !== "undefined") {
9071        registerDocument(document);
9072      }
9073      return globalScope.__wpStyleRuntime;
9074    }
9075    function documentContainsStyleHash(targetDocument, hash) {
9076      if (!targetDocument.head) {
9077        return false;
9078      }
9079      for (const style of targetDocument.head.querySelectorAll(
9080        `style[$STYLE_HASH_ATTRIBUTE}]`
9081      )) {
9082        if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
9083          return true;
9084        }
9085      }
9086      return false;
9087    }
9088    function injectStyle(targetDocument, hash, css) {
9089      if (!targetDocument.head) {
9090        return;
9091      }
9092      const runtime = getRuntime();
9093      let injectedStyles = runtime.injectedStyles.get(targetDocument);
9094      if (!injectedStyles) {
9095        injectedStyles = /* @__PURE__ */ new Set();
9096        runtime.injectedStyles.set(targetDocument, injectedStyles);
9097      }
9098      if (injectedStyles.has(hash)) {
9099        return;
9100      }
9101      if (documentContainsStyleHash(targetDocument, hash)) {
9102        injectedStyles.add(hash);
9103        return;
9104      }
9105      const style = targetDocument.createElement("style");
9106      style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
9107      style.appendChild(targetDocument.createTextNode(css));
9108      targetDocument.head.appendChild(style);
9109      injectedStyles.add(hash);
9110    }
9111    function registerDocument(targetDocument) {
9112      const runtime = getRuntime();
9113      runtime.documents.set(
9114        targetDocument,
9115        (runtime.documents.get(targetDocument) ?? 0) + 1
9116      );
9117      for (const [hash, css] of runtime.styles) {
9118        injectStyle(targetDocument, hash, css);
9119      }
9120      return () => {
9121        const count = runtime.documents.get(targetDocument);
9122        if (count === void 0) {
9123          return;
9124        }
9125        if (count <= 1) {
9126          runtime.documents.delete(targetDocument);
9127          return;
9128        }
9129        runtime.documents.set(targetDocument, count - 1);
9130      };
9131    }
9132    function registerStyle(hash, css) {
9133      const runtime = getRuntime();
9134      runtime.styles.set(hash, css);
9135      for (const targetDocument of runtime.documents.keys()) {
9136        injectStyle(targetDocument, hash, css);
9137      }
9138    }
9139    if (typeof process === "undefined" || true) {
9140      registerStyle("be37f31c1e", "._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}}");
9141    }
9142    var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" };
9143    var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot";
9144    function resolveOwnerDocument() {
9145      return typeof document === "undefined" ? null : document;
9146    }
9147    function isInWordPressEnvironment() {
9148      let topWp;
9149      try {
9150        topWp = window.top?.wp;
9151      } catch {
9152      }
9153      const wp = topWp ?? window.wp;
9154      return typeof wp?.components === "object" && wp.components !== null;
9155    }
9156    var cachedSlot = null;
9157    function ensureSlotIsAccessible(element) {
9158      element.setAttribute("aria-hidden", "false");
9159      return element;
9160    }
9161    function createSlot(ownerDocument2) {
9162      const element = ownerDocument2.createElement("div");
9163      element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, "");
9164      if (wp_compat_overlay_slot_default.slot) {
9165        element.classList.add(wp_compat_overlay_slot_default.slot);
9166      }
9167      ownerDocument2.body.appendChild(element);
9168      return element;
9169    }
9170    function getWpCompatOverlaySlot() {
9171      if (typeof window === "undefined") {
9172        return void 0;
9173      }
9174      if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) {
9175        return void 0;
9176      }
9177      const ownerDocument2 = resolveOwnerDocument();
9178      if (!ownerDocument2 || !ownerDocument2.body) {
9179        return void 0;
9180      }
9181      if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) {
9182        return ensureSlotIsAccessible(cachedSlot);
9183      }
9184      const existing = ownerDocument2.querySelector(
9185        `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]`
9186      );
9187      if (existing instanceof HTMLDivElement) {
9188        cachedSlot = ensureSlotIsAccessible(existing);
9189        return cachedSlot;
9190      }
9191      if (cachedSlot?.isConnected) {
9192        cachedSlot.remove();
9193      }
9194      cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2));
9195      return cachedSlot;
9196    }
9197  
9198    // packages/ui/build-module/tooltip/portal.mjs
9199    var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
9200    var Portal = (0, import_element11.forwardRef)(
9201      function TooltipPortal3({ container, ...restProps }, ref) {
9202        return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9203          index_parts_exports.Portal,
9204          {
9205            container: container ?? getWpCompatOverlaySlot(),
9206            ...restProps,
9207            ref
9208          }
9209        );
9210      }
9211    );
9212  
9213    // packages/ui/build-module/tooltip/positioner.mjs
9214    var import_element12 = __toESM(require_element(), 1);
9215    var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
9216    var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
9217    function getRuntime2() {
9218      const globalScope = globalThis;
9219      if (globalScope.__wpStyleRuntime) {
9220        return globalScope.__wpStyleRuntime;
9221      }
9222      globalScope.__wpStyleRuntime = {
9223        documents: /* @__PURE__ */ new Map(),
9224        styles: /* @__PURE__ */ new Map(),
9225        injectedStyles: /* @__PURE__ */ new WeakMap()
9226      };
9227      if (typeof document !== "undefined") {
9228        registerDocument2(document);
9229      }
9230      return globalScope.__wpStyleRuntime;
9231    }
9232    function documentContainsStyleHash2(targetDocument, hash) {
9233      if (!targetDocument.head) {
9234        return false;
9235      }
9236      for (const style of targetDocument.head.querySelectorAll(
9237        `style[$STYLE_HASH_ATTRIBUTE2}]`
9238      )) {
9239        if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
9240          return true;
9241        }
9242      }
9243      return false;
9244    }
9245    function injectStyle2(targetDocument, hash, css) {
9246      if (!targetDocument.head) {
9247        return;
9248      }
9249      const runtime = getRuntime2();
9250      let injectedStyles = runtime.injectedStyles.get(targetDocument);
9251      if (!injectedStyles) {
9252        injectedStyles = /* @__PURE__ */ new Set();
9253        runtime.injectedStyles.set(targetDocument, injectedStyles);
9254      }
9255      if (injectedStyles.has(hash)) {
9256        return;
9257      }
9258      if (documentContainsStyleHash2(targetDocument, hash)) {
9259        injectedStyles.add(hash);
9260        return;
9261      }
9262      const style = targetDocument.createElement("style");
9263      style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
9264      style.appendChild(targetDocument.createTextNode(css));
9265      targetDocument.head.appendChild(style);
9266      injectedStyles.add(hash);
9267    }
9268    function registerDocument2(targetDocument) {
9269      const runtime = getRuntime2();
9270      runtime.documents.set(
9271        targetDocument,
9272        (runtime.documents.get(targetDocument) ?? 0) + 1
9273      );
9274      for (const [hash, css] of runtime.styles) {
9275        injectStyle2(targetDocument, hash, css);
9276      }
9277      return () => {
9278        const count = runtime.documents.get(targetDocument);
9279        if (count === void 0) {
9280          return;
9281        }
9282        if (count <= 1) {
9283          runtime.documents.delete(targetDocument);
9284          return;
9285        }
9286        runtime.documents.set(targetDocument, count - 1);
9287      };
9288    }
9289    function registerStyle2(hash, css) {
9290      const runtime = getRuntime2();
9291      runtime.styles.set(hash, css);
9292      for (const targetDocument of runtime.documents.keys()) {
9293        injectStyle2(targetDocument, hash, css);
9294      }
9295    }
9296    if (typeof process === "undefined" || true) {
9297      registerStyle2("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
9298    }
9299    var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
9300    if (typeof process === "undefined" || true) {
9301      registerStyle2("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}');
9302    }
9303    var style_default = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
9304    var Positioner = (0, import_element12.forwardRef)(
9305      function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) {
9306        return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9307          index_parts_exports.Positioner,
9308          {
9309            ref,
9310            align,
9311            side,
9312            sideOffset,
9313            ...props,
9314            className: clsx_default(
9315              resets_default["box-sizing"],
9316              style_default.positioner,
9317              className
9318            )
9319          }
9320        );
9321      }
9322    );
9323  
9324    // packages/ui/build-module/utils/render-slot-with-children.mjs
9325    var import_element13 = __toESM(require_element(), 1);
9326    function renderSlotWithChildren(slot, defaultSlot, children) {
9327      return (0, import_element13.cloneElement)(slot ?? defaultSlot, { children });
9328    }
9329  
9330    // packages/ui/build-module/utils/theme-provider.mjs
9331    var theme = __toESM(require_theme(), 1);
9332  
9333    // packages/ui/build-module/lock-unlock.mjs
9334    var import_private_apis = __toESM(require_private_apis(), 1);
9335    var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
9336      "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
9337      "@wordpress/ui"
9338    );
9339  
9340    // packages/ui/build-module/utils/theme-provider.mjs
9341    function getThemeProvider() {
9342      const themePackage = theme;
9343      if (themePackage.ThemeProvider) {
9344        return themePackage.ThemeProvider;
9345      }
9346      if (!themePackage.privateApis) {
9347        throw new Error(
9348          "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`."
9349        );
9350      }
9351      return unlock(
9352        themePackage.privateApis
9353      ).ThemeProvider;
9354    }
9355    var ThemeProvider = getThemeProvider();
9356  
9357    // packages/ui/build-module/tooltip/popup.mjs
9358    var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
9359    var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash";
9360    function getRuntime3() {
9361      const globalScope = globalThis;
9362      if (globalScope.__wpStyleRuntime) {
9363        return globalScope.__wpStyleRuntime;
9364      }
9365      globalScope.__wpStyleRuntime = {
9366        documents: /* @__PURE__ */ new Map(),
9367        styles: /* @__PURE__ */ new Map(),
9368        injectedStyles: /* @__PURE__ */ new WeakMap()
9369      };
9370      if (typeof document !== "undefined") {
9371        registerDocument3(document);
9372      }
9373      return globalScope.__wpStyleRuntime;
9374    }
9375    function documentContainsStyleHash3(targetDocument, hash) {
9376      if (!targetDocument.head) {
9377        return false;
9378      }
9379      for (const style of targetDocument.head.querySelectorAll(
9380        `style[$STYLE_HASH_ATTRIBUTE3}]`
9381      )) {
9382        if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) {
9383          return true;
9384        }
9385      }
9386      return false;
9387    }
9388    function injectStyle3(targetDocument, hash, css) {
9389      if (!targetDocument.head) {
9390        return;
9391      }
9392      const runtime = getRuntime3();
9393      let injectedStyles = runtime.injectedStyles.get(targetDocument);
9394      if (!injectedStyles) {
9395        injectedStyles = /* @__PURE__ */ new Set();
9396        runtime.injectedStyles.set(targetDocument, injectedStyles);
9397      }
9398      if (injectedStyles.has(hash)) {
9399        return;
9400      }
9401      if (documentContainsStyleHash3(targetDocument, hash)) {
9402        injectedStyles.add(hash);
9403        return;
9404      }
9405      const style = targetDocument.createElement("style");
9406      style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash);
9407      style.appendChild(targetDocument.createTextNode(css));
9408      targetDocument.head.appendChild(style);
9409      injectedStyles.add(hash);
9410    }
9411    function registerDocument3(targetDocument) {
9412      const runtime = getRuntime3();
9413      runtime.documents.set(
9414        targetDocument,
9415        (runtime.documents.get(targetDocument) ?? 0) + 1
9416      );
9417      for (const [hash, css] of runtime.styles) {
9418        injectStyle3(targetDocument, hash, css);
9419      }
9420      return () => {
9421        const count = runtime.documents.get(targetDocument);
9422        if (count === void 0) {
9423          return;
9424        }
9425        if (count <= 1) {
9426          runtime.documents.delete(targetDocument);
9427          return;
9428        }
9429        runtime.documents.set(targetDocument, count - 1);
9430      };
9431    }
9432    function registerStyle3(hash, css) {
9433      const runtime = getRuntime3();
9434      runtime.styles.set(hash, css);
9435      for (const targetDocument of runtime.documents.keys()) {
9436        injectStyle3(targetDocument, hash, css);
9437      }
9438    }
9439    if (typeof process === "undefined" || true) {
9440      registerStyle3("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}');
9441    }
9442    var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
9443    var POPUP_COLOR = { background: "#1e1e1e" };
9444    var Popup = (0, import_element14.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) {
9445      const popupContent = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
9446        index_parts_exports.Popup,
9447        {
9448          ref,
9449          className: clsx_default(style_default2.popup, className),
9450          ...props,
9451          children
9452        }
9453      ) });
9454      const positionedPopup = renderSlotWithChildren(
9455        positioner,
9456        /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Positioner, {}),
9457        popupContent
9458      );
9459      return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Portal, {}), positionedPopup);
9460    });
9461  
9462    // packages/ui/build-module/tooltip/trigger.mjs
9463    var import_element15 = __toESM(require_element(), 1);
9464    var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
9465    var Trigger = (0, import_element15.forwardRef)(
9466      function TooltipTrigger3(props, ref) {
9467        return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(index_parts_exports.Trigger, { ref, ...props });
9468      }
9469    );
9470  
9471    // packages/ui/build-module/utils/direction-provider.mjs
9472    var import_i18n2 = __toESM(require_i18n(), 1);
9473    var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
9474    function DirectionProvider3({ children }) {
9475      return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DirectionProvider, { direction: (0, import_i18n2.isRTL)() ? "rtl" : "ltr", children });
9476    }
9477  
9478    // packages/ui/build-module/tooltip/root.mjs
9479    var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
9480    function Root(props) {
9481      return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(index_parts_exports.Root, { ...props }) });
9482    }
9483  
9484    // packages/ui/build-module/tooltip/provider.mjs
9485    var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
9486    function Provider({ ...props }) {
9487      return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(index_parts_exports.Provider, { ...props });
9488    }
9489  
9490    // packages/icons/build-module/icon/index.mjs
9491    var import_element16 = __toESM(require_element(), 1);
9492    var icon_default = (0, import_element16.forwardRef)(
9493      ({ icon, size: size4 = 24, style, ...props }, ref) => {
9494        const intrinsicStyle = icon.props.style;
9495        const mergedStyle = intrinsicStyle || style ? { ...intrinsicStyle, ...style } : void 0;
9496        return (0, import_element16.cloneElement)(icon, {
9497          width: size4,
9498          height: size4,
9499          ...props,
9500          // Merge styles so the icon's intrinsic style (e.g. `fill: none` on
9501          // stroke-based icons) is preserved unless the consumer overrides
9502          // the same property explicitly.
9503          ...mergedStyle ? { style: mergedStyle } : {},
9504          ref
9505        });
9506      }
9507    );
9508  
9509    // packages/icons/build-module/library/star-empty.mjs
9510    var import_primitives = __toESM(require_primitives(), 1);
9511    var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
9512    var star_empty_default = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives.Path, { d: "M12 5.71576L13.6106 8.97924C13.7563 9.27438 14.0379 9.47895 14.3636 9.52628L17.965 10.0496L15.359 12.5899C15.1233 12.8196 15.0157 13.1506 15.0714 13.475L15.6866 17.0619L12.4653 15.3684C12.174 15.2152 11.826 15.2152 11.5347 15.3684L8.31341 17.0619L8.92861 13.475C8.98425 13.1506 8.8767 12.8196 8.64102 12.5899L6.03497 10.0496L9.63644 9.52628C9.96215 9.47895 10.2437 9.27438 10.3894 8.97924L12 5.71576Z", vectorEffect: "non-scaling-stroke" }) });
9513  
9514    // packages/icons/build-module/library/star-filled.mjs
9515    var import_primitives2 = __toESM(require_primitives(), 1);
9516    var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
9517    var star_filled_default = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives2.Path, { d: "M12 5.71576L13.6106 8.97924C13.7563 9.27438 14.0379 9.47895 14.3636 9.52628L17.965 10.0496L15.359 12.5899C15.1233 12.8196 15.0157 13.1506 15.0714 13.475L15.6866 17.0619L12.4653 15.3684C12.174 15.2152 11.826 15.2152 11.5347 15.3684L8.31341 17.0619L8.92861 13.475C8.98425 13.1506 8.8767 12.8196 8.64102 12.5899L6.03497 10.0496L9.63644 9.52628C9.96215 9.47895 10.2437 9.27438 10.3894 8.97924L12 5.71576Z", fill: "currentColor", vectorEffect: "non-scaling-stroke" }) });
9518  
9519    // packages/icons/build-module/library/star-half.mjs
9520    var import_primitives3 = __toESM(require_primitives(), 1);
9521    var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
9522    var star_half_default = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
9523      /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives3.Path, { d: "M12 5.71576L13.6106 8.97924C13.7563 9.27438 14.0379 9.47895 14.3636 9.52628L17.965 10.0496L15.359 12.5899C15.1233 12.8196 15.0157 13.1506 15.0714 13.475L15.6866 17.0619L12.4653 15.3684C12.174 15.2152 11.826 15.2152 11.5347 15.3684L8.31341 17.0619L8.92861 13.475C8.98425 13.1506 8.8767 12.8196 8.64102 12.5899L6.03497 10.0496L9.63644 9.52628C9.96215 9.47895 10.2437 9.27438 10.3894 8.97924L12 5.71576Z", vectorEffect: "non-scaling-stroke" }),
9524      /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives3.Path, { d: "M11.4653 15.4048C11.7941 15.232 12 14.8912 12 14.5197V5.71576L10.3894 8.97924C10.2437 9.27438 9.96215 9.47895 9.63644 9.52628L6.03497 10.0496L8.64102 12.5899C8.8767 12.8196 8.98425 13.1506 8.92861 13.475L8.31341 17.0619L11.4653 15.4048Z", fill: "currentColor", stroke: "none" })
9525    ] });
9526  
9527    // packages/ui/build-module/visually-hidden/visually-hidden.mjs
9528    var import_element17 = __toESM(require_element(), 1);
9529    var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash";
9530    function getRuntime4() {
9531      const globalScope = globalThis;
9532      if (globalScope.__wpStyleRuntime) {
9533        return globalScope.__wpStyleRuntime;
9534      }
9535      globalScope.__wpStyleRuntime = {
9536        documents: /* @__PURE__ */ new Map(),
9537        styles: /* @__PURE__ */ new Map(),
9538        injectedStyles: /* @__PURE__ */ new WeakMap()
9539      };
9540      if (typeof document !== "undefined") {
9541        registerDocument4(document);
9542      }
9543      return globalScope.__wpStyleRuntime;
9544    }
9545    function documentContainsStyleHash4(targetDocument, hash) {
9546      if (!targetDocument.head) {
9547        return false;
9548      }
9549      for (const style of targetDocument.head.querySelectorAll(
9550        `style[$STYLE_HASH_ATTRIBUTE4}]`
9551      )) {
9552        if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) {
9553          return true;
9554        }
9555      }
9556      return false;
9557    }
9558    function injectStyle4(targetDocument, hash, css) {
9559      if (!targetDocument.head) {
9560        return;
9561      }
9562      const runtime = getRuntime4();
9563      let injectedStyles = runtime.injectedStyles.get(targetDocument);
9564      if (!injectedStyles) {
9565        injectedStyles = /* @__PURE__ */ new Set();
9566        runtime.injectedStyles.set(targetDocument, injectedStyles);
9567      }
9568      if (injectedStyles.has(hash)) {
9569        return;
9570      }
9571      if (documentContainsStyleHash4(targetDocument, hash)) {
9572        injectedStyles.add(hash);
9573        return;
9574      }
9575      const style = targetDocument.createElement("style");
9576      style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash);
9577      style.appendChild(targetDocument.createTextNode(css));
9578      targetDocument.head.appendChild(style);
9579      injectedStyles.add(hash);
9580    }
9581    function registerDocument4(targetDocument) {
9582      const runtime = getRuntime4();
9583      runtime.documents.set(
9584        targetDocument,
9585        (runtime.documents.get(targetDocument) ?? 0) + 1
9586      );
9587      for (const [hash, css] of runtime.styles) {
9588        injectStyle4(targetDocument, hash, css);
9589      }
9590      return () => {
9591        const count = runtime.documents.get(targetDocument);
9592        if (count === void 0) {
9593          return;
9594        }
9595        if (count <= 1) {
9596          runtime.documents.delete(targetDocument);
9597          return;
9598        }
9599        runtime.documents.set(targetDocument, count - 1);
9600      };
9601    }
9602    function registerStyle4(hash, css) {
9603      const runtime = getRuntime4();
9604      runtime.styles.set(hash, css);
9605      for (const targetDocument of runtime.documents.keys()) {
9606        injectStyle4(targetDocument, hash, css);
9607      }
9608    }
9609    if (typeof process === "undefined" || true) {
9610      registerStyle4("fa606a57ae", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}}");
9611    }
9612    var style_default3 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" };
9613    var VisuallyHidden = (0, import_element17.forwardRef)(
9614      function VisuallyHidden2({ render, ...restProps }, ref) {
9615        const element = useRender({
9616          render,
9617          ref,
9618          props: mergeProps(
9619            { className: style_default3["visually-hidden"] },
9620            restProps,
9621            {
9622              // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it.
9623              "data-visually-hidden": ""
9624            }
9625          )
9626        });
9627        return element;
9628      }
9629    );
9630  
9631    // packages/block-directory/build-module/components/block-ratings/stars.mjs
9632    var import_i18n3 = __toESM(require_i18n(), 1);
9633    var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
9634    function Stars({ rating }) {
9635      const stars = Math.round(rating / 0.5) * 0.5;
9636      const fullStarCount = Math.floor(rating);
9637      const halfStarCount = Math.ceil(rating - fullStarCount);
9638      const emptyStarCount = 5 - (fullStarCount + halfStarCount);
9639      return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
9640        "span",
9641        {
9642          "aria-label": (0, import_i18n3.sprintf)(
9643            /* translators: %s: number of stars. */
9644            (0, import_i18n3.__)("%s out of 5 stars"),
9645            stars
9646          ),
9647          children: [
9648            Array.from({ length: fullStarCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
9649              icon_default,
9650              {
9651                className: "block-directory-block-ratings__star-full",
9652                icon: star_filled_default,
9653                size: 16
9654              },
9655              `full_stars_$i}`
9656            )),
9657            Array.from({ length: halfStarCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
9658              icon_default,
9659              {
9660                className: "block-directory-block-ratings__star-half-full",
9661                icon: star_half_default,
9662                size: 16
9663              },
9664              `half_stars_$i}`
9665            )),
9666            Array.from({ length: emptyStarCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
9667              icon_default,
9668              {
9669                className: "block-directory-block-ratings__star-empty",
9670                icon: star_empty_default,
9671                size: 16
9672              },
9673              `empty_stars_$i}`
9674            ))
9675          ]
9676        }
9677      );
9678    }
9679    var stars_default = Stars;
9680  
9681    // packages/block-directory/build-module/components/block-ratings/index.mjs
9682    var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
9683    var BlockRatings = ({ rating }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "block-directory-block-ratings", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(stars_default, { rating }) });
9684    var block_ratings_default = BlockRatings;
9685  
9686    // packages/block-directory/build-module/components/downloadable-block-icon/index.mjs
9687    var import_block_editor2 = __toESM(require_block_editor(), 1);
9688    var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
9689    function DownloadableBlockIcon({ icon }) {
9690      const className = "block-directory-downloadable-block-icon";
9691      return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { className, src: icon, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_block_editor2.BlockIcon, { className, icon, showColors: true });
9692    }
9693    var downloadable_block_icon_default = DownloadableBlockIcon;
9694  
9695    // packages/block-directory/build-module/components/downloadable-block-notice/index.mjs
9696    var import_i18n4 = __toESM(require_i18n(), 1);
9697    var import_data5 = __toESM(require_data(), 1);
9698    var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
9699    var DownloadableBlockNotice = ({ block }) => {
9700      const errorNotice = (0, import_data5.useSelect)(
9701        (select) => select(store).getErrorNoticeForBlock(block.id),
9702        [block]
9703      );
9704      if (!errorNotice) {
9705        return null;
9706      }
9707      return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "block-directory-downloadable-block-notice", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "block-directory-downloadable-block-notice__content", children: [
9708        errorNotice.message,
9709        errorNotice.isFatal ? " " + (0, import_i18n4.__)("Try reloading the page.") : null
9710      ] }) });
9711    };
9712    var downloadable_block_notice_default = DownloadableBlockNotice;
9713  
9714    // packages/block-directory/build-module/components/downloadable-block-list-item/index.mjs
9715    var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
9716    function getDownloadableBlockLabel({ title, rating, ratingCount }, { hasNotice, isInstalled, isInstalling: isInstalling2 }) {
9717      const stars = Math.round(rating / 0.5) * 0.5;
9718      if (!isInstalled && hasNotice) {
9719        return (0, import_i18n5.sprintf)(
9720          /* translators: %s: block title */
9721          (0, import_i18n5.__)("Retry installing %s."),
9722          (0, import_html_entities.decodeEntities)(title)
9723        );
9724      }
9725      if (isInstalled) {
9726        return (0, import_i18n5.sprintf)(
9727          /* translators: %s: block title */
9728          (0, import_i18n5.__)("Add %s."),
9729          (0, import_html_entities.decodeEntities)(title)
9730        );
9731      }
9732      if (isInstalling2) {
9733        return (0, import_i18n5.sprintf)(
9734          /* translators: %s: block title */
9735          (0, import_i18n5.__)("Installing %s."),
9736          (0, import_html_entities.decodeEntities)(title)
9737        );
9738      }
9739      if (ratingCount < 1) {
9740        return (0, import_i18n5.sprintf)(
9741          /* translators: %s: block title */
9742          (0, import_i18n5.__)("Install %s."),
9743          (0, import_html_entities.decodeEntities)(title)
9744        );
9745      }
9746      return (0, import_i18n5.sprintf)(
9747        /* translators: 1: block title, 2: average rating, 3: total ratings count. */
9748        (0, import_i18n5._n)(
9749          "Install %1$s. %2$s stars with %3$s review.",
9750          "Install %1$s. %2$s stars with %3$s reviews.",
9751          ratingCount
9752        ),
9753        (0, import_html_entities.decodeEntities)(title),
9754        stars,
9755        ratingCount
9756      );
9757    }
9758    function DownloadableBlockListItem({ item, onClick }) {
9759      const { author, description, icon, rating, title } = item;
9760      const isInstalled = !!(0, import_blocks3.getBlockType)(item.name);
9761      const { hasNotice, isInstalling: isInstalling2, isInstallable } = (0, import_data6.useSelect)(
9762        (select) => {
9763          const { getErrorNoticeForBlock: getErrorNoticeForBlock2, isInstalling: isBlockInstalling } = select(store);
9764          const notice = getErrorNoticeForBlock2(item.id);
9765          const hasFatal = notice && notice.isFatal;
9766          return {
9767            hasNotice: !!notice,
9768            isInstalling: isBlockInstalling(item.id),
9769            isInstallable: !hasFatal
9770          };
9771        },
9772        [item]
9773      );
9774      let statusText = "";
9775      if (isInstalled) {
9776        statusText = (0, import_i18n5.__)("Installed!");
9777      } else if (isInstalling2) {
9778        statusText = (0, import_i18n5.__)("Installing\u2026");
9779      }
9780      const itemLabel = getDownloadableBlockLabel(item, {
9781        hasNotice,
9782        isInstalled,
9783        isInstalling: isInstalling2
9784      });
9785      return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(tooltip_exports.Root, { children: [
9786        /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9787          tooltip_exports.Trigger,
9788          {
9789            render: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
9790              import_components.Composite.Item,
9791              {
9792                className: clsx_default(
9793                  "block-directory-downloadable-block-list-item",
9794                  isInstalling2 && "is-installing"
9795                ),
9796                accessibleWhenDisabled: true,
9797                disabled: isInstalling2 || !isInstallable,
9798                onClick: (event) => {
9799                  event.preventDefault();
9800                  onClick();
9801                },
9802                "aria-label": itemLabel,
9803                type: "button",
9804                role: "option",
9805                children: [
9806                  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "block-directory-downloadable-block-list-item__icon", children: [
9807                    /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9808                      downloadable_block_icon_default,
9809                      {
9810                        icon,
9811                        title
9812                      }
9813                    ),
9814                    isInstalling2 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "block-directory-downloadable-block-list-item__spinner", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components.Spinner, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(block_ratings_default, { rating })
9815                  ] }),
9816                  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "block-directory-downloadable-block-list-item__details", children: [
9817                    /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "block-directory-downloadable-block-list-item__title", children: (0, import_element18.createInterpolateElement)(
9818                      (0, import_i18n5.sprintf)(
9819                        /* translators: 1: block title. 2: author name. */
9820                        (0, import_i18n5.__)("%1$s <span>by %2$s</span>"),
9821                        (0, import_html_entities.decodeEntities)(title),
9822                        author
9823                      ),
9824                      {
9825                        span: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "block-directory-downloadable-block-list-item__author" })
9826                      }
9827                    ) }),
9828                    hasNotice ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(downloadable_block_notice_default, { block: item }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
9829                      /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "block-directory-downloadable-block-list-item__desc", children: !!statusText ? statusText : (0, import_html_entities.decodeEntities)(description) }),
9830                      isInstallable && !(isInstalled || isInstalling2) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(VisuallyHidden, { children: (0, import_i18n5.__)("Install block") })
9831                    ] })
9832                  ] })
9833                ]
9834              }
9835            )
9836          }
9837        ),
9838        /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(tooltip_exports.Popup, { children: itemLabel })
9839      ] });
9840    }
9841    var downloadable_block_list_item_default = DownloadableBlockListItem;
9842  
9843    // packages/block-directory/build-module/components/downloadable-blocks-list/index.mjs
9844    var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
9845    var noop4 = () => {
9846    };
9847    function DownloadableBlocksList({ items, onHover = noop4, onSelect }) {
9848      const { installBlockType: installBlockType2 } = (0, import_data7.useDispatch)(store);
9849      if (!items.length) {
9850        return null;
9851      }
9852      return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9853        import_components2.Composite,
9854        {
9855          role: "listbox",
9856          className: "block-directory-downloadable-blocks-list",
9857          "aria-label": (0, import_i18n6.__)("Blocks available for install"),
9858          children: items.map((item) => {
9859            return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9860              downloadable_block_list_item_default,
9861              {
9862                onClick: () => {
9863                  if ((0, import_blocks4.getBlockType)(item.name)) {
9864                    onSelect(item);
9865                  } else {
9866                    installBlockType2(item).then((success) => {
9867                      if (success) {
9868                        onSelect(item);
9869                      }
9870                    });
9871                  }
9872                  onHover(null);
9873                },
9874                onHover,
9875                item
9876              },
9877              item.id
9878            );
9879          })
9880        }
9881      );
9882    }
9883    var downloadable_blocks_list_default = DownloadableBlocksList;
9884  
9885    // packages/block-directory/build-module/components/downloadable-blocks-panel/inserter-panel.mjs
9886    var import_i18n7 = __toESM(require_i18n(), 1);
9887    var import_element19 = __toESM(require_element(), 1);
9888    var import_a11y = __toESM(require_a11y(), 1);
9889    var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
9890    function DownloadableBlocksInserterPanel({
9891      children,
9892      downloadableItems,
9893      hasLocalBlocks
9894    }) {
9895      const count = downloadableItems.length;
9896      (0, import_element19.useEffect)(() => {
9897        (0, import_a11y.speak)(
9898          (0, import_i18n7.sprintf)(
9899            /* translators: %d: number of available blocks. */
9900            (0, import_i18n7._n)(
9901              "%d additional block is available to install.",
9902              "%d additional blocks are available to install.",
9903              count
9904            ),
9905            count
9906          )
9907        );
9908      }, [count]);
9909      return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
9910        !hasLocalBlocks && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "block-directory-downloadable-blocks-panel__no-local", children: (0, import_i18n7.__)("No results available from your installed blocks.") }),
9911        /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "block-editor-inserter__quick-inserter-separator" }),
9912        /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "block-directory-downloadable-blocks-panel", children: [
9913          /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "block-directory-downloadable-blocks-panel__header", children: [
9914            /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h2", { className: "block-directory-downloadable-blocks-panel__title", children: (0, import_i18n7.__)("Available to install") }),
9915            /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "block-directory-downloadable-blocks-panel__description", children: (0, import_i18n7.__)(
9916              "Select a block to install and add it to your post."
9917            ) })
9918          ] }),
9919          children
9920        ] })
9921      ] });
9922    }
9923    var inserter_panel_default = DownloadableBlocksInserterPanel;
9924  
9925    // packages/block-directory/build-module/components/downloadable-blocks-panel/no-results.mjs
9926    var import_i18n8 = __toESM(require_i18n(), 1);
9927    var import_components3 = __toESM(require_components(), 1);
9928    var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
9929    function DownloadableBlocksNoResults() {
9930      return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
9931        /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "block-editor-inserter__no-results", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { children: (0, import_i18n8.__)("No results found.") }) }),
9932        /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "block-editor-inserter__tips", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_components3.Tip, { children: [
9933          (0, import_i18n8.__)("Interested in creating your own block?"),
9934          /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("br", {}),
9935          /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_components3.ExternalLink, { href: "https://developer.wordpress.org/block-editor/", children: [
9936            (0, import_i18n8.__)("Get started here"),
9937            "."
9938          ] })
9939        ] }) })
9940      ] });
9941    }
9942    var no_results_default = DownloadableBlocksNoResults;
9943  
9944    // packages/block-directory/build-module/components/downloadable-blocks-panel/index.mjs
9945    var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
9946    var EMPTY_ARRAY3 = [];
9947    var useDownloadableBlocks = (filterValue) => (0, import_data8.useSelect)(
9948      (select) => {
9949        const {
9950          getDownloadableBlocks: getDownloadableBlocks3,
9951          isRequestingDownloadableBlocks: isRequestingDownloadableBlocks2,
9952          getInstalledBlockTypes: getInstalledBlockTypes2
9953        } = select(store);
9954        const hasPermission = select(import_core_data.store).canUser(
9955          "read",
9956          "block-directory/search"
9957        );
9958        let downloadableBlocks2 = EMPTY_ARRAY3;
9959        if (hasPermission) {
9960          downloadableBlocks2 = getDownloadableBlocks3(filterValue);
9961          const installedBlockTypes = getInstalledBlockTypes2();
9962          const installableBlocks = downloadableBlocks2.filter(
9963            ({ name }) => {
9964              const isJustInstalled = installedBlockTypes.some(
9965                (blockType) => blockType.name === name
9966              );
9967              const isPreviouslyInstalled = (0, import_blocks5.getBlockType)(name);
9968              return isJustInstalled || !isPreviouslyInstalled;
9969            }
9970          );
9971          if (installableBlocks.length !== downloadableBlocks2.length) {
9972            downloadableBlocks2 = installableBlocks;
9973          }
9974          if (downloadableBlocks2.length === 0) {
9975            downloadableBlocks2 = EMPTY_ARRAY3;
9976          }
9977        }
9978        return {
9979          hasPermission,
9980          downloadableBlocks: downloadableBlocks2,
9981          isLoading: isRequestingDownloadableBlocks2(filterValue)
9982        };
9983      },
9984      [filterValue]
9985    );
9986    function DownloadableBlocksPanel({
9987      onSelect,
9988      onHover,
9989      hasLocalBlocks,
9990      isTyping,
9991      filterValue
9992    }) {
9993      const { hasPermission, downloadableBlocks: downloadableBlocks2, isLoading } = useDownloadableBlocks(filterValue);
9994      if (hasPermission === void 0 || isLoading || isTyping) {
9995        return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
9996          hasPermission && !hasLocalBlocks && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
9997            /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "block-directory-downloadable-blocks-panel__no-local", children: (0, import_i18n9.__)(
9998              "No results available from your installed blocks."
9999            ) }),
10000            /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "block-editor-inserter__quick-inserter-separator" })
10001          ] }),
10002          /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "block-directory-downloadable-blocks-panel has-blocks-loading", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components4.Spinner, {}) })
10003        ] });
10004      }
10005      if (false === hasPermission) {
10006        if (!hasLocalBlocks) {
10007          return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(no_results_default, {});
10008        }
10009        return null;
10010      }
10011      if (downloadableBlocks2.length === 0) {
10012        return hasLocalBlocks ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(no_results_default, {});
10013      }
10014      return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10015        inserter_panel_default,
10016        {
10017          downloadableItems: downloadableBlocks2,
10018          hasLocalBlocks,
10019          children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10020            downloadable_blocks_list_default,
10021            {
10022              items: downloadableBlocks2,
10023              onSelect,
10024              onHover
10025            }
10026          )
10027        }
10028      );
10029    }
10030  
10031    // packages/block-directory/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.mjs
10032    var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
10033    function InserterMenuDownloadableBlocksPanel() {
10034      const [debouncedFilterValue, setFilterValue] = (0, import_element20.useState)("");
10035      const debouncedSetFilterValue = (0, import_compose.debounce)(setFilterValue, 400);
10036      return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_block_editor3.__unstableInserterMenuExtension, { children: ({ onSelect, onHover, filterValue, hasItems }) => {
10037        if (debouncedFilterValue !== filterValue) {
10038          debouncedSetFilterValue(filterValue);
10039        }
10040        if (!debouncedFilterValue) {
10041          return null;
10042        }
10043        return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10044          DownloadableBlocksPanel,
10045          {
10046            onSelect,
10047            onHover,
10048            filterValue: debouncedFilterValue,
10049            hasLocalBlocks: hasItems,
10050            isTyping: filterValue !== debouncedFilterValue
10051          }
10052        );
10053      } });
10054    }
10055    var inserter_menu_downloadable_blocks_panel_default = InserterMenuDownloadableBlocksPanel;
10056  
10057    // packages/block-directory/build-module/plugins/installed-blocks-pre-publish-panel/index.mjs
10058    var import_i18n11 = __toESM(require_i18n(), 1);
10059    var import_data9 = __toESM(require_data(), 1);
10060    var import_editor2 = __toESM(require_editor(), 1);
10061  
10062    // packages/block-directory/build-module/components/compact-list/index.mjs
10063    var import_i18n10 = __toESM(require_i18n(), 1);
10064    var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
10065    function CompactList({ items }) {
10066      if (!items.length) {
10067        return null;
10068      }
10069      return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("ul", { className: "block-directory-compact-list", children: items.map(({ icon, id, title, author }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("li", { className: "block-directory-compact-list__item", children: [
10070        /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(downloadable_block_icon_default, { icon, title }),
10071        /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "block-directory-compact-list__item-details", children: [
10072          /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "block-directory-compact-list__item-title", children: title }),
10073          /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "block-directory-compact-list__item-author", children: (0, import_i18n10.sprintf)(
10074            /* translators: %s: Name of the block author. */
10075            (0, import_i18n10.__)("By %s"),
10076            author
10077          ) })
10078        ] })
10079      ] }, id)) });
10080    }
10081  
10082    // packages/block-directory/build-module/plugins/installed-blocks-pre-publish-panel/index.mjs
10083    var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
10084    function InstalledBlocksPrePublishPanel() {
10085      const newBlockTypes = (0, import_data9.useSelect)(
10086        (select) => select(store).getNewBlockTypes(),
10087        []
10088      );
10089      if (!newBlockTypes.length) {
10090        return null;
10091      }
10092      return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
10093        import_editor2.PluginPrePublishPanel,
10094        {
10095          title: (0, import_i18n11.sprintf)(
10096            // translators: %d: number of blocks (number).
10097            (0, import_i18n11._n)(
10098              "Added: %d block",
10099              "Added: %d blocks",
10100              newBlockTypes.length
10101            ),
10102            newBlockTypes.length
10103          ),
10104          initialOpen: true,
10105          children: [
10106            /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "installed-blocks-pre-publish-panel__copy", children: (0, import_i18n11._n)(
10107              "The following block has been added to your site.",
10108              "The following blocks have been added to your site.",
10109              newBlockTypes.length
10110            ) }),
10111            /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CompactList, { items: newBlockTypes })
10112          ]
10113        }
10114      );
10115    }
10116  
10117    // packages/block-directory/build-module/plugins/get-install-missing/index.mjs
10118    var import_i18n13 = __toESM(require_i18n(), 1);
10119    var import_components6 = __toESM(require_components(), 1);
10120    var import_blocks7 = __toESM(require_blocks(), 1);
10121    var import_element21 = __toESM(require_element(), 1);
10122    var import_data11 = __toESM(require_data(), 1);
10123    var import_core_data2 = __toESM(require_core_data(), 1);
10124    var import_block_editor5 = __toESM(require_block_editor(), 1);
10125  
10126    // packages/block-directory/build-module/plugins/get-install-missing/install-button.mjs
10127    var import_i18n12 = __toESM(require_i18n(), 1);
10128    var import_components5 = __toESM(require_components(), 1);
10129    var import_blocks6 = __toESM(require_blocks(), 1);
10130    var import_data10 = __toESM(require_data(), 1);
10131    var import_block_editor4 = __toESM(require_block_editor(), 1);
10132    var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
10133    function InstallButton({ attributes, block, clientId }) {
10134      const isInstallingBlock = (0, import_data10.useSelect)(
10135        (select) => select(store).isInstalling(block.id),
10136        [block.id]
10137      );
10138      const { installBlockType: installBlockType2 } = (0, import_data10.useDispatch)(store);
10139      const { replaceBlock } = (0, import_data10.useDispatch)(import_block_editor4.store);
10140      return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
10141        import_components5.Button,
10142        {
10143          __next40pxDefaultSize: true,
10144          onClick: () => installBlockType2(block).then((success) => {
10145            if (success) {
10146              const blockType = (0, import_blocks6.getBlockType)(block.name);
10147              const [originalBlock] = (0, import_blocks6.parse)(
10148                attributes.originalContent
10149              );
10150              if (originalBlock && blockType) {
10151                replaceBlock(
10152                  clientId,
10153                  (0, import_blocks6.createBlock)(
10154                    blockType.name,
10155                    originalBlock.attributes,
10156                    originalBlock.innerBlocks
10157                  )
10158                );
10159              }
10160            }
10161          }),
10162          accessibleWhenDisabled: true,
10163          disabled: isInstallingBlock,
10164          isBusy: isInstallingBlock,
10165          variant: "primary",
10166          children: (0, import_i18n12.sprintf)(
10167            /* translators: %s: block name */
10168            (0, import_i18n12.__)("Install %s"),
10169            block.title
10170          )
10171        }
10172      );
10173    }
10174  
10175    // packages/block-directory/build-module/plugins/get-install-missing/index.mjs
10176    var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
10177    var getInstallMissing = (OriginalComponent) => (props) => {
10178      const { originalName } = props.attributes;
10179      const { block, hasPermission } = (0, import_data11.useSelect)(
10180        (select) => {
10181          const { getDownloadableBlocks: getDownloadableBlocks3 } = select(store);
10182          const blocks = getDownloadableBlocks3(
10183            "block:" + originalName
10184          ).filter(({ name }) => originalName === name);
10185          return {
10186            hasPermission: select(import_core_data2.store).canUser(
10187              "read",
10188              "block-directory/search"
10189            ),
10190            block: blocks.length && blocks[0]
10191          };
10192        },
10193        [originalName]
10194      );
10195      if (!hasPermission || !block) {
10196        return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(OriginalComponent, { ...props });
10197      }
10198      return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ModifiedWarning, { ...props, originalBlock: block });
10199    };
10200    var ModifiedWarning = ({ originalBlock, ...props }) => {
10201      const { originalName, originalUndelimitedContent, clientId } = props.attributes;
10202      const { replaceBlock } = (0, import_data11.useDispatch)(import_block_editor5.store);
10203      const convertToHTML = () => {
10204        replaceBlock(
10205          props.clientId,
10206          (0, import_blocks7.createBlock)("core/html", {}, [], [originalUndelimitedContent])
10207        );
10208      };
10209      const hasContent = !!originalUndelimitedContent;
10210      const hasHTMLBlock = (0, import_data11.useSelect)(
10211        (select) => {
10212          const { canInsertBlockType, getBlockRootClientId } = select(import_block_editor5.store);
10213          return canInsertBlockType(
10214            "core/html",
10215            getBlockRootClientId(clientId)
10216          );
10217        },
10218        [clientId]
10219      );
10220      let messageHTML = (0, import_i18n13.sprintf)(
10221        /* translators: %s: block name */
10222        (0, import_i18n13.__)(
10223          "Your site doesn\u2019t include support for the %s block. You can try installing the block or remove it entirely."
10224        ),
10225        originalBlock.title || originalName
10226      );
10227      const actions = [
10228        /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
10229          InstallButton,
10230          {
10231            block: originalBlock,
10232            attributes: props.attributes,
10233            clientId: props.clientId
10234          },
10235          "install"
10236        )
10237      ];
10238      if (hasContent && hasHTMLBlock) {
10239        messageHTML = (0, import_i18n13.sprintf)(
10240          /* translators: %s: block name */
10241          (0, import_i18n13.__)(
10242            "Your site doesn\u2019t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."
10243          ),
10244          originalBlock.title || originalName
10245        );
10246        actions.push(
10247          /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
10248            import_components6.Button,
10249            {
10250              __next40pxDefaultSize: true,
10251              onClick: convertToHTML,
10252              variant: "tertiary",
10253              children: (0, import_i18n13.__)("Keep as HTML")
10254            },
10255            "convert"
10256          )
10257        );
10258      }
10259      return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { ...(0, import_block_editor5.useBlockProps)(), children: [
10260        /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_block_editor5.Warning, { actions, children: messageHTML }),
10261        /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_element21.RawHTML, { children: originalUndelimitedContent })
10262      ] });
10263    };
10264    var get_install_missing_default = getInstallMissing;
10265  
10266    // packages/block-directory/build-module/plugins/index.mjs
10267    var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
10268    (0, import_plugins.registerPlugin)("block-directory", {
10269      // The icon is explicitly set to undefined to prevent PluginPrePublishPanel
10270      // from rendering the fallback icon pluginIcon.
10271      icon: void 0,
10272      render() {
10273        return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
10274          /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AutoBlockUninstaller, {}),
10275          /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(inserter_menu_downloadable_blocks_panel_default, {}),
10276          /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InstalledBlocksPrePublishPanel, {})
10277        ] });
10278      }
10279    });
10280    (0, import_hooks.addFilter)(
10281      "blocks.registerBlockType",
10282      "block-directory/fallback",
10283      (settings, name) => {
10284        if (name !== "core/missing") {
10285          return settings;
10286        }
10287        settings.edit = get_install_missing_default(settings.edit);
10288        return settings;
10289      }
10290    );
10291    return __toCommonJS(index_exports);
10292  })();
10293  /*! Bundled license information:
10294  
10295  use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
10296    (**
10297     * @license React
10298     * use-sync-external-store-shim.development.js
10299     *
10300     * Copyright (c) Meta Platforms, Inc. and affiliates.
10301     *
10302     * This source code is licensed under the MIT license found in the
10303     * LICENSE file in the root directory of this source tree.
10304     *)
10305  
10306  use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:
10307    (**
10308     * @license React
10309     * use-sync-external-store-shim/with-selector.development.js
10310     *
10311     * Copyright (c) Meta Platforms, Inc. and affiliates.
10312     *
10313     * This source code is licensed under the MIT license found in the
10314     * LICENSE file in the root directory of this source tree.
10315     *)
10316  */
10317  (window.wp ||= {}).blockDirectory = wp.blockDirectory;
10318  })();


Generated : Thu Sep 17 08:20:31 2026 Cross-referenced by PHPXref