| @@ -1,4 +1,5 @@ | ||
| 1 | +(function() { | |
| 1 | 2 | var wp; |
| 2 | 3 | (wp ||= {}).blockDirectory = (() => { |
| 3 | 4 | var __create = Object.create; |
| 4 | 5 | var __defProp = Object.defineProperty; |
| @@ -149,15 +150,184 @@ | ||
| 149 | 150 | module.exports = window.ReactJSXRuntime; |
| 150 | 151 | } |
| 151 | 152 | }); |
| 152 | 153 | |
| 153 | - // package-external:@wordpress/a11y | |
| 154 | - var require_a11y = __commonJS({ | |
| 155 | - "package-external:@wordpress/a11y"(exports, module) { | |
| 156 | - module.exports = window.wp.a11y; | |
| 154 | + // vendor-external:react-dom | |
| 155 | + var require_react_dom = __commonJS({ | |
| 156 | + "vendor-external:react-dom"(exports, module) { | |
| 157 | + module.exports = window.ReactDOM; | |
| 157 | 158 | } |
| 158 | 159 | }); |
| 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 | + | |
| 160 | 330 | // package-external:@wordpress/primitives |
| 161 | 331 | var require_primitives = __commonJS({ |
| 162 | 332 | "package-external:@wordpress/primitives"(exports, module) { |
| 163 | 333 | module.exports = window.wp.primitives; |
| @@ -163,8 +333,15 @@ | ||
| 163 | 333 | module.exports = window.wp.primitives; |
| 164 | 334 | } |
| 165 | 335 | }); |
| 166 | 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 | + | |
| 167 | 344 | // packages/block-directory/build-module/index.mjs |
| 168 | 345 | var index_exports = {}; |
| 169 | 346 | __export(index_exports, { |
| 170 | 347 | store: () => store |
| @@ -371,11 +548,11 @@ | ||
| 371 | 548 | var import_api_fetch = __toESM(require_api_fetch(), 1); |
| 372 | 549 | var loadAsset = (el) => { |
| 373 | 550 | return new Promise((resolve, reject) => { |
| 374 | 551 | const newNode = document.createElement(el.nodeName); |
| 375 | - ["id", "rel", "src", "href", "type"].forEach((attr) => { | |
| 376 | - if (el[attr]) { | |
| 377 | - newNode[attr] = el[attr]; | |
| 552 | + ["id", "rel", "src", "href", "type"].forEach((attr2) => { | |
| 553 | + if (el[attr2]) { | |
| 554 | + newNode[attr2] = el[attr2]; | |
| 378 | 555 | } |
| 379 | 556 | }); |
| 380 | 557 | if (el.innerHTML) { |
| 381 | 558 | newNode.appendChild(document.createTextNode(el.innerHTML)); |
| @@ -633,12 +810,12 @@ | ||
| 633 | 810 | }, input); |
| 634 | 811 | } |
| 635 | 812 | |
| 636 | 813 | // node_modules/pascal-case/dist.es2015/index.js |
| 637 | - function pascalCaseTransform(input, index) { | |
| 814 | + function pascalCaseTransform(input, index2) { | |
| 638 | 815 | var firstChar = input.charAt(0); |
| 639 | 816 | var lowerChars = input.substr(1).toLowerCase(); |
| 640 | - if (index > 0 && firstChar >= "0" && firstChar <= "9") { | |
| 817 | + if (index2 > 0 && firstChar >= "0" && firstChar <= "9") { | |
| 641 | 818 | return "_" + firstChar + lowerChars; |
| 642 | 819 | } |
| 643 | 820 | return "" + firstChar.toUpperCase() + lowerChars; |
| 644 | 821 | } |
| @@ -649,12 +826,12 @@ | ||
| 649 | 826 | return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options)); |
| 650 | 827 | } |
| 651 | 828 | |
| 652 | 829 | // node_modules/camel-case/dist.es2015/index.js |
| 653 | - function camelCaseTransform(input, index) { | |
| 654 | - if (index === 0) | |
| 830 | + function camelCaseTransform(input, index2) { | |
| 831 | + if (index2 === 0) | |
| 655 | 832 | return input.toLowerCase(); |
| 656 | - return pascalCaseTransform(input, index); | |
| 833 | + return pascalCaseTransform(input, index2); | |
| 657 | 834 | } |
| 658 | 835 | function camelCase(input, options) { |
| 659 | 836 | if (options === void 0) { |
| 660 | 837 | options = {}; |
| @@ -722,12 +899,12 @@ | ||
| 722 | 899 | |
| 723 | 900 | // packages/block-directory/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.mjs |
| 724 | 901 | var import_block_editor3 = __toESM(require_block_editor(), 1); |
| 725 | 902 | var import_compose = __toESM(require_compose(), 1); |
| 726 | - var import_element6 = __toESM(require_element(), 1); | |
| 903 | + var import_element20 = __toESM(require_element(), 1); | |
| 727 | 904 | |
| 728 | 905 | // packages/block-directory/build-module/components/downloadable-blocks-panel/index.mjs |
| 729 | - var import_i18n8 = __toESM(require_i18n(), 1); | |
| 906 | + var import_i18n9 = __toESM(require_i18n(), 1); | |
| 730 | 907 | var import_components4 = __toESM(require_components(), 1); |
| 731 | 908 | var import_core_data = __toESM(require_core_data(), 1); |
| 732 | 909 | var import_data8 = __toESM(require_data(), 1); |
| 733 | 910 | var import_blocks5 = __toESM(require_blocks(), 1); |
| @@ -732,9 +909,9 @@ | ||
| 732 | 909 | var import_data8 = __toESM(require_data(), 1); |
| 733 | 910 | var import_blocks5 = __toESM(require_blocks(), 1); |
| 734 | 911 | |
| 735 | 912 | // packages/block-directory/build-module/components/downloadable-blocks-list/index.mjs |
| 736 | - var import_i18n5 = __toESM(require_i18n(), 1); | |
| 913 | + var import_i18n6 = __toESM(require_i18n(), 1); | |
| 737 | 914 | var import_components2 = __toESM(require_components(), 1); |
| 738 | 915 | var import_blocks4 = __toESM(require_blocks(), 1); |
| 739 | 916 | var import_data7 = __toESM(require_data(), 1); |
| 740 | 917 | |
| @@ -754,20 +931,49 @@ | ||
| 754 | 931 | } |
| 755 | 932 | var clsx_default = clsx; |
| 756 | 933 | |
| 757 | 934 | // packages/block-directory/build-module/components/downloadable-block-list-item/index.mjs |
| 758 | - var import_i18n4 = __toESM(require_i18n(), 1); | |
| 935 | + var import_i18n5 = __toESM(require_i18n(), 1); | |
| 759 | 936 | var import_components = __toESM(require_components(), 1); |
| 760 | - var import_element4 = __toESM(require_element(), 1); | |
| 937 | + var import_element18 = __toESM(require_element(), 1); | |
| 761 | 938 | var import_html_entities = __toESM(require_html_entities(), 1); |
| 762 | 939 | var import_blocks3 = __toESM(require_blocks(), 1); |
| 763 | 940 | var import_data6 = __toESM(require_data(), 1); |
| 764 | 941 | |
| 765 | - // node_modules/@base-ui/utils/esm/useRefWithInit.js | |
| 942 | + // node_modules/@base-ui/utils/createLogOnce.mjs | |
| 943 | + var loggedMessages; | |
| 944 | + if (true) { | |
| 945 | + loggedMessages = /* @__PURE__ */ new Set(); | |
| 946 | + } | |
| 947 | + function createLogOnce(severity, prefix) { | |
| 948 | + return function logOnce(...messages) { | |
| 949 | + if (true) { | |
| 950 | + const message = messages.join(" "); | |
| 951 | + const output = prefix ? `${prefix}: ${message}` : message; | |
| 952 | + const key = `${severity}:${output}`; | |
| 953 | + if (!loggedMessages.has(key)) { | |
| 954 | + loggedMessages.add(key); | |
| 955 | + if (severity === "warn") { | |
| 956 | + console.warn(output); | |
| 957 | + } else { | |
| 958 | + console.error(output); | |
| 959 | + } | |
| 960 | + } | |
| 961 | + } | |
| 962 | + }; | |
| 963 | + } | |
| 964 | + | |
| 965 | + // node_modules/@base-ui/utils/safeReact.mjs | |
| 766 | 966 | var React = __toESM(require_react(), 1); |
| 967 | + var SafeReact = { | |
| 968 | + ...React | |
| 969 | + }; | |
| 970 | + | |
| 971 | + // node_modules/@base-ui/utils/useRefWithInit.mjs | |
| 972 | + var React2 = __toESM(require_react(), 1); | |
| 767 | 973 | var UNINITIALIZED = {}; |
| 768 | 974 | function useRefWithInit(init, initArg) { |
| 769 | - const ref = React.useRef(UNINITIALIZED); | |
| 975 | + const ref = React2.useRef(UNINITIALIZED); | |
| 770 | 976 | if (ref.current === UNINITIALIZED) { |
| 771 | 977 | ref.current = init(initArg); |
| 772 | 978 | } |
| 773 | 979 | return ref; |
| @@ -772,27 +978,60 @@ | ||
| 772 | 978 | } |
| 773 | 979 | return ref; |
| 774 | 980 | } |
| 775 | 981 | |
| 776 | - // node_modules/@base-ui/utils/esm/warn.js | |
| 777 | - var set; | |
| 778 | - if (true) { | |
| 779 | - set = /* @__PURE__ */ new Set(); | |
| 982 | + // node_modules/@base-ui/utils/useStableCallback.mjs | |
| 983 | + var useInsertionEffect = SafeReact.useInsertionEffect; | |
| 984 | + var useSafeInsertionEffect = ( | |
| 985 | + // React 17 doesn't have useInsertionEffect. | |
| 986 | + useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. | |
| 987 | + useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() | |
| 988 | + ); | |
| 989 | + function useStableCallback(callback) { | |
| 990 | + const stable = useRefWithInit(createStableCallback).current; | |
| 991 | + stable.next = callback; | |
| 992 | + useSafeInsertionEffect(stable.effect); | |
| 993 | + return stable.trampoline; | |
| 780 | 994 | } |
| 781 | - function warn(...messages) { | |
| 995 | + function createStableCallback() { | |
| 996 | + const stable = { | |
| 997 | + next: void 0, | |
| 998 | + callback: assertNotCalled, | |
| 999 | + trampoline: (...args) => stable.callback?.(...args), | |
| 1000 | + effect: () => { | |
| 1001 | + stable.callback = stable.next; | |
| 1002 | + } | |
| 1003 | + }; | |
| 1004 | + return stable; | |
| 1005 | + } | |
| 1006 | + function assertNotCalled() { | |
| 782 | 1007 | if (true) { |
| 783 | - const messageKey = messages.join(" "); | |
| 784 | - if (!set.has(messageKey)) { | |
| 785 | - set.add(messageKey); | |
| 786 | - console.warn(`Base UI: ${messageKey}`); | |
| 787 | - } | |
| 1008 | + throw ( | |
| 1009 | + /* minify-error-disabled */ | |
| 1010 | + new Error("Base UI: Cannot call an event handler while rendering.") | |
| 1011 | + ); | |
| 788 | 1012 | } |
| 789 | 1013 | } |
| 790 | 1014 | |
| 791 | - // node_modules/@base-ui/react/esm/internals/useRenderElement.js | |
| 792 | - var React4 = __toESM(require_react(), 1); | |
| 1015 | + // node_modules/@base-ui/utils/warn.mjs | |
| 1016 | + var warn = createLogOnce("warn", "Base UI"); | |
| 793 | 1017 | |
| 794 | - // node_modules/@base-ui/utils/esm/useMergedRefs.js | |
| 1018 | + // node_modules/@base-ui/utils/empty.mjs | |
| 1019 | + function NOOP() { | |
| 1020 | + } | |
| 1021 | + var EMPTY_ARRAY2 = Object.freeze([]); | |
| 1022 | + var EMPTY_OBJECT = Object.freeze({}); | |
| 1023 | + | |
| 1024 | + // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs | |
| 1025 | + var React3 = __toESM(require_react(), 1); | |
| 1026 | + var noop = () => { | |
| 1027 | + }; | |
| 1028 | + var useIsoLayoutEffect = typeof document !== "undefined" ? React3.useLayoutEffect : noop; | |
| 1029 | + | |
| 1030 | + // node_modules/@base-ui/react/internals/useRenderElement.mjs | |
| 1031 | + var React6 = __toESM(require_react(), 1); | |
| 1032 | + | |
| 1033 | + // node_modules/@base-ui/utils/useMergedRefs.mjs | |
| 795 | 1034 | function useMergedRefs(a, b, c, d) { |
| 796 | 1035 | const forkRef = useRefWithInit(createForkRef).current; |
| 797 | 1036 | if (didChange(forkRef, a, b, c, d)) { |
| 798 | 1037 | update(forkRef, [a, b, c, d]); |
| @@ -816,9 +1055,9 @@ | ||
| 816 | 1055 | function didChange(forkRef, a, b, c, d) { |
| 817 | 1056 | return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; |
| 818 | 1057 | } |
| 819 | 1058 | function didChangeN(forkRef, newRefs) { |
| 820 | - return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]); | |
| 1059 | + return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); | |
| 821 | 1060 | } |
| 822 | 1061 | function update(forkRef, refs) { |
| 823 | 1062 | forkRef.refs = refs; |
| 824 | 1063 | if (refs.every((ref) => ref == null)) { |
| @@ -863,9 +1102,9 @@ | ||
| 863 | 1102 | const cleanupCallback = cleanupCallbacks[i]; |
| 864 | 1103 | if (typeof cleanupCallback === "function") { |
| 865 | 1104 | cleanupCallback(); |
| 866 | 1105 | } else { |
| 867 | - ref(null); | |
| 1106 | + void ref(null); | |
| 868 | 1107 | } |
| 869 | 1108 | break; |
| 870 | 1109 | } |
| 871 | 1110 | case "object": { |
| @@ -879,21 +1118,21 @@ | ||
| 879 | 1118 | } |
| 880 | 1119 | }; |
| 881 | 1120 | } |
| 882 | 1121 | |
| 883 | - // node_modules/@base-ui/utils/esm/getReactElementRef.js | |
| 884 | - var React3 = __toESM(require_react(), 1); | |
| 1122 | + // node_modules/@base-ui/utils/getReactElementRef.mjs | |
| 1123 | + var React5 = __toESM(require_react(), 1); | |
| 885 | 1124 | |
| 886 | - // node_modules/@base-ui/utils/esm/reactVersion.js | |
| 887 | - var React2 = __toESM(require_react(), 1); | |
| 888 | - var majorVersion = parseInt(React2.version, 10); | |
| 1125 | + // node_modules/@base-ui/utils/reactVersion.mjs | |
| 1126 | + var React4 = __toESM(require_react(), 1); | |
| 1127 | + var majorVersion = parseInt(React4.version, 10); | |
| 889 | 1128 | function isReactVersionAtLeast(reactVersionToCheck) { |
| 890 | 1129 | return majorVersion >= reactVersionToCheck; |
| 891 | 1130 | } |
| 892 | 1131 | |
| 893 | - // node_modules/@base-ui/utils/esm/getReactElementRef.js | |
| 1132 | + // node_modules/@base-ui/utils/getReactElementRef.mjs | |
| 894 | 1133 | function getReactElementRef(element) { |
| 895 | - if (!/* @__PURE__ */ React3.isValidElement(element)) { | |
| 1134 | + if (!/* @__PURE__ */ React5.isValidElement(element)) { | |
| 896 | 1135 | return null; |
| 897 | 1136 | } |
| 898 | 1137 | const reactElement = element; |
| 899 | 1138 | const propsWithRef = reactElement.props; |
| @@ -899,9 +1138,9 @@ | ||
| 899 | 1138 | const propsWithRef = reactElement.props; |
| 900 | 1139 | return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; |
| 901 | 1140 | } |
| 902 | 1141 | |
| 903 | - // node_modules/@base-ui/utils/esm/mergeObjects.js | |
| 1142 | + // node_modules/@base-ui/utils/mergeObjects.mjs | |
| 904 | 1143 | function mergeObjects(a, b) { |
| 905 | 1144 | if (a && !b) { |
| 906 | 1145 | return a; |
| 907 | 1146 | } |
| @@ -916,13 +1155,9 @@ | ||
| 916 | 1155 | } |
| 917 | 1156 | return void 0; |
| 918 | 1157 | } |
| 919 | 1158 | |
| 920 | - // node_modules/@base-ui/utils/esm/empty.js | |
| 921 | - var EMPTY_ARRAY2 = Object.freeze([]); | |
| 922 | - var EMPTY_OBJECT = Object.freeze({}); | |
| 923 | - | |
| 924 | - // node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js | |
| 1159 | + // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs | |
| 925 | 1160 | function getStateAttributesProps(state, customMapping) { |
| 926 | 1161 | const props = {}; |
| 927 | 1162 | for (const key in state) { |
| 928 | 1163 | const value = state[key]; |
| @@ -941,19 +1176,19 @@ | ||
| 941 | 1176 | } |
| 942 | 1177 | return props; |
| 943 | 1178 | } |
| 944 | 1179 | |
| 945 | - // node_modules/@base-ui/react/esm/utils/resolveClassName.js | |
| 1180 | + // node_modules/@base-ui/react/utils/resolveClassName.mjs | |
| 946 | 1181 | function resolveClassName(className, state) { |
| 947 | 1182 | return typeof className === "function" ? className(state) : className; |
| 948 | 1183 | } |
| 949 | 1184 | |
| 950 | - // node_modules/@base-ui/react/esm/utils/resolveStyle.js | |
| 1185 | + // node_modules/@base-ui/react/utils/resolveStyle.mjs | |
| 951 | 1186 | function resolveStyle(style, state) { |
| 952 | 1187 | return typeof style === "function" ? style(state) : style; |
| 953 | 1188 | } |
| 954 | 1189 | |
| 955 | - // node_modules/@base-ui/react/esm/merge-props/mergeProps.js | |
| 1190 | + // node_modules/@base-ui/react/merge-props/mergeProps.mjs | |
| 956 | 1191 | var EMPTY_PROPS = {}; |
| 957 | 1192 | function mergeProps(a, b, c, d, e) { |
| 958 | 1193 | if (!c && !d && !e && !a) { |
| 959 | 1194 | return createInitialMergedProps(b); |
| @@ -1106,13 +1341,16 @@ | ||
| 1106 | 1341 | function isSyntheticEvent(event) { |
| 1107 | 1342 | return event != null && typeof event === "object" && "nativeEvent" in event; |
| 1108 | 1343 | } |
| 1109 | 1344 | |
| 1110 | - // node_modules/@base-ui/react/esm/internals/useRenderElement.js | |
| 1345 | + // node_modules/@base-ui/react/internals/useRenderElement.mjs | |
| 1111 | 1346 | var import_react = __toESM(require_react(), 1); |
| 1112 | 1347 | function useRenderElement(element, componentProps, params = {}) { |
| 1113 | - const renderProp = componentProps.render; | |
| 1114 | - const outProps = useRenderElementProps(componentProps, params); | |
| 1348 | + let renderProp = componentProps.render; | |
| 1349 | + if (params.enabled !== false) { | |
| 1350 | + renderProp = unwrapLazyRenderProp(renderProp); | |
| 1351 | + } | |
| 1352 | + const outProps = useRenderElementProps(componentProps, params, renderProp); | |
| 1115 | 1353 | if (params.enabled === false) { |
| 1116 | 1354 | return null; |
| 1117 | 1355 | } |
| 1118 | 1356 | const state = params.state ?? EMPTY_OBJECT; |
| @@ -1117,13 +1355,12 @@ | ||
| 1117 | 1355 | } |
| 1118 | 1356 | const state = params.state ?? EMPTY_OBJECT; |
| 1119 | 1357 | return evaluateRenderProp(element, renderProp, outProps, state); |
| 1120 | 1358 | } |
| 1121 | - function useRenderElementProps(componentProps, params = {}) { | |
| 1359 | + function useRenderElementProps(componentProps, params, renderProp) { | |
| 1122 | 1360 | const { |
| 1123 | 1361 | className: classNameProp, |
| 1124 | - style: styleProp, | |
| 1125 | - render: renderProp | |
| 1362 | + style: styleProp | |
| 1126 | 1363 | } = componentProps; |
| 1127 | 1364 | const { |
| 1128 | 1365 | state = EMPTY_OBJECT, |
| 1129 | 1366 | ref, |
| @@ -1137,9 +1374,9 @@ | ||
| 1137 | 1374 | const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; |
| 1138 | 1375 | const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; |
| 1139 | 1376 | if (typeof document !== "undefined") { |
| 1140 | 1377 | if (!enabled) { |
| 1141 | - useMergedRefs(null, null); | |
| 1378 | + void useMergedRefs(null, null); | |
| 1142 | 1379 | } else if (Array.isArray(ref)) { |
| 1143 | 1380 | outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); |
| 1144 | 1381 | } else { |
| 1145 | 1382 | outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); |
| @@ -1164,8 +1401,15 @@ | ||
| 1164 | 1401 | } |
| 1165 | 1402 | var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); |
| 1166 | 1403 | var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; |
| 1167 | 1404 | var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; |
| 1405 | + function unwrapLazyRenderProp(render) { | |
| 1406 | + if (render?.$$typeof !== REACT_LAZY_TYPE) { | |
| 1407 | + return render; | |
| 1408 | + } | |
| 1409 | + const unwrapped = React6.Children.toArray(render)[0]; | |
| 1410 | + return /* @__PURE__ */ React6.isValidElement(unwrapped) ? unwrapped : render; | |
| 1411 | + } | |
| 1168 | 1412 | function evaluateRenderProp(element, render, props, state) { |
| 1169 | 1413 | if (render) { |
| 1170 | 1414 | if (typeof render === "function") { |
| 1171 | 1415 | if (true) { |
| @@ -1174,19 +1418,14 @@ | ||
| 1174 | 1418 | return render(props, state); |
| 1175 | 1419 | } |
| 1176 | 1420 | const mergedProps = mergeProps(props, render.props); |
| 1177 | 1421 | mergedProps.ref = props.ref; |
| 1178 | - let newElement = render; | |
| 1179 | - if (newElement?.$$typeof === REACT_LAZY_TYPE) { | |
| 1180 | - const children = React4.Children.toArray(render); | |
| 1181 | - newElement = children[0]; | |
| 1182 | - } | |
| 1183 | 1422 | if (true) { |
| 1184 | - if (!/* @__PURE__ */ React4.isValidElement(newElement)) { | |
| 1423 | + if (!/* @__PURE__ */ React6.isValidElement(render)) { | |
| 1185 | 1424 | 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")); |
| 1186 | 1425 | } |
| 1187 | 1426 | } |
| 1188 | - return /* @__PURE__ */ React4.cloneElement(newElement, mergedProps); | |
| 1427 | + return /* @__PURE__ */ React6.cloneElement(render, mergedProps); | |
| 1189 | 1428 | } |
| 1190 | 1429 | if (element) { |
| 1191 | 1430 | if (typeof element === "string") { |
| 1192 | 1431 | return renderTag(element, props); |
| @@ -1221,46 +1460,7749 @@ | ||
| 1221 | 1460 | ...props, |
| 1222 | 1461 | key: props.key |
| 1223 | 1462 | }); |
| 1224 | 1463 | } |
| 1225 | - return /* @__PURE__ */ React4.createElement(Tag, props); | |
| 1464 | + return /* @__PURE__ */ React6.createElement(Tag, props); | |
| 1226 | 1465 | } |
| 1227 | 1466 | |
| 1228 | - // node_modules/@base-ui/react/esm/use-render/useRender.js | |
| 1229 | - function useRender(params) { | |
| 1230 | - return useRenderElement(params.defaultTagName ?? "div", params, params); | |
| 1467 | + // node_modules/@base-ui/utils/useId.mjs | |
| 1468 | + var React7 = __toESM(require_react(), 1); | |
| 1469 | + var globalId = 0; | |
| 1470 | + function useGlobalId(idOverride, prefix = "mui") { | |
| 1471 | + const [defaultId, setDefaultId] = React7.useState(idOverride); | |
| 1472 | + const id = idOverride || defaultId; | |
| 1473 | + React7.useEffect(() => { | |
| 1474 | + if (defaultId == null) { | |
| 1475 | + globalId += 1; | |
| 1476 | + setDefaultId(`${prefix}-${globalId}`); | |
| 1477 | + } | |
| 1478 | + }, [defaultId, prefix]); | |
| 1479 | + return id; | |
| 1231 | 1480 | } |
| 1481 | + var maybeReactUseId = SafeReact.useId; | |
| 1482 | + function useId(idOverride, prefix) { | |
| 1483 | + if (maybeReactUseId !== void 0) { | |
| 1484 | + const reactId = maybeReactUseId(); | |
| 1485 | + return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId); | |
| 1486 | + } | |
| 1487 | + return useGlobalId(idOverride, prefix); | |
| 1488 | + } | |
| 1232 | 1489 | |
| 1233 | - // packages/icons/build-module/icon/index.mjs | |
| 1234 | - var import_element2 = __toESM(require_element(), 1); | |
| 1235 | - var icon_default = (0, import_element2.forwardRef)( | |
| 1236 | - ({ icon, size = 24, ...props }, ref) => { | |
| 1237 | - return (0, import_element2.cloneElement)(icon, { | |
| 1238 | - width: size, | |
| 1239 | - height: size, | |
| 1240 | - ...props, | |
| 1241 | - ref | |
| 1490 | + // node_modules/@base-ui/react/internals/useBaseUiId.mjs | |
| 1491 | + function useBaseUiId(idOverride) { | |
| 1492 | + return useId(idOverride, "base-ui"); | |
| 1493 | + } | |
| 1494 | + | |
| 1495 | + // node_modules/@base-ui/react/internals/reason-parts.mjs | |
| 1496 | + var reason_parts_exports = {}; | |
| 1497 | + __export(reason_parts_exports, { | |
| 1498 | + cancelOpen: () => cancelOpen, | |
| 1499 | + chipRemovePress: () => chipRemovePress, | |
| 1500 | + clearPress: () => clearPress, | |
| 1501 | + closePress: () => closePress, | |
| 1502 | + closeWatcher: () => closeWatcher, | |
| 1503 | + decrementPress: () => decrementPress, | |
| 1504 | + disabled: () => disabled, | |
| 1505 | + drag: () => drag, | |
| 1506 | + escapeKey: () => escapeKey, | |
| 1507 | + focusOut: () => focusOut, | |
| 1508 | + imperativeAction: () => imperativeAction, | |
| 1509 | + incrementPress: () => incrementPress, | |
| 1510 | + initial: () => initial, | |
| 1511 | + inputBlur: () => inputBlur, | |
| 1512 | + inputChange: () => inputChange, | |
| 1513 | + inputClear: () => inputClear, | |
| 1514 | + inputPaste: () => inputPaste, | |
| 1515 | + inputPress: () => inputPress, | |
| 1516 | + itemPress: () => itemPress, | |
| 1517 | + keyboard: () => keyboard, | |
| 1518 | + linkPress: () => linkPress, | |
| 1519 | + listNavigation: () => listNavigation, | |
| 1520 | + missing: () => missing, | |
| 1521 | + none: () => none, | |
| 1522 | + outsidePress: () => outsidePress, | |
| 1523 | + pointer: () => pointer, | |
| 1524 | + scrub: () => scrub, | |
| 1525 | + siblingOpen: () => siblingOpen, | |
| 1526 | + swipe: () => swipe, | |
| 1527 | + trackPress: () => trackPress, | |
| 1528 | + triggerFocus: () => triggerFocus, | |
| 1529 | + triggerHover: () => triggerHover, | |
| 1530 | + triggerPress: () => triggerPress, | |
| 1531 | + wheel: () => wheel, | |
| 1532 | + windowResize: () => windowResize | |
| 1533 | + }); | |
| 1534 | + var none = "none"; | |
| 1535 | + var triggerPress = "trigger-press"; | |
| 1536 | + var triggerHover = "trigger-hover"; | |
| 1537 | + var triggerFocus = "trigger-focus"; | |
| 1538 | + var outsidePress = "outside-press"; | |
| 1539 | + var itemPress = "item-press"; | |
| 1540 | + var closePress = "close-press"; | |
| 1541 | + var linkPress = "link-press"; | |
| 1542 | + var clearPress = "clear-press"; | |
| 1543 | + var chipRemovePress = "chip-remove-press"; | |
| 1544 | + var trackPress = "track-press"; | |
| 1545 | + var incrementPress = "increment-press"; | |
| 1546 | + var decrementPress = "decrement-press"; | |
| 1547 | + var inputChange = "input-change"; | |
| 1548 | + var inputClear = "input-clear"; | |
| 1549 | + var inputBlur = "input-blur"; | |
| 1550 | + var inputPaste = "input-paste"; | |
| 1551 | + var inputPress = "input-press"; | |
| 1552 | + var focusOut = "focus-out"; | |
| 1553 | + var escapeKey = "escape-key"; | |
| 1554 | + var closeWatcher = "close-watcher"; | |
| 1555 | + var listNavigation = "list-navigation"; | |
| 1556 | + var keyboard = "keyboard"; | |
| 1557 | + var pointer = "pointer"; | |
| 1558 | + var drag = "drag"; | |
| 1559 | + var wheel = "wheel"; | |
| 1560 | + var scrub = "scrub"; | |
| 1561 | + var cancelOpen = "cancel-open"; | |
| 1562 | + var siblingOpen = "sibling-open"; | |
| 1563 | + var disabled = "disabled"; | |
| 1564 | + var missing = "missing"; | |
| 1565 | + var initial = "initial"; | |
| 1566 | + var imperativeAction = "imperative-action"; | |
| 1567 | + var swipe = "swipe"; | |
| 1568 | + var windowResize = "window-resize"; | |
| 1569 | + | |
| 1570 | + // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs | |
| 1571 | + function createChangeEventDetails(reason, event, trigger, customProperties) { | |
| 1572 | + let canceled = false; | |
| 1573 | + let allowPropagation = false; | |
| 1574 | + const custom = customProperties ?? EMPTY_OBJECT; | |
| 1575 | + const details = { | |
| 1576 | + reason, | |
| 1577 | + event: event ?? new Event("base-ui"), | |
| 1578 | + cancel() { | |
| 1579 | + canceled = true; | |
| 1580 | + }, | |
| 1581 | + allowPropagation() { | |
| 1582 | + allowPropagation = true; | |
| 1583 | + }, | |
| 1584 | + get isCanceled() { | |
| 1585 | + return canceled; | |
| 1586 | + }, | |
| 1587 | + get isPropagationAllowed() { | |
| 1588 | + return allowPropagation; | |
| 1589 | + }, | |
| 1590 | + trigger, | |
| 1591 | + ...custom | |
| 1592 | + }; | |
| 1593 | + return details; | |
| 1594 | + } | |
| 1595 | + | |
| 1596 | + // node_modules/@base-ui/react/internals/useTransitionStatus.mjs | |
| 1597 | + var React9 = __toESM(require_react(), 1); | |
| 1598 | + | |
| 1599 | + // node_modules/@base-ui/utils/useOnMount.mjs | |
| 1600 | + var React8 = __toESM(require_react(), 1); | |
| 1601 | + function useOnMount(fn) { | |
| 1602 | + React8.useEffect(fn, EMPTY_ARRAY2); | |
| 1603 | + } | |
| 1604 | + | |
| 1605 | + // node_modules/@base-ui/utils/useAnimationFrame.mjs | |
| 1606 | + var EMPTY = null; | |
| 1607 | + var LAST_RAF = globalThis.requestAnimationFrame; | |
| 1608 | + var Scheduler = class { | |
| 1609 | + /* This implementation uses an array as a backing data-structure for frame callbacks. | |
| 1610 | + * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it | |
| 1611 | + * never calls the native `cancelAnimationFrame` if there are no frames left. This can | |
| 1612 | + * be much more efficient if there is a call pattern that alterns as | |
| 1613 | + * "request-cancel-request-cancel-…". | |
| 1614 | + * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation | |
| 1615 | + * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ | |
| 1616 | + callbacks = []; | |
| 1617 | + callbacksCount = 0; | |
| 1618 | + nextId = 1; | |
| 1619 | + startId = 1; | |
| 1620 | + isScheduled = false; | |
| 1621 | + tick = (timestamp) => { | |
| 1622 | + this.isScheduled = false; | |
| 1623 | + const currentCallbacks = this.callbacks; | |
| 1624 | + const currentCallbacksCount = this.callbacksCount; | |
| 1625 | + this.callbacks = []; | |
| 1626 | + this.callbacksCount = 0; | |
| 1627 | + this.startId = this.nextId; | |
| 1628 | + if (currentCallbacksCount > 0) { | |
| 1629 | + for (let i = 0; i < currentCallbacks.length; i += 1) { | |
| 1630 | + currentCallbacks[i]?.(timestamp); | |
| 1631 | + } | |
| 1632 | + } | |
| 1633 | + }; | |
| 1634 | + request(fn) { | |
| 1635 | + const id = this.nextId; | |
| 1636 | + this.nextId += 1; | |
| 1637 | + this.callbacks.push(fn); | |
| 1638 | + this.callbacksCount += 1; | |
| 1639 | + const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); | |
| 1640 | + if (!this.isScheduled || didRAFChange) { | |
| 1641 | + requestAnimationFrame(this.tick); | |
| 1642 | + this.isScheduled = true; | |
| 1643 | + } | |
| 1644 | + return id; | |
| 1645 | + } | |
| 1646 | + cancel(id) { | |
| 1647 | + const index2 = id - this.startId; | |
| 1648 | + if (index2 < 0 || index2 >= this.callbacks.length) { | |
| 1649 | + return; | |
| 1650 | + } | |
| 1651 | + if (this.callbacks[index2] === null) { | |
| 1652 | + return; | |
| 1653 | + } | |
| 1654 | + this.callbacks[index2] = null; | |
| 1655 | + this.callbacksCount -= 1; | |
| 1656 | + } | |
| 1657 | + }; | |
| 1658 | + var scheduler = new Scheduler(); | |
| 1659 | + var AnimationFrame = class _AnimationFrame { | |
| 1660 | + static create() { | |
| 1661 | + return new _AnimationFrame(); | |
| 1662 | + } | |
| 1663 | + static request(fn) { | |
| 1664 | + return scheduler.request(fn); | |
| 1665 | + } | |
| 1666 | + static cancel(id) { | |
| 1667 | + return scheduler.cancel(id); | |
| 1668 | + } | |
| 1669 | + currentId = EMPTY; | |
| 1670 | + /** | |
| 1671 | + * Executes `fn` after `delay`, clearing any previously scheduled call. | |
| 1672 | + */ | |
| 1673 | + request(fn) { | |
| 1674 | + this.cancel(); | |
| 1675 | + this.currentId = scheduler.request(() => { | |
| 1676 | + this.currentId = EMPTY; | |
| 1677 | + fn(); | |
| 1242 | 1678 | }); |
| 1243 | 1679 | } |
| 1244 | - ); | |
| 1680 | + cancel = () => { | |
| 1681 | + if (this.currentId !== EMPTY) { | |
| 1682 | + scheduler.cancel(this.currentId); | |
| 1683 | + this.currentId = EMPTY; | |
| 1684 | + } | |
| 1685 | + }; | |
| 1686 | + disposeEffect = () => { | |
| 1687 | + return this.cancel; | |
| 1688 | + }; | |
| 1689 | + }; | |
| 1690 | + function useAnimationFrame() { | |
| 1691 | + const timeout = useRefWithInit(AnimationFrame.create).current; | |
| 1692 | + useOnMount(timeout.disposeEffect); | |
| 1693 | + return timeout; | |
| 1694 | + } | |
| 1245 | 1695 | |
| 1246 | - // packages/icons/build-module/library/star-empty.mjs | |
| 1247 | - var import_primitives = __toESM(require_primitives(), 1); | |
| 1696 | + // node_modules/@base-ui/react/internals/useTransitionStatus.mjs | |
| 1697 | + function useTransitionStatus(open2, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) { | |
| 1698 | + const [transitionStatus, setTransitionStatus] = React9.useState(open2 && enableIdleState ? "idle" : void 0); | |
| 1699 | + const [mounted, setMounted] = React9.useState(open2 && !animateInitialOpen); | |
| 1700 | + if (open2 && !mounted) { | |
| 1701 | + setMounted(true); | |
| 1702 | + setTransitionStatus("starting"); | |
| 1703 | + } | |
| 1704 | + if (!open2 && mounted && transitionStatus !== "ending" && !deferEndingState) { | |
| 1705 | + setTransitionStatus("ending"); | |
| 1706 | + } | |
| 1707 | + if (!open2 && !mounted && transitionStatus === "ending") { | |
| 1708 | + setTransitionStatus(void 0); | |
| 1709 | + } | |
| 1710 | + useIsoLayoutEffect(() => { | |
| 1711 | + if (!open2 && mounted && transitionStatus !== "ending" && deferEndingState) { | |
| 1712 | + const frame = AnimationFrame.request(() => { | |
| 1713 | + setTransitionStatus("ending"); | |
| 1714 | + }); | |
| 1715 | + return () => { | |
| 1716 | + AnimationFrame.cancel(frame); | |
| 1717 | + }; | |
| 1718 | + } | |
| 1719 | + return void 0; | |
| 1720 | + }, [open2, mounted, transitionStatus, deferEndingState]); | |
| 1721 | + useIsoLayoutEffect(() => { | |
| 1722 | + if (!open2 || enableIdleState) { | |
| 1723 | + return void 0; | |
| 1724 | + } | |
| 1725 | + const frame = AnimationFrame.request(() => { | |
| 1726 | + setTransitionStatus(void 0); | |
| 1727 | + }); | |
| 1728 | + return () => { | |
| 1729 | + AnimationFrame.cancel(frame); | |
| 1730 | + }; | |
| 1731 | + }, [enableIdleState, open2]); | |
| 1732 | + useIsoLayoutEffect(() => { | |
| 1733 | + if (!open2 || !enableIdleState) { | |
| 1734 | + return void 0; | |
| 1735 | + } | |
| 1736 | + if (open2 && mounted && transitionStatus !== "idle") { | |
| 1737 | + setTransitionStatus("starting"); | |
| 1738 | + } | |
| 1739 | + const frame = AnimationFrame.request(() => { | |
| 1740 | + setTransitionStatus("idle"); | |
| 1741 | + }); | |
| 1742 | + return () => { | |
| 1743 | + AnimationFrame.cancel(frame); | |
| 1744 | + }; | |
| 1745 | + }, [enableIdleState, open2, mounted, transitionStatus]); | |
| 1746 | + return { | |
| 1747 | + mounted, | |
| 1748 | + setMounted, | |
| 1749 | + transitionStatus | |
| 1750 | + }; | |
| 1751 | + } | |
| 1752 | + | |
| 1753 | + // node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs | |
| 1754 | + var startingStyle = "data-starting-style"; | |
| 1755 | + var endingStyle = "data-ending-style"; | |
| 1756 | + | |
| 1757 | + // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs | |
| 1758 | + var STARTING_HOOK = { | |
| 1759 | + [startingStyle]: "" | |
| 1760 | + }; | |
| 1761 | + var ENDING_HOOK = { | |
| 1762 | + [endingStyle]: "" | |
| 1763 | + }; | |
| 1764 | + var transitionStatusMapping = { | |
| 1765 | + transitionStatus(value) { | |
| 1766 | + if (value === "starting") { | |
| 1767 | + return STARTING_HOOK; | |
| 1768 | + } | |
| 1769 | + if (value === "ending") { | |
| 1770 | + return ENDING_HOOK; | |
| 1771 | + } | |
| 1772 | + return null; | |
| 1773 | + } | |
| 1774 | + }; | |
| 1775 | + | |
| 1776 | + // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs | |
| 1777 | + function hasWindow() { | |
| 1778 | + return typeof window !== "undefined"; | |
| 1779 | + } | |
| 1780 | + function getNodeName(node) { | |
| 1781 | + if (isNode(node)) { | |
| 1782 | + return (node.nodeName || "").toLowerCase(); | |
| 1783 | + } | |
| 1784 | + return "#document"; | |
| 1785 | + } | |
| 1786 | + function getWindow(node) { | |
| 1787 | + var _node$ownerDocument; | |
| 1788 | + return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; | |
| 1789 | + } | |
| 1790 | + function getDocumentElement(node) { | |
| 1791 | + var _ref; | |
| 1792 | + return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; | |
| 1793 | + } | |
| 1794 | + function isNode(value) { | |
| 1795 | + if (!hasWindow()) { | |
| 1796 | + return false; | |
| 1797 | + } | |
| 1798 | + return value instanceof Node || value instanceof getWindow(value).Node; | |
| 1799 | + } | |
| 1800 | + function isElement(value) { | |
| 1801 | + if (!hasWindow()) { | |
| 1802 | + return false; | |
| 1803 | + } | |
| 1804 | + return value instanceof Element || value instanceof getWindow(value).Element; | |
| 1805 | + } | |
| 1806 | + function isHTMLElement(value) { | |
| 1807 | + if (!hasWindow()) { | |
| 1808 | + return false; | |
| 1809 | + } | |
| 1810 | + return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; | |
| 1811 | + } | |
| 1812 | + function isShadowRoot(value) { | |
| 1813 | + if (!hasWindow() || typeof ShadowRoot === "undefined") { | |
| 1814 | + return false; | |
| 1815 | + } | |
| 1816 | + return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; | |
| 1817 | + } | |
| 1818 | + function isOverflowElement(element) { | |
| 1819 | + const { | |
| 1820 | + overflow, | |
| 1821 | + overflowX, | |
| 1822 | + overflowY, | |
| 1823 | + display | |
| 1824 | + } = getComputedStyle2(element); | |
| 1825 | + return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; | |
| 1826 | + } | |
| 1827 | + function isTableElement(element) { | |
| 1828 | + return /^(table|td|th)$/.test(getNodeName(element)); | |
| 1829 | + } | |
| 1830 | + function isTopLayer(element) { | |
| 1831 | + try { | |
| 1832 | + if (element.matches(":popover-open")) { | |
| 1833 | + return true; | |
| 1834 | + } | |
| 1835 | + } catch (_e) { | |
| 1836 | + } | |
| 1837 | + try { | |
| 1838 | + return element.matches(":modal"); | |
| 1839 | + } catch (_e) { | |
| 1840 | + return false; | |
| 1841 | + } | |
| 1842 | + } | |
| 1843 | + var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; | |
| 1844 | + var containRe = /paint|layout|strict|content/; | |
| 1845 | + var isNotNone = (value) => !!value && value !== "none"; | |
| 1846 | + var isWebKitValue; | |
| 1847 | + function isContainingBlock(elementOrCss) { | |
| 1848 | + const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; | |
| 1849 | + 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 || ""); | |
| 1850 | + } | |
| 1851 | + function getContainingBlock(element) { | |
| 1852 | + let currentNode = getParentNode(element); | |
| 1853 | + while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { | |
| 1854 | + if (isContainingBlock(currentNode)) { | |
| 1855 | + return currentNode; | |
| 1856 | + } else if (isTopLayer(currentNode)) { | |
| 1857 | + return null; | |
| 1858 | + } | |
| 1859 | + currentNode = getParentNode(currentNode); | |
| 1860 | + } | |
| 1861 | + return null; | |
| 1862 | + } | |
| 1863 | + function isWebKit() { | |
| 1864 | + if (isWebKitValue == null) { | |
| 1865 | + isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); | |
| 1866 | + } | |
| 1867 | + return isWebKitValue; | |
| 1868 | + } | |
| 1869 | + function isLastTraversableNode(node) { | |
| 1870 | + return /^(html|body|#document)$/.test(getNodeName(node)); | |
| 1871 | + } | |
| 1872 | + function getComputedStyle2(element) { | |
| 1873 | + return getWindow(element).getComputedStyle(element); | |
| 1874 | + } | |
| 1875 | + function getNodeScroll(element) { | |
| 1876 | + if (isElement(element)) { | |
| 1877 | + return { | |
| 1878 | + scrollLeft: element.scrollLeft, | |
| 1879 | + scrollTop: element.scrollTop | |
| 1880 | + }; | |
| 1881 | + } | |
| 1882 | + return { | |
| 1883 | + scrollLeft: element.scrollX, | |
| 1884 | + scrollTop: element.scrollY | |
| 1885 | + }; | |
| 1886 | + } | |
| 1887 | + function getParentNode(node) { | |
| 1888 | + if (getNodeName(node) === "html") { | |
| 1889 | + return node; | |
| 1890 | + } | |
| 1891 | + const result = ( | |
| 1892 | + // Step into the shadow DOM of the parent of a slotted node. | |
| 1893 | + node.assignedSlot || // DOM Element detected. | |
| 1894 | + node.parentNode || // ShadowRoot detected. | |
| 1895 | + isShadowRoot(node) && node.host || // Fallback. | |
| 1896 | + getDocumentElement(node) | |
| 1897 | + ); | |
| 1898 | + return isShadowRoot(result) ? result.host : result; | |
| 1899 | + } | |
| 1900 | + function getNearestOverflowAncestor(node) { | |
| 1901 | + const parentNode = getParentNode(node); | |
| 1902 | + if (isLastTraversableNode(parentNode)) { | |
| 1903 | + return (node.ownerDocument || node).body; | |
| 1904 | + } | |
| 1905 | + if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { | |
| 1906 | + return parentNode; | |
| 1907 | + } | |
| 1908 | + return getNearestOverflowAncestor(parentNode); | |
| 1909 | + } | |
| 1910 | + function getOverflowAncestors(node, list, traverseIframes) { | |
| 1911 | + var _node$ownerDocument2; | |
| 1912 | + if (list === void 0) { | |
| 1913 | + list = []; | |
| 1914 | + } | |
| 1915 | + if (traverseIframes === void 0) { | |
| 1916 | + traverseIframes = true; | |
| 1917 | + } | |
| 1918 | + const scrollableAncestor = getNearestOverflowAncestor(node); | |
| 1919 | + const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); | |
| 1920 | + const win = getWindow(scrollableAncestor); | |
| 1921 | + if (isBody) { | |
| 1922 | + const frameElement = getFrameElement(win); | |
| 1923 | + return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); | |
| 1924 | + } else { | |
| 1925 | + return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); | |
| 1926 | + } | |
| 1927 | + } | |
| 1928 | + function getFrameElement(win) { | |
| 1929 | + return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; | |
| 1930 | + } | |
| 1931 | + | |
| 1932 | + // node_modules/@base-ui/utils/owner.mjs | |
| 1933 | + function ownerDocument(node) { | |
| 1934 | + return node?.ownerDocument || document; | |
| 1935 | + } | |
| 1936 | + | |
| 1937 | + // node_modules/@base-ui/utils/addEventListener.mjs | |
| 1938 | + function addEventListener(target, type, listener, options) { | |
| 1939 | + target.addEventListener(type, listener, options); | |
| 1940 | + return () => { | |
| 1941 | + target.removeEventListener(type, listener, options); | |
| 1942 | + }; | |
| 1943 | + } | |
| 1944 | + | |
| 1945 | + // node_modules/@base-ui/utils/useValueAsRef.mjs | |
| 1946 | + function useValueAsRef(value) { | |
| 1947 | + const latest = useRefWithInit(createLatestRef, value).current; | |
| 1948 | + latest.next = value; | |
| 1949 | + useIsoLayoutEffect(latest.effect); | |
| 1950 | + return latest; | |
| 1951 | + } | |
| 1952 | + function createLatestRef(value) { | |
| 1953 | + const latest = { | |
| 1954 | + current: value, | |
| 1955 | + next: value, | |
| 1956 | + effect: () => { | |
| 1957 | + latest.current = latest.next; | |
| 1958 | + } | |
| 1959 | + }; | |
| 1960 | + return latest; | |
| 1961 | + } | |
| 1962 | + | |
| 1963 | + // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs | |
| 1964 | + var React10 = __toESM(require_react(), 1); | |
| 1965 | + | |
| 1966 | + // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs | |
| 1967 | + var ReactDOM = __toESM(require_react_dom(), 1); | |
| 1968 | + | |
| 1969 | + // node_modules/@base-ui/react/utils/resolveRef.mjs | |
| 1970 | + function resolveRef(maybeRef) { | |
| 1971 | + if (maybeRef == null) { | |
| 1972 | + return maybeRef; | |
| 1973 | + } | |
| 1974 | + return "current" in maybeRef ? maybeRef.current : maybeRef; | |
| 1975 | + } | |
| 1976 | + | |
| 1977 | + // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs | |
| 1978 | + var pendingCallbacks = null; | |
| 1979 | + function flushBeforePaint(fn) { | |
| 1980 | + if (!pendingCallbacks) { | |
| 1981 | + const callbacks = []; | |
| 1982 | + pendingCallbacks = callbacks; | |
| 1983 | + queueMicrotask(() => { | |
| 1984 | + pendingCallbacks = null; | |
| 1985 | + ReactDOM.flushSync(() => { | |
| 1986 | + for (const callback of callbacks) { | |
| 1987 | + callback(); | |
| 1988 | + } | |
| 1989 | + }); | |
| 1990 | + }); | |
| 1991 | + } | |
| 1992 | + pendingCallbacks.push(fn); | |
| 1993 | + } | |
| 1994 | + function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch = false) { | |
| 1995 | + const frame = useAnimationFrame(); | |
| 1996 | + return useStableCallback((fnToExecute, signal = null) => { | |
| 1997 | + frame.cancel(); | |
| 1998 | + const element = resolveRef(elementOrRef); | |
| 1999 | + if (element == null) { | |
| 2000 | + return; | |
| 2001 | + } | |
| 2002 | + const resolvedElement = element; | |
| 2003 | + const done = () => { | |
| 2004 | + if (!batch) { | |
| 2005 | + ReactDOM.flushSync(fnToExecute); | |
| 2006 | + return; | |
| 2007 | + } | |
| 2008 | + flushBeforePaint(() => { | |
| 2009 | + if (!signal?.aborted) { | |
| 2010 | + fnToExecute(); | |
| 2011 | + } | |
| 2012 | + }); | |
| 2013 | + }; | |
| 2014 | + if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { | |
| 2015 | + fnToExecute(); | |
| 2016 | + return; | |
| 2017 | + } | |
| 2018 | + function exec() { | |
| 2019 | + Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { | |
| 2020 | + if (!signal?.aborted) { | |
| 2021 | + done(); | |
| 2022 | + } | |
| 2023 | + }, () => { | |
| 2024 | + if (signal?.aborted) { | |
| 2025 | + return; | |
| 2026 | + } | |
| 2027 | + const currentAnimations = resolvedElement.getAnimations(); | |
| 2028 | + if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { | |
| 2029 | + exec(); | |
| 2030 | + return; | |
| 2031 | + } | |
| 2032 | + done(); | |
| 2033 | + }); | |
| 2034 | + } | |
| 2035 | + if (waitForStartingStyleRemoved) { | |
| 2036 | + const startingStyleAttribute = startingStyle; | |
| 2037 | + if (!resolvedElement.hasAttribute(startingStyleAttribute)) { | |
| 2038 | + frame.request(exec); | |
| 2039 | + return; | |
| 2040 | + } | |
| 2041 | + const attributeObserver = new MutationObserver(() => { | |
| 2042 | + if (!resolvedElement.hasAttribute(startingStyleAttribute)) { | |
| 2043 | + attributeObserver.disconnect(); | |
| 2044 | + exec(); | |
| 2045 | + } | |
| 2046 | + }); | |
| 2047 | + attributeObserver.observe(resolvedElement, { | |
| 2048 | + attributes: true, | |
| 2049 | + attributeFilter: [startingStyleAttribute] | |
| 2050 | + }); | |
| 2051 | + signal?.addEventListener("abort", () => attributeObserver.disconnect(), { | |
| 2052 | + once: true | |
| 2053 | + }); | |
| 2054 | + return; | |
| 2055 | + } | |
| 2056 | + frame.request(exec); | |
| 2057 | + }); | |
| 2058 | + } | |
| 2059 | + | |
| 2060 | + // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs | |
| 2061 | + function useOpenChangeComplete(parameters) { | |
| 2062 | + const { | |
| 2063 | + enabled = true, | |
| 2064 | + open: open2, | |
| 2065 | + ref, | |
| 2066 | + batch = false, | |
| 2067 | + onComplete: onCompleteParam | |
| 2068 | + } = parameters; | |
| 2069 | + const onComplete = useStableCallback(onCompleteParam); | |
| 2070 | + const runOnceAnimationsFinish = useAnimationsFinished(ref, open2, batch); | |
| 2071 | + React10.useEffect(() => { | |
| 2072 | + if (!enabled) { | |
| 2073 | + return void 0; | |
| 2074 | + } | |
| 2075 | + const abortController = new AbortController(); | |
| 2076 | + runOnceAnimationsFinish(onComplete, abortController.signal); | |
| 2077 | + return () => { | |
| 2078 | + abortController.abort(); | |
| 2079 | + }; | |
| 2080 | + }, [enabled, open2, onComplete, runOnceAnimationsFinish]); | |
| 2081 | + } | |
| 2082 | + | |
| 2083 | + // node_modules/@base-ui/utils/platform/parts.mjs | |
| 2084 | + var parts_exports = {}; | |
| 2085 | + __export(parts_exports, { | |
| 2086 | + engine: () => engine_exports, | |
| 2087 | + env: () => env_exports, | |
| 2088 | + mediaQuery: () => media_query_exports, | |
| 2089 | + os: () => os_exports, | |
| 2090 | + screenReader: () => screen_reader_exports | |
| 2091 | + }); | |
| 2092 | + | |
| 2093 | + // node_modules/@base-ui/utils/platform/os.mjs | |
| 2094 | + var os_exports = {}; | |
| 2095 | + __export(os_exports, { | |
| 2096 | + android: () => android, | |
| 2097 | + apple: () => apple, | |
| 2098 | + ios: () => ios, | |
| 2099 | + linux: () => linux, | |
| 2100 | + mac: () => mac, | |
| 2101 | + windows: () => windows | |
| 2102 | + }); | |
| 2103 | + | |
| 2104 | + // node_modules/@base-ui/utils/platform/shared.mjs | |
| 2105 | + function readRawData() { | |
| 2106 | + if (typeof navigator === "undefined") { | |
| 2107 | + return { | |
| 2108 | + userAgent: "", | |
| 2109 | + platform: "", | |
| 2110 | + maxTouchPoints: 0 | |
| 2111 | + }; | |
| 2112 | + } | |
| 2113 | + if (true) { | |
| 2114 | + const uaData = navigator.userAgentData; | |
| 2115 | + if (uaData && Array.isArray(uaData.brands)) { | |
| 2116 | + return { | |
| 2117 | + userAgent: uaData.brands.map(({ | |
| 2118 | + brand, | |
| 2119 | + version: version2 | |
| 2120 | + }) => `${brand}/${version2}`).join(" "), | |
| 2121 | + platform: uaData.platform ?? navigator.platform ?? "", | |
| 2122 | + maxTouchPoints: navigator.maxTouchPoints ?? 0 | |
| 2123 | + }; | |
| 2124 | + } | |
| 2125 | + } | |
| 2126 | + return { | |
| 2127 | + userAgent: navigator.userAgent, | |
| 2128 | + platform: navigator.platform ?? "", | |
| 2129 | + maxTouchPoints: navigator.maxTouchPoints ?? 0 | |
| 2130 | + }; | |
| 2131 | + } | |
| 2132 | + var { | |
| 2133 | + userAgent, | |
| 2134 | + platform, | |
| 2135 | + maxTouchPoints | |
| 2136 | + } = readRawData(); | |
| 2137 | + var lowerUserAgent = userAgent.toLowerCase(); | |
| 2138 | + var lowerPlatform = platform.toLowerCase(); | |
| 2139 | + | |
| 2140 | + // node_modules/@base-ui/utils/platform/os.mjs | |
| 2141 | + var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1; | |
| 2142 | + var ANDROID_STRING = "android"; | |
| 2143 | + var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING); | |
| 2144 | + var mac = !ios && lowerPlatform.startsWith("mac"); | |
| 2145 | + var windows = lowerPlatform.startsWith("win"); | |
| 2146 | + var linux = !android && /^(linux|chrome os)/.test(lowerPlatform); | |
| 2147 | + var apple = mac || ios; | |
| 2148 | + | |
| 2149 | + // node_modules/@base-ui/utils/platform/engine.mjs | |
| 2150 | + var engine_exports = {}; | |
| 2151 | + __export(engine_exports, { | |
| 2152 | + blink: () => blink, | |
| 2153 | + gecko: () => gecko, | |
| 2154 | + webkit: () => webkit | |
| 2155 | + }); | |
| 2156 | + var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none"); | |
| 2157 | + var gecko = !webkit && lowerUserAgent.includes("firefox"); | |
| 2158 | + var blink = !webkit && lowerUserAgent.includes("chrom"); | |
| 2159 | + | |
| 2160 | + // node_modules/@base-ui/utils/platform/screen-reader.mjs | |
| 2161 | + var screen_reader_exports = {}; | |
| 2162 | + __export(screen_reader_exports, { | |
| 2163 | + voiceOver: () => voiceOver | |
| 2164 | + }); | |
| 2165 | + var voiceOver = apple; | |
| 2166 | + | |
| 2167 | + // node_modules/@base-ui/utils/platform/env.mjs | |
| 2168 | + var env_exports = {}; | |
| 2169 | + __export(env_exports, { | |
| 2170 | + jsdom: () => jsdom | |
| 2171 | + }); | |
| 2172 | + var jsdom = /jsdom|happydom/.test(lowerUserAgent); | |
| 2173 | + | |
| 2174 | + // node_modules/@base-ui/utils/platform/media-query.mjs | |
| 2175 | + var media_query_exports = {}; | |
| 2176 | + __export(media_query_exports, { | |
| 2177 | + iOS: () => iOS | |
| 2178 | + }); | |
| 2179 | + var iOS = "@supports (-webkit-touch-callout: none)"; | |
| 2180 | + | |
| 2181 | + // node_modules/@base-ui/utils/useTimeout.mjs | |
| 2182 | + var EMPTY2 = 0; | |
| 2183 | + var Timeout = class _Timeout { | |
| 2184 | + static create() { | |
| 2185 | + return new _Timeout(); | |
| 2186 | + } | |
| 2187 | + currentId = EMPTY2; | |
| 2188 | + /** | |
| 2189 | + * Executes `fn` after `delay`, clearing any previously scheduled call. | |
| 2190 | + */ | |
| 2191 | + start(delay, fn) { | |
| 2192 | + this.clear(); | |
| 2193 | + this.currentId = setTimeout(() => { | |
| 2194 | + this.currentId = EMPTY2; | |
| 2195 | + fn(); | |
| 2196 | + }, delay); | |
| 2197 | + } | |
| 2198 | + isStarted() { | |
| 2199 | + return this.currentId !== EMPTY2; | |
| 2200 | + } | |
| 2201 | + clear = () => { | |
| 2202 | + if (this.currentId !== EMPTY2) { | |
| 2203 | + clearTimeout(this.currentId); | |
| 2204 | + this.currentId = EMPTY2; | |
| 2205 | + } | |
| 2206 | + }; | |
| 2207 | + disposeEffect = () => { | |
| 2208 | + return this.clear; | |
| 2209 | + }; | |
| 2210 | + }; | |
| 2211 | + function useTimeout() { | |
| 2212 | + const timeout = useRefWithInit(Timeout.create).current; | |
| 2213 | + useOnMount(timeout.disposeEffect); | |
| 2214 | + return timeout; | |
| 2215 | + } | |
| 2216 | + | |
| 2217 | + // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs | |
| 2218 | + var React11 = __toESM(require_react(), 1); | |
| 2219 | + | |
| 2220 | + // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs | |
| 2221 | + function isReactEvent(event) { | |
| 2222 | + return "nativeEvent" in event; | |
| 2223 | + } | |
| 2224 | + function isVirtualClick(event) { | |
| 2225 | + if (event.pointerType === "" && event.isTrusted) { | |
| 2226 | + return true; | |
| 2227 | + } | |
| 2228 | + if (parts_exports.os.android && event.pointerType) { | |
| 2229 | + return event.type === "click" && event.buttons === 1; | |
| 2230 | + } | |
| 2231 | + return event.detail === 0 && !event.pointerType; | |
| 2232 | + } | |
| 2233 | + function isMouseLikePointerType(pointerType, strict) { | |
| 2234 | + const values = ["mouse", "pen"]; | |
| 2235 | + if (!strict) { | |
| 2236 | + values.push("", void 0); | |
| 2237 | + } | |
| 2238 | + return values.includes(pointerType); | |
| 2239 | + } | |
| 2240 | + function isClickLikeEvent(event) { | |
| 2241 | + const type = event.type; | |
| 2242 | + return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; | |
| 2243 | + } | |
| 2244 | + | |
| 2245 | + // node_modules/@base-ui/utils/shadowDom.mjs | |
| 2246 | + function activeElement(doc) { | |
| 2247 | + let element = doc.activeElement; | |
| 2248 | + while (element?.shadowRoot?.activeElement != null) { | |
| 2249 | + element = element.shadowRoot.activeElement; | |
| 2250 | + } | |
| 2251 | + return element; | |
| 2252 | + } | |
| 2253 | + function contains(parent, child) { | |
| 2254 | + if (!parent || !child) { | |
| 2255 | + return false; | |
| 2256 | + } | |
| 2257 | + const rootNode = child.getRootNode?.(); | |
| 2258 | + if (parent.contains(child)) { | |
| 2259 | + return true; | |
| 2260 | + } | |
| 2261 | + if (rootNode && isShadowRoot(rootNode)) { | |
| 2262 | + let next = child; | |
| 2263 | + while (next) { | |
| 2264 | + if (parent === next) { | |
| 2265 | + return true; | |
| 2266 | + } | |
| 2267 | + next = next.parentNode || next.host; | |
| 2268 | + } | |
| 2269 | + } | |
| 2270 | + return false; | |
| 2271 | + } | |
| 2272 | + function getTarget(event) { | |
| 2273 | + if ("composedPath" in event) { | |
| 2274 | + return event.composedPath()[0] ?? event.target; | |
| 2275 | + } | |
| 2276 | + return event.target; | |
| 2277 | + } | |
| 2278 | + | |
| 2279 | + // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs | |
| 2280 | + var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; | |
| 2281 | + var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; | |
| 2282 | + | |
| 2283 | + // node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs | |
| 2284 | + var open = "data-open"; | |
| 2285 | + var closed = "data-closed"; | |
| 2286 | + var anchorHidden = "data-anchor-hidden"; | |
| 2287 | + | |
| 2288 | + // node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs | |
| 2289 | + var CommonTriggerDataAttributes_exports = {}; | |
| 2290 | + __export(CommonTriggerDataAttributes_exports, { | |
| 2291 | + popupOpen: () => popupOpen, | |
| 2292 | + pressed: () => pressed | |
| 2293 | + }); | |
| 2294 | + var popupOpen = "data-popup-open"; | |
| 2295 | + var pressed = "data-pressed"; | |
| 2296 | + | |
| 2297 | + // node_modules/@base-ui/react/utils/popupStateMapping.mjs | |
| 2298 | + var TRIGGER_HOOK = { | |
| 2299 | + [popupOpen]: "" | |
| 2300 | + }; | |
| 2301 | + var PRESSABLE_TRIGGER_HOOK = { | |
| 2302 | + [popupOpen]: "", | |
| 2303 | + [pressed]: "" | |
| 2304 | + }; | |
| 2305 | + var POPUP_OPEN_HOOK = { | |
| 2306 | + [open]: "" | |
| 2307 | + }; | |
| 2308 | + var POPUP_CLOSED_HOOK = { | |
| 2309 | + [closed]: "" | |
| 2310 | + }; | |
| 2311 | + var ANCHOR_HIDDEN_HOOK = { | |
| 2312 | + [anchorHidden]: "" | |
| 2313 | + }; | |
| 2314 | + var triggerOpenStateMapping = { | |
| 2315 | + open(value) { | |
| 2316 | + if (value) { | |
| 2317 | + return TRIGGER_HOOK; | |
| 2318 | + } | |
| 2319 | + return null; | |
| 2320 | + } | |
| 2321 | + }; | |
| 2322 | + var popupStateMapping = { | |
| 2323 | + open(value) { | |
| 2324 | + if (value) { | |
| 2325 | + return POPUP_OPEN_HOOK; | |
| 2326 | + } | |
| 2327 | + return POPUP_CLOSED_HOOK; | |
| 2328 | + }, | |
| 2329 | + anchorHidden(value) { | |
| 2330 | + if (value) { | |
| 2331 | + return ANCHOR_HIDDEN_HOOK; | |
| 2332 | + } | |
| 2333 | + return null; | |
| 2334 | + } | |
| 2335 | + }; | |
| 2336 | + var popupTransitionStateMapping = { | |
| 2337 | + ...popupStateMapping, | |
| 2338 | + ...transitionStatusMapping | |
| 2339 | + }; | |
| 2340 | + | |
| 2341 | + // node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs | |
| 2342 | + var popupOpen2 = CommonTriggerDataAttributes_exports.popupOpen; | |
| 2343 | + var triggerDisabled = "data-trigger-disabled"; | |
| 2344 | + | |
| 2345 | + // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs | |
| 2346 | + function isTargetInsideEnabledTrigger(target, triggerElements) { | |
| 2347 | + if (!isElement(target)) { | |
| 2348 | + return false; | |
| 2349 | + } | |
| 2350 | + const targetElement = target; | |
| 2351 | + if (triggerElements.hasElement(targetElement)) { | |
| 2352 | + return !targetElement.hasAttribute(triggerDisabled); | |
| 2353 | + } | |
| 2354 | + for (const [, trigger] of triggerElements.entries()) { | |
| 2355 | + if (contains(trigger, targetElement)) { | |
| 2356 | + return !trigger.hasAttribute(triggerDisabled); | |
| 2357 | + } | |
| 2358 | + } | |
| 2359 | + return false; | |
| 2360 | + } | |
| 2361 | + function isEventTargetWithin(event, node) { | |
| 2362 | + if (node == null) { | |
| 2363 | + return false; | |
| 2364 | + } | |
| 2365 | + if ("composedPath" in event) { | |
| 2366 | + return event.composedPath().includes(node); | |
| 2367 | + } | |
| 2368 | + const eventAgain = event; | |
| 2369 | + return eventAgain.target != null && node.contains(eventAgain.target); | |
| 2370 | + } | |
| 2371 | + function isRootElement(element) { | |
| 2372 | + return element.matches("html,body"); | |
| 2373 | + } | |
| 2374 | + function isTypeableElement(element) { | |
| 2375 | + return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); | |
| 2376 | + } | |
| 2377 | + function isInteractiveElement(element) { | |
| 2378 | + return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null; | |
| 2379 | + } | |
| 2380 | + function matchesFocusVisible(element) { | |
| 2381 | + if (!element || parts_exports.env.jsdom) { | |
| 2382 | + return true; | |
| 2383 | + } | |
| 2384 | + try { | |
| 2385 | + return element.matches(":focus-visible"); | |
| 2386 | + } catch (_e) { | |
| 2387 | + return true; | |
| 2388 | + } | |
| 2389 | + } | |
| 2390 | + | |
| 2391 | + // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs | |
| 2392 | + function resolveValue(value, pointerType) { | |
| 2393 | + if (pointerType != null && !isMouseLikePointerType(pointerType)) { | |
| 2394 | + return 0; | |
| 2395 | + } | |
| 2396 | + if (typeof value === "function") { | |
| 2397 | + return value(); | |
| 2398 | + } | |
| 2399 | + return value; | |
| 2400 | + } | |
| 2401 | + function getDelay(value, prop, pointerType) { | |
| 2402 | + const result = resolveValue(value, pointerType); | |
| 2403 | + if (typeof result === "number") { | |
| 2404 | + return result; | |
| 2405 | + } | |
| 2406 | + return result?.[prop]; | |
| 2407 | + } | |
| 2408 | + function getRestMs(value) { | |
| 2409 | + if (typeof value === "function") { | |
| 2410 | + return value(); | |
| 2411 | + } | |
| 2412 | + return value; | |
| 2413 | + } | |
| 2414 | + function isClickLikeOpenEvent(openEventType, interactedInside) { | |
| 2415 | + return interactedInside || openEventType === "click" || openEventType === "mousedown"; | |
| 2416 | + } | |
| 2417 | + function isHoverOpenEvent(openEventType) { | |
| 2418 | + return openEventType?.includes("mouse") && openEventType !== "mousedown"; | |
| 2419 | + } | |
| 2420 | + | |
| 2421 | + // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs | |
| 1248 | 2422 | var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); |
| 1249 | - var star_empty_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z" }) }); | |
| 2423 | + var FloatingDelayGroupContext = /* @__PURE__ */ React11.createContext({ | |
| 2424 | + hasProvider: false, | |
| 2425 | + timeoutMs: 0, | |
| 2426 | + delayRef: { | |
| 2427 | + current: 0 | |
| 2428 | + }, | |
| 2429 | + initialDelayRef: { | |
| 2430 | + current: 0 | |
| 2431 | + }, | |
| 2432 | + timeout: new Timeout(), | |
| 2433 | + currentIdRef: { | |
| 2434 | + current: null | |
| 2435 | + }, | |
| 2436 | + currentContextRef: { | |
| 2437 | + current: null | |
| 2438 | + } | |
| 2439 | + }); | |
| 2440 | + if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; | |
| 2441 | + function resetDelayRef(delayRef, initialDelayRef) { | |
| 2442 | + delayRef.current = initialDelayRef.current; | |
| 2443 | + } | |
| 2444 | + function FloatingDelayGroup(props) { | |
| 2445 | + const { | |
| 2446 | + children, | |
| 2447 | + delay, | |
| 2448 | + timeoutMs = 0 | |
| 2449 | + } = props; | |
| 2450 | + const delayRef = React11.useRef(delay); | |
| 2451 | + const initialDelayRef = React11.useRef(delay); | |
| 2452 | + const currentIdRef = React11.useRef(null); | |
| 2453 | + const currentContextRef = React11.useRef(null); | |
| 2454 | + const timeout = useTimeout(); | |
| 2455 | + useIsoLayoutEffect(() => { | |
| 2456 | + initialDelayRef.current = delay; | |
| 2457 | + if (!currentIdRef.current) { | |
| 2458 | + delayRef.current = delay; | |
| 2459 | + return; | |
| 2460 | + } | |
| 2461 | + delayRef.current = { | |
| 2462 | + open: getDelay(delayRef.current, "open"), | |
| 2463 | + close: getDelay(delay, "close") | |
| 2464 | + }; | |
| 2465 | + }, [delay, currentIdRef, delayRef, initialDelayRef]); | |
| 2466 | + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, { | |
| 2467 | + value: React11.useMemo(() => ({ | |
| 2468 | + hasProvider: true, | |
| 2469 | + delayRef, | |
| 2470 | + initialDelayRef, | |
| 2471 | + currentIdRef, | |
| 2472 | + timeoutMs, | |
| 2473 | + currentContextRef, | |
| 2474 | + timeout | |
| 2475 | + }), [timeoutMs, timeout]), | |
| 2476 | + children | |
| 2477 | + }); | |
| 2478 | + } | |
| 2479 | + function useDelayGroup(context, options = { | |
| 2480 | + open: false | |
| 2481 | + }) { | |
| 2482 | + const { | |
| 2483 | + open: open2 | |
| 2484 | + } = options; | |
| 2485 | + const store2 = "rootStore" in context ? context.rootStore : context; | |
| 2486 | + const floatingId = store2.useState("floatingId"); | |
| 2487 | + const groupContext = React11.useContext(FloatingDelayGroupContext); | |
| 2488 | + const { | |
| 2489 | + currentIdRef, | |
| 2490 | + delayRef, | |
| 2491 | + timeoutMs, | |
| 2492 | + initialDelayRef, | |
| 2493 | + currentContextRef, | |
| 2494 | + hasProvider, | |
| 2495 | + timeout | |
| 2496 | + } = groupContext; | |
| 2497 | + const [isInstantPhase, setIsInstantPhase] = React11.useState(false); | |
| 2498 | + const openRef = React11.useRef(open2); | |
| 2499 | + useIsoLayoutEffect(() => { | |
| 2500 | + openRef.current = open2; | |
| 2501 | + }, [open2]); | |
| 2502 | + useIsoLayoutEffect(() => { | |
| 2503 | + function unset() { | |
| 2504 | + currentContextRef.current?.setIsInstantPhase(false); | |
| 2505 | + currentIdRef.current = null; | |
| 2506 | + currentContextRef.current = null; | |
| 2507 | + delayRef.current = initialDelayRef.current; | |
| 2508 | + timeout.clear(); | |
| 2509 | + } | |
| 2510 | + if (!currentIdRef.current) { | |
| 2511 | + return void 0; | |
| 2512 | + } | |
| 2513 | + if (!open2 && currentIdRef.current === floatingId) { | |
| 2514 | + setIsInstantPhase(false); | |
| 2515 | + if (timeoutMs) { | |
| 2516 | + const closingId = floatingId; | |
| 2517 | + timeout.start(timeoutMs, () => { | |
| 2518 | + if (store2.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { | |
| 2519 | + return; | |
| 2520 | + } | |
| 2521 | + unset(); | |
| 2522 | + }); | |
| 2523 | + return () => { | |
| 2524 | + if (openRef.current || currentIdRef.current !== closingId) { | |
| 2525 | + timeout.clear(); | |
| 2526 | + } | |
| 2527 | + }; | |
| 2528 | + } | |
| 2529 | + unset(); | |
| 2530 | + } | |
| 2531 | + return void 0; | |
| 2532 | + }, [open2, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store2]); | |
| 2533 | + useIsoLayoutEffect(() => { | |
| 2534 | + if (!open2) { | |
| 2535 | + return; | |
| 2536 | + } | |
| 2537 | + const prevContext = currentContextRef.current; | |
| 2538 | + const prevId = currentIdRef.current; | |
| 2539 | + timeout.clear(); | |
| 2540 | + currentContextRef.current = { | |
| 2541 | + onOpenChange: store2.setOpen, | |
| 2542 | + setIsInstantPhase | |
| 2543 | + }; | |
| 2544 | + currentIdRef.current = floatingId; | |
| 2545 | + delayRef.current = { | |
| 2546 | + open: 0, | |
| 2547 | + close: getDelay(initialDelayRef.current, "close") | |
| 2548 | + }; | |
| 2549 | + if (prevId !== null && prevId !== floatingId) { | |
| 2550 | + setIsInstantPhase(true); | |
| 2551 | + prevContext?.setIsInstantPhase(true); | |
| 2552 | + prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); | |
| 2553 | + } else { | |
| 2554 | + setIsInstantPhase(false); | |
| 2555 | + prevContext?.setIsInstantPhase(false); | |
| 2556 | + } | |
| 2557 | + }, [open2, floatingId, store2, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); | |
| 2558 | + useIsoLayoutEffect(() => { | |
| 2559 | + return () => { | |
| 2560 | + if (currentIdRef.current === floatingId) { | |
| 2561 | + currentContextRef.current = null; | |
| 2562 | + if (!openRef.current) { | |
| 2563 | + return; | |
| 2564 | + } | |
| 2565 | + currentIdRef.current = null; | |
| 2566 | + resetDelayRef(delayRef, initialDelayRef); | |
| 2567 | + timeout.clear(); | |
| 2568 | + } | |
| 2569 | + }; | |
| 2570 | + }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]); | |
| 2571 | + return React11.useMemo(() => ({ | |
| 2572 | + activeIdRef: currentIdRef, | |
| 2573 | + hasProvider, | |
| 2574 | + delayRef, | |
| 2575 | + isInstantPhase | |
| 2576 | + }), [currentIdRef, hasProvider, delayRef, isInstantPhase]); | |
| 2577 | + } | |
| 1250 | 2578 | |
| 1251 | - // packages/icons/build-module/library/star-filled.mjs | |
| 1252 | - var import_primitives2 = __toESM(require_primitives(), 1); | |
| 2579 | + // node_modules/@base-ui/utils/mergeCleanups.mjs | |
| 2580 | + function mergeCleanups(...cleanups) { | |
| 2581 | + return () => { | |
| 2582 | + for (let i = 0; i < cleanups.length; i += 1) { | |
| 2583 | + const cleanup = cleanups[i]; | |
| 2584 | + if (cleanup) { | |
| 2585 | + cleanup(); | |
| 2586 | + } | |
| 2587 | + } | |
| 2588 | + }; | |
| 2589 | + } | |
| 2590 | + | |
| 2591 | + // node_modules/@base-ui/react/utils/FocusGuard.mjs | |
| 2592 | + var React12 = __toESM(require_react(), 1); | |
| 2593 | + | |
| 2594 | + // node_modules/@base-ui/utils/visuallyHidden.mjs | |
| 2595 | + var visuallyHiddenBase = { | |
| 2596 | + clipPath: "inset(50%)", | |
| 2597 | + overflow: "hidden", | |
| 2598 | + whiteSpace: "nowrap", | |
| 2599 | + border: 0, | |
| 2600 | + padding: 0, | |
| 2601 | + width: 1, | |
| 2602 | + height: 1, | |
| 2603 | + margin: -1 | |
| 2604 | + }; | |
| 2605 | + var visuallyHidden = { | |
| 2606 | + ...visuallyHiddenBase, | |
| 2607 | + position: "fixed", | |
| 2608 | + top: 0, | |
| 2609 | + left: 0 | |
| 2610 | + }; | |
| 2611 | + var visuallyHiddenInput = { | |
| 2612 | + ...visuallyHiddenBase, | |
| 2613 | + position: "absolute" | |
| 2614 | + }; | |
| 2615 | + | |
| 2616 | + // node_modules/@base-ui/react/utils/FocusGuard.mjs | |
| 1253 | 2617 | var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); |
| 1254 | - var star_filled_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" }) }); | |
| 2618 | + var FocusGuard = /* @__PURE__ */ React12.forwardRef(function FocusGuard2(props, ref) { | |
| 2619 | + const [role, setRole] = React12.useState(); | |
| 2620 | + useIsoLayoutEffect(() => { | |
| 2621 | + if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) { | |
| 2622 | + setRole("button"); | |
| 2623 | + } | |
| 2624 | + }, []); | |
| 2625 | + const restProps = { | |
| 2626 | + tabIndex: 0, | |
| 2627 | + // Role is only for VoiceOver | |
| 2628 | + role | |
| 2629 | + }; | |
| 2630 | + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { | |
| 2631 | + ...props, | |
| 2632 | + ref, | |
| 2633 | + style: visuallyHidden, | |
| 2634 | + "aria-hidden": role ? void 0 : true, | |
| 2635 | + ...restProps, | |
| 2636 | + "data-base-ui-focus-guard": "" | |
| 2637 | + }); | |
| 2638 | + }); | |
| 2639 | + if (true) FocusGuard.displayName = "FocusGuard"; | |
| 1255 | 2640 | |
| 1256 | - // packages/icons/build-module/library/star-half.mjs | |
| 1257 | - var import_primitives3 = __toESM(require_primitives(), 1); | |
| 2641 | + // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs | |
| 2642 | + var min = Math.min; | |
| 2643 | + var max = Math.max; | |
| 2644 | + var round = Math.round; | |
| 2645 | + var floor = Math.floor; | |
| 2646 | + var createCoords = (v) => ({ | |
| 2647 | + x: v, | |
| 2648 | + y: v | |
| 2649 | + }); | |
| 2650 | + var oppositeSideMap = { | |
| 2651 | + left: "right", | |
| 2652 | + right: "left", | |
| 2653 | + bottom: "top", | |
| 2654 | + top: "bottom" | |
| 2655 | + }; | |
| 2656 | + function clamp(start, value, end) { | |
| 2657 | + return max(start, min(value, end)); | |
| 2658 | + } | |
| 2659 | + function evaluate(value, param) { | |
| 2660 | + return typeof value === "function" ? value(param) : value; | |
| 2661 | + } | |
| 2662 | + function getSide(placement) { | |
| 2663 | + return placement.split("-")[0]; | |
| 2664 | + } | |
| 2665 | + function getAlignment(placement) { | |
| 2666 | + return placement.split("-")[1]; | |
| 2667 | + } | |
| 2668 | + function getOppositeAxis(axis) { | |
| 2669 | + return axis === "x" ? "y" : "x"; | |
| 2670 | + } | |
| 2671 | + function getAxisLength(axis) { | |
| 2672 | + return axis === "y" ? "height" : "width"; | |
| 2673 | + } | |
| 2674 | + function getSideAxis(placement) { | |
| 2675 | + const firstChar = placement[0]; | |
| 2676 | + return firstChar === "t" || firstChar === "b" ? "y" : "x"; | |
| 2677 | + } | |
| 2678 | + function getAlignmentAxis(placement) { | |
| 2679 | + return getOppositeAxis(getSideAxis(placement)); | |
| 2680 | + } | |
| 2681 | + function getAlignmentSides(placement, rects, rtl) { | |
| 2682 | + if (rtl === void 0) { | |
| 2683 | + rtl = false; | |
| 2684 | + } | |
| 2685 | + const alignment = getAlignment(placement); | |
| 2686 | + const alignmentAxis = getAlignmentAxis(placement); | |
| 2687 | + const length = getAxisLength(alignmentAxis); | |
| 2688 | + let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; | |
| 2689 | + if (rects.reference[length] > rects.floating[length]) { | |
| 2690 | + mainAlignmentSide = getOppositePlacement(mainAlignmentSide); | |
| 2691 | + } | |
| 2692 | + return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; | |
| 2693 | + } | |
| 2694 | + function getExpandedPlacements(placement) { | |
| 2695 | + const oppositePlacement = getOppositePlacement(placement); | |
| 2696 | + return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; | |
| 2697 | + } | |
| 2698 | + function getOppositeAlignmentPlacement(placement) { | |
| 2699 | + return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); | |
| 2700 | + } | |
| 2701 | + var lrPlacement = ["left", "right"]; | |
| 2702 | + var rlPlacement = ["right", "left"]; | |
| 2703 | + var tbPlacement = ["top", "bottom"]; | |
| 2704 | + var btPlacement = ["bottom", "top"]; | |
| 2705 | + function getSideList(side, isStart, rtl) { | |
| 2706 | + switch (side) { | |
| 2707 | + case "top": | |
| 2708 | + case "bottom": | |
| 2709 | + if (rtl) return isStart ? rlPlacement : lrPlacement; | |
| 2710 | + return isStart ? lrPlacement : rlPlacement; | |
| 2711 | + case "left": | |
| 2712 | + case "right": | |
| 2713 | + return isStart ? tbPlacement : btPlacement; | |
| 2714 | + default: | |
| 2715 | + return []; | |
| 2716 | + } | |
| 2717 | + } | |
| 2718 | + function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { | |
| 2719 | + const alignment = getAlignment(placement); | |
| 2720 | + let list = getSideList(getSide(placement), direction === "start", rtl); | |
| 2721 | + if (alignment) { | |
| 2722 | + list = list.map((side) => side + "-" + alignment); | |
| 2723 | + if (flipAlignment) { | |
| 2724 | + list = list.concat(list.map(getOppositeAlignmentPlacement)); | |
| 2725 | + } | |
| 2726 | + } | |
| 2727 | + return list; | |
| 2728 | + } | |
| 2729 | + function getOppositePlacement(placement) { | |
| 2730 | + const side = getSide(placement); | |
| 2731 | + return oppositeSideMap[side] + placement.slice(side.length); | |
| 2732 | + } | |
| 2733 | + function expandPaddingObject(padding) { | |
| 2734 | + var _padding$top, _padding$right, _padding$bottom, _padding$left; | |
| 2735 | + return { | |
| 2736 | + top: (_padding$top = padding.top) != null ? _padding$top : 0, | |
| 2737 | + right: (_padding$right = padding.right) != null ? _padding$right : 0, | |
| 2738 | + bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0, | |
| 2739 | + left: (_padding$left = padding.left) != null ? _padding$left : 0 | |
| 2740 | + }; | |
| 2741 | + } | |
| 2742 | + function getPaddingObject(padding) { | |
| 2743 | + return typeof padding !== "number" ? expandPaddingObject(padding) : { | |
| 2744 | + top: padding, | |
| 2745 | + right: padding, | |
| 2746 | + bottom: padding, | |
| 2747 | + left: padding | |
| 2748 | + }; | |
| 2749 | + } | |
| 2750 | + function rectToClientRect(rect) { | |
| 2751 | + const { | |
| 2752 | + x, | |
| 2753 | + y, | |
| 2754 | + width, | |
| 2755 | + height | |
| 2756 | + } = rect; | |
| 2757 | + return { | |
| 2758 | + width, | |
| 2759 | + height, | |
| 2760 | + top: y, | |
| 2761 | + left: x, | |
| 2762 | + right: x + width, | |
| 2763 | + bottom: y + height, | |
| 2764 | + x, | |
| 2765 | + y | |
| 2766 | + }; | |
| 2767 | + } | |
| 2768 | + | |
| 2769 | + // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs | |
| 2770 | + function isHiddenByStyles(styles) { | |
| 2771 | + return styles.visibility === "hidden" || styles.visibility === "collapse"; | |
| 2772 | + } | |
| 2773 | + function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { | |
| 2774 | + if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { | |
| 2775 | + return false; | |
| 2776 | + } | |
| 2777 | + if (typeof element.checkVisibility === "function") { | |
| 2778 | + return element.checkVisibility(); | |
| 2779 | + } | |
| 2780 | + return styles.display !== "none" && styles.display !== "contents"; | |
| 2781 | + } | |
| 2782 | + | |
| 2783 | + // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs | |
| 2784 | + var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; | |
| 2785 | + function getParentElement(element) { | |
| 2786 | + const assignedSlot = element.assignedSlot; | |
| 2787 | + if (assignedSlot) { | |
| 2788 | + return assignedSlot; | |
| 2789 | + } | |
| 2790 | + if (element.parentElement) { | |
| 2791 | + return element.parentElement; | |
| 2792 | + } | |
| 2793 | + const rootNode = element.getRootNode(); | |
| 2794 | + return isShadowRoot(rootNode) ? rootNode.host : null; | |
| 2795 | + } | |
| 2796 | + function getDetailsSummary(details) { | |
| 2797 | + for (const child of Array.from(details.children)) { | |
| 2798 | + if (getNodeName(child) === "summary") { | |
| 2799 | + return child; | |
| 2800 | + } | |
| 2801 | + } | |
| 2802 | + return null; | |
| 2803 | + } | |
| 2804 | + function isWithinOpenDetailsSummary(element, details) { | |
| 2805 | + const summary = getDetailsSummary(details); | |
| 2806 | + return !!summary && (element === summary || contains(summary, element)); | |
| 2807 | + } | |
| 2808 | + function isFocusableCandidate(element) { | |
| 2809 | + const nodeName = element ? getNodeName(element) : ""; | |
| 2810 | + 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"); | |
| 2811 | + } | |
| 2812 | + function isFocusableElement(element) { | |
| 2813 | + if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { | |
| 2814 | + return false; | |
| 2815 | + } | |
| 2816 | + for (let current = element; current; current = getParentElement(current)) { | |
| 2817 | + const isAncestor = current !== element; | |
| 2818 | + const isSlot = getNodeName(current) === "slot"; | |
| 2819 | + if (current.hasAttribute("inert")) { | |
| 2820 | + return false; | |
| 2821 | + } | |
| 2822 | + if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { | |
| 2823 | + return false; | |
| 2824 | + } | |
| 2825 | + } | |
| 2826 | + return true; | |
| 2827 | + } | |
| 2828 | + function isVisibleInTabbableTree(element, isAncestor) { | |
| 2829 | + const styles = getComputedStyle2(element); | |
| 2830 | + if (!isAncestor) { | |
| 2831 | + return isElementVisible(element, styles); | |
| 2832 | + } | |
| 2833 | + return styles.display !== "none"; | |
| 2834 | + } | |
| 2835 | + function getTabIndex(element) { | |
| 2836 | + const tabIndex = element.tabIndex; | |
| 2837 | + if (tabIndex < 0) { | |
| 2838 | + const nodeName = getNodeName(element); | |
| 2839 | + if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { | |
| 2840 | + return 0; | |
| 2841 | + } | |
| 2842 | + } | |
| 2843 | + return tabIndex; | |
| 2844 | + } | |
| 2845 | + function getNamedRadioInput(element) { | |
| 2846 | + if (getNodeName(element) !== "input") { | |
| 2847 | + return null; | |
| 2848 | + } | |
| 2849 | + const input = element; | |
| 2850 | + return input.type === "radio" && input.name !== "" ? input : null; | |
| 2851 | + } | |
| 2852 | + function isTabbableRadio(element, candidates) { | |
| 2853 | + const input = getNamedRadioInput(element); | |
| 2854 | + if (!input) { | |
| 2855 | + return true; | |
| 2856 | + } | |
| 2857 | + const checkedRadio = candidates.find((candidate) => { | |
| 2858 | + const radio = getNamedRadioInput(candidate); | |
| 2859 | + return radio?.name === input.name && radio.form === input.form && radio.checked; | |
| 2860 | + }); | |
| 2861 | + if (checkedRadio) { | |
| 2862 | + return checkedRadio === input; | |
| 2863 | + } | |
| 2864 | + return candidates.find((candidate) => { | |
| 2865 | + const radio = getNamedRadioInput(candidate); | |
| 2866 | + return radio?.name === input.name && radio.form === input.form; | |
| 2867 | + }) === input; | |
| 2868 | + } | |
| 2869 | + function getComposedChildren(container) { | |
| 2870 | + if (isHTMLElement(container) && getNodeName(container) === "slot") { | |
| 2871 | + const assignedElements = container.assignedElements({ | |
| 2872 | + flatten: true | |
| 2873 | + }); | |
| 2874 | + if (assignedElements.length > 0) { | |
| 2875 | + return assignedElements; | |
| 2876 | + } | |
| 2877 | + } | |
| 2878 | + if (isHTMLElement(container) && container.shadowRoot) { | |
| 2879 | + return Array.from(container.shadowRoot.children); | |
| 2880 | + } | |
| 2881 | + return Array.from(container.children); | |
| 2882 | + } | |
| 2883 | + function appendCandidates(container, list) { | |
| 2884 | + getComposedChildren(container).forEach((child) => { | |
| 2885 | + if (isFocusableCandidate(child)) { | |
| 2886 | + list.push(child); | |
| 2887 | + } | |
| 2888 | + appendCandidates(child, list); | |
| 2889 | + }); | |
| 2890 | + } | |
| 2891 | + function appendMatchingElements(container, selector, list) { | |
| 2892 | + getComposedChildren(container).forEach((child) => { | |
| 2893 | + if (isHTMLElement(child) && child.matches(selector)) { | |
| 2894 | + list.push(child); | |
| 2895 | + } | |
| 2896 | + appendMatchingElements(child, selector, list); | |
| 2897 | + }); | |
| 2898 | + } | |
| 2899 | + function focusable(container) { | |
| 2900 | + const candidates = []; | |
| 2901 | + appendCandidates(container, candidates); | |
| 2902 | + return candidates.filter(isFocusableElement); | |
| 2903 | + } | |
| 2904 | + function tabbable(container) { | |
| 2905 | + const candidates = focusable(container); | |
| 2906 | + return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); | |
| 2907 | + } | |
| 2908 | + function getTabbableIn(container, dir) { | |
| 2909 | + const list = tabbable(container); | |
| 2910 | + const len = list.length; | |
| 2911 | + if (len === 0) { | |
| 2912 | + return void 0; | |
| 2913 | + } | |
| 2914 | + const active = activeElement(ownerDocument(container)); | |
| 2915 | + const index2 = list.indexOf(active); | |
| 2916 | + const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; | |
| 2917 | + return list[nextIndex]; | |
| 2918 | + } | |
| 2919 | + function getNextTabbable(referenceElement) { | |
| 2920 | + return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; | |
| 2921 | + } | |
| 2922 | + function getPreviousTabbable(referenceElement) { | |
| 2923 | + return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; | |
| 2924 | + } | |
| 2925 | + function isOutsideEvent(event, container) { | |
| 2926 | + const containerElement = container || event.currentTarget; | |
| 2927 | + const relatedTarget = event.relatedTarget; | |
| 2928 | + return !relatedTarget || !contains(containerElement, relatedTarget); | |
| 2929 | + } | |
| 2930 | + function disableFocusInside(container) { | |
| 2931 | + const tabbableElements = tabbable(container); | |
| 2932 | + tabbableElements.forEach((element) => { | |
| 2933 | + element.dataset.tabindex = element.getAttribute("tabindex") || ""; | |
| 2934 | + element.setAttribute("tabindex", "-1"); | |
| 2935 | + }); | |
| 2936 | + } | |
| 2937 | + function enableFocusInside(container) { | |
| 2938 | + const elements = []; | |
| 2939 | + appendMatchingElements(container, "[data-tabindex]", elements); | |
| 2940 | + elements.forEach((element) => { | |
| 2941 | + const tabindex = element.dataset.tabindex; | |
| 2942 | + delete element.dataset.tabindex; | |
| 2943 | + if (tabindex) { | |
| 2944 | + element.setAttribute("tabindex", tabindex); | |
| 2945 | + } else { | |
| 2946 | + element.removeAttribute("tabindex"); | |
| 2947 | + } | |
| 2948 | + }); | |
| 2949 | + } | |
| 2950 | + | |
| 2951 | + // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs | |
| 2952 | + function getNodeChildren(nodes, id, onlyOpenChildren = true) { | |
| 2953 | + const directChildren = nodes.filter((node) => node.parentId === id); | |
| 2954 | + return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); | |
| 2955 | + } | |
| 2956 | + | |
| 2957 | + // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs | |
| 2958 | + function createAttribute(name) { | |
| 2959 | + return `data-base-ui-${name}`; | |
| 2960 | + } | |
| 2961 | + | |
| 2962 | + // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs | |
| 2963 | + var React13 = __toESM(require_react(), 1); | |
| 2964 | + var ReactDOM2 = __toESM(require_react_dom(), 1); | |
| 2965 | + | |
| 2966 | + // node_modules/@base-ui/react/internals/constants.mjs | |
| 2967 | + var DISABLED_TRANSITIONS_STYLE = { | |
| 2968 | + style: { | |
| 2969 | + transition: "none" | |
| 2970 | + } | |
| 2971 | + }; | |
| 2972 | + var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; | |
| 2973 | + var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; | |
| 2974 | + var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; | |
| 2975 | + var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; | |
| 2976 | + var POPUP_COLLISION_AVOIDANCE = { | |
| 2977 | + fallbackAxisSide: "end" | |
| 2978 | + }; | |
| 2979 | + var ownerVisuallyHidden = { | |
| 2980 | + clipPath: "inset(50%)", | |
| 2981 | + position: "fixed", | |
| 2982 | + top: 0, | |
| 2983 | + left: 0 | |
| 2984 | + }; | |
| 2985 | + | |
| 2986 | + // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs | |
| 1258 | 2987 | var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); |
| 1259 | - var star_half_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39v7.143z" }) }); | |
| 2988 | + var PortalContext = /* @__PURE__ */ React13.createContext(null); | |
| 2989 | + if (true) PortalContext.displayName = "PortalContext"; | |
| 2990 | + var usePortalContext = () => React13.useContext(PortalContext); | |
| 2991 | + var attr = createAttribute("portal"); | |
| 2992 | + function useFloatingPortalNode(props = {}) { | |
| 2993 | + const { | |
| 2994 | + ref, | |
| 2995 | + container: containerProp, | |
| 2996 | + componentProps = EMPTY_OBJECT, | |
| 2997 | + elementProps | |
| 2998 | + } = props; | |
| 2999 | + const uniqueId = useId(); | |
| 3000 | + const portalContext = usePortalContext(); | |
| 3001 | + const parentPortalNode = portalContext?.portalNode; | |
| 3002 | + const [containerElement, setContainerElement] = React13.useState(null); | |
| 3003 | + const [portalNode, setPortalNode] = React13.useState(null); | |
| 3004 | + const setPortalNodeRef = useStableCallback((node) => { | |
| 3005 | + if (node !== null) { | |
| 3006 | + setPortalNode(node); | |
| 3007 | + } | |
| 3008 | + }); | |
| 3009 | + const containerRef = React13.useRef(null); | |
| 3010 | + useIsoLayoutEffect(() => { | |
| 3011 | + if (containerProp === null) { | |
| 3012 | + if (containerRef.current) { | |
| 3013 | + containerRef.current = null; | |
| 3014 | + setPortalNode(null); | |
| 3015 | + setContainerElement(null); | |
| 3016 | + } | |
| 3017 | + return; | |
| 3018 | + } | |
| 3019 | + const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; | |
| 3020 | + if (resolvedContainer == null) { | |
| 3021 | + if (containerRef.current) { | |
| 3022 | + containerRef.current = null; | |
| 3023 | + setPortalNode(null); | |
| 3024 | + setContainerElement(null); | |
| 3025 | + } | |
| 3026 | + return; | |
| 3027 | + } | |
| 3028 | + if (containerRef.current !== resolvedContainer) { | |
| 3029 | + containerRef.current = resolvedContainer; | |
| 3030 | + setPortalNode(null); | |
| 3031 | + setContainerElement(resolvedContainer); | |
| 3032 | + } | |
| 3033 | + }, [containerProp, parentPortalNode]); | |
| 3034 | + const portalElement = useRenderElement("div", componentProps, { | |
| 3035 | + ref: [ref, setPortalNodeRef], | |
| 3036 | + props: [{ | |
| 3037 | + id: uniqueId, | |
| 3038 | + [attr]: "" | |
| 3039 | + }, elementProps] | |
| 3040 | + }); | |
| 3041 | + const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; | |
| 3042 | + return { | |
| 3043 | + node: portalNode, | |
| 3044 | + // `id` and `render` props can override or remove the generated ID. Use the exact | |
| 3045 | + // rendered value so `aria-owns` never points at an ID absent from the DOM. | |
| 3046 | + nodeId: /* @__PURE__ */ React13.isValidElement(portalElement) ? portalElement.props.id : void 0, | |
| 3047 | + subtree: portalSubtree | |
| 3048 | + }; | |
| 3049 | + } | |
| 3050 | + var FloatingPortal = /* @__PURE__ */ React13.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { | |
| 3051 | + const { | |
| 3052 | + render, | |
| 3053 | + className, | |
| 3054 | + style, | |
| 3055 | + children, | |
| 3056 | + container, | |
| 3057 | + portalOwnerRole, | |
| 3058 | + ...elementProps | |
| 3059 | + } = componentProps; | |
| 3060 | + const { | |
| 3061 | + node: portalNode, | |
| 3062 | + nodeId: portalNodeId, | |
| 3063 | + subtree: portalSubtree | |
| 3064 | + } = useFloatingPortalNode({ | |
| 3065 | + container, | |
| 3066 | + ref: forwardedRef, | |
| 3067 | + componentProps, | |
| 3068 | + elementProps | |
| 3069 | + }); | |
| 3070 | + const beforeOutsideRef = React13.useRef(null); | |
| 3071 | + const afterOutsideRef = React13.useRef(null); | |
| 3072 | + const beforeInsideRef = React13.useRef(null); | |
| 3073 | + const afterInsideRef = React13.useRef(null); | |
| 3074 | + const [focusManagerState, setFocusManagerState] = React13.useState(null); | |
| 3075 | + const focusInsideDisabledRef = React13.useRef(false); | |
| 3076 | + const modal = focusManagerState?.modal; | |
| 3077 | + const open2 = focusManagerState?.open; | |
| 3078 | + const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; | |
| 3079 | + React13.useEffect(() => { | |
| 3080 | + if (!portalNode || modal) { | |
| 3081 | + return void 0; | |
| 3082 | + } | |
| 3083 | + function onFocus(event) { | |
| 3084 | + if (portalNode && event.relatedTarget && isOutsideEvent(event)) { | |
| 3085 | + if (event.type === "focusin") { | |
| 3086 | + if (focusInsideDisabledRef.current) { | |
| 3087 | + enableFocusInside(portalNode); | |
| 3088 | + focusInsideDisabledRef.current = false; | |
| 3089 | + } | |
| 3090 | + } else { | |
| 3091 | + disableFocusInside(portalNode); | |
| 3092 | + focusInsideDisabledRef.current = true; | |
| 3093 | + } | |
| 3094 | + } | |
| 3095 | + } | |
| 3096 | + return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); | |
| 3097 | + }, [portalNode, modal]); | |
| 3098 | + useIsoLayoutEffect(() => { | |
| 3099 | + if (!portalNode || open2 !== true || !focusInsideDisabledRef.current) { | |
| 3100 | + return; | |
| 3101 | + } | |
| 3102 | + enableFocusInside(portalNode); | |
| 3103 | + focusInsideDisabledRef.current = false; | |
| 3104 | + }, [open2, portalNode]); | |
| 3105 | + const portalContextValue = React13.useMemo(() => ({ | |
| 3106 | + beforeOutsideRef, | |
| 3107 | + afterOutsideRef, | |
| 3108 | + beforeInsideRef, | |
| 3109 | + afterInsideRef, | |
| 3110 | + portalNode, | |
| 3111 | + setFocusManagerState | |
| 3112 | + }), [portalNode]); | |
| 3113 | + return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React13.Fragment, { | |
| 3114 | + children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, { | |
| 3115 | + value: portalContextValue, | |
| 3116 | + children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { | |
| 3117 | + "data-type": "outside", | |
| 3118 | + ref: beforeOutsideRef, | |
| 3119 | + onFocus: (event) => { | |
| 3120 | + if (isOutsideEvent(event, portalNode)) { | |
| 3121 | + beforeInsideRef.current?.focus(); | |
| 3122 | + } else { | |
| 3123 | + const domReference = focusManagerState ? focusManagerState.domReference : null; | |
| 3124 | + const prevTabbable = getPreviousTabbable(domReference); | |
| 3125 | + prevTabbable?.focus(); | |
| 3126 | + } | |
| 3127 | + } | |
| 3128 | + }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { | |
| 3129 | + role: portalOwnerRole, | |
| 3130 | + "aria-owns": portalNodeId, | |
| 3131 | + style: ownerVisuallyHidden | |
| 3132 | + }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { | |
| 3133 | + "data-type": "outside", | |
| 3134 | + ref: afterOutsideRef, | |
| 3135 | + onFocus: (event) => { | |
| 3136 | + if (isOutsideEvent(event, portalNode)) { | |
| 3137 | + afterInsideRef.current?.focus(); | |
| 3138 | + } else { | |
| 3139 | + const domReference = focusManagerState ? focusManagerState.domReference : null; | |
| 3140 | + const nextTabbable = getNextTabbable(domReference); | |
| 3141 | + nextTabbable?.focus(); | |
| 3142 | + if (focusManagerState?.closeOnFocusOut) { | |
| 3143 | + focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); | |
| 3144 | + } | |
| 3145 | + } | |
| 3146 | + } | |
| 3147 | + })] | |
| 3148 | + })] | |
| 3149 | + }); | |
| 3150 | + }); | |
| 3151 | + if (true) FloatingPortal.displayName = "FloatingPortal"; | |
| 1260 | 3152 | |
| 1261 | - // packages/ui/build-module/visually-hidden/visually-hidden.mjs | |
| 1262 | - var import_element3 = __toESM(require_element(), 1); | |
| 3153 | + // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs | |
| 3154 | + var React14 = __toESM(require_react(), 1); | |
| 3155 | + | |
| 3156 | + // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs | |
| 3157 | + function createEventEmitter() { | |
| 3158 | + const map = /* @__PURE__ */ new Map(); | |
| 3159 | + return { | |
| 3160 | + emit(event, data) { | |
| 3161 | + map.get(event)?.forEach((listener) => listener(data)); | |
| 3162 | + }, | |
| 3163 | + on(event, listener) { | |
| 3164 | + if (!map.has(event)) { | |
| 3165 | + map.set(event, /* @__PURE__ */ new Set()); | |
| 3166 | + } | |
| 3167 | + map.get(event).add(listener); | |
| 3168 | + }, | |
| 3169 | + off(event, listener) { | |
| 3170 | + map.get(event)?.delete(listener); | |
| 3171 | + } | |
| 3172 | + }; | |
| 3173 | + } | |
| 3174 | + | |
| 3175 | + // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs | |
| 3176 | + var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); | |
| 3177 | + var FloatingNodeContext = /* @__PURE__ */ React14.createContext(null); | |
| 3178 | + if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; | |
| 3179 | + var FloatingTreeContext = /* @__PURE__ */ React14.createContext(null); | |
| 3180 | + if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; | |
| 3181 | + var useFloatingParentNodeId = () => React14.useContext(FloatingNodeContext)?.id || null; | |
| 3182 | + var useFloatingTree = (externalTree) => { | |
| 3183 | + const contextTree = React14.useContext(FloatingTreeContext); | |
| 3184 | + return externalTree ?? contextTree; | |
| 3185 | + }; | |
| 3186 | + | |
| 3187 | + // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs | |
| 3188 | + var React15 = __toESM(require_react(), 1); | |
| 3189 | + function createVirtualElement(domElement, data) { | |
| 3190 | + let offsetX = null; | |
| 3191 | + let offsetY = null; | |
| 3192 | + let isAutoUpdateEvent = false; | |
| 3193 | + return { | |
| 3194 | + contextElement: domElement || void 0, | |
| 3195 | + getBoundingClientRect() { | |
| 3196 | + const domRect = domElement?.getBoundingClientRect() || { | |
| 3197 | + width: 0, | |
| 3198 | + height: 0, | |
| 3199 | + x: 0, | |
| 3200 | + y: 0 | |
| 3201 | + }; | |
| 3202 | + const isXAxis = data.axis === "x" || data.axis === "both"; | |
| 3203 | + const isYAxis = data.axis === "y" || data.axis === "both"; | |
| 3204 | + const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; | |
| 3205 | + let width = domRect.width; | |
| 3206 | + let height = domRect.height; | |
| 3207 | + let x = domRect.x; | |
| 3208 | + let y = domRect.y; | |
| 3209 | + if (offsetX == null && data.x && isXAxis) { | |
| 3210 | + offsetX = domRect.x - data.x; | |
| 3211 | + } | |
| 3212 | + if (offsetY == null && data.y && isYAxis) { | |
| 3213 | + offsetY = domRect.y - data.y; | |
| 3214 | + } | |
| 3215 | + x -= offsetX || 0; | |
| 3216 | + y -= offsetY || 0; | |
| 3217 | + width = 0; | |
| 3218 | + height = 0; | |
| 3219 | + if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { | |
| 3220 | + width = data.axis === "y" ? domRect.width : 0; | |
| 3221 | + height = data.axis === "x" ? domRect.height : 0; | |
| 3222 | + x = isXAxis && data.x != null ? data.x : x; | |
| 3223 | + y = isYAxis && data.y != null ? data.y : y; | |
| 3224 | + } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { | |
| 3225 | + height = data.axis === "x" ? domRect.height : height; | |
| 3226 | + width = data.axis === "y" ? domRect.width : width; | |
| 3227 | + } | |
| 3228 | + isAutoUpdateEvent = true; | |
| 3229 | + return { | |
| 3230 | + width, | |
| 3231 | + height, | |
| 3232 | + x, | |
| 3233 | + y, | |
| 3234 | + top: y, | |
| 3235 | + right: x + width, | |
| 3236 | + bottom: y + height, | |
| 3237 | + left: x | |
| 3238 | + }; | |
| 3239 | + } | |
| 3240 | + }; | |
| 3241 | + } | |
| 3242 | + function isMouseBasedEvent(event) { | |
| 3243 | + return event != null && event.clientX != null; | |
| 3244 | + } | |
| 3245 | + function useClientPoint(context, props = {}) { | |
| 3246 | + const { | |
| 3247 | + enabled = true, | |
| 3248 | + axis = "both" | |
| 3249 | + } = props; | |
| 3250 | + const store2 = "rootStore" in context ? context.rootStore : context; | |
| 3251 | + const open2 = store2.useState("open"); | |
| 3252 | + const floating = store2.useState("floatingElement"); | |
| 3253 | + const domReference = store2.useState("domReferenceElement"); | |
| 3254 | + const dataRef = store2.context.dataRef; | |
| 3255 | + const initialRef = React15.useRef(false); | |
| 3256 | + const cleanupListenerRef = React15.useRef(null); | |
| 3257 | + const [pointerType, setPointerType] = React15.useState(); | |
| 3258 | + const [reactive, setReactive] = React15.useState([]); | |
| 3259 | + const resetReference = useStableCallback((reference2) => { | |
| 3260 | + store2.set("positionReference", reference2); | |
| 3261 | + }); | |
| 3262 | + const setReference = useStableCallback((newX, newY, referenceElement) => { | |
| 3263 | + if (initialRef.current) { | |
| 3264 | + return; | |
| 3265 | + } | |
| 3266 | + if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { | |
| 3267 | + return; | |
| 3268 | + } | |
| 3269 | + store2.set("positionReference", createVirtualElement(referenceElement ?? domReference, { | |
| 3270 | + x: newX, | |
| 3271 | + y: newY, | |
| 3272 | + axis, | |
| 3273 | + dataRef, | |
| 3274 | + pointerType | |
| 3275 | + })); | |
| 3276 | + }); | |
| 3277 | + const handleReferenceEnterOrMove = useStableCallback((event) => { | |
| 3278 | + if (!open2) { | |
| 3279 | + setReference(event.clientX, event.clientY, event.currentTarget); | |
| 3280 | + } else if (!cleanupListenerRef.current) { | |
| 3281 | + setReference(event.clientX, event.clientY, event.currentTarget); | |
| 3282 | + setReactive([]); | |
| 3283 | + } | |
| 3284 | + }); | |
| 3285 | + const openCheck = isMouseLikePointerType(pointerType) ? floating : open2; | |
| 3286 | + React15.useEffect(() => { | |
| 3287 | + if (!enabled) { | |
| 3288 | + resetReference(domReference); | |
| 3289 | + return void 0; | |
| 3290 | + } | |
| 3291 | + if (!openCheck) { | |
| 3292 | + return void 0; | |
| 3293 | + } | |
| 3294 | + function cleanupListener() { | |
| 3295 | + cleanupListenerRef.current?.(); | |
| 3296 | + cleanupListenerRef.current = null; | |
| 3297 | + } | |
| 3298 | + const win = getWindow(floating); | |
| 3299 | + function handleMouseMove(event) { | |
| 3300 | + const target = getTarget(event); | |
| 3301 | + if (!contains(floating, target)) { | |
| 3302 | + setReference(event.clientX, event.clientY); | |
| 3303 | + } else { | |
| 3304 | + cleanupListener(); | |
| 3305 | + } | |
| 3306 | + } | |
| 3307 | + if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { | |
| 3308 | + cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); | |
| 3309 | + } else { | |
| 3310 | + resetReference(domReference); | |
| 3311 | + } | |
| 3312 | + return cleanupListener; | |
| 3313 | + }, [openCheck, enabled, floating, dataRef, domReference, store2, setReference, resetReference, reactive]); | |
| 3314 | + React15.useEffect(() => () => { | |
| 3315 | + store2.set("positionReference", null); | |
| 3316 | + }, [store2]); | |
| 3317 | + React15.useEffect(() => { | |
| 3318 | + if (enabled && !floating) { | |
| 3319 | + initialRef.current = false; | |
| 3320 | + } | |
| 3321 | + }, [enabled, floating]); | |
| 3322 | + React15.useEffect(() => { | |
| 3323 | + if (!enabled && open2) { | |
| 3324 | + initialRef.current = true; | |
| 3325 | + } | |
| 3326 | + }, [enabled, open2]); | |
| 3327 | + const reference = React15.useMemo(() => { | |
| 3328 | + function setPointerTypeRef(event) { | |
| 3329 | + setPointerType(event.pointerType); | |
| 3330 | + } | |
| 3331 | + return { | |
| 3332 | + onPointerDown: setPointerTypeRef, | |
| 3333 | + onPointerEnter: setPointerTypeRef, | |
| 3334 | + onMouseMove: handleReferenceEnterOrMove, | |
| 3335 | + onMouseEnter: handleReferenceEnterOrMove | |
| 3336 | + }; | |
| 3337 | + }, [handleReferenceEnterOrMove]); | |
| 3338 | + return React15.useMemo(() => enabled ? { | |
| 3339 | + reference, | |
| 3340 | + trigger: reference | |
| 3341 | + } : {}, [enabled, reference]); | |
| 3342 | + } | |
| 3343 | + | |
| 3344 | + // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs | |
| 3345 | + var React16 = __toESM(require_react(), 1); | |
| 3346 | + function alwaysFalse() { | |
| 3347 | + return false; | |
| 3348 | + } | |
| 3349 | + function normalizeProp(normalizable) { | |
| 3350 | + return { | |
| 3351 | + escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, | |
| 3352 | + outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true | |
| 3353 | + }; | |
| 3354 | + } | |
| 3355 | + function useDismiss(context, props = {}) { | |
| 3356 | + const { | |
| 3357 | + enabled = true, | |
| 3358 | + escapeKey: escapeKey2 = true, | |
| 3359 | + outsidePress: outsidePressProp = true, | |
| 3360 | + outsidePressEvent = "sloppy", | |
| 3361 | + referencePress = alwaysFalse, | |
| 3362 | + bubbles, | |
| 3363 | + externalTree | |
| 3364 | + } = props; | |
| 3365 | + const store2 = "rootStore" in context ? context.rootStore : context; | |
| 3366 | + const open2 = store2.useState("open"); | |
| 3367 | + const floatingElement = store2.useState("floatingElement"); | |
| 3368 | + const { | |
| 3369 | + dataRef, | |
| 3370 | + events | |
| 3371 | + } = store2.context; | |
| 3372 | + const tree = useFloatingTree(externalTree); | |
| 3373 | + const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); | |
| 3374 | + const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; | |
| 3375 | + const outsidePressEnabled = outsidePress2 !== false; | |
| 3376 | + const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); | |
| 3377 | + const { | |
| 3378 | + escapeKey: escapeKeyBubbles, | |
| 3379 | + outsidePress: outsidePressBubbles | |
| 3380 | + } = normalizeProp(bubbles); | |
| 3381 | + const pressStartedInsideRef = React16.useRef(false); | |
| 3382 | + const pressStartPreventedRef = React16.useRef(false); | |
| 3383 | + const suppressNextOutsideClickRef = React16.useRef(false); | |
| 3384 | + const sawPressWhileOpenRef = React16.useRef(false); | |
| 3385 | + const isComposingRef = React16.useRef(false); | |
| 3386 | + const currentPointerTypeRef = React16.useRef(""); | |
| 3387 | + const touchStateRef = React16.useRef(null); | |
| 3388 | + const cancelDismissOnEndTimeout = useTimeout(); | |
| 3389 | + const clearInsideReactTreeTimeout = useTimeout(); | |
| 3390 | + const clearInsideReactTree = useStableCallback(() => { | |
| 3391 | + clearInsideReactTreeTimeout.clear(); | |
| 3392 | + dataRef.current.insideReactTree = false; | |
| 3393 | + }); | |
| 3394 | + const hasBlockingChild = useStableCallback((bubbleKey) => { | |
| 3395 | + const nodeId = dataRef.current.floatingContext?.nodeId; | |
| 3396 | + const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; | |
| 3397 | + return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); | |
| 3398 | + }); | |
| 3399 | + const isEventWithinOwnElements = useStableCallback((event) => { | |
| 3400 | + return isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement")); | |
| 3401 | + }); | |
| 3402 | + const closeOnReferencePress = useStableCallback((event) => { | |
| 3403 | + if (!referencePress()) { | |
| 3404 | + return; | |
| 3405 | + } | |
| 3406 | + store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); | |
| 3407 | + }); | |
| 3408 | + const closeOnEscapeKeyDown = useStableCallback((event) => { | |
| 3409 | + if (!open2 || !enabled || !escapeKey2 || event.key !== "Escape") { | |
| 3410 | + return; | |
| 3411 | + } | |
| 3412 | + if (isComposingRef.current) { | |
| 3413 | + return; | |
| 3414 | + } | |
| 3415 | + if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { | |
| 3416 | + return; | |
| 3417 | + } | |
| 3418 | + const native = isReactEvent(event) ? event.nativeEvent : event; | |
| 3419 | + const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); | |
| 3420 | + store2.setOpen(false, eventDetails); | |
| 3421 | + if (!eventDetails.isCanceled) { | |
| 3422 | + event.preventDefault(); | |
| 3423 | + } | |
| 3424 | + if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { | |
| 3425 | + event.stopPropagation(); | |
| 3426 | + } | |
| 3427 | + }); | |
| 3428 | + const markInsideReactTree = useStableCallback(() => { | |
| 3429 | + dataRef.current.insideReactTree = true; | |
| 3430 | + clearInsideReactTreeTimeout.start(0, clearInsideReactTree); | |
| 3431 | + }); | |
| 3432 | + const markPressStartedInsideReactTree = useStableCallback((event) => { | |
| 3433 | + if (!open2 || !enabled || event.button !== 0) { | |
| 3434 | + return; | |
| 3435 | + } | |
| 3436 | + const target = getTarget(event.nativeEvent); | |
| 3437 | + if (!contains(store2.select("floatingElement"), target)) { | |
| 3438 | + return; | |
| 3439 | + } | |
| 3440 | + if (!pressStartedInsideRef.current) { | |
| 3441 | + pressStartedInsideRef.current = true; | |
| 3442 | + pressStartPreventedRef.current = false; | |
| 3443 | + } | |
| 3444 | + }); | |
| 3445 | + const markInsidePressStartPrevented = useStableCallback((event) => { | |
| 3446 | + if (!open2 || !enabled) { | |
| 3447 | + return; | |
| 3448 | + } | |
| 3449 | + if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { | |
| 3450 | + return; | |
| 3451 | + } | |
| 3452 | + if (pressStartedInsideRef.current) { | |
| 3453 | + pressStartPreventedRef.current = true; | |
| 3454 | + } | |
| 3455 | + }); | |
| 3456 | + React16.useEffect(() => { | |
| 3457 | + function handleOpenChange(details) { | |
| 3458 | + if (!details.open) { | |
| 3459 | + sawPressWhileOpenRef.current = false; | |
| 3460 | + } | |
| 3461 | + } | |
| 3462 | + events.on("openchange", handleOpenChange); | |
| 3463 | + return () => { | |
| 3464 | + events.off("openchange", handleOpenChange); | |
| 3465 | + }; | |
| 3466 | + }, [events]); | |
| 3467 | + React16.useEffect(() => { | |
| 3468 | + if (!open2 || !enabled) { | |
| 3469 | + if (!open2) { | |
| 3470 | + sawPressWhileOpenRef.current = false; | |
| 3471 | + } | |
| 3472 | + return clearInsideReactTree; | |
| 3473 | + } | |
| 3474 | + dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; | |
| 3475 | + dataRef.current.__outsidePressBubbles = outsidePressBubbles; | |
| 3476 | + const compositionTimeout = new Timeout(); | |
| 3477 | + const preventedPressSuppressionTimeout = new Timeout(); | |
| 3478 | + const doc = ownerDocument(floatingElement); | |
| 3479 | + function handleCompositionStart() { | |
| 3480 | + compositionTimeout.clear(); | |
| 3481 | + isComposingRef.current = true; | |
| 3482 | + } | |
| 3483 | + function handleCompositionEnd() { | |
| 3484 | + compositionTimeout.start( | |
| 3485 | + // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. | |
| 3486 | + // Only apply to WebKit for the test to remain 0ms. | |
| 3487 | + parts_exports.engine.webkit ? 5 : 0, | |
| 3488 | + () => { | |
| 3489 | + isComposingRef.current = false; | |
| 3490 | + } | |
| 3491 | + ); | |
| 3492 | + } | |
| 3493 | + function suppressImmediateOutsideClickAfterPreventedStart() { | |
| 3494 | + suppressNextOutsideClickRef.current = true; | |
| 3495 | + preventedPressSuppressionTimeout.start(0, () => { | |
| 3496 | + suppressNextOutsideClickRef.current = false; | |
| 3497 | + }); | |
| 3498 | + } | |
| 3499 | + function resetPressStartState() { | |
| 3500 | + pressStartedInsideRef.current = false; | |
| 3501 | + pressStartPreventedRef.current = false; | |
| 3502 | + } | |
| 3503 | + function getOutsidePressEvent() { | |
| 3504 | + const type = currentPointerTypeRef.current; | |
| 3505 | + const computedType = type === "pen" || !type ? "mouse" : type; | |
| 3506 | + const outsidePressEventValue = getOutsidePressEventProp(); | |
| 3507 | + const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; | |
| 3508 | + if (typeof resolved === "string") { | |
| 3509 | + return resolved; | |
| 3510 | + } | |
| 3511 | + return resolved[computedType]; | |
| 3512 | + } | |
| 3513 | + function shouldIgnoreEvent(event) { | |
| 3514 | + const computedOutsidePressEvent = getOutsidePressEvent(); | |
| 3515 | + return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; | |
| 3516 | + } | |
| 3517 | + function isEventWithinFloatingTree(event) { | |
| 3518 | + const nodeId = dataRef.current.floatingContext?.nodeId; | |
| 3519 | + const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); | |
| 3520 | + return isEventWithinOwnElements(event) || targetIsInsideChildren; | |
| 3521 | + } | |
| 3522 | + function closeOnPressOutside(event) { | |
| 3523 | + if (shouldIgnoreEvent(event)) { | |
| 3524 | + if (event.type !== "click" && !isEventWithinOwnElements(event)) { | |
| 3525 | + preventedPressSuppressionTimeout.clear(); | |
| 3526 | + suppressNextOutsideClickRef.current = false; | |
| 3527 | + } | |
| 3528 | + clearInsideReactTree(); | |
| 3529 | + return; | |
| 3530 | + } | |
| 3531 | + if (dataRef.current.insideReactTree) { | |
| 3532 | + clearInsideReactTree(); | |
| 3533 | + return; | |
| 3534 | + } | |
| 3535 | + const target = getTarget(event); | |
| 3536 | + const inertSelector = `[${createAttribute("inert")}]`; | |
| 3537 | + const targetRoot = isElement(target) ? target.getRootNode() : null; | |
| 3538 | + const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store2.select("floatingElement"))).querySelectorAll(inertSelector)); | |
| 3539 | + const triggers = store2.context.triggerElements; | |
| 3540 | + if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { | |
| 3541 | + return; | |
| 3542 | + } | |
| 3543 | + let targetRootAncestor = isElement(target) ? target : null; | |
| 3544 | + while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { | |
| 3545 | + const nextParent = getParentNode(targetRootAncestor); | |
| 3546 | + if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { | |
| 3547 | + break; | |
| 3548 | + } | |
| 3549 | + targetRootAncestor = nextParent; | |
| 3550 | + } | |
| 3551 | + if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). | |
| 3552 | + !contains(target, store2.select("floatingElement")) && // If the target root element contains none of the markers, then the | |
| 3553 | + // element was injected after the floating element rendered. | |
| 3554 | + markers.every((marker) => !contains(targetRootAncestor, marker))) { | |
| 3555 | + return; | |
| 3556 | + } | |
| 3557 | + if (isHTMLElement(target) && !("touches" in event)) { | |
| 3558 | + const lastTraversableNode = isLastTraversableNode(target); | |
| 3559 | + const style = getComputedStyle2(target); | |
| 3560 | + const scrollRe = /auto|scroll/; | |
| 3561 | + const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); | |
| 3562 | + const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); | |
| 3563 | + const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; | |
| 3564 | + const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; | |
| 3565 | + const isRTL3 = style.direction === "rtl"; | |
| 3566 | + const pressedVerticalScrollbar = canScrollY && (isRTL3 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); | |
| 3567 | + const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; | |
| 3568 | + if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { | |
| 3569 | + return; | |
| 3570 | + } | |
| 3571 | + } | |
| 3572 | + if (isEventWithinFloatingTree(event)) { | |
| 3573 | + return; | |
| 3574 | + } | |
| 3575 | + if (getOutsidePressEvent() === "intentional") { | |
| 3576 | + if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) { | |
| 3577 | + return; | |
| 3578 | + } | |
| 3579 | + if (suppressNextOutsideClickRef.current) { | |
| 3580 | + preventedPressSuppressionTimeout.clear(); | |
| 3581 | + suppressNextOutsideClickRef.current = false; | |
| 3582 | + return; | |
| 3583 | + } | |
| 3584 | + } | |
| 3585 | + if (typeof outsidePress2 === "function" && !outsidePress2(event)) { | |
| 3586 | + return; | |
| 3587 | + } | |
| 3588 | + if (hasBlockingChild("__outsidePressBubbles")) { | |
| 3589 | + return; | |
| 3590 | + } | |
| 3591 | + store2.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); | |
| 3592 | + clearInsideReactTree(); | |
| 3593 | + } | |
| 3594 | + function handlePointerDown(event) { | |
| 3595 | + if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { | |
| 3596 | + return; | |
| 3597 | + } | |
| 3598 | + closeOnPressOutside(event); | |
| 3599 | + } | |
| 3600 | + function handleTouchStart(event) { | |
| 3601 | + if (getOutsidePressEvent() !== "sloppy" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { | |
| 3602 | + return; | |
| 3603 | + } | |
| 3604 | + const touch = event.touches[0]; | |
| 3605 | + if (touch) { | |
| 3606 | + touchStateRef.current = { | |
| 3607 | + startTime: Date.now(), | |
| 3608 | + startX: touch.clientX, | |
| 3609 | + startY: touch.clientY, | |
| 3610 | + dismissOnTouchEnd: false, | |
| 3611 | + dismissOnMouseDown: true | |
| 3612 | + }; | |
| 3613 | + cancelDismissOnEndTimeout.start(1e3, () => { | |
| 3614 | + if (touchStateRef.current) { | |
| 3615 | + touchStateRef.current.dismissOnTouchEnd = false; | |
| 3616 | + touchStateRef.current.dismissOnMouseDown = false; | |
| 3617 | + } | |
| 3618 | + }); | |
| 3619 | + } | |
| 3620 | + } | |
| 3621 | + function addTargetEventListenerOnce(event, listener) { | |
| 3622 | + const target = getTarget(event); | |
| 3623 | + if (!target) { | |
| 3624 | + return; | |
| 3625 | + } | |
| 3626 | + const unsubscribe2 = addEventListener(target, event.type, () => { | |
| 3627 | + listener(event); | |
| 3628 | + unsubscribe2(); | |
| 3629 | + }); | |
| 3630 | + } | |
| 3631 | + function handleTouchStartCapture(event) { | |
| 3632 | + currentPointerTypeRef.current = "touch"; | |
| 3633 | + addTargetEventListenerOnce(event, handleTouchStart); | |
| 3634 | + } | |
| 3635 | + function closeOnPressOutsideCapture(event) { | |
| 3636 | + cancelDismissOnEndTimeout.clear(); | |
| 3637 | + if (event.type === "pointerdown") { | |
| 3638 | + if (event.button === 0) { | |
| 3639 | + sawPressWhileOpenRef.current = true; | |
| 3640 | + } | |
| 3641 | + currentPointerTypeRef.current = event.pointerType; | |
| 3642 | + } | |
| 3643 | + if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { | |
| 3644 | + return; | |
| 3645 | + } | |
| 3646 | + addTargetEventListenerOnce(event, (targetEvent) => { | |
| 3647 | + if (targetEvent.type === "pointerdown") { | |
| 3648 | + handlePointerDown(targetEvent); | |
| 3649 | + } else { | |
| 3650 | + closeOnPressOutside(targetEvent); | |
| 3651 | + } | |
| 3652 | + }); | |
| 3653 | + } | |
| 3654 | + function handlePressEndCapture(event) { | |
| 3655 | + if (event.type === "pointercancel") { | |
| 3656 | + sawPressWhileOpenRef.current = false; | |
| 3657 | + } | |
| 3658 | + if (!pressStartedInsideRef.current) { | |
| 3659 | + return; | |
| 3660 | + } | |
| 3661 | + const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; | |
| 3662 | + resetPressStartState(); | |
| 3663 | + if (getOutsidePressEvent() !== "intentional") { | |
| 3664 | + return; | |
| 3665 | + } | |
| 3666 | + if (event.type === "pointercancel") { | |
| 3667 | + if (pressStartedInsideDefaultPrevented) { | |
| 3668 | + suppressImmediateOutsideClickAfterPreventedStart(); | |
| 3669 | + } | |
| 3670 | + return; | |
| 3671 | + } | |
| 3672 | + if (isEventWithinFloatingTree(event)) { | |
| 3673 | + return; | |
| 3674 | + } | |
| 3675 | + if (pressStartedInsideDefaultPrevented) { | |
| 3676 | + suppressImmediateOutsideClickAfterPreventedStart(); | |
| 3677 | + return; | |
| 3678 | + } | |
| 3679 | + if (typeof outsidePress2 === "function" && !outsidePress2(event)) { | |
| 3680 | + return; | |
| 3681 | + } | |
| 3682 | + preventedPressSuppressionTimeout.clear(); | |
| 3683 | + suppressNextOutsideClickRef.current = true; | |
| 3684 | + clearInsideReactTree(); | |
| 3685 | + } | |
| 3686 | + function handleTouchMove(event) { | |
| 3687 | + if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { | |
| 3688 | + return; | |
| 3689 | + } | |
| 3690 | + const touch = event.touches[0]; | |
| 3691 | + if (!touch) { | |
| 3692 | + return; | |
| 3693 | + } | |
| 3694 | + const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); | |
| 3695 | + const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); | |
| 3696 | + const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); | |
| 3697 | + if (distance > 5) { | |
| 3698 | + touchStateRef.current.dismissOnTouchEnd = true; | |
| 3699 | + } | |
| 3700 | + if (distance > 10) { | |
| 3701 | + closeOnPressOutside(event); | |
| 3702 | + cancelDismissOnEndTimeout.clear(); | |
| 3703 | + touchStateRef.current = null; | |
| 3704 | + } | |
| 3705 | + } | |
| 3706 | + function handleTouchMoveCapture(event) { | |
| 3707 | + addTargetEventListenerOnce(event, handleTouchMove); | |
| 3708 | + } | |
| 3709 | + function handleTouchEnd(event) { | |
| 3710 | + if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { | |
| 3711 | + return; | |
| 3712 | + } | |
| 3713 | + if (touchStateRef.current.dismissOnTouchEnd) { | |
| 3714 | + closeOnPressOutside(event); | |
| 3715 | + } | |
| 3716 | + cancelDismissOnEndTimeout.clear(); | |
| 3717 | + touchStateRef.current = null; | |
| 3718 | + } | |
| 3719 | + function handleTouchEndCapture(event) { | |
| 3720 | + addTargetEventListenerOnce(event, handleTouchEnd); | |
| 3721 | + } | |
| 3722 | + 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, { | |
| 3723 | + capture: true, | |
| 3724 | + passive: true | |
| 3725 | + }), addEventListener(doc, "touchmove", handleTouchMoveCapture, { | |
| 3726 | + capture: true, | |
| 3727 | + passive: true | |
| 3728 | + }), addEventListener(doc, "touchend", handleTouchEndCapture, { | |
| 3729 | + capture: true, | |
| 3730 | + passive: true | |
| 3731 | + }))); | |
| 3732 | + return () => { | |
| 3733 | + unsubscribe(); | |
| 3734 | + compositionTimeout.clear(); | |
| 3735 | + preventedPressSuppressionTimeout.clear(); | |
| 3736 | + resetPressStartState(); | |
| 3737 | + suppressNextOutsideClickRef.current = false; | |
| 3738 | + clearInsideReactTree(); | |
| 3739 | + }; | |
| 3740 | + }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open2, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store2, cancelDismissOnEndTimeout]); | |
| 3741 | + const reference = React16.useMemo(() => ({ | |
| 3742 | + onKeyDown: closeOnEscapeKeyDown, | |
| 3743 | + onPointerDown: closeOnReferencePress, | |
| 3744 | + onClick: closeOnReferencePress | |
| 3745 | + }), [closeOnEscapeKeyDown, closeOnReferencePress]); | |
| 3746 | + const floating = React16.useMemo(() => ({ | |
| 3747 | + onKeyDown: closeOnEscapeKeyDown, | |
| 3748 | + // `onMouseDown` may be blocked if `event.preventDefault()` is called in | |
| 3749 | + // `onPointerDown`, such as with <NumberField.ScrubArea>. | |
| 3750 | + // See https://github.com/mui/base-ui/pull/3379 | |
| 3751 | + onPointerDown: markInsidePressStartPrevented, | |
| 3752 | + onMouseDown: markInsidePressStartPrevented, | |
| 3753 | + onClickCapture: markInsideReactTree, | |
| 3754 | + onMouseDownCapture(event) { | |
| 3755 | + markInsideReactTree(); | |
| 3756 | + markPressStartedInsideReactTree(event); | |
| 3757 | + }, | |
| 3758 | + onPointerDownCapture(event) { | |
| 3759 | + markInsideReactTree(); | |
| 3760 | + markPressStartedInsideReactTree(event); | |
| 3761 | + }, | |
| 3762 | + onMouseUpCapture: markInsideReactTree, | |
| 3763 | + onTouchEndCapture: markInsideReactTree, | |
| 3764 | + onTouchMoveCapture: markInsideReactTree | |
| 3765 | + }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); | |
| 3766 | + return React16.useMemo(() => enabled ? { | |
| 3767 | + reference, | |
| 3768 | + floating, | |
| 3769 | + trigger: reference | |
| 3770 | + } : {}, [enabled, reference, floating]); | |
| 3771 | + } | |
| 3772 | + | |
| 3773 | + // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs | |
| 3774 | + var React24 = __toESM(require_react(), 1); | |
| 3775 | + | |
| 3776 | + // node_modules/@floating-ui/core/dist/floating-ui.core.mjs | |
| 3777 | + function computeCoordsFromPlacement(_ref, placement, rtl) { | |
| 3778 | + let { | |
| 3779 | + reference, | |
| 3780 | + floating | |
| 3781 | + } = _ref; | |
| 3782 | + const sideAxis = getSideAxis(placement); | |
| 3783 | + const alignmentAxis = getAlignmentAxis(placement); | |
| 3784 | + const alignLength = getAxisLength(alignmentAxis); | |
| 3785 | + const side = getSide(placement); | |
| 3786 | + const isVertical = sideAxis === "y"; | |
| 3787 | + const commonX = reference.x + reference.width / 2 - floating.width / 2; | |
| 3788 | + const commonY = reference.y + reference.height / 2 - floating.height / 2; | |
| 3789 | + const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; | |
| 3790 | + let coords; | |
| 3791 | + switch (side) { | |
| 3792 | + case "top": | |
| 3793 | + coords = { | |
| 3794 | + x: commonX, | |
| 3795 | + y: reference.y - floating.height | |
| 3796 | + }; | |
| 3797 | + break; | |
| 3798 | + case "bottom": | |
| 3799 | + coords = { | |
| 3800 | + x: commonX, | |
| 3801 | + y: reference.y + reference.height | |
| 3802 | + }; | |
| 3803 | + break; | |
| 3804 | + case "right": | |
| 3805 | + coords = { | |
| 3806 | + x: reference.x + reference.width, | |
| 3807 | + y: commonY | |
| 3808 | + }; | |
| 3809 | + break; | |
| 3810 | + case "left": | |
| 3811 | + coords = { | |
| 3812 | + x: reference.x - floating.width, | |
| 3813 | + y: commonY | |
| 3814 | + }; | |
| 3815 | + break; | |
| 3816 | + default: | |
| 3817 | + coords = { | |
| 3818 | + x: reference.x, | |
| 3819 | + y: reference.y | |
| 3820 | + }; | |
| 3821 | + } | |
| 3822 | + const alignment = getAlignment(placement); | |
| 3823 | + if (alignment) { | |
| 3824 | + coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1); | |
| 3825 | + } | |
| 3826 | + return coords; | |
| 3827 | + } | |
| 3828 | + async function detectOverflow(state, options) { | |
| 3829 | + var _await$platform$isEle; | |
| 3830 | + if (options === void 0) { | |
| 3831 | + options = {}; | |
| 3832 | + } | |
| 3833 | + const { | |
| 3834 | + x, | |
| 3835 | + y, | |
| 3836 | + platform: platform3, | |
| 3837 | + rects, | |
| 3838 | + elements, | |
| 3839 | + strategy | |
| 3840 | + } = state; | |
| 3841 | + const { | |
| 3842 | + boundary = "clippingAncestors", | |
| 3843 | + rootBoundary = "viewport", | |
| 3844 | + elementContext = "floating", | |
| 3845 | + altBoundary = false, | |
| 3846 | + padding = 0 | |
| 3847 | + } = evaluate(options, state); | |
| 3848 | + const paddingObject = getPaddingObject(padding); | |
| 3849 | + const altContext = elementContext === "floating" ? "reference" : "floating"; | |
| 3850 | + const element = elements[altBoundary ? altContext : elementContext]; | |
| 3851 | + const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ | |
| 3852 | + 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)), | |
| 3853 | + boundary, | |
| 3854 | + rootBoundary, | |
| 3855 | + strategy | |
| 3856 | + })); | |
| 3857 | + const rect = elementContext === "floating" ? { | |
| 3858 | + x, | |
| 3859 | + y, | |
| 3860 | + width: rects.floating.width, | |
| 3861 | + height: rects.floating.height | |
| 3862 | + } : rects.reference; | |
| 3863 | + const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); | |
| 3864 | + const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) && await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { | |
| 3865 | + x: 1, | |
| 3866 | + y: 1 | |
| 3867 | + }; | |
| 3868 | + const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ | |
| 3869 | + elements, | |
| 3870 | + rect, | |
| 3871 | + offsetParent, | |
| 3872 | + strategy | |
| 3873 | + }) : rect); | |
| 3874 | + return { | |
| 3875 | + top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, | |
| 3876 | + bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, | |
| 3877 | + left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, | |
| 3878 | + right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x | |
| 3879 | + }; | |
| 3880 | + } | |
| 3881 | + var MAX_RESET_COUNT = 50; | |
| 3882 | + var computePosition = async (reference, floating, config) => { | |
| 3883 | + const { | |
| 3884 | + placement = "bottom", | |
| 3885 | + strategy = "absolute", | |
| 3886 | + middleware = [], | |
| 3887 | + platform: platform3 | |
| 3888 | + } = config; | |
| 3889 | + const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { | |
| 3890 | + ...platform3, | |
| 3891 | + detectOverflow | |
| 3892 | + }; | |
| 3893 | + const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); | |
| 3894 | + let rects = await platform3.getElementRects({ | |
| 3895 | + reference, | |
| 3896 | + floating, | |
| 3897 | + strategy | |
| 3898 | + }); | |
| 3899 | + let { | |
| 3900 | + x, | |
| 3901 | + y | |
| 3902 | + } = computeCoordsFromPlacement(rects, placement, rtl); | |
| 3903 | + let statefulPlacement = placement; | |
| 3904 | + let resetCount = 0; | |
| 3905 | + const middlewareData = {}; | |
| 3906 | + for (let i = 0; i < middleware.length; i++) { | |
| 3907 | + const currentMiddleware = middleware[i]; | |
| 3908 | + if (!currentMiddleware) { | |
| 3909 | + continue; | |
| 3910 | + } | |
| 3911 | + const { | |
| 3912 | + name, | |
| 3913 | + fn | |
| 3914 | + } = currentMiddleware; | |
| 3915 | + const { | |
| 3916 | + x: nextX, | |
| 3917 | + y: nextY, | |
| 3918 | + data, | |
| 3919 | + reset | |
| 3920 | + } = await fn({ | |
| 3921 | + x, | |
| 3922 | + y, | |
| 3923 | + initialPlacement: placement, | |
| 3924 | + placement: statefulPlacement, | |
| 3925 | + strategy, | |
| 3926 | + middlewareData, | |
| 3927 | + rects, | |
| 3928 | + platform: platformWithDetectOverflow, | |
| 3929 | + elements: { | |
| 3930 | + reference, | |
| 3931 | + floating | |
| 3932 | + } | |
| 3933 | + }); | |
| 3934 | + x = nextX != null ? nextX : x; | |
| 3935 | + y = nextY != null ? nextY : y; | |
| 3936 | + middlewareData[name] = { | |
| 3937 | + ...middlewareData[name], | |
| 3938 | + ...data | |
| 3939 | + }; | |
| 3940 | + if (reset && resetCount < MAX_RESET_COUNT) { | |
| 3941 | + resetCount++; | |
| 3942 | + if (typeof reset === "object") { | |
| 3943 | + if (reset.placement) { | |
| 3944 | + statefulPlacement = reset.placement; | |
| 3945 | + } | |
| 3946 | + if (reset.rects) { | |
| 3947 | + rects = reset.rects === true ? await platform3.getElementRects({ | |
| 3948 | + reference, | |
| 3949 | + floating, | |
| 3950 | + strategy | |
| 3951 | + }) : reset.rects; | |
| 3952 | + } | |
| 3953 | + ({ | |
| 3954 | + x, | |
| 3955 | + y | |
| 3956 | + } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); | |
| 3957 | + } | |
| 3958 | + i = -1; | |
| 3959 | + } | |
| 3960 | + } | |
| 3961 | + return { | |
| 3962 | + x, | |
| 3963 | + y, | |
| 3964 | + placement: statefulPlacement, | |
| 3965 | + strategy, | |
| 3966 | + middlewareData | |
| 3967 | + }; | |
| 3968 | + }; | |
| 3969 | + var flip = function(options) { | |
| 3970 | + if (options === void 0) { | |
| 3971 | + options = {}; | |
| 3972 | + } | |
| 3973 | + return { | |
| 3974 | + name: "flip", | |
| 3975 | + options, | |
| 3976 | + async fn(state) { | |
| 3977 | + var _middlewareData$arrow, _middlewareData$flip; | |
| 3978 | + const { | |
| 3979 | + placement, | |
| 3980 | + middlewareData, | |
| 3981 | + rects, | |
| 3982 | + initialPlacement, | |
| 3983 | + platform: platform3, | |
| 3984 | + elements | |
| 3985 | + } = state; | |
| 3986 | + const { | |
| 3987 | + mainAxis: checkMainAxis = true, | |
| 3988 | + crossAxis: checkCrossAxis = true, | |
| 3989 | + fallbackPlacements: specifiedFallbackPlacements, | |
| 3990 | + fallbackStrategy = "bestFit", | |
| 3991 | + fallbackAxisSideDirection = "none", | |
| 3992 | + flipAlignment = true, | |
| 3993 | + ...detectOverflowOptions | |
| 3994 | + } = evaluate(options, state); | |
| 3995 | + if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { | |
| 3996 | + return {}; | |
| 3997 | + } | |
| 3998 | + const side = getSide(placement); | |
| 3999 | + const initialSideAxis = getSideAxis(initialPlacement); | |
| 4000 | + const isBasePlacement = getSide(initialPlacement) === initialPlacement; | |
| 4001 | + const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); | |
| 4002 | + const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); | |
| 4003 | + const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; | |
| 4004 | + if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { | |
| 4005 | + fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); | |
| 4006 | + } | |
| 4007 | + const placements2 = [initialPlacement, ...fallbackPlacements]; | |
| 4008 | + const overflow = await platform3.detectOverflow(state, detectOverflowOptions); | |
| 4009 | + const overflows = []; | |
| 4010 | + let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; | |
| 4011 | + if (checkMainAxis) { | |
| 4012 | + overflows.push(overflow[side]); | |
| 4013 | + } | |
| 4014 | + if (checkCrossAxis) { | |
| 4015 | + const sides2 = getAlignmentSides(placement, rects, rtl); | |
| 4016 | + overflows.push(overflow[sides2[0]], overflow[sides2[1]]); | |
| 4017 | + } | |
| 4018 | + overflowsData = [...overflowsData, { | |
| 4019 | + placement, | |
| 4020 | + overflows | |
| 4021 | + }]; | |
| 4022 | + if (!overflows.every((side2) => side2 <= 0)) { | |
| 4023 | + var _middlewareData$flip2, _overflowsData$filter; | |
| 4024 | + const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; | |
| 4025 | + const nextPlacement = placements2[nextIndex]; | |
| 4026 | + if (nextPlacement) { | |
| 4027 | + const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; | |
| 4028 | + if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis | |
| 4029 | + // overflows the main axis. | |
| 4030 | + overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { | |
| 4031 | + return { | |
| 4032 | + data: { | |
| 4033 | + index: nextIndex, | |
| 4034 | + overflows: overflowsData | |
| 4035 | + }, | |
| 4036 | + reset: { | |
| 4037 | + placement: nextPlacement | |
| 4038 | + } | |
| 4039 | + }; | |
| 4040 | + } | |
| 4041 | + } | |
| 4042 | + 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; | |
| 4043 | + if (!resetPlacement) { | |
| 4044 | + switch (fallbackStrategy) { | |
| 4045 | + case "bestFit": { | |
| 4046 | + var _overflowsData$filter2; | |
| 4047 | + const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { | |
| 4048 | + if (hasFallbackAxisSideDirection) { | |
| 4049 | + const currentSideAxis = getSideAxis(d.placement); | |
| 4050 | + return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal | |
| 4051 | + // reading directions favoring greater width. | |
| 4052 | + currentSideAxis === "y"; | |
| 4053 | + } | |
| 4054 | + return true; | |
| 4055 | + }).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]; | |
| 4056 | + if (placement2) { | |
| 4057 | + resetPlacement = placement2; | |
| 4058 | + } | |
| 4059 | + break; | |
| 4060 | + } | |
| 4061 | + case "initialPlacement": | |
| 4062 | + resetPlacement = initialPlacement; | |
| 4063 | + break; | |
| 4064 | + } | |
| 4065 | + } | |
| 4066 | + if (placement !== resetPlacement) { | |
| 4067 | + return { | |
| 4068 | + reset: { | |
| 4069 | + placement: resetPlacement | |
| 4070 | + } | |
| 4071 | + }; | |
| 4072 | + } | |
| 4073 | + } | |
| 4074 | + return {}; | |
| 4075 | + } | |
| 4076 | + }; | |
| 4077 | + }; | |
| 4078 | + var originSides = /* @__PURE__ */ new Set(["left", "top"]); | |
| 4079 | + async function convertValueToCoords(state, options) { | |
| 4080 | + const { | |
| 4081 | + placement, | |
| 4082 | + platform: platform3, | |
| 4083 | + elements | |
| 4084 | + } = state; | |
| 4085 | + const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); | |
| 4086 | + const side = getSide(placement); | |
| 4087 | + const alignment = getAlignment(placement); | |
| 4088 | + const isVertical = getSideAxis(placement) === "y"; | |
| 4089 | + const mainAxisMulti = originSides.has(side) ? -1 : 1; | |
| 4090 | + const crossAxisMulti = rtl && isVertical ? -1 : 1; | |
| 4091 | + const rawValue = evaluate(options, state); | |
| 4092 | + let { | |
| 4093 | + mainAxis, | |
| 4094 | + crossAxis, | |
| 4095 | + alignmentAxis | |
| 4096 | + } = typeof rawValue === "number" ? { | |
| 4097 | + mainAxis: rawValue, | |
| 4098 | + crossAxis: 0, | |
| 4099 | + alignmentAxis: null | |
| 4100 | + } : { | |
| 4101 | + mainAxis: rawValue.mainAxis || 0, | |
| 4102 | + crossAxis: rawValue.crossAxis || 0, | |
| 4103 | + alignmentAxis: rawValue.alignmentAxis | |
| 4104 | + }; | |
| 4105 | + if (alignment && typeof alignmentAxis === "number") { | |
| 4106 | + crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; | |
| 4107 | + } | |
| 4108 | + return isVertical ? { | |
| 4109 | + x: crossAxis * crossAxisMulti, | |
| 4110 | + y: mainAxis * mainAxisMulti | |
| 4111 | + } : { | |
| 4112 | + x: mainAxis * mainAxisMulti, | |
| 4113 | + y: crossAxis * crossAxisMulti | |
| 4114 | + }; | |
| 4115 | + } | |
| 4116 | + var offset = function(options) { | |
| 4117 | + if (options === void 0) { | |
| 4118 | + options = 0; | |
| 4119 | + } | |
| 4120 | + return { | |
| 4121 | + name: "offset", | |
| 4122 | + options, | |
| 4123 | + async fn(state) { | |
| 4124 | + var _middlewareData$offse, _middlewareData$arrow; | |
| 4125 | + const { | |
| 4126 | + x, | |
| 4127 | + y, | |
| 4128 | + placement, | |
| 4129 | + middlewareData | |
| 4130 | + } = state; | |
| 4131 | + const diffCoords = await convertValueToCoords(state, options); | |
| 4132 | + if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { | |
| 4133 | + return {}; | |
| 4134 | + } | |
| 4135 | + return { | |
| 4136 | + x: x + diffCoords.x, | |
| 4137 | + y: y + diffCoords.y, | |
| 4138 | + data: { | |
| 4139 | + ...diffCoords, | |
| 4140 | + placement | |
| 4141 | + } | |
| 4142 | + }; | |
| 4143 | + } | |
| 4144 | + }; | |
| 4145 | + }; | |
| 4146 | + var shift = function(options) { | |
| 4147 | + if (options === void 0) { | |
| 4148 | + options = {}; | |
| 4149 | + } | |
| 4150 | + return { | |
| 4151 | + name: "shift", | |
| 4152 | + options, | |
| 4153 | + async fn(state) { | |
| 4154 | + const { | |
| 4155 | + x, | |
| 4156 | + y, | |
| 4157 | + placement, | |
| 4158 | + platform: platform3 | |
| 4159 | + } = state; | |
| 4160 | + const { | |
| 4161 | + mainAxis: checkMainAxis = true, | |
| 4162 | + crossAxis: checkCrossAxis = false, | |
| 4163 | + limiter = { | |
| 4164 | + fn: (_ref) => { | |
| 4165 | + let { | |
| 4166 | + x: x2, | |
| 4167 | + y: y2 | |
| 4168 | + } = _ref; | |
| 4169 | + return { | |
| 4170 | + x: x2, | |
| 4171 | + y: y2 | |
| 4172 | + }; | |
| 4173 | + } | |
| 4174 | + }, | |
| 4175 | + ...detectOverflowOptions | |
| 4176 | + } = evaluate(options, state); | |
| 4177 | + const coords = { | |
| 4178 | + x, | |
| 4179 | + y | |
| 4180 | + }; | |
| 4181 | + const overflow = await platform3.detectOverflow(state, detectOverflowOptions); | |
| 4182 | + const crossAxis = getSideAxis(placement); | |
| 4183 | + const mainAxis = getOppositeAxis(crossAxis); | |
| 4184 | + let mainAxisCoord = coords[mainAxis]; | |
| 4185 | + let crossAxisCoord = coords[crossAxis]; | |
| 4186 | + const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]); | |
| 4187 | + if (checkMainAxis) { | |
| 4188 | + mainAxisCoord = clampCoord(mainAxis, mainAxisCoord); | |
| 4189 | + } | |
| 4190 | + if (checkCrossAxis) { | |
| 4191 | + crossAxisCoord = clampCoord(crossAxis, crossAxisCoord); | |
| 4192 | + } | |
| 4193 | + const limitedCoords = limiter.fn({ | |
| 4194 | + ...state, | |
| 4195 | + [mainAxis]: mainAxisCoord, | |
| 4196 | + [crossAxis]: crossAxisCoord | |
| 4197 | + }); | |
| 4198 | + return { | |
| 4199 | + ...limitedCoords, | |
| 4200 | + data: { | |
| 4201 | + x: limitedCoords.x - x, | |
| 4202 | + y: limitedCoords.y - y, | |
| 4203 | + enabled: { | |
| 4204 | + [mainAxis]: checkMainAxis, | |
| 4205 | + [crossAxis]: checkCrossAxis | |
| 4206 | + } | |
| 4207 | + } | |
| 4208 | + }; | |
| 4209 | + } | |
| 4210 | + }; | |
| 4211 | + }; | |
| 4212 | + var limitShift = function(options) { | |
| 4213 | + if (options === void 0) { | |
| 4214 | + options = {}; | |
| 4215 | + } | |
| 4216 | + return { | |
| 4217 | + options, | |
| 4218 | + fn(state) { | |
| 4219 | + var _rawOffset$mainAxis, _rawOffset$crossAxis; | |
| 4220 | + const { | |
| 4221 | + x, | |
| 4222 | + y, | |
| 4223 | + placement, | |
| 4224 | + rects, | |
| 4225 | + middlewareData | |
| 4226 | + } = state; | |
| 4227 | + const { | |
| 4228 | + offset: offset4 = 0, | |
| 4229 | + mainAxis: checkMainAxis = true, | |
| 4230 | + crossAxis: checkCrossAxis = true | |
| 4231 | + } = evaluate(options, state); | |
| 4232 | + const coords = { | |
| 4233 | + x, | |
| 4234 | + y | |
| 4235 | + }; | |
| 4236 | + const crossAxis = getSideAxis(placement); | |
| 4237 | + const mainAxis = getOppositeAxis(crossAxis); | |
| 4238 | + let mainAxisCoord = coords[mainAxis]; | |
| 4239 | + let crossAxisCoord = coords[crossAxis]; | |
| 4240 | + const rawOffset = evaluate(offset4, state); | |
| 4241 | + const computedOffset = typeof rawOffset === "number" ? { | |
| 4242 | + mainAxis: rawOffset, | |
| 4243 | + crossAxis: 0 | |
| 4244 | + } : { | |
| 4245 | + mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0, | |
| 4246 | + crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0 | |
| 4247 | + }; | |
| 4248 | + if (checkMainAxis) { | |
| 4249 | + const len = mainAxis === "y" ? "height" : "width"; | |
| 4250 | + const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; | |
| 4251 | + const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; | |
| 4252 | + if (mainAxisCoord < limitMin) { | |
| 4253 | + mainAxisCoord = limitMin; | |
| 4254 | + } else if (mainAxisCoord > limitMax) { | |
| 4255 | + mainAxisCoord = limitMax; | |
| 4256 | + } | |
| 4257 | + } | |
| 4258 | + if (checkCrossAxis) { | |
| 4259 | + var _middlewareData$offse, _middlewareData$offse2; | |
| 4260 | + const len = mainAxis === "y" ? "width" : "height"; | |
| 4261 | + const isOriginSide = originSides.has(getSide(placement)); | |
| 4262 | + 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); | |
| 4263 | + 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); | |
| 4264 | + if (crossAxisCoord < limitMin) { | |
| 4265 | + crossAxisCoord = limitMin; | |
| 4266 | + } else if (crossAxisCoord > limitMax) { | |
| 4267 | + crossAxisCoord = limitMax; | |
| 4268 | + } | |
| 4269 | + } | |
| 4270 | + return { | |
| 4271 | + [mainAxis]: mainAxisCoord, | |
| 4272 | + [crossAxis]: crossAxisCoord | |
| 4273 | + }; | |
| 4274 | + } | |
| 4275 | + }; | |
| 4276 | + }; | |
| 4277 | + var size = function(options) { | |
| 4278 | + if (options === void 0) { | |
| 4279 | + options = {}; | |
| 4280 | + } | |
| 4281 | + return { | |
| 4282 | + name: "size", | |
| 4283 | + options, | |
| 4284 | + async fn(state) { | |
| 4285 | + const { | |
| 4286 | + placement, | |
| 4287 | + rects, | |
| 4288 | + platform: platform3, | |
| 4289 | + elements | |
| 4290 | + } = state; | |
| 4291 | + const { | |
| 4292 | + apply = () => { | |
| 4293 | + }, | |
| 4294 | + ...detectOverflowOptions | |
| 4295 | + } = evaluate(options, state); | |
| 4296 | + const overflow = await platform3.detectOverflow(state, detectOverflowOptions); | |
| 4297 | + const side = getSide(placement); | |
| 4298 | + const alignment = getAlignment(placement); | |
| 4299 | + const isYAxis = getSideAxis(placement) === "y"; | |
| 4300 | + const { | |
| 4301 | + width, | |
| 4302 | + height | |
| 4303 | + } = rects.floating; | |
| 4304 | + let heightSide; | |
| 4305 | + let widthSide; | |
| 4306 | + if (side === "top" || side === "bottom") { | |
| 4307 | + heightSide = side; | |
| 4308 | + widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; | |
| 4309 | + } else { | |
| 4310 | + widthSide = side; | |
| 4311 | + heightSide = alignment === "end" ? "top" : "bottom"; | |
| 4312 | + } | |
| 4313 | + const maximumClippingHeight = height - overflow.top - overflow.bottom; | |
| 4314 | + const maximumClippingWidth = width - overflow.left - overflow.right; | |
| 4315 | + const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); | |
| 4316 | + const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); | |
| 4317 | + const shiftData = state.middlewareData.shift; | |
| 4318 | + const noShift = !shiftData; | |
| 4319 | + let availableHeight2 = overflowAvailableHeight; | |
| 4320 | + let availableWidth2 = overflowAvailableWidth; | |
| 4321 | + if (shiftData != null && shiftData.enabled.x) { | |
| 4322 | + availableWidth2 = maximumClippingWidth; | |
| 4323 | + } | |
| 4324 | + if (shiftData != null && shiftData.enabled.y) { | |
| 4325 | + availableHeight2 = maximumClippingHeight; | |
| 4326 | + } | |
| 4327 | + if (noShift && !alignment) { | |
| 4328 | + if (isYAxis) { | |
| 4329 | + availableWidth2 = width - 2 * max(overflow.left, overflow.right); | |
| 4330 | + } else { | |
| 4331 | + availableHeight2 = height - 2 * max(overflow.top, overflow.bottom); | |
| 4332 | + } | |
| 4333 | + } | |
| 4334 | + await apply({ | |
| 4335 | + ...state, | |
| 4336 | + availableWidth: availableWidth2, | |
| 4337 | + availableHeight: availableHeight2 | |
| 4338 | + }); | |
| 4339 | + const nextDimensions = await platform3.getDimensions(elements.floating); | |
| 4340 | + if (width !== nextDimensions.width || height !== nextDimensions.height) { | |
| 4341 | + return { | |
| 4342 | + reset: { | |
| 4343 | + rects: true | |
| 4344 | + } | |
| 4345 | + }; | |
| 4346 | + } | |
| 4347 | + return {}; | |
| 4348 | + } | |
| 4349 | + }; | |
| 4350 | + }; | |
| 4351 | + | |
| 4352 | + // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs | |
| 4353 | + function getCssDimensions(element) { | |
| 4354 | + const css = getComputedStyle2(element); | |
| 4355 | + let width = parseFloat(css.width) || 0; | |
| 4356 | + let height = parseFloat(css.height) || 0; | |
| 4357 | + const hasOffset = isHTMLElement(element); | |
| 4358 | + const offsetWidth = hasOffset ? element.offsetWidth : width; | |
| 4359 | + const offsetHeight = hasOffset ? element.offsetHeight : height; | |
| 4360 | + const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; | |
| 4361 | + if (shouldFallback) { | |
| 4362 | + width = offsetWidth; | |
| 4363 | + height = offsetHeight; | |
| 4364 | + } | |
| 4365 | + return { | |
| 4366 | + width, | |
| 4367 | + height, | |
| 4368 | + $: shouldFallback | |
| 4369 | + }; | |
| 4370 | + } | |
| 4371 | + function unwrapElement(element) { | |
| 4372 | + return !isElement(element) ? element.contextElement : element; | |
| 4373 | + } | |
| 4374 | + function getScale(element) { | |
| 4375 | + const domElement = unwrapElement(element); | |
| 4376 | + if (!isHTMLElement(domElement)) { | |
| 4377 | + return createCoords(1); | |
| 4378 | + } | |
| 4379 | + const rect = domElement.getBoundingClientRect(); | |
| 4380 | + const { | |
| 4381 | + width, | |
| 4382 | + height, | |
| 4383 | + $ | |
| 4384 | + } = getCssDimensions(domElement); | |
| 4385 | + let x = ($ ? round(rect.width) : rect.width) / width; | |
| 4386 | + let y = ($ ? round(rect.height) : rect.height) / height; | |
| 4387 | + if (!x || !Number.isFinite(x)) { | |
| 4388 | + x = 1; | |
| 4389 | + } | |
| 4390 | + if (!y || !Number.isFinite(y)) { | |
| 4391 | + y = 1; | |
| 4392 | + } | |
| 4393 | + return { | |
| 4394 | + x, | |
| 4395 | + y | |
| 4396 | + }; | |
| 4397 | + } | |
| 4398 | + var noOffsets = /* @__PURE__ */ createCoords(0); | |
| 4399 | + function getVisualOffsets(element) { | |
| 4400 | + const win = getWindow(element); | |
| 4401 | + if (!isWebKit() || !win.visualViewport) { | |
| 4402 | + return noOffsets; | |
| 4403 | + } | |
| 4404 | + return { | |
| 4405 | + x: win.visualViewport.offsetLeft, | |
| 4406 | + y: win.visualViewport.offsetTop | |
| 4407 | + }; | |
| 4408 | + } | |
| 4409 | + function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { | |
| 4410 | + if (isFixed === void 0) { | |
| 4411 | + isFixed = false; | |
| 4412 | + } | |
| 4413 | + return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element); | |
| 4414 | + } | |
| 4415 | + function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { | |
| 4416 | + if (includeScale === void 0) { | |
| 4417 | + includeScale = false; | |
| 4418 | + } | |
| 4419 | + if (isFixedStrategy === void 0) { | |
| 4420 | + isFixedStrategy = false; | |
| 4421 | + } | |
| 4422 | + const clientRect = element.getBoundingClientRect(); | |
| 4423 | + const domElement = unwrapElement(element); | |
| 4424 | + let scale = createCoords(1); | |
| 4425 | + if (includeScale) { | |
| 4426 | + if (offsetParent) { | |
| 4427 | + if (isElement(offsetParent)) { | |
| 4428 | + scale = getScale(offsetParent); | |
| 4429 | + } | |
| 4430 | + } else { | |
| 4431 | + scale = getScale(element); | |
| 4432 | + } | |
| 4433 | + } | |
| 4434 | + const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); | |
| 4435 | + let x = (clientRect.left + visualOffsets.x) / scale.x; | |
| 4436 | + let y = (clientRect.top + visualOffsets.y) / scale.y; | |
| 4437 | + let width = clientRect.width / scale.x; | |
| 4438 | + let height = clientRect.height / scale.y; | |
| 4439 | + if (domElement && offsetParent) { | |
| 4440 | + const win = getWindow(domElement); | |
| 4441 | + const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; | |
| 4442 | + let currentWin = win; | |
| 4443 | + let currentIFrame = getFrameElement(currentWin); | |
| 4444 | + while (currentIFrame && offsetWin !== currentWin) { | |
| 4445 | + const iframeScale = getScale(currentIFrame); | |
| 4446 | + const iframeRect = currentIFrame.getBoundingClientRect(); | |
| 4447 | + const css = getComputedStyle2(currentIFrame); | |
| 4448 | + const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; | |
| 4449 | + const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; | |
| 4450 | + x *= iframeScale.x; | |
| 4451 | + y *= iframeScale.y; | |
| 4452 | + width *= iframeScale.x; | |
| 4453 | + height *= iframeScale.y; | |
| 4454 | + x += left; | |
| 4455 | + y += top; | |
| 4456 | + currentWin = getWindow(currentIFrame); | |
| 4457 | + currentIFrame = getFrameElement(currentWin); | |
| 4458 | + } | |
| 4459 | + } | |
| 4460 | + return rectToClientRect({ | |
| 4461 | + width, | |
| 4462 | + height, | |
| 4463 | + x, | |
| 4464 | + y | |
| 4465 | + }); | |
| 4466 | + } | |
| 4467 | + function getWindowScrollBarX(element, rect) { | |
| 4468 | + const leftScroll = getNodeScroll(element).scrollLeft; | |
| 4469 | + if (!rect) { | |
| 4470 | + return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; | |
| 4471 | + } | |
| 4472 | + return rect.left + leftScroll; | |
| 4473 | + } | |
| 4474 | + function getHTMLOffset(documentElement, scroll) { | |
| 4475 | + const htmlRect = documentElement.getBoundingClientRect(); | |
| 4476 | + const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); | |
| 4477 | + const y = htmlRect.top + scroll.scrollTop; | |
| 4478 | + return { | |
| 4479 | + x, | |
| 4480 | + y | |
| 4481 | + }; | |
| 4482 | + } | |
| 4483 | + function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { | |
| 4484 | + let { | |
| 4485 | + elements, | |
| 4486 | + rect, | |
| 4487 | + offsetParent, | |
| 4488 | + strategy | |
| 4489 | + } = _ref; | |
| 4490 | + const isFixed = strategy === "fixed"; | |
| 4491 | + const documentElement = getDocumentElement(offsetParent); | |
| 4492 | + const topLayer = elements ? isTopLayer(elements.floating) : false; | |
| 4493 | + if (offsetParent === documentElement || topLayer && isFixed) { | |
| 4494 | + return rect; | |
| 4495 | + } | |
| 4496 | + let scroll = { | |
| 4497 | + scrollLeft: 0, | |
| 4498 | + scrollTop: 0 | |
| 4499 | + }; | |
| 4500 | + let scale = createCoords(1); | |
| 4501 | + const offsets = createCoords(0); | |
| 4502 | + const isOffsetParentAnElement = isHTMLElement(offsetParent); | |
| 4503 | + if (isOffsetParentAnElement || !isFixed) { | |
| 4504 | + if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { | |
| 4505 | + scroll = getNodeScroll(offsetParent); | |
| 4506 | + } | |
| 4507 | + if (isOffsetParentAnElement) { | |
| 4508 | + const offsetRect = getBoundingClientRect(offsetParent); | |
| 4509 | + scale = getScale(offsetParent); | |
| 4510 | + offsets.x = offsetRect.x + offsetParent.clientLeft; | |
| 4511 | + offsets.y = offsetRect.y + offsetParent.clientTop; | |
| 4512 | + } | |
| 4513 | + } | |
| 4514 | + const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); | |
| 4515 | + return { | |
| 4516 | + width: rect.width * scale.x, | |
| 4517 | + height: rect.height * scale.y, | |
| 4518 | + x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, | |
| 4519 | + y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y | |
| 4520 | + }; | |
| 4521 | + } | |
| 4522 | + function getClientRects(element) { | |
| 4523 | + return element.getClientRects ? Array.from(element.getClientRects()) : []; | |
| 4524 | + } | |
| 4525 | + function getDocumentRect(html) { | |
| 4526 | + const scroll = getNodeScroll(html); | |
| 4527 | + const body = html.ownerDocument.body; | |
| 4528 | + const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); | |
| 4529 | + const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); | |
| 4530 | + let x = -scroll.scrollLeft + getWindowScrollBarX(html); | |
| 4531 | + const y = -scroll.scrollTop; | |
| 4532 | + if (getComputedStyle2(body).direction === "rtl") { | |
| 4533 | + x += max(html.clientWidth, body.clientWidth) - width; | |
| 4534 | + } | |
| 4535 | + return { | |
| 4536 | + width, | |
| 4537 | + height, | |
| 4538 | + x, | |
| 4539 | + y | |
| 4540 | + }; | |
| 4541 | + } | |
| 4542 | + var SCROLLBAR_MAX = 25; | |
| 4543 | + function getViewportRect(element, strategy, rootBoundary) { | |
| 4544 | + if (rootBoundary === void 0) { | |
| 4545 | + rootBoundary = "viewport"; | |
| 4546 | + } | |
| 4547 | + const isLayoutViewport = rootBoundary === "layoutViewport"; | |
| 4548 | + const win = getWindow(element); | |
| 4549 | + const html = getDocumentElement(element); | |
| 4550 | + const visualViewport = win.visualViewport; | |
| 4551 | + let width = html.clientWidth; | |
| 4552 | + let height = html.clientHeight; | |
| 4553 | + let x = 0; | |
| 4554 | + let y = 0; | |
| 4555 | + if (visualViewport) { | |
| 4556 | + const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed"; | |
| 4557 | + if (isLayoutViewport) { | |
| 4558 | + if (!layoutRelativeClientCoords) { | |
| 4559 | + x = -visualViewport.offsetLeft; | |
| 4560 | + y = -visualViewport.offsetTop; | |
| 4561 | + } | |
| 4562 | + } else { | |
| 4563 | + width = visualViewport.width; | |
| 4564 | + height = visualViewport.height; | |
| 4565 | + if (layoutRelativeClientCoords) { | |
| 4566 | + x = visualViewport.offsetLeft; | |
| 4567 | + y = visualViewport.offsetTop; | |
| 4568 | + } | |
| 4569 | + } | |
| 4570 | + } | |
| 4571 | + const windowScrollbarX = getWindowScrollBarX(html); | |
| 4572 | + if (windowScrollbarX <= 0) { | |
| 4573 | + const doc = html.ownerDocument; | |
| 4574 | + const body = doc.body; | |
| 4575 | + const bodyStyles = getComputedStyle(body); | |
| 4576 | + const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; | |
| 4577 | + const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); | |
| 4578 | + const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth; | |
| 4579 | + if (gutter <= SCROLLBAR_MAX) { | |
| 4580 | + width -= gutter; | |
| 4581 | + } | |
| 4582 | + } | |
| 4583 | + return { | |
| 4584 | + width, | |
| 4585 | + height, | |
| 4586 | + x, | |
| 4587 | + y | |
| 4588 | + }; | |
| 4589 | + } | |
| 4590 | + function getInnerBoundingClientRect(element, strategy) { | |
| 4591 | + const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); | |
| 4592 | + const top = clientRect.top + element.clientTop; | |
| 4593 | + const left = clientRect.left + element.clientLeft; | |
| 4594 | + const scale = getScale(element); | |
| 4595 | + const width = element.clientWidth * scale.x; | |
| 4596 | + const height = element.clientHeight * scale.y; | |
| 4597 | + const x = left * scale.x; | |
| 4598 | + const y = top * scale.y; | |
| 4599 | + return { | |
| 4600 | + width, | |
| 4601 | + height, | |
| 4602 | + x, | |
| 4603 | + y | |
| 4604 | + }; | |
| 4605 | + } | |
| 4606 | + function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { | |
| 4607 | + let rect; | |
| 4608 | + if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") { | |
| 4609 | + rect = getViewportRect(element, strategy, clippingAncestor); | |
| 4610 | + } else if (clippingAncestor === "document") { | |
| 4611 | + rect = getDocumentRect(getDocumentElement(element)); | |
| 4612 | + } else if (isElement(clippingAncestor)) { | |
| 4613 | + rect = getInnerBoundingClientRect(clippingAncestor, strategy); | |
| 4614 | + } else { | |
| 4615 | + const visualOffsets = getVisualOffsets(element); | |
| 4616 | + rect = { | |
| 4617 | + x: clippingAncestor.x - visualOffsets.x, | |
| 4618 | + y: clippingAncestor.y - visualOffsets.y, | |
| 4619 | + width: clippingAncestor.width, | |
| 4620 | + height: clippingAncestor.height | |
| 4621 | + }; | |
| 4622 | + } | |
| 4623 | + return rectToClientRect(rect); | |
| 4624 | + } | |
| 4625 | + function getClippingElementAncestors(element, cache) { | |
| 4626 | + const cachedResult = cache.get(element); | |
| 4627 | + if (cachedResult) { | |
| 4628 | + return cachedResult; | |
| 4629 | + } | |
| 4630 | + let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); | |
| 4631 | + let lastKeptComputedStyle = null; | |
| 4632 | + const elementIsFixed = getComputedStyle2(element).position === "fixed"; | |
| 4633 | + let currentNode = elementIsFixed ? getParentNode(element) : element; | |
| 4634 | + while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { | |
| 4635 | + const computedStyle = getComputedStyle2(currentNode); | |
| 4636 | + const currentNodeIsContaining = isContainingBlock(currentNode); | |
| 4637 | + const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : ""; | |
| 4638 | + const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static"); | |
| 4639 | + if (shouldDropCurrentNode) { | |
| 4640 | + result = result.filter((ancestor) => ancestor !== currentNode); | |
| 4641 | + } else { | |
| 4642 | + lastKeptComputedStyle = computedStyle; | |
| 4643 | + } | |
| 4644 | + currentNode = getParentNode(currentNode); | |
| 4645 | + } | |
| 4646 | + cache.set(element, result); | |
| 4647 | + return result; | |
| 4648 | + } | |
| 4649 | + function getClippingRect(_ref) { | |
| 4650 | + let { | |
| 4651 | + element, | |
| 4652 | + boundary, | |
| 4653 | + rootBoundary, | |
| 4654 | + strategy | |
| 4655 | + } = _ref; | |
| 4656 | + const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); | |
| 4657 | + const clippingAncestors = [...elementClippingAncestors, rootBoundary]; | |
| 4658 | + const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); | |
| 4659 | + let top = firstRect.top; | |
| 4660 | + let right = firstRect.right; | |
| 4661 | + let bottom = firstRect.bottom; | |
| 4662 | + let left = firstRect.left; | |
| 4663 | + for (let i = 1; i < clippingAncestors.length; i++) { | |
| 4664 | + const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); | |
| 4665 | + top = max(rect.top, top); | |
| 4666 | + right = min(rect.right, right); | |
| 4667 | + bottom = min(rect.bottom, bottom); | |
| 4668 | + left = max(rect.left, left); | |
| 4669 | + } | |
| 4670 | + return { | |
| 4671 | + width: right - left, | |
| 4672 | + height: bottom - top, | |
| 4673 | + x: left, | |
| 4674 | + y: top | |
| 4675 | + }; | |
| 4676 | + } | |
| 4677 | + function getDimensions(element) { | |
| 4678 | + const { | |
| 4679 | + width, | |
| 4680 | + height | |
| 4681 | + } = getCssDimensions(element); | |
| 4682 | + return { | |
| 4683 | + width, | |
| 4684 | + height | |
| 4685 | + }; | |
| 4686 | + } | |
| 4687 | + function getRectRelativeToOffsetParent(element, offsetParent, strategy) { | |
| 4688 | + const isOffsetParentAnElement = isHTMLElement(offsetParent); | |
| 4689 | + const documentElement = getDocumentElement(offsetParent); | |
| 4690 | + const isFixed = strategy === "fixed"; | |
| 4691 | + const rect = getBoundingClientRect(element, true, isFixed, offsetParent); | |
| 4692 | + let scroll = { | |
| 4693 | + scrollLeft: 0, | |
| 4694 | + scrollTop: 0 | |
| 4695 | + }; | |
| 4696 | + const offsets = createCoords(0); | |
| 4697 | + if (isOffsetParentAnElement || !isFixed) { | |
| 4698 | + if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { | |
| 4699 | + scroll = getNodeScroll(offsetParent); | |
| 4700 | + } | |
| 4701 | + if (isOffsetParentAnElement) { | |
| 4702 | + const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); | |
| 4703 | + offsets.x = offsetRect.x + offsetParent.clientLeft; | |
| 4704 | + offsets.y = offsetRect.y + offsetParent.clientTop; | |
| 4705 | + } | |
| 4706 | + } | |
| 4707 | + if (!isOffsetParentAnElement && documentElement) { | |
| 4708 | + offsets.x = getWindowScrollBarX(documentElement); | |
| 4709 | + } | |
| 4710 | + const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); | |
| 4711 | + const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; | |
| 4712 | + const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; | |
| 4713 | + return { | |
| 4714 | + x, | |
| 4715 | + y, | |
| 4716 | + width: rect.width, | |
| 4717 | + height: rect.height | |
| 4718 | + }; | |
| 4719 | + } | |
| 4720 | + function isStaticPositioned(element) { | |
| 4721 | + return getComputedStyle2(element).position === "static"; | |
| 4722 | + } | |
| 4723 | + function getTrueOffsetParent(element, polyfill) { | |
| 4724 | + if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { | |
| 4725 | + return null; | |
| 4726 | + } | |
| 4727 | + if (polyfill) { | |
| 4728 | + return polyfill(element); | |
| 4729 | + } | |
| 4730 | + let rawOffsetParent = element.offsetParent; | |
| 4731 | + if (getDocumentElement(element) === rawOffsetParent) { | |
| 4732 | + rawOffsetParent = rawOffsetParent.ownerDocument.body; | |
| 4733 | + } | |
| 4734 | + return rawOffsetParent; | |
| 4735 | + } | |
| 4736 | + function getOffsetParent(element, polyfill) { | |
| 4737 | + const win = getWindow(element); | |
| 4738 | + if (isTopLayer(element)) { | |
| 4739 | + return win; | |
| 4740 | + } | |
| 4741 | + if (!isHTMLElement(element)) { | |
| 4742 | + let svgOffsetParent = getParentNode(element); | |
| 4743 | + while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { | |
| 4744 | + if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { | |
| 4745 | + return svgOffsetParent; | |
| 4746 | + } | |
| 4747 | + svgOffsetParent = getParentNode(svgOffsetParent); | |
| 4748 | + } | |
| 4749 | + return win; | |
| 4750 | + } | |
| 4751 | + let offsetParent = getTrueOffsetParent(element, polyfill); | |
| 4752 | + while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { | |
| 4753 | + offsetParent = getTrueOffsetParent(offsetParent, polyfill); | |
| 4754 | + } | |
| 4755 | + if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { | |
| 4756 | + return win; | |
| 4757 | + } | |
| 4758 | + return offsetParent || getContainingBlock(element) || win; | |
| 4759 | + } | |
| 4760 | + var getElementRects = async function(data) { | |
| 4761 | + const getOffsetParentFn = this.getOffsetParent || getOffsetParent; | |
| 4762 | + const getDimensionsFn = this.getDimensions; | |
| 4763 | + const floatingDimensions = await getDimensionsFn(data.floating); | |
| 4764 | + return { | |
| 4765 | + reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), | |
| 4766 | + floating: { | |
| 4767 | + x: 0, | |
| 4768 | + y: 0, | |
| 4769 | + width: floatingDimensions.width, | |
| 4770 | + height: floatingDimensions.height | |
| 4771 | + } | |
| 4772 | + }; | |
| 4773 | + }; | |
| 4774 | + function isRTL(element) { | |
| 4775 | + return getComputedStyle2(element).direction === "rtl"; | |
| 4776 | + } | |
| 4777 | + var platform2 = { | |
| 4778 | + convertOffsetParentRelativeRectToViewportRelativeRect, | |
| 4779 | + getDocumentElement, | |
| 4780 | + getClippingRect, | |
| 4781 | + getOffsetParent, | |
| 4782 | + getElementRects, | |
| 4783 | + getClientRects, | |
| 4784 | + getDimensions, | |
| 4785 | + getScale, | |
| 4786 | + isElement, | |
| 4787 | + isRTL | |
| 4788 | + }; | |
| 4789 | + function rectsAreEqual(a, b) { | |
| 4790 | + return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; | |
| 4791 | + } | |
| 4792 | + function observeMove(element, onMove, ancestorResize) { | |
| 4793 | + let io = null; | |
| 4794 | + let timeoutId; | |
| 4795 | + const root = getDocumentElement(element); | |
| 4796 | + function cleanup() { | |
| 4797 | + var _io; | |
| 4798 | + clearTimeout(timeoutId); | |
| 4799 | + (_io = io) == null || _io.disconnect(); | |
| 4800 | + io = null; | |
| 4801 | + } | |
| 4802 | + function refresh(skip, threshold) { | |
| 4803 | + if (skip === void 0) { | |
| 4804 | + skip = false; | |
| 4805 | + } | |
| 4806 | + if (threshold === void 0) { | |
| 4807 | + threshold = 1; | |
| 4808 | + } | |
| 4809 | + cleanup(); | |
| 4810 | + const elementRectForRootMargin = element.getBoundingClientRect(); | |
| 4811 | + const { | |
| 4812 | + left, | |
| 4813 | + top, | |
| 4814 | + width, | |
| 4815 | + height | |
| 4816 | + } = elementRectForRootMargin; | |
| 4817 | + if (!skip) { | |
| 4818 | + onMove(); | |
| 4819 | + } | |
| 4820 | + if (!width || !height) { | |
| 4821 | + return; | |
| 4822 | + } | |
| 4823 | + const insetTop = floor(top); | |
| 4824 | + const insetRight = floor(root.clientWidth - (left + width)); | |
| 4825 | + const insetBottom = floor(root.clientHeight - (top + height)); | |
| 4826 | + const insetLeft = floor(left); | |
| 4827 | + const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; | |
| 4828 | + const options = { | |
| 4829 | + rootMargin, | |
| 4830 | + threshold: max(0, min(1, threshold)) || 1 | |
| 4831 | + }; | |
| 4832 | + let isFirstUpdate = true; | |
| 4833 | + function handleObserve(entries) { | |
| 4834 | + const ratio = entries[0].intersectionRatio; | |
| 4835 | + if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { | |
| 4836 | + return refresh(); | |
| 4837 | + } | |
| 4838 | + if (ratio !== threshold) { | |
| 4839 | + if (!isFirstUpdate) { | |
| 4840 | + return refresh(); | |
| 4841 | + } | |
| 4842 | + if (!ratio) { | |
| 4843 | + timeoutId = setTimeout(() => { | |
| 4844 | + refresh(false, 1e-7); | |
| 4845 | + }, 1e3); | |
| 4846 | + } else { | |
| 4847 | + refresh(false, ratio); | |
| 4848 | + } | |
| 4849 | + } | |
| 4850 | + isFirstUpdate = false; | |
| 4851 | + } | |
| 4852 | + try { | |
| 4853 | + io = new IntersectionObserver(handleObserve, { | |
| 4854 | + ...options, | |
| 4855 | + // Handle <iframe>s | |
| 4856 | + root: root.ownerDocument | |
| 4857 | + }); | |
| 4858 | + } catch (_e) { | |
| 4859 | + io = new IntersectionObserver(handleObserve, options); | |
| 4860 | + } | |
| 4861 | + io.observe(element); | |
| 4862 | + } | |
| 4863 | + const win = getWindow(element); | |
| 4864 | + const handleResize = () => refresh(ancestorResize); | |
| 4865 | + win.addEventListener("resize", handleResize); | |
| 4866 | + refresh(true); | |
| 4867 | + return () => { | |
| 4868 | + win.removeEventListener("resize", handleResize); | |
| 4869 | + cleanup(); | |
| 4870 | + }; | |
| 4871 | + } | |
| 4872 | + function autoUpdate(reference, floating, update2, options) { | |
| 4873 | + if (options === void 0) { | |
| 4874 | + options = {}; | |
| 4875 | + } | |
| 4876 | + const { | |
| 4877 | + ancestorScroll = true, | |
| 4878 | + ancestorResize = true, | |
| 4879 | + elementResize = typeof ResizeObserver === "function", | |
| 4880 | + layoutShift = typeof IntersectionObserver === "function", | |
| 4881 | + animationFrame = false | |
| 4882 | + } = options; | |
| 4883 | + const referenceEl = unwrapElement(reference); | |
| 4884 | + const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; | |
| 4885 | + ancestors.forEach((ancestor) => { | |
| 4886 | + ancestorScroll && ancestor.addEventListener("scroll", update2); | |
| 4887 | + ancestorResize && ancestor.addEventListener("resize", update2); | |
| 4888 | + }); | |
| 4889 | + const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2, ancestorResize) : null; | |
| 4890 | + let reobserveFrame = -1; | |
| 4891 | + let resizeObserver = null; | |
| 4892 | + if (elementResize) { | |
| 4893 | + resizeObserver = new ResizeObserver((_ref) => { | |
| 4894 | + let [firstEntry] = _ref; | |
| 4895 | + if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { | |
| 4896 | + resizeObserver.unobserve(floating); | |
| 4897 | + cancelAnimationFrame(reobserveFrame); | |
| 4898 | + reobserveFrame = requestAnimationFrame(() => { | |
| 4899 | + var _resizeObserver; | |
| 4900 | + (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); | |
| 4901 | + }); | |
| 4902 | + } | |
| 4903 | + update2(); | |
| 4904 | + }); | |
| 4905 | + if (referenceEl && !animationFrame) { | |
| 4906 | + resizeObserver.observe(referenceEl); | |
| 4907 | + } | |
| 4908 | + if (floating) { | |
| 4909 | + resizeObserver.observe(floating); | |
| 4910 | + } | |
| 4911 | + } | |
| 4912 | + let frameId; | |
| 4913 | + let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; | |
| 4914 | + if (animationFrame) { | |
| 4915 | + frameLoop(); | |
| 4916 | + } | |
| 4917 | + function frameLoop() { | |
| 4918 | + const nextRefRect = getBoundingClientRect(reference); | |
| 4919 | + if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { | |
| 4920 | + update2(); | |
| 4921 | + } | |
| 4922 | + prevRefRect = nextRefRect; | |
| 4923 | + frameId = requestAnimationFrame(frameLoop); | |
| 4924 | + } | |
| 4925 | + update2(); | |
| 4926 | + return () => { | |
| 4927 | + var _resizeObserver2; | |
| 4928 | + ancestors.forEach((ancestor) => { | |
| 4929 | + ancestorScroll && ancestor.removeEventListener("scroll", update2); | |
| 4930 | + ancestorResize && ancestor.removeEventListener("resize", update2); | |
| 4931 | + }); | |
| 4932 | + cleanupIo == null || cleanupIo(); | |
| 4933 | + (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); | |
| 4934 | + resizeObserver = null; | |
| 4935 | + if (animationFrame) { | |
| 4936 | + cancelAnimationFrame(frameId); | |
| 4937 | + } | |
| 4938 | + }; | |
| 4939 | + } | |
| 4940 | + var offset2 = offset; | |
| 4941 | + var shift2 = shift; | |
| 4942 | + var flip2 = flip; | |
| 4943 | + var size2 = size; | |
| 4944 | + var limitShift2 = limitShift; | |
| 4945 | + var computePosition2 = (reference, floating, options) => { | |
| 4946 | + const cache = /* @__PURE__ */ new Map(); | |
| 4947 | + const mergedOptions = options != null ? options : {}; | |
| 4948 | + const platformWithCache = { | |
| 4949 | + ...platform2, | |
| 4950 | + ...mergedOptions.platform, | |
| 4951 | + _c: cache | |
| 4952 | + }; | |
| 4953 | + return computePosition(reference, floating, { | |
| 4954 | + ...mergedOptions, | |
| 4955 | + platform: platformWithCache | |
| 4956 | + }); | |
| 4957 | + }; | |
| 4958 | + | |
| 4959 | + // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs | |
| 4960 | + var React17 = __toESM(require_react(), 1); | |
| 4961 | + var import_react2 = __toESM(require_react(), 1); | |
| 4962 | + var ReactDOM3 = __toESM(require_react_dom(), 1); | |
| 4963 | + var isClient = typeof document !== "undefined"; | |
| 4964 | + var noop2 = function noop3() { | |
| 4965 | + }; | |
| 4966 | + var index = isClient ? import_react2.useLayoutEffect : noop2; | |
| 4967 | + function deepEqual(a, b) { | |
| 4968 | + if (a === b) { | |
| 4969 | + return true; | |
| 4970 | + } | |
| 4971 | + if (typeof a !== typeof b) { | |
| 4972 | + return false; | |
| 4973 | + } | |
| 4974 | + if (typeof a === "function" && a.toString() === b.toString()) { | |
| 4975 | + return true; | |
| 4976 | + } | |
| 4977 | + let length; | |
| 4978 | + let i; | |
| 4979 | + let keys; | |
| 4980 | + if (a && b && typeof a === "object") { | |
| 4981 | + if (Array.isArray(a)) { | |
| 4982 | + length = a.length; | |
| 4983 | + if (length !== b.length) return false; | |
| 4984 | + for (i = length; i-- !== 0; ) { | |
| 4985 | + if (!deepEqual(a[i], b[i])) { | |
| 4986 | + return false; | |
| 4987 | + } | |
| 4988 | + } | |
| 4989 | + return true; | |
| 4990 | + } | |
| 4991 | + keys = Object.keys(a); | |
| 4992 | + length = keys.length; | |
| 4993 | + if (length !== Object.keys(b).length) { | |
| 4994 | + return false; | |
| 4995 | + } | |
| 4996 | + for (i = length; i-- !== 0; ) { | |
| 4997 | + if (!{}.hasOwnProperty.call(b, keys[i])) { | |
| 4998 | + return false; | |
| 4999 | + } | |
| 5000 | + } | |
| 5001 | + for (i = length; i-- !== 0; ) { | |
| 5002 | + const key = keys[i]; | |
| 5003 | + if (key === "_owner" && a.$$typeof) { | |
| 5004 | + continue; | |
| 5005 | + } | |
| 5006 | + if (!deepEqual(a[key], b[key])) { | |
| 5007 | + return false; | |
| 5008 | + } | |
| 5009 | + } | |
| 5010 | + return true; | |
| 5011 | + } | |
| 5012 | + return a !== a && b !== b; | |
| 5013 | + } | |
| 5014 | + function getDPR(element) { | |
| 5015 | + if (typeof window === "undefined") { | |
| 5016 | + return 1; | |
| 5017 | + } | |
| 5018 | + const win = element.ownerDocument.defaultView || window; | |
| 5019 | + return win.devicePixelRatio || 1; | |
| 5020 | + } | |
| 5021 | + function roundByDPR(element, value) { | |
| 5022 | + const dpr = getDPR(element); | |
| 5023 | + return Math.round(value * dpr) / dpr; | |
| 5024 | + } | |
| 5025 | + function useLatestRef(value) { | |
| 5026 | + const ref = React17.useRef(value); | |
| 5027 | + index(() => { | |
| 5028 | + ref.current = value; | |
| 5029 | + }); | |
| 5030 | + return ref; | |
| 5031 | + } | |
| 5032 | + function useFloating(options) { | |
| 5033 | + if (options === void 0) { | |
| 5034 | + options = {}; | |
| 5035 | + } | |
| 5036 | + const { | |
| 5037 | + placement = "bottom", | |
| 5038 | + strategy = "absolute", | |
| 5039 | + middleware = [], | |
| 5040 | + platform: platform3, | |
| 5041 | + elements: { | |
| 5042 | + reference: externalReference, | |
| 5043 | + floating: externalFloating | |
| 5044 | + } = {}, | |
| 5045 | + transform = true, | |
| 5046 | + whileElementsMounted, | |
| 5047 | + open: open2 | |
| 5048 | + } = options; | |
| 5049 | + const [data, setData] = React17.useState({ | |
| 5050 | + x: 0, | |
| 5051 | + y: 0, | |
| 5052 | + strategy, | |
| 5053 | + placement, | |
| 5054 | + middlewareData: {}, | |
| 5055 | + isPositioned: false | |
| 5056 | + }); | |
| 5057 | + const [latestMiddleware, setLatestMiddleware] = React17.useState(middleware); | |
| 5058 | + if (!deepEqual(latestMiddleware, middleware)) { | |
| 5059 | + setLatestMiddleware(middleware); | |
| 5060 | + } | |
| 5061 | + const [_reference, _setReference] = React17.useState(null); | |
| 5062 | + const [_floating, _setFloating] = React17.useState(null); | |
| 5063 | + const setReference = React17.useCallback((node) => { | |
| 5064 | + if (node !== referenceRef.current) { | |
| 5065 | + referenceRef.current = node; | |
| 5066 | + _setReference(node); | |
| 5067 | + } | |
| 5068 | + }, []); | |
| 5069 | + const setFloating = React17.useCallback((node) => { | |
| 5070 | + if (node !== floatingRef.current) { | |
| 5071 | + floatingRef.current = node; | |
| 5072 | + _setFloating(node); | |
| 5073 | + } | |
| 5074 | + }, []); | |
| 5075 | + const referenceEl = externalReference || _reference; | |
| 5076 | + const floatingEl = externalFloating || _floating; | |
| 5077 | + const referenceRef = React17.useRef(null); | |
| 5078 | + const floatingRef = React17.useRef(null); | |
| 5079 | + const dataRef = React17.useRef(data); | |
| 5080 | + const hasWhileElementsMounted = whileElementsMounted != null; | |
| 5081 | + const whileElementsMountedRef = useLatestRef(whileElementsMounted); | |
| 5082 | + const platformRef = useLatestRef(platform3); | |
| 5083 | + const openRef = useLatestRef(open2); | |
| 5084 | + const update2 = React17.useCallback(() => { | |
| 5085 | + if (!referenceRef.current || !floatingRef.current) { | |
| 5086 | + return; | |
| 5087 | + } | |
| 5088 | + const config = { | |
| 5089 | + placement, | |
| 5090 | + strategy, | |
| 5091 | + middleware: latestMiddleware | |
| 5092 | + }; | |
| 5093 | + if (platformRef.current) { | |
| 5094 | + config.platform = platformRef.current; | |
| 5095 | + } | |
| 5096 | + computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { | |
| 5097 | + const fullData = { | |
| 5098 | + ...data2, | |
| 5099 | + // The floating element's position may be recomputed while it's closed | |
| 5100 | + // but still mounted (such as when transitioning out). To ensure | |
| 5101 | + // `isPositioned` will be `false` initially on the next open, avoid | |
| 5102 | + // setting it to `true` when `open === false` (must be specified). | |
| 5103 | + isPositioned: openRef.current !== false | |
| 5104 | + }; | |
| 5105 | + if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { | |
| 5106 | + dataRef.current = fullData; | |
| 5107 | + ReactDOM3.flushSync(() => { | |
| 5108 | + setData(fullData); | |
| 5109 | + }); | |
| 5110 | + } | |
| 5111 | + }); | |
| 5112 | + }, [latestMiddleware, placement, strategy, platformRef, openRef]); | |
| 5113 | + index(() => { | |
| 5114 | + if (open2 === false && dataRef.current.isPositioned) { | |
| 5115 | + dataRef.current.isPositioned = false; | |
| 5116 | + setData((data2) => ({ | |
| 5117 | + ...data2, | |
| 5118 | + isPositioned: false | |
| 5119 | + })); | |
| 5120 | + } | |
| 5121 | + }, [open2]); | |
| 5122 | + const isMountedRef = React17.useRef(false); | |
| 5123 | + index(() => { | |
| 5124 | + isMountedRef.current = true; | |
| 5125 | + return () => { | |
| 5126 | + isMountedRef.current = false; | |
| 5127 | + }; | |
| 5128 | + }, []); | |
| 5129 | + index(() => { | |
| 5130 | + if (referenceEl) referenceRef.current = referenceEl; | |
| 5131 | + if (floatingEl) floatingRef.current = floatingEl; | |
| 5132 | + if (referenceEl && floatingEl) { | |
| 5133 | + if (whileElementsMountedRef.current) { | |
| 5134 | + return whileElementsMountedRef.current(referenceEl, floatingEl, update2); | |
| 5135 | + } | |
| 5136 | + update2(); | |
| 5137 | + } | |
| 5138 | + }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); | |
| 5139 | + const refs = React17.useMemo(() => ({ | |
| 5140 | + reference: referenceRef, | |
| 5141 | + floating: floatingRef, | |
| 5142 | + setReference, | |
| 5143 | + setFloating | |
| 5144 | + }), [setReference, setFloating]); | |
| 5145 | + const elements = React17.useMemo(() => ({ | |
| 5146 | + reference: referenceEl, | |
| 5147 | + floating: floatingEl | |
| 5148 | + }), [referenceEl, floatingEl]); | |
| 5149 | + const floatingStyles = React17.useMemo(() => { | |
| 5150 | + const initialStyles = { | |
| 5151 | + position: strategy, | |
| 5152 | + left: 0, | |
| 5153 | + top: 0 | |
| 5154 | + }; | |
| 5155 | + if (!elements.floating) { | |
| 5156 | + return initialStyles; | |
| 5157 | + } | |
| 5158 | + const x = roundByDPR(elements.floating, data.x); | |
| 5159 | + const y = roundByDPR(elements.floating, data.y); | |
| 5160 | + if (transform) { | |
| 5161 | + return { | |
| 5162 | + ...initialStyles, | |
| 5163 | + transform: "translate(" + x + "px, " + y + "px)", | |
| 5164 | + ...getDPR(elements.floating) >= 1.5 && { | |
| 5165 | + willChange: "transform" | |
| 5166 | + } | |
| 5167 | + }; | |
| 5168 | + } | |
| 5169 | + return { | |
| 5170 | + position: strategy, | |
| 5171 | + left: x, | |
| 5172 | + top: y | |
| 5173 | + }; | |
| 5174 | + }, [strategy, transform, elements.floating, data.x, data.y]); | |
| 5175 | + return React17.useMemo(() => ({ | |
| 5176 | + ...data, | |
| 5177 | + update: update2, | |
| 5178 | + refs, | |
| 5179 | + elements, | |
| 5180 | + floatingStyles | |
| 5181 | + }), [data, update2, refs, elements, floatingStyles]); | |
| 5182 | + } | |
| 5183 | + var offset3 = (options, deps) => { | |
| 5184 | + const result = offset2(options); | |
| 5185 | + return { | |
| 5186 | + name: result.name, | |
| 5187 | + fn: result.fn, | |
| 5188 | + options: [options, deps] | |
| 5189 | + }; | |
| 5190 | + }; | |
| 5191 | + var shift3 = (options, deps) => { | |
| 5192 | + const result = shift2(options); | |
| 5193 | + return { | |
| 5194 | + name: result.name, | |
| 5195 | + fn: result.fn, | |
| 5196 | + options: [options, deps] | |
| 5197 | + }; | |
| 5198 | + }; | |
| 5199 | + var limitShift3 = (options, deps) => { | |
| 5200 | + const result = limitShift2(options); | |
| 5201 | + return { | |
| 5202 | + fn: result.fn, | |
| 5203 | + options: [options, deps] | |
| 5204 | + }; | |
| 5205 | + }; | |
| 5206 | + var flip3 = (options, deps) => { | |
| 5207 | + const result = flip2(options); | |
| 5208 | + return { | |
| 5209 | + name: result.name, | |
| 5210 | + fn: result.fn, | |
| 5211 | + options: [options, deps] | |
| 5212 | + }; | |
| 5213 | + }; | |
| 5214 | + var size3 = (options, deps) => { | |
| 5215 | + const result = size2(options); | |
| 5216 | + return { | |
| 5217 | + name: result.name, | |
| 5218 | + fn: result.fn, | |
| 5219 | + options: [options, deps] | |
| 5220 | + }; | |
| 5221 | + }; | |
| 5222 | + | |
| 5223 | + // node_modules/@base-ui/react/utils/popups/popupHandle.mjs | |
| 5224 | + var BasePopupHandle = class { | |
| 5225 | + /** | |
| 5226 | + * Stores of every root currently using this handle, in attach order. A handle is meant to be used | |
| 5227 | + * by a single mounted root, but roots can transiently overlap (e.g. during an animated route | |
| 5228 | + * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of | |
| 5229 | + * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first. | |
| 5230 | + */ | |
| 5231 | + attachedStores = []; | |
| 5232 | + /** | |
| 5233 | + * Store of the root that currently controls the handle: the most recently attached one still | |
| 5234 | + * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`. | |
| 5235 | + */ | |
| 5236 | + attachedStoreValue = null; | |
| 5237 | + /** | |
| 5238 | + * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer. | |
| 5239 | + */ | |
| 5240 | + storeListeners = /* @__PURE__ */ new Set(); | |
| 5241 | + /** | |
| 5242 | + * Creates a handle backed by the store used while no root is attached. | |
| 5243 | + * | |
| 5244 | + * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached, | |
| 5245 | + * so they can render and register without a mounted root. Triggers register into whichever store | |
| 5246 | + * `store` currently resolves to, so while detached they live in this store's trigger map and | |
| 5247 | + * migrate themselves to the root's store (and back) as it attaches/detaches. | |
| 5248 | + * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces | |
| 5249 | + * `MenuHandle.open()` in warning text. | |
| 5250 | + * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is | |
| 5251 | + * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to, | |
| 5252 | + * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning. | |
| 5253 | + */ | |
| 5254 | + constructor(fallbackStore, componentName, throwOnMissingTrigger = true) { | |
| 5255 | + this.fallbackStore = fallbackStore; | |
| 5256 | + this.componentName = componentName; | |
| 5257 | + this.throwOnMissingTrigger = throwOnMissingTrigger; | |
| 5258 | + } | |
| 5259 | + get attachedStore() { | |
| 5260 | + return this.attachedStoreValue; | |
| 5261 | + } | |
| 5262 | + /** | |
| 5263 | + * Store that detached triggers read from: the attached root's store, or an inert fallback store | |
| 5264 | + * used while no root is attached. | |
| 5265 | + * @internal | |
| 5266 | + */ | |
| 5267 | + get store() { | |
| 5268 | + return this.attachedStoreValue ?? this.fallbackStore; | |
| 5269 | + } | |
| 5270 | + /** | |
| 5271 | + * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on | |
| 5272 | + * the handle during render because a handle can be shared by concurrent server-rendered requests. | |
| 5273 | + * @internal | |
| 5274 | + */ | |
| 5275 | + get serverStore() { | |
| 5276 | + return this.fallbackStore; | |
| 5277 | + } | |
| 5278 | + /** | |
| 5279 | + * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind | |
| 5280 | + * when a root attaches or detaches. Returns a function that removes the listener. | |
| 5281 | + * @internal | |
| 5282 | + */ | |
| 5283 | + subscribeStore(listener) { | |
| 5284 | + this.storeListeners.add(listener); | |
| 5285 | + return () => { | |
| 5286 | + this.storeListeners.delete(listener); | |
| 5287 | + }; | |
| 5288 | + } | |
| 5289 | + /** | |
| 5290 | + * Points the handle at a root's store and notifies subscribers so detached triggers re-render and | |
| 5291 | + * re-register into it (their registration effect migrates them when the store pointer changes). | |
| 5292 | + * Returns a cleanup function that detaches the store again. | |
| 5293 | + * @internal | |
| 5294 | + */ | |
| 5295 | + attachStore(newStore) { | |
| 5296 | + this.attachedStores.push(newStore); | |
| 5297 | + this.setActiveStore(newStore); | |
| 5298 | + if (true) { | |
| 5299 | + if (this.attachedStores.length > 1) { | |
| 5300 | + const dev = this; | |
| 5301 | + (dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => { | |
| 5302 | + if (this.attachedStores.length > 1) { | |
| 5303 | + 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."); | |
| 5304 | + } | |
| 5305 | + }); | |
| 5306 | + } | |
| 5307 | + } | |
| 5308 | + return () => { | |
| 5309 | + const index2 = this.attachedStores.lastIndexOf(newStore); | |
| 5310 | + if (index2 !== -1) { | |
| 5311 | + this.attachedStores.splice(index2, 1); | |
| 5312 | + } | |
| 5313 | + this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null); | |
| 5314 | + }; | |
| 5315 | + } | |
| 5316 | + /** | |
| 5317 | + * Sets the store that currently controls the handle and notifies subscribers when it changes, so | |
| 5318 | + * detached triggers re-render and migrate their registration to the new store. | |
| 5319 | + */ | |
| 5320 | + setActiveStore(store2) { | |
| 5321 | + if (this.attachedStoreValue !== store2) { | |
| 5322 | + this.attachedStoreValue = store2; | |
| 5323 | + this.storeListeners.forEach((listener) => { | |
| 5324 | + listener(); | |
| 5325 | + }); | |
| 5326 | + } | |
| 5327 | + } | |
| 5328 | + /** | |
| 5329 | + * Opens the attached root's store and associates it with the trigger with the given id, or a | |
| 5330 | + * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public | |
| 5331 | + * `open()` method, which only narrows the parameter type. | |
| 5332 | + * | |
| 5333 | + * When a trigger id is given but no matching trigger is registered, anchored popups throw (see | |
| 5334 | + * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead. | |
| 5335 | + * | |
| 5336 | + * This method should only be called in an event handler or an effect (not during rendering). | |
| 5337 | + * | |
| 5338 | + * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open | |
| 5339 | + * without associating any trigger. | |
| 5340 | + */ | |
| 5341 | + openByTrigger(triggerId) { | |
| 5342 | + const attachedStore = this.attachedStore; | |
| 5343 | + if (attachedStore === null) { | |
| 5344 | + if (true) { | |
| 5345 | + 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.`); | |
| 5346 | + } | |
| 5347 | + return; | |
| 5348 | + } | |
| 5349 | + let triggerElement; | |
| 5350 | + if (triggerId) { | |
| 5351 | + for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) { | |
| 5352 | + triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId); | |
| 5353 | + } | |
| 5354 | + triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId); | |
| 5355 | + } | |
| 5356 | + if (triggerId && !triggerElement) { | |
| 5357 | + if (this.throwOnMissingTrigger) { | |
| 5358 | + 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)); | |
| 5359 | + } | |
| 5360 | + if (true) { | |
| 5361 | + 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.`); | |
| 5362 | + } | |
| 5363 | + } | |
| 5364 | + attachedStore.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); | |
| 5365 | + } | |
| 5366 | + /** | |
| 5367 | + * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning) | |
| 5368 | + * while no root is attached. Shared by every concrete handle's public `close()` method. | |
| 5369 | + * | |
| 5370 | + * This method should only be called in an event handler or an effect (not during rendering). | |
| 5371 | + */ | |
| 5372 | + closePopup() { | |
| 5373 | + const attachedStore = this.attachedStore; | |
| 5374 | + if (attachedStore === null) { | |
| 5375 | + if (true) { | |
| 5376 | + console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`); | |
| 5377 | + } | |
| 5378 | + return; | |
| 5379 | + } | |
| 5380 | + attachedStore.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); | |
| 5381 | + } | |
| 5382 | + }; | |
| 5383 | + | |
| 5384 | + // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs | |
| 5385 | + var React22 = __toESM(require_react(), 1); | |
| 5386 | + var ReactDOM4 = __toESM(require_react_dom(), 1); | |
| 5387 | + | |
| 5388 | + // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs | |
| 5389 | + var React21 = __toESM(require_react(), 1); | |
| 5390 | + | |
| 5391 | + // node_modules/@base-ui/utils/store/useStore.mjs | |
| 5392 | + var React19 = __toESM(require_react(), 1); | |
| 5393 | + var import_shim = __toESM(require_shim(), 1); | |
| 5394 | + var import_with_selector = __toESM(require_with_selector(), 1); | |
| 5395 | + | |
| 5396 | + // node_modules/@base-ui/utils/fastHooks.mjs | |
| 5397 | + var React18 = __toESM(require_react(), 1); | |
| 5398 | + var hooks = []; | |
| 5399 | + var currentInstance = void 0; | |
| 5400 | + function getInstance() { | |
| 5401 | + return currentInstance; | |
| 5402 | + } | |
| 5403 | + function register2(hook) { | |
| 5404 | + hooks.push(hook); | |
| 5405 | + } | |
| 5406 | + function fastComponent(fn) { | |
| 5407 | + const FastComponent = (props, forwardedRef) => { | |
| 5408 | + const instance = useRefWithInit(createInstance).current; | |
| 5409 | + let result; | |
| 5410 | + try { | |
| 5411 | + currentInstance = instance; | |
| 5412 | + for (const hook of hooks) { | |
| 5413 | + hook.before(instance); | |
| 5414 | + } | |
| 5415 | + result = fn(props, forwardedRef); | |
| 5416 | + for (const hook of hooks) { | |
| 5417 | + hook.after(instance); | |
| 5418 | + } | |
| 5419 | + instance.didInitialize = true; | |
| 5420 | + } finally { | |
| 5421 | + currentInstance = void 0; | |
| 5422 | + } | |
| 5423 | + return result; | |
| 5424 | + }; | |
| 5425 | + FastComponent.displayName = fn.displayName || fn.name; | |
| 5426 | + return FastComponent; | |
| 5427 | + } | |
| 5428 | + function fastComponentRef(fn) { | |
| 5429 | + return /* @__PURE__ */ React18.forwardRef(fastComponent(fn)); | |
| 5430 | + } | |
| 5431 | + function createInstance() { | |
| 5432 | + return { | |
| 5433 | + didInitialize: false | |
| 5434 | + }; | |
| 5435 | + } | |
| 5436 | + | |
| 5437 | + // node_modules/@base-ui/utils/store/useStore.mjs | |
| 5438 | + var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); | |
| 5439 | + var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; | |
| 5440 | + function useStore(store2, selector, a1, a2, a3) { | |
| 5441 | + return useStoreImplementation(store2, selector, a1, a2, a3); | |
| 5442 | + } | |
| 5443 | + function useStoreR19(store2, selector, a1, a2, a3) { | |
| 5444 | + const getSelection = React19.useCallback(() => selector(store2.getSnapshot(), a1, a2, a3), [store2, selector, a1, a2, a3]); | |
| 5445 | + return (0, import_shim.useSyncExternalStore)(store2.subscribe, getSelection, getSelection); | |
| 5446 | + } | |
| 5447 | + register2({ | |
| 5448 | + before(instance) { | |
| 5449 | + instance.syncIndex = 0; | |
| 5450 | + if (!instance.didInitialize) { | |
| 5451 | + instance.syncTick = 1; | |
| 5452 | + instance.syncHooks = []; | |
| 5453 | + instance.didChangeStore = true; | |
| 5454 | + instance.getSnapshot = () => { | |
| 5455 | + let didChange2 = false; | |
| 5456 | + for (let i = 0; i < instance.syncHooks.length; i += 1) { | |
| 5457 | + const hook = instance.syncHooks[i]; | |
| 5458 | + const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); | |
| 5459 | + if (!Object.is(hook.value, value)) { | |
| 5460 | + didChange2 = true; | |
| 5461 | + hook.value = value; | |
| 5462 | + } | |
| 5463 | + } | |
| 5464 | + if (didChange2) { | |
| 5465 | + instance.syncTick += 1; | |
| 5466 | + } | |
| 5467 | + return instance.syncTick; | |
| 5468 | + }; | |
| 5469 | + } | |
| 5470 | + }, | |
| 5471 | + after(instance) { | |
| 5472 | + if (instance.syncHooks.length > 0) { | |
| 5473 | + if (instance.didChangeStore) { | |
| 5474 | + instance.didChangeStore = false; | |
| 5475 | + instance.subscribe = (onStoreChange) => { | |
| 5476 | + const stores = /* @__PURE__ */ new Set(); | |
| 5477 | + for (const hook of instance.syncHooks) { | |
| 5478 | + stores.add(hook.store); | |
| 5479 | + } | |
| 5480 | + const unsubscribes = []; | |
| 5481 | + for (const store2 of stores) { | |
| 5482 | + unsubscribes.push(store2.subscribe(onStoreChange)); | |
| 5483 | + } | |
| 5484 | + return () => { | |
| 5485 | + for (const unsubscribe of unsubscribes) { | |
| 5486 | + unsubscribe(); | |
| 5487 | + } | |
| 5488 | + }; | |
| 5489 | + }; | |
| 5490 | + } | |
| 5491 | + (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); | |
| 5492 | + } | |
| 5493 | + } | |
| 5494 | + }); | |
| 5495 | + function useStoreFast(store2, selector, a1, a2, a3) { | |
| 5496 | + const instance = getInstance(); | |
| 5497 | + if (!instance) { | |
| 5498 | + return useStoreR19(store2, selector, a1, a2, a3); | |
| 5499 | + } | |
| 5500 | + const index2 = instance.syncIndex; | |
| 5501 | + instance.syncIndex += 1; | |
| 5502 | + let hook; | |
| 5503 | + if (!instance.didInitialize) { | |
| 5504 | + hook = { | |
| 5505 | + store: store2, | |
| 5506 | + selector, | |
| 5507 | + a1, | |
| 5508 | + a2, | |
| 5509 | + a3, | |
| 5510 | + value: selector(store2.getSnapshot(), a1, a2, a3) | |
| 5511 | + }; | |
| 5512 | + instance.syncHooks.push(hook); | |
| 5513 | + } else { | |
| 5514 | + hook = instance.syncHooks[index2]; | |
| 5515 | + if (hook.store !== store2 || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { | |
| 5516 | + if (hook.store !== store2) { | |
| 5517 | + instance.didChangeStore = true; | |
| 5518 | + } | |
| 5519 | + hook.store = store2; | |
| 5520 | + hook.selector = selector; | |
| 5521 | + hook.a1 = a1; | |
| 5522 | + hook.a2 = a2; | |
| 5523 | + hook.a3 = a3; | |
| 5524 | + hook.value = selector(store2.getSnapshot(), a1, a2, a3); | |
| 5525 | + } | |
| 5526 | + } | |
| 5527 | + return hook.value; | |
| 5528 | + } | |
| 5529 | + function useStoreLegacy(store2, selector, a1, a2, a3) { | |
| 5530 | + return (0, import_with_selector.useSyncExternalStoreWithSelector)(store2.subscribe, store2.getSnapshot, store2.getSnapshot, (state) => selector(state, a1, a2, a3)); | |
| 5531 | + } | |
| 5532 | + | |
| 5533 | + // node_modules/@base-ui/utils/store/Store.mjs | |
| 5534 | + var Store = class { | |
| 5535 | + /** | |
| 5536 | + * Creates a store with the given initial state, constructing the class it is called on. | |
| 5537 | + * Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that | |
| 5538 | + * class but degrades the inferred instance type to `Store`; use `new` there instead. | |
| 5539 | + */ | |
| 5540 | + static create(state) { | |
| 5541 | + return new this(state); | |
| 5542 | + } | |
| 5543 | + /** | |
| 5544 | + * The current state of the store. | |
| 5545 | + * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. | |
| 5546 | + * 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). | |
| 5547 | + * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. | |
| 5548 | + * | |
| 5549 | + * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. | |
| 5550 | + */ | |
| 5551 | + // Internal state to handle recursive `setState()` calls | |
| 5552 | + constructor(state) { | |
| 5553 | + this.state = state; | |
| 5554 | + this.listeners = /* @__PURE__ */ new Set(); | |
| 5555 | + this.updateTick = 0; | |
| 5556 | + } | |
| 5557 | + /** | |
| 5558 | + * Registers a listener that will be called whenever the store's state changes. | |
| 5559 | + * | |
| 5560 | + * @param fn The listener function to be called on state changes. | |
| 5561 | + * @returns A function to unsubscribe the listener. | |
| 5562 | + */ | |
| 5563 | + subscribe = (fn) => { | |
| 5564 | + this.listeners.add(fn); | |
| 5565 | + return () => { | |
| 5566 | + this.listeners.delete(fn); | |
| 5567 | + }; | |
| 5568 | + }; | |
| 5569 | + /** | |
| 5570 | + * Returns the current state of the store. | |
| 5571 | + */ | |
| 5572 | + getSnapshot = () => { | |
| 5573 | + return this.state; | |
| 5574 | + }; | |
| 5575 | + /** | |
| 5576 | + * Updates the entire store's state and notifies all registered listeners. | |
| 5577 | + * | |
| 5578 | + * @param newState The new state to set for the store. | |
| 5579 | + */ | |
| 5580 | + setState(newState) { | |
| 5581 | + if (this.state === newState) { | |
| 5582 | + return; | |
| 5583 | + } | |
| 5584 | + this.state = newState; | |
| 5585 | + this.updateTick += 1; | |
| 5586 | + const currentTick = this.updateTick; | |
| 5587 | + for (const listener of this.listeners) { | |
| 5588 | + if (currentTick !== this.updateTick) { | |
| 5589 | + return; | |
| 5590 | + } | |
| 5591 | + listener(newState); | |
| 5592 | + } | |
| 5593 | + } | |
| 5594 | + /** | |
| 5595 | + * Merges the provided changes into the current state and notifies listeners if there are changes. | |
| 5596 | + * Each value must match its state key. Pass an exact known subset rather than a broad | |
| 5597 | + * `Partial<State>`, which may contain `undefined` for required state fields. | |
| 5598 | + * | |
| 5599 | + * @param changes An object containing the changes to apply to the current state. | |
| 5600 | + */ | |
| 5601 | + update(changes) { | |
| 5602 | + for (const key in changes) { | |
| 5603 | + if (!Object.is(this.state[key], changes[key])) { | |
| 5604 | + this.setState({ | |
| 5605 | + ...this.state, | |
| 5606 | + ...changes | |
| 5607 | + }); | |
| 5608 | + return; | |
| 5609 | + } | |
| 5610 | + } | |
| 5611 | + } | |
| 5612 | + /** | |
| 5613 | + * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. | |
| 5614 | + * | |
| 5615 | + * @param key The key in the store's state to update. | |
| 5616 | + * @param value The new value to set for the specified key. | |
| 5617 | + */ | |
| 5618 | + set(key, value) { | |
| 5619 | + if (!Object.is(this.state[key], value)) { | |
| 5620 | + this.setState({ | |
| 5621 | + ...this.state, | |
| 5622 | + [key]: value | |
| 5623 | + }); | |
| 5624 | + } | |
| 5625 | + } | |
| 5626 | + /** | |
| 5627 | + * Gives the state a new reference and updates all registered listeners. | |
| 5628 | + */ | |
| 5629 | + notifyAll() { | |
| 5630 | + const newState = { | |
| 5631 | + ...this.state | |
| 5632 | + }; | |
| 5633 | + this.setState(newState); | |
| 5634 | + } | |
| 5635 | + use(selector, a1, a2, a3) { | |
| 5636 | + return useStore(this, selector, a1, a2, a3); | |
| 5637 | + } | |
| 5638 | + }; | |
| 5639 | + | |
| 5640 | + // node_modules/@base-ui/utils/store/ReactStore.mjs | |
| 5641 | + var React20 = __toESM(require_react(), 1); | |
| 5642 | + var ReactStore = class extends Store { | |
| 5643 | + /** | |
| 5644 | + * Creates a new ReactStore instance. | |
| 5645 | + * | |
| 5646 | + * @param state Initial state of the store. | |
| 5647 | + * @param context Non-reactive context values. | |
| 5648 | + * @param selectors Optional selectors for use with `useState`. | |
| 5649 | + */ | |
| 5650 | + constructor(state, context = {}, selectors3) { | |
| 5651 | + super(state); | |
| 5652 | + this.context = context; | |
| 5653 | + this.selectors = selectors3; | |
| 5654 | + } | |
| 5655 | + /** | |
| 5656 | + * Non-reactive values such as refs, callbacks, etc. | |
| 5657 | + */ | |
| 5658 | + /** | |
| 5659 | + * Synchronizes a single external value into the store. | |
| 5660 | + * | |
| 5661 | + * Note that the while the value in `state` is updated immediately, the value returned | |
| 5662 | + * by `useState` is updated before the next render (similarly to React's `useState`). | |
| 5663 | + */ | |
| 5664 | + useSyncedValue(key, value) { | |
| 5665 | + React20.useDebugValue(key); | |
| 5666 | + const store2 = this; | |
| 5667 | + useIsoLayoutEffect(() => { | |
| 5668 | + if (store2.state[key] !== value) { | |
| 5669 | + store2.set(key, value); | |
| 5670 | + } | |
| 5671 | + }, [store2, key, value]); | |
| 5672 | + } | |
| 5673 | + /** | |
| 5674 | + * Synchronizes a single external value into the store and | |
| 5675 | + * cleans it up (sets to `undefined`) on unmount. | |
| 5676 | + * | |
| 5677 | + * Note that the while the value in `state` is updated immediately, the value returned | |
| 5678 | + * by `useState` is updated before the next render (similarly to React's `useState`). | |
| 5679 | + */ | |
| 5680 | + useSyncedValueWithCleanup(key, value) { | |
| 5681 | + const store2 = this; | |
| 5682 | + useIsoLayoutEffect(() => { | |
| 5683 | + if (store2.state[key] !== value) { | |
| 5684 | + store2.set(key, value); | |
| 5685 | + } | |
| 5686 | + return () => { | |
| 5687 | + store2.set(key, void 0); | |
| 5688 | + }; | |
| 5689 | + }, [store2, key, value]); | |
| 5690 | + } | |
| 5691 | + /** | |
| 5692 | + * Synchronizes multiple external values into the store. | |
| 5693 | + * Each value must match its state key. Pass an exact known subset rather than a broad | |
| 5694 | + * `Partial<State>`, which may contain `undefined` for required state fields. | |
| 5695 | + * | |
| 5696 | + * Note that the while the values in `state` are updated immediately, the values returned | |
| 5697 | + * by `useState` are updated before the next render (similarly to React's `useState`). | |
| 5698 | + * | |
| 5699 | + * @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted. | |
| 5700 | + */ | |
| 5701 | + useSyncedValues(statePart) { | |
| 5702 | + const store2 = this; | |
| 5703 | + if (true) { | |
| 5704 | + React20.useDebugValue(statePart, (p) => Object.keys(p)); | |
| 5705 | + const keys = React20.useRef(Object.keys(statePart)).current; | |
| 5706 | + const nextKeys = Object.keys(statePart); | |
| 5707 | + if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { | |
| 5708 | + console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); | |
| 5709 | + } | |
| 5710 | + } | |
| 5711 | + const dependencies = Object.values(statePart); | |
| 5712 | + useIsoLayoutEffect(() => { | |
| 5713 | + store2.update(statePart); | |
| 5714 | + }, [store2, ...dependencies]); | |
| 5715 | + } | |
| 5716 | + /** | |
| 5717 | + * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` | |
| 5718 | + * is non-undefined, the store's state at `key` is updated to match `controlled`. | |
| 5719 | + */ | |
| 5720 | + useControlledProp(key, controlled) { | |
| 5721 | + React20.useDebugValue(key); | |
| 5722 | + const store2 = this; | |
| 5723 | + const isControlled = controlled !== void 0; | |
| 5724 | + useIsoLayoutEffect(() => { | |
| 5725 | + if (isControlled && !Object.is(store2.state[key], controlled)) { | |
| 5726 | + store2.setState({ | |
| 5727 | + ...store2.state, | |
| 5728 | + [key]: controlled | |
| 5729 | + }); | |
| 5730 | + } | |
| 5731 | + }, [store2, key, controlled, isControlled]); | |
| 5732 | + if (true) { | |
| 5733 | + const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); | |
| 5734 | + if (!cache.has(key)) { | |
| 5735 | + cache.set(key, isControlled); | |
| 5736 | + } | |
| 5737 | + const previouslyControlled = cache.get(key); | |
| 5738 | + if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { | |
| 5739 | + 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).`); | |
| 5740 | + } | |
| 5741 | + } | |
| 5742 | + } | |
| 5743 | + /** Gets the current value from the store using a selector with the provided key. | |
| 5744 | + * | |
| 5745 | + * @param key Key of the selector to use. | |
| 5746 | + */ | |
| 5747 | + select(key, a1, a2, a3) { | |
| 5748 | + const selector = this.selectors[key]; | |
| 5749 | + return selector(this.state, a1, a2, a3); | |
| 5750 | + } | |
| 5751 | + /** | |
| 5752 | + * Returns a value from the store's state using a selector function. | |
| 5753 | + * Used to subscribe to specific parts of the state. | |
| 5754 | + * This methods causes a rerender whenever the selected state changes. | |
| 5755 | + * | |
| 5756 | + * @param key Key of the selector to use. | |
| 5757 | + */ | |
| 5758 | + useState(key, a1, a2, a3) { | |
| 5759 | + React20.useDebugValue(key); | |
| 5760 | + return useStore(this, this.selectors[key], a1, a2, a3); | |
| 5761 | + } | |
| 5762 | + /** | |
| 5763 | + * Wraps a function with `useStableCallback` to ensure it has a stable reference | |
| 5764 | + * and assigns it to the context. | |
| 5765 | + * | |
| 5766 | + * @param key Key of the event callback. Must be a function in the context. | |
| 5767 | + * @param fn Function to assign. | |
| 5768 | + */ | |
| 5769 | + useContextCallback(key, fn) { | |
| 5770 | + React20.useDebugValue(key); | |
| 5771 | + const stableFunction = useStableCallback(fn ?? NOOP); | |
| 5772 | + this.context[key] = stableFunction; | |
| 5773 | + } | |
| 5774 | + /** | |
| 5775 | + * Returns a stable setter function for a specific key in the store's state. | |
| 5776 | + * It's commonly used to pass as a ref callback to React elements. | |
| 5777 | + * | |
| 5778 | + * @param key Key of the state to set. | |
| 5779 | + */ | |
| 5780 | + useStateSetter(key) { | |
| 5781 | + const ref = React20.useRef(void 0); | |
| 5782 | + if (ref.current === void 0) { | |
| 5783 | + ref.current = (value) => { | |
| 5784 | + this.set(key, value); | |
| 5785 | + }; | |
| 5786 | + } | |
| 5787 | + return ref.current; | |
| 5788 | + } | |
| 5789 | + /** | |
| 5790 | + * Observes changes derived from the store's selectors and calls the listener when the selected value changes. | |
| 5791 | + * | |
| 5792 | + * @param key Key of the selector to observe. | |
| 5793 | + * @param listener Listener function called when the selector result changes. | |
| 5794 | + */ | |
| 5795 | + observe(selector, listener) { | |
| 5796 | + let selectFn; | |
| 5797 | + if (typeof selector === "function") { | |
| 5798 | + selectFn = selector; | |
| 5799 | + } else { | |
| 5800 | + selectFn = this.selectors[selector]; | |
| 5801 | + } | |
| 5802 | + let prevValue = selectFn(this.state); | |
| 5803 | + listener(prevValue, prevValue, this); | |
| 5804 | + return this.subscribe((nextState) => { | |
| 5805 | + const nextValue = selectFn(nextState); | |
| 5806 | + if (!Object.is(prevValue, nextValue)) { | |
| 5807 | + const oldValue = prevValue; | |
| 5808 | + prevValue = nextValue; | |
| 5809 | + listener(nextValue, oldValue, this); | |
| 5810 | + } | |
| 5811 | + }); | |
| 5812 | + } | |
| 5813 | + }; | |
| 5814 | + | |
| 5815 | + // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs | |
| 5816 | + var selectors = { | |
| 5817 | + open: (state) => state.open, | |
| 5818 | + transitionStatus: (state) => state.transitionStatus, | |
| 5819 | + domReferenceElement: (state) => state.domReferenceElement, | |
| 5820 | + referenceElement: (state) => state.positionReference ?? state.referenceElement, | |
| 5821 | + floatingElement: (state) => state.floatingElement, | |
| 5822 | + floatingId: (state) => state.floatingId | |
| 5823 | + }; | |
| 5824 | + var FloatingRootStore = class extends ReactStore { | |
| 5825 | + constructor(options) { | |
| 5826 | + const { | |
| 5827 | + syncOnly, | |
| 5828 | + nested, | |
| 5829 | + onOpenChange, | |
| 5830 | + triggerElements, | |
| 5831 | + ...initialState | |
| 5832 | + } = options; | |
| 5833 | + super({ | |
| 5834 | + ...initialState, | |
| 5835 | + positionReference: initialState.referenceElement, | |
| 5836 | + domReferenceElement: initialState.referenceElement | |
| 5837 | + }, { | |
| 5838 | + onOpenChange, | |
| 5839 | + dataRef: { | |
| 5840 | + current: {} | |
| 5841 | + }, | |
| 5842 | + events: createEventEmitter(), | |
| 5843 | + nested, | |
| 5844 | + triggerElements | |
| 5845 | + }, selectors); | |
| 5846 | + this.syncOnly = syncOnly; | |
| 5847 | + } | |
| 5848 | + /** | |
| 5849 | + * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. | |
| 5850 | + */ | |
| 5851 | + syncOpenEvent = (newOpen, event) => { | |
| 5852 | + if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing | |
| 5853 | + // click events to upgrade a hover-open. | |
| 5854 | + event != null && isClickLikeEvent(event)) { | |
| 5855 | + this.context.dataRef.current.openEvent = newOpen ? event : void 0; | |
| 5856 | + } | |
| 5857 | + }; | |
| 5858 | + /** | |
| 5859 | + * Runs the root-owned side effects for an open state change. | |
| 5860 | + */ | |
| 5861 | + dispatchOpenChange = (newOpen, eventDetails) => { | |
| 5862 | + this.syncOpenEvent(newOpen, eventDetails.event); | |
| 5863 | + const details = { | |
| 5864 | + open: newOpen, | |
| 5865 | + reason: eventDetails.reason, | |
| 5866 | + nativeEvent: eventDetails.event, | |
| 5867 | + nested: this.context.nested, | |
| 5868 | + triggerElement: eventDetails.trigger | |
| 5869 | + }; | |
| 5870 | + this.context.events.emit("openchange", details); | |
| 5871 | + }; | |
| 5872 | + /** | |
| 5873 | + * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. | |
| 5874 | + * | |
| 5875 | + * @param newOpen The new open state. | |
| 5876 | + * @param eventDetails Details about the event that triggered the open state change. | |
| 5877 | + */ | |
| 5878 | + setOpen = (newOpen, eventDetails) => { | |
| 5879 | + if (this.syncOnly) { | |
| 5880 | + this.context.onOpenChange?.(newOpen, eventDetails); | |
| 5881 | + return; | |
| 5882 | + } | |
| 5883 | + this.dispatchOpenChange(newOpen, eventDetails); | |
| 5884 | + this.context.onOpenChange?.(newOpen, eventDetails); | |
| 5885 | + }; | |
| 5886 | + }; | |
| 5887 | + | |
| 5888 | + // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs | |
| 5889 | + function useSyncedFloatingRootContext(options) { | |
| 5890 | + const { | |
| 5891 | + popupStore, | |
| 5892 | + treatPopupAsFloatingElement = false, | |
| 5893 | + floatingRootContext: floatingRootContextProp, | |
| 5894 | + floatingId, | |
| 5895 | + nested, | |
| 5896 | + onOpenChange | |
| 5897 | + } = options; | |
| 5898 | + const open2 = popupStore.useState("open"); | |
| 5899 | + const referenceElement = popupStore.useState("activeTriggerElement"); | |
| 5900 | + const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); | |
| 5901 | + const triggerElements = popupStore.context.triggerElements; | |
| 5902 | + const handleOpenChange = onOpenChange; | |
| 5903 | + const internalStoreRef = React21.useRef(null); | |
| 5904 | + if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { | |
| 5905 | + internalStoreRef.current = new FloatingRootStore({ | |
| 5906 | + open: open2, | |
| 5907 | + transitionStatus: void 0, | |
| 5908 | + referenceElement, | |
| 5909 | + floatingElement, | |
| 5910 | + triggerElements, | |
| 5911 | + onOpenChange: handleOpenChange, | |
| 5912 | + floatingId, | |
| 5913 | + syncOnly: true, | |
| 5914 | + nested | |
| 5915 | + }); | |
| 5916 | + } | |
| 5917 | + const store2 = floatingRootContextProp ?? internalStoreRef.current; | |
| 5918 | + popupStore.useSyncedValue("floatingId", floatingId); | |
| 5919 | + useIsoLayoutEffect(() => { | |
| 5920 | + const valuesToSync = { | |
| 5921 | + open: open2, | |
| 5922 | + floatingId, | |
| 5923 | + referenceElement, | |
| 5924 | + floatingElement | |
| 5925 | + }; | |
| 5926 | + if (isElement(referenceElement)) { | |
| 5927 | + valuesToSync.domReferenceElement = referenceElement; | |
| 5928 | + } | |
| 5929 | + if (store2.state.positionReference === store2.state.referenceElement) { | |
| 5930 | + valuesToSync.positionReference = referenceElement; | |
| 5931 | + } | |
| 5932 | + store2.update(valuesToSync); | |
| 5933 | + }, [open2, floatingId, referenceElement, floatingElement, store2]); | |
| 5934 | + store2.context.onOpenChange = handleOpenChange; | |
| 5935 | + store2.context.nested = nested; | |
| 5936 | + return store2; | |
| 5937 | + } | |
| 5938 | + | |
| 5939 | + // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs | |
| 5940 | + var FOCUSABLE_POPUP_PROPS = { | |
| 5941 | + tabIndex: -1, | |
| 5942 | + [FOCUSABLE_ATTRIBUTE]: "" | |
| 5943 | + }; | |
| 5944 | + function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) { | |
| 5945 | + const floatingId = useId(); | |
| 5946 | + const nested = useFloatingParentNodeId() != null; | |
| 5947 | + const store2 = useRefWithInit(() => createStore(floatingId, nested)).current; | |
| 5948 | + useSyncedFloatingRootContext({ | |
| 5949 | + popupStore: store2, | |
| 5950 | + treatPopupAsFloatingElement, | |
| 5951 | + floatingRootContext: store2.state.floatingRootContext, | |
| 5952 | + floatingId, | |
| 5953 | + nested, | |
| 5954 | + onOpenChange: store2.setOpen | |
| 5955 | + }); | |
| 5956 | + return store2; | |
| 5957 | + } | |
| 5958 | + function PopupHandleAttachment({ | |
| 5959 | + handle, | |
| 5960 | + store: store2 | |
| 5961 | + }) { | |
| 5962 | + useIsoLayoutEffect(() => { | |
| 5963 | + return handle.attachStore(store2); | |
| 5964 | + }, [handle, store2]); | |
| 5965 | + return null; | |
| 5966 | + } | |
| 5967 | + function syncTriggerCount(store2) { | |
| 5968 | + const triggerCount = store2.context.triggerElements.size; | |
| 5969 | + if (store2.select("open") && store2.state.triggerCount !== triggerCount) { | |
| 5970 | + store2.set("triggerCount", triggerCount); | |
| 5971 | + } | |
| 5972 | + } | |
| 5973 | + function useTriggerRegistration(id, store2) { | |
| 5974 | + const registrationRef = React22.useRef(null); | |
| 5975 | + return useStableCallback((element) => { | |
| 5976 | + const registration = registrationRef.current; | |
| 5977 | + if (registration !== null) { | |
| 5978 | + if (registration.element === element && registration.store === store2 && registration.id === id) { | |
| 5979 | + return; | |
| 5980 | + } | |
| 5981 | + registrationRef.current = null; | |
| 5982 | + const registeredStore = registration.store; | |
| 5983 | + if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) { | |
| 5984 | + registeredStore.context.triggerElements.delete(registration.id); | |
| 5985 | + syncTriggerCount(registeredStore); | |
| 5986 | + } | |
| 5987 | + } | |
| 5988 | + if (element !== null && id !== void 0) { | |
| 5989 | + registrationRef.current = { | |
| 5990 | + store: store2, | |
| 5991 | + id, | |
| 5992 | + element | |
| 5993 | + }; | |
| 5994 | + store2.context.triggerElements.add(id, element); | |
| 5995 | + syncTriggerCount(store2); | |
| 5996 | + } | |
| 5997 | + }); | |
| 5998 | + } | |
| 5999 | + function createPopupOpenState(state, open2, trigger, preventUnmountOnClose = false) { | |
| 6000 | + let preventUnmountingOnClose = state.preventUnmountingOnClose; | |
| 6001 | + if (open2) { | |
| 6002 | + preventUnmountingOnClose = false; | |
| 6003 | + } else if (preventUnmountOnClose) { | |
| 6004 | + preventUnmountingOnClose = true; | |
| 6005 | + } | |
| 6006 | + const triggerId = trigger?.id ?? null; | |
| 6007 | + let activeTriggerId = state.activeTriggerId; | |
| 6008 | + let activeTriggerElement = state.activeTriggerElement; | |
| 6009 | + if (triggerId || open2) { | |
| 6010 | + activeTriggerId = triggerId; | |
| 6011 | + activeTriggerElement = trigger ?? null; | |
| 6012 | + } | |
| 6013 | + return { | |
| 6014 | + open: open2, | |
| 6015 | + preventUnmountingOnClose, | |
| 6016 | + activeTriggerId, | |
| 6017 | + activeTriggerElement | |
| 6018 | + }; | |
| 6019 | + } | |
| 6020 | + function attachPreventUnmountOnClose(eventDetails) { | |
| 6021 | + let preventUnmountOnClose = false; | |
| 6022 | + eventDetails.preventUnmountOnClose = () => { | |
| 6023 | + preventUnmountOnClose = true; | |
| 6024 | + }; | |
| 6025 | + return () => preventUnmountOnClose; | |
| 6026 | + } | |
| 6027 | + function applyPopupOpenChange(store2, nextOpen, eventDetails, options = {}) { | |
| 6028 | + const reason = eventDetails.reason; | |
| 6029 | + const isHover = reason === reason_parts_exports.triggerHover; | |
| 6030 | + const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; | |
| 6031 | + const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); | |
| 6032 | + const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); | |
| 6033 | + store2.context.onOpenChange?.(nextOpen, eventDetails); | |
| 6034 | + if (eventDetails.isCanceled) { | |
| 6035 | + return; | |
| 6036 | + } | |
| 6037 | + options.onBeforeDispatch?.(); | |
| 6038 | + store2.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); | |
| 6039 | + const changeState = () => { | |
| 6040 | + const popupOpenState = createPopupOpenState(store2.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); | |
| 6041 | + const updatedState = { | |
| 6042 | + ...options.extraState, | |
| 6043 | + ...popupOpenState | |
| 6044 | + }; | |
| 6045 | + if (isFocusOpen) { | |
| 6046 | + updatedState.instantType = "focus"; | |
| 6047 | + } else if (isDismissClose) { | |
| 6048 | + updatedState.instantType = "dismiss"; | |
| 6049 | + } else if (isHover) { | |
| 6050 | + updatedState.instantType = void 0; | |
| 6051 | + } | |
| 6052 | + store2.update(updatedState); | |
| 6053 | + }; | |
| 6054 | + if (isHover) { | |
| 6055 | + ReactDOM4.flushSync(changeState); | |
| 6056 | + } else { | |
| 6057 | + changeState(); | |
| 6058 | + } | |
| 6059 | + } | |
| 6060 | + function useTriggerDataForwarding(triggerId, triggerElementRef, store2, stateUpdates) { | |
| 6061 | + const isMountedByThisTrigger = store2.useState("isMountedByTrigger", triggerId); | |
| 6062 | + const baseRegisterTrigger = useTriggerRegistration(triggerId, store2); | |
| 6063 | + const applyTriggerData = useStableCallback((element) => { | |
| 6064 | + const open2 = store2.select("open"); | |
| 6065 | + const activeTriggerId = store2.select("activeTriggerId"); | |
| 6066 | + if (activeTriggerId === triggerId) { | |
| 6067 | + const changes = { | |
| 6068 | + activeTriggerElement: element, | |
| 6069 | + ...open2 ? stateUpdates : null | |
| 6070 | + }; | |
| 6071 | + store2.update(changes); | |
| 6072 | + return; | |
| 6073 | + } | |
| 6074 | + if (activeTriggerId == null && open2) { | |
| 6075 | + const changes = { | |
| 6076 | + activeTriggerId: triggerId ?? null, | |
| 6077 | + activeTriggerElement: element, | |
| 6078 | + ...stateUpdates | |
| 6079 | + }; | |
| 6080 | + store2.update(changes); | |
| 6081 | + } | |
| 6082 | + }); | |
| 6083 | + const registerTrigger = useStableCallback((element) => { | |
| 6084 | + baseRegisterTrigger(element); | |
| 6085 | + if (element) { | |
| 6086 | + applyTriggerData(element); | |
| 6087 | + } | |
| 6088 | + }); | |
| 6089 | + useIsoLayoutEffect(() => { | |
| 6090 | + registerTrigger(triggerElementRef.current); | |
| 6091 | + return () => registerTrigger(null); | |
| 6092 | + }, [registerTrigger, triggerElementRef, store2, triggerId]); | |
| 6093 | + useIsoLayoutEffect(() => { | |
| 6094 | + if (isMountedByThisTrigger) { | |
| 6095 | + const changes = { | |
| 6096 | + activeTriggerElement: triggerElementRef.current, | |
| 6097 | + ...stateUpdates | |
| 6098 | + }; | |
| 6099 | + store2.update(changes); | |
| 6100 | + } | |
| 6101 | + }, [isMountedByThisTrigger, store2, triggerElementRef, ...Object.values(stateUpdates)]); | |
| 6102 | + return { | |
| 6103 | + registerTrigger, | |
| 6104 | + isMountedByThisTrigger | |
| 6105 | + }; | |
| 6106 | + } | |
| 6107 | + function useImplicitActiveTrigger(store2, options = {}) { | |
| 6108 | + const { | |
| 6109 | + closeOnActiveTriggerUnmount = false | |
| 6110 | + } = options; | |
| 6111 | + const resolvedActiveTriggerIdRef = React22.useRef(null); | |
| 6112 | + const open2 = store2.useState("open"); | |
| 6113 | + const reactiveTriggerCount = store2.useState("triggerCount"); | |
| 6114 | + const activeTriggerId = store2.useState("activeTriggerId"); | |
| 6115 | + const reactiveActiveTriggerElement = store2.useState("activeTriggerElement"); | |
| 6116 | + useIsoLayoutEffect(() => { | |
| 6117 | + if (!open2) { | |
| 6118 | + resolvedActiveTriggerIdRef.current = null; | |
| 6119 | + if (store2.state.triggerCount !== 0) { | |
| 6120 | + store2.set("triggerCount", 0); | |
| 6121 | + } | |
| 6122 | + return; | |
| 6123 | + } | |
| 6124 | + const triggerCount = store2.context.triggerElements.size; | |
| 6125 | + const stateUpdates = {}; | |
| 6126 | + if (store2.state.triggerCount !== triggerCount) { | |
| 6127 | + stateUpdates.triggerCount = triggerCount; | |
| 6128 | + } | |
| 6129 | + const currentActiveTriggerId = store2.select("activeTriggerId"); | |
| 6130 | + let lostActiveTriggerId = null; | |
| 6131 | + if (currentActiveTriggerId) { | |
| 6132 | + const activeTriggerElement = store2.context.triggerElements.getById(currentActiveTriggerId); | |
| 6133 | + if (!activeTriggerElement) { | |
| 6134 | + for (const [triggerId, triggerElement] of store2.context.triggerElements.entries()) { | |
| 6135 | + if (triggerElement === store2.state.activeTriggerElement) { | |
| 6136 | + stateUpdates.activeTriggerId = triggerId; | |
| 6137 | + stateUpdates.activeTriggerElement = triggerElement; | |
| 6138 | + resolvedActiveTriggerIdRef.current = triggerId; | |
| 6139 | + break; | |
| 6140 | + } | |
| 6141 | + } | |
| 6142 | + if (stateUpdates.activeTriggerId === void 0) { | |
| 6143 | + if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) { | |
| 6144 | + lostActiveTriggerId = currentActiveTriggerId; | |
| 6145 | + } else { | |
| 6146 | + resolvedActiveTriggerIdRef.current = null; | |
| 6147 | + } | |
| 6148 | + } | |
| 6149 | + } else { | |
| 6150 | + resolvedActiveTriggerIdRef.current = currentActiveTriggerId; | |
| 6151 | + if (activeTriggerElement !== store2.state.activeTriggerElement) { | |
| 6152 | + stateUpdates.activeTriggerElement = activeTriggerElement; | |
| 6153 | + } | |
| 6154 | + } | |
| 6155 | + } else { | |
| 6156 | + resolvedActiveTriggerIdRef.current = null; | |
| 6157 | + } | |
| 6158 | + if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) { | |
| 6159 | + const iteratorResult = store2.context.triggerElements.entries().next(); | |
| 6160 | + if (!iteratorResult.done) { | |
| 6161 | + const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; | |
| 6162 | + stateUpdates.activeTriggerId = implicitTriggerId; | |
| 6163 | + stateUpdates.activeTriggerElement = implicitTriggerElement; | |
| 6164 | + resolvedActiveTriggerIdRef.current = implicitTriggerId; | |
| 6165 | + } | |
| 6166 | + } | |
| 6167 | + if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) { | |
| 6168 | + store2.update(stateUpdates); | |
| 6169 | + } | |
| 6170 | + if (lostActiveTriggerId) { | |
| 6171 | + if (closeOnActiveTriggerUnmount) { | |
| 6172 | + queueMicrotask(() => { | |
| 6173 | + if (store2.select("open") && store2.select("activeTriggerId") === lostActiveTriggerId && !store2.context.triggerElements.getById(lostActiveTriggerId)) { | |
| 6174 | + const eventDetails = createChangeEventDetails(reason_parts_exports.none); | |
| 6175 | + store2.setOpen(false, eventDetails); | |
| 6176 | + if (!eventDetails.isCanceled) { | |
| 6177 | + store2.update({ | |
| 6178 | + activeTriggerId: null, | |
| 6179 | + activeTriggerElement: null | |
| 6180 | + }); | |
| 6181 | + } | |
| 6182 | + } | |
| 6183 | + }); | |
| 6184 | + } | |
| 6185 | + } | |
| 6186 | + }, [open2, store2, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]); | |
| 6187 | + } | |
| 6188 | + function useOpenStateTransitions(open2, store2, onUnmount, animateInitialOpen) { | |
| 6189 | + const { | |
| 6190 | + mounted, | |
| 6191 | + setMounted, | |
| 6192 | + transitionStatus | |
| 6193 | + } = useTransitionStatus(open2, false, false, animateInitialOpen); | |
| 6194 | + const preventUnmountingOnClose = store2.useState("preventUnmountingOnClose"); | |
| 6195 | + const syncedPreventUnmountingOnClose = open2 ? false : preventUnmountingOnClose; | |
| 6196 | + store2.useSyncedValues({ | |
| 6197 | + mounted, | |
| 6198 | + transitionStatus, | |
| 6199 | + preventUnmountingOnClose: syncedPreventUnmountingOnClose | |
| 6200 | + }); | |
| 6201 | + const forceUnmount = useStableCallback(() => { | |
| 6202 | + setMounted(false); | |
| 6203 | + store2.update({ | |
| 6204 | + activeTriggerId: null, | |
| 6205 | + activeTriggerElement: null, | |
| 6206 | + mounted: false, | |
| 6207 | + preventUnmountingOnClose: false | |
| 6208 | + }); | |
| 6209 | + onUnmount?.(); | |
| 6210 | + store2.context.onOpenChangeComplete?.(false); | |
| 6211 | + }); | |
| 6212 | + useOpenChangeComplete({ | |
| 6213 | + enabled: mounted && !open2 && !syncedPreventUnmountingOnClose, | |
| 6214 | + open: open2, | |
| 6215 | + ref: store2.context.popupRef, | |
| 6216 | + onComplete() { | |
| 6217 | + if (!open2) { | |
| 6218 | + forceUnmount(); | |
| 6219 | + } | |
| 6220 | + } | |
| 6221 | + }); | |
| 6222 | + return { | |
| 6223 | + forceUnmount, | |
| 6224 | + transitionStatus | |
| 6225 | + }; | |
| 6226 | + } | |
| 6227 | + function usePopupInteractionProps(store2, statePart) { | |
| 6228 | + store2.useSyncedValues(statePart); | |
| 6229 | + useIsoLayoutEffect(() => () => { | |
| 6230 | + store2.update({ | |
| 6231 | + activeTriggerProps: EMPTY_OBJECT, | |
| 6232 | + inactiveTriggerProps: EMPTY_OBJECT, | |
| 6233 | + popupProps: EMPTY_OBJECT | |
| 6234 | + }); | |
| 6235 | + }, [store2]); | |
| 6236 | + } | |
| 6237 | + | |
| 6238 | + // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs | |
| 6239 | + var devElementIdsByMap; | |
| 6240 | + function getDevElementIds(map) { | |
| 6241 | + devElementIdsByMap ??= /* @__PURE__ */ new WeakMap(); | |
| 6242 | + let elementIds = devElementIdsByMap.get(map); | |
| 6243 | + if (!elementIds) { | |
| 6244 | + elementIds = /* @__PURE__ */ new WeakMap(); | |
| 6245 | + devElementIdsByMap.set(map, elementIds); | |
| 6246 | + } | |
| 6247 | + return elementIds; | |
| 6248 | + } | |
| 6249 | + var PopupTriggerMap = class { | |
| 6250 | + constructor() { | |
| 6251 | + this.idMap = /* @__PURE__ */ new Map(); | |
| 6252 | + } | |
| 6253 | + /** | |
| 6254 | + * Adds a trigger element with the given ID. | |
| 6255 | + * | |
| 6256 | + * Note: The provided element is assumed to not be registered under multiple IDs. | |
| 6257 | + */ | |
| 6258 | + add(id, element) { | |
| 6259 | + if (true) { | |
| 6260 | + const elementIds = getDevElementIds(this); | |
| 6261 | + const existingId = elementIds.get(element); | |
| 6262 | + if (existingId !== void 0 && existingId !== id) { | |
| 6263 | + throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); | |
| 6264 | + } | |
| 6265 | + const previousElement = this.idMap.get(id); | |
| 6266 | + if (previousElement !== void 0 && previousElement !== element) { | |
| 6267 | + elementIds.delete(previousElement); | |
| 6268 | + } | |
| 6269 | + elementIds.set(element, id); | |
| 6270 | + } | |
| 6271 | + this.idMap.set(id, element); | |
| 6272 | + } | |
| 6273 | + /** | |
| 6274 | + * Removes the trigger element with the given ID. | |
| 6275 | + */ | |
| 6276 | + delete(id) { | |
| 6277 | + if (true) { | |
| 6278 | + const element = this.idMap.get(id); | |
| 6279 | + if (element !== void 0) { | |
| 6280 | + devElementIdsByMap?.get(this)?.delete(element); | |
| 6281 | + } | |
| 6282 | + } | |
| 6283 | + this.idMap.delete(id); | |
| 6284 | + } | |
| 6285 | + /** | |
| 6286 | + * Whether the given element is registered as a trigger. | |
| 6287 | + */ | |
| 6288 | + hasElement(element) { | |
| 6289 | + for (const registered of this.idMap.values()) { | |
| 6290 | + if (registered === element) { | |
| 6291 | + return true; | |
| 6292 | + } | |
| 6293 | + } | |
| 6294 | + return false; | |
| 6295 | + } | |
| 6296 | + /** | |
| 6297 | + * Whether there is a registered trigger element matching the given predicate. | |
| 6298 | + */ | |
| 6299 | + hasMatchingElement(predicate) { | |
| 6300 | + for (const element of this.idMap.values()) { | |
| 6301 | + if (predicate(element)) { | |
| 6302 | + return true; | |
| 6303 | + } | |
| 6304 | + } | |
| 6305 | + return false; | |
| 6306 | + } | |
| 6307 | + /** | |
| 6308 | + * Returns the trigger element associated with the given ID, or undefined if no such element exists. | |
| 6309 | + */ | |
| 6310 | + getById(id) { | |
| 6311 | + return this.idMap.get(id); | |
| 6312 | + } | |
| 6313 | + /** | |
| 6314 | + * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. | |
| 6315 | + */ | |
| 6316 | + entries() { | |
| 6317 | + return this.idMap.entries(); | |
| 6318 | + } | |
| 6319 | + /** | |
| 6320 | + * Returns an iterable of all registered trigger elements. | |
| 6321 | + */ | |
| 6322 | + elements() { | |
| 6323 | + return this.idMap.values(); | |
| 6324 | + } | |
| 6325 | + /** | |
| 6326 | + * Returns the number of registered trigger elements. | |
| 6327 | + */ | |
| 6328 | + get size() { | |
| 6329 | + return this.idMap.size; | |
| 6330 | + } | |
| 6331 | + }; | |
| 6332 | + | |
| 6333 | + // node_modules/@base-ui/react/utils/popups/store.mjs | |
| 6334 | + function createInitialPopupStoreState(triggerElements, floatingId, nested = false) { | |
| 6335 | + return { | |
| 6336 | + open: false, | |
| 6337 | + openProp: void 0, | |
| 6338 | + mounted: false, | |
| 6339 | + transitionStatus: void 0, | |
| 6340 | + floatingRootContext: new FloatingRootStore({ | |
| 6341 | + open: false, | |
| 6342 | + transitionStatus: void 0, | |
| 6343 | + floatingElement: null, | |
| 6344 | + referenceElement: null, | |
| 6345 | + triggerElements, | |
| 6346 | + floatingId, | |
| 6347 | + syncOnly: true, | |
| 6348 | + nested, | |
| 6349 | + onOpenChange: void 0 | |
| 6350 | + }), | |
| 6351 | + floatingId, | |
| 6352 | + triggerCount: 0, | |
| 6353 | + preventUnmountingOnClose: false, | |
| 6354 | + payload: void 0, | |
| 6355 | + activeTriggerId: null, | |
| 6356 | + activeTriggerElement: null, | |
| 6357 | + triggerIdProp: void 0, | |
| 6358 | + popupElement: null, | |
| 6359 | + positionerElement: null, | |
| 6360 | + activeTriggerProps: EMPTY_OBJECT, | |
| 6361 | + inactiveTriggerProps: EMPTY_OBJECT, | |
| 6362 | + popupProps: EMPTY_OBJECT | |
| 6363 | + }; | |
| 6364 | + } | |
| 6365 | + var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId; | |
| 6366 | + var openSelector = (state) => state.openProp ?? state.open; | |
| 6367 | + var popupIdSelector = (state) => { | |
| 6368 | + const popupId = state.popupElement?.id ?? state.floatingId; | |
| 6369 | + return popupId || void 0; | |
| 6370 | + }; | |
| 6371 | + function triggerOwnsOpenPopup(state, triggerId) { | |
| 6372 | + return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; | |
| 6373 | + } | |
| 6374 | + function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { | |
| 6375 | + if (triggerOwnsOpenPopup(state, triggerId)) { | |
| 6376 | + return true; | |
| 6377 | + } | |
| 6378 | + return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; | |
| 6379 | + } | |
| 6380 | + var popupStoreSelectors = { | |
| 6381 | + open: openSelector, | |
| 6382 | + mounted: (state) => state.mounted, | |
| 6383 | + transitionStatus: (state) => state.transitionStatus, | |
| 6384 | + floatingRootContext: (state) => state.floatingRootContext, | |
| 6385 | + triggerCount: (state) => state.triggerCount, | |
| 6386 | + preventUnmountingOnClose: (state) => state.preventUnmountingOnClose, | |
| 6387 | + payload: (state) => state.payload, | |
| 6388 | + activeTriggerId: activeTriggerIdSelector, | |
| 6389 | + activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null, | |
| 6390 | + popupId: popupIdSelector, | |
| 6391 | + /** | |
| 6392 | + * Whether the trigger with the given ID was used to open the popup. | |
| 6393 | + */ | |
| 6394 | + isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId, | |
| 6395 | + /** | |
| 6396 | + * Whether the popup is open and was activated by a trigger with the given ID. | |
| 6397 | + */ | |
| 6398 | + isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId), | |
| 6399 | + /** | |
| 6400 | + * Whether the popup is mounted and was activated by a trigger with the given ID. | |
| 6401 | + */ | |
| 6402 | + isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted, | |
| 6403 | + triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps, | |
| 6404 | + /** | |
| 6405 | + * Popup id for the trigger that currently owns the open popup. | |
| 6406 | + */ | |
| 6407 | + triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0, | |
| 6408 | + popupProps: (state) => state.popupProps, | |
| 6409 | + popupElement: (state) => state.popupElement, | |
| 6410 | + positionerElement: (state) => state.positionerElement | |
| 6411 | + }; | |
| 6412 | + | |
| 6413 | + // node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs | |
| 6414 | + var React23 = __toESM(require_react(), 1); | |
| 6415 | + var import_shim2 = __toESM(require_shim(), 1); | |
| 6416 | + function usePopupHandleStore(handle) { | |
| 6417 | + const subscribe = React23.useCallback((listener) => { | |
| 6418 | + if (handle === void 0) { | |
| 6419 | + return NOOP; | |
| 6420 | + } | |
| 6421 | + return handle.subscribeStore(listener); | |
| 6422 | + }, [handle]); | |
| 6423 | + const getSnapshot = React23.useCallback(() => { | |
| 6424 | + return handle === void 0 ? void 0 : handle.store; | |
| 6425 | + }, [handle]); | |
| 6426 | + return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore); | |
| 6427 | + } | |
| 6428 | + | |
| 6429 | + // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs | |
| 6430 | + function useBaseUIFloating(options) { | |
| 6431 | + return useFloatingWithStore(options, options.rootContext); | |
| 6432 | + } | |
| 6433 | + function useFloatingWithStore(options, store2) { | |
| 6434 | + const { | |
| 6435 | + nodeId, | |
| 6436 | + externalTree | |
| 6437 | + } = options; | |
| 6438 | + const referenceElement = store2.useState("referenceElement"); | |
| 6439 | + const floatingElement = store2.useState("floatingElement"); | |
| 6440 | + const domReferenceElement = store2.useState("domReferenceElement"); | |
| 6441 | + const open2 = store2.useState("open"); | |
| 6442 | + const floatingId = store2.useState("floatingId"); | |
| 6443 | + const [positionReference, setPositionReferenceRaw] = React24.useState(null); | |
| 6444 | + const [localDomReference, setLocalDomReference] = React24.useState(void 0); | |
| 6445 | + const [localFloatingElement, setLocalFloatingElement] = React24.useState(void 0); | |
| 6446 | + const domReferenceRef = React24.useRef(null); | |
| 6447 | + const tree = useFloatingTree(externalTree); | |
| 6448 | + const storeElements = React24.useMemo(() => ({ | |
| 6449 | + reference: referenceElement, | |
| 6450 | + floating: floatingElement, | |
| 6451 | + domReference: domReferenceElement | |
| 6452 | + }), [referenceElement, floatingElement, domReferenceElement]); | |
| 6453 | + const position = useFloating({ | |
| 6454 | + ...options, | |
| 6455 | + elements: { | |
| 6456 | + ...storeElements, | |
| 6457 | + ...positionReference && { | |
| 6458 | + reference: positionReference | |
| 6459 | + } | |
| 6460 | + } | |
| 6461 | + }); | |
| 6462 | + const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; | |
| 6463 | + const syncedFloatingElement = localFloatingElement === void 0 ? store2.state.floatingElement : localFloatingElement; | |
| 6464 | + store2.useSyncedValue("referenceElement", localDomReference ?? null); | |
| 6465 | + store2.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); | |
| 6466 | + store2.useSyncedValue("floatingElement", syncedFloatingElement); | |
| 6467 | + const setPositionReference = React24.useCallback((node) => { | |
| 6468 | + const computedPositionReference = isElement(node) ? { | |
| 6469 | + getBoundingClientRect: () => node.getBoundingClientRect(), | |
| 6470 | + getClientRects: () => node.getClientRects(), | |
| 6471 | + contextElement: node | |
| 6472 | + } : node; | |
| 6473 | + setPositionReferenceRaw(computedPositionReference); | |
| 6474 | + position.refs.setReference(computedPositionReference); | |
| 6475 | + }, [position.refs]); | |
| 6476 | + const setReference = React24.useCallback((node) => { | |
| 6477 | + if (isElement(node) || node === null) { | |
| 6478 | + domReferenceRef.current = node; | |
| 6479 | + setLocalDomReference(node); | |
| 6480 | + } | |
| 6481 | + if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to | |
| 6482 | + // `null` to support `positionReference` + an unstable `reference` | |
| 6483 | + // callback ref. | |
| 6484 | + node !== null && !isElement(node)) { | |
| 6485 | + position.refs.setReference(node); | |
| 6486 | + } | |
| 6487 | + }, [position.refs, setLocalDomReference]); | |
| 6488 | + const setFloating = React24.useCallback((node) => { | |
| 6489 | + setLocalFloatingElement(node); | |
| 6490 | + position.refs.setFloating(node); | |
| 6491 | + }, [position.refs]); | |
| 6492 | + const refs = React24.useMemo(() => ({ | |
| 6493 | + ...position.refs, | |
| 6494 | + setReference, | |
| 6495 | + setFloating, | |
| 6496 | + setPositionReference, | |
| 6497 | + domReference: domReferenceRef | |
| 6498 | + }), [position.refs, setReference, setFloating, setPositionReference]); | |
| 6499 | + const elements = React24.useMemo(() => ({ | |
| 6500 | + ...position.elements, | |
| 6501 | + domReference: domReferenceElement | |
| 6502 | + }), [position.elements, domReferenceElement]); | |
| 6503 | + const context = React24.useMemo(() => ({ | |
| 6504 | + ...position, | |
| 6505 | + dataRef: store2.context.dataRef, | |
| 6506 | + open: open2, | |
| 6507 | + onOpenChange: store2.setOpen, | |
| 6508 | + events: store2.context.events, | |
| 6509 | + floatingId, | |
| 6510 | + refs, | |
| 6511 | + elements, | |
| 6512 | + nodeId, | |
| 6513 | + rootStore: store2 | |
| 6514 | + }), [position, refs, elements, nodeId, store2, open2, floatingId]); | |
| 6515 | + useIsoLayoutEffect(() => { | |
| 6516 | + if (domReferenceElement) { | |
| 6517 | + domReferenceRef.current = domReferenceElement; | |
| 6518 | + } | |
| 6519 | + }, [domReferenceElement]); | |
| 6520 | + useIsoLayoutEffect(() => { | |
| 6521 | + store2.context.dataRef.current.floatingContext = context; | |
| 6522 | + const node = tree?.nodesRef.current.find((n) => n.id === nodeId); | |
| 6523 | + if (node) { | |
| 6524 | + node.context = context; | |
| 6525 | + } | |
| 6526 | + }); | |
| 6527 | + return React24.useMemo(() => ({ | |
| 6528 | + ...position, | |
| 6529 | + context, | |
| 6530 | + refs, | |
| 6531 | + elements, | |
| 6532 | + rootStore: store2 | |
| 6533 | + }), [position, refs, elements, context, store2]); | |
| 6534 | + } | |
| 6535 | + | |
| 6536 | + // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs | |
| 6537 | + var React25 = __toESM(require_react(), 1); | |
| 6538 | + var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit; | |
| 6539 | + function useFocus(context, props = {}) { | |
| 6540 | + const { | |
| 6541 | + enabled = true, | |
| 6542 | + delay | |
| 6543 | + } = props; | |
| 6544 | + const store2 = "rootStore" in context ? context.rootStore : context; | |
| 6545 | + const { | |
| 6546 | + events, | |
| 6547 | + dataRef | |
| 6548 | + } = store2.context; | |
| 6549 | + const blockFocusRef = React25.useRef(false); | |
| 6550 | + const blockedReferenceRef = React25.useRef(null); | |
| 6551 | + const keyboardModalityRef = React25.useRef(true); | |
| 6552 | + const timeout = useTimeout(); | |
| 6553 | + React25.useEffect(() => { | |
| 6554 | + const domReference = store2.select("domReferenceElement"); | |
| 6555 | + if (!enabled) { | |
| 6556 | + return void 0; | |
| 6557 | + } | |
| 6558 | + const win = getWindow(domReference); | |
| 6559 | + function onBlur() { | |
| 6560 | + const currentDomReference = store2.select("domReferenceElement"); | |
| 6561 | + if (!store2.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { | |
| 6562 | + blockFocusRef.current = true; | |
| 6563 | + blockedReferenceRef.current = currentDomReference; | |
| 6564 | + } | |
| 6565 | + } | |
| 6566 | + function onKeyDown() { | |
| 6567 | + keyboardModalityRef.current = true; | |
| 6568 | + } | |
| 6569 | + function onPointerDown() { | |
| 6570 | + keyboardModalityRef.current = false; | |
| 6571 | + } | |
| 6572 | + return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); | |
| 6573 | + }, [store2, enabled]); | |
| 6574 | + React25.useEffect(() => { | |
| 6575 | + if (!enabled) { | |
| 6576 | + return void 0; | |
| 6577 | + } | |
| 6578 | + function onOpenChangeLocal(details) { | |
| 6579 | + if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { | |
| 6580 | + const referenceElement = store2.select("domReferenceElement"); | |
| 6581 | + if (isElement(referenceElement)) { | |
| 6582 | + blockedReferenceRef.current = referenceElement; | |
| 6583 | + blockFocusRef.current = true; | |
| 6584 | + } | |
| 6585 | + } | |
| 6586 | + } | |
| 6587 | + events.on("openchange", onOpenChangeLocal); | |
| 6588 | + return () => { | |
| 6589 | + events.off("openchange", onOpenChangeLocal); | |
| 6590 | + }; | |
| 6591 | + }, [events, enabled, store2]); | |
| 6592 | + const reference = React25.useMemo(() => { | |
| 6593 | + function resetBlockedFocus() { | |
| 6594 | + blockFocusRef.current = false; | |
| 6595 | + blockedReferenceRef.current = null; | |
| 6596 | + } | |
| 6597 | + return { | |
| 6598 | + onMouseLeave() { | |
| 6599 | + resetBlockedFocus(); | |
| 6600 | + }, | |
| 6601 | + onFocus(event) { | |
| 6602 | + const focusTarget = event.currentTarget; | |
| 6603 | + if (blockFocusRef.current) { | |
| 6604 | + if (blockedReferenceRef.current === focusTarget) { | |
| 6605 | + return; | |
| 6606 | + } | |
| 6607 | + resetBlockedFocus(); | |
| 6608 | + } | |
| 6609 | + const target = getTarget(event.nativeEvent); | |
| 6610 | + if (isElement(target)) { | |
| 6611 | + if (isMacSafari && !event.relatedTarget) { | |
| 6612 | + if (!keyboardModalityRef.current && !isTypeableElement(target)) { | |
| 6613 | + return; | |
| 6614 | + } | |
| 6615 | + } else if (!matchesFocusVisible(target)) { | |
| 6616 | + return; | |
| 6617 | + } | |
| 6618 | + } | |
| 6619 | + const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements); | |
| 6620 | + const { | |
| 6621 | + nativeEvent, | |
| 6622 | + currentTarget | |
| 6623 | + } = event; | |
| 6624 | + const delayValue = typeof delay === "function" ? delay() : delay; | |
| 6625 | + if (store2.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { | |
| 6626 | + store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); | |
| 6627 | + return; | |
| 6628 | + } | |
| 6629 | + timeout.start(delayValue, () => { | |
| 6630 | + if (blockFocusRef.current) { | |
| 6631 | + return; | |
| 6632 | + } | |
| 6633 | + store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); | |
| 6634 | + }); | |
| 6635 | + }, | |
| 6636 | + onBlur(event) { | |
| 6637 | + resetBlockedFocus(); | |
| 6638 | + const relatedTarget = event.relatedTarget; | |
| 6639 | + const nativeEvent = event.nativeEvent; | |
| 6640 | + const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; | |
| 6641 | + timeout.start(0, () => { | |
| 6642 | + const domReference = store2.select("domReferenceElement"); | |
| 6643 | + const activeEl = activeElement(ownerDocument(domReference)); | |
| 6644 | + if (!relatedTarget && activeEl === domReference) { | |
| 6645 | + return; | |
| 6646 | + } | |
| 6647 | + if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { | |
| 6648 | + return; | |
| 6649 | + } | |
| 6650 | + const nextFocusedElement = relatedTarget ?? activeEl; | |
| 6651 | + if (isTargetInsideEnabledTrigger(nextFocusedElement, store2.context.triggerElements)) { | |
| 6652 | + return; | |
| 6653 | + } | |
| 6654 | + store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); | |
| 6655 | + }); | |
| 6656 | + } | |
| 6657 | + }; | |
| 6658 | + }, [dataRef, delay, store2, timeout]); | |
| 6659 | + return React25.useMemo(() => enabled ? { | |
| 6660 | + reference, | |
| 6661 | + trigger: reference | |
| 6662 | + } : {}, [enabled, reference]); | |
| 6663 | + } | |
| 6664 | + | |
| 6665 | + // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs | |
| 6666 | + var React26 = __toESM(require_react(), 1); | |
| 6667 | + | |
| 6668 | + // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs | |
| 6669 | + var HoverInteraction = class _HoverInteraction { | |
| 6670 | + constructor() { | |
| 6671 | + this.pointerType = void 0; | |
| 6672 | + this.interactedInside = false; | |
| 6673 | + this.handler = void 0; | |
| 6674 | + this.blockMouseMove = true; | |
| 6675 | + this.performedPointerEventsMutation = false; | |
| 6676 | + this.pointerEventsScopeElement = null; | |
| 6677 | + this.pointerEventsReferenceElement = null; | |
| 6678 | + this.pointerEventsFloatingElement = null; | |
| 6679 | + this.restTimeoutPending = false; | |
| 6680 | + this.openChangeTimeout = new Timeout(); | |
| 6681 | + this.restTimeout = new Timeout(); | |
| 6682 | + this.handleCloseOptions = void 0; | |
| 6683 | + } | |
| 6684 | + static create() { | |
| 6685 | + return new _HoverInteraction(); | |
| 6686 | + } | |
| 6687 | + dispose = () => { | |
| 6688 | + this.openChangeTimeout.clear(); | |
| 6689 | + this.restTimeout.clear(); | |
| 6690 | + }; | |
| 6691 | + disposeEffect = () => { | |
| 6692 | + return this.dispose; | |
| 6693 | + }; | |
| 6694 | + }; | |
| 6695 | + var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); | |
| 6696 | + function clearSafePolygonPointerEventsMutation(instance) { | |
| 6697 | + if (!instance.performedPointerEventsMutation) { | |
| 6698 | + return; | |
| 6699 | + } | |
| 6700 | + const scopeElement = instance.pointerEventsScopeElement; | |
| 6701 | + if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { | |
| 6702 | + instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); | |
| 6703 | + instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); | |
| 6704 | + instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); | |
| 6705 | + pointerEventsMutationOwnerByScopeElement.delete(scopeElement); | |
| 6706 | + } | |
| 6707 | + instance.performedPointerEventsMutation = false; | |
| 6708 | + instance.pointerEventsScopeElement = null; | |
| 6709 | + instance.pointerEventsReferenceElement = null; | |
| 6710 | + instance.pointerEventsFloatingElement = null; | |
| 6711 | + } | |
| 6712 | + function applySafePolygonPointerEventsMutation(instance, options) { | |
| 6713 | + const { | |
| 6714 | + scopeElement, | |
| 6715 | + referenceElement, | |
| 6716 | + floatingElement | |
| 6717 | + } = options; | |
| 6718 | + const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); | |
| 6719 | + if (existingOwner && existingOwner !== instance) { | |
| 6720 | + clearSafePolygonPointerEventsMutation(existingOwner); | |
| 6721 | + } | |
| 6722 | + clearSafePolygonPointerEventsMutation(instance); | |
| 6723 | + instance.performedPointerEventsMutation = true; | |
| 6724 | + instance.pointerEventsScopeElement = scopeElement; | |
| 6725 | + instance.pointerEventsReferenceElement = referenceElement; | |
| 6726 | + instance.pointerEventsFloatingElement = floatingElement; | |
| 6727 | + pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); | |
| 6728 | + scopeElement.style.pointerEvents = "none"; | |
| 6729 | + referenceElement.style.pointerEvents = "auto"; | |
| 6730 | + floatingElement.style.pointerEvents = "auto"; | |
| 6731 | + } | |
| 6732 | + function useHoverInteractionSharedState(store2) { | |
| 6733 | + const data = store2.context.dataRef.current; | |
| 6734 | + const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; | |
| 6735 | + if (!data.hoverInteractionState) { | |
| 6736 | + data.hoverInteractionState = instance; | |
| 6737 | + } | |
| 6738 | + useOnMount(data.hoverInteractionState.disposeEffect); | |
| 6739 | + return data.hoverInteractionState; | |
| 6740 | + } | |
| 6741 | + | |
| 6742 | + // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs | |
| 6743 | + function useHoverFloatingInteraction(context, parameters = {}) { | |
| 6744 | + const { | |
| 6745 | + enabled = true, | |
| 6746 | + closeDelay: closeDelayProp = 0, | |
| 6747 | + nodeId: nodeIdProp | |
| 6748 | + } = parameters; | |
| 6749 | + const store2 = "rootStore" in context ? context.rootStore : context; | |
| 6750 | + const open2 = store2.useState("open"); | |
| 6751 | + const floatingElement = store2.useState("floatingElement"); | |
| 6752 | + const domReferenceElement = store2.useState("domReferenceElement"); | |
| 6753 | + const { | |
| 6754 | + dataRef | |
| 6755 | + } = store2.context; | |
| 6756 | + const tree = useFloatingTree(); | |
| 6757 | + const parentId = useFloatingParentNodeId(); | |
| 6758 | + const instance = useHoverInteractionSharedState(store2); | |
| 6759 | + const childClosedTimeout = useTimeout(); | |
| 6760 | + const isClickLikeOpenEvent2 = useStableCallback(() => { | |
| 6761 | + return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); | |
| 6762 | + }); | |
| 6763 | + const isHoverOpen = useStableCallback(() => { | |
| 6764 | + return isHoverOpenEvent(dataRef.current.openEvent?.type); | |
| 6765 | + }); | |
| 6766 | + const clearPointerEvents = useStableCallback(() => { | |
| 6767 | + clearSafePolygonPointerEventsMutation(instance); | |
| 6768 | + }); | |
| 6769 | + useIsoLayoutEffect(() => { | |
| 6770 | + if (!open2) { | |
| 6771 | + instance.pointerType = void 0; | |
| 6772 | + instance.restTimeoutPending = false; | |
| 6773 | + instance.interactedInside = false; | |
| 6774 | + clearPointerEvents(); | |
| 6775 | + } | |
| 6776 | + }, [open2, instance, clearPointerEvents]); | |
| 6777 | + React26.useEffect(() => { | |
| 6778 | + return clearPointerEvents; | |
| 6779 | + }, [clearPointerEvents]); | |
| 6780 | + useIsoLayoutEffect(() => { | |
| 6781 | + if (!enabled) { | |
| 6782 | + return void 0; | |
| 6783 | + } | |
| 6784 | + if (open2 && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { | |
| 6785 | + const ref = domReferenceElement; | |
| 6786 | + const floatingEl = floatingElement; | |
| 6787 | + const doc = ownerDocument(floatingElement); | |
| 6788 | + const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; | |
| 6789 | + if (parentFloating) { | |
| 6790 | + parentFloating.style.pointerEvents = ""; | |
| 6791 | + } | |
| 6792 | + const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; | |
| 6793 | + const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; | |
| 6794 | + const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; | |
| 6795 | + applySafePolygonPointerEventsMutation(instance, { | |
| 6796 | + scopeElement, | |
| 6797 | + referenceElement: ref, | |
| 6798 | + floatingElement: floatingEl | |
| 6799 | + }); | |
| 6800 | + return () => { | |
| 6801 | + clearPointerEvents(); | |
| 6802 | + }; | |
| 6803 | + } | |
| 6804 | + return void 0; | |
| 6805 | + }, [enabled, open2, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); | |
| 6806 | + React26.useEffect(() => { | |
| 6807 | + if (!enabled) { | |
| 6808 | + return void 0; | |
| 6809 | + } | |
| 6810 | + function hasParentChildren() { | |
| 6811 | + return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); | |
| 6812 | + } | |
| 6813 | + function closeWithDelay(event) { | |
| 6814 | + const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); | |
| 6815 | + const close = () => { | |
| 6816 | + store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 6817 | + tree?.events.emit("floating.closed", event); | |
| 6818 | + }; | |
| 6819 | + if (closeDelay) { | |
| 6820 | + instance.openChangeTimeout.start(closeDelay, close); | |
| 6821 | + } else { | |
| 6822 | + instance.openChangeTimeout.clear(); | |
| 6823 | + close(); | |
| 6824 | + } | |
| 6825 | + } | |
| 6826 | + function handleInteractInside(event) { | |
| 6827 | + const target = getTarget(event); | |
| 6828 | + if (!isInteractiveElement(target)) { | |
| 6829 | + instance.interactedInside = false; | |
| 6830 | + return; | |
| 6831 | + } | |
| 6832 | + instance.interactedInside = target?.closest("[aria-haspopup]") != null; | |
| 6833 | + } | |
| 6834 | + function onFloatingMouseEnter() { | |
| 6835 | + instance.openChangeTimeout.clear(); | |
| 6836 | + childClosedTimeout.clear(); | |
| 6837 | + tree?.events.off("floating.closed", onNodeClosed); | |
| 6838 | + clearPointerEvents(); | |
| 6839 | + } | |
| 6840 | + function onFloatingMouseLeave(event) { | |
| 6841 | + if (hasParentChildren() && tree) { | |
| 6842 | + tree.events.on("floating.closed", onNodeClosed); | |
| 6843 | + return; | |
| 6844 | + } | |
| 6845 | + if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { | |
| 6846 | + return; | |
| 6847 | + } | |
| 6848 | + const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; | |
| 6849 | + const relatedTarget = event.relatedTarget; | |
| 6850 | + const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); | |
| 6851 | + if (isMovingIntoDescendantFloating) { | |
| 6852 | + return; | |
| 6853 | + } | |
| 6854 | + if (instance.handler) { | |
| 6855 | + instance.handler(event); | |
| 6856 | + return; | |
| 6857 | + } | |
| 6858 | + clearPointerEvents(); | |
| 6859 | + if (isHoverOpen() && !isClickLikeOpenEvent2()) { | |
| 6860 | + closeWithDelay(event); | |
| 6861 | + } | |
| 6862 | + } | |
| 6863 | + function onNodeClosed(event) { | |
| 6864 | + if (!tree || !parentId || hasParentChildren()) { | |
| 6865 | + return; | |
| 6866 | + } | |
| 6867 | + childClosedTimeout.start(0, () => { | |
| 6868 | + tree.events.off("floating.closed", onNodeClosed); | |
| 6869 | + store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 6870 | + tree.events.emit("floating.closed", event); | |
| 6871 | + }); | |
| 6872 | + } | |
| 6873 | + const floating = floatingElement; | |
| 6874 | + return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { | |
| 6875 | + tree?.events.off("floating.closed", onNodeClosed); | |
| 6876 | + }); | |
| 6877 | + }, [enabled, floatingElement, store2, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); | |
| 6878 | + } | |
| 6879 | + | |
| 6880 | + // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs | |
| 6881 | + var React27 = __toESM(require_react(), 1); | |
| 6882 | + var ReactDOM5 = __toESM(require_react_dom(), 1); | |
| 6883 | + var EMPTY_REF = { | |
| 6884 | + current: null | |
| 6885 | + }; | |
| 6886 | + function useHoverReferenceInteraction(context, props = {}) { | |
| 6887 | + const { | |
| 6888 | + enabled = true, | |
| 6889 | + delay = 0, | |
| 6890 | + handleClose = null, | |
| 6891 | + mouseOnly = false, | |
| 6892 | + restMs = 0, | |
| 6893 | + move = true, | |
| 6894 | + triggerElementRef = EMPTY_REF, | |
| 6895 | + externalTree, | |
| 6896 | + isActiveTrigger = true, | |
| 6897 | + getHandleCloseContext, | |
| 6898 | + isClosing, | |
| 6899 | + shouldOpen: shouldOpenProp, | |
| 6900 | + guardStaleOpen = false | |
| 6901 | + } = props; | |
| 6902 | + const store2 = "rootStore" in context ? context.rootStore : context; | |
| 6903 | + const { | |
| 6904 | + dataRef, | |
| 6905 | + events | |
| 6906 | + } = store2.context; | |
| 6907 | + const tree = useFloatingTree(externalTree); | |
| 6908 | + const instance = useHoverInteractionSharedState(store2); | |
| 6909 | + const isHoverCloseActiveRef = React27.useRef(false); | |
| 6910 | + const handleCloseRef = useValueAsRef(handleClose); | |
| 6911 | + const delayRef = useValueAsRef(delay); | |
| 6912 | + const restMsRef = useValueAsRef(restMs); | |
| 6913 | + const enabledRef = useValueAsRef(enabled); | |
| 6914 | + const shouldOpenRef = useValueAsRef(shouldOpenProp); | |
| 6915 | + const isClosingRef = useValueAsRef(isClosing); | |
| 6916 | + const isClickLikeOpenEvent2 = useStableCallback(() => { | |
| 6917 | + return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); | |
| 6918 | + }); | |
| 6919 | + const checkShouldOpen = useStableCallback(() => { | |
| 6920 | + return shouldOpenRef.current?.() !== false; | |
| 6921 | + }); | |
| 6922 | + const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { | |
| 6923 | + const allTriggers = store2.context.triggerElements; | |
| 6924 | + if (allTriggers.hasElement(currentTarget)) { | |
| 6925 | + return !currentDomReference || !contains(currentDomReference, currentTarget); | |
| 6926 | + } | |
| 6927 | + if (!isElement(target)) { | |
| 6928 | + return false; | |
| 6929 | + } | |
| 6930 | + const targetElement = target; | |
| 6931 | + return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); | |
| 6932 | + }); | |
| 6933 | + const cleanupMouseMoveHandler = useStableCallback(() => { | |
| 6934 | + if (!instance.handler) { | |
| 6935 | + return; | |
| 6936 | + } | |
| 6937 | + const doc = ownerDocument(store2.select("domReferenceElement")); | |
| 6938 | + doc.removeEventListener("mousemove", instance.handler); | |
| 6939 | + instance.handler = void 0; | |
| 6940 | + }); | |
| 6941 | + const clearPointerEvents = useStableCallback(() => { | |
| 6942 | + clearSafePolygonPointerEventsMutation(instance); | |
| 6943 | + }); | |
| 6944 | + if (isActiveTrigger) { | |
| 6945 | + instance.handleCloseOptions = handleClose?.__options; | |
| 6946 | + } | |
| 6947 | + React27.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); | |
| 6948 | + React27.useEffect(() => { | |
| 6949 | + if (!enabled) { | |
| 6950 | + return void 0; | |
| 6951 | + } | |
| 6952 | + function onOpenChangeLocal(details) { | |
| 6953 | + if (!details.open) { | |
| 6954 | + isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; | |
| 6955 | + cleanupMouseMoveHandler(); | |
| 6956 | + instance.openChangeTimeout.clear(); | |
| 6957 | + instance.restTimeout.clear(); | |
| 6958 | + instance.blockMouseMove = true; | |
| 6959 | + instance.restTimeoutPending = false; | |
| 6960 | + } else { | |
| 6961 | + isHoverCloseActiveRef.current = false; | |
| 6962 | + } | |
| 6963 | + } | |
| 6964 | + events.on("openchange", onOpenChangeLocal); | |
| 6965 | + return () => { | |
| 6966 | + events.off("openchange", onOpenChangeLocal); | |
| 6967 | + }; | |
| 6968 | + }, [enabled, events, instance, cleanupMouseMoveHandler]); | |
| 6969 | + React27.useEffect(() => { | |
| 6970 | + if (!enabled) { | |
| 6971 | + return void 0; | |
| 6972 | + } | |
| 6973 | + function closeWithDelay(event, runElseBranch = true) { | |
| 6974 | + const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); | |
| 6975 | + if (closeDelay) { | |
| 6976 | + instance.openChangeTimeout.start(closeDelay, () => { | |
| 6977 | + store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 6978 | + tree?.events.emit("floating.closed", event); | |
| 6979 | + }); | |
| 6980 | + } else if (runElseBranch) { | |
| 6981 | + instance.openChangeTimeout.clear(); | |
| 6982 | + store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 6983 | + tree?.events.emit("floating.closed", event); | |
| 6984 | + } | |
| 6985 | + } | |
| 6986 | + const trigger = triggerElementRef.current ?? (isActiveTrigger ? store2.select("domReferenceElement") : null); | |
| 6987 | + if (!isElement(trigger)) { | |
| 6988 | + return void 0; | |
| 6989 | + } | |
| 6990 | + function onMouseEnter(event) { | |
| 6991 | + instance.openChangeTimeout.clear(); | |
| 6992 | + instance.blockMouseMove = false; | |
| 6993 | + if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { | |
| 6994 | + return; | |
| 6995 | + } | |
| 6996 | + const restMsValue = getRestMs(restMsRef.current); | |
| 6997 | + const openDelay = getDelay(delayRef.current, "open", instance.pointerType); | |
| 6998 | + const eventTarget = getTarget(event); | |
| 6999 | + const currentTarget = event.currentTarget ?? null; | |
| 7000 | + const currentDomReference = store2.select("domReferenceElement"); | |
| 7001 | + let triggerNode = currentTarget; | |
| 7002 | + if (isElement(eventTarget) && !store2.context.triggerElements.hasElement(eventTarget)) { | |
| 7003 | + for (const triggerElement of store2.context.triggerElements.elements()) { | |
| 7004 | + if (contains(triggerElement, eventTarget)) { | |
| 7005 | + triggerNode = triggerElement; | |
| 7006 | + break; | |
| 7007 | + } | |
| 7008 | + } | |
| 7009 | + } | |
| 7010 | + if (isElement(currentTarget) && isElement(currentDomReference) && !store2.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { | |
| 7011 | + triggerNode = currentDomReference; | |
| 7012 | + } | |
| 7013 | + const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); | |
| 7014 | + const isOpen = store2.select("open"); | |
| 7015 | + const isInClosingTransition = isClosingRef.current?.() ?? store2.select("transitionStatus") === "ending"; | |
| 7016 | + const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; | |
| 7017 | + const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; | |
| 7018 | + const isRestOnlyDelay = restMsValue > 0 && !openDelay; | |
| 7019 | + const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; | |
| 7020 | + const shouldOpen = !isOpen || isOverInactive; | |
| 7021 | + if (shouldOpenImmediately) { | |
| 7022 | + if (checkShouldOpen()) { | |
| 7023 | + store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); | |
| 7024 | + } | |
| 7025 | + return; | |
| 7026 | + } | |
| 7027 | + if (isRestOnlyDelay) { | |
| 7028 | + return; | |
| 7029 | + } | |
| 7030 | + if (openDelay) { | |
| 7031 | + instance.openChangeTimeout.start(openDelay, () => { | |
| 7032 | + if (shouldOpen && checkShouldOpen()) { | |
| 7033 | + store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); | |
| 7034 | + } | |
| 7035 | + }); | |
| 7036 | + } else if (shouldOpen) { | |
| 7037 | + if (checkShouldOpen()) { | |
| 7038 | + store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); | |
| 7039 | + } | |
| 7040 | + } | |
| 7041 | + } | |
| 7042 | + function onMouseLeave(event) { | |
| 7043 | + if (isClickLikeOpenEvent2()) { | |
| 7044 | + clearPointerEvents(); | |
| 7045 | + return; | |
| 7046 | + } | |
| 7047 | + cleanupMouseMoveHandler(); | |
| 7048 | + const domReferenceElement = store2.select("domReferenceElement"); | |
| 7049 | + const doc = ownerDocument(domReferenceElement); | |
| 7050 | + instance.restTimeout.clear(); | |
| 7051 | + instance.restTimeoutPending = false; | |
| 7052 | + const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); | |
| 7053 | + if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { | |
| 7054 | + return; | |
| 7055 | + } | |
| 7056 | + if (handleCloseRef.current && handleCloseContextBase) { | |
| 7057 | + if (!store2.select("open")) { | |
| 7058 | + instance.openChangeTimeout.clear(); | |
| 7059 | + } | |
| 7060 | + const currentTrigger = triggerElementRef.current; | |
| 7061 | + instance.handler = handleCloseRef.current({ | |
| 7062 | + ...handleCloseContextBase, | |
| 7063 | + tree, | |
| 7064 | + x: event.clientX, | |
| 7065 | + y: event.clientY, | |
| 7066 | + onClose() { | |
| 7067 | + clearPointerEvents(); | |
| 7068 | + cleanupMouseMoveHandler(); | |
| 7069 | + if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store2.select("domReferenceElement")) { | |
| 7070 | + closeWithDelay(event, true); | |
| 7071 | + } | |
| 7072 | + } | |
| 7073 | + }); | |
| 7074 | + doc.addEventListener("mousemove", instance.handler); | |
| 7075 | + instance.handler(event); | |
| 7076 | + return; | |
| 7077 | + } | |
| 7078 | + const shouldClose = instance.pointerType === "touch" ? !contains(store2.select("floatingElement"), event.relatedTarget) : true; | |
| 7079 | + if (shouldClose) { | |
| 7080 | + closeWithDelay(event); | |
| 7081 | + } | |
| 7082 | + } | |
| 7083 | + function onMouseOut(event) { | |
| 7084 | + if (contains(trigger, event.relatedTarget)) { | |
| 7085 | + return; | |
| 7086 | + } | |
| 7087 | + instance.openChangeTimeout.clear(); | |
| 7088 | + instance.restTimeout.clear(); | |
| 7089 | + instance.restTimeoutPending = false; | |
| 7090 | + } | |
| 7091 | + const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, "mouseout", onMouseOut) : void 0; | |
| 7092 | + if (move) { | |
| 7093 | + return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { | |
| 7094 | + once: true | |
| 7095 | + }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); | |
| 7096 | + } | |
| 7097 | + return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); | |
| 7098 | + }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store2, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]); | |
| 7099 | + return React27.useMemo(() => { | |
| 7100 | + if (!enabled) { | |
| 7101 | + return void 0; | |
| 7102 | + } | |
| 7103 | + function setPointerRef(event) { | |
| 7104 | + instance.pointerType = event.pointerType; | |
| 7105 | + } | |
| 7106 | + return { | |
| 7107 | + onPointerDown: setPointerRef, | |
| 7108 | + onPointerEnter: setPointerRef, | |
| 7109 | + onMouseMove(event) { | |
| 7110 | + const { | |
| 7111 | + nativeEvent | |
| 7112 | + } = event; | |
| 7113 | + const trigger = event.currentTarget; | |
| 7114 | + const currentDomReference = store2.select("domReferenceElement"); | |
| 7115 | + const currentOpen = store2.select("open"); | |
| 7116 | + const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); | |
| 7117 | + if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { | |
| 7118 | + return; | |
| 7119 | + } | |
| 7120 | + if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { | |
| 7121 | + const floatingElement = store2.select("floatingElement"); | |
| 7122 | + if (floatingElement) { | |
| 7123 | + const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; | |
| 7124 | + applySafePolygonPointerEventsMutation(instance, { | |
| 7125 | + scopeElement, | |
| 7126 | + referenceElement: trigger, | |
| 7127 | + floatingElement | |
| 7128 | + }); | |
| 7129 | + } | |
| 7130 | + } | |
| 7131 | + const restMsValue = getRestMs(restMsRef.current); | |
| 7132 | + if (currentOpen && !isOverInactive || restMsValue === 0) { | |
| 7133 | + return; | |
| 7134 | + } | |
| 7135 | + if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { | |
| 7136 | + return; | |
| 7137 | + } | |
| 7138 | + instance.restTimeout.clear(); | |
| 7139 | + function handleMouseMove() { | |
| 7140 | + instance.restTimeoutPending = false; | |
| 7141 | + if (isClickLikeOpenEvent2()) { | |
| 7142 | + return; | |
| 7143 | + } | |
| 7144 | + const latestOpen = store2.select("open"); | |
| 7145 | + if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { | |
| 7146 | + store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); | |
| 7147 | + } | |
| 7148 | + } | |
| 7149 | + if (instance.pointerType === "touch") { | |
| 7150 | + ReactDOM5.flushSync(() => { | |
| 7151 | + handleMouseMove(); | |
| 7152 | + }); | |
| 7153 | + } else if (isOverInactive && currentOpen) { | |
| 7154 | + handleMouseMove(); | |
| 7155 | + } else { | |
| 7156 | + instance.restTimeoutPending = true; | |
| 7157 | + instance.restTimeout.start(restMsValue, handleMouseMove); | |
| 7158 | + } | |
| 7159 | + } | |
| 7160 | + }; | |
| 7161 | + }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store2, restMsRef, checkShouldOpen]); | |
| 7162 | + } | |
| 7163 | + | |
| 7164 | + // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs | |
| 7165 | + var CURSOR_SPEED_THRESHOLD = 0.1; | |
| 7166 | + var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; | |
| 7167 | + var POLYGON_BUFFER = 0.5; | |
| 7168 | + function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { | |
| 7169 | + return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; | |
| 7170 | + } | |
| 7171 | + function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { | |
| 7172 | + let isInsideValue = false; | |
| 7173 | + if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { | |
| 7174 | + isInsideValue = !isInsideValue; | |
| 7175 | + } | |
| 7176 | + if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { | |
| 7177 | + isInsideValue = !isInsideValue; | |
| 7178 | + } | |
| 7179 | + if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { | |
| 7180 | + isInsideValue = !isInsideValue; | |
| 7181 | + } | |
| 7182 | + if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { | |
| 7183 | + isInsideValue = !isInsideValue; | |
| 7184 | + } | |
| 7185 | + return isInsideValue; | |
| 7186 | + } | |
| 7187 | + function isInsideRect(pointX, pointY, rect) { | |
| 7188 | + return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; | |
| 7189 | + } | |
| 7190 | + function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { | |
| 7191 | + const minX = Math.min(x1, x2); | |
| 7192 | + const maxX = Math.max(x1, x2); | |
| 7193 | + const minY = Math.min(y1, y2); | |
| 7194 | + const maxY = Math.max(y1, y2); | |
| 7195 | + return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; | |
| 7196 | + } | |
| 7197 | + function safePolygon(options = {}) { | |
| 7198 | + const { | |
| 7199 | + blockPointerEvents = false | |
| 7200 | + } = options; | |
| 7201 | + const timeout = new Timeout(); | |
| 7202 | + const fn = ({ | |
| 7203 | + x, | |
| 7204 | + y, | |
| 7205 | + placement, | |
| 7206 | + elements, | |
| 7207 | + onClose, | |
| 7208 | + nodeId, | |
| 7209 | + tree | |
| 7210 | + }) => { | |
| 7211 | + const side = placement?.split("-")[0]; | |
| 7212 | + let hasLanded = false; | |
| 7213 | + let lastX = null; | |
| 7214 | + let lastY = null; | |
| 7215 | + let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; | |
| 7216 | + function isCursorMovingSlowly(nextX, nextY) { | |
| 7217 | + const currentTime = performance.now(); | |
| 7218 | + const elapsedTime = currentTime - lastCursorTime; | |
| 7219 | + if (lastX === null || lastY === null || elapsedTime === 0) { | |
| 7220 | + lastX = nextX; | |
| 7221 | + lastY = nextY; | |
| 7222 | + lastCursorTime = currentTime; | |
| 7223 | + return false; | |
| 7224 | + } | |
| 7225 | + const deltaX = nextX - lastX; | |
| 7226 | + const deltaY = nextY - lastY; | |
| 7227 | + const distanceSquared = deltaX * deltaX + deltaY * deltaY; | |
| 7228 | + const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; | |
| 7229 | + lastX = nextX; | |
| 7230 | + lastY = nextY; | |
| 7231 | + lastCursorTime = currentTime; | |
| 7232 | + return distanceSquared < thresholdSquared; | |
| 7233 | + } | |
| 7234 | + function close() { | |
| 7235 | + timeout.clear(); | |
| 7236 | + onClose(); | |
| 7237 | + } | |
| 7238 | + return function onMouseMove(event) { | |
| 7239 | + timeout.clear(); | |
| 7240 | + const domReference = elements.domReference; | |
| 7241 | + const floating = elements.floating; | |
| 7242 | + if (!domReference || !floating || side == null || x == null || y == null) { | |
| 7243 | + return void 0; | |
| 7244 | + } | |
| 7245 | + const { | |
| 7246 | + clientX, | |
| 7247 | + clientY | |
| 7248 | + } = event; | |
| 7249 | + const target = getTarget(event); | |
| 7250 | + const isLeave = event.type === "mouseleave"; | |
| 7251 | + const isOverFloatingEl = contains(floating, target); | |
| 7252 | + const isOverReferenceEl = contains(domReference, target); | |
| 7253 | + if (isOverFloatingEl) { | |
| 7254 | + hasLanded = true; | |
| 7255 | + if (!isLeave) { | |
| 7256 | + return void 0; | |
| 7257 | + } | |
| 7258 | + } | |
| 7259 | + if (isOverReferenceEl) { | |
| 7260 | + hasLanded = false; | |
| 7261 | + if (!isLeave) { | |
| 7262 | + hasLanded = true; | |
| 7263 | + return void 0; | |
| 7264 | + } | |
| 7265 | + } | |
| 7266 | + if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { | |
| 7267 | + return void 0; | |
| 7268 | + } | |
| 7269 | + function hasOpenChildNode() { | |
| 7270 | + return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); | |
| 7271 | + } | |
| 7272 | + function closeIfNoOpenChild() { | |
| 7273 | + if (!hasOpenChildNode()) { | |
| 7274 | + close(); | |
| 7275 | + } | |
| 7276 | + } | |
| 7277 | + if (hasOpenChildNode()) { | |
| 7278 | + return void 0; | |
| 7279 | + } | |
| 7280 | + const refRect = domReference.getBoundingClientRect(); | |
| 7281 | + const rect = floating.getBoundingClientRect(); | |
| 7282 | + const cursorLeaveFromRight = x > rect.right - rect.width / 2; | |
| 7283 | + const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; | |
| 7284 | + const isFloatingWider = rect.width > refRect.width; | |
| 7285 | + const isFloatingTaller = rect.height > refRect.height; | |
| 7286 | + const left = (isFloatingWider ? refRect : rect).left; | |
| 7287 | + const right = (isFloatingWider ? refRect : rect).right; | |
| 7288 | + const top = (isFloatingTaller ? refRect : rect).top; | |
| 7289 | + const bottom = (isFloatingTaller ? refRect : rect).bottom; | |
| 7290 | + 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) { | |
| 7291 | + closeIfNoOpenChild(); | |
| 7292 | + return void 0; | |
| 7293 | + } | |
| 7294 | + let isInsideTroughRect = false; | |
| 7295 | + switch (side) { | |
| 7296 | + case "top": | |
| 7297 | + isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); | |
| 7298 | + break; | |
| 7299 | + case "bottom": | |
| 7300 | + isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); | |
| 7301 | + break; | |
| 7302 | + case "left": | |
| 7303 | + isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); | |
| 7304 | + break; | |
| 7305 | + case "right": | |
| 7306 | + isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); | |
| 7307 | + break; | |
| 7308 | + default: | |
| 7309 | + } | |
| 7310 | + if (isInsideTroughRect) { | |
| 7311 | + return void 0; | |
| 7312 | + } | |
| 7313 | + if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { | |
| 7314 | + closeIfNoOpenChild(); | |
| 7315 | + return void 0; | |
| 7316 | + } | |
| 7317 | + if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { | |
| 7318 | + closeIfNoOpenChild(); | |
| 7319 | + return void 0; | |
| 7320 | + } | |
| 7321 | + let isInsidePolygon = false; | |
| 7322 | + switch (side) { | |
| 7323 | + case "top": { | |
| 7324 | + const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 7325 | + const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; | |
| 7326 | + const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; | |
| 7327 | + const cursorPointY = y + POLYGON_BUFFER + 1; | |
| 7328 | + const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; | |
| 7329 | + const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; | |
| 7330 | + isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); | |
| 7331 | + break; | |
| 7332 | + } | |
| 7333 | + case "bottom": { | |
| 7334 | + const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 7335 | + const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; | |
| 7336 | + const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; | |
| 7337 | + const cursorPointY = y - POLYGON_BUFFER; | |
| 7338 | + const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; | |
| 7339 | + const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; | |
| 7340 | + isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); | |
| 7341 | + break; | |
| 7342 | + } | |
| 7343 | + case "left": { | |
| 7344 | + const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 7345 | + const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; | |
| 7346 | + const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; | |
| 7347 | + const cursorPointX = x + POLYGON_BUFFER + 1; | |
| 7348 | + const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; | |
| 7349 | + const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; | |
| 7350 | + isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); | |
| 7351 | + break; | |
| 7352 | + } | |
| 7353 | + case "right": { | |
| 7354 | + const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 7355 | + const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; | |
| 7356 | + const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; | |
| 7357 | + const cursorPointX = x - POLYGON_BUFFER; | |
| 7358 | + const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; | |
| 7359 | + const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; | |
| 7360 | + isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); | |
| 7361 | + break; | |
| 7362 | + } | |
| 7363 | + default: | |
| 7364 | + } | |
| 7365 | + if (!isInsidePolygon) { | |
| 7366 | + closeIfNoOpenChild(); | |
| 7367 | + } else if (!hasLanded) { | |
| 7368 | + timeout.start(40, closeIfNoOpenChild); | |
| 7369 | + } | |
| 7370 | + return void 0; | |
| 7371 | + }; | |
| 7372 | + }; | |
| 7373 | + fn.__options = { | |
| 7374 | + ...options, | |
| 7375 | + blockPointerEvents | |
| 7376 | + }; | |
| 7377 | + return fn; | |
| 7378 | + } | |
| 7379 | + | |
| 7380 | + // node_modules/@base-ui/react/utils/NullStore.mjs | |
| 7381 | + var NullStore = class extends ReactStore { | |
| 7382 | + // `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding | |
| 7383 | + // `setState` alone would neutralize them today. They are overridden explicitly so the store stays | |
| 7384 | + // inert even if a future base-class change stops routing a mutator through `setState`. | |
| 7385 | + setState(_newState) { | |
| 7386 | + } | |
| 7387 | + update(_changes) { | |
| 7388 | + } | |
| 7389 | + set(_key, _value) { | |
| 7390 | + } | |
| 7391 | + notifyAll() { | |
| 7392 | + } | |
| 7393 | + }; | |
| 7394 | + | |
| 7395 | + // node_modules/@base-ui/utils/inertValue.mjs | |
| 7396 | + function inertValue(value) { | |
| 7397 | + if (isReactVersionAtLeast(19)) { | |
| 7398 | + return value; | |
| 7399 | + } | |
| 7400 | + return value ? "true" : void 0; | |
| 7401 | + } | |
| 7402 | + | |
| 7403 | + // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs | |
| 7404 | + var React28 = __toESM(require_react(), 1); | |
| 7405 | + var DirectionContext = /* @__PURE__ */ React28.createContext(void 0); | |
| 7406 | + if (true) DirectionContext.displayName = "DirectionContext"; | |
| 7407 | + function useDirection() { | |
| 7408 | + const context = React28.useContext(DirectionContext); | |
| 7409 | + return context?.direction ?? "ltr"; | |
| 7410 | + } | |
| 7411 | + | |
| 7412 | + // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs | |
| 7413 | + var React29 = __toESM(require_react(), 1); | |
| 7414 | + | |
| 7415 | + // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs | |
| 7416 | + var baseArrow = (options) => ({ | |
| 7417 | + name: "arrow", | |
| 7418 | + options, | |
| 7419 | + async fn(state) { | |
| 7420 | + const { | |
| 7421 | + x, | |
| 7422 | + y, | |
| 7423 | + placement, | |
| 7424 | + rects, | |
| 7425 | + platform: platform3, | |
| 7426 | + elements, | |
| 7427 | + middlewareData | |
| 7428 | + } = state; | |
| 7429 | + const { | |
| 7430 | + element, | |
| 7431 | + padding = 0, | |
| 7432 | + offsetParent = "real" | |
| 7433 | + } = evaluate(options, state) || {}; | |
| 7434 | + if (element == null) { | |
| 7435 | + return {}; | |
| 7436 | + } | |
| 7437 | + const paddingObject = getPaddingObject(padding); | |
| 7438 | + const coords = { | |
| 7439 | + x, | |
| 7440 | + y | |
| 7441 | + }; | |
| 7442 | + const axis = getAlignmentAxis(placement); | |
| 7443 | + const length = getAxisLength(axis); | |
| 7444 | + const arrowDimensions = await platform3.getDimensions(element); | |
| 7445 | + const isYAxis = axis === "y"; | |
| 7446 | + const minProp = isYAxis ? "top" : "left"; | |
| 7447 | + const maxProp = isYAxis ? "bottom" : "right"; | |
| 7448 | + const clientProp = isYAxis ? "clientHeight" : "clientWidth"; | |
| 7449 | + const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; | |
| 7450 | + const startDiff = coords[axis] - rects.reference[axis]; | |
| 7451 | + const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; | |
| 7452 | + let clientSize = elements.floating[clientProp] || rects.floating[length]; | |
| 7453 | + if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { | |
| 7454 | + clientSize = elements.floating[clientProp] || rects.floating[length]; | |
| 7455 | + } | |
| 7456 | + const centerToReference = endDiff / 2 - startDiff / 2; | |
| 7457 | + const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; | |
| 7458 | + const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); | |
| 7459 | + const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); | |
| 7460 | + const min2 = minPadding; | |
| 7461 | + const max2 = clientSize - arrowDimensions[length] - maxPadding; | |
| 7462 | + const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; | |
| 7463 | + const offset4 = clamp(min2, center, max2); | |
| 7464 | + const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; | |
| 7465 | + const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; | |
| 7466 | + return { | |
| 7467 | + [axis]: coords[axis] + alignmentOffset, | |
| 7468 | + data: { | |
| 7469 | + [axis]: offset4, | |
| 7470 | + centerOffset: center - offset4 - alignmentOffset, | |
| 7471 | + ...shouldAddOffset && { | |
| 7472 | + alignmentOffset | |
| 7473 | + } | |
| 7474 | + }, | |
| 7475 | + reset: shouldAddOffset | |
| 7476 | + }; | |
| 7477 | + } | |
| 7478 | + }); | |
| 7479 | + var arrow4 = (options, deps) => { | |
| 7480 | + const { | |
| 7481 | + name, | |
| 7482 | + fn | |
| 7483 | + } = baseArrow(options); | |
| 7484 | + return { | |
| 7485 | + name, | |
| 7486 | + fn, | |
| 7487 | + options: [options, deps] | |
| 7488 | + }; | |
| 7489 | + }; | |
| 7490 | + | |
| 7491 | + // node_modules/@base-ui/react/utils/hideMiddleware.mjs | |
| 7492 | + var hide4 = { | |
| 7493 | + name: "hide", | |
| 7494 | + async fn(state) { | |
| 7495 | + const { | |
| 7496 | + width, | |
| 7497 | + height, | |
| 7498 | + x, | |
| 7499 | + y | |
| 7500 | + } = state.rects.reference; | |
| 7501 | + const anchorHidden2 = width === 0 && height === 0 && x === 0 && y === 0; | |
| 7502 | + const overflow = await state.platform.detectOverflow(state, { | |
| 7503 | + elementContext: "reference" | |
| 7504 | + }); | |
| 7505 | + const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0; | |
| 7506 | + return { | |
| 7507 | + data: { | |
| 7508 | + referenceHidden: referenceHidden || anchorHidden2 | |
| 7509 | + } | |
| 7510 | + }; | |
| 7511 | + } | |
| 7512 | + }; | |
| 7513 | + | |
| 7514 | + // node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs | |
| 7515 | + var DEFAULT_SIDES = { | |
| 7516 | + sideX: "left", | |
| 7517 | + sideY: "top" | |
| 7518 | + }; | |
| 7519 | + | |
| 7520 | + // node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs | |
| 7521 | + var availableWidth = "--available-width"; | |
| 7522 | + var availableHeight = "--available-height"; | |
| 7523 | + var anchorWidth = "--anchor-width"; | |
| 7524 | + var anchorHeight = "--anchor-height"; | |
| 7525 | + var transformOrigin = "--transform-origin"; | |
| 7526 | + var positionerWidth = "--positioner-width"; | |
| 7527 | + var positionerHeight = "--positioner-height"; | |
| 7528 | + | |
| 7529 | + // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs | |
| 7530 | + var AVAILABLE_WIDTH_VAR = availableWidth; | |
| 7531 | + var AVAILABLE_HEIGHT_VAR = availableHeight; | |
| 7532 | + function getLogicalSide(sideParam, renderedSide, isRtl) { | |
| 7533 | + const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; | |
| 7534 | + const logicalRight = isRtl ? "inline-start" : "inline-end"; | |
| 7535 | + const logicalLeft = isRtl ? "inline-end" : "inline-start"; | |
| 7536 | + return { | |
| 7537 | + top: "top", | |
| 7538 | + right: isLogicalSideParam ? logicalRight : "right", | |
| 7539 | + bottom: "bottom", | |
| 7540 | + left: isLogicalSideParam ? logicalLeft : "left" | |
| 7541 | + }[renderedSide]; | |
| 7542 | + } | |
| 7543 | + function getOffsetData(state, sideParam, isRtl) { | |
| 7544 | + const { | |
| 7545 | + rects, | |
| 7546 | + placement | |
| 7547 | + } = state; | |
| 7548 | + const data = { | |
| 7549 | + side: getLogicalSide(sideParam, getSide(placement), isRtl), | |
| 7550 | + align: getAlignment(placement) || "center", | |
| 7551 | + anchor: { | |
| 7552 | + width: rects.reference.width, | |
| 7553 | + height: rects.reference.height | |
| 7554 | + }, | |
| 7555 | + positioner: { | |
| 7556 | + width: rects.floating.width, | |
| 7557 | + height: rects.floating.height | |
| 7558 | + } | |
| 7559 | + }; | |
| 7560 | + return data; | |
| 7561 | + } | |
| 7562 | + function useAnchorPositioning(params) { | |
| 7563 | + return useAnchorPositioningWithHook(params, useBaseUIFloating); | |
| 7564 | + } | |
| 7565 | + function useAnchorPositioningWithHook(params, useFloatingHook) { | |
| 7566 | + const { | |
| 7567 | + // Public parameters | |
| 7568 | + anchor, | |
| 7569 | + positionMethod = "absolute", | |
| 7570 | + side: sideParam = "bottom", | |
| 7571 | + sideOffset = 0, | |
| 7572 | + align = "center", | |
| 7573 | + alignOffset = 0, | |
| 7574 | + collisionBoundary, | |
| 7575 | + collisionPadding: collisionPaddingParam = 5, | |
| 7576 | + sticky = false, | |
| 7577 | + arrowPadding = 5, | |
| 7578 | + disableAnchorTracking = false, | |
| 7579 | + inline: inlineMiddleware, | |
| 7580 | + // Private parameters | |
| 7581 | + keepMounted = false, | |
| 7582 | + floatingRootContext, | |
| 7583 | + mounted, | |
| 7584 | + collisionAvoidance, | |
| 7585 | + shift: shift4, | |
| 7586 | + nodeId, | |
| 7587 | + adaptiveOrigin: adaptiveOrigin2, | |
| 7588 | + lazyFlip = false, | |
| 7589 | + externalTree | |
| 7590 | + } = params; | |
| 7591 | + const [mountSide, setMountSide] = React29.useState(null); | |
| 7592 | + if (!mounted && mountSide !== null) { | |
| 7593 | + setMountSide(null); | |
| 7594 | + } | |
| 7595 | + const collisionAvoidanceSide = collisionAvoidance.side || "flip"; | |
| 7596 | + const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; | |
| 7597 | + const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; | |
| 7598 | + const shiftCrossAxis = shift4?.crossAxis ?? false; | |
| 7599 | + const shiftRootBoundary = shift4?.rootBoundary; | |
| 7600 | + const anchorFn = typeof anchor === "function" ? anchor : void 0; | |
| 7601 | + const anchorFnCallback = useStableCallback(anchorFn); | |
| 7602 | + const anchorDep = anchorFn ? anchorFnCallback : anchor; | |
| 7603 | + const anchorValueRef = useValueAsRef(anchor); | |
| 7604 | + const mountedRef = useValueAsRef(mounted); | |
| 7605 | + const direction = useDirection(); | |
| 7606 | + const isRtl = direction === "rtl"; | |
| 7607 | + const side = mountSide || { | |
| 7608 | + top: "top", | |
| 7609 | + right: "right", | |
| 7610 | + bottom: "bottom", | |
| 7611 | + left: "left", | |
| 7612 | + "inline-end": isRtl ? "left" : "right", | |
| 7613 | + "inline-start": isRtl ? "right" : "left" | |
| 7614 | + }[sideParam]; | |
| 7615 | + const placement = align === "center" ? side : `${side}-${align}`; | |
| 7616 | + let collisionPadding = collisionPaddingParam; | |
| 7617 | + if (typeof collisionPadding === "number") { | |
| 7618 | + collisionPadding = { | |
| 7619 | + top: collisionPadding, | |
| 7620 | + right: collisionPadding, | |
| 7621 | + bottom: collisionPadding, | |
| 7622 | + left: collisionPadding | |
| 7623 | + }; | |
| 7624 | + } else if (collisionPadding) { | |
| 7625 | + collisionPadding = { | |
| 7626 | + top: collisionPadding.top || 0, | |
| 7627 | + right: collisionPadding.right || 0, | |
| 7628 | + bottom: collisionPadding.bottom || 0, | |
| 7629 | + left: collisionPadding.left || 0 | |
| 7630 | + }; | |
| 7631 | + } | |
| 7632 | + const bias = 1; | |
| 7633 | + const biasTop = sideParam === "bottom" ? bias : 0; | |
| 7634 | + const biasBottom = sideParam === "top" ? bias : 0; | |
| 7635 | + const biasLeft = sideParam === "right" ? bias : 0; | |
| 7636 | + const biasRight = sideParam === "left" ? bias : 0; | |
| 7637 | + const commonCollisionProps = { | |
| 7638 | + boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, | |
| 7639 | + padding: collisionPadding | |
| 7640 | + }; | |
| 7641 | + const arrowRef = React29.useRef(null); | |
| 7642 | + const sideOffsetRef = useValueAsRef(sideOffset); | |
| 7643 | + const alignOffsetRef = useValueAsRef(alignOffset); | |
| 7644 | + const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; | |
| 7645 | + const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; | |
| 7646 | + const middleware = []; | |
| 7647 | + if (inlineMiddleware) { | |
| 7648 | + middleware.push(inlineMiddleware); | |
| 7649 | + } | |
| 7650 | + middleware.push(offset3((state) => { | |
| 7651 | + const data = getOffsetData(state, sideParam, isRtl); | |
| 7652 | + const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; | |
| 7653 | + const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; | |
| 7654 | + return { | |
| 7655 | + mainAxis: sideAxis, | |
| 7656 | + crossAxis: alignAxis, | |
| 7657 | + alignmentAxis: alignAxis | |
| 7658 | + }; | |
| 7659 | + }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); | |
| 7660 | + const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; | |
| 7661 | + const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); | |
| 7662 | + const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ | |
| 7663 | + ...commonCollisionProps, | |
| 7664 | + // Ensure the popup flips if it's been limited by its --available-height and it resizes. | |
| 7665 | + // Since the size() padding is smaller than the flip() padding, flip() will take precedence. | |
| 7666 | + padding: { | |
| 7667 | + top: collisionPadding.top + bias + biasTop, | |
| 7668 | + right: collisionPadding.right + bias + biasRight, | |
| 7669 | + bottom: collisionPadding.bottom + bias + biasBottom, | |
| 7670 | + left: collisionPadding.left + bias + biasLeft | |
| 7671 | + }, | |
| 7672 | + mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", | |
| 7673 | + crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, | |
| 7674 | + fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide | |
| 7675 | + }); | |
| 7676 | + const shiftMiddleware = shiftDisabled ? null : shift3({ | |
| 7677 | + ...commonCollisionProps, | |
| 7678 | + // Use the Layout Viewport to avoid shifting around when pinch-zooming. | |
| 7679 | + rootBoundary: shiftRootBoundary, | |
| 7680 | + mainAxis: collisionAvoidanceAlign !== "none", | |
| 7681 | + crossAxis: crossAxisShiftEnabled, | |
| 7682 | + limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { | |
| 7683 | + if (!arrowRef.current) { | |
| 7684 | + return {}; | |
| 7685 | + } | |
| 7686 | + const { | |
| 7687 | + width, | |
| 7688 | + height | |
| 7689 | + } = arrowRef.current.getBoundingClientRect(); | |
| 7690 | + const sideAxis = getSideAxis(getSide(limitData.placement)); | |
| 7691 | + const arrowSize = sideAxis === "y" ? width : height; | |
| 7692 | + const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; | |
| 7693 | + return { | |
| 7694 | + offset: arrowSize / 2 + offsetAmount / 2 | |
| 7695 | + }; | |
| 7696 | + }) | |
| 7697 | + }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]); | |
| 7698 | + if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { | |
| 7699 | + middleware.push(shiftMiddleware, flipMiddleware); | |
| 7700 | + } else { | |
| 7701 | + middleware.push(flipMiddleware, shiftMiddleware); | |
| 7702 | + } | |
| 7703 | + middleware.push(size3({ | |
| 7704 | + ...commonCollisionProps, | |
| 7705 | + apply({ | |
| 7706 | + elements: { | |
| 7707 | + floating | |
| 7708 | + }, | |
| 7709 | + availableWidth: availableWidth2, | |
| 7710 | + availableHeight: availableHeight2, | |
| 7711 | + rects | |
| 7712 | + }) { | |
| 7713 | + if (!mountedRef.current) { | |
| 7714 | + return; | |
| 7715 | + } | |
| 7716 | + const floatingStyle = floating.style; | |
| 7717 | + floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth2}px`); | |
| 7718 | + floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight2}px`); | |
| 7719 | + const dpr = getWindow(floating).devicePixelRatio || 1; | |
| 7720 | + const { | |
| 7721 | + x: x2, | |
| 7722 | + y: y2, | |
| 7723 | + width, | |
| 7724 | + height | |
| 7725 | + } = rects.reference; | |
| 7726 | + const anchorWidth2 = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr; | |
| 7727 | + const anchorHeight2 = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr; | |
| 7728 | + floatingStyle.setProperty(anchorWidth, `${anchorWidth2}px`); | |
| 7729 | + floatingStyle.setProperty(anchorHeight, `${anchorHeight2}px`); | |
| 7730 | + } | |
| 7731 | + }), arrow4((state) => ({ | |
| 7732 | + // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, | |
| 7733 | + // we'll create a fake element. | |
| 7734 | + element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), | |
| 7735 | + // No padding for the fake arrow: it would displace aligned popups on narrow anchors. | |
| 7736 | + padding: arrowRef.current ? arrowPadding : 0, | |
| 7737 | + offsetParent: "floating" | |
| 7738 | + }), [arrowPadding]), { | |
| 7739 | + name: "transformOrigin", | |
| 7740 | + fn(state) { | |
| 7741 | + const { | |
| 7742 | + elements: { | |
| 7743 | + floating | |
| 7744 | + }, | |
| 7745 | + middlewareData: middlewareData2, | |
| 7746 | + placement: renderedPlacement2, | |
| 7747 | + platform: platform3, | |
| 7748 | + rects, | |
| 7749 | + y: y2 | |
| 7750 | + } = state; | |
| 7751 | + const renderedSide2 = getSide(renderedPlacement2); | |
| 7752 | + const renderedAlign2 = getAlignment(renderedPlacement2); | |
| 7753 | + const isVertical = getSideAxis(renderedSide2) === "y"; | |
| 7754 | + const arrowEl = arrowRef.current; | |
| 7755 | + const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; | |
| 7756 | + let crossOrigin; | |
| 7757 | + if (!arrowEl && renderedAlign2 && Math.abs(isVertical ? middlewareData2.shift?.x || 0 : middlewareData2.shift?.y || 0) <= 1) { | |
| 7758 | + crossOrigin = renderedAlign2 === "start" === (isVertical && platform3.isRTL?.(floating) === true) ? "100%" : "0%"; | |
| 7759 | + } else { | |
| 7760 | + const arrowOffset = isVertical ? middlewareData2.arrow?.x || 0 : middlewareData2.arrow?.y || 0; | |
| 7761 | + const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0; | |
| 7762 | + crossOrigin = `${arrowOffset + arrowSize / 2}px`; | |
| 7763 | + } | |
| 7764 | + let sideOrigin = renderedSide2 === "top" || renderedSide2 === "left" ? `calc(100% + ${sideOffsetValue}px)` : `${-sideOffsetValue}px`; | |
| 7765 | + if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData2.shift?.y || 0) > sideOffsetValue) { | |
| 7766 | + sideOrigin = `${rects.reference.y + rects.reference.height / 2 - y2}px`; | |
| 7767 | + } | |
| 7768 | + floating.style.setProperty(transformOrigin, isVertical ? `${crossOrigin} ${sideOrigin}` : `${sideOrigin} ${crossOrigin}`); | |
| 7769 | + return {}; | |
| 7770 | + } | |
| 7771 | + }, hide4, adaptiveOrigin2); | |
| 7772 | + useIsoLayoutEffect(() => { | |
| 7773 | + if (!mounted && floatingRootContext) { | |
| 7774 | + floatingRootContext.update({ | |
| 7775 | + referenceElement: null, | |
| 7776 | + floatingElement: null, | |
| 7777 | + domReferenceElement: null, | |
| 7778 | + positionReference: null | |
| 7779 | + }); | |
| 7780 | + } | |
| 7781 | + }, [mounted, floatingRootContext]); | |
| 7782 | + const autoUpdateOptions = React29.useMemo(() => ({ | |
| 7783 | + ancestorScroll: !disableAnchorTracking, | |
| 7784 | + elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", | |
| 7785 | + layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" | |
| 7786 | + }), [disableAnchorTracking]); | |
| 7787 | + const { | |
| 7788 | + refs, | |
| 7789 | + elements, | |
| 7790 | + x, | |
| 7791 | + y, | |
| 7792 | + middlewareData, | |
| 7793 | + update: update2, | |
| 7794 | + placement: renderedPlacement, | |
| 7795 | + context, | |
| 7796 | + isPositioned, | |
| 7797 | + floatingStyles: originalFloatingStyles | |
| 7798 | + } = useFloatingHook({ | |
| 7799 | + rootContext: floatingRootContext, | |
| 7800 | + open: keepMounted ? mounted : void 0, | |
| 7801 | + placement, | |
| 7802 | + middleware, | |
| 7803 | + strategy: positionMethod, | |
| 7804 | + whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), | |
| 7805 | + nodeId, | |
| 7806 | + externalTree | |
| 7807 | + }); | |
| 7808 | + const { | |
| 7809 | + sideX, | |
| 7810 | + sideY | |
| 7811 | + } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; | |
| 7812 | + const resolvedPosition = isPositioned ? positionMethod : "fixed"; | |
| 7813 | + const floatingStyles = React29.useMemo(() => { | |
| 7814 | + let base; | |
| 7815 | + if (!isPositioned) { | |
| 7816 | + base = { | |
| 7817 | + position: resolvedPosition, | |
| 7818 | + top: 0, | |
| 7819 | + left: 0 | |
| 7820 | + }; | |
| 7821 | + } else if (adaptiveOrigin2) { | |
| 7822 | + base = { | |
| 7823 | + position: resolvedPosition, | |
| 7824 | + [sideX]: x, | |
| 7825 | + [sideY]: y | |
| 7826 | + }; | |
| 7827 | + } else { | |
| 7828 | + base = { | |
| 7829 | + ...originalFloatingStyles, | |
| 7830 | + position: resolvedPosition | |
| 7831 | + }; | |
| 7832 | + } | |
| 7833 | + base[AVAILABLE_WIDTH_VAR] = "100vw"; | |
| 7834 | + base[AVAILABLE_HEIGHT_VAR] = "100vh"; | |
| 7835 | + if (!isPositioned) { | |
| 7836 | + base.opacity = 0; | |
| 7837 | + } | |
| 7838 | + return base; | |
| 7839 | + }, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]); | |
| 7840 | + const registeredPositionReferenceRef = React29.useRef(null); | |
| 7841 | + useIsoLayoutEffect(() => { | |
| 7842 | + if (!mounted) { | |
| 7843 | + return; | |
| 7844 | + } | |
| 7845 | + const anchorValue = anchorValueRef.current; | |
| 7846 | + const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; | |
| 7847 | + const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; | |
| 7848 | + const finalAnchor = unwrappedElement || null; | |
| 7849 | + if (finalAnchor !== registeredPositionReferenceRef.current) { | |
| 7850 | + refs.setPositionReference(finalAnchor); | |
| 7851 | + registeredPositionReferenceRef.current = finalAnchor; | |
| 7852 | + } | |
| 7853 | + }, [mounted, refs, anchorDep, anchorValueRef]); | |
| 7854 | + React29.useEffect(() => { | |
| 7855 | + if (!mounted) { | |
| 7856 | + return; | |
| 7857 | + } | |
| 7858 | + const anchorValue = anchorValueRef.current; | |
| 7859 | + if (typeof anchorValue === "function") { | |
| 7860 | + return; | |
| 7861 | + } | |
| 7862 | + if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { | |
| 7863 | + refs.setPositionReference(anchorValue.current); | |
| 7864 | + registeredPositionReferenceRef.current = anchorValue.current; | |
| 7865 | + } | |
| 7866 | + }, [mounted, refs, anchorDep, anchorValueRef]); | |
| 7867 | + React29.useEffect(() => { | |
| 7868 | + if (keepMounted && mounted && elements.reference && elements.floating) { | |
| 7869 | + return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions); | |
| 7870 | + } | |
| 7871 | + return void 0; | |
| 7872 | + }, [keepMounted, mounted, elements, update2, autoUpdateOptions]); | |
| 7873 | + const renderedSide = getSide(renderedPlacement); | |
| 7874 | + const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); | |
| 7875 | + const renderedAlign = getAlignment(renderedPlacement) || "center"; | |
| 7876 | + const anchorHidden2 = Boolean(middlewareData.hide?.referenceHidden); | |
| 7877 | + useIsoLayoutEffect(() => { | |
| 7878 | + if (lazyFlip && mounted && isPositioned && renderedSide !== side) { | |
| 7879 | + setMountSide(renderedSide); | |
| 7880 | + } | |
| 7881 | + }, [lazyFlip, mounted, isPositioned, renderedSide, side]); | |
| 7882 | + const arrowStyles = React29.useMemo(() => ({ | |
| 7883 | + position: "absolute", | |
| 7884 | + top: middlewareData.arrow?.y, | |
| 7885 | + left: middlewareData.arrow?.x | |
| 7886 | + }), [middlewareData.arrow]); | |
| 7887 | + const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; | |
| 7888 | + return React29.useMemo(() => ({ | |
| 7889 | + positionerStyles: floatingStyles, | |
| 7890 | + arrowStyles, | |
| 7891 | + arrowRef, | |
| 7892 | + arrowUncentered, | |
| 7893 | + side: logicalRenderedSide, | |
| 7894 | + align: renderedAlign, | |
| 7895 | + physicalSide: renderedSide, | |
| 7896 | + anchorHidden: anchorHidden2, | |
| 7897 | + refs, | |
| 7898 | + context, | |
| 7899 | + isPositioned, | |
| 7900 | + update: update2 | |
| 7901 | + }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden2, refs, context, isPositioned, update2]); | |
| 7902 | + } | |
| 7903 | + function isRef(param) { | |
| 7904 | + return param != null && "current" in param; | |
| 7905 | + } | |
| 7906 | + | |
| 7907 | + // node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs | |
| 7908 | + function getDisabledMountTransitionStyles(transitionStatus) { | |
| 7909 | + return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; | |
| 7910 | + } | |
| 7911 | + | |
| 7912 | + // node_modules/@base-ui/react/utils/usePositioner.mjs | |
| 7913 | + function usePositioner(componentProps, state, { | |
| 7914 | + styles, | |
| 7915 | + transitionStatus, | |
| 7916 | + props, | |
| 7917 | + refs, | |
| 7918 | + hidden, | |
| 7919 | + inert = false | |
| 7920 | + }) { | |
| 7921 | + const style = { | |
| 7922 | + ...styles | |
| 7923 | + }; | |
| 7924 | + if (inert) { | |
| 7925 | + style.pointerEvents = "none"; | |
| 7926 | + } | |
| 7927 | + return useRenderElement("div", componentProps, { | |
| 7928 | + state, | |
| 7929 | + ref: refs, | |
| 7930 | + props: [{ | |
| 7931 | + role: "presentation", | |
| 7932 | + hidden, | |
| 7933 | + style | |
| 7934 | + }, getDisabledMountTransitionStyles(transitionStatus), props], | |
| 7935 | + stateAttributesMapping: popupStateMapping | |
| 7936 | + }); | |
| 7937 | + } | |
| 7938 | + | |
| 7939 | + // node_modules/@base-ui/react/utils/usePopupViewport.mjs | |
| 7940 | + var React33 = __toESM(require_react(), 1); | |
| 7941 | + var ReactDOM6 = __toESM(require_react_dom(), 1); | |
| 7942 | + | |
| 7943 | + // node_modules/@base-ui/utils/usePreviousValue.mjs | |
| 7944 | + var React30 = __toESM(require_react(), 1); | |
| 7945 | + function usePreviousValue(value) { | |
| 7946 | + const [state, setState] = React30.useState({ | |
| 7947 | + current: value, | |
| 7948 | + previous: null | |
| 7949 | + }); | |
| 7950 | + if (!Object.is(value, state.current)) { | |
| 7951 | + setState({ | |
| 7952 | + current: value, | |
| 7953 | + previous: state.current | |
| 7954 | + }); | |
| 7955 | + } | |
| 7956 | + return state.previous; | |
| 7957 | + } | |
| 7958 | + | |
| 7959 | + // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs | |
| 7960 | + var React31 = __toESM(require_react(), 1); | |
| 7961 | + | |
| 7962 | + // node_modules/@base-ui/react/utils/getCssDimensions.mjs | |
| 7963 | + function getCssDimensions2(element) { | |
| 7964 | + const css = getComputedStyle2(element); | |
| 7965 | + let width = parseFloat(css.width) || 0; | |
| 7966 | + let height = parseFloat(css.height) || 0; | |
| 7967 | + const hasOffset = isHTMLElement(element); | |
| 7968 | + const offsetWidth = hasOffset ? element.offsetWidth : width; | |
| 7969 | + const offsetHeight = hasOffset ? element.offsetHeight : height; | |
| 7970 | + const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; | |
| 7971 | + if (shouldFallback) { | |
| 7972 | + width = offsetWidth; | |
| 7973 | + height = offsetHeight; | |
| 7974 | + } | |
| 7975 | + return { | |
| 7976 | + width, | |
| 7977 | + height | |
| 7978 | + }; | |
| 7979 | + } | |
| 7980 | + | |
| 7981 | + // node_modules/@base-ui/react/utils/CommonPopupCssVars.mjs | |
| 7982 | + var popupWidth = "--popup-width"; | |
| 7983 | + var popupHeight = "--popup-height"; | |
| 7984 | + | |
| 7985 | + // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs | |
| 7986 | + function usePopupAutoResize(parameters) { | |
| 7987 | + const { | |
| 7988 | + popupElement, | |
| 7989 | + positionerElement, | |
| 7990 | + content, | |
| 7991 | + mounted, | |
| 7992 | + onMeasureLayout: onMeasureLayoutParam, | |
| 7993 | + onMeasureLayoutComplete: onMeasureLayoutCompleteParam, | |
| 7994 | + side, | |
| 7995 | + direction | |
| 7996 | + } = parameters; | |
| 7997 | + const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true); | |
| 7998 | + const animationFrame = useAnimationFrame(); | |
| 7999 | + const committedDimensionsRef = React31.useRef(null); | |
| 8000 | + const isInitialRenderRef = React31.useRef(true); | |
| 8001 | + const restoreAnchoringStylesRef = React31.useRef(NOOP); | |
| 8002 | + const onMeasureLayout = useStableCallback(onMeasureLayoutParam); | |
| 8003 | + const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); | |
| 8004 | + const anchoringStyles = React31.useMemo(() => getPopupAnchoringStyles(side, direction), [side, direction]); | |
| 8005 | + useIsoLayoutEffect(() => { | |
| 8006 | + if (!mounted) { | |
| 8007 | + restoreAnchoringStylesRef.current = NOOP; | |
| 8008 | + isInitialRenderRef.current = true; | |
| 8009 | + committedDimensionsRef.current = null; | |
| 8010 | + return void 0; | |
| 8011 | + } | |
| 8012 | + if (!popupElement || !positionerElement) { | |
| 8013 | + return void 0; | |
| 8014 | + } | |
| 8015 | + restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); | |
| 8016 | + setPopupCssSize(popupElement, "auto"); | |
| 8017 | + const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); | |
| 8018 | + const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); | |
| 8019 | + const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); | |
| 8020 | + const restorePositionerAvailableSize = applyElementStyles(positionerElement, { | |
| 8021 | + [availableWidth]: "max-content", | |
| 8022 | + [availableHeight]: "max-content" | |
| 8023 | + }); | |
| 8024 | + function restoreMeasurementOverrides() { | |
| 8025 | + restorePopupPosition(); | |
| 8026 | + restorePopupTransform(); | |
| 8027 | + restorePositionerAvailableSize(); | |
| 8028 | + } | |
| 8029 | + function restoreMeasurementOverridesIncludingScale() { | |
| 8030 | + restoreMeasurementOverrides(); | |
| 8031 | + restorePopupScale(); | |
| 8032 | + } | |
| 8033 | + onMeasureLayout?.(); | |
| 8034 | + if (isInitialRenderRef.current || committedDimensionsRef.current === null) { | |
| 8035 | + setPositionerCssSize(positionerElement, "max-content"); | |
| 8036 | + const dimensions = getCssDimensions2(popupElement); | |
| 8037 | + committedDimensionsRef.current = dimensions; | |
| 8038 | + setPositionerCssSize(positionerElement, dimensions); | |
| 8039 | + restoreMeasurementOverridesIncludingScale(); | |
| 8040 | + onMeasureLayoutComplete?.(null, dimensions); | |
| 8041 | + isInitialRenderRef.current = false; | |
| 8042 | + return () => { | |
| 8043 | + restoreAnchoringStylesRef.current(); | |
| 8044 | + restoreAnchoringStylesRef.current = NOOP; | |
| 8045 | + }; | |
| 8046 | + } | |
| 8047 | + setPositionerCssSize(positionerElement, "max-content"); | |
| 8048 | + const previousDimensions = committedDimensionsRef.current; | |
| 8049 | + const newDimensions = getCssDimensions2(popupElement); | |
| 8050 | + committedDimensionsRef.current = newDimensions; | |
| 8051 | + setPopupCssSize(popupElement, previousDimensions); | |
| 8052 | + restoreMeasurementOverridesIncludingScale(); | |
| 8053 | + onMeasureLayoutComplete?.(previousDimensions, newDimensions); | |
| 8054 | + setPositionerCssSize(positionerElement, newDimensions); | |
| 8055 | + const abortController = new AbortController(); | |
| 8056 | + animationFrame.request(() => { | |
| 8057 | + setPopupCssSize(popupElement, newDimensions); | |
| 8058 | + runOnceAnimationsFinish(() => { | |
| 8059 | + popupElement.style.setProperty(popupWidth, "auto"); | |
| 8060 | + popupElement.style.setProperty(popupHeight, "auto"); | |
| 8061 | + }, abortController.signal); | |
| 8062 | + }); | |
| 8063 | + return () => { | |
| 8064 | + abortController.abort(); | |
| 8065 | + animationFrame.cancel(); | |
| 8066 | + restoreAnchoringStylesRef.current(); | |
| 8067 | + restoreAnchoringStylesRef.current = NOOP; | |
| 8068 | + }; | |
| 8069 | + }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); | |
| 8070 | + } | |
| 8071 | + function getPopupAnchoringStyles(side, direction) { | |
| 8072 | + const isPhysicalTop = side === "top"; | |
| 8073 | + const isPhysicalLeft = side === "left" || side === (direction === "rtl" ? "inline-end" : "inline-start"); | |
| 8074 | + if (!isPhysicalTop && !isPhysicalLeft) { | |
| 8075 | + return EMPTY_OBJECT; | |
| 8076 | + } | |
| 8077 | + return { | |
| 8078 | + position: "absolute", | |
| 8079 | + [isPhysicalTop ? "bottom" : "top"]: "0", | |
| 8080 | + [isPhysicalLeft ? "right" : "left"]: "0" | |
| 8081 | + }; | |
| 8082 | + } | |
| 8083 | + function overrideElementStyle(element, property, value) { | |
| 8084 | + const originalValue = element.style.getPropertyValue(property); | |
| 8085 | + element.style.setProperty(property, value); | |
| 8086 | + return () => { | |
| 8087 | + element.style.setProperty(property, originalValue); | |
| 8088 | + }; | |
| 8089 | + } | |
| 8090 | + function applyElementStyles(element, styles) { | |
| 8091 | + const restorers = []; | |
| 8092 | + for (const [key, value] of Object.entries(styles)) { | |
| 8093 | + restorers.push(overrideElementStyle(element, key, value)); | |
| 8094 | + } | |
| 8095 | + return restorers.length ? () => { | |
| 8096 | + restorers.forEach((restore) => restore()); | |
| 8097 | + } : NOOP; | |
| 8098 | + } | |
| 8099 | + function setPopupCssSize(popupElement, size4) { | |
| 8100 | + const width = size4 === "auto" ? "auto" : `${size4.width}px`; | |
| 8101 | + const height = size4 === "auto" ? "auto" : `${size4.height}px`; | |
| 8102 | + popupElement.style.setProperty(popupWidth, width); | |
| 8103 | + popupElement.style.setProperty(popupHeight, height); | |
| 8104 | + } | |
| 8105 | + function setPositionerCssSize(positionerElement, size4) { | |
| 8106 | + const width = size4 === "max-content" ? "max-content" : `${size4.width}px`; | |
| 8107 | + const height = size4 === "max-content" ? "max-content" : `${size4.height}px`; | |
| 8108 | + positionerElement.style.setProperty(positionerWidth, width); | |
| 8109 | + positionerElement.style.setProperty(positionerHeight, height); | |
| 8110 | + } | |
| 8111 | + | |
| 8112 | + // node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs | |
| 8113 | + var React32 = __toESM(require_react(), 1); | |
| 8114 | + var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); | |
| 8115 | + var DirectionProvider = function DirectionProvider2(props) { | |
| 8116 | + const { | |
| 8117 | + direction = "ltr" | |
| 8118 | + } = props; | |
| 8119 | + const contextValue = React32.useMemo(() => ({ | |
| 8120 | + direction | |
| 8121 | + }), [direction]); | |
| 8122 | + return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DirectionContext.Provider, { | |
| 8123 | + value: contextValue, | |
| 8124 | + children: props.children | |
| 8125 | + }); | |
| 8126 | + }; | |
| 8127 | + if (true) DirectionProvider.displayName = "DirectionProvider"; | |
| 8128 | + | |
| 8129 | + // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs | |
| 8130 | + var adaptiveOrigin = { | |
| 8131 | + name: "adaptiveOrigin", | |
| 8132 | + async fn(state) { | |
| 8133 | + const { | |
| 8134 | + x: rawX, | |
| 8135 | + y: rawY, | |
| 8136 | + rects: { | |
| 8137 | + floating: floatRect | |
| 8138 | + }, | |
| 8139 | + elements: { | |
| 8140 | + floating | |
| 8141 | + }, | |
| 8142 | + platform: platform3, | |
| 8143 | + strategy, | |
| 8144 | + placement | |
| 8145 | + } = state; | |
| 8146 | + const win = getWindow(floating); | |
| 8147 | + const styles = win.getComputedStyle(floating); | |
| 8148 | + const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; | |
| 8149 | + if (!hasTransition) { | |
| 8150 | + return { | |
| 8151 | + x: rawX, | |
| 8152 | + y: rawY, | |
| 8153 | + data: DEFAULT_SIDES | |
| 8154 | + }; | |
| 8155 | + } | |
| 8156 | + const offsetParent = await platform3.getOffsetParent?.(floating); | |
| 8157 | + let offsetDimensions = { | |
| 8158 | + width: 0, | |
| 8159 | + height: 0 | |
| 8160 | + }; | |
| 8161 | + if (strategy === "fixed" && win?.visualViewport) { | |
| 8162 | + offsetDimensions = { | |
| 8163 | + width: win.visualViewport.width, | |
| 8164 | + height: win.visualViewport.height | |
| 8165 | + }; | |
| 8166 | + } else if (offsetParent === win) { | |
| 8167 | + const doc = ownerDocument(floating); | |
| 8168 | + offsetDimensions = { | |
| 8169 | + width: doc.documentElement.clientWidth, | |
| 8170 | + height: doc.documentElement.clientHeight | |
| 8171 | + }; | |
| 8172 | + } else if (await platform3.isElement?.(offsetParent)) { | |
| 8173 | + offsetDimensions = await platform3.getDimensions(offsetParent); | |
| 8174 | + } | |
| 8175 | + const currentSide = getSide(placement); | |
| 8176 | + let x = rawX; | |
| 8177 | + let y = rawY; | |
| 8178 | + if (currentSide === "left") { | |
| 8179 | + x = offsetDimensions.width - (rawX + floatRect.width); | |
| 8180 | + } | |
| 8181 | + if (currentSide === "top") { | |
| 8182 | + y = offsetDimensions.height - (rawY + floatRect.height); | |
| 8183 | + } | |
| 8184 | + const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; | |
| 8185 | + const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; | |
| 8186 | + return { | |
| 8187 | + x, | |
| 8188 | + y, | |
| 8189 | + data: { | |
| 8190 | + sideX, | |
| 8191 | + sideY | |
| 8192 | + } | |
| 8193 | + }; | |
| 8194 | + } | |
| 8195 | + }; | |
| 8196 | + | |
| 8197 | + // node_modules/@base-ui/react/utils/CommonViewportDataAttributes.mjs | |
| 8198 | + var activationDirection = "data-activation-direction"; | |
| 8199 | + | |
| 8200 | + // node_modules/@base-ui/react/utils/usePopupViewport.mjs | |
| 8201 | + var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); | |
| 8202 | + var popupViewportStateMapping = { | |
| 8203 | + activationDirection: (value) => value ? { | |
| 8204 | + [activationDirection]: value | |
| 8205 | + } : null | |
| 8206 | + }; | |
| 8207 | + function usePopupViewport(parameters) { | |
| 8208 | + const { | |
| 8209 | + store: store2, | |
| 8210 | + side, | |
| 8211 | + children | |
| 8212 | + } = parameters; | |
| 8213 | + const direction = useDirection(); | |
| 8214 | + const activeTrigger = store2.useState("activeTriggerElement"); | |
| 8215 | + const activeTriggerId = store2.useState("activeTriggerId"); | |
| 8216 | + const open2 = store2.useState("open"); | |
| 8217 | + const payload = store2.useState("payload"); | |
| 8218 | + const mounted = store2.useState("mounted"); | |
| 8219 | + const popupElement = store2.useState("popupElement"); | |
| 8220 | + const positionerElement = store2.useState("positionerElement"); | |
| 8221 | + const previousActiveTrigger = usePreviousValue(open2 ? activeTrigger : null); | |
| 8222 | + const currentContentKey = usePopupContentKey(activeTriggerId, payload); | |
| 8223 | + const capturedNodeRef = React33.useRef(null); | |
| 8224 | + const [previousContentNode, setPreviousContentNode] = React33.useState(null); | |
| 8225 | + const [newTriggerOffset, setNewTriggerOffset] = React33.useState(null); | |
| 8226 | + const currentContainerRef = React33.useRef(null); | |
| 8227 | + const previousContainerRef = React33.useRef(null); | |
| 8228 | + const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true); | |
| 8229 | + const cleanupFrame = useAnimationFrame(); | |
| 8230 | + const cleanupControllerRef = React33.useRef(null); | |
| 8231 | + const [previousContentDimensions, setPreviousContentDimensions] = React33.useState(null); | |
| 8232 | + const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React33.useState(false); | |
| 8233 | + useIsoLayoutEffect(() => { | |
| 8234 | + store2.set("adaptiveOrigin", adaptiveOrigin); | |
| 8235 | + return () => { | |
| 8236 | + store2.set("adaptiveOrigin", void 0); | |
| 8237 | + }; | |
| 8238 | + }, [store2]); | |
| 8239 | + const handleMeasureLayout = useStableCallback(() => { | |
| 8240 | + currentContainerRef.current?.style.setProperty("animation", "none"); | |
| 8241 | + currentContainerRef.current?.style.setProperty("transition", "none"); | |
| 8242 | + previousContainerRef.current?.style.setProperty("display", "none"); | |
| 8243 | + }); | |
| 8244 | + const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { | |
| 8245 | + currentContainerRef.current?.style.removeProperty("animation"); | |
| 8246 | + currentContainerRef.current?.style.removeProperty("transition"); | |
| 8247 | + previousContainerRef.current?.style.removeProperty("display"); | |
| 8248 | + if (previousDimensions) { | |
| 8249 | + setPreviousContentDimensions(previousDimensions); | |
| 8250 | + } | |
| 8251 | + }); | |
| 8252 | + const armViewportCleanup = useStableCallback(() => { | |
| 8253 | + cleanupControllerRef.current?.abort(); | |
| 8254 | + const controller = new AbortController(); | |
| 8255 | + cleanupControllerRef.current = controller; | |
| 8256 | + onAnimationsFinished(() => { | |
| 8257 | + setPreviousContentNode(null); | |
| 8258 | + setPreviousContentDimensions(null); | |
| 8259 | + capturedNodeRef.current = null; | |
| 8260 | + }, controller.signal); | |
| 8261 | + }); | |
| 8262 | + const lastHandledTriggerRef = React33.useRef(null); | |
| 8263 | + useIsoLayoutEffect(() => { | |
| 8264 | + if (!open2 || !mounted) { | |
| 8265 | + lastHandledTriggerRef.current = null; | |
| 8266 | + } | |
| 8267 | + }, [open2, mounted]); | |
| 8268 | + useIsoLayoutEffect(() => { | |
| 8269 | + if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { | |
| 8270 | + setPreviousContentNode(capturedNodeRef.current); | |
| 8271 | + setShowStartingStyleAttribute(true); | |
| 8272 | + const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); | |
| 8273 | + setNewTriggerOffset(offset4); | |
| 8274 | + lastHandledTriggerRef.current = activeTrigger; | |
| 8275 | + } | |
| 8276 | + }, [activeTrigger, previousActiveTrigger]); | |
| 8277 | + useIsoLayoutEffect(() => { | |
| 8278 | + if (previousContentNode == null) { | |
| 8279 | + return; | |
| 8280 | + } | |
| 8281 | + cleanupControllerRef.current?.abort(); | |
| 8282 | + setShowStartingStyleAttribute(true); | |
| 8283 | + cleanupFrame.request(() => { | |
| 8284 | + ReactDOM6.flushSync(() => { | |
| 8285 | + setShowStartingStyleAttribute(false); | |
| 8286 | + }); | |
| 8287 | + armViewportCleanup(); | |
| 8288 | + }); | |
| 8289 | + }, [currentContentKey, previousContentNode, armViewportCleanup, cleanupFrame]); | |
| 8290 | + useIsoLayoutEffect(() => { | |
| 8291 | + const source = currentContainerRef.current; | |
| 8292 | + if (!source) { | |
| 8293 | + return; | |
| 8294 | + } | |
| 8295 | + const wrapper = ownerDocument(source).createElement("div"); | |
| 8296 | + for (const child of Array.from(source.childNodes)) { | |
| 8297 | + wrapper.appendChild(child.cloneNode(true)); | |
| 8298 | + } | |
| 8299 | + capturedNodeRef.current = wrapper; | |
| 8300 | + }); | |
| 8301 | + const isTransitioning = previousContentNode != null; | |
| 8302 | + let childrenToRender; | |
| 8303 | + if (!isTransitioning) { | |
| 8304 | + childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { | |
| 8305 | + "data-current": true, | |
| 8306 | + ref: currentContainerRef, | |
| 8307 | + children | |
| 8308 | + }, currentContentKey); | |
| 8309 | + } else { | |
| 8310 | + childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React33.Fragment, { | |
| 8311 | + children: [/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { | |
| 8312 | + "data-previous": true, | |
| 8313 | + inert: inertValue(true), | |
| 8314 | + ref: previousContainerRef, | |
| 8315 | + style: { | |
| 8316 | + ...previousContentDimensions ? { | |
| 8317 | + [popupWidth]: `${previousContentDimensions.width}px`, | |
| 8318 | + [popupHeight]: `${previousContentDimensions.height}px` | |
| 8319 | + } : null, | |
| 8320 | + position: "absolute" | |
| 8321 | + }, | |
| 8322 | + "data-ending-style": showStartingStyleAttribute ? void 0 : "" | |
| 8323 | + }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { | |
| 8324 | + "data-current": true, | |
| 8325 | + ref: currentContainerRef, | |
| 8326 | + "data-starting-style": showStartingStyleAttribute ? "" : void 0, | |
| 8327 | + children | |
| 8328 | + }, currentContentKey)] | |
| 8329 | + }); | |
| 8330 | + } | |
| 8331 | + useIsoLayoutEffect(() => { | |
| 8332 | + const container = previousContainerRef.current; | |
| 8333 | + if (!container || !previousContentNode) { | |
| 8334 | + return; | |
| 8335 | + } | |
| 8336 | + container.replaceChildren(...Array.from(previousContentNode.childNodes)); | |
| 8337 | + }, [previousContentNode]); | |
| 8338 | + usePopupAutoResize({ | |
| 8339 | + popupElement, | |
| 8340 | + positionerElement, | |
| 8341 | + mounted, | |
| 8342 | + content: payload, | |
| 8343 | + onMeasureLayout: handleMeasureLayout, | |
| 8344 | + onMeasureLayoutComplete: handleMeasureLayoutComplete, | |
| 8345 | + side, | |
| 8346 | + direction | |
| 8347 | + }); | |
| 8348 | + const state = { | |
| 8349 | + activationDirection: getActivationDirection(newTriggerOffset), | |
| 8350 | + transitioning: isTransitioning | |
| 8351 | + }; | |
| 8352 | + return { | |
| 8353 | + children: childrenToRender, | |
| 8354 | + state | |
| 8355 | + }; | |
| 8356 | + } | |
| 8357 | + function getActivationDirection(offset4) { | |
| 8358 | + if (!offset4) { | |
| 8359 | + return void 0; | |
| 8360 | + } | |
| 8361 | + return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; | |
| 8362 | + } | |
| 8363 | + function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { | |
| 8364 | + if (value > tolerance) { | |
| 8365 | + return positiveLabel; | |
| 8366 | + } | |
| 8367 | + if (value < -tolerance) { | |
| 8368 | + return negativeLabel; | |
| 8369 | + } | |
| 8370 | + return ""; | |
| 8371 | + } | |
| 8372 | + function calculateRelativePosition(from, to) { | |
| 8373 | + const fromRect = from.getBoundingClientRect(); | |
| 8374 | + const toRect = to.getBoundingClientRect(); | |
| 8375 | + const fromCenter = { | |
| 8376 | + x: fromRect.left + fromRect.width / 2, | |
| 8377 | + y: fromRect.top + fromRect.height / 2 | |
| 8378 | + }; | |
| 8379 | + const toCenter = { | |
| 8380 | + x: toRect.left + toRect.width / 2, | |
| 8381 | + y: toRect.top + toRect.height / 2 | |
| 8382 | + }; | |
| 8383 | + return { | |
| 8384 | + horizontal: toCenter.x - fromCenter.x, | |
| 8385 | + vertical: toCenter.y - fromCenter.y | |
| 8386 | + }; | |
| 8387 | + } | |
| 8388 | + function usePopupContentKey(activeTriggerId, payload) { | |
| 8389 | + const [contentKey, setContentKey] = React33.useState(0); | |
| 8390 | + const previousActiveTriggerIdRef = React33.useRef(activeTriggerId); | |
| 8391 | + const previousPayloadRef = React33.useRef(payload); | |
| 8392 | + const pendingPayloadUpdateRef = React33.useRef(false); | |
| 8393 | + useIsoLayoutEffect(() => { | |
| 8394 | + const previousActiveTriggerId = previousActiveTriggerIdRef.current; | |
| 8395 | + const previousPayload = previousPayloadRef.current; | |
| 8396 | + const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; | |
| 8397 | + const payloadChanged = payload !== previousPayload; | |
| 8398 | + if (triggerIdChanged) { | |
| 8399 | + setContentKey((value) => value + 1); | |
| 8400 | + pendingPayloadUpdateRef.current = !payloadChanged; | |
| 8401 | + } else if (pendingPayloadUpdateRef.current && payloadChanged) { | |
| 8402 | + setContentKey((value) => value + 1); | |
| 8403 | + pendingPayloadUpdateRef.current = false; | |
| 8404 | + } | |
| 8405 | + previousActiveTriggerIdRef.current = activeTriggerId; | |
| 8406 | + previousPayloadRef.current = payload; | |
| 8407 | + }, [activeTriggerId, payload]); | |
| 8408 | + return `${activeTriggerId ?? "current"}-${contentKey}`; | |
| 8409 | + } | |
| 8410 | + | |
| 8411 | + // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs | |
| 8412 | + var React34 = __toESM(require_react(), 1); | |
| 8413 | + var ReactDOM7 = __toESM(require_react_dom(), 1); | |
| 8414 | + var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); | |
| 8415 | + var FloatingPortalLite = /* @__PURE__ */ React34.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { | |
| 8416 | + const { | |
| 8417 | + children, | |
| 8418 | + container, | |
| 8419 | + className, | |
| 8420 | + render, | |
| 8421 | + style, | |
| 8422 | + ...elementProps | |
| 8423 | + } = componentProps; | |
| 8424 | + const { | |
| 8425 | + node: portalNode, | |
| 8426 | + subtree: portalSubtree | |
| 8427 | + } = useFloatingPortalNode({ | |
| 8428 | + container, | |
| 8429 | + ref: forwardedRef, | |
| 8430 | + componentProps, | |
| 8431 | + elementProps | |
| 8432 | + }); | |
| 8433 | + if (!portalSubtree && !portalNode) { | |
| 8434 | + return null; | |
| 8435 | + } | |
| 8436 | + return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(React34.Fragment, { | |
| 8437 | + children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)] | |
| 8438 | + }); | |
| 8439 | + }); | |
| 8440 | + if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; | |
| 8441 | + | |
| 8442 | + // node_modules/@base-ui/react/tooltip/index.parts.mjs | |
| 8443 | + var index_parts_exports = {}; | |
| 8444 | + __export(index_parts_exports, { | |
| 8445 | + Arrow: () => TooltipArrow, | |
| 8446 | + Handle: () => TooltipHandle, | |
| 8447 | + Popup: () => TooltipPopup, | |
| 8448 | + Portal: () => TooltipPortal, | |
| 8449 | + Positioner: () => TooltipPositioner, | |
| 8450 | + Provider: () => TooltipProvider, | |
| 8451 | + Root: () => TooltipRoot, | |
| 8452 | + Trigger: () => TooltipTrigger, | |
| 8453 | + Viewport: () => TooltipViewport, | |
| 8454 | + createHandle: () => createTooltipHandle | |
| 8455 | + }); | |
| 8456 | + | |
| 8457 | + // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs | |
| 8458 | + var React37 = __toESM(require_react(), 1); | |
| 8459 | + | |
| 8460 | + // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs | |
| 8461 | + var React35 = __toESM(require_react(), 1); | |
| 8462 | + var TooltipRootContext = /* @__PURE__ */ React35.createContext(void 0); | |
| 8463 | + if (true) TooltipRootContext.displayName = "TooltipRootContext"; | |
| 8464 | + function useTooltipRootContext(optional) { | |
| 8465 | + const context = React35.useContext(TooltipRootContext); | |
| 8466 | + if (context === void 0 && !optional) { | |
| 8467 | + throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); | |
| 8468 | + } | |
| 8469 | + return context; | |
| 8470 | + } | |
| 8471 | + | |
| 8472 | + // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs | |
| 8473 | + var React36 = __toESM(require_react(), 1); | |
| 8474 | + var selectors2 = { | |
| 8475 | + ...popupStoreSelectors, | |
| 8476 | + disabled: (state) => state.disabled, | |
| 8477 | + instantType: (state) => state.instantType, | |
| 8478 | + isInstantPhase: (state) => state.isInstantPhase, | |
| 8479 | + trackCursorAxis: (state) => state.trackCursorAxis, | |
| 8480 | + disableHoverablePopup: (state) => state.disableHoverablePopup, | |
| 8481 | + lastOpenChangeReason: (state) => state.openChangeReason, | |
| 8482 | + closeOnClick: (state) => state.closeOnClick, | |
| 8483 | + closeDelay: (state) => state.closeDelay, | |
| 8484 | + adaptiveOrigin: (state) => state.adaptiveOrigin | |
| 8485 | + }; | |
| 8486 | + var TooltipStore = class extends ReactStore { | |
| 8487 | + constructor(initialState, floatingId, nested) { | |
| 8488 | + const triggerElements = new PopupTriggerMap(); | |
| 8489 | + super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors2); | |
| 8490 | + } | |
| 8491 | + setOpen = (nextOpen, eventDetails) => { | |
| 8492 | + applyPopupOpenChange(this, nextOpen, eventDetails, { | |
| 8493 | + extraState: { | |
| 8494 | + openChangeReason: eventDetails.reason | |
| 8495 | + } | |
| 8496 | + }); | |
| 8497 | + }; | |
| 8498 | + // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. | |
| 8499 | + cancelPendingOpen(event) { | |
| 8500 | + this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); | |
| 8501 | + } | |
| 8502 | + }; | |
| 8503 | + function createNullTooltipStore() { | |
| 8504 | + const triggerElements = new PopupTriggerMap(); | |
| 8505 | + const store2 = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors2); | |
| 8506 | + return Object.assign(store2, { | |
| 8507 | + setOpen: NOOP, | |
| 8508 | + cancelPendingOpen: NOOP | |
| 8509 | + }); | |
| 8510 | + } | |
| 8511 | + function createInitialState(initialState, triggerElements, floatingId, nested = false) { | |
| 8512 | + const state = { | |
| 8513 | + ...createInitialPopupStoreState(triggerElements, floatingId, nested), | |
| 8514 | + disabled: false, | |
| 8515 | + instantType: void 0, | |
| 8516 | + isInstantPhase: false, | |
| 8517 | + trackCursorAxis: "none", | |
| 8518 | + disableHoverablePopup: false, | |
| 8519 | + openChangeReason: null, | |
| 8520 | + closeOnClick: true, | |
| 8521 | + closeDelay: 0, | |
| 8522 | + adaptiveOrigin: void 0, | |
| 8523 | + ...initialState | |
| 8524 | + }; | |
| 8525 | + return state; | |
| 8526 | + } | |
| 8527 | + function createInitialContext(triggerElements) { | |
| 8528 | + return { | |
| 8529 | + popupRef: /* @__PURE__ */ React36.createRef(), | |
| 8530 | + onOpenChange: void 0, | |
| 8531 | + onOpenChangeComplete: void 0, | |
| 8532 | + triggerElements | |
| 8533 | + }; | |
| 8534 | + } | |
| 8535 | + | |
| 8536 | + // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs | |
| 8537 | + var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); | |
| 8538 | + var TooltipRoot = fastComponent(function TooltipRoot2(props) { | |
| 8539 | + const { | |
| 8540 | + disabled: disabled2 = false, | |
| 8541 | + defaultOpen = false, | |
| 8542 | + open: openProp, | |
| 8543 | + disableHoverablePopup = false, | |
| 8544 | + trackCursorAxis = "none", | |
| 8545 | + actionsRef, | |
| 8546 | + onOpenChange, | |
| 8547 | + onOpenChangeComplete, | |
| 8548 | + handle, | |
| 8549 | + triggerId: triggerIdProp, | |
| 8550 | + defaultTriggerId: defaultTriggerIdProp = null, | |
| 8551 | + children | |
| 8552 | + } = props; | |
| 8553 | + const store2 = usePopupRootStore((floatingId, nested) => new TooltipStore({ | |
| 8554 | + open: defaultOpen, | |
| 8555 | + openProp, | |
| 8556 | + activeTriggerId: defaultTriggerIdProp, | |
| 8557 | + triggerIdProp | |
| 8558 | + }, floatingId, nested)); | |
| 8559 | + store2.useControlledProp("openProp", openProp); | |
| 8560 | + store2.useControlledProp("triggerIdProp", triggerIdProp); | |
| 8561 | + store2.useContextCallback("onOpenChange", onOpenChange); | |
| 8562 | + store2.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); | |
| 8563 | + const openState = store2.useState("open"); | |
| 8564 | + const open2 = !disabled2 && openState; | |
| 8565 | + const activeTriggerId = store2.useState("activeTriggerId"); | |
| 8566 | + const mounted = store2.useState("mounted"); | |
| 8567 | + const payload = store2.useState("payload"); | |
| 8568 | + store2.useSyncedValues({ | |
| 8569 | + trackCursorAxis, | |
| 8570 | + disableHoverablePopup, | |
| 8571 | + disabled: disabled2 | |
| 8572 | + }); | |
| 8573 | + useImplicitActiveTrigger(store2, { | |
| 8574 | + closeOnActiveTriggerUnmount: true | |
| 8575 | + }); | |
| 8576 | + const { | |
| 8577 | + forceUnmount, | |
| 8578 | + transitionStatus | |
| 8579 | + } = useOpenStateTransitions(open2, store2); | |
| 8580 | + const isInstantPhase = store2.useState("isInstantPhase"); | |
| 8581 | + const instantType = store2.useState("instantType"); | |
| 8582 | + const lastOpenChangeReason = store2.useState("lastOpenChangeReason"); | |
| 8583 | + const previousInstantTypeRef = React37.useRef(null); | |
| 8584 | + useIsoLayoutEffect(() => { | |
| 8585 | + if (openState && disabled2) { | |
| 8586 | + store2.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); | |
| 8587 | + } | |
| 8588 | + }, [openState, disabled2, store2]); | |
| 8589 | + useIsoLayoutEffect(() => { | |
| 8590 | + if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { | |
| 8591 | + if (instantType !== "delay") { | |
| 8592 | + previousInstantTypeRef.current = instantType; | |
| 8593 | + } | |
| 8594 | + store2.set("instantType", "delay"); | |
| 8595 | + } else if (previousInstantTypeRef.current !== null) { | |
| 8596 | + store2.set("instantType", previousInstantTypeRef.current); | |
| 8597 | + previousInstantTypeRef.current = null; | |
| 8598 | + } | |
| 8599 | + }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store2]); | |
| 8600 | + useIsoLayoutEffect(() => { | |
| 8601 | + if (open2) { | |
| 8602 | + if (activeTriggerId == null) { | |
| 8603 | + store2.set("payload", void 0); | |
| 8604 | + } | |
| 8605 | + } | |
| 8606 | + }, [store2, activeTriggerId, open2]); | |
| 8607 | + React37.useImperativeHandle(actionsRef, () => ({ | |
| 8608 | + unmount: forceUnmount, | |
| 8609 | + close: () => store2.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)) | |
| 8610 | + }), [forceUnmount, store2]); | |
| 8611 | + const shouldRenderInteractions = open2 || mounted || !disabled2 && trackCursorAxis !== "none"; | |
| 8612 | + return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(TooltipRootContext.Provider, { | |
| 8613 | + value: store2, | |
| 8614 | + children: [handle && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PopupHandleAttachment, { | |
| 8615 | + handle, | |
| 8616 | + store: store2 | |
| 8617 | + }), shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipInteractions, { | |
| 8618 | + store: store2, | |
| 8619 | + disabled: disabled2, | |
| 8620 | + trackCursorAxis | |
| 8621 | + }), typeof children === "function" ? children({ | |
| 8622 | + payload | |
| 8623 | + }) : children] | |
| 8624 | + }); | |
| 8625 | + }); | |
| 8626 | + if (true) TooltipRoot.displayName = "TooltipRoot"; | |
| 8627 | + function TooltipInteractions({ | |
| 8628 | + store: store2, | |
| 8629 | + disabled: disabled2, | |
| 8630 | + trackCursorAxis | |
| 8631 | + }) { | |
| 8632 | + const floatingRootContext = store2.useState("floatingRootContext"); | |
| 8633 | + const dismiss = useDismiss(floatingRootContext, { | |
| 8634 | + enabled: !disabled2, | |
| 8635 | + referencePress: () => store2.select("closeOnClick") | |
| 8636 | + }); | |
| 8637 | + const clientPoint = useClientPoint(floatingRootContext, { | |
| 8638 | + enabled: !disabled2 && trackCursorAxis !== "none", | |
| 8639 | + axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis | |
| 8640 | + }); | |
| 8641 | + const triggerProps = React37.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); | |
| 8642 | + usePopupInteractionProps(store2, { | |
| 8643 | + activeTriggerProps: triggerProps, | |
| 8644 | + inactiveTriggerProps: triggerProps, | |
| 8645 | + popupProps: dismiss.floating ?? EMPTY_OBJECT | |
| 8646 | + }); | |
| 8647 | + return null; | |
| 8648 | + } | |
| 8649 | + | |
| 8650 | + // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs | |
| 8651 | + var React39 = __toESM(require_react(), 1); | |
| 8652 | + | |
| 8653 | + // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs | |
| 8654 | + var React38 = __toESM(require_react(), 1); | |
| 8655 | + var TooltipProviderContext = /* @__PURE__ */ React38.createContext(void 0); | |
| 8656 | + if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; | |
| 8657 | + function useTooltipProviderContext() { | |
| 8658 | + return React38.useContext(TooltipProviderContext); | |
| 8659 | + } | |
| 8660 | + | |
| 8661 | + // node_modules/@base-ui/react/tooltip/utils/constants.mjs | |
| 8662 | + var OPEN_DELAY = 600; | |
| 8663 | + | |
| 8664 | + // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs | |
| 8665 | + var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; | |
| 8666 | + function getTargetElement(event) { | |
| 8667 | + if ("composedPath" in event) { | |
| 8668 | + const path = event.composedPath(); | |
| 8669 | + for (let i = 0; i < path.length; i += 1) { | |
| 8670 | + const element = path[i]; | |
| 8671 | + if (isElement(element)) { | |
| 8672 | + return element; | |
| 8673 | + } | |
| 8674 | + } | |
| 8675 | + } | |
| 8676 | + const target = event.target; | |
| 8677 | + if (isElement(target)) { | |
| 8678 | + return target; | |
| 8679 | + } | |
| 8680 | + return null; | |
| 8681 | + } | |
| 8682 | + function closestEnabledTooltipTrigger(element) { | |
| 8683 | + let current = element; | |
| 8684 | + while (current) { | |
| 8685 | + const trigger = current.closest(`[${TOOLTIP_TRIGGER_IDENTIFIER}]`); | |
| 8686 | + if (trigger) { | |
| 8687 | + return trigger; | |
| 8688 | + } | |
| 8689 | + const root = current.getRootNode(); | |
| 8690 | + current = "host" in root && isElement(root.host) ? root.host : null; | |
| 8691 | + } | |
| 8692 | + return null; | |
| 8693 | + } | |
| 8694 | + var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { | |
| 8695 | + const { | |
| 8696 | + render, | |
| 8697 | + className, | |
| 8698 | + style, | |
| 8699 | + handle, | |
| 8700 | + payload, | |
| 8701 | + disabled: disabledProp, | |
| 8702 | + delay, | |
| 8703 | + closeOnClick = true, | |
| 8704 | + closeDelay, | |
| 8705 | + id: idProp, | |
| 8706 | + ...elementProps | |
| 8707 | + } = componentProps; | |
| 8708 | + const rootContext = useTooltipRootContext(true); | |
| 8709 | + const handleStore = usePopupHandleStore(handle); | |
| 8710 | + const store2 = handleStore ?? rootContext; | |
| 8711 | + if (!store2) { | |
| 8712 | + 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)); | |
| 8713 | + } | |
| 8714 | + const thisTriggerId = useBaseUiId(idProp); | |
| 8715 | + const isTriggerActive = store2.useState("isTriggerActive", thisTriggerId); | |
| 8716 | + const isOpenedByThisTrigger = store2.useState("isOpenedByTrigger", thisTriggerId); | |
| 8717 | + const floatingRootContext = store2.useState("floatingRootContext"); | |
| 8718 | + const triggerElementRef = React39.useRef(null); | |
| 8719 | + const closeDelayWithDefault = closeDelay ?? 0; | |
| 8720 | + const { | |
| 8721 | + registerTrigger, | |
| 8722 | + isMountedByThisTrigger | |
| 8723 | + } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store2, { | |
| 8724 | + payload, | |
| 8725 | + closeOnClick, | |
| 8726 | + closeDelay: closeDelayWithDefault | |
| 8727 | + }); | |
| 8728 | + const providerDelay = useTooltipProviderContext(); | |
| 8729 | + const { | |
| 8730 | + activeIdRef, | |
| 8731 | + delayRef, | |
| 8732 | + isInstantPhase, | |
| 8733 | + hasProvider | |
| 8734 | + } = useDelayGroup(floatingRootContext, { | |
| 8735 | + open: isOpenedByThisTrigger | |
| 8736 | + }); | |
| 8737 | + const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); | |
| 8738 | + store2.useSyncedValue("isInstantPhase", isInstantPhase); | |
| 8739 | + const rootDisabled = store2.useState("disabled"); | |
| 8740 | + const disabled2 = disabledProp ?? rootDisabled; | |
| 8741 | + const disabledRef = useValueAsRef(disabled2); | |
| 8742 | + const trackCursorAxis = store2.useState("trackCursorAxis"); | |
| 8743 | + const disableHoverablePopup = store2.useState("disableHoverablePopup"); | |
| 8744 | + const isNestedTriggerHoveredRef = React39.useRef(false); | |
| 8745 | + const nestedTriggerOpenTimeout = useTimeout(); | |
| 8746 | + const pointerTypeRef = React39.useRef(void 0); | |
| 8747 | + function getOpenDelay() { | |
| 8748 | + if (hasProvider && activeIdRef.current != null) { | |
| 8749 | + return 0; | |
| 8750 | + } | |
| 8751 | + return delay ?? providerDelay ?? OPEN_DELAY; | |
| 8752 | + } | |
| 8753 | + function isEnabledNestedTriggerTarget(target) { | |
| 8754 | + const triggerEl = triggerElementRef.current; | |
| 8755 | + if (!triggerEl || !target) { | |
| 8756 | + return false; | |
| 8757 | + } | |
| 8758 | + const nearestTrigger = closestEnabledTooltipTrigger(target); | |
| 8759 | + return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); | |
| 8760 | + } | |
| 8761 | + function detectNestedTriggerHover(target) { | |
| 8762 | + const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); | |
| 8763 | + isNestedTriggerHoveredRef.current = nestedTriggerHovered; | |
| 8764 | + if (nestedTriggerHovered) { | |
| 8765 | + hoverInteraction.openChangeTimeout.clear(); | |
| 8766 | + hoverInteraction.restTimeout.clear(); | |
| 8767 | + hoverInteraction.restTimeoutPending = false; | |
| 8768 | + nestedTriggerOpenTimeout.clear(); | |
| 8769 | + } | |
| 8770 | + return nestedTriggerHovered; | |
| 8771 | + } | |
| 8772 | + const hoverProps = useHoverReferenceInteraction(floatingRootContext, { | |
| 8773 | + enabled: !disabled2, | |
| 8774 | + mouseOnly: true, | |
| 8775 | + move: false, | |
| 8776 | + handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, | |
| 8777 | + restMs: getOpenDelay, | |
| 8778 | + delay() { | |
| 8779 | + if (closeDelay == null && hasProvider) { | |
| 8780 | + return { | |
| 8781 | + close: getDelay(delayRef.current, "close") | |
| 8782 | + }; | |
| 8783 | + } | |
| 8784 | + return { | |
| 8785 | + close: closeDelayWithDefault | |
| 8786 | + }; | |
| 8787 | + }, | |
| 8788 | + triggerElementRef, | |
| 8789 | + isActiveTrigger: isTriggerActive, | |
| 8790 | + isClosing: () => store2.select("transitionStatus") === "ending", | |
| 8791 | + shouldOpen() { | |
| 8792 | + return !isNestedTriggerHoveredRef.current; | |
| 8793 | + } | |
| 8794 | + }); | |
| 8795 | + const focusProps = useFocus(floatingRootContext, { | |
| 8796 | + enabled: !disabled2 | |
| 8797 | + }).reference; | |
| 8798 | + const handleNestedTriggerHover = (event) => { | |
| 8799 | + const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; | |
| 8800 | + const target = getTargetElement(event); | |
| 8801 | + const nestedTriggerHovered = detectNestedTriggerHover(target); | |
| 8802 | + const triggerEl = triggerElementRef.current; | |
| 8803 | + const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); | |
| 8804 | + if (nestedTriggerHovered && store2.select("open") && store2.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { | |
| 8805 | + store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 8806 | + return; | |
| 8807 | + } | |
| 8808 | + if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store2.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. | |
| 8809 | + isMouseLikePointerType(pointerTypeRef.current)) { | |
| 8810 | + const open2 = () => { | |
| 8811 | + if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store2.select("open")) { | |
| 8812 | + store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); | |
| 8813 | + } | |
| 8814 | + }; | |
| 8815 | + const openDelay = getOpenDelay(); | |
| 8816 | + if (openDelay === 0) { | |
| 8817 | + nestedTriggerOpenTimeout.clear(); | |
| 8818 | + open2(); | |
| 8819 | + } else { | |
| 8820 | + nestedTriggerOpenTimeout.start(openDelay, open2); | |
| 8821 | + } | |
| 8822 | + } | |
| 8823 | + }; | |
| 8824 | + const rootTriggerProps = store2.useState("triggerProps", isMountedByThisTrigger); | |
| 8825 | + const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; | |
| 8826 | + const state = { | |
| 8827 | + open: isOpenedByThisTrigger | |
| 8828 | + }; | |
| 8829 | + const element = useRenderElement("button", componentProps, { | |
| 8830 | + state, | |
| 8831 | + ref: [forwardedRef, registerTrigger, triggerElementRef], | |
| 8832 | + props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { | |
| 8833 | + onMouseOver(event) { | |
| 8834 | + handleNestedTriggerHover(event.nativeEvent); | |
| 8835 | + }, | |
| 8836 | + onFocus(event) { | |
| 8837 | + if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { | |
| 8838 | + event.preventBaseUIHandler(); | |
| 8839 | + } | |
| 8840 | + }, | |
| 8841 | + onMouseLeave() { | |
| 8842 | + isNestedTriggerHoveredRef.current = false; | |
| 8843 | + nestedTriggerOpenTimeout.clear(); | |
| 8844 | + pointerTypeRef.current = void 0; | |
| 8845 | + }, | |
| 8846 | + onPointerEnter(event) { | |
| 8847 | + pointerTypeRef.current = event.pointerType; | |
| 8848 | + }, | |
| 8849 | + onPointerDown(event) { | |
| 8850 | + pointerTypeRef.current = event.pointerType; | |
| 8851 | + store2.set("closeOnClick", closeOnClick); | |
| 8852 | + if (closeOnClick && !store2.select("open")) { | |
| 8853 | + store2.cancelPendingOpen(event.nativeEvent); | |
| 8854 | + } | |
| 8855 | + }, | |
| 8856 | + onClick(event) { | |
| 8857 | + if (closeOnClick && !store2.select("open")) { | |
| 8858 | + store2.cancelPendingOpen(event.nativeEvent); | |
| 8859 | + } | |
| 8860 | + }, | |
| 8861 | + id: thisTriggerId, | |
| 8862 | + [triggerDisabled]: disabled2 ? "" : void 0, | |
| 8863 | + [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" | |
| 8864 | + }, elementProps], | |
| 8865 | + stateAttributesMapping: triggerOpenStateMapping | |
| 8866 | + }); | |
| 8867 | + return element; | |
| 8868 | + }); | |
| 8869 | + if (true) TooltipTrigger.displayName = "TooltipTrigger"; | |
| 8870 | + | |
| 8871 | + // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs | |
| 8872 | + var React41 = __toESM(require_react(), 1); | |
| 8873 | + | |
| 8874 | + // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs | |
| 8875 | + var React40 = __toESM(require_react(), 1); | |
| 8876 | + var TooltipPortalContext = /* @__PURE__ */ React40.createContext(void 0); | |
| 8877 | + if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; | |
| 8878 | + function useTooltipPortalContext() { | |
| 8879 | + const value = React40.useContext(TooltipPortalContext); | |
| 8880 | + if (value === void 0) { | |
| 8881 | + throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); | |
| 8882 | + } | |
| 8883 | + return value; | |
| 8884 | + } | |
| 8885 | + | |
| 8886 | + // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs | |
| 8887 | + var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); | |
| 8888 | + var TooltipPortal = /* @__PURE__ */ React41.forwardRef(function TooltipPortal2(props, forwardedRef) { | |
| 8889 | + const { | |
| 8890 | + keepMounted = false, | |
| 8891 | + ...portalProps | |
| 8892 | + } = props; | |
| 8893 | + const store2 = useTooltipRootContext(); | |
| 8894 | + const mounted = store2.useState("mounted"); | |
| 8895 | + const shouldRender = mounted || keepMounted; | |
| 8896 | + if (!shouldRender) { | |
| 8897 | + return null; | |
| 8898 | + } | |
| 8899 | + return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPortalContext.Provider, { | |
| 8900 | + value: keepMounted, | |
| 8901 | + children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FloatingPortalLite, { | |
| 8902 | + ref: forwardedRef, | |
| 8903 | + ...portalProps | |
| 8904 | + }) | |
| 8905 | + }); | |
| 8906 | + }); | |
| 8907 | + if (true) TooltipPortal.displayName = "TooltipPortal"; | |
| 8908 | + | |
| 8909 | + // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs | |
| 8910 | + var React43 = __toESM(require_react(), 1); | |
| 8911 | + | |
| 8912 | + // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs | |
| 8913 | + var React42 = __toESM(require_react(), 1); | |
| 8914 | + var TooltipPositionerContext = /* @__PURE__ */ React42.createContext(void 0); | |
| 8915 | + if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; | |
| 8916 | + function useTooltipPositionerContext() { | |
| 8917 | + const context = React42.useContext(TooltipPositionerContext); | |
| 8918 | + if (context === void 0) { | |
| 8919 | + throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); | |
| 8920 | + } | |
| 8921 | + return context; | |
| 8922 | + } | |
| 8923 | + | |
| 8924 | + // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs | |
| 8925 | + var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); | |
| 8926 | + var TooltipPositioner = /* @__PURE__ */ React43.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { | |
| 8927 | + const { | |
| 8928 | + render, | |
| 8929 | + className, | |
| 8930 | + anchor, | |
| 8931 | + positionMethod = "absolute", | |
| 8932 | + side = "top", | |
| 8933 | + align = "center", | |
| 8934 | + sideOffset = 0, | |
| 8935 | + alignOffset = 0, | |
| 8936 | + collisionBoundary = "clipping-ancestors", | |
| 8937 | + collisionPadding = 5, | |
| 8938 | + arrowPadding = 5, | |
| 8939 | + sticky = false, | |
| 8940 | + disableAnchorTracking = false, | |
| 8941 | + collisionAvoidance = POPUP_COLLISION_AVOIDANCE, | |
| 8942 | + style, | |
| 8943 | + ...elementProps | |
| 8944 | + } = componentProps; | |
| 8945 | + const store2 = useTooltipRootContext(); | |
| 8946 | + const keepMounted = useTooltipPortalContext(); | |
| 8947 | + const open2 = store2.useState("open"); | |
| 8948 | + const mounted = store2.useState("mounted"); | |
| 8949 | + const trackCursorAxis = store2.useState("trackCursorAxis"); | |
| 8950 | + const disableHoverablePopup = store2.useState("disableHoverablePopup"); | |
| 8951 | + const floatingRootContext = store2.useState("floatingRootContext"); | |
| 8952 | + const instantType = store2.useState("instantType"); | |
| 8953 | + const transitionStatus = store2.useState("transitionStatus"); | |
| 8954 | + const adaptiveOrigin2 = store2.useState("adaptiveOrigin"); | |
| 8955 | + const positioning = useAnchorPositioning({ | |
| 8956 | + anchor, | |
| 8957 | + positionMethod, | |
| 8958 | + floatingRootContext, | |
| 8959 | + mounted, | |
| 8960 | + side, | |
| 8961 | + sideOffset, | |
| 8962 | + align, | |
| 8963 | + alignOffset, | |
| 8964 | + collisionBoundary, | |
| 8965 | + collisionPadding, | |
| 8966 | + sticky, | |
| 8967 | + arrowPadding, | |
| 8968 | + disableAnchorTracking, | |
| 8969 | + keepMounted, | |
| 8970 | + collisionAvoidance, | |
| 8971 | + adaptiveOrigin: adaptiveOrigin2 | |
| 8972 | + }); | |
| 8973 | + const state = React43.useMemo(() => ({ | |
| 8974 | + open: open2, | |
| 8975 | + side: positioning.side, | |
| 8976 | + align: positioning.align, | |
| 8977 | + anchorHidden: positioning.anchorHidden, | |
| 8978 | + instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType | |
| 8979 | + }), [open2, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); | |
| 8980 | + const element = usePositioner(componentProps, state, { | |
| 8981 | + styles: positioning.positionerStyles, | |
| 8982 | + transitionStatus, | |
| 8983 | + props: elementProps, | |
| 8984 | + refs: [forwardedRef, store2.useStateSetter("positionerElement")], | |
| 8985 | + hidden: !mounted, | |
| 8986 | + inert: !open2 || trackCursorAxis === "both" || disableHoverablePopup | |
| 8987 | + }); | |
| 8988 | + return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipPositionerContext.Provider, { | |
| 8989 | + value: positioning, | |
| 8990 | + children: element | |
| 8991 | + }); | |
| 8992 | + }); | |
| 8993 | + if (true) TooltipPositioner.displayName = "TooltipPositioner"; | |
| 8994 | + | |
| 8995 | + // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs | |
| 8996 | + var React44 = __toESM(require_react(), 1); | |
| 8997 | + var TooltipPopup = /* @__PURE__ */ React44.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { | |
| 8998 | + const { | |
| 8999 | + render, | |
| 9000 | + className, | |
| 9001 | + style, | |
| 9002 | + ...elementProps | |
| 9003 | + } = componentProps; | |
| 9004 | + const store2 = useTooltipRootContext(); | |
| 9005 | + const { | |
| 9006 | + side, | |
| 9007 | + align | |
| 9008 | + } = useTooltipPositionerContext(); | |
| 9009 | + const open2 = store2.useState("open"); | |
| 9010 | + const instantType = store2.useState("instantType"); | |
| 9011 | + const transitionStatus = store2.useState("transitionStatus"); | |
| 9012 | + const popupProps = store2.useState("popupProps"); | |
| 9013 | + const floatingContext = store2.useState("floatingRootContext"); | |
| 9014 | + const disabled2 = store2.useState("disabled"); | |
| 9015 | + const closeDelay = store2.useState("closeDelay"); | |
| 9016 | + useOpenChangeComplete({ | |
| 9017 | + open: open2, | |
| 9018 | + ref: store2.context.popupRef, | |
| 9019 | + onComplete() { | |
| 9020 | + if (open2) { | |
| 9021 | + store2.context.onOpenChangeComplete?.(true); | |
| 9022 | + } | |
| 9023 | + } | |
| 9024 | + }); | |
| 9025 | + useHoverFloatingInteraction(floatingContext, { | |
| 9026 | + enabled: !disabled2, | |
| 9027 | + closeDelay | |
| 9028 | + }); | |
| 9029 | + const setPopupElement = store2.useStateSetter("popupElement"); | |
| 9030 | + const state = { | |
| 9031 | + open: open2, | |
| 9032 | + side, | |
| 9033 | + align, | |
| 9034 | + instant: instantType, | |
| 9035 | + transitionStatus | |
| 9036 | + }; | |
| 9037 | + const element = useRenderElement("div", componentProps, { | |
| 9038 | + state, | |
| 9039 | + ref: [forwardedRef, store2.context.popupRef, setPopupElement], | |
| 9040 | + props: [FOCUSABLE_POPUP_PROPS, popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], | |
| 9041 | + stateAttributesMapping: popupTransitionStateMapping | |
| 9042 | + }); | |
| 9043 | + return element; | |
| 9044 | + }); | |
| 9045 | + if (true) TooltipPopup.displayName = "TooltipPopup"; | |
| 9046 | + | |
| 9047 | + // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs | |
| 9048 | + var React45 = __toESM(require_react(), 1); | |
| 9049 | + var TooltipArrow = /* @__PURE__ */ React45.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { | |
| 9050 | + const { | |
| 9051 | + render, | |
| 9052 | + className, | |
| 9053 | + style, | |
| 9054 | + ...elementProps | |
| 9055 | + } = componentProps; | |
| 9056 | + const store2 = useTooltipRootContext(); | |
| 9057 | + const { | |
| 9058 | + arrowRef, | |
| 9059 | + side, | |
| 9060 | + align, | |
| 9061 | + arrowUncentered, | |
| 9062 | + arrowStyles | |
| 9063 | + } = useTooltipPositionerContext(); | |
| 9064 | + const open2 = store2.useState("open"); | |
| 9065 | + const instantType = store2.useState("instantType"); | |
| 9066 | + const state = { | |
| 9067 | + open: open2, | |
| 9068 | + side, | |
| 9069 | + align, | |
| 9070 | + uncentered: arrowUncentered, | |
| 9071 | + instant: instantType | |
| 9072 | + }; | |
| 9073 | + const element = useRenderElement("div", componentProps, { | |
| 9074 | + state, | |
| 9075 | + ref: [forwardedRef, arrowRef], | |
| 9076 | + props: [{ | |
| 9077 | + style: arrowStyles, | |
| 9078 | + "aria-hidden": true | |
| 9079 | + }, elementProps], | |
| 9080 | + stateAttributesMapping: popupStateMapping | |
| 9081 | + }); | |
| 9082 | + return element; | |
| 9083 | + }); | |
| 9084 | + if (true) TooltipArrow.displayName = "TooltipArrow"; | |
| 9085 | + | |
| 9086 | + // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs | |
| 9087 | + var React46 = __toESM(require_react(), 1); | |
| 9088 | + var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); | |
| 9089 | + var TooltipProvider = function TooltipProvider2(props) { | |
| 9090 | + const { | |
| 9091 | + delay, | |
| 9092 | + closeDelay, | |
| 9093 | + timeout = 400 | |
| 9094 | + } = props; | |
| 9095 | + const delayValue = React46.useMemo(() => ({ | |
| 9096 | + open: delay, | |
| 9097 | + close: closeDelay | |
| 9098 | + }), [delay, closeDelay]); | |
| 9099 | + return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipProviderContext.Provider, { | |
| 9100 | + value: delay, | |
| 9101 | + children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FloatingDelayGroup, { | |
| 9102 | + delay: delayValue, | |
| 9103 | + timeoutMs: timeout, | |
| 9104 | + children: props.children | |
| 9105 | + }) | |
| 9106 | + }); | |
| 9107 | + }; | |
| 9108 | + if (true) TooltipProvider.displayName = "TooltipProvider"; | |
| 9109 | + | |
| 9110 | + // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs | |
| 9111 | + var React47 = __toESM(require_react(), 1); | |
| 9112 | + var TooltipViewport = /* @__PURE__ */ React47.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { | |
| 9113 | + const { | |
| 9114 | + render, | |
| 9115 | + className, | |
| 9116 | + style, | |
| 9117 | + children, | |
| 9118 | + ...elementProps | |
| 9119 | + } = componentProps; | |
| 9120 | + const store2 = useTooltipRootContext(); | |
| 9121 | + const positioner = useTooltipPositionerContext(); | |
| 9122 | + const instantType = store2.useState("instantType"); | |
| 9123 | + const { | |
| 9124 | + children: childrenToRender, | |
| 9125 | + state: viewportState | |
| 9126 | + } = usePopupViewport({ | |
| 9127 | + store: store2, | |
| 9128 | + side: positioner.side, | |
| 9129 | + children | |
| 9130 | + }); | |
| 9131 | + const state = { | |
| 9132 | + activationDirection: viewportState.activationDirection, | |
| 9133 | + transitioning: viewportState.transitioning, | |
| 9134 | + instant: instantType | |
| 9135 | + }; | |
| 9136 | + return useRenderElement("div", componentProps, { | |
| 9137 | + state, | |
| 9138 | + ref: forwardedRef, | |
| 9139 | + props: [elementProps, { | |
| 9140 | + children: childrenToRender | |
| 9141 | + }], | |
| 9142 | + stateAttributesMapping: popupViewportStateMapping | |
| 9143 | + }); | |
| 9144 | + }); | |
| 9145 | + if (true) TooltipViewport.displayName = "TooltipViewport"; | |
| 9146 | + | |
| 9147 | + // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs | |
| 9148 | + var TooltipHandle = class extends BasePopupHandle { | |
| 9149 | + constructor() { | |
| 9150 | + super(createNullTooltipStore(), "Tooltip"); | |
| 9151 | + } | |
| 9152 | + /** | |
| 9153 | + * Opens the tooltip and associates it with the trigger with the given id. | |
| 9154 | + * | |
| 9155 | + * This method should only be called in an event handler or an effect (not during rendering). | |
| 9156 | + * | |
| 9157 | + * @param triggerId ID of the trigger to associate with the tooltip. The trigger must be a matching | |
| 9158 | + * `Tooltip.Trigger` with this handle passed as a prop. | |
| 9159 | + */ | |
| 9160 | + open(triggerId) { | |
| 9161 | + this.openByTrigger(triggerId); | |
| 9162 | + } | |
| 9163 | + /** | |
| 9164 | + * Closes the tooltip. | |
| 9165 | + * | |
| 9166 | + * This method should only be called in an event handler or an effect (not during rendering). | |
| 9167 | + */ | |
| 9168 | + close() { | |
| 9169 | + this.closePopup(); | |
| 9170 | + } | |
| 9171 | + /** | |
| 9172 | + * Whether the tooltip is currently open. Returns `false` while no root is attached to the handle. | |
| 9173 | + */ | |
| 9174 | + get isOpen() { | |
| 9175 | + return this.attachedStore?.select("open") ?? false; | |
| 9176 | + } | |
| 9177 | + }; | |
| 9178 | + function createTooltipHandle() { | |
| 9179 | + return new TooltipHandle(); | |
| 9180 | + } | |
| 9181 | + | |
| 9182 | + // node_modules/@base-ui/react/use-render/useRender.mjs | |
| 9183 | + function useRender(params) { | |
| 9184 | + return useRenderElement(params.defaultTagName ?? "div", params, params); | |
| 9185 | + } | |
| 9186 | + | |
| 9187 | + // packages/ui/build-module/tooltip/index.mjs | |
| 9188 | + var tooltip_exports = {}; | |
| 9189 | + __export(tooltip_exports, { | |
| 9190 | + Popup: () => Popup, | |
| 9191 | + Portal: () => Portal, | |
| 9192 | + Positioner: () => Positioner, | |
| 9193 | + Provider: () => Provider, | |
| 9194 | + Root: () => Root, | |
| 9195 | + Trigger: () => Trigger | |
| 9196 | + }); | |
| 9197 | + | |
| 9198 | + // packages/ui/build-module/tooltip/popup.mjs | |
| 9199 | + var import_element14 = __toESM(require_element(), 1); | |
| 9200 | + | |
| 9201 | + // packages/ui/build-module/tooltip/portal.mjs | |
| 9202 | + var import_element11 = __toESM(require_element(), 1); | |
| 9203 | + | |
| 9204 | + // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs | |
| 1263 | 9205 | var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; |
| 1264 | 9206 | function getRuntime() { |
| 1265 | 9207 | const globalScope = globalThis; |
| 1266 | 9208 | if (globalScope.__wpStyleRuntime) { |
| @@ -1340,18 +9282,488 @@ | ||
| 1340 | 9282 | injectStyle(targetDocument, hash, css); |
| 1341 | 9283 | } |
| 1342 | 9284 | } |
| 1343 | 9285 | if (typeof process === "undefined" || true) { |
| 1344 | - registerStyle("c46e8cb841", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-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}}"); | |
| 9286 | + 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}}}"); | |
| 1345 | 9287 | } |
| 1346 | - var style_default = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; | |
| 1347 | - var VisuallyHidden = (0, import_element3.forwardRef)( | |
| 9288 | + var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; | |
| 9289 | + var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; | |
| 9290 | + function resolveOwnerDocument() { | |
| 9291 | + return typeof document === "undefined" ? null : document; | |
| 9292 | + } | |
| 9293 | + function isInWordPressEnvironment() { | |
| 9294 | + let topWp; | |
| 9295 | + try { | |
| 9296 | + topWp = window.top?.wp; | |
| 9297 | + } catch { | |
| 9298 | + } | |
| 9299 | + const wp = topWp ?? window.wp; | |
| 9300 | + return typeof wp?.components === "object" && wp.components !== null; | |
| 9301 | + } | |
| 9302 | + var cachedSlot = null; | |
| 9303 | + function ensureSlotIsAccessible(element) { | |
| 9304 | + element.setAttribute("aria-hidden", "false"); | |
| 9305 | + return element; | |
| 9306 | + } | |
| 9307 | + function createSlot(ownerDocument2) { | |
| 9308 | + const element = ownerDocument2.createElement("div"); | |
| 9309 | + element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); | |
| 9310 | + if (wp_compat_overlay_slot_default.slot) { | |
| 9311 | + element.classList.add(wp_compat_overlay_slot_default.slot); | |
| 9312 | + } | |
| 9313 | + ownerDocument2.body.appendChild(element); | |
| 9314 | + return element; | |
| 9315 | + } | |
| 9316 | + function getWpCompatOverlaySlot() { | |
| 9317 | + if (typeof window === "undefined") { | |
| 9318 | + return void 0; | |
| 9319 | + } | |
| 9320 | + if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { | |
| 9321 | + return void 0; | |
| 9322 | + } | |
| 9323 | + const ownerDocument2 = resolveOwnerDocument(); | |
| 9324 | + if (!ownerDocument2 || !ownerDocument2.body) { | |
| 9325 | + return void 0; | |
| 9326 | + } | |
| 9327 | + if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { | |
| 9328 | + return ensureSlotIsAccessible(cachedSlot); | |
| 9329 | + } | |
| 9330 | + const existing = ownerDocument2.querySelector( | |
| 9331 | + `[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` | |
| 9332 | + ); | |
| 9333 | + if (existing instanceof HTMLDivElement) { | |
| 9334 | + cachedSlot = ensureSlotIsAccessible(existing); | |
| 9335 | + return cachedSlot; | |
| 9336 | + } | |
| 9337 | + if (cachedSlot?.isConnected) { | |
| 9338 | + cachedSlot.remove(); | |
| 9339 | + } | |
| 9340 | + cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2)); | |
| 9341 | + return cachedSlot; | |
| 9342 | + } | |
| 9343 | + | |
| 9344 | + // packages/ui/build-module/tooltip/portal.mjs | |
| 9345 | + var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); | |
| 9346 | + var Portal = (0, import_element11.forwardRef)( | |
| 9347 | + function TooltipPortal3({ container, ...restProps }, ref) { | |
| 9348 | + return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( | |
| 9349 | + index_parts_exports.Portal, | |
| 9350 | + { | |
| 9351 | + container: container ?? getWpCompatOverlaySlot(), | |
| 9352 | + ...restProps, | |
| 9353 | + ref | |
| 9354 | + } | |
| 9355 | + ); | |
| 9356 | + } | |
| 9357 | + ); | |
| 9358 | + | |
| 9359 | + // packages/ui/build-module/tooltip/positioner.mjs | |
| 9360 | + var import_element12 = __toESM(require_element(), 1); | |
| 9361 | + var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); | |
| 9362 | + var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; | |
| 9363 | + function getRuntime2() { | |
| 9364 | + const globalScope = globalThis; | |
| 9365 | + if (globalScope.__wpStyleRuntime) { | |
| 9366 | + return globalScope.__wpStyleRuntime; | |
| 9367 | + } | |
| 9368 | + globalScope.__wpStyleRuntime = { | |
| 9369 | + documents: /* @__PURE__ */ new Map(), | |
| 9370 | + styles: /* @__PURE__ */ new Map(), | |
| 9371 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 9372 | + }; | |
| 9373 | + if (typeof document !== "undefined") { | |
| 9374 | + registerDocument2(document); | |
| 9375 | + } | |
| 9376 | + return globalScope.__wpStyleRuntime; | |
| 9377 | + } | |
| 9378 | + function documentContainsStyleHash2(targetDocument, hash) { | |
| 9379 | + if (!targetDocument.head) { | |
| 9380 | + return false; | |
| 9381 | + } | |
| 9382 | + for (const style of targetDocument.head.querySelectorAll( | |
| 9383 | + `style[${STYLE_HASH_ATTRIBUTE2}]` | |
| 9384 | + )) { | |
| 9385 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { | |
| 9386 | + return true; | |
| 9387 | + } | |
| 9388 | + } | |
| 9389 | + return false; | |
| 9390 | + } | |
| 9391 | + function injectStyle2(targetDocument, hash, css) { | |
| 9392 | + if (!targetDocument.head) { | |
| 9393 | + return; | |
| 9394 | + } | |
| 9395 | + const runtime = getRuntime2(); | |
| 9396 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 9397 | + if (!injectedStyles) { | |
| 9398 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 9399 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 9400 | + } | |
| 9401 | + if (injectedStyles.has(hash)) { | |
| 9402 | + return; | |
| 9403 | + } | |
| 9404 | + if (documentContainsStyleHash2(targetDocument, hash)) { | |
| 9405 | + injectedStyles.add(hash); | |
| 9406 | + return; | |
| 9407 | + } | |
| 9408 | + const style = targetDocument.createElement("style"); | |
| 9409 | + style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); | |
| 9410 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 9411 | + targetDocument.head.appendChild(style); | |
| 9412 | + injectedStyles.add(hash); | |
| 9413 | + } | |
| 9414 | + function registerDocument2(targetDocument) { | |
| 9415 | + const runtime = getRuntime2(); | |
| 9416 | + runtime.documents.set( | |
| 9417 | + targetDocument, | |
| 9418 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 9419 | + ); | |
| 9420 | + for (const [hash, css] of runtime.styles) { | |
| 9421 | + injectStyle2(targetDocument, hash, css); | |
| 9422 | + } | |
| 9423 | + return () => { | |
| 9424 | + const count = runtime.documents.get(targetDocument); | |
| 9425 | + if (count === void 0) { | |
| 9426 | + return; | |
| 9427 | + } | |
| 9428 | + if (count <= 1) { | |
| 9429 | + runtime.documents.delete(targetDocument); | |
| 9430 | + return; | |
| 9431 | + } | |
| 9432 | + runtime.documents.set(targetDocument, count - 1); | |
| 9433 | + }; | |
| 9434 | + } | |
| 9435 | + function registerStyle2(hash, css) { | |
| 9436 | + const runtime = getRuntime2(); | |
| 9437 | + runtime.styles.set(hash, css); | |
| 9438 | + for (const targetDocument of runtime.documents.keys()) { | |
| 9439 | + injectStyle2(targetDocument, hash, css); | |
| 9440 | + } | |
| 9441 | + } | |
| 9442 | + if (typeof process === "undefined" || true) { | |
| 9443 | + registerStyle2("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 9444 | + } | |
| 9445 | + var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 9446 | + if (typeof process === "undefined" || true) { | |
| 9447 | + 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}}}}'); | |
| 9448 | + } | |
| 9449 | + var style_default = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; | |
| 9450 | + var Positioner = (0, import_element12.forwardRef)( | |
| 9451 | + function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { | |
| 9452 | + return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( | |
| 9453 | + index_parts_exports.Positioner, | |
| 9454 | + { | |
| 9455 | + ref, | |
| 9456 | + align, | |
| 9457 | + side, | |
| 9458 | + sideOffset, | |
| 9459 | + ...props, | |
| 9460 | + className: clsx_default( | |
| 9461 | + resets_default["box-sizing"], | |
| 9462 | + style_default.positioner, | |
| 9463 | + className | |
| 9464 | + ) | |
| 9465 | + } | |
| 9466 | + ); | |
| 9467 | + } | |
| 9468 | + ); | |
| 9469 | + | |
| 9470 | + // packages/ui/build-module/utils/render-slot-with-children.mjs | |
| 9471 | + var import_element13 = __toESM(require_element(), 1); | |
| 9472 | + function renderSlotWithChildren(slot, defaultSlot, children) { | |
| 9473 | + return (0, import_element13.cloneElement)(slot ?? defaultSlot, { children }); | |
| 9474 | + } | |
| 9475 | + | |
| 9476 | + // packages/ui/build-module/utils/theme-provider.mjs | |
| 9477 | + var theme = __toESM(require_theme(), 1); | |
| 9478 | + | |
| 9479 | + // packages/ui/build-module/lock-unlock.mjs | |
| 9480 | + var import_private_apis = __toESM(require_private_apis(), 1); | |
| 9481 | + var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( | |
| 9482 | + "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", | |
| 9483 | + "@wordpress/ui" | |
| 9484 | + ); | |
| 9485 | + | |
| 9486 | + // packages/ui/build-module/utils/theme-provider.mjs | |
| 9487 | + function getThemeProvider() { | |
| 9488 | + const themePackage = theme; | |
| 9489 | + if (themePackage.ThemeProvider) { | |
| 9490 | + return themePackage.ThemeProvider; | |
| 9491 | + } | |
| 9492 | + if (!themePackage.privateApis) { | |
| 9493 | + throw new Error( | |
| 9494 | + "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." | |
| 9495 | + ); | |
| 9496 | + } | |
| 9497 | + return unlock( | |
| 9498 | + themePackage.privateApis | |
| 9499 | + ).ThemeProvider; | |
| 9500 | + } | |
| 9501 | + var ThemeProvider = getThemeProvider(); | |
| 9502 | + | |
| 9503 | + // packages/ui/build-module/tooltip/popup.mjs | |
| 9504 | + var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); | |
| 9505 | + var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; | |
| 9506 | + function getRuntime3() { | |
| 9507 | + const globalScope = globalThis; | |
| 9508 | + if (globalScope.__wpStyleRuntime) { | |
| 9509 | + return globalScope.__wpStyleRuntime; | |
| 9510 | + } | |
| 9511 | + globalScope.__wpStyleRuntime = { | |
| 9512 | + documents: /* @__PURE__ */ new Map(), | |
| 9513 | + styles: /* @__PURE__ */ new Map(), | |
| 9514 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 9515 | + }; | |
| 9516 | + if (typeof document !== "undefined") { | |
| 9517 | + registerDocument3(document); | |
| 9518 | + } | |
| 9519 | + return globalScope.__wpStyleRuntime; | |
| 9520 | + } | |
| 9521 | + function documentContainsStyleHash3(targetDocument, hash) { | |
| 9522 | + if (!targetDocument.head) { | |
| 9523 | + return false; | |
| 9524 | + } | |
| 9525 | + for (const style of targetDocument.head.querySelectorAll( | |
| 9526 | + `style[${STYLE_HASH_ATTRIBUTE3}]` | |
| 9527 | + )) { | |
| 9528 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { | |
| 9529 | + return true; | |
| 9530 | + } | |
| 9531 | + } | |
| 9532 | + return false; | |
| 9533 | + } | |
| 9534 | + function injectStyle3(targetDocument, hash, css) { | |
| 9535 | + if (!targetDocument.head) { | |
| 9536 | + return; | |
| 9537 | + } | |
| 9538 | + const runtime = getRuntime3(); | |
| 9539 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 9540 | + if (!injectedStyles) { | |
| 9541 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 9542 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 9543 | + } | |
| 9544 | + if (injectedStyles.has(hash)) { | |
| 9545 | + return; | |
| 9546 | + } | |
| 9547 | + if (documentContainsStyleHash3(targetDocument, hash)) { | |
| 9548 | + injectedStyles.add(hash); | |
| 9549 | + return; | |
| 9550 | + } | |
| 9551 | + const style = targetDocument.createElement("style"); | |
| 9552 | + style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); | |
| 9553 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 9554 | + targetDocument.head.appendChild(style); | |
| 9555 | + injectedStyles.add(hash); | |
| 9556 | + } | |
| 9557 | + function registerDocument3(targetDocument) { | |
| 9558 | + const runtime = getRuntime3(); | |
| 9559 | + runtime.documents.set( | |
| 9560 | + targetDocument, | |
| 9561 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 9562 | + ); | |
| 9563 | + for (const [hash, css] of runtime.styles) { | |
| 9564 | + injectStyle3(targetDocument, hash, css); | |
| 9565 | + } | |
| 9566 | + return () => { | |
| 9567 | + const count = runtime.documents.get(targetDocument); | |
| 9568 | + if (count === void 0) { | |
| 9569 | + return; | |
| 9570 | + } | |
| 9571 | + if (count <= 1) { | |
| 9572 | + runtime.documents.delete(targetDocument); | |
| 9573 | + return; | |
| 9574 | + } | |
| 9575 | + runtime.documents.set(targetDocument, count - 1); | |
| 9576 | + }; | |
| 9577 | + } | |
| 9578 | + function registerStyle3(hash, css) { | |
| 9579 | + const runtime = getRuntime3(); | |
| 9580 | + runtime.styles.set(hash, css); | |
| 9581 | + for (const targetDocument of runtime.documents.keys()) { | |
| 9582 | + injectStyle3(targetDocument, hash, css); | |
| 9583 | + } | |
| 9584 | + } | |
| 9585 | + if (typeof process === "undefined" || true) { | |
| 9586 | + 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}}}}'); | |
| 9587 | + } | |
| 9588 | + var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; | |
| 9589 | + var POPUP_COLOR = { background: "#1e1e1e" }; | |
| 9590 | + var Popup = (0, import_element14.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { | |
| 9591 | + const popupContent = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( | |
| 9592 | + index_parts_exports.Popup, | |
| 9593 | + { | |
| 9594 | + ref, | |
| 9595 | + className: clsx_default(style_default2.popup, className), | |
| 9596 | + ...props, | |
| 9597 | + children | |
| 9598 | + } | |
| 9599 | + ) }); | |
| 9600 | + const positionedPopup = renderSlotWithChildren( | |
| 9601 | + positioner, | |
| 9602 | + /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Positioner, {}), | |
| 9603 | + popupContent | |
| 9604 | + ); | |
| 9605 | + return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Portal, {}), positionedPopup); | |
| 9606 | + }); | |
| 9607 | + | |
| 9608 | + // packages/ui/build-module/tooltip/trigger.mjs | |
| 9609 | + var import_element15 = __toESM(require_element(), 1); | |
| 9610 | + var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); | |
| 9611 | + var Trigger = (0, import_element15.forwardRef)( | |
| 9612 | + function TooltipTrigger3(props, ref) { | |
| 9613 | + return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(index_parts_exports.Trigger, { ref, ...props }); | |
| 9614 | + } | |
| 9615 | + ); | |
| 9616 | + | |
| 9617 | + // packages/ui/build-module/utils/direction-provider.mjs | |
| 9618 | + var import_i18n2 = __toESM(require_i18n(), 1); | |
| 9619 | + var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); | |
| 9620 | + function DirectionProvider3({ children }) { | |
| 9621 | + return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DirectionProvider, { direction: (0, import_i18n2.isRTL)() ? "rtl" : "ltr", children }); | |
| 9622 | + } | |
| 9623 | + | |
| 9624 | + // packages/ui/build-module/tooltip/root.mjs | |
| 9625 | + var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); | |
| 9626 | + function Root(props) { | |
| 9627 | + return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(index_parts_exports.Root, { ...props }) }); | |
| 9628 | + } | |
| 9629 | + | |
| 9630 | + // packages/ui/build-module/tooltip/provider.mjs | |
| 9631 | + var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); | |
| 9632 | + function Provider({ ...props }) { | |
| 9633 | + return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(index_parts_exports.Provider, { ...props }); | |
| 9634 | + } | |
| 9635 | + | |
| 9636 | + // packages/icons/build-module/icon/index.mjs | |
| 9637 | + var import_element16 = __toESM(require_element(), 1); | |
| 9638 | + var icon_default = (0, import_element16.forwardRef)( | |
| 9639 | + ({ icon, size: size4 = 24, style, ...props }, ref) => { | |
| 9640 | + const intrinsicStyle = icon.props.style; | |
| 9641 | + const mergedStyle = intrinsicStyle || style ? { ...intrinsicStyle, ...style } : void 0; | |
| 9642 | + return (0, import_element16.cloneElement)(icon, { | |
| 9643 | + width: size4, | |
| 9644 | + height: size4, | |
| 9645 | + ...props, | |
| 9646 | + // Merge styles so the icon's intrinsic style (e.g. `fill: none` on | |
| 9647 | + // stroke-based icons) is preserved unless the consumer overrides | |
| 9648 | + // the same property explicitly. | |
| 9649 | + ...mergedStyle ? { style: mergedStyle } : {}, | |
| 9650 | + ref | |
| 9651 | + }); | |
| 9652 | + } | |
| 9653 | + ); | |
| 9654 | + | |
| 9655 | + // packages/icons/build-module/library/star-empty.mjs | |
| 9656 | + var import_primitives = __toESM(require_primitives(), 1); | |
| 9657 | + var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); | |
| 9658 | + 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" }) }); | |
| 9659 | + | |
| 9660 | + // packages/icons/build-module/library/star-filled.mjs | |
| 9661 | + var import_primitives2 = __toESM(require_primitives(), 1); | |
| 9662 | + var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); | |
| 9663 | + 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" }) }); | |
| 9664 | + | |
| 9665 | + // packages/icons/build-module/library/star-half.mjs | |
| 9666 | + var import_primitives3 = __toESM(require_primitives(), 1); | |
| 9667 | + var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); | |
| 9668 | + 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: [ | |
| 9669 | + /* @__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" }), | |
| 9670 | + /* @__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" }) | |
| 9671 | + ] }); | |
| 9672 | + | |
| 9673 | + // packages/ui/build-module/visually-hidden/visually-hidden.mjs | |
| 9674 | + var import_element17 = __toESM(require_element(), 1); | |
| 9675 | + var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; | |
| 9676 | + function getRuntime4() { | |
| 9677 | + const globalScope = globalThis; | |
| 9678 | + if (globalScope.__wpStyleRuntime) { | |
| 9679 | + return globalScope.__wpStyleRuntime; | |
| 9680 | + } | |
| 9681 | + globalScope.__wpStyleRuntime = { | |
| 9682 | + documents: /* @__PURE__ */ new Map(), | |
| 9683 | + styles: /* @__PURE__ */ new Map(), | |
| 9684 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 9685 | + }; | |
| 9686 | + if (typeof document !== "undefined") { | |
| 9687 | + registerDocument4(document); | |
| 9688 | + } | |
| 9689 | + return globalScope.__wpStyleRuntime; | |
| 9690 | + } | |
| 9691 | + function documentContainsStyleHash4(targetDocument, hash) { | |
| 9692 | + if (!targetDocument.head) { | |
| 9693 | + return false; | |
| 9694 | + } | |
| 9695 | + for (const style of targetDocument.head.querySelectorAll( | |
| 9696 | + `style[${STYLE_HASH_ATTRIBUTE4}]` | |
| 9697 | + )) { | |
| 9698 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { | |
| 9699 | + return true; | |
| 9700 | + } | |
| 9701 | + } | |
| 9702 | + return false; | |
| 9703 | + } | |
| 9704 | + function injectStyle4(targetDocument, hash, css) { | |
| 9705 | + if (!targetDocument.head) { | |
| 9706 | + return; | |
| 9707 | + } | |
| 9708 | + const runtime = getRuntime4(); | |
| 9709 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 9710 | + if (!injectedStyles) { | |
| 9711 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 9712 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 9713 | + } | |
| 9714 | + if (injectedStyles.has(hash)) { | |
| 9715 | + return; | |
| 9716 | + } | |
| 9717 | + if (documentContainsStyleHash4(targetDocument, hash)) { | |
| 9718 | + injectedStyles.add(hash); | |
| 9719 | + return; | |
| 9720 | + } | |
| 9721 | + const style = targetDocument.createElement("style"); | |
| 9722 | + style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); | |
| 9723 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 9724 | + targetDocument.head.appendChild(style); | |
| 9725 | + injectedStyles.add(hash); | |
| 9726 | + } | |
| 9727 | + function registerDocument4(targetDocument) { | |
| 9728 | + const runtime = getRuntime4(); | |
| 9729 | + runtime.documents.set( | |
| 9730 | + targetDocument, | |
| 9731 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 9732 | + ); | |
| 9733 | + for (const [hash, css] of runtime.styles) { | |
| 9734 | + injectStyle4(targetDocument, hash, css); | |
| 9735 | + } | |
| 9736 | + return () => { | |
| 9737 | + const count = runtime.documents.get(targetDocument); | |
| 9738 | + if (count === void 0) { | |
| 9739 | + return; | |
| 9740 | + } | |
| 9741 | + if (count <= 1) { | |
| 9742 | + runtime.documents.delete(targetDocument); | |
| 9743 | + return; | |
| 9744 | + } | |
| 9745 | + runtime.documents.set(targetDocument, count - 1); | |
| 9746 | + }; | |
| 9747 | + } | |
| 9748 | + function registerStyle4(hash, css) { | |
| 9749 | + const runtime = getRuntime4(); | |
| 9750 | + runtime.styles.set(hash, css); | |
| 9751 | + for (const targetDocument of runtime.documents.keys()) { | |
| 9752 | + injectStyle4(targetDocument, hash, css); | |
| 9753 | + } | |
| 9754 | + } | |
| 9755 | + if (typeof process === "undefined" || true) { | |
| 9756 | + registerStyle4("f4df7461e9", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;overflow-wrap:normal;padding:0;position:absolute;width:1px;word-break:normal}}}"); | |
| 9757 | + } | |
| 9758 | + var style_default3 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; | |
| 9759 | + var VisuallyHidden = (0, import_element17.forwardRef)( | |
| 1348 | 9760 | function VisuallyHidden2({ render, ...restProps }, ref) { |
| 1349 | 9761 | const element = useRender({ |
| 1350 | 9762 | render, |
| 1351 | 9763 | ref, |
| 1352 | 9764 | props: mergeProps( |
| 1353 | - { className: style_default["visually-hidden"] }, | |
| 9765 | + { className: style_default3["visually-hidden"] }, | |
| 1354 | 9766 | restProps, |
| 1355 | 9767 | { |
| 1356 | 9768 | // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. |
| 1357 | 9769 | "data-visually-hidden": "" |
| @@ -1362,25 +9774,25 @@ | ||
| 1362 | 9774 | } |
| 1363 | 9775 | ); |
| 1364 | 9776 | |
| 1365 | 9777 | // packages/block-directory/build-module/components/block-ratings/stars.mjs |
| 1366 | - var import_i18n2 = __toESM(require_i18n(), 1); | |
| 1367 | - var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); | |
| 9778 | + var import_i18n3 = __toESM(require_i18n(), 1); | |
| 9779 | + var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); | |
| 1368 | 9780 | function Stars({ rating }) { |
| 1369 | 9781 | const stars = Math.round(rating / 0.5) * 0.5; |
| 1370 | 9782 | const fullStarCount = Math.floor(rating); |
| 1371 | 9783 | const halfStarCount = Math.ceil(rating - fullStarCount); |
| 1372 | 9784 | const emptyStarCount = 5 - (fullStarCount + halfStarCount); |
| 1373 | - return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)( | |
| 9785 | + return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)( | |
| 1374 | 9786 | "span", |
| 1375 | 9787 | { |
| 1376 | - "aria-label": (0, import_i18n2.sprintf)( | |
| 9788 | + "aria-label": (0, import_i18n3.sprintf)( | |
| 1377 | 9789 | /* translators: %s: number of stars. */ |
| 1378 | - (0, import_i18n2.__)("%s out of 5 stars"), | |
| 9790 | + (0, import_i18n3.__)("%s out of 5 stars"), | |
| 1379 | 9791 | stars |
| 1380 | 9792 | ), |
| 1381 | 9793 | children: [ |
| 1382 | - Array.from({ length: fullStarCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( | |
| 9794 | + Array.from({ length: fullStarCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( | |
| 1383 | 9795 | icon_default, |
| 1384 | 9796 | { |
| 1385 | 9797 | className: "block-directory-block-ratings__star-full", |
| 1386 | 9798 | icon: star_filled_default, |
| @@ -1387,9 +9799,9 @@ | ||
| 1387 | 9799 | size: 16 |
| 1388 | 9800 | }, |
| 1389 | 9801 | `full_stars_${i}` |
| 1390 | 9802 | )), |
| 1391 | - Array.from({ length: halfStarCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( | |
| 9803 | + Array.from({ length: halfStarCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( | |
| 1392 | 9804 | icon_default, |
| 1393 | 9805 | { |
| 1394 | 9806 | className: "block-directory-block-ratings__star-half-full", |
| 1395 | 9807 | icon: star_half_default, |
| @@ -1396,9 +9808,9 @@ | ||
| 1396 | 9808 | size: 16 |
| 1397 | 9809 | }, |
| 1398 | 9810 | `half_stars_${i}` |
| 1399 | 9811 | )), |
| 1400 | - Array.from({ length: emptyStarCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( | |
| 9812 | + Array.from({ length: emptyStarCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( | |
| 1401 | 9813 | icon_default, |
| 1402 | 9814 | { |
| 1403 | 9815 | className: "block-directory-block-ratings__star-empty", |
| 1404 | 9816 | icon: star_empty_default, |
| @@ -1412,25 +9824,25 @@ | ||
| 1412 | 9824 | } |
| 1413 | 9825 | var stars_default = Stars; |
| 1414 | 9826 | |
| 1415 | 9827 | // packages/block-directory/build-module/components/block-ratings/index.mjs |
| 1416 | - var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); | |
| 1417 | - var BlockRatings = ({ rating }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "block-directory-block-ratings", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(stars_default, { rating }) }); | |
| 9828 | + var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); | |
| 9829 | + 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 }) }); | |
| 1418 | 9830 | var block_ratings_default = BlockRatings; |
| 1419 | 9831 | |
| 1420 | 9832 | // packages/block-directory/build-module/components/downloadable-block-icon/index.mjs |
| 1421 | 9833 | var import_block_editor2 = __toESM(require_block_editor(), 1); |
| 1422 | - var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); | |
| 9834 | + var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); | |
| 1423 | 9835 | function DownloadableBlockIcon({ icon }) { |
| 1424 | 9836 | const className = "block-directory-downloadable-block-icon"; |
| 1425 | - return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { className, src: icon, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_block_editor2.BlockIcon, { className, icon, showColors: true }); | |
| 9837 | + 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 }); | |
| 1426 | 9838 | } |
| 1427 | 9839 | var downloadable_block_icon_default = DownloadableBlockIcon; |
| 1428 | 9840 | |
| 1429 | 9841 | // packages/block-directory/build-module/components/downloadable-block-notice/index.mjs |
| 1430 | - var import_i18n3 = __toESM(require_i18n(), 1); | |
| 9842 | + var import_i18n4 = __toESM(require_i18n(), 1); | |
| 1431 | 9843 | var import_data5 = __toESM(require_data(), 1); |
| 1432 | - var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); | |
| 9844 | + var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); | |
| 1433 | 9845 | var DownloadableBlockNotice = ({ block }) => { |
| 1434 | 9846 | const errorNotice = (0, import_data5.useSelect)( |
| 1435 | 9847 | (select) => select(store).getErrorNoticeForBlock(block.id), |
| 1436 | 9848 | [block] |
| @@ -1437,34 +9849,50 @@ | ||
| 1437 | 9849 | ); |
| 1438 | 9850 | if (!errorNotice) { |
| 1439 | 9851 | return null; |
| 1440 | 9852 | } |
| 1441 | - return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "block-directory-downloadable-block-notice", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "block-directory-downloadable-block-notice__content", children: [ | |
| 9853 | + 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: [ | |
| 1442 | 9854 | errorNotice.message, |
| 1443 | - errorNotice.isFatal ? " " + (0, import_i18n3.__)("Try reloading the page.") : null | |
| 9855 | + errorNotice.isFatal ? " " + (0, import_i18n4.__)("Try reloading the page.") : null | |
| 1444 | 9856 | ] }) }); |
| 1445 | 9857 | }; |
| 1446 | 9858 | var downloadable_block_notice_default = DownloadableBlockNotice; |
| 1447 | 9859 | |
| 1448 | 9860 | // packages/block-directory/build-module/components/downloadable-block-list-item/index.mjs |
| 1449 | - var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); | |
| 9861 | + var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); | |
| 1450 | 9862 | function getDownloadableBlockLabel({ title, rating, ratingCount }, { hasNotice, isInstalled, isInstalling: isInstalling2 }) { |
| 1451 | 9863 | const stars = Math.round(rating / 0.5) * 0.5; |
| 1452 | 9864 | if (!isInstalled && hasNotice) { |
| 1453 | - return (0, import_i18n4.sprintf)("Retry installing %s.", (0, import_html_entities.decodeEntities)(title)); | |
| 9865 | + return (0, import_i18n5.sprintf)( | |
| 9866 | + /* translators: %s: block title */ | |
| 9867 | + (0, import_i18n5.__)("Retry installing %s."), | |
| 9868 | + (0, import_html_entities.decodeEntities)(title) | |
| 9869 | + ); | |
| 1454 | 9870 | } |
| 1455 | 9871 | if (isInstalled) { |
| 1456 | - return (0, import_i18n4.sprintf)("Add %s.", (0, import_html_entities.decodeEntities)(title)); | |
| 9872 | + return (0, import_i18n5.sprintf)( | |
| 9873 | + /* translators: %s: block title */ | |
| 9874 | + (0, import_i18n5.__)("Add %s."), | |
| 9875 | + (0, import_html_entities.decodeEntities)(title) | |
| 9876 | + ); | |
| 1457 | 9877 | } |
| 1458 | 9878 | if (isInstalling2) { |
| 1459 | - return (0, import_i18n4.sprintf)("Installing %s.", (0, import_html_entities.decodeEntities)(title)); | |
| 9879 | + return (0, import_i18n5.sprintf)( | |
| 9880 | + /* translators: %s: block title */ | |
| 9881 | + (0, import_i18n5.__)("Installing %s."), | |
| 9882 | + (0, import_html_entities.decodeEntities)(title) | |
| 9883 | + ); | |
| 1460 | 9884 | } |
| 1461 | 9885 | if (ratingCount < 1) { |
| 1462 | - return (0, import_i18n4.sprintf)("Install %s.", (0, import_html_entities.decodeEntities)(title)); | |
| 9886 | + return (0, import_i18n5.sprintf)( | |
| 9887 | + /* translators: %s: block title */ | |
| 9888 | + (0, import_i18n5.__)("Install %s."), | |
| 9889 | + (0, import_html_entities.decodeEntities)(title) | |
| 9890 | + ); | |
| 1463 | 9891 | } |
| 1464 | - return (0, import_i18n4.sprintf)( | |
| 9892 | + return (0, import_i18n5.sprintf)( | |
| 1465 | 9893 | /* translators: 1: block title, 2: average rating, 3: total ratings count. */ |
| 1466 | - (0, import_i18n4._n)( | |
| 9894 | + (0, import_i18n5._n)( | |
| 1467 | 9895 | "Install %1$s. %2$s stars with %3$s review.", |
| 1468 | 9896 | "Install %1$s. %2$s stars with %3$s reviews.", |
| 1469 | 9897 | ratingCount |
| 1470 | 9898 | ), |
| @@ -1490,11 +9918,11 @@ | ||
| 1490 | 9918 | [item] |
| 1491 | 9919 | ); |
| 1492 | 9920 | let statusText = ""; |
| 1493 | 9921 | if (isInstalled) { |
| 1494 | - statusText = (0, import_i18n4.__)("Installed!"); | |
| 9922 | + statusText = (0, import_i18n5.__)("Installed!"); | |
| 1495 | 9923 | } else if (isInstalling2) { |
| 1496 | - statusText = (0, import_i18n4.__)("Installing\u2026"); | |
| 9924 | + statusText = (0, import_i18n5.__)("Installing\u2026"); | |
| 1497 | 9925 | } |
| 1498 | 9926 | const itemLabel = getDownloadableBlockLabel(item, { |
| 1499 | 9927 | hasNotice, |
| 1500 | 9928 | isInstalled, |
| @@ -1499,69 +9927,83 @@ | ||
| 1499 | 9927 | hasNotice, |
| 1500 | 9928 | isInstalled, |
| 1501 | 9929 | isInstalling: isInstalling2 |
| 1502 | 9930 | }); |
| 1503 | - return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components.Tooltip, { placement: "top", text: itemLabel, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)( | |
| 1504 | - import_components.Composite.Item, | |
| 1505 | - { | |
| 1506 | - className: clsx_default( | |
| 1507 | - "block-directory-downloadable-block-list-item", | |
| 1508 | - isInstalling2 && "is-installing" | |
| 1509 | - ), | |
| 1510 | - accessibleWhenDisabled: true, | |
| 1511 | - disabled: isInstalling2 || !isInstallable, | |
| 1512 | - onClick: (event) => { | |
| 1513 | - event.preventDefault(); | |
| 1514 | - onClick(); | |
| 1515 | - }, | |
| 1516 | - "aria-label": itemLabel, | |
| 1517 | - type: "button", | |
| 1518 | - role: "option", | |
| 1519 | - children: [ | |
| 1520 | - /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "block-directory-downloadable-block-list-item__icon", children: [ | |
| 1521 | - /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(downloadable_block_icon_default, { icon, title }), | |
| 1522 | - isInstalling2 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "block-directory-downloadable-block-list-item__spinner", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components.Spinner, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(block_ratings_default, { rating }) | |
| 1523 | - ] }), | |
| 1524 | - /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "block-directory-downloadable-block-list-item__details", children: [ | |
| 1525 | - /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "block-directory-downloadable-block-list-item__title", children: (0, import_element4.createInterpolateElement)( | |
| 1526 | - (0, import_i18n4.sprintf)( | |
| 1527 | - /* translators: 1: block title. 2: author name. */ | |
| 1528 | - (0, import_i18n4.__)("%1$s <span>by %2$s</span>"), | |
| 1529 | - (0, import_html_entities.decodeEntities)(title), | |
| 1530 | - author | |
| 9931 | + return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(tooltip_exports.Root, { children: [ | |
| 9932 | + /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( | |
| 9933 | + tooltip_exports.Trigger, | |
| 9934 | + { | |
| 9935 | + render: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)( | |
| 9936 | + import_components.Composite.Item, | |
| 9937 | + { | |
| 9938 | + className: clsx_default( | |
| 9939 | + "block-directory-downloadable-block-list-item", | |
| 9940 | + isInstalling2 && "is-installing" | |
| 1531 | 9941 | ), |
| 1532 | - { | |
| 1533 | - span: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "block-directory-downloadable-block-list-item__author" }) | |
| 1534 | - } | |
| 1535 | - ) }), | |
| 1536 | - hasNotice ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(downloadable_block_notice_default, { block: item }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [ | |
| 1537 | - /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "block-directory-downloadable-block-list-item__desc", children: !!statusText ? statusText : (0, import_html_entities.decodeEntities)(description) }), | |
| 1538 | - isInstallable && !(isInstalled || isInstalling2) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(VisuallyHidden, { children: (0, import_i18n4.__)("Install block") }) | |
| 1539 | - ] }) | |
| 1540 | - ] }) | |
| 1541 | - ] | |
| 1542 | - } | |
| 1543 | - ) }); | |
| 9942 | + accessibleWhenDisabled: true, | |
| 9943 | + disabled: isInstalling2 || !isInstallable, | |
| 9944 | + onClick: (event) => { | |
| 9945 | + event.preventDefault(); | |
| 9946 | + onClick(); | |
| 9947 | + }, | |
| 9948 | + "aria-label": itemLabel, | |
| 9949 | + type: "button", | |
| 9950 | + role: "option", | |
| 9951 | + children: [ | |
| 9952 | + /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "block-directory-downloadable-block-list-item__icon", children: [ | |
| 9953 | + /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( | |
| 9954 | + downloadable_block_icon_default, | |
| 9955 | + { | |
| 9956 | + icon, | |
| 9957 | + title | |
| 9958 | + } | |
| 9959 | + ), | |
| 9960 | + 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 }) | |
| 9961 | + ] }), | |
| 9962 | + /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "block-directory-downloadable-block-list-item__details", children: [ | |
| 9963 | + /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "block-directory-downloadable-block-list-item__title", children: (0, import_element18.createInterpolateElement)( | |
| 9964 | + (0, import_i18n5.sprintf)( | |
| 9965 | + /* translators: 1: block title. 2: author name. */ | |
| 9966 | + (0, import_i18n5.__)("%1$s <span>by %2$s</span>"), | |
| 9967 | + (0, import_html_entities.decodeEntities)(title), | |
| 9968 | + author | |
| 9969 | + ), | |
| 9970 | + { | |
| 9971 | + span: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "block-directory-downloadable-block-list-item__author" }) | |
| 9972 | + } | |
| 9973 | + ) }), | |
| 9974 | + hasNotice ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(downloadable_block_notice_default, { block: item }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [ | |
| 9975 | + /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "block-directory-downloadable-block-list-item__desc", children: !!statusText ? statusText : (0, import_html_entities.decodeEntities)(description) }), | |
| 9976 | + isInstallable && !(isInstalled || isInstalling2) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(VisuallyHidden, { children: (0, import_i18n5.__)("Install block") }) | |
| 9977 | + ] }) | |
| 9978 | + ] }) | |
| 9979 | + ] | |
| 9980 | + } | |
| 9981 | + ) | |
| 9982 | + } | |
| 9983 | + ), | |
| 9984 | + /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(tooltip_exports.Popup, { children: itemLabel }) | |
| 9985 | + ] }); | |
| 1544 | 9986 | } |
| 1545 | 9987 | var downloadable_block_list_item_default = DownloadableBlockListItem; |
| 1546 | 9988 | |
| 1547 | 9989 | // packages/block-directory/build-module/components/downloadable-blocks-list/index.mjs |
| 1548 | - var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); | |
| 1549 | - var noop = () => { | |
| 9990 | + var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); | |
| 9991 | + var noop4 = () => { | |
| 1550 | 9992 | }; |
| 1551 | - function DownloadableBlocksList({ items, onHover = noop, onSelect }) { | |
| 9993 | + function DownloadableBlocksList({ items, onHover = noop4, onSelect }) { | |
| 1552 | 9994 | const { installBlockType: installBlockType2 } = (0, import_data7.useDispatch)(store); |
| 1553 | 9995 | if (!items.length) { |
| 1554 | 9996 | return null; |
| 1555 | 9997 | } |
| 1556 | - return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 9998 | + return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)( | |
| 1557 | 9999 | import_components2.Composite, |
| 1558 | 10000 | { |
| 1559 | 10001 | role: "listbox", |
| 1560 | 10002 | className: "block-directory-downloadable-blocks-list", |
| 1561 | - "aria-label": (0, import_i18n5.__)("Blocks available for install"), | |
| 10003 | + "aria-label": (0, import_i18n6.__)("Blocks available for install"), | |
| 1562 | 10004 | children: items.map((item) => { |
| 1563 | - return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 10005 | + return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)( | |
| 1564 | 10006 | downloadable_block_list_item_default, |
| 1565 | 10007 | { |
| 1566 | 10008 | onClick: () => { |
| 1567 | 10009 | if ((0, import_blocks4.getBlockType)(item.name)) { |
| @@ -1586,12 +10028,12 @@ | ||
| 1586 | 10028 | } |
| 1587 | 10029 | var downloadable_blocks_list_default = DownloadableBlocksList; |
| 1588 | 10030 | |
| 1589 | 10031 | // packages/block-directory/build-module/components/downloadable-blocks-panel/inserter-panel.mjs |
| 1590 | - var import_i18n6 = __toESM(require_i18n(), 1); | |
| 1591 | - var import_element5 = __toESM(require_element(), 1); | |
| 10032 | + var import_i18n7 = __toESM(require_i18n(), 1); | |
| 10033 | + var import_element19 = __toESM(require_element(), 1); | |
| 1592 | 10034 | var import_a11y = __toESM(require_a11y(), 1); |
| 1593 | - var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); | |
| 10035 | + var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); | |
| 1594 | 10036 | function DownloadableBlocksInserterPanel({ |
| 1595 | 10037 | children, |
| 1596 | 10038 | downloadableItems, |
| 1597 | 10039 | hasLocalBlocks |
| @@ -1596,13 +10038,13 @@ | ||
| 1596 | 10038 | downloadableItems, |
| 1597 | 10039 | hasLocalBlocks |
| 1598 | 10040 | }) { |
| 1599 | 10041 | const count = downloadableItems.length; |
| 1600 | - (0, import_element5.useEffect)(() => { | |
| 10042 | + (0, import_element19.useEffect)(() => { | |
| 1601 | 10043 | (0, import_a11y.speak)( |
| 1602 | - (0, import_i18n6.sprintf)( | |
| 10044 | + (0, import_i18n7.sprintf)( | |
| 1603 | 10045 | /* translators: %d: number of available blocks. */ |
| 1604 | - (0, import_i18n6._n)( | |
| 10046 | + (0, import_i18n7._n)( | |
| 1605 | 10047 | "%d additional block is available to install.", |
| 1606 | 10048 | "%d additional blocks are available to install.", |
| 1607 | 10049 | count |
| 1608 | 10050 | ), |
| @@ -1609,15 +10051,15 @@ | ||
| 1609 | 10051 | count |
| 1610 | 10052 | ) |
| 1611 | 10053 | ); |
| 1612 | 10054 | }, [count]); |
| 1613 | - return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [ | |
| 1614 | - !hasLocalBlocks && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "block-directory-downloadable-blocks-panel__no-local", children: (0, import_i18n6.__)("No results available from your installed blocks.") }), | |
| 1615 | - /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "block-editor-inserter__quick-inserter-separator" }), | |
| 1616 | - /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "block-directory-downloadable-blocks-panel", children: [ | |
| 1617 | - /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "block-directory-downloadable-blocks-panel__header", children: [ | |
| 1618 | - /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "block-directory-downloadable-blocks-panel__title", children: (0, import_i18n6.__)("Available to install") }), | |
| 1619 | - /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "block-directory-downloadable-blocks-panel__description", children: (0, import_i18n6.__)( | |
| 10055 | + return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [ | |
| 10056 | + !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.") }), | |
| 10057 | + /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "block-editor-inserter__quick-inserter-separator" }), | |
| 10058 | + /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "block-directory-downloadable-blocks-panel", children: [ | |
| 10059 | + /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "block-directory-downloadable-blocks-panel__header", children: [ | |
| 10060 | + /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h2", { className: "block-directory-downloadable-blocks-panel__title", children: (0, import_i18n7.__)("Available to install") }), | |
| 10061 | + /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "block-directory-downloadable-blocks-panel__description", children: (0, import_i18n7.__)( | |
| 1620 | 10062 | "Select a block to install and add it to your post." |
| 1621 | 10063 | ) }) |
| 1622 | 10064 | ] }), |
| 1623 | 10065 | children |
| @@ -1626,19 +10068,19 @@ | ||
| 1626 | 10068 | } |
| 1627 | 10069 | var inserter_panel_default = DownloadableBlocksInserterPanel; |
| 1628 | 10070 | |
| 1629 | 10071 | // packages/block-directory/build-module/components/downloadable-blocks-panel/no-results.mjs |
| 1630 | - var import_i18n7 = __toESM(require_i18n(), 1); | |
| 10072 | + var import_i18n8 = __toESM(require_i18n(), 1); | |
| 1631 | 10073 | var import_components3 = __toESM(require_components(), 1); |
| 1632 | - var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); | |
| 10074 | + var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); | |
| 1633 | 10075 | function DownloadableBlocksNoResults() { |
| 1634 | - return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [ | |
| 1635 | - /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "block-editor-inserter__no-results", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: (0, import_i18n7.__)("No results found.") }) }), | |
| 1636 | - /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "block-editor-inserter__tips", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_components3.Tip, { children: [ | |
| 1637 | - (0, import_i18n7.__)("Interested in creating your own block?"), | |
| 1638 | - /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("br", {}), | |
| 1639 | - /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_components3.ExternalLink, { href: "https://developer.wordpress.org/block-editor/", children: [ | |
| 1640 | - (0, import_i18n7.__)("Get started here"), | |
| 10076 | + return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [ | |
| 10077 | + /* @__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.") }) }), | |
| 10078 | + /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "block-editor-inserter__tips", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_components3.Tip, { children: [ | |
| 10079 | + (0, import_i18n8.__)("Interested in creating your own block?"), | |
| 10080 | + /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("br", {}), | |
| 10081 | + /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_components3.ExternalLink, { href: "https://developer.wordpress.org/block-editor/", children: [ | |
| 10082 | + (0, import_i18n8.__)("Get started here"), | |
| 1641 | 10083 | "." |
| 1642 | 10084 | ] }) |
| 1643 | 10085 | ] }) }) |
| 1644 | 10086 | ] }); |
| @@ -1645,9 +10087,9 @@ | ||
| 1645 | 10087 | } |
| 1646 | 10088 | var no_results_default = DownloadableBlocksNoResults; |
| 1647 | 10089 | |
| 1648 | 10090 | // packages/block-directory/build-module/components/downloadable-blocks-panel/index.mjs |
| 1649 | - var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); | |
| 10091 | + var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); | |
| 1650 | 10092 | var EMPTY_ARRAY3 = []; |
| 1651 | 10093 | var useDownloadableBlocks = (filterValue) => (0, import_data8.useSelect)( |
| 1652 | 10094 | (select) => { |
| 1653 | 10095 | const { |
| @@ -1695,33 +10137,33 @@ | ||
| 1695 | 10137 | filterValue |
| 1696 | 10138 | }) { |
| 1697 | 10139 | const { hasPermission, downloadableBlocks: downloadableBlocks2, isLoading } = useDownloadableBlocks(filterValue); |
| 1698 | 10140 | if (hasPermission === void 0 || isLoading || isTyping) { |
| 1699 | - return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [ | |
| 1700 | - hasPermission && !hasLocalBlocks && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [ | |
| 1701 | - /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "block-directory-downloadable-blocks-panel__no-local", children: (0, import_i18n8.__)( | |
| 10141 | + return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [ | |
| 10142 | + hasPermission && !hasLocalBlocks && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [ | |
| 10143 | + /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "block-directory-downloadable-blocks-panel__no-local", children: (0, import_i18n9.__)( | |
| 1702 | 10144 | "No results available from your installed blocks." |
| 1703 | 10145 | ) }), |
| 1704 | - /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "block-editor-inserter__quick-inserter-separator" }) | |
| 10146 | + /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "block-editor-inserter__quick-inserter-separator" }) | |
| 1705 | 10147 | ] }), |
| 1706 | - /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "block-directory-downloadable-blocks-panel has-blocks-loading", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_components4.Spinner, {}) }) | |
| 10148 | + /* @__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, {}) }) | |
| 1707 | 10149 | ] }); |
| 1708 | 10150 | } |
| 1709 | 10151 | if (false === hasPermission) { |
| 1710 | 10152 | if (!hasLocalBlocks) { |
| 1711 | - return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(no_results_default, {}); | |
| 10153 | + return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(no_results_default, {}); | |
| 1712 | 10154 | } |
| 1713 | 10155 | return null; |
| 1714 | 10156 | } |
| 1715 | 10157 | if (downloadableBlocks2.length === 0) { |
| 1716 | - return hasLocalBlocks ? null : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(no_results_default, {}); | |
| 10158 | + return hasLocalBlocks ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(no_results_default, {}); | |
| 1717 | 10159 | } |
| 1718 | - return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( | |
| 10160 | + return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( | |
| 1719 | 10161 | inserter_panel_default, |
| 1720 | 10162 | { |
| 1721 | 10163 | downloadableItems: downloadableBlocks2, |
| 1722 | 10164 | hasLocalBlocks, |
| 1723 | - children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( | |
| 10165 | + children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( | |
| 1724 | 10166 | downloadable_blocks_list_default, |
| 1725 | 10167 | { |
| 1726 | 10168 | items: downloadableBlocks2, |
| 1727 | 10169 | onSelect, |
| @@ -1732,13 +10174,13 @@ | ||
| 1732 | 10174 | ); |
| 1733 | 10175 | } |
| 1734 | 10176 | |
| 1735 | 10177 | // packages/block-directory/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.mjs |
| 1736 | - var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); | |
| 10178 | + var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); | |
| 1737 | 10179 | function InserterMenuDownloadableBlocksPanel() { |
| 1738 | - const [debouncedFilterValue, setFilterValue] = (0, import_element6.useState)(""); | |
| 10180 | + const [debouncedFilterValue, setFilterValue] = (0, import_element20.useState)(""); | |
| 1739 | 10181 | const debouncedSetFilterValue = (0, import_compose.debounce)(setFilterValue, 400); |
| 1740 | - return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_block_editor3.__unstableInserterMenuExtension, { children: ({ onSelect, onHover, filterValue, hasItems }) => { | |
| 10182 | + return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_block_editor3.__unstableInserterMenuExtension, { children: ({ onSelect, onHover, filterValue, hasItems }) => { | |
| 1741 | 10183 | if (debouncedFilterValue !== filterValue) { |
| 1742 | 10184 | debouncedSetFilterValue(filterValue); |
| 1743 | 10185 | } |
| 1744 | 10186 | if (!debouncedFilterValue) { |
| @@ -1743,9 +10185,9 @@ | ||
| 1743 | 10185 | } |
| 1744 | 10186 | if (!debouncedFilterValue) { |
| 1745 | 10187 | return null; |
| 1746 | 10188 | } |
| 1747 | - return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( | |
| 10189 | + return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( | |
| 1748 | 10190 | DownloadableBlocksPanel, |
| 1749 | 10191 | { |
| 1750 | 10192 | onSelect, |
| 1751 | 10193 | onHover, |
| @@ -1758,26 +10200,26 @@ | ||
| 1758 | 10200 | } |
| 1759 | 10201 | var inserter_menu_downloadable_blocks_panel_default = InserterMenuDownloadableBlocksPanel; |
| 1760 | 10202 | |
| 1761 | 10203 | // packages/block-directory/build-module/plugins/installed-blocks-pre-publish-panel/index.mjs |
| 1762 | - var import_i18n10 = __toESM(require_i18n(), 1); | |
| 10204 | + var import_i18n11 = __toESM(require_i18n(), 1); | |
| 1763 | 10205 | var import_data9 = __toESM(require_data(), 1); |
| 1764 | 10206 | var import_editor2 = __toESM(require_editor(), 1); |
| 1765 | 10207 | |
| 1766 | 10208 | // packages/block-directory/build-module/components/compact-list/index.mjs |
| 1767 | - var import_i18n9 = __toESM(require_i18n(), 1); | |
| 1768 | - var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); | |
| 10209 | + var import_i18n10 = __toESM(require_i18n(), 1); | |
| 10210 | + var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); | |
| 1769 | 10211 | function CompactList({ items }) { |
| 1770 | 10212 | if (!items.length) { |
| 1771 | 10213 | return null; |
| 1772 | 10214 | } |
| 1773 | - return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "block-directory-compact-list", children: items.map(({ icon, id, title, author }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { className: "block-directory-compact-list__item", children: [ | |
| 1774 | - /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(downloadable_block_icon_default, { icon, title }), | |
| 1775 | - /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "block-directory-compact-list__item-details", children: [ | |
| 1776 | - /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "block-directory-compact-list__item-title", children: title }), | |
| 1777 | - /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "block-directory-compact-list__item-author", children: (0, import_i18n9.sprintf)( | |
| 10215 | + 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: [ | |
| 10216 | + /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(downloadable_block_icon_default, { icon, title }), | |
| 10217 | + /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "block-directory-compact-list__item-details", children: [ | |
| 10218 | + /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "block-directory-compact-list__item-title", children: title }), | |
| 10219 | + /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "block-directory-compact-list__item-author", children: (0, import_i18n10.sprintf)( | |
| 1778 | 10220 | /* translators: %s: Name of the block author. */ |
| 1779 | - (0, import_i18n9.__)("By %s"), | |
| 10221 | + (0, import_i18n10.__)("By %s"), | |
| 1780 | 10222 | author |
| 1781 | 10223 | ) }) |
| 1782 | 10224 | ] }) |
| 1783 | 10225 | ] }, id)) }); |
| @@ -1783,9 +10225,9 @@ | ||
| 1783 | 10225 | ] }, id)) }); |
| 1784 | 10226 | } |
| 1785 | 10227 | |
| 1786 | 10228 | // packages/block-directory/build-module/plugins/installed-blocks-pre-publish-panel/index.mjs |
| 1787 | - var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); | |
| 10229 | + var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); | |
| 1788 | 10230 | function InstalledBlocksPrePublishPanel() { |
| 1789 | 10231 | const newBlockTypes = (0, import_data9.useSelect)( |
| 1790 | 10232 | (select) => select(store).getNewBlockTypes(), |
| 1791 | 10233 | [] |
| @@ -1792,14 +10234,14 @@ | ||
| 1792 | 10234 | ); |
| 1793 | 10235 | if (!newBlockTypes.length) { |
| 1794 | 10236 | return null; |
| 1795 | 10237 | } |
| 1796 | - return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)( | |
| 10238 | + return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)( | |
| 1797 | 10239 | import_editor2.PluginPrePublishPanel, |
| 1798 | 10240 | { |
| 1799 | - title: (0, import_i18n10.sprintf)( | |
| 10241 | + title: (0, import_i18n11.sprintf)( | |
| 1800 | 10242 | // translators: %d: number of blocks (number). |
| 1801 | - (0, import_i18n10._n)( | |
| 10243 | + (0, import_i18n11._n)( | |
| 1802 | 10244 | "Added: %d block", |
| 1803 | 10245 | "Added: %d blocks", |
| 1804 | 10246 | newBlockTypes.length |
| 1805 | 10247 | ), |
| @@ -1806,14 +10248,14 @@ | ||
| 1806 | 10248 | newBlockTypes.length |
| 1807 | 10249 | ), |
| 1808 | 10250 | initialOpen: true, |
| 1809 | 10251 | children: [ |
| 1810 | - /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "installed-blocks-pre-publish-panel__copy", children: (0, import_i18n10._n)( | |
| 10252 | + /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "installed-blocks-pre-publish-panel__copy", children: (0, import_i18n11._n)( | |
| 1811 | 10253 | "The following block has been added to your site.", |
| 1812 | 10254 | "The following blocks have been added to your site.", |
| 1813 | 10255 | newBlockTypes.length |
| 1814 | 10256 | ) }), |
| 1815 | - /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CompactList, { items: newBlockTypes }) | |
| 10257 | + /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CompactList, { items: newBlockTypes }) | |
| 1816 | 10258 | ] |
| 1817 | 10259 | } |
| 1818 | 10260 | ); |
| 1819 | 10261 | } |
| @@ -1818,23 +10260,23 @@ | ||
| 1818 | 10260 | ); |
| 1819 | 10261 | } |
| 1820 | 10262 | |
| 1821 | 10263 | // packages/block-directory/build-module/plugins/get-install-missing/index.mjs |
| 1822 | - var import_i18n12 = __toESM(require_i18n(), 1); | |
| 10264 | + var import_i18n13 = __toESM(require_i18n(), 1); | |
| 1823 | 10265 | var import_components6 = __toESM(require_components(), 1); |
| 1824 | 10266 | var import_blocks7 = __toESM(require_blocks(), 1); |
| 1825 | - var import_element7 = __toESM(require_element(), 1); | |
| 10267 | + var import_element21 = __toESM(require_element(), 1); | |
| 1826 | 10268 | var import_data11 = __toESM(require_data(), 1); |
| 1827 | 10269 | var import_core_data2 = __toESM(require_core_data(), 1); |
| 1828 | 10270 | var import_block_editor5 = __toESM(require_block_editor(), 1); |
| 1829 | 10271 | |
| 1830 | 10272 | // packages/block-directory/build-module/plugins/get-install-missing/install-button.mjs |
| 1831 | - var import_i18n11 = __toESM(require_i18n(), 1); | |
| 10273 | + var import_i18n12 = __toESM(require_i18n(), 1); | |
| 1832 | 10274 | var import_components5 = __toESM(require_components(), 1); |
| 1833 | 10275 | var import_blocks6 = __toESM(require_blocks(), 1); |
| 1834 | 10276 | var import_data10 = __toESM(require_data(), 1); |
| 1835 | 10277 | var import_block_editor4 = __toESM(require_block_editor(), 1); |
| 1836 | - var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); | |
| 10278 | + var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); | |
| 1837 | 10279 | function InstallButton({ attributes, block, clientId }) { |
| 1838 | 10280 | const isInstallingBlock = (0, import_data10.useSelect)( |
| 1839 | 10281 | (select) => select(store).isInstalling(block.id), |
| 1840 | 10282 | [block.id] |
| @@ -1840,9 +10282,9 @@ | ||
| 1840 | 10282 | [block.id] |
| 1841 | 10283 | ); |
| 1842 | 10284 | const { installBlockType: installBlockType2 } = (0, import_data10.useDispatch)(store); |
| 1843 | 10285 | const { replaceBlock } = (0, import_data10.useDispatch)(import_block_editor4.store); |
| 1844 | - return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 10286 | + return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( | |
| 1845 | 10287 | import_components5.Button, |
| 1846 | 10288 | { |
| 1847 | 10289 | __next40pxDefaultSize: true, |
| 1848 | 10290 | onClick: () => installBlockType2(block).then((success) => { |
| @@ -1866,11 +10308,11 @@ | ||
| 1866 | 10308 | accessibleWhenDisabled: true, |
| 1867 | 10309 | disabled: isInstallingBlock, |
| 1868 | 10310 | isBusy: isInstallingBlock, |
| 1869 | 10311 | variant: "primary", |
| 1870 | - children: (0, import_i18n11.sprintf)( | |
| 10312 | + children: (0, import_i18n12.sprintf)( | |
| 1871 | 10313 | /* translators: %s: block name */ |
| 1872 | - (0, import_i18n11.__)("Install %s"), | |
| 10314 | + (0, import_i18n12.__)("Install %s"), | |
| 1873 | 10315 | block.title |
| 1874 | 10316 | ) |
| 1875 | 10317 | } |
| 1876 | 10318 | ); |
| @@ -1876,9 +10318,9 @@ | ||
| 1876 | 10318 | ); |
| 1877 | 10319 | } |
| 1878 | 10320 | |
| 1879 | 10321 | // packages/block-directory/build-module/plugins/get-install-missing/index.mjs |
| 1880 | - var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); | |
| 10322 | + var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); | |
| 1881 | 10323 | var getInstallMissing = (OriginalComponent) => (props) => { |
| 1882 | 10324 | const { originalName } = props.attributes; |
| 1883 | 10325 | const { block, hasPermission } = (0, import_data11.useSelect)( |
| 1884 | 10326 | (select) => { |
| @@ -1896,11 +10338,11 @@ | ||
| 1896 | 10338 | }, |
| 1897 | 10339 | [originalName] |
| 1898 | 10340 | ); |
| 1899 | 10341 | if (!hasPermission || !block) { |
| 1900 | - return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(OriginalComponent, { ...props }); | |
| 10342 | + return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(OriginalComponent, { ...props }); | |
| 1901 | 10343 | } |
| 1902 | - return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModifiedWarning, { ...props, originalBlock: block }); | |
| 10344 | + return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ModifiedWarning, { ...props, originalBlock: block }); | |
| 1903 | 10345 | }; |
| 1904 | 10346 | var ModifiedWarning = ({ originalBlock, ...props }) => { |
| 1905 | 10347 | const { originalName, originalUndelimitedContent, clientId } = props.attributes; |
| 1906 | 10348 | const { replaceBlock } = (0, import_data11.useDispatch)(import_block_editor5.store); |
| @@ -1906,11 +10348,9 @@ | ||
| 1906 | 10348 | const { replaceBlock } = (0, import_data11.useDispatch)(import_block_editor5.store); |
| 1907 | 10349 | const convertToHTML = () => { |
| 1908 | 10350 | replaceBlock( |
| 1909 | 10351 | props.clientId, |
| 1910 | - (0, import_blocks7.createBlock)("core/html", { | |
| 1911 | - content: originalUndelimitedContent | |
| 1912 | - }) | |
| 10352 | + (0, import_blocks7.createBlock)("core/html", {}, [], [originalUndelimitedContent]) | |
| 1913 | 10353 | ); |
| 1914 | 10354 | }; |
| 1915 | 10355 | const hasContent = !!originalUndelimitedContent; |
| 1916 | 10356 | const hasHTMLBlock = (0, import_data11.useSelect)( |
| @@ -1922,17 +10362,17 @@ | ||
| 1922 | 10362 | ); |
| 1923 | 10363 | }, |
| 1924 | 10364 | [clientId] |
| 1925 | 10365 | ); |
| 1926 | - let messageHTML = (0, import_i18n12.sprintf)( | |
| 10366 | + let messageHTML = (0, import_i18n13.sprintf)( | |
| 1927 | 10367 | /* translators: %s: block name */ |
| 1928 | - (0, import_i18n12.__)( | |
| 10368 | + (0, import_i18n13.__)( | |
| 1929 | 10369 | "Your site doesn\u2019t include support for the %s block. You can try installing the block or remove it entirely." |
| 1930 | 10370 | ), |
| 1931 | 10371 | originalBlock.title || originalName |
| 1932 | 10372 | ); |
| 1933 | 10373 | const actions = [ |
| 1934 | - /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( | |
| 10374 | + /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( | |
| 1935 | 10375 | InstallButton, |
| 1936 | 10376 | { |
| 1937 | 10377 | block: originalBlock, |
| 1938 | 10378 | attributes: props.attributes, |
| @@ -1941,46 +10381,46 @@ | ||
| 1941 | 10381 | "install" |
| 1942 | 10382 | ) |
| 1943 | 10383 | ]; |
| 1944 | 10384 | if (hasContent && hasHTMLBlock) { |
| 1945 | - messageHTML = (0, import_i18n12.sprintf)( | |
| 10385 | + messageHTML = (0, import_i18n13.sprintf)( | |
| 1946 | 10386 | /* translators: %s: block name */ |
| 1947 | - (0, import_i18n12.__)( | |
| 10387 | + (0, import_i18n13.__)( | |
| 1948 | 10388 | "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." |
| 1949 | 10389 | ), |
| 1950 | 10390 | originalBlock.title || originalName |
| 1951 | 10391 | ); |
| 1952 | 10392 | actions.push( |
| 1953 | - /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( | |
| 10393 | + /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( | |
| 1954 | 10394 | import_components6.Button, |
| 1955 | 10395 | { |
| 1956 | 10396 | __next40pxDefaultSize: true, |
| 1957 | 10397 | onClick: convertToHTML, |
| 1958 | 10398 | variant: "tertiary", |
| 1959 | - children: (0, import_i18n12.__)("Keep as HTML") | |
| 10399 | + children: (0, import_i18n13.__)("Keep as HTML") | |
| 1960 | 10400 | }, |
| 1961 | 10401 | "convert" |
| 1962 | 10402 | ) |
| 1963 | 10403 | ); |
| 1964 | 10404 | } |
| 1965 | - return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ...(0, import_block_editor5.useBlockProps)(), children: [ | |
| 1966 | - /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_block_editor5.Warning, { actions, children: messageHTML }), | |
| 1967 | - /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_element7.RawHTML, { children: originalUndelimitedContent }) | |
| 10405 | + return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { ...(0, import_block_editor5.useBlockProps)(), children: [ | |
| 10406 | + /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_block_editor5.Warning, { actions, children: messageHTML }), | |
| 10407 | + /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_element21.RawHTML, { children: originalUndelimitedContent }) | |
| 1968 | 10408 | ] }); |
| 1969 | 10409 | }; |
| 1970 | 10410 | var get_install_missing_default = getInstallMissing; |
| 1971 | 10411 | |
| 1972 | 10412 | // packages/block-directory/build-module/plugins/index.mjs |
| 1973 | - var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); | |
| 10413 | + var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); | |
| 1974 | 10414 | (0, import_plugins.registerPlugin)("block-directory", { |
| 1975 | 10415 | // The icon is explicitly set to undefined to prevent PluginPrePublishPanel |
| 1976 | 10416 | // from rendering the fallback icon pluginIcon. |
| 1977 | 10417 | icon: void 0, |
| 1978 | 10418 | render() { |
| 1979 | - return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [ | |
| 1980 | - /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoBlockUninstaller, {}), | |
| 1981 | - /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(inserter_menu_downloadable_blocks_panel_default, {}), | |
| 1982 | - /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(InstalledBlocksPrePublishPanel, {}) | |
| 10419 | + return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [ | |
| 10420 | + /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AutoBlockUninstaller, {}), | |
| 10421 | + /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(inserter_menu_downloadable_blocks_panel_default, {}), | |
| 10422 | + /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InstalledBlocksPrePublishPanel, {}) | |
| 1983 | 10423 | ] }); |
| 1984 | 10424 | } |
| 1985 | 10425 | }); |
| 1986 | 10426 | (0, import_hooks.addFilter)( |
| @@ -1994,6 +10434,32 @@ | ||
| 1994 | 10434 | return settings; |
| 1995 | 10435 | } |
| 1996 | 10436 | ); |
| 1997 | 10437 | return __toCommonJS(index_exports); |
| 10438 | +})(); | |
| 10439 | +/*! Bundled license information: | |
| 10440 | + | |
| 10441 | +use-sync-external-store/cjs/use-sync-external-store-shim.development.js: | |
| 10442 | + (** | |
| 10443 | + * @license React | |
| 10444 | + * use-sync-external-store-shim.development.js | |
| 10445 | + * | |
| 10446 | + * Copyright (c) Meta Platforms, Inc. and affiliates. | |
| 10447 | + * | |
| 10448 | + * This source code is licensed under the MIT license found in the | |
| 10449 | + * LICENSE file in the root directory of this source tree. | |
| 10450 | + *) | |
| 10451 | + | |
| 10452 | +use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: | |
| 10453 | + (** | |
| 10454 | + * @license React | |
| 10455 | + * use-sync-external-store-shim/with-selector.development.js | |
| 10456 | + * | |
| 10457 | + * Copyright (c) Meta Platforms, Inc. and affiliates. | |
| 10458 | + * | |
| 10459 | + * This source code is licensed under the MIT license found in the | |
| 10460 | + * LICENSE file in the root directory of this source tree. | |
| 10461 | + *) | |
| 10462 | +*/ | |
| 10463 | +(window.wp ||= {}).blockDirectory = wp.blockDirectory; | |
| 1998 | 10464 | })(); |
| 1999 | 10465 | //# sourceMappingURL=index.js.map |