| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 (function() { 2 var wp; 3 (wp ||= {}).editPost = (() => { 4 var __create = Object.create; 5 var __defProp = Object.defineProperty; 6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 7 var __getOwnPropNames = Object.getOwnPropertyNames; 8 var __getProtoOf = Object.getPrototypeOf; 9 var __hasOwnProp = Object.prototype.hasOwnProperty; 10 var __commonJS = (cb, mod) => function __require() { 11 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 12 }; 13 var __export = (target, all) => { 14 for (var name in all) 15 __defProp(target, name, { get: all[name], enumerable: true }); 16 }; 17 var __copyProps = (to, from, except, desc) => { 18 if (from && typeof from === "object" || typeof from === "function") { 19 for (let key of __getOwnPropNames(from)) 20 if (!__hasOwnProp.call(to, key) && key !== except) 21 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 22 } 23 return to; 24 }; 25 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 26 // If the importer is in node compatibility mode or this is not an ESM 27 // file that has been converted to a CommonJS file using a Babel- 28 // compatible transform (i.e. "__esModule" has not been set), then set 29 // "default" to the CommonJS "module.exports" for node compatibility. 30 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 31 mod 32 )); 33 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 34 35 // package-external:@wordpress/blocks 36 var require_blocks = __commonJS({ 37 "package-external:@wordpress/blocks"(exports, module) { 38 module.exports = window.wp.blocks; 39 } 40 }); 41 42 // package-external:@wordpress/block-library 43 var require_block_library = __commonJS({ 44 "package-external:@wordpress/block-library"(exports, module) { 45 module.exports = window.wp.blockLibrary; 46 } 47 }); 48 49 // package-external:@wordpress/deprecated 50 var require_deprecated = __commonJS({ 51 "package-external:@wordpress/deprecated"(exports, module) { 52 module.exports = window.wp.deprecated; 53 } 54 }); 55 56 // package-external:@wordpress/element 57 var require_element = __commonJS({ 58 "package-external:@wordpress/element"(exports, module) { 59 module.exports = window.wp.element; 60 } 61 }); 62 63 // package-external:@wordpress/data 64 var require_data = __commonJS({ 65 "package-external:@wordpress/data"(exports, module) { 66 module.exports = window.wp.data; 67 } 68 }); 69 70 // package-external:@wordpress/preferences 71 var require_preferences = __commonJS({ 72 "package-external:@wordpress/preferences"(exports, module) { 73 module.exports = window.wp.preferences; 74 } 75 }); 76 77 // package-external:@wordpress/widgets 78 var require_widgets = __commonJS({ 79 "package-external:@wordpress/widgets"(exports, module) { 80 module.exports = window.wp.widgets; 81 } 82 }); 83 84 // package-external:@wordpress/editor 85 var require_editor = __commonJS({ 86 "package-external:@wordpress/editor"(exports, module) { 87 module.exports = window.wp.editor; 88 } 89 }); 90 91 // package-external:@wordpress/core-data 92 var require_core_data = __commonJS({ 93 "package-external:@wordpress/core-data"(exports, module) { 94 module.exports = window.wp.coreData; 95 } 96 }); 97 98 // package-external:@wordpress/api-fetch 99 var require_api_fetch = __commonJS({ 100 "package-external:@wordpress/api-fetch"(exports, module) { 101 module.exports = window.wp.apiFetch; 102 } 103 }); 104 105 // package-external:@wordpress/i18n 106 var require_i18n = __commonJS({ 107 "package-external:@wordpress/i18n"(exports, module) { 108 module.exports = window.wp.i18n; 109 } 110 }); 111 112 // vendor-external:react 113 var require_react = __commonJS({ 114 "vendor-external:react"(exports, module) { 115 module.exports = window.React; 116 } 117 }); 118 119 // vendor-external:react/jsx-runtime 120 var require_jsx_runtime = __commonJS({ 121 "vendor-external:react/jsx-runtime"(exports, module) { 122 module.exports = window.ReactJSXRuntime; 123 } 124 }); 125 126 // vendor-external:react-dom 127 var require_react_dom = __commonJS({ 128 "vendor-external:react-dom"(exports, module) { 129 module.exports = window.ReactDOM; 130 } 131 }); 132 133 // package-external:@wordpress/primitives 134 var require_primitives = __commonJS({ 135 "package-external:@wordpress/primitives"(exports, module) { 136 module.exports = window.wp.primitives; 137 } 138 }); 139 140 // node_modules/.store/use-sync-external-store@1.7.0-jHNF5n8408rkWhZ5NHKclA/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js 141 var require_use_sync_external_store_shim_development = __commonJS({ 142 "node_modules/.store/use-sync-external-store@1.7.0-jHNF5n8408rkWhZ5NHKclA/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { 143 "use strict"; 144 (function() { 145 function is(x, y) { 146 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; 147 } 148 function useSyncExternalStore$2(subscribe, getSnapshot) { 149 didWarnOld18Alpha || void 0 === React49.startTransition || (didWarnOld18Alpha = true, console.error( 150 "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." 151 )); 152 var value = getSnapshot(); 153 if (!didWarnUncachedGetSnapshot) { 154 var cachedValue = getSnapshot(); 155 objectIs(value, cachedValue) || (console.error( 156 "The result of getSnapshot should be cached to avoid an infinite loop" 157 ), didWarnUncachedGetSnapshot = true); 158 } 159 cachedValue = useState16({ 160 inst: { value, getSnapshot } 161 }); 162 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; 163 useLayoutEffect4( 164 function() { 165 inst.value = value; 166 inst.getSnapshot = getSnapshot; 167 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 168 }, 169 [subscribe, value, getSnapshot] 170 ); 171 useEffect17( 172 function() { 173 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 174 return subscribe(function() { 175 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 176 }); 177 }, 178 [subscribe] 179 ); 180 useDebugValue2(value); 181 return value; 182 } 183 function checkIfSnapshotChanged(inst) { 184 var latestGetSnapshot = inst.getSnapshot; 185 inst = inst.value; 186 try { 187 var nextValue = latestGetSnapshot(); 188 return !objectIs(inst, nextValue); 189 } catch (error) { 190 return true; 191 } 192 } 193 function useSyncExternalStore$1(subscribe, getSnapshot) { 194 return getSnapshot(); 195 } 196 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 197 var React49 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState16 = React49.useState, useEffect17 = React49.useEffect, useLayoutEffect4 = React49.useLayoutEffect, useDebugValue2 = React49.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; 198 exports.useSyncExternalStore = void 0 !== React49.useSyncExternalStore ? React49.useSyncExternalStore : shim; 199 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 200 })(); 201 } 202 }); 203 204 // node_modules/.store/use-sync-external-store@1.7.0-jHNF5n8408rkWhZ5NHKclA/node_modules/use-sync-external-store/shim/index.js 205 var require_shim = __commonJS({ 206 "node_modules/.store/use-sync-external-store@1.7.0-jHNF5n8408rkWhZ5NHKclA/node_modules/use-sync-external-store/shim/index.js"(exports, module) { 207 "use strict"; 208 if (false) { 209 module.exports = null; 210 } else { 211 module.exports = require_use_sync_external_store_shim_development(); 212 } 213 } 214 }); 215 216 // node_modules/.store/use-sync-external-store@1.7.0-jHNF5n8408rkWhZ5NHKclA/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js 217 var require_with_selector_development = __commonJS({ 218 "node_modules/.store/use-sync-external-store@1.7.0-jHNF5n8408rkWhZ5NHKclA/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { 219 "use strict"; 220 (function() { 221 function is(x, y) { 222 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; 223 } 224 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 225 var React49 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef23 = React49.useRef, useEffect17 = React49.useEffect, useMemo17 = React49.useMemo, useDebugValue2 = React49.useDebugValue; 226 exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { 227 var instRef = useRef23(null); 228 if (null === instRef.current) { 229 var inst = { hasValue: false, value: null }; 230 instRef.current = inst; 231 } else inst = instRef.current; 232 instRef = useMemo17( 233 function() { 234 function memoizedSelector(nextSnapshot) { 235 if (!hasMemo) { 236 hasMemo = true; 237 memoizedSnapshot = nextSnapshot; 238 nextSnapshot = selector(nextSnapshot); 239 if (void 0 !== isEqual && inst.hasValue) { 240 var currentSelection = inst.value; 241 if (isEqual(currentSelection, nextSnapshot)) 242 return memoizedSelection = currentSelection; 243 } 244 return memoizedSelection = nextSnapshot; 245 } 246 currentSelection = memoizedSelection; 247 if (objectIs(memoizedSnapshot, nextSnapshot)) 248 return currentSelection; 249 var nextSelection = selector(nextSnapshot); 250 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) 251 return memoizedSnapshot = nextSnapshot, currentSelection; 252 memoizedSnapshot = nextSnapshot; 253 return memoizedSelection = nextSelection; 254 } 255 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; 256 return [ 257 function() { 258 return memoizedSelector(getSnapshot()); 259 }, 260 null === maybeGetServerSnapshot ? void 0 : function() { 261 return memoizedSelector(maybeGetServerSnapshot()); 262 } 263 ]; 264 }, 265 [getSnapshot, getServerSnapshot, selector, isEqual] 266 ); 267 var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]); 268 useEffect17( 269 function() { 270 inst.hasValue = true; 271 inst.value = value; 272 }, 273 [value] 274 ); 275 useDebugValue2(value); 276 return value; 277 }; 278 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 279 })(); 280 } 281 }); 282 283 // node_modules/.store/use-sync-external-store@1.7.0-jHNF5n8408rkWhZ5NHKclA/node_modules/use-sync-external-store/shim/with-selector.js 284 var require_with_selector = __commonJS({ 285 "node_modules/.store/use-sync-external-store@1.7.0-jHNF5n8408rkWhZ5NHKclA/node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { 286 "use strict"; 287 if (false) { 288 module.exports = null; 289 } else { 290 module.exports = require_with_selector_development(); 291 } 292 } 293 }); 294 295 // package-external:@wordpress/compose 296 var require_compose = __commonJS({ 297 "package-external:@wordpress/compose"(exports, module) { 298 module.exports = window.wp.compose; 299 } 300 }); 301 302 // package-external:@wordpress/theme 303 var require_theme = __commonJS({ 304 "package-external:@wordpress/theme"(exports, module) { 305 module.exports = window.wp.theme; 306 } 307 }); 308 309 // package-external:@wordpress/private-apis 310 var require_private_apis = __commonJS({ 311 "package-external:@wordpress/private-apis"(exports, module) { 312 module.exports = window.wp.privateApis; 313 } 314 }); 315 316 // package-external:@wordpress/components 317 var require_components = __commonJS({ 318 "package-external:@wordpress/components"(exports, module) { 319 module.exports = window.wp.components; 320 } 321 }); 322 323 // package-external:@wordpress/block-editor 324 var require_block_editor = __commonJS({ 325 "package-external:@wordpress/block-editor"(exports, module) { 326 module.exports = window.wp.blockEditor; 327 } 328 }); 329 330 // package-external:@wordpress/style-engine 331 var require_style_engine = __commonJS({ 332 "package-external:@wordpress/style-engine"(exports, module) { 333 module.exports = window.wp.styleEngine; 334 } 335 }); 336 337 // package-external:@wordpress/plugins 338 var require_plugins = __commonJS({ 339 "package-external:@wordpress/plugins"(exports, module) { 340 module.exports = window.wp.plugins; 341 } 342 }); 343 344 // package-external:@wordpress/notices 345 var require_notices = __commonJS({ 346 "package-external:@wordpress/notices"(exports, module) { 347 module.exports = window.wp.notices; 348 } 349 }); 350 351 // package-external:@wordpress/commands 352 var require_commands = __commonJS({ 353 "package-external:@wordpress/commands"(exports, module) { 354 module.exports = window.wp.commands; 355 } 356 }); 357 358 // package-external:@wordpress/url 359 var require_url = __commonJS({ 360 "package-external:@wordpress/url"(exports, module) { 361 module.exports = window.wp.url; 362 } 363 }); 364 365 // package-external:@wordpress/html-entities 366 var require_html_entities = __commonJS({ 367 "package-external:@wordpress/html-entities"(exports, module) { 368 module.exports = window.wp.htmlEntities; 369 } 370 }); 371 372 // package-external:@wordpress/keyboard-shortcuts 373 var require_keyboard_shortcuts = __commonJS({ 374 "package-external:@wordpress/keyboard-shortcuts"(exports, module) { 375 module.exports = window.wp.keyboardShortcuts; 376 } 377 }); 378 379 // package-external:@wordpress/hooks 380 var require_hooks = __commonJS({ 381 "package-external:@wordpress/hooks"(exports, module) { 382 module.exports = window.wp.hooks; 383 } 384 }); 385 386 // package-external:@wordpress/keycodes 387 var require_keycodes = __commonJS({ 388 "package-external:@wordpress/keycodes"(exports, module) { 389 module.exports = window.wp.keycodes; 390 } 391 }); 392 393 // packages/edit-post/build-module/index.mjs 394 var index_exports = {}; 395 __export(index_exports, { 396 PluginBlockSettingsMenuItem: () => PluginBlockSettingsMenuItem, 397 PluginDocumentSettingPanel: () => PluginDocumentSettingPanel, 398 PluginMoreMenuItem: () => PluginMoreMenuItem, 399 PluginPostPublishPanel: () => PluginPostPublishPanel, 400 PluginPostStatusInfo: () => PluginPostStatusInfo, 401 PluginPrePublishPanel: () => PluginPrePublishPanel, 402 PluginSidebar: () => PluginSidebar, 403 PluginSidebarMoreMenuItem: () => PluginSidebarMoreMenuItem, 404 __experimentalFullscreenModeClose: () => fullscreen_mode_close_default, 405 __experimentalMainDashboardButton: () => __experimentalMainDashboardButton, 406 __experimentalPluginPostExcerpt: () => __experimentalPluginPostExcerpt, 407 initializeEditor: () => initializeEditor, 408 reinitializeEditor: () => reinitializeEditor, 409 store: () => store 410 }); 411 var import_blocks2 = __toESM(require_blocks(), 1); 412 var import_block_library = __toESM(require_block_library(), 1); 413 var import_deprecated4 = __toESM(require_deprecated(), 1); 414 var import_element30 = __toESM(require_element(), 1); 415 var import_data27 = __toESM(require_data(), 1); 416 var import_preferences11 = __toESM(require_preferences(), 1); 417 var import_widgets = __toESM(require_widgets(), 1); 418 var import_editor21 = __toESM(require_editor(), 1); 419 var import_core_data10 = __toESM(require_core_data(), 1); 420 var import_api_fetch2 = __toESM(require_api_fetch(), 1); 421 422 // node_modules/.store/clsx@2.1.1-XOLP1vUL9vEGfpiXm37fAw/node_modules/clsx/dist/clsx.mjs 423 function r(e) { 424 var t, f, n = ""; 425 if ("string" == typeof e || "number" == typeof e) n += e; 426 else if ("object" == typeof e) if (Array.isArray(e)) { 427 var o = e.length; 428 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); 429 } else for (f in e) e[f] && (n && (n += " "), n += f); 430 return n; 431 } 432 function clsx() { 433 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); 434 return n; 435 } 436 var clsx_default = clsx; 437 438 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useRenderElement.mjs 439 var React4 = __toESM(require_react(), 1); 440 441 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useRefWithInit.mjs 442 var React = __toESM(require_react(), 1); 443 var UNINITIALIZED = {}; 444 function useRefWithInit(init, initArg) { 445 const ref = React.useRef(UNINITIALIZED); 446 if (ref.current === UNINITIALIZED) { 447 ref.current = init(initArg); 448 } 449 return ref; 450 } 451 452 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useMergedRefs.mjs 453 function useMergedRefs(a, b, c, d) { 454 const forkRef = useRefWithInit(createForkRef).current; 455 if (didChange(forkRef, a, b, c, d)) { 456 update(forkRef, [a, b, c, d]); 457 } 458 return forkRef.callback; 459 } 460 function useMergedRefsN(refs) { 461 const forkRef = useRefWithInit(createForkRef).current; 462 if (didChangeN(forkRef, refs)) { 463 update(forkRef, refs); 464 } 465 return forkRef.callback; 466 } 467 function createForkRef() { 468 return { 469 callback: null, 470 cleanup: null, 471 refs: [] 472 }; 473 } 474 function didChange(forkRef, a, b, c, d) { 475 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; 476 } 477 function didChangeN(forkRef, newRefs) { 478 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); 479 } 480 function update(forkRef, refs) { 481 forkRef.refs = refs; 482 if (refs.every((ref) => ref == null)) { 483 forkRef.callback = null; 484 return; 485 } 486 forkRef.callback = (instance) => { 487 if (forkRef.cleanup) { 488 forkRef.cleanup(); 489 forkRef.cleanup = null; 490 } 491 if (instance != null) { 492 const cleanupCallbacks = Array(refs.length).fill(null); 493 for (let i = 0; i < refs.length; i += 1) { 494 const ref = refs[i]; 495 if (ref == null) { 496 continue; 497 } 498 switch (typeof ref) { 499 case "function": { 500 const refCleanup = ref(instance); 501 if (typeof refCleanup === "function") { 502 cleanupCallbacks[i] = refCleanup; 503 } 504 break; 505 } 506 case "object": { 507 ref.current = instance; 508 break; 509 } 510 default: 511 } 512 } 513 forkRef.cleanup = () => { 514 for (let i = 0; i < refs.length; i += 1) { 515 const ref = refs[i]; 516 if (ref == null) { 517 continue; 518 } 519 switch (typeof ref) { 520 case "function": { 521 const cleanupCallback = cleanupCallbacks[i]; 522 if (typeof cleanupCallback === "function") { 523 cleanupCallback(); 524 } else { 525 void ref(null); 526 } 527 break; 528 } 529 case "object": { 530 ref.current = null; 531 break; 532 } 533 default: 534 } 535 } 536 }; 537 } 538 }; 539 } 540 541 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/getReactElementRef.mjs 542 var React3 = __toESM(require_react(), 1); 543 544 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/reactVersion.mjs 545 var React2 = __toESM(require_react(), 1); 546 var majorVersion = parseInt(React2.version, 10); 547 function isReactVersionAtLeast(reactVersionToCheck) { 548 return majorVersion >= reactVersionToCheck; 549 } 550 551 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/getReactElementRef.mjs 552 function getReactElementRef(element) { 553 if (!/* @__PURE__ */ React3.isValidElement(element)) { 554 return null; 555 } 556 const reactElement = element; 557 const propsWithRef = reactElement.props; 558 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 559 } 560 561 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/mergeObjects.mjs 562 function mergeObjects(a, b) { 563 if (a && !b) { 564 return a; 565 } 566 if (!a && b) { 567 return b; 568 } 569 if (a || b) { 570 return { 571 ...a, 572 ...b 573 }; 574 } 575 return void 0; 576 } 577 578 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/createLogOnce.mjs 579 var loggedMessages; 580 if (true) { 581 loggedMessages = /* @__PURE__ */ new Set(); 582 } 583 function createLogOnce(severity, prefix) { 584 return function logOnce(...messages) { 585 if (true) { 586 const message = messages.join(" "); 587 const output = prefix ? `$prefix}: $message}` : message; 588 const key = `$severity}:$output}`; 589 if (!loggedMessages.has(key)) { 590 loggedMessages.add(key); 591 if (severity === "warn") { 592 console.warn(output); 593 } else { 594 console.error(output); 595 } 596 } 597 } 598 }; 599 } 600 601 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/warn.mjs 602 var warn = createLogOnce("warn", "Base UI"); 603 604 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/empty.mjs 605 function NOOP() { 606 } 607 var EMPTY_ARRAY = Object.freeze([]); 608 var EMPTY_OBJECT = Object.freeze({}); 609 610 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/getStateAttributesProps.mjs 611 function getStateAttributesProps(state, customMapping) { 612 const props = {}; 613 for (const key in state) { 614 const value = state[key]; 615 if (customMapping?.hasOwnProperty(key)) { 616 const customProps = customMapping[key](value); 617 if (customProps != null) { 618 Object.assign(props, customProps); 619 } 620 continue; 621 } 622 if (value === true) { 623 props[`data-$key.toLowerCase()}`] = ""; 624 } else if (value) { 625 props[`data-$key.toLowerCase()}`] = value.toString(); 626 } 627 } 628 return props; 629 } 630 631 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/resolveClassName.mjs 632 function resolveClassName(className, state) { 633 return typeof className === "function" ? className(state) : className; 634 } 635 636 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/resolveStyle.mjs 637 function resolveStyle(style, state) { 638 return typeof style === "function" ? style(state) : style; 639 } 640 641 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/merge-props/mergeProps.mjs 642 var EMPTY_PROPS = {}; 643 function mergeProps(a, b, c, d, e) { 644 if (!c && !d && !e && !a) { 645 return createInitialMergedProps(b); 646 } 647 let merged = createInitialMergedProps(a); 648 if (b) { 649 merged = mergeInto(merged, b); 650 } 651 if (c) { 652 merged = mergeInto(merged, c); 653 } 654 if (d) { 655 merged = mergeInto(merged, d); 656 } 657 if (e) { 658 merged = mergeInto(merged, e); 659 } 660 return merged; 661 } 662 function mergePropsN(props) { 663 if (props.length === 0) { 664 return EMPTY_PROPS; 665 } 666 if (props.length === 1) { 667 return createInitialMergedProps(props[0]); 668 } 669 let merged = createInitialMergedProps(props[0]); 670 for (let i = 1; i < props.length; i += 1) { 671 merged = mergeInto(merged, props[i]); 672 } 673 return merged; 674 } 675 function createInitialMergedProps(inputProps) { 676 if (isPropsGetter(inputProps)) { 677 return { 678 ...inputProps(EMPTY_PROPS) 679 }; 680 } 681 return copyInitialProps(inputProps); 682 } 683 function mergeInto(merged, inputProps) { 684 if (isPropsGetter(inputProps)) { 685 return inputProps(merged); 686 } 687 return mutablyMergeInto(merged, inputProps); 688 } 689 function copyInitialProps(inputProps) { 690 const copiedProps = { 691 ...inputProps 692 }; 693 for (const propName in copiedProps) { 694 const propValue = copiedProps[propName]; 695 if (isEventHandler(propName, propValue)) { 696 copiedProps[propName] = wrapEventHandler(propValue); 697 } 698 } 699 return copiedProps; 700 } 701 function mutablyMergeInto(mergedProps, externalProps) { 702 if (!externalProps) { 703 return mergedProps; 704 } 705 for (const propName in externalProps) { 706 const externalPropValue = externalProps[propName]; 707 switch (propName) { 708 case "style": { 709 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 710 break; 711 } 712 case "className": { 713 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 714 break; 715 } 716 default: { 717 if (isEventHandler(propName, externalPropValue)) { 718 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 719 } else { 720 mergedProps[propName] = externalPropValue; 721 } 722 } 723 } 724 } 725 return mergedProps; 726 } 727 function isEventHandler(key, value) { 728 const code0 = key.charCodeAt(0); 729 const code1 = key.charCodeAt(1); 730 const code2 = key.charCodeAt(2); 731 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 732 } 733 function isPropsGetter(inputProps) { 734 return typeof inputProps === "function"; 735 } 736 function mergeEventHandlers(ourHandler, theirHandler) { 737 if (!theirHandler) { 738 return ourHandler; 739 } 740 if (!ourHandler) { 741 return wrapEventHandler(theirHandler); 742 } 743 return (...args) => { 744 const event = args[0]; 745 if (isSyntheticEvent(event)) { 746 const baseUIEvent = event; 747 makeEventPreventable(baseUIEvent); 748 const result2 = theirHandler(...args); 749 if (!baseUIEvent.baseUIHandlerPrevented) { 750 ourHandler?.(...args); 751 } 752 return result2; 753 } 754 const result = theirHandler(...args); 755 ourHandler?.(...args); 756 return result; 757 }; 758 } 759 function wrapEventHandler(handler) { 760 if (!handler) { 761 return handler; 762 } 763 return (...args) => { 764 const event = args[0]; 765 if (isSyntheticEvent(event)) { 766 makeEventPreventable(event); 767 } 768 return handler(...args); 769 }; 770 } 771 function makeEventPreventable(event) { 772 event.preventBaseUIHandler = () => { 773 event.baseUIHandlerPrevented = true; 774 }; 775 return event; 776 } 777 function mergeClassNames(ourClassName, theirClassName) { 778 if (theirClassName) { 779 if (ourClassName) { 780 return theirClassName + " " + ourClassName; 781 } 782 return theirClassName; 783 } 784 return ourClassName; 785 } 786 function isSyntheticEvent(event) { 787 return event != null && typeof event === "object" && "nativeEvent" in event; 788 } 789 790 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useRenderElement.mjs 791 var import_react = __toESM(require_react(), 1); 792 function useRenderElement(element, componentProps, params = {}) { 793 let renderProp = componentProps.render; 794 if (params.enabled !== false) { 795 renderProp = unwrapLazyRenderProp(renderProp); 796 } 797 const outProps = useRenderElementProps(componentProps, params, renderProp); 798 if (params.enabled === false) { 799 return null; 800 } 801 const state = params.state ?? EMPTY_OBJECT; 802 return evaluateRenderProp(element, renderProp, outProps, state); 803 } 804 function useRenderElementProps(componentProps, params, renderProp) { 805 const { 806 className: classNameProp, 807 style: styleProp 808 } = componentProps; 809 const { 810 state = EMPTY_OBJECT, 811 ref, 812 props, 813 stateAttributesMapping, 814 enabled = true 815 } = params; 816 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 817 const style = enabled ? resolveStyle(styleProp, state) : void 0; 818 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT; 819 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 820 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 821 if (typeof document !== "undefined") { 822 if (!enabled) { 823 void useMergedRefs(null, null); 824 } else if (Array.isArray(ref)) { 825 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 826 } else { 827 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 828 } 829 } 830 if (!enabled) { 831 return EMPTY_OBJECT; 832 } 833 if (className !== void 0) { 834 outProps.className = mergeClassNames(outProps.className, className); 835 } 836 if (style !== void 0) { 837 outProps.style = mergeObjects(outProps.style, style); 838 } 839 return outProps; 840 } 841 function resolveRenderFunctionProps(props) { 842 if (Array.isArray(props)) { 843 return mergePropsN(props); 844 } 845 return mergeProps(void 0, props); 846 } 847 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 848 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 849 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 850 function unwrapLazyRenderProp(render) { 851 if (render?.$$typeof !== REACT_LAZY_TYPE) { 852 return render; 853 } 854 const unwrapped = React4.Children.toArray(render)[0]; 855 return /* @__PURE__ */ React4.isValidElement(unwrapped) ? unwrapped : render; 856 } 857 function evaluateRenderProp(element, render, props, state) { 858 if (render) { 859 if (typeof render === "function") { 860 if (true) { 861 warnIfRenderPropLooksLikeComponent(render); 862 } 863 return render(props, state); 864 } 865 const mergedProps = mergeProps(props, render.props); 866 mergedProps.ref = props.ref; 867 if (true) { 868 if (!/* @__PURE__ */ React4.isValidElement(render)) { 869 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")); 870 } 871 } 872 return /* @__PURE__ */ React4.cloneElement(render, mergedProps); 873 } 874 return renderTag(element, props); 875 } 876 function warnIfRenderPropLooksLikeComponent(renderFn) { 877 const functionName = renderFn.name; 878 if (functionName.length === 0) { 879 return; 880 } 881 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 882 return; 883 } 884 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 885 return; 886 } 887 warn(`The \`render\` prop received a function named \`$functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop"); 888 } 889 function renderTag(Tag, props) { 890 if (Tag === "button") { 891 return /* @__PURE__ */ (0, import_react.createElement)("button", { 892 type: "button", 893 ...props, 894 key: props.key 895 }); 896 } 897 if (Tag === "img") { 898 return /* @__PURE__ */ (0, import_react.createElement)("img", { 899 alt: "", 900 ...props, 901 key: props.key 902 }); 903 } 904 return /* @__PURE__ */ React4.createElement(Tag, props); 905 } 906 907 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/safeReact.mjs 908 var React5 = __toESM(require_react(), 1); 909 var SafeReact = { 910 ...React5 911 }; 912 913 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useStableCallback.mjs 914 var useInsertionEffect = SafeReact.useInsertionEffect; 915 var useSafeInsertionEffect = ( 916 // React 17 doesn't have useInsertionEffect. 917 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. 918 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() 919 ); 920 function useStableCallback(callback) { 921 const stable = useRefWithInit(createStableCallback).current; 922 stable.next = callback; 923 useSafeInsertionEffect(stable.effect); 924 return stable.trampoline; 925 } 926 function createStableCallback() { 927 const stable = { 928 next: void 0, 929 callback: assertNotCalled, 930 trampoline: (...args) => stable.callback?.(...args), 931 effect: () => { 932 stable.callback = stable.next; 933 } 934 }; 935 return stable; 936 } 937 function assertNotCalled() { 938 if (true) { 939 throw ( 940 /* minify-error-disabled */ 941 new Error("Base UI: Cannot call an event handler while rendering.") 942 ); 943 } 944 } 945 946 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useIsoLayoutEffect.mjs 947 var React6 = __toESM(require_react(), 1); 948 var noop = () => { 949 }; 950 var useIsoLayoutEffect = typeof document !== "undefined" ? React6.useLayoutEffect : noop; 951 952 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 953 var React8 = __toESM(require_react(), 1); 954 955 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 956 var ReactDOM = __toESM(require_react_dom(), 1); 957 958 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useOnMount.mjs 959 var React7 = __toESM(require_react(), 1); 960 function useOnMount(fn) { 961 React7.useEffect(fn, EMPTY_ARRAY); 962 } 963 964 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useAnimationFrame.mjs 965 var EMPTY = null; 966 var LAST_RAF = globalThis.requestAnimationFrame; 967 var Scheduler = class { 968 /* This implementation uses an array as a backing data-structure for frame callbacks. 969 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it 970 * never calls the native `cancelAnimationFrame` if there are no frames left. This can 971 * be much more efficient if there is a call pattern that alterns as 972 * "request-cancel-request-cancel-…". 973 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation 974 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ 975 callbacks = []; 976 callbacksCount = 0; 977 nextId = 1; 978 startId = 1; 979 isScheduled = false; 980 tick = (timestamp) => { 981 this.isScheduled = false; 982 const currentCallbacks = this.callbacks; 983 const currentCallbacksCount = this.callbacksCount; 984 this.callbacks = []; 985 this.callbacksCount = 0; 986 this.startId = this.nextId; 987 if (currentCallbacksCount > 0) { 988 for (let i = 0; i < currentCallbacks.length; i += 1) { 989 currentCallbacks[i]?.(timestamp); 990 } 991 } 992 }; 993 request(fn) { 994 const id = this.nextId; 995 this.nextId += 1; 996 this.callbacks.push(fn); 997 this.callbacksCount += 1; 998 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); 999 if (!this.isScheduled || didRAFChange) { 1000 requestAnimationFrame(this.tick); 1001 this.isScheduled = true; 1002 } 1003 return id; 1004 } 1005 cancel(id) { 1006 const index2 = id - this.startId; 1007 if (index2 < 0 || index2 >= this.callbacks.length) { 1008 return; 1009 } 1010 if (this.callbacks[index2] === null) { 1011 return; 1012 } 1013 this.callbacks[index2] = null; 1014 this.callbacksCount -= 1; 1015 } 1016 }; 1017 var scheduler = new Scheduler(); 1018 var AnimationFrame = class _AnimationFrame { 1019 static create() { 1020 return new _AnimationFrame(); 1021 } 1022 static request(fn) { 1023 return scheduler.request(fn); 1024 } 1025 static cancel(id) { 1026 return scheduler.cancel(id); 1027 } 1028 currentId = EMPTY; 1029 /** 1030 * Executes `fn` after `delay`, clearing any previously scheduled call. 1031 */ 1032 request(fn) { 1033 this.cancel(); 1034 this.currentId = scheduler.request(() => { 1035 this.currentId = EMPTY; 1036 fn(); 1037 }); 1038 } 1039 cancel = () => { 1040 if (this.currentId !== EMPTY) { 1041 scheduler.cancel(this.currentId); 1042 this.currentId = EMPTY; 1043 } 1044 }; 1045 disposeEffect = () => { 1046 return this.cancel; 1047 }; 1048 }; 1049 function useAnimationFrame() { 1050 const timeout = useRefWithInit(AnimationFrame.create).current; 1051 useOnMount(timeout.disposeEffect); 1052 return timeout; 1053 } 1054 1055 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/resolveRef.mjs 1056 function resolveRef(maybeRef) { 1057 if (maybeRef == null) { 1058 return maybeRef; 1059 } 1060 return "current" in maybeRef ? maybeRef.current : maybeRef; 1061 } 1062 1063 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/getFiniteAnimations.mjs 1064 function getFiniteAnimations(element, options) { 1065 return element.getAnimations(options).filter((animation) => { 1066 const timing = animation.effect?.getTiming(); 1067 return timing?.duration !== Infinity && timing?.iterations !== Infinity; 1068 }); 1069 } 1070 1071 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs 1072 var startingStyle = "data-starting-style"; 1073 var endingStyle = "data-ending-style"; 1074 1075 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 1076 var pendingCallbacks = null; 1077 function flushBeforePaint(fn) { 1078 if (!pendingCallbacks) { 1079 const callbacks = []; 1080 pendingCallbacks = callbacks; 1081 queueMicrotask(() => { 1082 pendingCallbacks = null; 1083 ReactDOM.flushSync(() => { 1084 for (const callback of callbacks) { 1085 callback(); 1086 } 1087 }); 1088 }); 1089 } 1090 pendingCallbacks.push(fn); 1091 } 1092 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch = false) { 1093 const frame = useAnimationFrame(); 1094 return useStableCallback((fnToExecute, signal = null) => { 1095 frame.cancel(); 1096 const element = resolveRef(elementOrRef); 1097 if (element == null) { 1098 return; 1099 } 1100 const resolvedElement = element; 1101 const done = () => { 1102 if (!batch) { 1103 ReactDOM.flushSync(fnToExecute); 1104 return; 1105 } 1106 flushBeforePaint(() => { 1107 if (!signal?.aborted) { 1108 fnToExecute(); 1109 } 1110 }); 1111 }; 1112 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { 1113 fnToExecute(); 1114 return; 1115 } 1116 function exec() { 1117 Promise.all(getFiniteAnimations(resolvedElement).map((animation) => animation.finished.then(NOOP))).then(() => { 1118 if (!signal?.aborted) { 1119 done(); 1120 } 1121 }, () => { 1122 if (signal?.aborted) { 1123 return; 1124 } 1125 const currentAnimations = getFiniteAnimations(resolvedElement); 1126 if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { 1127 exec(); 1128 return; 1129 } 1130 done(); 1131 }); 1132 } 1133 if (waitForStartingStyleRemoved) { 1134 const startingStyleAttribute = startingStyle; 1135 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 1136 frame.request(exec); 1137 return; 1138 } 1139 const attributeObserver = new MutationObserver(() => { 1140 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 1141 attributeObserver.disconnect(); 1142 exec(); 1143 } 1144 }); 1145 attributeObserver.observe(resolvedElement, { 1146 attributes: true, 1147 attributeFilter: [startingStyleAttribute] 1148 }); 1149 signal?.addEventListener("abort", () => attributeObserver.disconnect(), { 1150 once: true 1151 }); 1152 return; 1153 } 1154 frame.request(exec); 1155 }); 1156 } 1157 1158 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 1159 function useOpenChangeComplete(parameters) { 1160 const { 1161 enabled = true, 1162 open: open2, 1163 ref, 1164 batch = false, 1165 onComplete: onCompleteParam 1166 } = parameters; 1167 const onComplete = useStableCallback(onCompleteParam); 1168 const runOnceAnimationsFinish = useAnimationsFinished(ref, open2, batch); 1169 React8.useEffect(() => { 1170 if (!enabled) { 1171 return void 0; 1172 } 1173 const abortController = new AbortController(); 1174 runOnceAnimationsFinish(onComplete, abortController.signal); 1175 return () => { 1176 abortController.abort(); 1177 }; 1178 }, [enabled, open2, onComplete, runOnceAnimationsFinish]); 1179 } 1180 1181 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/stateAttributesMapping.mjs 1182 var STARTING_HOOK = { 1183 [startingStyle]: "" 1184 }; 1185 var ENDING_HOOK = { 1186 [endingStyle]: "" 1187 }; 1188 var transitionStatusMapping = { 1189 transitionStatus(value) { 1190 if (value === "starting") { 1191 return STARTING_HOOK; 1192 } 1193 if (value === "ending") { 1194 return ENDING_HOOK; 1195 } 1196 return null; 1197 } 1198 }; 1199 1200 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useTransitionStatus.mjs 1201 var React9 = __toESM(require_react(), 1); 1202 function useTransitionStatus(open2, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) { 1203 const [transitionStatus, setTransitionStatus] = React9.useState(open2 && enableIdleState ? "idle" : void 0); 1204 const [mounted, setMounted] = React9.useState(open2 && !animateInitialOpen); 1205 if (open2 && !mounted) { 1206 setMounted(true); 1207 setTransitionStatus("starting"); 1208 } 1209 if (!open2 && mounted && transitionStatus !== "ending" && !deferEndingState) { 1210 setTransitionStatus("ending"); 1211 } 1212 if (!open2 && !mounted && transitionStatus === "ending") { 1213 setTransitionStatus(void 0); 1214 } 1215 useIsoLayoutEffect(() => { 1216 if (!open2 && mounted && transitionStatus !== "ending" && deferEndingState) { 1217 const frame = AnimationFrame.request(() => { 1218 setTransitionStatus("ending"); 1219 }); 1220 return () => { 1221 AnimationFrame.cancel(frame); 1222 }; 1223 } 1224 return void 0; 1225 }, [open2, mounted, transitionStatus, deferEndingState]); 1226 useIsoLayoutEffect(() => { 1227 if (!open2 || enableIdleState || transitionStatus === void 0) { 1228 return void 0; 1229 } 1230 const frame = AnimationFrame.request(() => { 1231 setTransitionStatus(void 0); 1232 }); 1233 return () => { 1234 AnimationFrame.cancel(frame); 1235 }; 1236 }, [enableIdleState, open2, transitionStatus]); 1237 useIsoLayoutEffect(() => { 1238 if (!open2 || !enableIdleState) { 1239 return void 0; 1240 } 1241 if (open2 && mounted && transitionStatus !== "idle") { 1242 setTransitionStatus("starting"); 1243 } 1244 const frame = AnimationFrame.request(() => { 1245 setTransitionStatus("idle"); 1246 }); 1247 return () => { 1248 AnimationFrame.cancel(frame); 1249 }; 1250 }, [enableIdleState, open2, mounted, transitionStatus]); 1251 return { 1252 mounted, 1253 setMounted, 1254 transitionStatus 1255 }; 1256 } 1257 1258 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useTimeout.mjs 1259 var EMPTY2 = 0; 1260 var Timeout = class _Timeout { 1261 static create() { 1262 return new _Timeout(); 1263 } 1264 currentId = EMPTY2; 1265 /** 1266 * Executes `fn` after `delay`, clearing any previously scheduled call. 1267 */ 1268 start(delay, fn) { 1269 this.clear(); 1270 this.currentId = setTimeout(() => { 1271 this.currentId = EMPTY2; 1272 fn(); 1273 }, delay); 1274 } 1275 isStarted() { 1276 return this.currentId !== EMPTY2; 1277 } 1278 clear = () => { 1279 if (this.currentId !== EMPTY2) { 1280 clearTimeout(this.currentId); 1281 this.currentId = EMPTY2; 1282 } 1283 }; 1284 disposeEffect = () => { 1285 return this.clear; 1286 }; 1287 }; 1288 function useTimeout() { 1289 const timeout = useRefWithInit(Timeout.create).current; 1290 useOnMount(timeout.disposeEffect); 1291 return timeout; 1292 } 1293 1294 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useId.mjs 1295 var React11 = __toESM(require_react(), 1); 1296 1297 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useForcedRerendering.mjs 1298 var React10 = __toESM(require_react(), 1); 1299 function useForcedRerendering() { 1300 const [, setState] = React10.useState({}); 1301 return React10.useCallback(() => { 1302 setState({}); 1303 }, []); 1304 } 1305 1306 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useId.mjs 1307 var globalId = 0; 1308 function useGlobalId(idOverride, prefix = "mui") { 1309 const defaultId = React11.useRef(void 0); 1310 const forceRerender = useForcedRerendering(); 1311 const id = idOverride ?? defaultId.current; 1312 React11.useEffect(() => { 1313 if (defaultId.current == null) { 1314 globalId += 1; 1315 defaultId.current = `$prefix}-$globalId}`; 1316 if (idOverride == null) { 1317 forceRerender(); 1318 } 1319 } 1320 }, [idOverride, prefix, forceRerender]); 1321 return id; 1322 } 1323 var maybeReactUseId = SafeReact.useId; 1324 function useId(idOverride, prefix) { 1325 if (maybeReactUseId !== void 0) { 1326 const reactId = maybeReactUseId(); 1327 return idOverride ?? (prefix ? `$prefix}-$reactId}` : reactId); 1328 } 1329 return useGlobalId(idOverride, prefix); 1330 } 1331 1332 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useBaseUiId.mjs 1333 function useBaseUiId(idOverride) { 1334 return useId(idOverride, "base-ui"); 1335 } 1336 1337 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs 1338 function createChangeEventDetails(reason, event, trigger, customProperties) { 1339 let canceled = false; 1340 let allowPropagation = false; 1341 const custom = customProperties ?? EMPTY_OBJECT; 1342 const details = { 1343 reason, 1344 event: event ?? new Event("base-ui"), 1345 cancel() { 1346 canceled = true; 1347 }, 1348 allowPropagation() { 1349 allowPropagation = true; 1350 }, 1351 get isCanceled() { 1352 return canceled; 1353 }, 1354 get isPropagationAllowed() { 1355 return allowPropagation; 1356 }, 1357 trigger, 1358 ...custom 1359 }; 1360 return details; 1361 } 1362 1363 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/reason-parts.mjs 1364 var reason_parts_exports = {}; 1365 __export(reason_parts_exports, { 1366 cancelOpen: () => cancelOpen, 1367 chipRemovePress: () => chipRemovePress, 1368 clearPress: () => clearPress, 1369 closePress: () => closePress, 1370 closeWatcher: () => closeWatcher, 1371 decrementPress: () => decrementPress, 1372 disabled: () => disabled, 1373 drag: () => drag, 1374 escapeKey: () => escapeKey, 1375 focusOut: () => focusOut, 1376 imperativeAction: () => imperativeAction, 1377 incrementPress: () => incrementPress, 1378 initial: () => initial, 1379 inputBlur: () => inputBlur, 1380 inputChange: () => inputChange, 1381 inputClear: () => inputClear, 1382 inputPaste: () => inputPaste, 1383 inputPress: () => inputPress, 1384 itemPress: () => itemPress, 1385 keyboard: () => keyboard, 1386 linkPress: () => linkPress, 1387 listNavigation: () => listNavigation, 1388 missing: () => missing, 1389 none: () => none, 1390 outsidePress: () => outsidePress, 1391 pointer: () => pointer, 1392 popupClose: () => popupClose, 1393 scrub: () => scrub, 1394 siblingOpen: () => siblingOpen, 1395 swipe: () => swipe, 1396 trackPress: () => trackPress, 1397 triggerFocus: () => triggerFocus, 1398 triggerHover: () => triggerHover, 1399 triggerPress: () => triggerPress, 1400 wheel: () => wheel, 1401 windowResize: () => windowResize 1402 }); 1403 var none = "none"; 1404 var triggerPress = "trigger-press"; 1405 var triggerHover = "trigger-hover"; 1406 var triggerFocus = "trigger-focus"; 1407 var outsidePress = "outside-press"; 1408 var itemPress = "item-press"; 1409 var closePress = "close-press"; 1410 var linkPress = "link-press"; 1411 var clearPress = "clear-press"; 1412 var chipRemovePress = "chip-remove-press"; 1413 var trackPress = "track-press"; 1414 var incrementPress = "increment-press"; 1415 var decrementPress = "decrement-press"; 1416 var inputChange = "input-change"; 1417 var inputClear = "input-clear"; 1418 var inputBlur = "input-blur"; 1419 var inputPaste = "input-paste"; 1420 var inputPress = "input-press"; 1421 var focusOut = "focus-out"; 1422 var escapeKey = "escape-key"; 1423 var closeWatcher = "close-watcher"; 1424 var listNavigation = "list-navigation"; 1425 var keyboard = "keyboard"; 1426 var pointer = "pointer"; 1427 var drag = "drag"; 1428 var wheel = "wheel"; 1429 var scrub = "scrub"; 1430 var popupClose = "popup-close"; 1431 var cancelOpen = "cancel-open"; 1432 var siblingOpen = "sibling-open"; 1433 var disabled = "disabled"; 1434 var missing = "missing"; 1435 var initial = "initial"; 1436 var imperativeAction = "imperative-action"; 1437 var swipe = "swipe"; 1438 var windowResize = "window-resize"; 1439 1440 // node_modules/.store/@floating-ui/utils@0.2.12-gOxTzMf36nCrbeHpEew-rw/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 1441 function hasWindow() { 1442 return typeof window !== "undefined"; 1443 } 1444 function getNodeName(node) { 1445 if (isNode(node)) { 1446 return (node.nodeName || "").toLowerCase(); 1447 } 1448 return "#document"; 1449 } 1450 function getWindow(node) { 1451 var _node$ownerDocument; 1452 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 1453 } 1454 function getDocumentElement(node) { 1455 var _ref; 1456 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 1457 } 1458 function isNode(value) { 1459 if (!hasWindow()) { 1460 return false; 1461 } 1462 return value instanceof Node || value instanceof getWindow(value).Node; 1463 } 1464 function isElement(value) { 1465 if (!hasWindow()) { 1466 return false; 1467 } 1468 return value instanceof Element || value instanceof getWindow(value).Element; 1469 } 1470 function isHTMLElement(value) { 1471 if (!hasWindow()) { 1472 return false; 1473 } 1474 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 1475 } 1476 function isShadowRoot(value) { 1477 if (!hasWindow() || typeof ShadowRoot === "undefined") { 1478 return false; 1479 } 1480 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 1481 } 1482 function isOverflowElement(element) { 1483 const { 1484 overflow, 1485 overflowX, 1486 overflowY, 1487 display 1488 } = getComputedStyle2(element); 1489 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; 1490 } 1491 function isTableElement(element) { 1492 return /^(table|td|th)$/.test(getNodeName(element)); 1493 } 1494 function isTopLayer(element) { 1495 try { 1496 if (element.matches(":popover-open")) { 1497 return true; 1498 } 1499 } catch (_e) { 1500 } 1501 try { 1502 return element.matches(":modal"); 1503 } catch (_e) { 1504 return false; 1505 } 1506 } 1507 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; 1508 var containRe = /paint|layout|strict|content/; 1509 var isNotNone = (value) => !!value && value !== "none"; 1510 var isWebKitValue; 1511 function isContainingBlock(elementOrCss) { 1512 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; 1513 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 || ""); 1514 } 1515 function getContainingBlock(element) { 1516 let currentNode = getParentNode(element); 1517 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 1518 if (isContainingBlock(currentNode)) { 1519 return currentNode; 1520 } else if (isTopLayer(currentNode)) { 1521 return null; 1522 } 1523 currentNode = getParentNode(currentNode); 1524 } 1525 return null; 1526 } 1527 function isWebKit() { 1528 if (isWebKitValue == null) { 1529 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); 1530 } 1531 return isWebKitValue; 1532 } 1533 function isLastTraversableNode(node) { 1534 return /^(html|body|#document)$/.test(getNodeName(node)); 1535 } 1536 function getComputedStyle2(element) { 1537 return getWindow(element).getComputedStyle(element); 1538 } 1539 function getNodeScroll(element) { 1540 if (isElement(element)) { 1541 return { 1542 scrollLeft: element.scrollLeft, 1543 scrollTop: element.scrollTop 1544 }; 1545 } 1546 return { 1547 scrollLeft: element.scrollX, 1548 scrollTop: element.scrollY 1549 }; 1550 } 1551 function getParentNode(node) { 1552 if (getNodeName(node) === "html") { 1553 return node; 1554 } 1555 const result = ( 1556 // Step into the shadow DOM of the parent of a slotted node. 1557 node.assignedSlot || // DOM Element detected. 1558 node.parentNode || // ShadowRoot detected. 1559 isShadowRoot(node) && node.host || // Fallback. 1560 getDocumentElement(node) 1561 ); 1562 return isShadowRoot(result) ? result.host : result; 1563 } 1564 function getNearestOverflowAncestor(node) { 1565 const parentNode = getParentNode(node); 1566 if (isLastTraversableNode(parentNode)) { 1567 return (node.ownerDocument || node).body; 1568 } 1569 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 1570 return parentNode; 1571 } 1572 return getNearestOverflowAncestor(parentNode); 1573 } 1574 function getOverflowAncestors(node, list, traverseIframes) { 1575 var _node$ownerDocument2; 1576 if (list === void 0) { 1577 list = []; 1578 } 1579 if (traverseIframes === void 0) { 1580 traverseIframes = true; 1581 } 1582 const scrollableAncestor = getNearestOverflowAncestor(node); 1583 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 1584 const win = getWindow(scrollableAncestor); 1585 if (isBody) { 1586 const frameElement = getFrameElement(win); 1587 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 1588 } else { 1589 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 1590 } 1591 } 1592 function getFrameElement(win) { 1593 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 1594 } 1595 1596 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/owner.mjs 1597 function ownerDocument(node) { 1598 return node?.ownerDocument || document; 1599 } 1600 1601 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/addEventListener.mjs 1602 function addEventListener(target, type, listener, options) { 1603 target.addEventListener(type, listener, options); 1604 return () => { 1605 target.removeEventListener(type, listener, options); 1606 }; 1607 } 1608 1609 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useValueAsRef.mjs 1610 function useValueAsRef(value) { 1611 const latest = useRefWithInit(createLatestRef, value).current; 1612 latest.next = value; 1613 useIsoLayoutEffect(latest.effect); 1614 return latest; 1615 } 1616 function createLatestRef(value) { 1617 const latest = { 1618 current: value, 1619 next: value, 1620 effect: () => { 1621 latest.current = latest.next; 1622 } 1623 }; 1624 return latest; 1625 } 1626 1627 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/platform/parts.mjs 1628 var parts_exports = {}; 1629 __export(parts_exports, { 1630 engine: () => engine_exports, 1631 env: () => env_exports, 1632 mediaQuery: () => media_query_exports, 1633 os: () => os_exports, 1634 screenReader: () => screen_reader_exports 1635 }); 1636 1637 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/platform/os.mjs 1638 var os_exports = {}; 1639 __export(os_exports, { 1640 android: () => android, 1641 apple: () => apple, 1642 ios: () => ios, 1643 linux: () => linux, 1644 mac: () => mac, 1645 windows: () => windows 1646 }); 1647 1648 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/platform/shared.mjs 1649 function readRawData() { 1650 if (typeof navigator === "undefined") { 1651 return { 1652 userAgent: "", 1653 platform: "", 1654 maxTouchPoints: 0 1655 }; 1656 } 1657 if (true) { 1658 const uaData = navigator.userAgentData; 1659 if (uaData && Array.isArray(uaData.brands)) { 1660 return { 1661 userAgent: uaData.brands.map(({ 1662 brand, 1663 version: version2 1664 }) => `$brand}/$version2}`).join(" "), 1665 platform: uaData.platform ?? navigator.platform ?? "", 1666 maxTouchPoints: navigator.maxTouchPoints ?? 0 1667 }; 1668 } 1669 } 1670 return { 1671 userAgent: navigator.userAgent, 1672 platform: navigator.platform ?? "", 1673 maxTouchPoints: navigator.maxTouchPoints ?? 0 1674 }; 1675 } 1676 var { 1677 userAgent, 1678 platform, 1679 maxTouchPoints 1680 } = readRawData(); 1681 var lowerUserAgent = userAgent.toLowerCase(); 1682 var lowerPlatform = platform.toLowerCase(); 1683 1684 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/platform/os.mjs 1685 var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1; 1686 var ANDROID_STRING = "android"; 1687 var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING); 1688 var mac = !ios && lowerPlatform.startsWith("mac"); 1689 var windows = lowerPlatform.startsWith("win"); 1690 var linux = !android && /^(linux|chrome os)/.test(lowerPlatform); 1691 var apple = mac || ios; 1692 1693 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/platform/engine.mjs 1694 var engine_exports = {}; 1695 __export(engine_exports, { 1696 blink: () => blink, 1697 gecko: () => gecko, 1698 webkit: () => webkit 1699 }); 1700 var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none"); 1701 var gecko = !webkit && lowerUserAgent.includes("firefox"); 1702 var blink = !webkit && lowerUserAgent.includes("chrom"); 1703 1704 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/platform/screen-reader.mjs 1705 var screen_reader_exports = {}; 1706 __export(screen_reader_exports, { 1707 voiceOver: () => voiceOver 1708 }); 1709 var voiceOver = apple; 1710 1711 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/platform/env.mjs 1712 var env_exports = {}; 1713 __export(env_exports, { 1714 jsdom: () => jsdom 1715 }); 1716 var jsdom = /jsdom|happydom/.test(lowerUserAgent); 1717 1718 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/platform/media-query.mjs 1719 var media_query_exports = {}; 1720 __export(media_query_exports, { 1721 iOS: () => iOS 1722 }); 1723 var iOS = "@supports (-webkit-touch-callout: none)"; 1724 1725 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 1726 var React12 = __toESM(require_react(), 1); 1727 1728 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/utils/event.mjs 1729 function isReactEvent(event) { 1730 return "nativeEvent" in event; 1731 } 1732 function isVirtualClick(event) { 1733 if (event.pointerType === "" && event.isTrusted) { 1734 return true; 1735 } 1736 if (parts_exports.os.android && event.pointerType) { 1737 return event.type === "click" && event.buttons === 1; 1738 } 1739 return event.detail === 0 && !event.pointerType; 1740 } 1741 function isMouseLikePointerType(pointerType, strict) { 1742 const values = ["mouse", "pen"]; 1743 if (!strict) { 1744 values.push("", void 0); 1745 } 1746 return values.includes(pointerType); 1747 } 1748 function isClickLikeEvent(event) { 1749 const type = event.type; 1750 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; 1751 } 1752 1753 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/shadowDom.mjs 1754 function activeElement(doc) { 1755 let element = doc.activeElement; 1756 while (element?.shadowRoot?.activeElement != null) { 1757 element = element.shadowRoot.activeElement; 1758 } 1759 return element; 1760 } 1761 function contains(parent, child) { 1762 if (!parent || !child) { 1763 return false; 1764 } 1765 const rootNode = child.getRootNode?.(); 1766 if (parent.contains(child)) { 1767 return true; 1768 } 1769 if (rootNode && isShadowRoot(rootNode)) { 1770 let next = child; 1771 while (next) { 1772 if (parent === next) { 1773 return true; 1774 } 1775 next = next.parentNode || next.host; 1776 } 1777 } 1778 return false; 1779 } 1780 function closest(node, selector) { 1781 let current = node; 1782 while (current) { 1783 if (isElement(current) && current.matches(selector)) { 1784 return current; 1785 } 1786 current = current.assignedSlot ?? current.parentNode ?? (isShadowRoot(current) ? current.host : null); 1787 } 1788 return null; 1789 } 1790 function getTarget(event) { 1791 if ("composedPath" in event) { 1792 return event.composedPath()[0] ?? event.target; 1793 } 1794 return event.target; 1795 } 1796 1797 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs 1798 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; 1799 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; 1800 1801 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs 1802 var open = "data-open"; 1803 var closed = "data-closed"; 1804 var anchorHidden = "data-anchor-hidden"; 1805 1806 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs 1807 var CommonTriggerDataAttributes_exports = {}; 1808 __export(CommonTriggerDataAttributes_exports, { 1809 popupOpen: () => popupOpen, 1810 pressed: () => pressed 1811 }); 1812 var popupOpen = "data-popup-open"; 1813 var pressed = "data-pressed"; 1814 1815 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/popupStateMapping.mjs 1816 var TRIGGER_HOOK = { 1817 [popupOpen]: "" 1818 }; 1819 var PRESSABLE_TRIGGER_HOOK = { 1820 [popupOpen]: "", 1821 [pressed]: "" 1822 }; 1823 var POPUP_OPEN_HOOK = { 1824 [open]: "" 1825 }; 1826 var POPUP_CLOSED_HOOK = { 1827 [closed]: "" 1828 }; 1829 var ANCHOR_HIDDEN_HOOK = { 1830 [anchorHidden]: "" 1831 }; 1832 var triggerOpenStateMapping = { 1833 open(value) { 1834 if (value) { 1835 return TRIGGER_HOOK; 1836 } 1837 return null; 1838 } 1839 }; 1840 var popupStateMapping = { 1841 open(value) { 1842 if (value) { 1843 return POPUP_OPEN_HOOK; 1844 } 1845 return POPUP_CLOSED_HOOK; 1846 }, 1847 anchorHidden(value) { 1848 if (value) { 1849 return ANCHOR_HIDDEN_HOOK; 1850 } 1851 return null; 1852 } 1853 }; 1854 var popupTransitionStateMapping = { 1855 ...popupStateMapping, 1856 ...transitionStatusMapping 1857 }; 1858 1859 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs 1860 var popupOpen2 = CommonTriggerDataAttributes_exports.popupOpen; 1861 var triggerDisabled = "data-trigger-disabled"; 1862 1863 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/utils/element.mjs 1864 function isTargetInsideEnabledTrigger(target, triggerElements) { 1865 if (!isElement(target)) { 1866 return false; 1867 } 1868 const targetElement = target; 1869 if (triggerElements.hasElement(targetElement)) { 1870 return !targetElement.hasAttribute(triggerDisabled); 1871 } 1872 for (const [, trigger] of triggerElements.entries()) { 1873 if (contains(trigger, targetElement)) { 1874 return !trigger.hasAttribute(triggerDisabled); 1875 } 1876 } 1877 return false; 1878 } 1879 function isEventTargetWithin(event, node) { 1880 if (node == null) { 1881 return false; 1882 } 1883 if ("composedPath" in event) { 1884 return event.composedPath().includes(node); 1885 } 1886 const eventAgain = event; 1887 return eventAgain.target != null && node.contains(eventAgain.target); 1888 } 1889 function isRootElement(element) { 1890 return element.matches("html,body"); 1891 } 1892 function isTypeableElement(element) { 1893 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); 1894 } 1895 function isInteractiveElement(element) { 1896 return closest(element, `button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null; 1897 } 1898 function matchesFocusVisible(element) { 1899 if (!element || parts_exports.env.jsdom) { 1900 return true; 1901 } 1902 try { 1903 return element.matches(":focus-visible"); 1904 } catch (_e) { 1905 return true; 1906 } 1907 } 1908 1909 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs 1910 function resolveValue(value, pointerType) { 1911 if (pointerType != null && !isMouseLikePointerType(pointerType)) { 1912 return 0; 1913 } 1914 if (typeof value === "function") { 1915 return value(); 1916 } 1917 return value; 1918 } 1919 function getDelay(value, prop, pointerType) { 1920 const result = resolveValue(value, pointerType); 1921 if (typeof result === "number") { 1922 return result; 1923 } 1924 return result?.[prop]; 1925 } 1926 function getRestMs(value) { 1927 if (typeof value === "function") { 1928 return value(); 1929 } 1930 return value; 1931 } 1932 function isClickLikeOpenEvent(openEventType, interactedInside) { 1933 return interactedInside || openEventType === "click" || openEventType === "mousedown"; 1934 } 1935 function isHoverOpenEvent(openEventType) { 1936 return openEventType?.includes("mouse") && openEventType !== "mousedown"; 1937 } 1938 1939 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 1940 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 1941 var FloatingDelayGroupContext = /* @__PURE__ */ React12.createContext({ 1942 hasProvider: false, 1943 timeoutMs: 0, 1944 delayRef: { 1945 current: 0 1946 }, 1947 initialDelayRef: { 1948 current: 0 1949 }, 1950 timeout: new Timeout(), 1951 currentIdRef: { 1952 current: null 1953 }, 1954 currentContextRef: { 1955 current: null 1956 } 1957 }); 1958 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; 1959 function resetDelayRef(delayRef, initialDelayRef) { 1960 delayRef.current = initialDelayRef.current; 1961 } 1962 function FloatingDelayGroup(props) { 1963 const { 1964 children, 1965 delay, 1966 timeoutMs = 0 1967 } = props; 1968 const delayRef = React12.useRef(delay); 1969 const initialDelayRef = React12.useRef(delay); 1970 const currentIdRef = React12.useRef(null); 1971 const currentContextRef = React12.useRef(null); 1972 const timeout = useTimeout(); 1973 useIsoLayoutEffect(() => { 1974 initialDelayRef.current = delay; 1975 if (!currentIdRef.current) { 1976 delayRef.current = delay; 1977 return; 1978 } 1979 delayRef.current = { 1980 open: getDelay(delayRef.current, "open"), 1981 close: getDelay(delay, "close") 1982 }; 1983 }, [delay, currentIdRef, delayRef, initialDelayRef]); 1984 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, { 1985 value: React12.useMemo(() => ({ 1986 hasProvider: true, 1987 delayRef, 1988 initialDelayRef, 1989 currentIdRef, 1990 timeoutMs, 1991 currentContextRef, 1992 timeout 1993 }), [timeoutMs, timeout]), 1994 children 1995 }); 1996 } 1997 function useDelayGroup(store2, options = { 1998 open: false 1999 }) { 2000 const { 2001 open: open2 2002 } = options; 2003 const floatingId = store2.useState("floatingId"); 2004 const groupContext = React12.useContext(FloatingDelayGroupContext); 2005 const { 2006 currentIdRef, 2007 delayRef, 2008 timeoutMs, 2009 initialDelayRef, 2010 currentContextRef, 2011 hasProvider, 2012 timeout 2013 } = groupContext; 2014 const [isInstantPhase, setIsInstantPhase] = React12.useState(false); 2015 const openRef = React12.useRef(open2); 2016 useIsoLayoutEffect(() => { 2017 openRef.current = open2; 2018 }, [open2]); 2019 useIsoLayoutEffect(() => { 2020 function unset() { 2021 currentContextRef.current?.setIsInstantPhase(false); 2022 currentIdRef.current = null; 2023 currentContextRef.current = null; 2024 delayRef.current = initialDelayRef.current; 2025 timeout.clear(); 2026 } 2027 if (!currentIdRef.current) { 2028 return void 0; 2029 } 2030 if (!open2 && currentIdRef.current === floatingId) { 2031 setIsInstantPhase(false); 2032 if (timeoutMs) { 2033 const closingId = floatingId; 2034 timeout.start(timeoutMs, () => { 2035 if (store2.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { 2036 return; 2037 } 2038 unset(); 2039 }); 2040 return () => { 2041 if (openRef.current || currentIdRef.current !== closingId) { 2042 timeout.clear(); 2043 } 2044 }; 2045 } 2046 unset(); 2047 } 2048 return void 0; 2049 }, [open2, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store2]); 2050 useIsoLayoutEffect(() => { 2051 if (!open2) { 2052 return; 2053 } 2054 const prevContext = currentContextRef.current; 2055 const prevId = currentIdRef.current; 2056 timeout.clear(); 2057 currentContextRef.current = { 2058 onOpenChange: store2.setOpen, 2059 setIsInstantPhase 2060 }; 2061 currentIdRef.current = floatingId; 2062 delayRef.current = { 2063 open: 0, 2064 close: getDelay(initialDelayRef.current, "close") 2065 }; 2066 if (prevId !== null && prevId !== floatingId) { 2067 setIsInstantPhase(true); 2068 prevContext?.setIsInstantPhase(true); 2069 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); 2070 } else { 2071 setIsInstantPhase(false); 2072 prevContext?.setIsInstantPhase(false); 2073 } 2074 }, [open2, floatingId, store2, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); 2075 useIsoLayoutEffect(() => { 2076 return () => { 2077 if (currentIdRef.current === floatingId) { 2078 currentContextRef.current = null; 2079 if (!openRef.current) { 2080 return; 2081 } 2082 currentIdRef.current = null; 2083 resetDelayRef(delayRef, initialDelayRef); 2084 timeout.clear(); 2085 } 2086 }; 2087 }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]); 2088 return React12.useMemo(() => ({ 2089 activeIdRef: currentIdRef, 2090 hasProvider, 2091 delayRef, 2092 isInstantPhase 2093 }), [currentIdRef, hasProvider, delayRef, isInstantPhase]); 2094 } 2095 2096 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/mergeCleanups.mjs 2097 function mergeCleanups(...cleanups) { 2098 return () => { 2099 for (let i = 0; i < cleanups.length; i += 1) { 2100 const cleanup = cleanups[i]; 2101 if (cleanup) { 2102 cleanup(); 2103 } 2104 } 2105 }; 2106 } 2107 2108 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/FocusGuard.mjs 2109 var React13 = __toESM(require_react(), 1); 2110 2111 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/visuallyHidden.mjs 2112 var visuallyHiddenBase = { 2113 clipPath: "inset(50%)", 2114 overflow: "hidden", 2115 whiteSpace: "nowrap", 2116 border: 0, 2117 padding: 0, 2118 width: 1, 2119 height: 1, 2120 margin: -1 2121 }; 2122 var visuallyHidden = { 2123 ...visuallyHiddenBase, 2124 position: "fixed", 2125 margin: 0, 2126 top: 0, 2127 left: 0 2128 }; 2129 var visuallyHiddenInput = { 2130 ...visuallyHiddenBase, 2131 position: "absolute" 2132 }; 2133 2134 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/FocusGuard.mjs 2135 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 2136 var FocusGuard = /* @__PURE__ */ React13.forwardRef(function FocusGuard2(props, ref) { 2137 const [role, setRole] = React13.useState(); 2138 useIsoLayoutEffect(() => { 2139 if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) { 2140 setRole("button"); 2141 } 2142 }, []); 2143 const restProps = { 2144 tabIndex: 0, 2145 // Role is only for VoiceOver 2146 role 2147 }; 2148 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { 2149 ...props, 2150 ref, 2151 style: visuallyHidden, 2152 "aria-hidden": role ? void 0 : true, 2153 ...restProps, 2154 "data-base-ui-focus-guard": "" 2155 }); 2156 }); 2157 if (true) FocusGuard.displayName = "FocusGuard"; 2158 2159 // node_modules/.store/@floating-ui/utils@0.2.12-gOxTzMf36nCrbeHpEew-rw/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 2160 var min = Math.min; 2161 var max = Math.max; 2162 var round = Math.round; 2163 var floor = Math.floor; 2164 var createCoords = (v) => ({ 2165 x: v, 2166 y: v 2167 }); 2168 var oppositeSideMap = { 2169 left: "right", 2170 right: "left", 2171 bottom: "top", 2172 top: "bottom" 2173 }; 2174 function clamp(start, value, end) { 2175 return max(start, min(value, end)); 2176 } 2177 function evaluate(value, param) { 2178 return typeof value === "function" ? value(param) : value; 2179 } 2180 function getSide(placement) { 2181 return placement.split("-")[0]; 2182 } 2183 function getAlignment(placement) { 2184 return placement.split("-")[1]; 2185 } 2186 function getOppositeAxis(axis) { 2187 return axis === "x" ? "y" : "x"; 2188 } 2189 function getAxisLength(axis) { 2190 return axis === "y" ? "height" : "width"; 2191 } 2192 function getSideAxis(placement) { 2193 const firstChar = placement[0]; 2194 return firstChar === "t" || firstChar === "b" ? "y" : "x"; 2195 } 2196 function getAlignmentAxis(placement) { 2197 return getOppositeAxis(getSideAxis(placement)); 2198 } 2199 function getAlignmentSides(placement, rects, rtl) { 2200 if (rtl === void 0) { 2201 rtl = false; 2202 } 2203 const alignment = getAlignment(placement); 2204 const alignmentAxis = getAlignmentAxis(placement); 2205 const length = getAxisLength(alignmentAxis); 2206 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 2207 if (rects.reference[length] > rects.floating[length]) { 2208 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 2209 } 2210 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 2211 } 2212 function getExpandedPlacements(placement) { 2213 const oppositePlacement = getOppositePlacement(placement); 2214 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 2215 } 2216 function getOppositeAlignmentPlacement(placement) { 2217 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); 2218 } 2219 var lrPlacement = ["left", "right"]; 2220 var rlPlacement = ["right", "left"]; 2221 var tbPlacement = ["top", "bottom"]; 2222 var btPlacement = ["bottom", "top"]; 2223 function getSideList(side, isStart, rtl) { 2224 switch (side) { 2225 case "top": 2226 case "bottom": 2227 if (rtl) return isStart ? rlPlacement : lrPlacement; 2228 return isStart ? lrPlacement : rlPlacement; 2229 case "left": 2230 case "right": 2231 return isStart ? tbPlacement : btPlacement; 2232 default: 2233 return []; 2234 } 2235 } 2236 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 2237 const alignment = getAlignment(placement); 2238 let list = getSideList(getSide(placement), direction === "start", rtl); 2239 if (alignment) { 2240 list = list.map((side) => side + "-" + alignment); 2241 if (flipAlignment) { 2242 list = list.concat(list.map(getOppositeAlignmentPlacement)); 2243 } 2244 } 2245 return list; 2246 } 2247 function getOppositePlacement(placement) { 2248 const side = getSide(placement); 2249 return oppositeSideMap[side] + placement.slice(side.length); 2250 } 2251 function expandPaddingObject(padding) { 2252 var _padding$top, _padding$right, _padding$bottom, _padding$left; 2253 return { 2254 top: (_padding$top = padding.top) != null ? _padding$top : 0, 2255 right: (_padding$right = padding.right) != null ? _padding$right : 0, 2256 bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0, 2257 left: (_padding$left = padding.left) != null ? _padding$left : 0 2258 }; 2259 } 2260 function getPaddingObject(padding) { 2261 return typeof padding !== "number" ? expandPaddingObject(padding) : { 2262 top: padding, 2263 right: padding, 2264 bottom: padding, 2265 left: padding 2266 }; 2267 } 2268 function rectToClientRect(rect) { 2269 const { 2270 x, 2271 y, 2272 width, 2273 height 2274 } = rect; 2275 return { 2276 width, 2277 height, 2278 top: y, 2279 left: x, 2280 right: x + width, 2281 bottom: y + height, 2282 x, 2283 y 2284 }; 2285 } 2286 2287 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs 2288 function isHiddenByStyles(styles) { 2289 return styles.visibility === "hidden" || styles.visibility === "collapse"; 2290 } 2291 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { 2292 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { 2293 return false; 2294 } 2295 if (typeof element.checkVisibility === "function") { 2296 return element.checkVisibility(); 2297 } 2298 return styles.display !== "none" && styles.display !== "contents"; 2299 } 2300 2301 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs 2302 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; 2303 function getParentElement(element) { 2304 const assignedSlot = element.assignedSlot; 2305 if (assignedSlot) { 2306 return assignedSlot; 2307 } 2308 if (element.parentElement) { 2309 return element.parentElement; 2310 } 2311 const rootNode = element.getRootNode(); 2312 return isShadowRoot(rootNode) ? rootNode.host : null; 2313 } 2314 function getDetailsSummary(details) { 2315 for (const child of Array.from(details.children)) { 2316 if (getNodeName(child) === "summary") { 2317 return child; 2318 } 2319 } 2320 return null; 2321 } 2322 function isWithinOpenDetailsSummary(element, details) { 2323 const summary = getDetailsSummary(details); 2324 return !!summary && (element === summary || contains(summary, element)); 2325 } 2326 function isFocusableCandidate(element) { 2327 const nodeName = element ? getNodeName(element) : ""; 2328 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"); 2329 } 2330 function isFocusableElement(element) { 2331 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { 2332 return false; 2333 } 2334 for (let current = element; current; current = getParentElement(current)) { 2335 const isAncestor = current !== element; 2336 const isSlot = getNodeName(current) === "slot"; 2337 if (current.hasAttribute("inert")) { 2338 return false; 2339 } 2340 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { 2341 return false; 2342 } 2343 } 2344 return true; 2345 } 2346 function isVisibleInTabbableTree(element, isAncestor) { 2347 const styles = getComputedStyle2(element); 2348 if (!isAncestor) { 2349 return isElementVisible(element, styles); 2350 } 2351 return styles.display !== "none"; 2352 } 2353 function getTabIndex(element) { 2354 const tabIndex = element.tabIndex; 2355 if (tabIndex < 0) { 2356 const nodeName = getNodeName(element); 2357 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { 2358 return 0; 2359 } 2360 } 2361 return tabIndex; 2362 } 2363 function getNamedRadioInput(element) { 2364 if (getNodeName(element) !== "input") { 2365 return null; 2366 } 2367 const input = element; 2368 return input.type === "radio" && input.name !== "" ? input : null; 2369 } 2370 function isTabbableRadio(element, candidates) { 2371 const input = getNamedRadioInput(element); 2372 if (!input) { 2373 return true; 2374 } 2375 const checkedRadio = candidates.find((candidate) => { 2376 const radio = getNamedRadioInput(candidate); 2377 return radio?.name === input.name && radio.form === input.form && radio.checked; 2378 }); 2379 if (checkedRadio) { 2380 return checkedRadio === input; 2381 } 2382 return candidates.find((candidate) => { 2383 const radio = getNamedRadioInput(candidate); 2384 return radio?.name === input.name && radio.form === input.form; 2385 }) === input; 2386 } 2387 function getComposedChildren(container) { 2388 if (isHTMLElement(container) && getNodeName(container) === "slot") { 2389 const assignedElements = container.assignedElements({ 2390 flatten: true 2391 }); 2392 if (assignedElements.length > 0) { 2393 return assignedElements; 2394 } 2395 } 2396 if (isHTMLElement(container) && container.shadowRoot) { 2397 return Array.from(container.shadowRoot.children); 2398 } 2399 return Array.from(container.children); 2400 } 2401 function appendCandidates(container, list) { 2402 getComposedChildren(container).forEach((child) => { 2403 if (isFocusableCandidate(child)) { 2404 list.push(child); 2405 } 2406 appendCandidates(child, list); 2407 }); 2408 } 2409 function appendMatchingElements(container, selector, list) { 2410 getComposedChildren(container).forEach((child) => { 2411 if (isHTMLElement(child) && child.matches(selector)) { 2412 list.push(child); 2413 } 2414 appendMatchingElements(child, selector, list); 2415 }); 2416 } 2417 function focusable(container) { 2418 const candidates = []; 2419 appendCandidates(container, candidates); 2420 return candidates.filter(isFocusableElement); 2421 } 2422 function tabbable(container) { 2423 const candidates = focusable(container); 2424 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); 2425 } 2426 function getTabbableIn(container, dir) { 2427 const list = tabbable(container); 2428 const len = list.length; 2429 if (len === 0) { 2430 return void 0; 2431 } 2432 const active = activeElement(ownerDocument(container)); 2433 const index2 = list.indexOf(active); 2434 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; 2435 return list[nextIndex]; 2436 } 2437 function getNextTabbable(referenceElement) { 2438 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; 2439 } 2440 function getPreviousTabbable(referenceElement) { 2441 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; 2442 } 2443 function isOutsideEvent(event, container) { 2444 const containerElement = container || event.currentTarget; 2445 const relatedTarget = event.relatedTarget; 2446 return !relatedTarget || !contains(containerElement, relatedTarget); 2447 } 2448 function disableFocusInside(container) { 2449 const tabbableElements = tabbable(container); 2450 tabbableElements.forEach((element) => { 2451 element.dataset.tabindex = element.getAttribute("tabindex") || ""; 2452 element.setAttribute("tabindex", "-1"); 2453 }); 2454 } 2455 function enableFocusInside(container) { 2456 const elements = []; 2457 appendMatchingElements(container, "[data-tabindex]", elements); 2458 elements.forEach((element) => { 2459 const tabindex = element.dataset.tabindex; 2460 delete element.dataset.tabindex; 2461 if (tabindex) { 2462 element.setAttribute("tabindex", tabindex); 2463 } else { 2464 element.removeAttribute("tabindex"); 2465 } 2466 }); 2467 } 2468 2469 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs 2470 function getNodeChildren(nodes, id, onlyOpenChildren = true) { 2471 const directChildren = nodes.filter((node) => node.parentId === id); 2472 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); 2473 } 2474 2475 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs 2476 function createAttribute(name) { 2477 return `data-base-ui-$name}`; 2478 } 2479 2480 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 2481 var React14 = __toESM(require_react(), 1); 2482 var ReactDOM2 = __toESM(require_react_dom(), 1); 2483 2484 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/constants.mjs 2485 var DISABLED_TRANSITIONS_STYLE = { 2486 style: { 2487 transition: "none" 2488 } 2489 }; 2490 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; 2491 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; 2492 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; 2493 var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; 2494 var POPUP_COLLISION_AVOIDANCE = { 2495 fallbackAxisSide: "end" 2496 }; 2497 var ownerVisuallyHidden = { 2498 clipPath: "inset(50%)", 2499 position: "fixed", 2500 top: 0, 2501 left: 0 2502 }; 2503 2504 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 2505 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 2506 var PortalContext = /* @__PURE__ */ React14.createContext(null); 2507 if (true) PortalContext.displayName = "PortalContext"; 2508 var usePortalContext = () => React14.useContext(PortalContext); 2509 var attr = createAttribute("portal"); 2510 function useFloatingPortalNode(props = {}) { 2511 const { 2512 ref, 2513 container: containerProp, 2514 componentProps = EMPTY_OBJECT, 2515 elementProps 2516 } = props; 2517 const uniqueId = useId(); 2518 const portalContext = usePortalContext(); 2519 const parentPortalNode = portalContext?.portalNode; 2520 const [containerElement, setContainerElement] = React14.useState(null); 2521 const [portalNode, setPortalNode] = React14.useState(null); 2522 const setPortalNodeRef = useStableCallback((node) => { 2523 if (node !== null) { 2524 setPortalNode(node); 2525 } 2526 }); 2527 const containerRef = React14.useRef(null); 2528 useIsoLayoutEffect(() => { 2529 if (containerProp === null) { 2530 if (containerRef.current) { 2531 containerRef.current = null; 2532 setPortalNode(null); 2533 setContainerElement(null); 2534 } 2535 return; 2536 } 2537 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; 2538 if (resolvedContainer == null) { 2539 if (containerRef.current) { 2540 containerRef.current = null; 2541 setPortalNode(null); 2542 setContainerElement(null); 2543 } 2544 return; 2545 } 2546 if (containerRef.current !== resolvedContainer) { 2547 containerRef.current = resolvedContainer; 2548 setPortalNode(null); 2549 setContainerElement(resolvedContainer); 2550 } 2551 }, [containerProp, parentPortalNode]); 2552 const portalElement = useRenderElement("div", componentProps, { 2553 ref: [ref, setPortalNodeRef], 2554 props: [{ 2555 id: uniqueId, 2556 [attr]: "" 2557 }, elementProps] 2558 }); 2559 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; 2560 return { 2561 node: portalNode, 2562 // `id` and `render` props can override or remove the generated ID. Use the exact 2563 // rendered value so `aria-owns` never points at an ID absent from the DOM. 2564 nodeId: /* @__PURE__ */ React14.isValidElement(portalElement) ? portalElement.props.id : void 0, 2565 subtree: portalSubtree 2566 }; 2567 } 2568 var FloatingPortal = /* @__PURE__ */ React14.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { 2569 const { 2570 render, 2571 className, 2572 style, 2573 children, 2574 container, 2575 portalOwnerRole, 2576 ...elementProps 2577 } = componentProps; 2578 const { 2579 node: portalNode, 2580 nodeId: portalNodeId, 2581 subtree: portalSubtree 2582 } = useFloatingPortalNode({ 2583 container, 2584 ref: forwardedRef, 2585 componentProps, 2586 elementProps 2587 }); 2588 const beforeOutsideRef = React14.useRef(null); 2589 const afterOutsideRef = React14.useRef(null); 2590 const beforeInsideRef = React14.useRef(null); 2591 const afterInsideRef = React14.useRef(null); 2592 const [focusManagerState, setFocusManagerState] = React14.useState(null); 2593 const focusInsideDisabledRef = React14.useRef(false); 2594 const modal = focusManagerState?.modal; 2595 const open2 = focusManagerState?.open; 2596 const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; 2597 React14.useEffect(() => { 2598 if (!portalNode || modal) { 2599 return void 0; 2600 } 2601 function onFocus(event) { 2602 if (portalNode && event.relatedTarget && isOutsideEvent(event)) { 2603 if (event.type === "focusin") { 2604 if (focusInsideDisabledRef.current) { 2605 enableFocusInside(portalNode); 2606 focusInsideDisabledRef.current = false; 2607 } 2608 } else { 2609 disableFocusInside(portalNode); 2610 focusInsideDisabledRef.current = true; 2611 } 2612 } 2613 } 2614 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); 2615 }, [portalNode, modal]); 2616 useIsoLayoutEffect(() => { 2617 if (!portalNode || open2 !== true || !focusInsideDisabledRef.current) { 2618 return; 2619 } 2620 enableFocusInside(portalNode); 2621 focusInsideDisabledRef.current = false; 2622 }, [open2, portalNode]); 2623 const portalContextValue = React14.useMemo(() => ({ 2624 beforeOutsideRef, 2625 afterOutsideRef, 2626 beforeInsideRef, 2627 afterInsideRef, 2628 portalNode, 2629 setFocusManagerState 2630 }), [portalNode]); 2631 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React14.Fragment, { 2632 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, { 2633 value: portalContextValue, 2634 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 2635 "data-type": "outside", 2636 ref: beforeOutsideRef, 2637 onFocus: (event) => { 2638 if (isOutsideEvent(event, portalNode)) { 2639 beforeInsideRef.current?.focus(); 2640 } else { 2641 const domReference = focusManagerState ? focusManagerState.domReference : null; 2642 const prevTabbable = getPreviousTabbable(domReference); 2643 prevTabbable?.focus(); 2644 } 2645 } 2646 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { 2647 role: portalOwnerRole, 2648 "aria-owns": portalNodeId, 2649 style: ownerVisuallyHidden 2650 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 2651 "data-type": "outside", 2652 ref: afterOutsideRef, 2653 onFocus: (event) => { 2654 if (isOutsideEvent(event, portalNode)) { 2655 afterInsideRef.current?.focus(); 2656 } else { 2657 const domReference = focusManagerState ? focusManagerState.domReference : null; 2658 const nextTabbable = getNextTabbable(domReference); 2659 nextTabbable?.focus(); 2660 if (focusManagerState?.closeOnFocusOut) { 2661 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); 2662 } 2663 } 2664 } 2665 })] 2666 })] 2667 }); 2668 }); 2669 if (true) FloatingPortal.displayName = "FloatingPortal"; 2670 2671 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 2672 var React15 = __toESM(require_react(), 1); 2673 2674 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs 2675 function createEventEmitter() { 2676 const map = /* @__PURE__ */ new Map(); 2677 return { 2678 emit(event, data) { 2679 map.get(event)?.forEach((listener) => listener(data)); 2680 }, 2681 on(event, listener) { 2682 if (!map.has(event)) { 2683 map.set(event, /* @__PURE__ */ new Set()); 2684 } 2685 map.get(event).add(listener); 2686 }, 2687 off(event, listener) { 2688 map.get(event)?.delete(listener); 2689 } 2690 }; 2691 } 2692 2693 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 2694 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 2695 var FloatingNodeContext = /* @__PURE__ */ React15.createContext(null); 2696 if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; 2697 var FloatingTreeContext = /* @__PURE__ */ React15.createContext(null); 2698 if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; 2699 var useFloatingParentNodeId = () => React15.useContext(FloatingNodeContext)?.id || null; 2700 var useFloatingTree = (externalTree) => { 2701 const contextTree = React15.useContext(FloatingTreeContext); 2702 return externalTree ?? contextTree; 2703 }; 2704 2705 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs 2706 var React16 = __toESM(require_react(), 1); 2707 function createVirtualElement(domElement, data) { 2708 let offsetX = null; 2709 let offsetY = null; 2710 let isAutoUpdateEvent = false; 2711 return { 2712 contextElement: domElement || void 0, 2713 getBoundingClientRect() { 2714 const domRect = domElement?.getBoundingClientRect() || { 2715 width: 0, 2716 height: 0, 2717 x: 0, 2718 y: 0 2719 }; 2720 const isXAxis = data.axis === "x" || data.axis === "both"; 2721 const isYAxis = data.axis === "y" || data.axis === "both"; 2722 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; 2723 const width = data.axis === "y" ? domRect.width : 0; 2724 const height = data.axis === "x" ? domRect.height : 0; 2725 let x = domRect.x; 2726 let y = domRect.y; 2727 if (offsetX == null && data.x && isXAxis) { 2728 offsetX = domRect.x - data.x; 2729 } 2730 if (offsetY == null && data.y && isYAxis) { 2731 offsetY = domRect.y - data.y; 2732 } 2733 x -= offsetX || 0; 2734 y -= offsetY || 0; 2735 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { 2736 x = isXAxis && data.x != null ? data.x : x; 2737 y = isYAxis && data.y != null ? data.y : y; 2738 } 2739 isAutoUpdateEvent = true; 2740 return { 2741 width, 2742 height, 2743 x, 2744 y, 2745 top: y, 2746 right: x + width, 2747 bottom: y + height, 2748 left: x 2749 }; 2750 } 2751 }; 2752 } 2753 function isMouseBasedEvent(event) { 2754 return event != null && event.clientX != null; 2755 } 2756 function useClientPoint(store2, props = {}) { 2757 const { 2758 enabled = true, 2759 axis = "both" 2760 } = props; 2761 const open2 = store2.useState("open"); 2762 const floating = store2.useState("floatingElement"); 2763 const domReference = store2.useState("domReferenceElement"); 2764 const dataRef = store2.context.dataRef; 2765 const initialRef = React16.useRef(false); 2766 const cleanupListenerRef = React16.useRef(null); 2767 const [pointerType, setPointerType] = React16.useState(); 2768 const [reactive, setReactive] = React16.useState([]); 2769 const resetReference = useStableCallback((reference2) => { 2770 store2.set("positionReference", reference2); 2771 }); 2772 const setReference = useStableCallback((newX, newY, referenceElement) => { 2773 if (initialRef.current) { 2774 return; 2775 } 2776 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { 2777 return; 2778 } 2779 store2.set("positionReference", createVirtualElement(referenceElement ?? domReference, { 2780 x: newX, 2781 y: newY, 2782 axis, 2783 dataRef, 2784 pointerType 2785 })); 2786 }); 2787 const handleReferenceEnterOrMove = useStableCallback((event) => { 2788 if (!open2) { 2789 setReference(event.clientX, event.clientY, event.currentTarget); 2790 } else if (!cleanupListenerRef.current) { 2791 setReference(event.clientX, event.clientY, event.currentTarget); 2792 setReactive([]); 2793 } 2794 }); 2795 const openCheck = isMouseLikePointerType(pointerType) ? floating : open2; 2796 React16.useEffect(() => { 2797 if (!enabled) { 2798 resetReference(domReference); 2799 return void 0; 2800 } 2801 if (!openCheck) { 2802 return void 0; 2803 } 2804 function cleanupListener() { 2805 cleanupListenerRef.current?.(); 2806 cleanupListenerRef.current = null; 2807 } 2808 const win = getWindow(floating); 2809 function handleMouseMove(event) { 2810 const target = getTarget(event); 2811 if (!contains(floating, target)) { 2812 setReference(event.clientX, event.clientY); 2813 } else { 2814 cleanupListener(); 2815 } 2816 } 2817 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { 2818 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); 2819 } else { 2820 resetReference(domReference); 2821 } 2822 return cleanupListener; 2823 }, [openCheck, enabled, floating, dataRef, domReference, store2, setReference, resetReference, reactive]); 2824 React16.useEffect(() => () => { 2825 store2.set("positionReference", null); 2826 }, [store2]); 2827 React16.useEffect(() => { 2828 if (enabled && !floating) { 2829 initialRef.current = false; 2830 } 2831 }, [enabled, floating]); 2832 React16.useEffect(() => { 2833 if (!enabled && open2) { 2834 initialRef.current = true; 2835 } 2836 }, [enabled, open2]); 2837 const reference = React16.useMemo(() => { 2838 function setPointerTypeRef(event) { 2839 setPointerType(event.pointerType); 2840 } 2841 return { 2842 onPointerDown: setPointerTypeRef, 2843 onPointerEnter: setPointerTypeRef, 2844 onMouseMove: handleReferenceEnterOrMove, 2845 onMouseEnter: handleReferenceEnterOrMove 2846 }; 2847 }, [handleReferenceEnterOrMove]); 2848 return React16.useMemo(() => enabled ? { 2849 reference, 2850 trigger: reference 2851 } : {}, [enabled, reference]); 2852 } 2853 2854 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs 2855 var React17 = __toESM(require_react(), 1); 2856 function alwaysFalse() { 2857 return false; 2858 } 2859 function normalizeProp(normalizable) { 2860 return { 2861 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, 2862 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true 2863 }; 2864 } 2865 function useDismiss(store2, props = {}) { 2866 const { 2867 enabled = true, 2868 escapeKey: escapeKey2 = true, 2869 outsidePress: outsidePressProp = true, 2870 outsidePressEvent = "sloppy", 2871 referencePress = alwaysFalse, 2872 bubbles, 2873 externalTree 2874 } = props; 2875 const open2 = store2.useState("open"); 2876 const floatingElement = store2.useState("floatingElement"); 2877 const { 2878 dataRef, 2879 events 2880 } = store2.context; 2881 const tree = useFloatingTree(externalTree); 2882 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); 2883 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; 2884 const outsidePressEnabled = outsidePress2 !== false; 2885 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); 2886 const { 2887 escapeKey: escapeKeyBubbles, 2888 outsidePress: outsidePressBubbles 2889 } = normalizeProp(bubbles); 2890 const pressStartedInsideRef = React17.useRef(false); 2891 const pressStartPreventedRef = React17.useRef(false); 2892 const suppressNextOutsideClickRef = React17.useRef(false); 2893 const sawPressWhileOpenRef = React17.useRef(false); 2894 const isComposingRef = React17.useRef(false); 2895 const currentPointerTypeRef = React17.useRef(""); 2896 const touchStateRef = React17.useRef(null); 2897 const cancelDismissOnEndTimeout = useTimeout(); 2898 const clearInsideReactTreeTimeout = useTimeout(); 2899 const compositionTimeout = useTimeout(); 2900 const clearInsideReactTree = useStableCallback(() => { 2901 clearInsideReactTreeTimeout.clear(); 2902 dataRef.current.insideReactTree = false; 2903 }); 2904 const hasBlockingChild = useStableCallback((bubbleKey) => { 2905 const nodeId = dataRef.current.floatingContext?.nodeId; 2906 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 2907 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); 2908 }); 2909 const isEventWithinOwnElements = useStableCallback((event) => { 2910 return isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement")); 2911 }); 2912 const closeOnReferencePress = useStableCallback((event) => { 2913 if (!referencePress()) { 2914 return; 2915 } 2916 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 2917 }); 2918 const closeOnEscapeKeyDown = useStableCallback((event) => { 2919 if (!open2 || !enabled || !escapeKey2 || event.key !== "Escape") { 2920 return; 2921 } 2922 const native = isReactEvent(event) ? event.nativeEvent : event; 2923 if (isComposingRef.current || native.isComposing) { 2924 return; 2925 } 2926 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { 2927 return; 2928 } 2929 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); 2930 store2.setOpen(false, eventDetails); 2931 if (!eventDetails.isCanceled) { 2932 event.preventDefault(); 2933 } 2934 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { 2935 event.stopPropagation(); 2936 } 2937 }); 2938 const markInsideReactTree = useStableCallback(() => { 2939 dataRef.current.insideReactTree = true; 2940 clearInsideReactTreeTimeout.start(0, clearInsideReactTree); 2941 }); 2942 const markPressStartedInsideReactTree = useStableCallback((event) => { 2943 if (!open2 || !enabled || event.button !== 0) { 2944 return; 2945 } 2946 const target = getTarget(event.nativeEvent); 2947 if (!contains(store2.select("floatingElement"), target)) { 2948 return; 2949 } 2950 if (!pressStartedInsideRef.current) { 2951 pressStartedInsideRef.current = true; 2952 pressStartPreventedRef.current = false; 2953 } 2954 }); 2955 const markInsidePressStartPrevented = useStableCallback((event) => { 2956 if (!open2 || !enabled) { 2957 return; 2958 } 2959 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { 2960 return; 2961 } 2962 if (pressStartedInsideRef.current) { 2963 pressStartPreventedRef.current = true; 2964 } 2965 }); 2966 React17.useEffect(() => { 2967 function handleOpenChange(details) { 2968 if (!details.open) { 2969 sawPressWhileOpenRef.current = false; 2970 } 2971 } 2972 events.on("openchange", handleOpenChange); 2973 return () => { 2974 events.off("openchange", handleOpenChange); 2975 }; 2976 }, [events]); 2977 React17.useEffect(() => clearInsideReactTree, [clearInsideReactTree]); 2978 React17.useEffect(() => { 2979 if (!open2 || !enabled) { 2980 if (!open2) { 2981 sawPressWhileOpenRef.current = false; 2982 isComposingRef.current = false; 2983 currentPointerTypeRef.current = ""; 2984 touchStateRef.current = null; 2985 } 2986 return clearInsideReactTree; 2987 } 2988 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; 2989 dataRef.current.__outsidePressBubbles = outsidePressBubbles; 2990 const preventedPressSuppressionTimeout = new Timeout(); 2991 const doc = ownerDocument(floatingElement); 2992 function handleCompositionStart() { 2993 compositionTimeout.clear(); 2994 isComposingRef.current = true; 2995 } 2996 function handleCompositionEnd() { 2997 isComposingRef.current = true; 2998 compositionTimeout.start( 2999 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. 3000 // Only apply to WebKit for the test to remain 0ms. 3001 parts_exports.engine.webkit ? 5 : 0, 3002 () => { 3003 isComposingRef.current = false; 3004 } 3005 ); 3006 } 3007 function suppressImmediateOutsideClickAfterPreventedStart() { 3008 suppressNextOutsideClickRef.current = true; 3009 preventedPressSuppressionTimeout.start(0, () => { 3010 suppressNextOutsideClickRef.current = false; 3011 }); 3012 } 3013 function resetPressStartState() { 3014 pressStartedInsideRef.current = false; 3015 pressStartPreventedRef.current = false; 3016 } 3017 function getOutsidePressEvent() { 3018 const type = currentPointerTypeRef.current; 3019 const computedType = type === "pen" || !type ? "mouse" : type; 3020 const outsidePressEventValue = getOutsidePressEventProp(); 3021 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; 3022 if (typeof resolved === "string") { 3023 return resolved; 3024 } 3025 return resolved[computedType]; 3026 } 3027 function shouldIgnoreEvent(event) { 3028 const computedOutsidePressEvent = getOutsidePressEvent(); 3029 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; 3030 } 3031 function isEventWithinFloatingTree(event) { 3032 const nodeId = dataRef.current.floatingContext?.nodeId; 3033 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); 3034 return isEventWithinOwnElements(event) || targetIsInsideChildren; 3035 } 3036 function closeOnPressOutside(event) { 3037 if (shouldIgnoreEvent(event)) { 3038 if (event.type !== "click" && !isEventWithinOwnElements(event)) { 3039 preventedPressSuppressionTimeout.clear(); 3040 suppressNextOutsideClickRef.current = false; 3041 } 3042 clearInsideReactTree(); 3043 return; 3044 } 3045 if (dataRef.current.insideReactTree) { 3046 clearInsideReactTree(); 3047 return; 3048 } 3049 const target = getTarget(event); 3050 const inertSelector = `[$createAttribute("inert")}]`; 3051 const targetRoot = isElement(target) ? target.getRootNode() : null; 3052 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store2.select("floatingElement"))).querySelectorAll(inertSelector)); 3053 const triggers = store2.context.triggerElements; 3054 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { 3055 return; 3056 } 3057 let targetRootAncestor = isElement(target) ? target : null; 3058 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { 3059 const nextParent = getParentNode(targetRootAncestor); 3060 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { 3061 break; 3062 } 3063 targetRootAncestor = nextParent; 3064 } 3065 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). 3066 !contains(target, store2.select("floatingElement")) && // If the target root element contains none of the markers, then the 3067 // element was injected after the floating element rendered. 3068 markers.every((marker) => !contains(targetRootAncestor, marker))) { 3069 return; 3070 } 3071 if (isHTMLElement(target) && !("touches" in event)) { 3072 const lastTraversableNode = isLastTraversableNode(target); 3073 const style = getComputedStyle2(target); 3074 const scrollRe = /auto|scroll/; 3075 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); 3076 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); 3077 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; 3078 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; 3079 const isRTL4 = style.direction === "rtl"; 3080 const pressedVerticalScrollbar = canScrollY && (isRTL4 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); 3081 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; 3082 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { 3083 return; 3084 } 3085 } 3086 if (isEventWithinFloatingTree(event)) { 3087 return; 3088 } 3089 if (getOutsidePressEvent() === "intentional") { 3090 if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) { 3091 return; 3092 } 3093 if (suppressNextOutsideClickRef.current) { 3094 preventedPressSuppressionTimeout.clear(); 3095 suppressNextOutsideClickRef.current = false; 3096 return; 3097 } 3098 } 3099 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 3100 return; 3101 } 3102 if (hasBlockingChild("__outsidePressBubbles")) { 3103 return; 3104 } 3105 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); 3106 clearInsideReactTree(); 3107 } 3108 function handlePointerDown(event) { 3109 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { 3110 return; 3111 } 3112 closeOnPressOutside(event); 3113 } 3114 function handleTouchStart(event) { 3115 if (getOutsidePressEvent() !== "sloppy" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { 3116 return; 3117 } 3118 const touch = event.touches[0]; 3119 if (touch) { 3120 touchStateRef.current = { 3121 startTime: Date.now(), 3122 startX: touch.clientX, 3123 startY: touch.clientY, 3124 dismissOnTouchEnd: false, 3125 dismissOnMouseDown: true 3126 }; 3127 cancelDismissOnEndTimeout.start(1e3, () => { 3128 if (touchStateRef.current) { 3129 touchStateRef.current.dismissOnTouchEnd = false; 3130 touchStateRef.current.dismissOnMouseDown = false; 3131 } 3132 }); 3133 } 3134 } 3135 function addTargetEventListenerOnce(event, listener) { 3136 const target = getTarget(event); 3137 if (!target) { 3138 return; 3139 } 3140 const unsubscribe2 = addEventListener(target, event.type, () => { 3141 listener(event); 3142 unsubscribe2(); 3143 }); 3144 } 3145 function handleTouchStartCapture(event) { 3146 currentPointerTypeRef.current = "touch"; 3147 addTargetEventListenerOnce(event, handleTouchStart); 3148 } 3149 function closeOnPressOutsideCapture(event) { 3150 cancelDismissOnEndTimeout.clear(); 3151 if (event.type === "pointerdown") { 3152 if (event.button === 0) { 3153 sawPressWhileOpenRef.current = true; 3154 } 3155 currentPointerTypeRef.current = event.pointerType; 3156 } 3157 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { 3158 return; 3159 } 3160 addTargetEventListenerOnce(event, (targetEvent) => { 3161 if (targetEvent.type === "pointerdown") { 3162 handlePointerDown(targetEvent); 3163 } else { 3164 closeOnPressOutside(targetEvent); 3165 } 3166 }); 3167 } 3168 function handlePressEndCapture(event) { 3169 if (event.type === "pointercancel") { 3170 sawPressWhileOpenRef.current = false; 3171 } 3172 if (!pressStartedInsideRef.current) { 3173 return; 3174 } 3175 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; 3176 resetPressStartState(); 3177 if (getOutsidePressEvent() !== "intentional") { 3178 return; 3179 } 3180 if (event.type === "pointercancel") { 3181 if (pressStartedInsideDefaultPrevented) { 3182 suppressImmediateOutsideClickAfterPreventedStart(); 3183 } 3184 return; 3185 } 3186 if (isEventWithinFloatingTree(event)) { 3187 return; 3188 } 3189 if (pressStartedInsideDefaultPrevented) { 3190 suppressImmediateOutsideClickAfterPreventedStart(); 3191 return; 3192 } 3193 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 3194 return; 3195 } 3196 preventedPressSuppressionTimeout.clear(); 3197 suppressNextOutsideClickRef.current = true; 3198 clearInsideReactTree(); 3199 } 3200 function handleTouchMove(event) { 3201 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 3202 return; 3203 } 3204 const touch = event.touches[0]; 3205 if (!touch) { 3206 return; 3207 } 3208 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); 3209 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); 3210 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 3211 if (distance > 5) { 3212 touchStateRef.current.dismissOnTouchEnd = true; 3213 } 3214 if (distance > 10) { 3215 closeOnPressOutside(event); 3216 cancelDismissOnEndTimeout.clear(); 3217 touchStateRef.current = null; 3218 } 3219 } 3220 function handleTouchMoveCapture(event) { 3221 addTargetEventListenerOnce(event, handleTouchMove); 3222 } 3223 function handleTouchEnd(event) { 3224 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 3225 return; 3226 } 3227 if (touchStateRef.current.dismissOnTouchEnd) { 3228 closeOnPressOutside(event); 3229 } 3230 cancelDismissOnEndTimeout.clear(); 3231 touchStateRef.current = null; 3232 } 3233 function handleTouchEndCapture(event) { 3234 addTargetEventListenerOnce(event, handleTouchEnd); 3235 } 3236 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, { 3237 capture: true, 3238 passive: true 3239 }), addEventListener(doc, "touchmove", handleTouchMoveCapture, { 3240 capture: true, 3241 passive: true 3242 }), addEventListener(doc, "touchend", handleTouchEndCapture, { 3243 capture: true, 3244 passive: true 3245 }))); 3246 return () => { 3247 unsubscribe(); 3248 preventedPressSuppressionTimeout.clear(); 3249 resetPressStartState(); 3250 suppressNextOutsideClickRef.current = false; 3251 }; 3252 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open2, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store2, cancelDismissOnEndTimeout, compositionTimeout]); 3253 const reference = React17.useMemo(() => ({ 3254 onKeyDown: closeOnEscapeKeyDown, 3255 onPointerDown: closeOnReferencePress, 3256 onClick: closeOnReferencePress 3257 }), [closeOnEscapeKeyDown, closeOnReferencePress]); 3258 const floating = React17.useMemo(() => ({ 3259 onKeyDown: closeOnEscapeKeyDown, 3260 // `onMouseDown` may be blocked if `event.preventDefault()` is called in 3261 // `onPointerDown`, such as with <NumberField.ScrubArea>. 3262 // See https://github.com/mui/base-ui/pull/3379 3263 onPointerDown: markInsidePressStartPrevented, 3264 onMouseDown: markInsidePressStartPrevented, 3265 onClickCapture: markInsideReactTree, 3266 onMouseDownCapture(event) { 3267 markInsideReactTree(); 3268 markPressStartedInsideReactTree(event); 3269 }, 3270 onPointerDownCapture(event) { 3271 markInsideReactTree(); 3272 markPressStartedInsideReactTree(event); 3273 }, 3274 onMouseUpCapture: markInsideReactTree, 3275 onTouchEndCapture: markInsideReactTree, 3276 onTouchMoveCapture: markInsideReactTree 3277 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); 3278 return React17.useMemo(() => enabled ? { 3279 reference, 3280 floating, 3281 trigger: reference 3282 } : {}, [enabled, reference, floating]); 3283 } 3284 3285 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/popups/popupHandle.mjs 3286 var BasePopupHandle = class { 3287 /** 3288 * Stores of every root currently using this handle, in attach order. A handle is meant to be used 3289 * by a single mounted root, but roots can transiently overlap (e.g. during an animated route 3290 * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of 3291 * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first. 3292 */ 3293 attachedStores = []; 3294 /** 3295 * Store of the root that currently controls the handle: the most recently attached one still 3296 * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`. 3297 */ 3298 attachedStoreValue = null; 3299 /** 3300 * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer. 3301 */ 3302 storeListeners = /* @__PURE__ */ new Set(); 3303 /** 3304 * Creates a handle backed by the store used while no root is attached. 3305 * 3306 * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached, 3307 * so they can render and register without a mounted root. Triggers register into whichever store 3308 * `store` currently resolves to, so while detached they live in this store's trigger map and 3309 * migrate themselves to the root's store (and back) as it attaches/detaches. 3310 * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces 3311 * `MenuHandle.open()` in warning text. 3312 * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is 3313 * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to, 3314 * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning. 3315 */ 3316 constructor(fallbackStore, componentName, throwOnMissingTrigger = true) { 3317 this.fallbackStore = fallbackStore; 3318 this.componentName = componentName; 3319 this.throwOnMissingTrigger = throwOnMissingTrigger; 3320 } 3321 get attachedStore() { 3322 return this.attachedStoreValue; 3323 } 3324 /** 3325 * Store that detached triggers read from: the attached root's store, or an inert fallback store 3326 * used while no root is attached. 3327 * @internal 3328 */ 3329 get store() { 3330 return this.attachedStoreValue ?? this.fallbackStore; 3331 } 3332 /** 3333 * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on 3334 * the handle during render because a handle can be shared by concurrent server-rendered requests. 3335 * @internal 3336 */ 3337 get serverStore() { 3338 return this.fallbackStore; 3339 } 3340 /** 3341 * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind 3342 * when a root attaches or detaches. Returns a function that removes the listener. 3343 * @internal 3344 */ 3345 subscribeStore(listener) { 3346 this.storeListeners.add(listener); 3347 return () => { 3348 this.storeListeners.delete(listener); 3349 }; 3350 } 3351 /** 3352 * Points the handle at a root's store and notifies subscribers so detached triggers re-render and 3353 * re-register into it (their registration effect migrates them when the store pointer changes). 3354 * Returns a cleanup function that detaches the store again. 3355 * @internal 3356 */ 3357 attachStore(newStore) { 3358 this.attachedStores.push(newStore); 3359 this.setActiveStore(newStore); 3360 if (true) { 3361 if (this.attachedStores.length > 1) { 3362 const dev = this; 3363 (dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => { 3364 if (this.attachedStores.length > 1) { 3365 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."); 3366 } 3367 }); 3368 } 3369 } 3370 return () => { 3371 const index2 = this.attachedStores.lastIndexOf(newStore); 3372 if (index2 !== -1) { 3373 this.attachedStores.splice(index2, 1); 3374 } 3375 this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null); 3376 }; 3377 } 3378 /** 3379 * Sets the store that currently controls the handle and notifies subscribers when it changes, so 3380 * detached triggers re-render and migrate their registration to the new store. 3381 */ 3382 setActiveStore(store2) { 3383 if (this.attachedStoreValue !== store2) { 3384 this.attachedStoreValue = store2; 3385 this.storeListeners.forEach((listener) => { 3386 listener(); 3387 }); 3388 } 3389 } 3390 /** 3391 * Opens the attached root's store and associates it with the trigger with the given id, or a 3392 * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public 3393 * `open()` method, which only narrows the parameter type. 3394 * 3395 * When a trigger id is given but no matching trigger is registered, anchored popups throw (see 3396 * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead. 3397 * 3398 * This method should only be called in an event handler or an effect (not during rendering). 3399 * 3400 * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open 3401 * without associating any trigger. 3402 */ 3403 openByTrigger(triggerId) { 3404 const attachedStore = this.attachedStore; 3405 if (attachedStore === null) { 3406 if (true) { 3407 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.`); 3408 } 3409 return; 3410 } 3411 let triggerElement; 3412 if (triggerId) { 3413 for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) { 3414 triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId); 3415 } 3416 triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId); 3417 } 3418 if (triggerId && !triggerElement) { 3419 if (this.throwOnMissingTrigger) { 3420 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)); 3421 } 3422 if (true) { 3423 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.`); 3424 } 3425 } 3426 attachedStore.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); 3427 } 3428 /** 3429 * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning) 3430 * while no root is attached. Shared by every concrete handle's public `close()` method. 3431 * 3432 * This method should only be called in an event handler or an effect (not during rendering). 3433 */ 3434 closePopup() { 3435 const attachedStore = this.attachedStore; 3436 if (attachedStore === null) { 3437 if (true) { 3438 console.warn(`Base UI: $this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`); 3439 } 3440 return; 3441 } 3442 attachedStore.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 3443 } 3444 }; 3445 3446 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 3447 var React19 = __toESM(require_react(), 1); 3448 var ReactDOM3 = __toESM(require_react_dom(), 1); 3449 3450 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 3451 function useSyncedFloatingRootContext(options) { 3452 const { 3453 popupStore, 3454 treatPopupAsFloatingElement = false, 3455 floatingRootContext: store2, 3456 floatingId, 3457 nested, 3458 onOpenChange 3459 } = options; 3460 const open2 = popupStore.useState("open"); 3461 const referenceElement = popupStore.useState("activeTriggerElement"); 3462 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); 3463 const handleOpenChange = onOpenChange; 3464 popupStore.useSyncedValue("floatingId", floatingId); 3465 useIsoLayoutEffect(() => { 3466 const valuesToSync = { 3467 open: open2, 3468 floatingId, 3469 referenceElement, 3470 floatingElement 3471 }; 3472 if (isElement(referenceElement)) { 3473 valuesToSync.domReferenceElement = referenceElement; 3474 } 3475 if (store2.state.positionReference === store2.state.referenceElement) { 3476 valuesToSync.positionReference = referenceElement; 3477 } 3478 store2.update(valuesToSync); 3479 }, [open2, floatingId, referenceElement, floatingElement, store2]); 3480 store2.context.onOpenChange = handleOpenChange; 3481 store2.context.nested = nested; 3482 return store2; 3483 } 3484 3485 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useUnmountAfterClose.mjs 3486 var React18 = __toESM(require_react(), 1); 3487 function useUnmountAfterClose(parameters) { 3488 const { 3489 open: open2, 3490 ref, 3491 preventUnmountOnClose, 3492 setPreventUnmountOnClose: setPreventUnmountOnCloseParam, 3493 onUnmount, 3494 animateInitialOpen 3495 } = parameters; 3496 const setPreventUnmountOnClose = useStableCallback(setPreventUnmountOnCloseParam); 3497 const { 3498 mounted, 3499 setMounted, 3500 transitionStatus 3501 } = useTransitionStatus(open2, false, false, animateInitialOpen); 3502 const preventUnmountingOnClose = open2 ? false : preventUnmountOnClose; 3503 useIsoLayoutEffect(() => { 3504 if (open2) { 3505 setPreventUnmountOnClose(false); 3506 } 3507 }, [open2, setPreventUnmountOnClose]); 3508 const mountedRef = React18.useRef(mounted); 3509 const pendingUnmountRef = React18.useRef(false); 3510 const rerender = useForcedRerendering(); 3511 const unmount = () => { 3512 mountedRef.current = false; 3513 setMounted(false); 3514 onUnmount(); 3515 }; 3516 useIsoLayoutEffect(() => { 3517 mountedRef.current = mounted; 3518 if (pendingUnmountRef.current) { 3519 pendingUnmountRef.current = false; 3520 if (!open2 && mounted) { 3521 unmount(); 3522 } 3523 } 3524 }); 3525 const forceUnmount = useStableCallback(() => { 3526 if (!mountedRef.current) { 3527 return; 3528 } 3529 if (open2) { 3530 pendingUnmountRef.current = true; 3531 rerender(); 3532 return; 3533 } 3534 unmount(); 3535 }); 3536 useOpenChangeComplete({ 3537 enabled: mounted && !open2 && !preventUnmountingOnClose, 3538 open: open2, 3539 ref, 3540 onComplete() { 3541 if (!open2) { 3542 forceUnmount(); 3543 } 3544 } 3545 }); 3546 return { 3547 mounted, 3548 transitionStatus, 3549 preventUnmountingOnClose, 3550 forceUnmount 3551 }; 3552 } 3553 3554 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 3555 var FOCUSABLE_POPUP_PROPS = { 3556 tabIndex: -1, 3557 [FOCUSABLE_ATTRIBUTE]: "" 3558 }; 3559 function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) { 3560 const floatingId = useId(); 3561 const nested = useFloatingParentNodeId() != null; 3562 const store2 = useRefWithInit(() => createStore(floatingId, nested)).current; 3563 useSyncedFloatingRootContext({ 3564 popupStore: store2, 3565 treatPopupAsFloatingElement, 3566 floatingRootContext: store2.state.floatingRootContext, 3567 floatingId, 3568 nested, 3569 onOpenChange: store2.setOpen 3570 }); 3571 return store2; 3572 } 3573 function PopupHandleAttachment({ 3574 handle, 3575 store: store2 3576 }) { 3577 useIsoLayoutEffect(() => { 3578 return handle.attachStore(store2); 3579 }, [handle, store2]); 3580 return null; 3581 } 3582 function syncTriggerCount(store2) { 3583 const triggerCount = store2.context.triggerElements.size; 3584 if (store2.select("open") && store2.state.triggerCount !== triggerCount) { 3585 store2.set("triggerCount", triggerCount); 3586 } 3587 } 3588 function useTriggerRegistration(id, store2) { 3589 const registrationRef = React19.useRef(null); 3590 return useStableCallback((element) => { 3591 const registration = registrationRef.current; 3592 if (registration !== null) { 3593 if (registration.element === element && registration.store === store2 && registration.id === id) { 3594 return; 3595 } 3596 registrationRef.current = null; 3597 const registeredStore = registration.store; 3598 if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) { 3599 registeredStore.context.triggerElements.delete(registration.id); 3600 syncTriggerCount(registeredStore); 3601 } 3602 } 3603 if (element !== null && id !== void 0) { 3604 registrationRef.current = { 3605 store: store2, 3606 id, 3607 element 3608 }; 3609 store2.context.triggerElements.add(id, element); 3610 syncTriggerCount(store2); 3611 } 3612 }); 3613 } 3614 function createPopupOpenState(state, open2, trigger, preventUnmountOnClose = false) { 3615 let preventUnmountingOnClose = state.preventUnmountingOnClose; 3616 if (open2) { 3617 preventUnmountingOnClose = false; 3618 } else if (preventUnmountOnClose) { 3619 preventUnmountingOnClose = true; 3620 } 3621 const triggerId = trigger?.id ?? null; 3622 let activeTriggerId = state.activeTriggerId; 3623 let activeTriggerElement = state.activeTriggerElement; 3624 if (triggerId || open2) { 3625 activeTriggerId = triggerId; 3626 activeTriggerElement = trigger ?? null; 3627 } 3628 return { 3629 open: open2, 3630 preventUnmountingOnClose, 3631 activeTriggerId, 3632 activeTriggerElement, 3633 // An open request without a trigger (a handle's `open(null)` or `openWithPayload()`) must not 3634 // be reassociated with a lone registered trigger later on. Controlled and default opens never 3635 // pass through here, so they keep claiming a lone trigger. A close request keeps the flag: a 3636 // controlled root may decline it and stay open, so the Root clears the flag only once the 3637 // popup is effectively closed. 3638 openedWithoutTrigger: open2 ? trigger == null : state.openedWithoutTrigger 3639 }; 3640 } 3641 function attachPreventUnmountOnClose(eventDetails) { 3642 let preventUnmountOnClose = false; 3643 eventDetails.preventUnmountOnClose = () => { 3644 preventUnmountOnClose = true; 3645 }; 3646 return () => preventUnmountOnClose; 3647 } 3648 function applyPopupOpenChange(store2, nextOpen, eventDetails, options = {}) { 3649 const reason = eventDetails.reason; 3650 const isHover = reason === reason_parts_exports.triggerHover; 3651 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; 3652 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); 3653 const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); 3654 store2.context.onOpenChange?.(nextOpen, eventDetails); 3655 if (eventDetails.isCanceled) { 3656 return; 3657 } 3658 options.onBeforeDispatch?.(); 3659 store2.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 3660 const changeState = () => { 3661 const popupOpenState = createPopupOpenState(store2.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); 3662 const updatedState = { 3663 ...options.extraState, 3664 ...popupOpenState 3665 }; 3666 if (isFocusOpen) { 3667 updatedState.instantType = "focus"; 3668 } else if (isDismissClose) { 3669 updatedState.instantType = "dismiss"; 3670 } else if (isHover) { 3671 updatedState.instantType = void 0; 3672 } 3673 store2.update(updatedState); 3674 }; 3675 if (isHover) { 3676 ReactDOM3.flushSync(changeState); 3677 } else { 3678 changeState(); 3679 } 3680 } 3681 function useTriggerDataForwarding(triggerId, triggerElementRef, store2, stateUpdates) { 3682 const isMountedByThisTrigger = store2.useState("isMountedByTrigger", triggerId); 3683 const baseRegisterTrigger = useTriggerRegistration(triggerId, store2); 3684 const applyTriggerData = useStableCallback((element) => { 3685 const open2 = store2.select("open"); 3686 const activeTriggerId = store2.select("activeTriggerId"); 3687 if (activeTriggerId === triggerId) { 3688 const changes = { 3689 activeTriggerElement: element, 3690 ...open2 ? stateUpdates : null 3691 }; 3692 store2.update(changes); 3693 return; 3694 } 3695 if (activeTriggerId == null && open2 && !store2.state.openedWithoutTrigger) { 3696 const changes = { 3697 activeTriggerId: triggerId ?? null, 3698 activeTriggerElement: element, 3699 ...stateUpdates 3700 }; 3701 store2.update(changes); 3702 } 3703 }); 3704 const registerTrigger = useStableCallback((element) => { 3705 baseRegisterTrigger(element); 3706 if (element) { 3707 applyTriggerData(element); 3708 } 3709 }); 3710 useIsoLayoutEffect(() => { 3711 registerTrigger(triggerElementRef.current); 3712 return () => registerTrigger(null); 3713 }, [registerTrigger, triggerElementRef, store2, triggerId]); 3714 useIsoLayoutEffect(() => { 3715 if (isMountedByThisTrigger) { 3716 const changes = { 3717 activeTriggerElement: triggerElementRef.current, 3718 ...stateUpdates 3719 }; 3720 store2.update(changes); 3721 } 3722 }, [isMountedByThisTrigger, store2, triggerElementRef, ...Object.values(stateUpdates)]); 3723 return { 3724 registerTrigger, 3725 isMountedByThisTrigger 3726 }; 3727 } 3728 function useImplicitActiveTrigger(store2, options = {}) { 3729 const { 3730 closeOnActiveTriggerUnmount = false 3731 } = options; 3732 const resolvedActiveTriggerIdRef = React19.useRef(null); 3733 const open2 = store2.useState("open"); 3734 const reactiveTriggerCount = store2.useState("triggerCount"); 3735 const activeTriggerId = store2.useState("activeTriggerId"); 3736 const reactiveActiveTriggerElement = store2.useState("activeTriggerElement"); 3737 useIsoLayoutEffect(() => { 3738 if (!open2) { 3739 resolvedActiveTriggerIdRef.current = null; 3740 if (store2.state.triggerCount !== 0) { 3741 store2.set("triggerCount", 0); 3742 } 3743 if (store2.state.openedWithoutTrigger) { 3744 store2.set("openedWithoutTrigger", false); 3745 } 3746 return; 3747 } 3748 const triggerCount = store2.context.triggerElements.size; 3749 const stateUpdates = {}; 3750 if (store2.state.triggerCount !== triggerCount) { 3751 stateUpdates.triggerCount = triggerCount; 3752 } 3753 const currentActiveTriggerId = store2.select("activeTriggerId"); 3754 let lostActiveTriggerId = null; 3755 if (currentActiveTriggerId) { 3756 const activeTriggerElement = store2.context.triggerElements.getById(currentActiveTriggerId); 3757 if (!activeTriggerElement) { 3758 for (const [triggerId, triggerElement] of store2.context.triggerElements.entries()) { 3759 if (triggerElement === store2.state.activeTriggerElement) { 3760 stateUpdates.activeTriggerId = triggerId; 3761 stateUpdates.activeTriggerElement = triggerElement; 3762 resolvedActiveTriggerIdRef.current = triggerId; 3763 break; 3764 } 3765 } 3766 if (stateUpdates.activeTriggerId === void 0) { 3767 if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) { 3768 lostActiveTriggerId = currentActiveTriggerId; 3769 } else { 3770 resolvedActiveTriggerIdRef.current = null; 3771 } 3772 } 3773 } else { 3774 resolvedActiveTriggerIdRef.current = currentActiveTriggerId; 3775 if (activeTriggerElement !== store2.state.activeTriggerElement) { 3776 stateUpdates.activeTriggerElement = activeTriggerElement; 3777 } 3778 } 3779 } else { 3780 resolvedActiveTriggerIdRef.current = null; 3781 } 3782 if (!lostActiveTriggerId && !currentActiveTriggerId && !store2.state.openedWithoutTrigger && triggerCount === 1) { 3783 const iteratorResult = store2.context.triggerElements.entries().next(); 3784 if (!iteratorResult.done) { 3785 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; 3786 stateUpdates.activeTriggerId = implicitTriggerId; 3787 stateUpdates.activeTriggerElement = implicitTriggerElement; 3788 resolvedActiveTriggerIdRef.current = implicitTriggerId; 3789 } 3790 } 3791 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) { 3792 store2.update(stateUpdates); 3793 } 3794 if (lostActiveTriggerId) { 3795 if (closeOnActiveTriggerUnmount) { 3796 queueMicrotask(() => { 3797 if (store2.select("open") && store2.select("activeTriggerId") === lostActiveTriggerId && !store2.context.triggerElements.getById(lostActiveTriggerId)) { 3798 const eventDetails = createChangeEventDetails(reason_parts_exports.none); 3799 store2.setOpen(false, eventDetails); 3800 if (!eventDetails.isCanceled) { 3801 store2.update({ 3802 activeTriggerId: null, 3803 activeTriggerElement: null 3804 }); 3805 } 3806 } 3807 }); 3808 } 3809 } 3810 }, [open2, store2, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]); 3811 } 3812 function useOpenStateTransitions(open2, store2, onUnmount, animateInitialOpen) { 3813 const { 3814 mounted, 3815 transitionStatus, 3816 forceUnmount 3817 } = useUnmountAfterClose({ 3818 open: open2, 3819 ref: store2.context.popupRef, 3820 preventUnmountOnClose: store2.useState("preventUnmountingOnClose"), 3821 setPreventUnmountOnClose: (preventUnmountOnClose) => store2.set("preventUnmountingOnClose", preventUnmountOnClose), 3822 animateInitialOpen, 3823 onUnmount() { 3824 store2.update({ 3825 activeTriggerId: null, 3826 activeTriggerElement: null, 3827 mounted: false, 3828 preventUnmountingOnClose: false 3829 }); 3830 onUnmount?.(); 3831 store2.context.onOpenChangeComplete?.(false); 3832 } 3833 }); 3834 useRefWithInit(() => { 3835 store2.set("mounted", mounted); 3836 return null; 3837 }); 3838 store2.useSyncedValues({ 3839 mounted, 3840 transitionStatus 3841 }); 3842 return { 3843 forceUnmount, 3844 transitionStatus 3845 }; 3846 } 3847 function usePopupInteractionProps(store2, statePart) { 3848 store2.useSyncedValues(statePart); 3849 useIsoLayoutEffect(() => () => { 3850 store2.update({ 3851 activeTriggerProps: EMPTY_OBJECT, 3852 inactiveTriggerProps: EMPTY_OBJECT, 3853 popupProps: EMPTY_OBJECT 3854 }); 3855 }, [store2]); 3856 } 3857 3858 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs 3859 var devElementIdsByMap; 3860 function getDevElementIds(map) { 3861 devElementIdsByMap ??= /* @__PURE__ */ new WeakMap(); 3862 let elementIds = devElementIdsByMap.get(map); 3863 if (!elementIds) { 3864 elementIds = /* @__PURE__ */ new WeakMap(); 3865 devElementIdsByMap.set(map, elementIds); 3866 } 3867 return elementIds; 3868 } 3869 var PopupTriggerMap = class { 3870 idMap = /* @__PURE__ */ new Map(); 3871 /** 3872 * Adds a trigger element with the given ID. 3873 * 3874 * Note: The provided element is assumed to not be registered under multiple IDs. 3875 */ 3876 add(id, element) { 3877 if (true) { 3878 const elementIds = getDevElementIds(this); 3879 const existingId = elementIds.get(element); 3880 if (existingId !== void 0 && existingId !== id) { 3881 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); 3882 } 3883 const previousElement = this.idMap.get(id); 3884 if (previousElement !== void 0 && previousElement !== element) { 3885 elementIds.delete(previousElement); 3886 } 3887 elementIds.set(element, id); 3888 } 3889 this.idMap.set(id, element); 3890 } 3891 /** 3892 * Removes the trigger element with the given ID. 3893 */ 3894 delete(id) { 3895 if (true) { 3896 const element = this.idMap.get(id); 3897 if (element !== void 0) { 3898 devElementIdsByMap?.get(this)?.delete(element); 3899 } 3900 } 3901 this.idMap.delete(id); 3902 } 3903 /** 3904 * Whether the given element is registered as a trigger. 3905 */ 3906 hasElement(element) { 3907 for (const registered of this.idMap.values()) { 3908 if (registered === element) { 3909 return true; 3910 } 3911 } 3912 return false; 3913 } 3914 /** 3915 * Whether there is a registered trigger element matching the given predicate. 3916 */ 3917 hasMatchingElement(predicate) { 3918 for (const element of this.idMap.values()) { 3919 if (predicate(element)) { 3920 return true; 3921 } 3922 } 3923 return false; 3924 } 3925 /** 3926 * Returns the trigger element associated with the given ID, or undefined if no such element exists. 3927 */ 3928 getById(id) { 3929 return this.idMap.get(id); 3930 } 3931 /** 3932 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. 3933 */ 3934 entries() { 3935 return this.idMap.entries(); 3936 } 3937 /** 3938 * Returns an iterable of all registered trigger elements. 3939 */ 3940 elements() { 3941 return this.idMap.values(); 3942 } 3943 /** 3944 * Returns the number of registered trigger elements. 3945 */ 3946 get size() { 3947 return this.idMap.size; 3948 } 3949 }; 3950 3951 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/store/useStore.mjs 3952 var React21 = __toESM(require_react(), 1); 3953 var import_shim = __toESM(require_shim(), 1); 3954 var import_with_selector = __toESM(require_with_selector(), 1); 3955 3956 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/fastHooks.mjs 3957 var React20 = __toESM(require_react(), 1); 3958 var hooks = []; 3959 var currentInstance = void 0; 3960 function getInstance() { 3961 return currentInstance; 3962 } 3963 function register(hook) { 3964 hooks.push(hook); 3965 } 3966 function fastComponent(fn) { 3967 const FastComponent = (props, forwardedRef) => { 3968 const instance = useRefWithInit(createInstance).current; 3969 let result; 3970 try { 3971 currentInstance = instance; 3972 for (const hook of hooks) { 3973 hook.before(instance); 3974 } 3975 result = fn(props, forwardedRef); 3976 for (const hook of hooks) { 3977 hook.after(instance); 3978 } 3979 instance.didInitialize = true; 3980 } finally { 3981 currentInstance = void 0; 3982 } 3983 return result; 3984 }; 3985 FastComponent.displayName = fn.displayName || fn.name; 3986 return FastComponent; 3987 } 3988 function fastComponentRef(fn) { 3989 return /* @__PURE__ */ React20.forwardRef(fastComponent(fn)); 3990 } 3991 function createInstance() { 3992 return { 3993 didInitialize: false 3994 }; 3995 } 3996 3997 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/store/useStore.mjs 3998 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); 3999 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; 4000 function useStore(store2, selector, a1, a2, a3) { 4001 return useStoreImplementation(store2, selector, a1, a2, a3); 4002 } 4003 function useStoreR19(store2, selector, a1, a2, a3) { 4004 const getSelection = React21.useCallback(() => selector(store2.getSnapshot(), a1, a2, a3), [store2, selector, a1, a2, a3]); 4005 return (0, import_shim.useSyncExternalStore)(store2.subscribe, getSelection, getSelection); 4006 } 4007 register({ 4008 before(instance) { 4009 instance.syncIndex = 0; 4010 if (!instance.didInitialize) { 4011 instance.syncTick = 1; 4012 instance.syncHooks = []; 4013 instance.didChangeStore = true; 4014 instance.getSnapshot = () => { 4015 let didChange2 = false; 4016 for (let i = 0; i < instance.syncHooks.length; i += 1) { 4017 const hook = instance.syncHooks[i]; 4018 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); 4019 if (!Object.is(hook.value, value)) { 4020 didChange2 = true; 4021 hook.value = value; 4022 } 4023 } 4024 if (didChange2) { 4025 instance.syncTick += 1; 4026 } 4027 return instance.syncTick; 4028 }; 4029 } 4030 }, 4031 after(instance) { 4032 if (instance.syncHooks.length > 0) { 4033 if (instance.didChangeStore) { 4034 instance.didChangeStore = false; 4035 instance.subscribe = (onStoreChange) => { 4036 const stores = /* @__PURE__ */ new Set(); 4037 for (const hook of instance.syncHooks) { 4038 stores.add(hook.store); 4039 } 4040 const unsubscribes = []; 4041 for (const store2 of stores) { 4042 unsubscribes.push(store2.subscribe(onStoreChange)); 4043 } 4044 return () => { 4045 for (const unsubscribe of unsubscribes) { 4046 unsubscribe(); 4047 } 4048 }; 4049 }; 4050 } 4051 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); 4052 } 4053 } 4054 }); 4055 function useStoreFast(store2, selector, a1, a2, a3) { 4056 const instance = getInstance(); 4057 if (!instance) { 4058 return useStoreR19(store2, selector, a1, a2, a3); 4059 } 4060 const index2 = instance.syncIndex; 4061 instance.syncIndex += 1; 4062 let hook; 4063 if (!instance.didInitialize) { 4064 hook = { 4065 store: store2, 4066 selector, 4067 a1, 4068 a2, 4069 a3, 4070 value: selector(store2.getSnapshot(), a1, a2, a3) 4071 }; 4072 instance.syncHooks.push(hook); 4073 } else { 4074 hook = instance.syncHooks[index2]; 4075 if (hook.store !== store2 || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { 4076 if (hook.store !== store2) { 4077 instance.didChangeStore = true; 4078 } 4079 hook.store = store2; 4080 hook.selector = selector; 4081 hook.a1 = a1; 4082 hook.a2 = a2; 4083 hook.a3 = a3; 4084 hook.value = selector(store2.getSnapshot(), a1, a2, a3); 4085 } 4086 } 4087 return hook.value; 4088 } 4089 function useStoreLegacy(store2, selector, a1, a2, a3) { 4090 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store2.subscribe, store2.getSnapshot, store2.getSnapshot, (state) => selector(state, a1, a2, a3)); 4091 } 4092 4093 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/store/Store.mjs 4094 var Store = class { 4095 /** 4096 * Creates a store with the given initial state, constructing the class it is called on. 4097 * Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that 4098 * class but degrades the inferred instance type to `Store`; use `new` there instead. 4099 */ 4100 static create(state) { 4101 return new this(state); 4102 } 4103 /** 4104 * The current state of the store. 4105 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. 4106 * 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). 4107 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. 4108 * 4109 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. 4110 */ 4111 // Internal state to handle recursive `setState()` calls 4112 constructor(state) { 4113 this.state = state; 4114 this.listeners = /* @__PURE__ */ new Set(); 4115 this.updateTick = 0; 4116 } 4117 /** 4118 * Registers a listener that will be called whenever the store's state changes. 4119 * 4120 * @param fn The listener function to be called on state changes. 4121 * @returns A function to unsubscribe the listener. 4122 */ 4123 subscribe = (fn) => { 4124 this.listeners.add(fn); 4125 return () => { 4126 this.listeners.delete(fn); 4127 }; 4128 }; 4129 /** 4130 * Returns the current state of the store. 4131 */ 4132 getSnapshot = () => { 4133 return this.state; 4134 }; 4135 /** 4136 * Updates the entire store's state and notifies all registered listeners. 4137 * 4138 * @param newState The new state to set for the store. 4139 */ 4140 setState(newState) { 4141 if (this.state === newState) { 4142 return; 4143 } 4144 this.state = newState; 4145 this.updateTick += 1; 4146 const currentTick = this.updateTick; 4147 for (const listener of this.listeners) { 4148 if (currentTick !== this.updateTick) { 4149 return; 4150 } 4151 listener(newState); 4152 } 4153 } 4154 /** 4155 * Merges the provided changes into the current state and notifies listeners if there are changes. 4156 * Each value must match its state key. Pass an exact known subset rather than a broad 4157 * `Partial<State>`, which may contain `undefined` for required state fields. 4158 * 4159 * @param changes An object containing the changes to apply to the current state. 4160 */ 4161 update(changes) { 4162 for (const key in changes) { 4163 if (!Object.is(this.state[key], changes[key])) { 4164 this.setState({ 4165 ...this.state, 4166 ...changes 4167 }); 4168 return; 4169 } 4170 } 4171 } 4172 /** 4173 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. 4174 * 4175 * @param key The key in the store's state to update. 4176 * @param value The new value to set for the specified key. 4177 */ 4178 set(key, value) { 4179 if (!Object.is(this.state[key], value)) { 4180 this.setState({ 4181 ...this.state, 4182 [key]: value 4183 }); 4184 } 4185 } 4186 /** 4187 * Gives the state a new reference and updates all registered listeners. 4188 */ 4189 notifyAll() { 4190 const newState = { 4191 ...this.state 4192 }; 4193 this.setState(newState); 4194 } 4195 use(selector, a1, a2, a3) { 4196 return useStore(this, selector, a1, a2, a3); 4197 } 4198 }; 4199 4200 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/store/ReactStore.mjs 4201 var React22 = __toESM(require_react(), 1); 4202 var ReactStore = class extends Store { 4203 /** 4204 * Creates a new ReactStore instance. 4205 * 4206 * @param state Initial state of the store. 4207 * @param context Non-reactive context values. 4208 * @param selectors Optional selectors for use with `useState`. 4209 */ 4210 constructor(state, context = {}, selectors3) { 4211 super(state); 4212 this.context = context; 4213 this.selectors = selectors3; 4214 } 4215 /** 4216 * Non-reactive values such as refs, callbacks, etc. 4217 */ 4218 /** 4219 * Synchronizes a single external value into the store. 4220 * 4221 * Note that the while the value in `state` is updated immediately, the value returned 4222 * by `useState` is updated before the next render (similarly to React's `useState`). 4223 */ 4224 useSyncedValue(key, value) { 4225 React22.useDebugValue(key); 4226 const store2 = this; 4227 useIsoLayoutEffect(() => { 4228 if (store2.state[key] !== value) { 4229 store2.set(key, value); 4230 } 4231 }, [store2, key, value]); 4232 } 4233 /** 4234 * Synchronizes a single external value into the store and 4235 * cleans it up (sets to `undefined`) on unmount. 4236 * 4237 * Note that the while the value in `state` is updated immediately, the value returned 4238 * by `useState` is updated before the next render (similarly to React's `useState`). 4239 */ 4240 useSyncedValueWithCleanup(key, value) { 4241 const store2 = this; 4242 useIsoLayoutEffect(() => { 4243 if (store2.state[key] !== value) { 4244 store2.set(key, value); 4245 } 4246 return () => { 4247 store2.set(key, void 0); 4248 }; 4249 }, [store2, key, value]); 4250 } 4251 /** 4252 * Synchronizes multiple external values into the store. 4253 * Each value must match its state key. Pass an exact known subset rather than a broad 4254 * `Partial<State>`, which may contain `undefined` for required state fields. 4255 * 4256 * Note that the while the values in `state` are updated immediately, the values returned 4257 * by `useState` are updated before the next render (similarly to React's `useState`). 4258 * 4259 * @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted. 4260 */ 4261 useSyncedValues(statePart) { 4262 const store2 = this; 4263 if (true) { 4264 React22.useDebugValue(statePart, (p) => Object.keys(p)); 4265 const keys = React22.useRef(Object.keys(statePart)).current; 4266 const nextKeys = Object.keys(statePart); 4267 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { 4268 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); 4269 } 4270 } 4271 const dependencies = Object.values(statePart); 4272 useIsoLayoutEffect(() => { 4273 store2.update(statePart); 4274 }, [store2, ...dependencies]); 4275 } 4276 /** 4277 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` 4278 * is non-undefined, the store's state at `key` is updated to match `controlled`. 4279 */ 4280 useControlledProp(key, controlled) { 4281 React22.useDebugValue(key); 4282 const store2 = this; 4283 const isControlled = controlled !== void 0; 4284 useIsoLayoutEffect(() => { 4285 if (isControlled && !Object.is(store2.state[key], controlled)) { 4286 store2.setState({ 4287 ...store2.state, 4288 [key]: controlled 4289 }); 4290 } 4291 }, [store2, key, controlled, isControlled]); 4292 if (true) { 4293 const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); 4294 if (!cache.has(key)) { 4295 cache.set(key, isControlled); 4296 } 4297 const previouslyControlled = cache.get(key); 4298 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { 4299 console.error(`A component is changing the $previouslyControlled ? "" : "un"}controlled state of $key.toString()} to be $previouslyControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`); 4300 } 4301 } 4302 } 4303 /** Gets the current value from the store using a selector with the provided key. 4304 * 4305 * @param key Key of the selector to use. 4306 */ 4307 select(key, a1, a2, a3) { 4308 const selector = this.selectors[key]; 4309 return selector(this.state, a1, a2, a3); 4310 } 4311 /** 4312 * Returns a value from the store's state using a selector function. 4313 * Used to subscribe to specific parts of the state. 4314 * This methods causes a rerender whenever the selected state changes. 4315 * 4316 * @param key Key of the selector to use. 4317 */ 4318 useState(key, a1, a2, a3) { 4319 React22.useDebugValue(key); 4320 return useStore(this, this.selectors[key], a1, a2, a3); 4321 } 4322 /** 4323 * Wraps a function with `useStableCallback` to ensure it has a stable reference 4324 * and assigns it to the context. 4325 * 4326 * @param key Key of the event callback. Must be a function in the context. 4327 * @param fn Function to assign. 4328 */ 4329 useContextCallback(key, fn) { 4330 React22.useDebugValue(key); 4331 const stableFunction = useStableCallback(fn ?? NOOP); 4332 this.context[key] = stableFunction; 4333 } 4334 /** 4335 * Returns a stable setter function for a specific key in the store's state. 4336 * It's commonly used to pass as a ref callback to React elements. 4337 * 4338 * @param key Key of the state to set. 4339 */ 4340 useStateSetter(key) { 4341 const ref = React22.useRef(void 0); 4342 if (ref.current === void 0) { 4343 ref.current = (value) => { 4344 this.set(key, value); 4345 }; 4346 } 4347 return ref.current; 4348 } 4349 /** 4350 * Observes changes derived from the store's selectors and calls the listener when the selected value changes. 4351 * 4352 * @param key Key of the selector to observe. 4353 * @param listener Listener function called when the selector result changes. 4354 */ 4355 observe(selector, listener) { 4356 let selectFn; 4357 if (typeof selector === "function") { 4358 selectFn = selector; 4359 } else { 4360 selectFn = this.selectors[selector]; 4361 } 4362 let prevValue = selectFn(this.state); 4363 listener(prevValue, prevValue, this); 4364 return this.subscribe((nextState) => { 4365 const nextValue = selectFn(nextState); 4366 if (!Object.is(prevValue, nextValue)) { 4367 const oldValue = prevValue; 4368 prevValue = nextValue; 4369 listener(nextValue, oldValue, this); 4370 } 4371 }); 4372 } 4373 }; 4374 4375 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs 4376 var selectors = { 4377 open: (state) => state.open, 4378 transitionStatus: (state) => state.transitionStatus, 4379 domReferenceElement: (state) => state.domReferenceElement, 4380 referenceElement: (state) => state.positionReference ?? state.referenceElement, 4381 floatingElement: (state) => state.floatingElement, 4382 floatingId: (state) => state.floatingId 4383 }; 4384 var FloatingRootStore = class extends ReactStore { 4385 constructor(options) { 4386 const { 4387 syncOnly, 4388 nested, 4389 onOpenChange, 4390 triggerElements, 4391 ...initialState 4392 } = options; 4393 super({ 4394 ...initialState, 4395 positionReference: initialState.referenceElement, 4396 domReferenceElement: initialState.referenceElement 4397 }, { 4398 onOpenChange, 4399 dataRef: { 4400 current: {} 4401 }, 4402 events: createEventEmitter(), 4403 nested, 4404 triggerElements 4405 }, selectors); 4406 this.syncOnly = syncOnly; 4407 } 4408 /** 4409 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. 4410 */ 4411 syncOpenEvent = (newOpen, event) => { 4412 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing 4413 // click events to upgrade a hover-open. 4414 event != null && isClickLikeEvent(event)) { 4415 this.context.dataRef.current.openEvent = newOpen ? event : void 0; 4416 } 4417 }; 4418 /** 4419 * Runs the root-owned side effects for an open state change. 4420 */ 4421 dispatchOpenChange = (newOpen, eventDetails) => { 4422 this.syncOpenEvent(newOpen, eventDetails.event); 4423 const details = { 4424 open: newOpen, 4425 reason: eventDetails.reason, 4426 nativeEvent: eventDetails.event, 4427 nested: this.context.nested, 4428 triggerElement: eventDetails.trigger 4429 }; 4430 this.context.events.emit("openchange", details); 4431 }; 4432 /** 4433 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. 4434 * 4435 * @param newOpen The new open state. 4436 * @param eventDetails Details about the event that triggered the open state change. 4437 */ 4438 setOpen = (newOpen, eventDetails) => { 4439 if (this.syncOnly) { 4440 this.context.onOpenChange?.(newOpen, eventDetails); 4441 return; 4442 } 4443 this.dispatchOpenChange(newOpen, eventDetails); 4444 this.context.onOpenChange?.(newOpen, eventDetails); 4445 }; 4446 }; 4447 4448 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/popups/store.mjs 4449 function createInitialPopupStoreState(triggerElements, floatingId, nested = false) { 4450 return { 4451 open: false, 4452 openProp: void 0, 4453 mounted: false, 4454 transitionStatus: void 0, 4455 floatingRootContext: new FloatingRootStore({ 4456 open: false, 4457 transitionStatus: void 0, 4458 floatingElement: null, 4459 referenceElement: null, 4460 triggerElements, 4461 floatingId, 4462 syncOnly: true, 4463 nested, 4464 onOpenChange: void 0 4465 }), 4466 floatingId, 4467 triggerCount: 0, 4468 preventUnmountingOnClose: false, 4469 payload: void 0, 4470 activeTriggerId: null, 4471 activeTriggerElement: null, 4472 openedWithoutTrigger: false, 4473 triggerIdProp: void 0, 4474 popupElement: null, 4475 positionerElement: null, 4476 activeTriggerProps: EMPTY_OBJECT, 4477 inactiveTriggerProps: EMPTY_OBJECT, 4478 popupProps: EMPTY_OBJECT 4479 }; 4480 } 4481 var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId; 4482 var openSelector = (state) => state.openProp ?? state.open; 4483 var popupIdSelector = (state) => { 4484 const popupId = state.popupElement?.id ?? state.floatingId; 4485 return popupId || void 0; 4486 }; 4487 function triggerOwnsOpenPopup(state, triggerId) { 4488 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; 4489 } 4490 function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { 4491 if (triggerOwnsOpenPopup(state, triggerId)) { 4492 return true; 4493 } 4494 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && !state.openedWithoutTrigger && state.triggerCount === 1; 4495 } 4496 var popupStoreSelectors = { 4497 open: openSelector, 4498 mounted: (state) => state.mounted, 4499 // `open` is written synchronously on an open change; `mounted`/`transitionStatus` sync in a 4500 // layout effect. Match useTransitionStatus so a retained popup does not miss its starting phase. 4501 transitionStatus: (state) => openSelector(state) && !state.mounted ? "starting" : state.transitionStatus, 4502 floatingRootContext: (state) => state.floatingRootContext, 4503 triggerCount: (state) => state.triggerCount, 4504 preventUnmountingOnClose: (state) => state.preventUnmountingOnClose, 4505 payload: (state) => state.payload, 4506 activeTriggerId: activeTriggerIdSelector, 4507 activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null, 4508 popupId: popupIdSelector, 4509 /** 4510 * Whether the trigger with the given ID was used to open the popup. 4511 */ 4512 isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId, 4513 /** 4514 * Whether the popup is open and was activated by a trigger with the given ID. 4515 */ 4516 isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId), 4517 /** 4518 * Whether the popup is mounted and was activated by a trigger with the given ID. 4519 */ 4520 isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted, 4521 triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps, 4522 /** 4523 * Popup id for the trigger that currently owns the open popup. 4524 */ 4525 triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0, 4526 popupProps: (state) => state.popupProps, 4527 popupElement: (state) => state.popupElement, 4528 positionerElement: (state) => state.positionerElement 4529 }; 4530 4531 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs 4532 var React23 = __toESM(require_react(), 1); 4533 var import_shim2 = __toESM(require_shim(), 1); 4534 function usePopupHandleStore(handle) { 4535 const subscribe = React23.useCallback((listener) => { 4536 if (handle === void 0) { 4537 return NOOP; 4538 } 4539 return handle.subscribeStore(listener); 4540 }, [handle]); 4541 const getSnapshot = React23.useCallback(() => { 4542 return handle === void 0 ? void 0 : handle.store; 4543 }, [handle]); 4544 return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore); 4545 } 4546 4547 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs 4548 var React24 = __toESM(require_react(), 1); 4549 var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit; 4550 function useFocus(store2, props = {}) { 4551 const { 4552 enabled = true, 4553 delay 4554 } = props; 4555 const { 4556 events, 4557 dataRef 4558 } = store2.context; 4559 const blockFocusRef = React24.useRef(false); 4560 const blockedReferenceRef = React24.useRef(null); 4561 const keyboardModalityRef = React24.useRef(true); 4562 const timeout = useTimeout(); 4563 React24.useEffect(() => { 4564 const domReference = store2.select("domReferenceElement"); 4565 if (!enabled) { 4566 return void 0; 4567 } 4568 const win = getWindow(domReference); 4569 function onBlur() { 4570 const currentDomReference = store2.select("domReferenceElement"); 4571 if (!store2.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { 4572 blockFocusRef.current = true; 4573 blockedReferenceRef.current = currentDomReference; 4574 } 4575 } 4576 function onKeyDown() { 4577 keyboardModalityRef.current = true; 4578 } 4579 function onPointerDown() { 4580 keyboardModalityRef.current = false; 4581 } 4582 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); 4583 }, [store2, enabled]); 4584 React24.useEffect(() => { 4585 if (!enabled) { 4586 return void 0; 4587 } 4588 function onOpenChangeLocal(details) { 4589 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { 4590 const referenceElement = store2.select("domReferenceElement"); 4591 if (isElement(referenceElement)) { 4592 blockedReferenceRef.current = referenceElement; 4593 blockFocusRef.current = true; 4594 } 4595 } 4596 } 4597 events.on("openchange", onOpenChangeLocal); 4598 return () => { 4599 events.off("openchange", onOpenChangeLocal); 4600 }; 4601 }, [events, enabled, store2]); 4602 const reference = React24.useMemo(() => { 4603 function resetBlockedFocus() { 4604 blockFocusRef.current = false; 4605 blockedReferenceRef.current = null; 4606 } 4607 return { 4608 onMouseLeave() { 4609 resetBlockedFocus(); 4610 }, 4611 onFocus(event) { 4612 const focusTarget = event.currentTarget; 4613 if (blockFocusRef.current) { 4614 if (blockedReferenceRef.current === focusTarget) { 4615 return; 4616 } 4617 resetBlockedFocus(); 4618 } 4619 const target = getTarget(event.nativeEvent); 4620 if (isElement(target)) { 4621 if (isMacSafari && !event.relatedTarget) { 4622 if (!keyboardModalityRef.current && !isTypeableElement(target)) { 4623 return; 4624 } 4625 } else if (!matchesFocusVisible(target)) { 4626 return; 4627 } 4628 } 4629 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements); 4630 const { 4631 nativeEvent, 4632 currentTarget 4633 } = event; 4634 if (store2.select("open") && movedFromOtherEnabledTrigger || !delay) { 4635 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 4636 return; 4637 } 4638 timeout.start(delay, () => { 4639 if (blockFocusRef.current) { 4640 return; 4641 } 4642 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 4643 }); 4644 }, 4645 onBlur(event) { 4646 resetBlockedFocus(); 4647 const relatedTarget = event.relatedTarget; 4648 const nativeEvent = event.nativeEvent; 4649 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; 4650 timeout.start(0, () => { 4651 const domReference = store2.select("domReferenceElement"); 4652 const activeEl = activeElement(ownerDocument(domReference)); 4653 if (!relatedTarget && activeEl === domReference) { 4654 return; 4655 } 4656 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { 4657 return; 4658 } 4659 const nextFocusedElement = relatedTarget ?? activeEl; 4660 if (isTargetInsideEnabledTrigger(nextFocusedElement, store2.context.triggerElements)) { 4661 return; 4662 } 4663 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); 4664 }); 4665 } 4666 }; 4667 }, [dataRef, delay, store2, timeout]); 4668 return React24.useMemo(() => enabled ? { 4669 reference, 4670 trigger: reference 4671 } : {}, [enabled, reference]); 4672 } 4673 4674 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 4675 var React25 = __toESM(require_react(), 1); 4676 4677 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs 4678 var HoverInteraction = class _HoverInteraction { 4679 pointerType = void 0; 4680 interactedInside = false; 4681 handler = void 0; 4682 blockMouseMove = true; 4683 performedPointerEventsMutation = false; 4684 pointerEventsScopeElement = null; 4685 pointerEventsReferenceElement = null; 4686 pointerEventsFloatingElement = null; 4687 restTimeoutPending = false; 4688 openChangeTimeout = new Timeout(); 4689 restTimeout = new Timeout(); 4690 handleCloseOptions = void 0; 4691 static create() { 4692 return new _HoverInteraction(); 4693 } 4694 dispose = () => { 4695 this.openChangeTimeout.clear(); 4696 this.restTimeout.clear(); 4697 }; 4698 disposeEffect = () => { 4699 return this.dispose; 4700 }; 4701 }; 4702 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); 4703 function clearSafePolygonPointerEventsMutation(instance) { 4704 if (!instance.performedPointerEventsMutation) { 4705 return; 4706 } 4707 const scopeElement = instance.pointerEventsScopeElement; 4708 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { 4709 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); 4710 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); 4711 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); 4712 pointerEventsMutationOwnerByScopeElement.delete(scopeElement); 4713 } 4714 instance.performedPointerEventsMutation = false; 4715 instance.pointerEventsScopeElement = null; 4716 instance.pointerEventsReferenceElement = null; 4717 instance.pointerEventsFloatingElement = null; 4718 } 4719 function applySafePolygonPointerEventsMutation(instance, options) { 4720 const { 4721 scopeElement, 4722 referenceElement, 4723 floatingElement 4724 } = options; 4725 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); 4726 if (existingOwner && existingOwner !== instance) { 4727 clearSafePolygonPointerEventsMutation(existingOwner); 4728 } 4729 clearSafePolygonPointerEventsMutation(instance); 4730 instance.performedPointerEventsMutation = true; 4731 instance.pointerEventsScopeElement = scopeElement; 4732 instance.pointerEventsReferenceElement = referenceElement; 4733 instance.pointerEventsFloatingElement = floatingElement; 4734 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); 4735 scopeElement.style.pointerEvents = "none"; 4736 referenceElement.style.pointerEvents = "auto"; 4737 floatingElement.style.pointerEvents = "auto"; 4738 } 4739 function useHoverInteractionSharedState(store2) { 4740 const data = store2.context.dataRef.current; 4741 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; 4742 if (!data.hoverInteractionState) { 4743 data.hoverInteractionState = instance; 4744 } 4745 useOnMount(data.hoverInteractionState.disposeEffect); 4746 return data.hoverInteractionState; 4747 } 4748 4749 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 4750 function useHoverFloatingInteraction(store2, parameters = {}) { 4751 const { 4752 enabled = true, 4753 closeDelay: closeDelayProp = 0, 4754 nodeId: nodeIdProp 4755 } = parameters; 4756 const open2 = store2.useState("open"); 4757 const floatingElement = store2.useState("floatingElement"); 4758 const domReferenceElement = store2.useState("domReferenceElement"); 4759 const { 4760 dataRef 4761 } = store2.context; 4762 const tree = useFloatingTree(); 4763 const parentId = useFloatingParentNodeId(); 4764 const instance = useHoverInteractionSharedState(store2); 4765 const childClosedTimeout = useTimeout(); 4766 const isClickLikeOpenEvent2 = useStableCallback(() => { 4767 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 4768 }); 4769 const isHoverOpen = useStableCallback(() => { 4770 return isHoverOpenEvent(dataRef.current.openEvent?.type); 4771 }); 4772 const clearPointerEvents = useStableCallback(() => { 4773 clearSafePolygonPointerEventsMutation(instance); 4774 }); 4775 useIsoLayoutEffect(() => { 4776 if (!open2) { 4777 instance.pointerType = void 0; 4778 instance.restTimeoutPending = false; 4779 instance.interactedInside = false; 4780 clearPointerEvents(); 4781 } 4782 }, [open2, instance, clearPointerEvents]); 4783 React25.useEffect(() => { 4784 return clearPointerEvents; 4785 }, [clearPointerEvents]); 4786 useIsoLayoutEffect(() => { 4787 if (!enabled) { 4788 return void 0; 4789 } 4790 if (open2 && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { 4791 const ref = domReferenceElement; 4792 const floatingEl = floatingElement; 4793 const doc = ownerDocument(floatingElement); 4794 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; 4795 if (parentFloating) { 4796 parentFloating.style.pointerEvents = ""; 4797 } 4798 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; 4799 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; 4800 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? closest(ref, "[data-rootownerid]") ?? doc.body; 4801 applySafePolygonPointerEventsMutation(instance, { 4802 scopeElement, 4803 referenceElement: ref, 4804 floatingElement: floatingEl 4805 }); 4806 return () => { 4807 clearPointerEvents(); 4808 }; 4809 } 4810 return void 0; 4811 }, [enabled, open2, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); 4812 React25.useEffect(() => { 4813 if (!enabled) { 4814 return void 0; 4815 } 4816 function hasParentChildren() { 4817 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); 4818 } 4819 function closeWithDelay(event) { 4820 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); 4821 const close = () => { 4822 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 4823 tree?.events.emit("floating.closed", event); 4824 }; 4825 if (closeDelay) { 4826 instance.openChangeTimeout.start(closeDelay, close); 4827 } else { 4828 instance.openChangeTimeout.clear(); 4829 close(); 4830 } 4831 } 4832 function handleInteractInside(event) { 4833 const target = getTarget(event); 4834 if (!isInteractiveElement(target)) { 4835 instance.interactedInside = false; 4836 return; 4837 } 4838 instance.interactedInside = closest(target, "[aria-haspopup]") != null; 4839 } 4840 function onFloatingMouseEnter() { 4841 instance.openChangeTimeout.clear(); 4842 childClosedTimeout.clear(); 4843 tree?.events.off("floating.closed", onNodeClosed); 4844 clearPointerEvents(); 4845 } 4846 function onFloatingMouseLeave(event) { 4847 if (hasParentChildren() && tree) { 4848 tree.events.on("floating.closed", onNodeClosed); 4849 return; 4850 } 4851 if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { 4852 return; 4853 } 4854 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; 4855 const relatedTarget = event.relatedTarget; 4856 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); 4857 if (isMovingIntoDescendantFloating) { 4858 return; 4859 } 4860 if (instance.handler) { 4861 instance.handler(event); 4862 return; 4863 } 4864 clearPointerEvents(); 4865 if (isHoverOpen() && !isClickLikeOpenEvent2()) { 4866 closeWithDelay(event); 4867 } 4868 } 4869 function onNodeClosed(event) { 4870 if (!tree || !parentId || hasParentChildren()) { 4871 return; 4872 } 4873 childClosedTimeout.start(0, () => { 4874 tree.events.off("floating.closed", onNodeClosed); 4875 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 4876 tree.events.emit("floating.closed", event); 4877 }); 4878 } 4879 const floating = floatingElement; 4880 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { 4881 tree?.events.off("floating.closed", onNodeClosed); 4882 }); 4883 }, [enabled, floatingElement, store2, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); 4884 } 4885 4886 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs 4887 var React26 = __toESM(require_react(), 1); 4888 var ReactDOM4 = __toESM(require_react_dom(), 1); 4889 var EMPTY_REF = { 4890 current: null 4891 }; 4892 function useHoverReferenceInteraction(store2, props = {}) { 4893 const { 4894 enabled = true, 4895 delay = 0, 4896 handleClose = null, 4897 mouseOnly = false, 4898 restMs = 0, 4899 move: move2 = true, 4900 triggerElementRef = EMPTY_REF, 4901 externalTree, 4902 isActiveTrigger = true, 4903 getHandleCloseContext, 4904 isClosing, 4905 shouldOpen: shouldOpenProp, 4906 guardStaleOpen = false 4907 } = props; 4908 const { 4909 dataRef, 4910 events 4911 } = store2.context; 4912 const tree = useFloatingTree(externalTree); 4913 const instance = useHoverInteractionSharedState(store2); 4914 const isHoverCloseActiveRef = React26.useRef(false); 4915 const handleCloseRef = useValueAsRef(handleClose); 4916 const delayRef = useValueAsRef(delay); 4917 const restMsRef = useValueAsRef(restMs); 4918 const enabledRef = useValueAsRef(enabled); 4919 const shouldOpenRef = useValueAsRef(shouldOpenProp); 4920 const isClosingRef = useValueAsRef(isClosing); 4921 const isClickLikeOpenEvent2 = useStableCallback(() => { 4922 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 4923 }); 4924 const checkShouldOpen = useStableCallback(() => { 4925 return shouldOpenRef.current?.() !== false; 4926 }); 4927 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { 4928 const allTriggers = store2.context.triggerElements; 4929 if (allTriggers.hasElement(currentTarget)) { 4930 return !currentDomReference || !contains(currentDomReference, currentTarget); 4931 } 4932 if (!isElement(target)) { 4933 return false; 4934 } 4935 const targetElement = target; 4936 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); 4937 }); 4938 const cleanupMouseMoveHandler = useStableCallback(() => { 4939 if (!instance.handler) { 4940 return; 4941 } 4942 const doc = ownerDocument(store2.select("domReferenceElement")); 4943 doc.removeEventListener("mousemove", instance.handler); 4944 instance.handler = void 0; 4945 }); 4946 const clearPointerEvents = useStableCallback(() => { 4947 clearSafePolygonPointerEventsMutation(instance); 4948 }); 4949 if (isActiveTrigger) { 4950 instance.handleCloseOptions = handleClose?.__options; 4951 } 4952 React26.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); 4953 React26.useEffect(() => { 4954 if (!enabled) { 4955 return void 0; 4956 } 4957 function onOpenChangeLocal(details) { 4958 if (!details.open) { 4959 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; 4960 cleanupMouseMoveHandler(); 4961 instance.openChangeTimeout.clear(); 4962 instance.restTimeout.clear(); 4963 instance.blockMouseMove = true; 4964 instance.restTimeoutPending = false; 4965 } else { 4966 isHoverCloseActiveRef.current = false; 4967 } 4968 } 4969 events.on("openchange", onOpenChangeLocal); 4970 return () => { 4971 events.off("openchange", onOpenChangeLocal); 4972 }; 4973 }, [enabled, events, instance, cleanupMouseMoveHandler]); 4974 React26.useEffect(() => { 4975 if (!enabled) { 4976 return void 0; 4977 } 4978 function closeWithDelay(event, runElseBranch = true) { 4979 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); 4980 if (closeDelay) { 4981 instance.openChangeTimeout.start(closeDelay, () => { 4982 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 4983 tree?.events.emit("floating.closed", event); 4984 }); 4985 } else if (runElseBranch) { 4986 instance.openChangeTimeout.clear(); 4987 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 4988 tree?.events.emit("floating.closed", event); 4989 } 4990 } 4991 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store2.select("domReferenceElement") : null); 4992 if (!isElement(trigger)) { 4993 return void 0; 4994 } 4995 function onMouseEnter(event) { 4996 instance.openChangeTimeout.clear(); 4997 instance.blockMouseMove = false; 4998 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 4999 return; 5000 } 5001 const restMsValue = getRestMs(restMsRef.current); 5002 const openDelay = getDelay(delayRef.current, "open", instance.pointerType); 5003 const eventTarget = getTarget(event); 5004 const currentTarget = event.currentTarget ?? null; 5005 const currentDomReference = store2.select("domReferenceElement"); 5006 let triggerNode = currentTarget; 5007 if (isElement(eventTarget) && !store2.context.triggerElements.hasElement(eventTarget)) { 5008 for (const triggerElement of store2.context.triggerElements.elements()) { 5009 if (contains(triggerElement, eventTarget)) { 5010 triggerNode = triggerElement; 5011 break; 5012 } 5013 } 5014 } 5015 if (isElement(currentTarget) && isElement(currentDomReference) && !store2.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { 5016 triggerNode = currentDomReference; 5017 } 5018 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); 5019 const isOpen = store2.select("open"); 5020 const isInClosingTransition = isClosingRef.current?.() ?? store2.select("transitionStatus") === "ending"; 5021 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; 5022 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; 5023 const isRestOnlyDelay = restMsValue > 0 && !openDelay; 5024 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; 5025 const shouldOpen = !isOpen || isOverInactive; 5026 if (shouldOpenImmediately) { 5027 if (checkShouldOpen()) { 5028 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 5029 } 5030 return; 5031 } 5032 if (isRestOnlyDelay) { 5033 return; 5034 } 5035 if (openDelay) { 5036 instance.openChangeTimeout.start(openDelay, () => { 5037 if (shouldOpen && checkShouldOpen()) { 5038 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 5039 } 5040 }); 5041 } else if (shouldOpen) { 5042 if (checkShouldOpen()) { 5043 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 5044 } 5045 } 5046 } 5047 function onMouseLeave(event) { 5048 if (isClickLikeOpenEvent2()) { 5049 clearPointerEvents(); 5050 return; 5051 } 5052 cleanupMouseMoveHandler(); 5053 const domReferenceElement = store2.select("domReferenceElement"); 5054 const doc = ownerDocument(domReferenceElement); 5055 instance.restTimeout.clear(); 5056 instance.restTimeoutPending = false; 5057 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); 5058 if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { 5059 return; 5060 } 5061 if (handleCloseRef.current && handleCloseContextBase) { 5062 if (!store2.select("open")) { 5063 instance.openChangeTimeout.clear(); 5064 } 5065 const currentTrigger = triggerElementRef.current; 5066 instance.handler = handleCloseRef.current({ 5067 ...handleCloseContextBase, 5068 tree, 5069 x: event.clientX, 5070 y: event.clientY, 5071 onClose() { 5072 clearPointerEvents(); 5073 cleanupMouseMoveHandler(); 5074 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store2.select("domReferenceElement")) { 5075 closeWithDelay(event, true); 5076 } 5077 } 5078 }); 5079 doc.addEventListener("mousemove", instance.handler); 5080 instance.handler(event); 5081 return; 5082 } 5083 const shouldClose = instance.pointerType === "touch" ? !contains(store2.select("floatingElement"), event.relatedTarget) : true; 5084 if (shouldClose) { 5085 closeWithDelay(event); 5086 } 5087 } 5088 function onMouseOut(event) { 5089 if (contains(trigger, event.relatedTarget)) { 5090 return; 5091 } 5092 instance.openChangeTimeout.clear(); 5093 instance.restTimeout.clear(); 5094 instance.restTimeoutPending = false; 5095 } 5096 const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, "mouseout", onMouseOut) : void 0; 5097 if (move2) { 5098 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { 5099 once: true 5100 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); 5101 } 5102 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); 5103 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store2, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move2, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]); 5104 return React26.useMemo(() => { 5105 if (!enabled) { 5106 return void 0; 5107 } 5108 function setPointerRef(event) { 5109 instance.pointerType = event.pointerType; 5110 } 5111 return { 5112 onPointerDown: setPointerRef, 5113 onPointerEnter: setPointerRef, 5114 onMouseMove(event) { 5115 const { 5116 nativeEvent 5117 } = event; 5118 const trigger = event.currentTarget; 5119 const currentDomReference = store2.select("domReferenceElement"); 5120 const currentOpen = store2.select("open"); 5121 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); 5122 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 5123 return; 5124 } 5125 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { 5126 const floatingElement = store2.select("floatingElement"); 5127 if (floatingElement) { 5128 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; 5129 applySafePolygonPointerEventsMutation(instance, { 5130 scopeElement, 5131 referenceElement: trigger, 5132 floatingElement 5133 }); 5134 } 5135 } 5136 const restMsValue = getRestMs(restMsRef.current); 5137 if (currentOpen && !isOverInactive || restMsValue === 0) { 5138 return; 5139 } 5140 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { 5141 return; 5142 } 5143 instance.restTimeout.clear(); 5144 function handleMouseMove() { 5145 instance.restTimeoutPending = false; 5146 if (isClickLikeOpenEvent2()) { 5147 return; 5148 } 5149 const latestOpen = store2.select("open"); 5150 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { 5151 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); 5152 } 5153 } 5154 if (instance.pointerType === "touch") { 5155 ReactDOM4.flushSync(() => { 5156 handleMouseMove(); 5157 }); 5158 } else if (isOverInactive && currentOpen) { 5159 handleMouseMove(); 5160 } else { 5161 instance.restTimeoutPending = true; 5162 instance.restTimeout.start(restMsValue, handleMouseMove); 5163 } 5164 } 5165 }; 5166 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store2, restMsRef, checkShouldOpen]); 5167 } 5168 5169 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs 5170 var CURSOR_SPEED_THRESHOLD = 0.1; 5171 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; 5172 var POLYGON_BUFFER = 0.5; 5173 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { 5174 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; 5175 } 5176 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { 5177 let isInsideValue = false; 5178 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { 5179 isInsideValue = !isInsideValue; 5180 } 5181 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { 5182 isInsideValue = !isInsideValue; 5183 } 5184 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { 5185 isInsideValue = !isInsideValue; 5186 } 5187 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { 5188 isInsideValue = !isInsideValue; 5189 } 5190 return isInsideValue; 5191 } 5192 function isInsideRect(pointX, pointY, rect) { 5193 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; 5194 } 5195 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { 5196 const minX = Math.min(x1, x2); 5197 const maxX = Math.max(x1, x2); 5198 const minY = Math.min(y1, y2); 5199 const maxY = Math.max(y1, y2); 5200 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; 5201 } 5202 function safePolygon(options = {}) { 5203 const { 5204 blockPointerEvents = false 5205 } = options; 5206 const timeout = new Timeout(); 5207 const fn = ({ 5208 x, 5209 y, 5210 placement, 5211 elements, 5212 onClose, 5213 nodeId, 5214 tree 5215 }) => { 5216 const side = placement?.split("-")[0]; 5217 let hasLanded = false; 5218 let lastX = null; 5219 let lastY = null; 5220 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; 5221 function isCursorMovingSlowly(nextX, nextY) { 5222 const currentTime = performance.now(); 5223 const elapsedTime = currentTime - lastCursorTime; 5224 if (lastX === null || lastY === null || elapsedTime === 0) { 5225 lastX = nextX; 5226 lastY = nextY; 5227 lastCursorTime = currentTime; 5228 return false; 5229 } 5230 const deltaX = nextX - lastX; 5231 const deltaY = nextY - lastY; 5232 const distanceSquared = deltaX * deltaX + deltaY * deltaY; 5233 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; 5234 lastX = nextX; 5235 lastY = nextY; 5236 lastCursorTime = currentTime; 5237 return distanceSquared < thresholdSquared; 5238 } 5239 function close() { 5240 timeout.clear(); 5241 onClose(); 5242 } 5243 return function onMouseMove(event) { 5244 timeout.clear(); 5245 const domReference = elements.domReference; 5246 const floating = elements.floating; 5247 if (!domReference || !floating || side == null || x == null || y == null) { 5248 return void 0; 5249 } 5250 const { 5251 clientX, 5252 clientY 5253 } = event; 5254 const target = getTarget(event); 5255 const isLeave = event.type === "mouseleave"; 5256 const isOverFloatingEl = contains(floating, target); 5257 const isOverReferenceEl = contains(domReference, target); 5258 if (isOverFloatingEl) { 5259 hasLanded = true; 5260 if (!isLeave) { 5261 return void 0; 5262 } 5263 } 5264 if (isOverReferenceEl) { 5265 hasLanded = false; 5266 if (!isLeave) { 5267 hasLanded = true; 5268 return void 0; 5269 } 5270 } 5271 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { 5272 return void 0; 5273 } 5274 function hasOpenChildNode() { 5275 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); 5276 } 5277 function closeIfNoOpenChild() { 5278 if (!hasOpenChildNode()) { 5279 close(); 5280 } 5281 } 5282 if (hasOpenChildNode()) { 5283 return void 0; 5284 } 5285 const refRect = domReference.getBoundingClientRect(); 5286 const rect = floating.getBoundingClientRect(); 5287 const cursorLeaveFromRight = x > rect.right - rect.width / 2; 5288 const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; 5289 const isFloatingWider = rect.width > refRect.width; 5290 const isFloatingTaller = rect.height > refRect.height; 5291 const left = (isFloatingWider ? refRect : rect).left; 5292 const right = (isFloatingWider ? refRect : rect).right; 5293 const top = (isFloatingTaller ? refRect : rect).top; 5294 const bottom = (isFloatingTaller ? refRect : rect).bottom; 5295 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) { 5296 closeIfNoOpenChild(); 5297 return void 0; 5298 } 5299 let isInsideTroughRect = false; 5300 switch (side) { 5301 case "top": 5302 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); 5303 break; 5304 case "bottom": 5305 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); 5306 break; 5307 case "left": 5308 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); 5309 break; 5310 case "right": 5311 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); 5312 break; 5313 default: 5314 } 5315 if (isInsideTroughRect) { 5316 return void 0; 5317 } 5318 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { 5319 closeIfNoOpenChild(); 5320 return void 0; 5321 } 5322 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { 5323 closeIfNoOpenChild(); 5324 return void 0; 5325 } 5326 let isInsidePolygon = false; 5327 switch (side) { 5328 case "top": { 5329 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 5330 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 5331 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 5332 const cursorPointY = y + POLYGON_BUFFER + 1; 5333 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; 5334 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; 5335 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 5336 break; 5337 } 5338 case "bottom": { 5339 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 5340 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 5341 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 5342 const cursorPointY = y - POLYGON_BUFFER; 5343 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; 5344 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; 5345 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 5346 break; 5347 } 5348 case "left": { 5349 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 5350 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 5351 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 5352 const cursorPointX = x + POLYGON_BUFFER + 1; 5353 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; 5354 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; 5355 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); 5356 break; 5357 } 5358 case "right": { 5359 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 5360 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 5361 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 5362 const cursorPointX = x - POLYGON_BUFFER; 5363 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; 5364 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; 5365 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); 5366 break; 5367 } 5368 default: 5369 } 5370 if (!isInsidePolygon) { 5371 closeIfNoOpenChild(); 5372 } else if (!hasLanded) { 5373 timeout.start(40, closeIfNoOpenChild); 5374 } 5375 return void 0; 5376 }; 5377 }; 5378 fn.__options = { 5379 ...options, 5380 blockPointerEvents 5381 }; 5382 return fn; 5383 } 5384 5385 // node_modules/.store/@floating-ui/core@1.8.0-3V8aS7jJHHGcsCINjP9-5A/node_modules/@floating-ui/core/dist/floating-ui.core.mjs 5386 function computeCoordsFromPlacement(_ref, placement, rtl) { 5387 let { 5388 reference, 5389 floating 5390 } = _ref; 5391 const sideAxis = getSideAxis(placement); 5392 const alignmentAxis = getAlignmentAxis(placement); 5393 const alignLength = getAxisLength(alignmentAxis); 5394 const side = getSide(placement); 5395 const isVertical = sideAxis === "y"; 5396 const commonX = reference.x + reference.width / 2 - floating.width / 2; 5397 const commonY = reference.y + reference.height / 2 - floating.height / 2; 5398 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 5399 let coords; 5400 switch (side) { 5401 case "top": 5402 coords = { 5403 x: commonX, 5404 y: reference.y - floating.height 5405 }; 5406 break; 5407 case "bottom": 5408 coords = { 5409 x: commonX, 5410 y: reference.y + reference.height 5411 }; 5412 break; 5413 case "right": 5414 coords = { 5415 x: reference.x + reference.width, 5416 y: commonY 5417 }; 5418 break; 5419 case "left": 5420 coords = { 5421 x: reference.x - floating.width, 5422 y: commonY 5423 }; 5424 break; 5425 default: 5426 coords = { 5427 x: reference.x, 5428 y: reference.y 5429 }; 5430 } 5431 const alignment = getAlignment(placement); 5432 if (alignment) { 5433 coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1); 5434 } 5435 return coords; 5436 } 5437 async function detectOverflow(state, options) { 5438 var _await$platform$isEle; 5439 if (options === void 0) { 5440 options = {}; 5441 } 5442 const { 5443 x, 5444 y, 5445 platform: platform3, 5446 rects, 5447 elements, 5448 strategy 5449 } = state; 5450 const { 5451 boundary = "clippingAncestors", 5452 rootBoundary = "viewport", 5453 elementContext = "floating", 5454 altBoundary = false, 5455 padding = 0 5456 } = evaluate(options, state); 5457 const paddingObject = getPaddingObject(padding); 5458 const altContext = elementContext === "floating" ? "reference" : "floating"; 5459 const element = elements[altBoundary ? altContext : elementContext]; 5460 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ 5461 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)), 5462 boundary, 5463 rootBoundary, 5464 strategy 5465 })); 5466 const rect = elementContext === "floating" ? { 5467 x, 5468 y, 5469 width: rects.floating.width, 5470 height: rects.floating.height 5471 } : rects.reference; 5472 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); 5473 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) && await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { 5474 x: 1, 5475 y: 1 5476 }; 5477 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ 5478 elements, 5479 rect, 5480 offsetParent, 5481 strategy 5482 }) : rect); 5483 return { 5484 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 5485 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 5486 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 5487 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 5488 }; 5489 } 5490 var MAX_RESET_COUNT = 50; 5491 var computePosition = async (reference, floating, config) => { 5492 const { 5493 placement = "bottom", 5494 strategy = "absolute", 5495 middleware = [], 5496 platform: platform3 5497 } = config; 5498 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { 5499 ...platform3, 5500 detectOverflow 5501 }; 5502 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); 5503 let rects = await platform3.getElementRects({ 5504 reference, 5505 floating, 5506 strategy 5507 }); 5508 let { 5509 x, 5510 y 5511 } = computeCoordsFromPlacement(rects, placement, rtl); 5512 let statefulPlacement = placement; 5513 let resetCount = 0; 5514 const middlewareData = {}; 5515 for (let i = 0; i < middleware.length; i++) { 5516 const currentMiddleware = middleware[i]; 5517 if (!currentMiddleware) { 5518 continue; 5519 } 5520 const { 5521 name, 5522 fn 5523 } = currentMiddleware; 5524 const { 5525 x: nextX, 5526 y: nextY, 5527 data, 5528 reset 5529 } = await fn({ 5530 x, 5531 y, 5532 initialPlacement: placement, 5533 placement: statefulPlacement, 5534 strategy, 5535 middlewareData, 5536 rects, 5537 platform: platformWithDetectOverflow, 5538 elements: { 5539 reference, 5540 floating 5541 } 5542 }); 5543 x = nextX != null ? nextX : x; 5544 y = nextY != null ? nextY : y; 5545 middlewareData[name] = { 5546 ...middlewareData[name], 5547 ...data 5548 }; 5549 if (reset && resetCount < MAX_RESET_COUNT) { 5550 resetCount++; 5551 if (typeof reset === "object") { 5552 if (reset.placement) { 5553 statefulPlacement = reset.placement; 5554 } 5555 if (reset.rects) { 5556 rects = reset.rects === true ? await platform3.getElementRects({ 5557 reference, 5558 floating, 5559 strategy 5560 }) : reset.rects; 5561 } 5562 ({ 5563 x, 5564 y 5565 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 5566 } 5567 i = -1; 5568 } 5569 } 5570 return { 5571 x, 5572 y, 5573 placement: statefulPlacement, 5574 strategy, 5575 middlewareData 5576 }; 5577 }; 5578 var flip = function(options) { 5579 if (options === void 0) { 5580 options = {}; 5581 } 5582 return { 5583 name: "flip", 5584 options, 5585 async fn(state) { 5586 var _middlewareData$arrow, _middlewareData$flip; 5587 const { 5588 placement, 5589 middlewareData, 5590 rects, 5591 initialPlacement, 5592 platform: platform3, 5593 elements 5594 } = state; 5595 const { 5596 mainAxis: checkMainAxis = true, 5597 crossAxis: checkCrossAxis = true, 5598 fallbackPlacements: specifiedFallbackPlacements, 5599 fallbackStrategy = "bestFit", 5600 fallbackAxisSideDirection = "none", 5601 flipAlignment = true, 5602 ...detectOverflowOptions 5603 } = evaluate(options, state); 5604 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 5605 return {}; 5606 } 5607 const side = getSide(placement); 5608 const initialSideAxis = getSideAxis(initialPlacement); 5609 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 5610 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 5611 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 5612 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; 5613 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { 5614 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 5615 } 5616 const placements2 = [initialPlacement, ...fallbackPlacements]; 5617 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 5618 const overflows = []; 5619 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 5620 if (checkMainAxis) { 5621 overflows.push(overflow[side]); 5622 } 5623 if (checkCrossAxis) { 5624 const sides2 = getAlignmentSides(placement, rects, rtl); 5625 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 5626 } 5627 overflowsData = [...overflowsData, { 5628 placement, 5629 overflows 5630 }]; 5631 if (!overflows.every((side2) => side2 <= 0)) { 5632 var _middlewareData$flip2, _overflowsData$filter; 5633 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 5634 const nextPlacement = placements2[nextIndex]; 5635 if (nextPlacement) { 5636 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; 5637 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis 5638 // overflows the main axis. 5639 overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { 5640 return { 5641 data: { 5642 index: nextIndex, 5643 overflows: overflowsData 5644 }, 5645 reset: { 5646 placement: nextPlacement 5647 } 5648 }; 5649 } 5650 } 5651 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; 5652 if (!resetPlacement) { 5653 switch (fallbackStrategy) { 5654 case "bestFit": { 5655 var _overflowsData$filter2; 5656 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { 5657 if (hasFallbackAxisSideDirection) { 5658 const currentSideAxis = getSideAxis(d.placement); 5659 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal 5660 // reading directions favoring greater width. 5661 currentSideAxis === "y"; 5662 } 5663 return true; 5664 }).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]; 5665 if (placement2) { 5666 resetPlacement = placement2; 5667 } 5668 break; 5669 } 5670 case "initialPlacement": 5671 resetPlacement = initialPlacement; 5672 break; 5673 } 5674 } 5675 if (placement !== resetPlacement) { 5676 return { 5677 reset: { 5678 placement: resetPlacement 5679 } 5680 }; 5681 } 5682 } 5683 return {}; 5684 } 5685 }; 5686 }; 5687 var originSides = /* @__PURE__ */ new Set(["left", "top"]); 5688 async function convertValueToCoords(state, options) { 5689 const { 5690 placement, 5691 platform: platform3, 5692 elements 5693 } = state; 5694 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 5695 const side = getSide(placement); 5696 const alignment = getAlignment(placement); 5697 const isVertical = getSideAxis(placement) === "y"; 5698 const mainAxisMulti = originSides.has(side) ? -1 : 1; 5699 const crossAxisMulti = rtl && isVertical ? -1 : 1; 5700 const rawValue = evaluate(options, state); 5701 let { 5702 mainAxis, 5703 crossAxis, 5704 alignmentAxis 5705 } = typeof rawValue === "number" ? { 5706 mainAxis: rawValue, 5707 crossAxis: 0, 5708 alignmentAxis: null 5709 } : { 5710 mainAxis: rawValue.mainAxis || 0, 5711 crossAxis: rawValue.crossAxis || 0, 5712 alignmentAxis: rawValue.alignmentAxis 5713 }; 5714 if (alignment && typeof alignmentAxis === "number") { 5715 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 5716 } 5717 return isVertical ? { 5718 x: crossAxis * crossAxisMulti, 5719 y: mainAxis * mainAxisMulti 5720 } : { 5721 x: mainAxis * mainAxisMulti, 5722 y: crossAxis * crossAxisMulti 5723 }; 5724 } 5725 var offset = function(options) { 5726 if (options === void 0) { 5727 options = 0; 5728 } 5729 return { 5730 name: "offset", 5731 options, 5732 async fn(state) { 5733 var _middlewareData$offse, _middlewareData$arrow; 5734 const { 5735 x, 5736 y, 5737 placement, 5738 middlewareData 5739 } = state; 5740 const diffCoords = await convertValueToCoords(state, options); 5741 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 5742 return {}; 5743 } 5744 return { 5745 x: x + diffCoords.x, 5746 y: y + diffCoords.y, 5747 data: { 5748 ...diffCoords, 5749 placement 5750 } 5751 }; 5752 } 5753 }; 5754 }; 5755 var shift = function(options) { 5756 if (options === void 0) { 5757 options = {}; 5758 } 5759 return { 5760 name: "shift", 5761 options, 5762 async fn(state) { 5763 const { 5764 x, 5765 y, 5766 placement, 5767 platform: platform3 5768 } = state; 5769 const { 5770 mainAxis: checkMainAxis = true, 5771 crossAxis: checkCrossAxis = false, 5772 limiter = { 5773 fn: (_ref) => { 5774 let { 5775 x: x2, 5776 y: y2 5777 } = _ref; 5778 return { 5779 x: x2, 5780 y: y2 5781 }; 5782 } 5783 }, 5784 ...detectOverflowOptions 5785 } = evaluate(options, state); 5786 const coords = { 5787 x, 5788 y 5789 }; 5790 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 5791 const crossAxis = getSideAxis(placement); 5792 const mainAxis = getOppositeAxis(crossAxis); 5793 let mainAxisCoord = coords[mainAxis]; 5794 let crossAxisCoord = coords[crossAxis]; 5795 const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]); 5796 if (checkMainAxis) { 5797 mainAxisCoord = clampCoord(mainAxis, mainAxisCoord); 5798 } 5799 if (checkCrossAxis) { 5800 crossAxisCoord = clampCoord(crossAxis, crossAxisCoord); 5801 } 5802 const limitedCoords = limiter.fn({ 5803 ...state, 5804 [mainAxis]: mainAxisCoord, 5805 [crossAxis]: crossAxisCoord 5806 }); 5807 return { 5808 ...limitedCoords, 5809 data: { 5810 x: limitedCoords.x - x, 5811 y: limitedCoords.y - y, 5812 enabled: { 5813 [mainAxis]: checkMainAxis, 5814 [crossAxis]: checkCrossAxis 5815 } 5816 } 5817 }; 5818 } 5819 }; 5820 }; 5821 var limitShift = function(options) { 5822 if (options === void 0) { 5823 options = {}; 5824 } 5825 return { 5826 options, 5827 fn(state) { 5828 var _rawOffset$mainAxis, _rawOffset$crossAxis; 5829 const { 5830 x, 5831 y, 5832 placement, 5833 rects, 5834 middlewareData 5835 } = state; 5836 const { 5837 offset: offset4 = 0, 5838 mainAxis: checkMainAxis = true, 5839 crossAxis: checkCrossAxis = true 5840 } = evaluate(options, state); 5841 const coords = { 5842 x, 5843 y 5844 }; 5845 const crossAxis = getSideAxis(placement); 5846 const mainAxis = getOppositeAxis(crossAxis); 5847 let mainAxisCoord = coords[mainAxis]; 5848 let crossAxisCoord = coords[crossAxis]; 5849 const rawOffset = evaluate(offset4, state); 5850 const computedOffset = typeof rawOffset === "number" ? { 5851 mainAxis: rawOffset, 5852 crossAxis: 0 5853 } : { 5854 mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0, 5855 crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0 5856 }; 5857 if (checkMainAxis) { 5858 const len = mainAxis === "y" ? "height" : "width"; 5859 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 5860 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 5861 if (mainAxisCoord < limitMin) { 5862 mainAxisCoord = limitMin; 5863 } else if (mainAxisCoord > limitMax) { 5864 mainAxisCoord = limitMax; 5865 } 5866 } 5867 if (checkCrossAxis) { 5868 var _middlewareData$offse, _middlewareData$offse2; 5869 const len = mainAxis === "y" ? "width" : "height"; 5870 const isOriginSide = originSides.has(getSide(placement)); 5871 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); 5872 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); 5873 if (crossAxisCoord < limitMin) { 5874 crossAxisCoord = limitMin; 5875 } else if (crossAxisCoord > limitMax) { 5876 crossAxisCoord = limitMax; 5877 } 5878 } 5879 return { 5880 [mainAxis]: mainAxisCoord, 5881 [crossAxis]: crossAxisCoord 5882 }; 5883 } 5884 }; 5885 }; 5886 var size = function(options) { 5887 if (options === void 0) { 5888 options = {}; 5889 } 5890 return { 5891 name: "size", 5892 options, 5893 async fn(state) { 5894 const { 5895 placement, 5896 rects, 5897 platform: platform3, 5898 elements 5899 } = state; 5900 const { 5901 apply = () => { 5902 }, 5903 ...detectOverflowOptions 5904 } = evaluate(options, state); 5905 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 5906 const side = getSide(placement); 5907 const alignment = getAlignment(placement); 5908 const isYAxis = getSideAxis(placement) === "y"; 5909 const { 5910 width, 5911 height 5912 } = rects.floating; 5913 let heightSide; 5914 let widthSide; 5915 if (side === "top" || side === "bottom") { 5916 heightSide = side; 5917 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; 5918 } else { 5919 widthSide = side; 5920 heightSide = alignment === "end" ? "top" : "bottom"; 5921 } 5922 const maximumClippingHeight = height - overflow.top - overflow.bottom; 5923 const maximumClippingWidth = width - overflow.left - overflow.right; 5924 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); 5925 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); 5926 const shiftData = state.middlewareData.shift; 5927 const noShift = !shiftData; 5928 let availableHeight2 = overflowAvailableHeight; 5929 let availableWidth2 = overflowAvailableWidth; 5930 if (shiftData != null && shiftData.enabled.x) { 5931 availableWidth2 = maximumClippingWidth; 5932 } 5933 if (shiftData != null && shiftData.enabled.y) { 5934 availableHeight2 = maximumClippingHeight; 5935 } 5936 if (noShift && !alignment) { 5937 if (isYAxis) { 5938 availableWidth2 = width - 2 * max(overflow.left, overflow.right); 5939 } else { 5940 availableHeight2 = height - 2 * max(overflow.top, overflow.bottom); 5941 } 5942 } 5943 await apply({ 5944 ...state, 5945 availableWidth: availableWidth2, 5946 availableHeight: availableHeight2 5947 }); 5948 const nextDimensions = await platform3.getDimensions(elements.floating); 5949 if (width !== nextDimensions.width || height !== nextDimensions.height) { 5950 return { 5951 reset: { 5952 rects: true 5953 } 5954 }; 5955 } 5956 return {}; 5957 } 5958 }; 5959 }; 5960 5961 // node_modules/.store/@floating-ui/dom@1.8.0-vHXcr4FgWneV0cgwFw-d7A/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 5962 function getCssDimensions(element) { 5963 const css = getComputedStyle2(element); 5964 let width = parseFloat(css.width) || 0; 5965 let height = parseFloat(css.height) || 0; 5966 const hasOffset = isHTMLElement(element); 5967 const offsetWidth = hasOffset ? element.offsetWidth : width; 5968 const offsetHeight = hasOffset ? element.offsetHeight : height; 5969 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 5970 if (shouldFallback) { 5971 width = offsetWidth; 5972 height = offsetHeight; 5973 } 5974 return { 5975 width, 5976 height, 5977 $: shouldFallback 5978 }; 5979 } 5980 function unwrapElement(element) { 5981 return !isElement(element) ? element.contextElement : element; 5982 } 5983 function getScale(element) { 5984 const domElement = unwrapElement(element); 5985 if (!isHTMLElement(domElement)) { 5986 return createCoords(1); 5987 } 5988 const rect = domElement.getBoundingClientRect(); 5989 const { 5990 width, 5991 height, 5992 $ 5993 } = getCssDimensions(domElement); 5994 let x = ($ ? round(rect.width) : rect.width) / width; 5995 let y = ($ ? round(rect.height) : rect.height) / height; 5996 if (!x || !Number.isFinite(x)) { 5997 x = 1; 5998 } 5999 if (!y || !Number.isFinite(y)) { 6000 y = 1; 6001 } 6002 return { 6003 x, 6004 y 6005 }; 6006 } 6007 var noOffsets = /* @__PURE__ */ createCoords(0); 6008 function getVisualOffsets(element) { 6009 const win = getWindow(element); 6010 if (!isWebKit() || !win.visualViewport) { 6011 return noOffsets; 6012 } 6013 return { 6014 x: win.visualViewport.offsetLeft, 6015 y: win.visualViewport.offsetTop 6016 }; 6017 } 6018 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 6019 if (isFixed === void 0) { 6020 isFixed = false; 6021 } 6022 return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element); 6023 } 6024 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 6025 if (includeScale === void 0) { 6026 includeScale = false; 6027 } 6028 if (isFixedStrategy === void 0) { 6029 isFixedStrategy = false; 6030 } 6031 const clientRect = element.getBoundingClientRect(); 6032 const domElement = unwrapElement(element); 6033 let scale = createCoords(1); 6034 if (includeScale) { 6035 if (offsetParent) { 6036 if (isElement(offsetParent)) { 6037 scale = getScale(offsetParent); 6038 } 6039 } else { 6040 scale = getScale(element); 6041 } 6042 } 6043 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 6044 let x = (clientRect.left + visualOffsets.x) / scale.x; 6045 let y = (clientRect.top + visualOffsets.y) / scale.y; 6046 let width = clientRect.width / scale.x; 6047 let height = clientRect.height / scale.y; 6048 if (domElement && offsetParent) { 6049 const win = getWindow(domElement); 6050 const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 6051 let currentWin = win; 6052 let currentIFrame = getFrameElement(currentWin); 6053 while (currentIFrame && offsetWin !== currentWin) { 6054 const iframeScale = getScale(currentIFrame); 6055 const iframeRect = currentIFrame.getBoundingClientRect(); 6056 const css = getComputedStyle2(currentIFrame); 6057 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 6058 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 6059 x *= iframeScale.x; 6060 y *= iframeScale.y; 6061 width *= iframeScale.x; 6062 height *= iframeScale.y; 6063 x += left; 6064 y += top; 6065 currentWin = getWindow(currentIFrame); 6066 currentIFrame = getFrameElement(currentWin); 6067 } 6068 } 6069 return rectToClientRect({ 6070 width, 6071 height, 6072 x, 6073 y 6074 }); 6075 } 6076 function getWindowScrollBarX(element, rect) { 6077 const leftScroll = getNodeScroll(element).scrollLeft; 6078 if (!rect) { 6079 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; 6080 } 6081 return rect.left + leftScroll; 6082 } 6083 function getHTMLOffset(documentElement, scroll) { 6084 const htmlRect = documentElement.getBoundingClientRect(); 6085 const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); 6086 const y = htmlRect.top + scroll.scrollTop; 6087 return { 6088 x, 6089 y 6090 }; 6091 } 6092 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 6093 let { 6094 elements, 6095 rect, 6096 offsetParent, 6097 strategy 6098 } = _ref; 6099 const isFixed = strategy === "fixed"; 6100 const documentElement = getDocumentElement(offsetParent); 6101 const topLayer = elements ? isTopLayer(elements.floating) : false; 6102 if (offsetParent === documentElement || topLayer && isFixed) { 6103 return rect; 6104 } 6105 let scroll = { 6106 scrollLeft: 0, 6107 scrollTop: 0 6108 }; 6109 let scale = createCoords(1); 6110 const offsets = createCoords(0); 6111 const isOffsetParentAnElement = isHTMLElement(offsetParent); 6112 if (isOffsetParentAnElement || !isFixed) { 6113 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 6114 scroll = getNodeScroll(offsetParent); 6115 } 6116 if (isOffsetParentAnElement) { 6117 const offsetRect = getBoundingClientRect(offsetParent); 6118 scale = getScale(offsetParent); 6119 offsets.x = offsetRect.x + offsetParent.clientLeft; 6120 offsets.y = offsetRect.y + offsetParent.clientTop; 6121 } 6122 } 6123 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 6124 return { 6125 width: rect.width * scale.x, 6126 height: rect.height * scale.y, 6127 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, 6128 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y 6129 }; 6130 } 6131 function getClientRects(element) { 6132 return element.getClientRects ? Array.from(element.getClientRects()) : []; 6133 } 6134 function getDocumentRect(html) { 6135 const scroll = getNodeScroll(html); 6136 const body = html.ownerDocument.body; 6137 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 6138 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 6139 let x = -scroll.scrollLeft + getWindowScrollBarX(html); 6140 const y = -scroll.scrollTop; 6141 if (getComputedStyle2(body).direction === "rtl") { 6142 x += max(html.clientWidth, body.clientWidth) - width; 6143 } 6144 return { 6145 width, 6146 height, 6147 x, 6148 y 6149 }; 6150 } 6151 var SCROLLBAR_MAX = 25; 6152 function getViewportRect(element, strategy, rootBoundary) { 6153 if (rootBoundary === void 0) { 6154 rootBoundary = "viewport"; 6155 } 6156 const isLayoutViewport = rootBoundary === "layoutViewport"; 6157 const win = getWindow(element); 6158 const html = getDocumentElement(element); 6159 const visualViewport = win.visualViewport; 6160 let width = html.clientWidth; 6161 let height = html.clientHeight; 6162 let x = 0; 6163 let y = 0; 6164 if (visualViewport) { 6165 const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed"; 6166 if (isLayoutViewport) { 6167 if (!layoutRelativeClientCoords) { 6168 x = -visualViewport.offsetLeft; 6169 y = -visualViewport.offsetTop; 6170 } 6171 } else { 6172 width = visualViewport.width; 6173 height = visualViewport.height; 6174 if (layoutRelativeClientCoords) { 6175 x = visualViewport.offsetLeft; 6176 y = visualViewport.offsetTop; 6177 } 6178 } 6179 } 6180 const windowScrollbarX = getWindowScrollBarX(html); 6181 if (windowScrollbarX <= 0) { 6182 const doc = html.ownerDocument; 6183 const body = doc.body; 6184 const bodyStyles = getComputedStyle(body); 6185 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 6186 const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 6187 const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth; 6188 if (gutter <= SCROLLBAR_MAX) { 6189 width -= gutter; 6190 } 6191 } 6192 return { 6193 width, 6194 height, 6195 x, 6196 y 6197 }; 6198 } 6199 function getInnerBoundingClientRect(element, strategy) { 6200 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 6201 const top = clientRect.top + element.clientTop; 6202 const left = clientRect.left + element.clientLeft; 6203 const scale = getScale(element); 6204 const width = element.clientWidth * scale.x; 6205 const height = element.clientHeight * scale.y; 6206 const x = left * scale.x; 6207 const y = top * scale.y; 6208 return { 6209 width, 6210 height, 6211 x, 6212 y 6213 }; 6214 } 6215 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 6216 let rect; 6217 if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") { 6218 rect = getViewportRect(element, strategy, clippingAncestor); 6219 } else if (clippingAncestor === "document") { 6220 rect = getDocumentRect(getDocumentElement(element)); 6221 } else if (isElement(clippingAncestor)) { 6222 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 6223 } else { 6224 const visualOffsets = getVisualOffsets(element); 6225 rect = { 6226 x: clippingAncestor.x - visualOffsets.x, 6227 y: clippingAncestor.y - visualOffsets.y, 6228 width: clippingAncestor.width, 6229 height: clippingAncestor.height 6230 }; 6231 } 6232 return rectToClientRect(rect); 6233 } 6234 function getClippingElementAncestors(element, cache) { 6235 const cachedResult = cache.get(element); 6236 if (cachedResult) { 6237 return cachedResult; 6238 } 6239 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 6240 let lastKeptComputedStyle = null; 6241 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 6242 let currentNode = elementIsFixed ? getParentNode(element) : element; 6243 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 6244 const computedStyle = getComputedStyle2(currentNode); 6245 const currentNodeIsContaining = isContainingBlock(currentNode); 6246 const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : ""; 6247 const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static"); 6248 if (shouldDropCurrentNode) { 6249 result = result.filter((ancestor) => ancestor !== currentNode); 6250 } else { 6251 lastKeptComputedStyle = computedStyle; 6252 } 6253 currentNode = getParentNode(currentNode); 6254 } 6255 cache.set(element, result); 6256 return result; 6257 } 6258 function getClippingRect(_ref) { 6259 let { 6260 element, 6261 boundary, 6262 rootBoundary, 6263 strategy 6264 } = _ref; 6265 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); 6266 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 6267 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); 6268 let top = firstRect.top; 6269 let right = firstRect.right; 6270 let bottom = firstRect.bottom; 6271 let left = firstRect.left; 6272 for (let i = 1; i < clippingAncestors.length; i++) { 6273 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); 6274 top = max(rect.top, top); 6275 right = min(rect.right, right); 6276 bottom = min(rect.bottom, bottom); 6277 left = max(rect.left, left); 6278 } 6279 return { 6280 width: right - left, 6281 height: bottom - top, 6282 x: left, 6283 y: top 6284 }; 6285 } 6286 function getDimensions(element) { 6287 const { 6288 width, 6289 height 6290 } = getCssDimensions(element); 6291 return { 6292 width, 6293 height 6294 }; 6295 } 6296 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 6297 const isOffsetParentAnElement = isHTMLElement(offsetParent); 6298 const documentElement = getDocumentElement(offsetParent); 6299 const isFixed = strategy === "fixed"; 6300 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 6301 let scroll = { 6302 scrollLeft: 0, 6303 scrollTop: 0 6304 }; 6305 const offsets = createCoords(0); 6306 if (isOffsetParentAnElement || !isFixed) { 6307 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 6308 scroll = getNodeScroll(offsetParent); 6309 } 6310 if (isOffsetParentAnElement) { 6311 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 6312 offsets.x = offsetRect.x + offsetParent.clientLeft; 6313 offsets.y = offsetRect.y + offsetParent.clientTop; 6314 } 6315 } 6316 if (!isOffsetParentAnElement && documentElement) { 6317 offsets.x = getWindowScrollBarX(documentElement); 6318 } 6319 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 6320 const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; 6321 const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; 6322 return { 6323 x, 6324 y, 6325 width: rect.width, 6326 height: rect.height 6327 }; 6328 } 6329 function isStaticPositioned(element) { 6330 return getComputedStyle2(element).position === "static"; 6331 } 6332 function getTrueOffsetParent(element, polyfill) { 6333 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 6334 return null; 6335 } 6336 if (polyfill) { 6337 return polyfill(element); 6338 } 6339 let rawOffsetParent = element.offsetParent; 6340 if (getDocumentElement(element) === rawOffsetParent) { 6341 rawOffsetParent = rawOffsetParent.ownerDocument.body; 6342 } 6343 return rawOffsetParent; 6344 } 6345 function getOffsetParent(element, polyfill) { 6346 const win = getWindow(element); 6347 if (isTopLayer(element)) { 6348 return win; 6349 } 6350 if (!isHTMLElement(element)) { 6351 let svgOffsetParent = getParentNode(element); 6352 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { 6353 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { 6354 return svgOffsetParent; 6355 } 6356 svgOffsetParent = getParentNode(svgOffsetParent); 6357 } 6358 return win; 6359 } 6360 let offsetParent = getTrueOffsetParent(element, polyfill); 6361 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { 6362 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 6363 } 6364 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { 6365 return win; 6366 } 6367 return offsetParent || getContainingBlock(element) || win; 6368 } 6369 var getElementRects = async function(data) { 6370 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 6371 const getDimensionsFn = this.getDimensions; 6372 const floatingDimensions = await getDimensionsFn(data.floating); 6373 return { 6374 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 6375 floating: { 6376 x: 0, 6377 y: 0, 6378 width: floatingDimensions.width, 6379 height: floatingDimensions.height 6380 } 6381 }; 6382 }; 6383 function isRTL(element) { 6384 return getComputedStyle2(element).direction === "rtl"; 6385 } 6386 var platform2 = { 6387 convertOffsetParentRelativeRectToViewportRelativeRect, 6388 getDocumentElement, 6389 getClippingRect, 6390 getOffsetParent, 6391 getElementRects, 6392 getClientRects, 6393 getDimensions, 6394 getScale, 6395 isElement, 6396 isRTL 6397 }; 6398 function rectsAreEqual(a, b) { 6399 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; 6400 } 6401 function observeMove(element, onMove, ancestorResize) { 6402 let io = null; 6403 let timeoutId; 6404 const root = getDocumentElement(element); 6405 function cleanup() { 6406 var _io; 6407 clearTimeout(timeoutId); 6408 (_io = io) == null || _io.disconnect(); 6409 io = null; 6410 } 6411 function refresh(skip, threshold) { 6412 if (skip === void 0) { 6413 skip = false; 6414 } 6415 if (threshold === void 0) { 6416 threshold = 1; 6417 } 6418 cleanup(); 6419 const elementRectForRootMargin = element.getBoundingClientRect(); 6420 const { 6421 left, 6422 top, 6423 width, 6424 height 6425 } = elementRectForRootMargin; 6426 if (!skip) { 6427 onMove(); 6428 } 6429 if (!width || !height) { 6430 return; 6431 } 6432 const insetTop = floor(top); 6433 const insetRight = floor(root.clientWidth - (left + width)); 6434 const insetBottom = floor(root.clientHeight - (top + height)); 6435 const insetLeft = floor(left); 6436 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 6437 const options = { 6438 rootMargin, 6439 threshold: max(0, min(1, threshold)) || 1 6440 }; 6441 let isFirstUpdate = true; 6442 function handleObserve(entries) { 6443 const ratio = entries[0].intersectionRatio; 6444 if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 6445 return refresh(); 6446 } 6447 if (ratio !== threshold) { 6448 if (!isFirstUpdate) { 6449 return refresh(); 6450 } 6451 if (!ratio) { 6452 timeoutId = setTimeout(() => { 6453 refresh(false, 1e-7); 6454 }, 1e3); 6455 } else { 6456 refresh(false, ratio); 6457 } 6458 } 6459 isFirstUpdate = false; 6460 } 6461 try { 6462 io = new IntersectionObserver(handleObserve, { 6463 ...options, 6464 // Handle <iframe>s 6465 root: root.ownerDocument 6466 }); 6467 } catch (_e) { 6468 io = new IntersectionObserver(handleObserve, options); 6469 } 6470 io.observe(element); 6471 } 6472 const win = getWindow(element); 6473 const handleResize = () => refresh(ancestorResize); 6474 win.addEventListener("resize", handleResize); 6475 refresh(true); 6476 return () => { 6477 win.removeEventListener("resize", handleResize); 6478 cleanup(); 6479 }; 6480 } 6481 function autoUpdate(reference, floating, update2, options) { 6482 if (options === void 0) { 6483 options = {}; 6484 } 6485 const { 6486 ancestorScroll = true, 6487 ancestorResize = true, 6488 elementResize = typeof ResizeObserver === "function", 6489 layoutShift = typeof IntersectionObserver === "function", 6490 animationFrame = false 6491 } = options; 6492 const referenceEl = unwrapElement(reference); 6493 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; 6494 ancestors.forEach((ancestor) => { 6495 ancestorScroll && ancestor.addEventListener("scroll", update2); 6496 ancestorResize && ancestor.addEventListener("resize", update2); 6497 }); 6498 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2, ancestorResize) : null; 6499 let reobserveFrame = -1; 6500 let resizeObserver = null; 6501 if (elementResize) { 6502 resizeObserver = new ResizeObserver((_ref) => { 6503 let [firstEntry] = _ref; 6504 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { 6505 resizeObserver.unobserve(floating); 6506 cancelAnimationFrame(reobserveFrame); 6507 reobserveFrame = requestAnimationFrame(() => { 6508 var _resizeObserver; 6509 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 6510 }); 6511 } 6512 update2(); 6513 }); 6514 if (referenceEl && !animationFrame) { 6515 resizeObserver.observe(referenceEl); 6516 } 6517 if (floating) { 6518 resizeObserver.observe(floating); 6519 } 6520 } 6521 let frameId; 6522 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 6523 if (animationFrame) { 6524 frameLoop(); 6525 } 6526 function frameLoop() { 6527 const nextRefRect = getBoundingClientRect(reference); 6528 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 6529 update2(); 6530 } 6531 prevRefRect = nextRefRect; 6532 frameId = requestAnimationFrame(frameLoop); 6533 } 6534 update2(); 6535 return () => { 6536 var _resizeObserver2; 6537 ancestors.forEach((ancestor) => { 6538 ancestorScroll && ancestor.removeEventListener("scroll", update2); 6539 ancestorResize && ancestor.removeEventListener("resize", update2); 6540 }); 6541 cleanupIo == null || cleanupIo(); 6542 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 6543 resizeObserver = null; 6544 if (animationFrame) { 6545 cancelAnimationFrame(frameId); 6546 } 6547 }; 6548 } 6549 var offset2 = offset; 6550 var shift2 = shift; 6551 var flip2 = flip; 6552 var size2 = size; 6553 var limitShift2 = limitShift; 6554 var computePosition2 = (reference, floating, options) => { 6555 const cache = /* @__PURE__ */ new Map(); 6556 const mergedOptions = options != null ? options : {}; 6557 const platformWithCache = { 6558 ...platform2, 6559 ...mergedOptions.platform, 6560 _c: cache 6561 }; 6562 return computePosition(reference, floating, { 6563 ...mergedOptions, 6564 platform: platformWithCache 6565 }); 6566 }; 6567 6568 // node_modules/.store/@floating-ui/react-dom@2.1.9-AxWcAwqlMfOrAFOinFKSVg/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs 6569 var React27 = __toESM(require_react(), 1); 6570 var import_react2 = __toESM(require_react(), 1); 6571 var ReactDOM5 = __toESM(require_react_dom(), 1); 6572 var isClient = typeof document !== "undefined"; 6573 var noop2 = function noop3() { 6574 }; 6575 var index = isClient ? import_react2.useLayoutEffect : noop2; 6576 function deepEqual(a, b) { 6577 if (a === b) { 6578 return true; 6579 } 6580 if (typeof a !== typeof b) { 6581 return false; 6582 } 6583 if (typeof a === "function" && a.toString() === b.toString()) { 6584 return true; 6585 } 6586 let length; 6587 let i; 6588 let keys; 6589 if (a && b && typeof a === "object") { 6590 if (Array.isArray(a)) { 6591 length = a.length; 6592 if (length !== b.length) return false; 6593 for (i = length; i-- !== 0; ) { 6594 if (!deepEqual(a[i], b[i])) { 6595 return false; 6596 } 6597 } 6598 return true; 6599 } 6600 keys = Object.keys(a); 6601 length = keys.length; 6602 if (length !== Object.keys(b).length) { 6603 return false; 6604 } 6605 for (i = length; i-- !== 0; ) { 6606 if (!{}.hasOwnProperty.call(b, keys[i])) { 6607 return false; 6608 } 6609 } 6610 for (i = length; i-- !== 0; ) { 6611 const key = keys[i]; 6612 if (key === "_owner" && a.$$typeof) { 6613 continue; 6614 } 6615 if (!deepEqual(a[key], b[key])) { 6616 return false; 6617 } 6618 } 6619 return true; 6620 } 6621 return a !== a && b !== b; 6622 } 6623 function getDPR(element) { 6624 if (typeof window === "undefined") { 6625 return 1; 6626 } 6627 const win = element.ownerDocument.defaultView || window; 6628 return win.devicePixelRatio || 1; 6629 } 6630 function roundByDPR(element, value) { 6631 const dpr = getDPR(element); 6632 return Math.round(value * dpr) / dpr; 6633 } 6634 function useLatestRef(value) { 6635 const ref = React27.useRef(value); 6636 index(() => { 6637 ref.current = value; 6638 }); 6639 return ref; 6640 } 6641 function useFloating(options) { 6642 if (options === void 0) { 6643 options = {}; 6644 } 6645 const { 6646 placement = "bottom", 6647 strategy = "absolute", 6648 middleware = [], 6649 platform: platform3, 6650 elements: { 6651 reference: externalReference, 6652 floating: externalFloating 6653 } = {}, 6654 transform = true, 6655 whileElementsMounted, 6656 open: open2 6657 } = options; 6658 const [data, setData] = React27.useState({ 6659 x: 0, 6660 y: 0, 6661 strategy, 6662 placement, 6663 middlewareData: {}, 6664 isPositioned: false 6665 }); 6666 const [latestMiddleware, setLatestMiddleware] = React27.useState(middleware); 6667 if (!deepEqual(latestMiddleware, middleware)) { 6668 setLatestMiddleware(middleware); 6669 } 6670 const [_reference, _setReference] = React27.useState(null); 6671 const [_floating, _setFloating] = React27.useState(null); 6672 const setReference = React27.useCallback((node) => { 6673 if (node !== referenceRef.current) { 6674 referenceRef.current = node; 6675 _setReference(node); 6676 } 6677 }, []); 6678 const setFloating = React27.useCallback((node) => { 6679 if (node !== floatingRef.current) { 6680 floatingRef.current = node; 6681 _setFloating(node); 6682 } 6683 }, []); 6684 const referenceEl = externalReference || _reference; 6685 const floatingEl = externalFloating || _floating; 6686 const referenceRef = React27.useRef(null); 6687 const floatingRef = React27.useRef(null); 6688 const dataRef = React27.useRef(data); 6689 const hasWhileElementsMounted = whileElementsMounted != null; 6690 const whileElementsMountedRef = useLatestRef(whileElementsMounted); 6691 const platformRef = useLatestRef(platform3); 6692 const openRef = useLatestRef(open2); 6693 const update2 = React27.useCallback(() => { 6694 if (!referenceRef.current || !floatingRef.current) { 6695 return; 6696 } 6697 const config = { 6698 placement, 6699 strategy, 6700 middleware: latestMiddleware 6701 }; 6702 if (platformRef.current) { 6703 config.platform = platformRef.current; 6704 } 6705 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { 6706 const fullData = { 6707 ...data2, 6708 // The floating element's position may be recomputed while it's closed 6709 // but still mounted (such as when transitioning out). To ensure 6710 // `isPositioned` will be `false` initially on the next open, avoid 6711 // setting it to `true` when `open === false` (must be specified). 6712 isPositioned: openRef.current !== false 6713 }; 6714 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { 6715 dataRef.current = fullData; 6716 ReactDOM5.flushSync(() => { 6717 setData(fullData); 6718 }); 6719 } 6720 }); 6721 }, [latestMiddleware, placement, strategy, platformRef, openRef]); 6722 index(() => { 6723 if (open2 === false && dataRef.current.isPositioned) { 6724 dataRef.current.isPositioned = false; 6725 setData((data2) => ({ 6726 ...data2, 6727 isPositioned: false 6728 })); 6729 } 6730 }, [open2]); 6731 const isMountedRef = React27.useRef(false); 6732 index(() => { 6733 isMountedRef.current = true; 6734 return () => { 6735 isMountedRef.current = false; 6736 }; 6737 }, []); 6738 index(() => { 6739 if (referenceEl) referenceRef.current = referenceEl; 6740 if (floatingEl) floatingRef.current = floatingEl; 6741 if (referenceEl && floatingEl) { 6742 if (whileElementsMountedRef.current) { 6743 return whileElementsMountedRef.current(referenceEl, floatingEl, update2); 6744 } 6745 update2(); 6746 } 6747 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); 6748 const refs = React27.useMemo(() => ({ 6749 reference: referenceRef, 6750 floating: floatingRef, 6751 setReference, 6752 setFloating 6753 }), [setReference, setFloating]); 6754 const elements = React27.useMemo(() => ({ 6755 reference: referenceEl, 6756 floating: floatingEl 6757 }), [referenceEl, floatingEl]); 6758 const floatingStyles = React27.useMemo(() => { 6759 const initialStyles = { 6760 position: strategy, 6761 left: 0, 6762 top: 0 6763 }; 6764 if (!elements.floating) { 6765 return initialStyles; 6766 } 6767 const x = roundByDPR(elements.floating, data.x); 6768 const y = roundByDPR(elements.floating, data.y); 6769 if (transform) { 6770 return { 6771 ...initialStyles, 6772 transform: "translate(" + x + "px, " + y + "px)", 6773 ...getDPR(elements.floating) >= 1.5 && { 6774 willChange: "transform" 6775 } 6776 }; 6777 } 6778 return { 6779 position: strategy, 6780 left: x, 6781 top: y 6782 }; 6783 }, [strategy, transform, elements.floating, data.x, data.y]); 6784 return React27.useMemo(() => ({ 6785 ...data, 6786 update: update2, 6787 refs, 6788 elements, 6789 floatingStyles 6790 }), [data, update2, refs, elements, floatingStyles]); 6791 } 6792 var offset3 = (options, deps) => { 6793 const result = offset2(options); 6794 return { 6795 name: result.name, 6796 fn: result.fn, 6797 options: [options, deps] 6798 }; 6799 }; 6800 var shift3 = (options, deps) => { 6801 const result = shift2(options); 6802 return { 6803 name: result.name, 6804 fn: result.fn, 6805 options: [options, deps] 6806 }; 6807 }; 6808 var limitShift3 = (options, deps) => { 6809 const result = limitShift2(options); 6810 return { 6811 fn: result.fn, 6812 options: [options, deps] 6813 }; 6814 }; 6815 var flip3 = (options, deps) => { 6816 const result = flip2(options); 6817 return { 6818 name: result.name, 6819 fn: result.fn, 6820 options: [options, deps] 6821 }; 6822 }; 6823 var size3 = (options, deps) => { 6824 const result = size2(options); 6825 return { 6826 name: result.name, 6827 fn: result.fn, 6828 options: [options, deps] 6829 }; 6830 }; 6831 6832 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/NullStore.mjs 6833 var NullStore = class extends ReactStore { 6834 // `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding 6835 // `setState` alone would neutralize them today. They are overridden explicitly so the store stays 6836 // inert even if a future base-class change stops routing a mutator through `setState`. 6837 setState(_newState) { 6838 } 6839 update(_changes) { 6840 } 6841 set(_key, _value) { 6842 } 6843 notifyAll() { 6844 } 6845 }; 6846 6847 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/inertValue.mjs 6848 function inertValue(value) { 6849 if (isReactVersionAtLeast(19)) { 6850 return value; 6851 } 6852 return value ? "true" : void 0; 6853 } 6854 6855 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs 6856 var React28 = __toESM(require_react(), 1); 6857 var DirectionContext = /* @__PURE__ */ React28.createContext(void 0); 6858 if (true) DirectionContext.displayName = "DirectionContext"; 6859 function useDirection() { 6860 const context = React28.useContext(DirectionContext); 6861 return context?.direction ?? "ltr"; 6862 } 6863 6864 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useAnchorPositioning.mjs 6865 var React30 = __toESM(require_react(), 1); 6866 6867 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 6868 var React29 = __toESM(require_react(), 1); 6869 function useBaseUIFloating(options) { 6870 const { 6871 nodeId, 6872 externalTree, 6873 rootContext: store2 6874 } = options; 6875 const referenceElement = store2.useState("referenceElement"); 6876 const floatingElement = store2.useState("floatingElement"); 6877 const domReferenceElement = store2.useState("domReferenceElement"); 6878 const open2 = store2.useState("open"); 6879 const floatingId = store2.useState("floatingId"); 6880 const [positionReference, setPositionReferenceRaw] = React29.useState(null); 6881 const domReferenceRef = React29.useRef(null); 6882 const tree = useFloatingTree(externalTree); 6883 const storeElements = React29.useMemo(() => ({ 6884 reference: referenceElement, 6885 floating: floatingElement, 6886 domReference: domReferenceElement 6887 }), [referenceElement, floatingElement, domReferenceElement]); 6888 const position = useFloating({ 6889 ...options, 6890 elements: { 6891 ...storeElements, 6892 ...positionReference && { 6893 reference: positionReference 6894 } 6895 } 6896 }); 6897 const setPositionReference = React29.useCallback((node) => { 6898 const computedPositionReference = isElement(node) ? { 6899 getBoundingClientRect: () => node.getBoundingClientRect(), 6900 getClientRects: () => node.getClientRects(), 6901 contextElement: node 6902 } : node; 6903 setPositionReferenceRaw(computedPositionReference); 6904 position.refs.setReference(computedPositionReference); 6905 }, [position.refs]); 6906 const refs = React29.useMemo(() => ({ 6907 ...position.refs, 6908 setPositionReference, 6909 domReference: domReferenceRef 6910 }), [position.refs, setPositionReference]); 6911 const elements = React29.useMemo(() => ({ 6912 ...position.elements, 6913 domReference: domReferenceElement 6914 }), [position.elements, domReferenceElement]); 6915 const context = React29.useMemo(() => ({ 6916 ...position, 6917 dataRef: store2.context.dataRef, 6918 open: open2, 6919 onOpenChange: store2.setOpen, 6920 events: store2.context.events, 6921 floatingId, 6922 refs, 6923 elements, 6924 nodeId, 6925 rootStore: store2 6926 }), [position, refs, elements, nodeId, store2, open2, floatingId]); 6927 useIsoLayoutEffect(() => { 6928 if (domReferenceElement) { 6929 domReferenceRef.current = domReferenceElement; 6930 } 6931 }, [domReferenceElement]); 6932 useIsoLayoutEffect(() => { 6933 store2.context.dataRef.current.floatingContext = context; 6934 const node = tree?.nodesRef.current.find((n) => n.id === nodeId); 6935 if (node) { 6936 node.context = context; 6937 } 6938 }); 6939 return React29.useMemo(() => ({ 6940 ...position, 6941 context, 6942 refs, 6943 elements, 6944 rootStore: store2 6945 }), [position, refs, elements, context, store2]); 6946 } 6947 6948 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs 6949 var baseArrow = (options) => ({ 6950 name: "arrow", 6951 options, 6952 async fn(state) { 6953 const { 6954 x, 6955 y, 6956 placement, 6957 rects, 6958 platform: platform3, 6959 elements, 6960 middlewareData 6961 } = state; 6962 const { 6963 element, 6964 padding = 0 6965 } = evaluate(options, state) || {}; 6966 if (element == null) { 6967 return {}; 6968 } 6969 const paddingObject = getPaddingObject(padding); 6970 const coords = { 6971 x, 6972 y 6973 }; 6974 const axis = getAlignmentAxis(placement); 6975 const length = getAxisLength(axis); 6976 const arrowDimensions = await platform3.getDimensions(element); 6977 const isYAxis = axis === "y"; 6978 const minProp = isYAxis ? "top" : "left"; 6979 const maxProp = isYAxis ? "bottom" : "right"; 6980 const clientProp = isYAxis ? "clientHeight" : "clientWidth"; 6981 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 6982 const startDiff = coords[axis] - rects.reference[axis]; 6983 const clientSize = elements.floating[clientProp] || rects.floating[length]; 6984 const centerToReference = endDiff / 2 - startDiff / 2; 6985 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 6986 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); 6987 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); 6988 const min2 = minPadding; 6989 const max2 = clientSize - arrowDimensions[length] - maxPadding; 6990 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 6991 const offset4 = clamp(min2, center, max2); 6992 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 6993 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; 6994 return { 6995 [axis]: coords[axis] + alignmentOffset, 6996 data: { 6997 [axis]: offset4, 6998 centerOffset: center - offset4 - alignmentOffset, 6999 ...shouldAddOffset && { 7000 alignmentOffset 7001 } 7002 }, 7003 reset: shouldAddOffset 7004 }; 7005 } 7006 }); 7007 var arrow4 = (options, deps) => { 7008 const { 7009 name, 7010 fn 7011 } = baseArrow(options); 7012 return { 7013 name, 7014 fn, 7015 options: [options, deps] 7016 }; 7017 }; 7018 7019 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/hideMiddleware.mjs 7020 var hide4 = { 7021 name: "hide", 7022 async fn(state) { 7023 const { 7024 width, 7025 height, 7026 x, 7027 y 7028 } = state.rects.reference; 7029 const anchorHidden2 = width === 0 && height === 0 && x === 0 && y === 0; 7030 const overflow = await state.platform.detectOverflow(state, { 7031 elementContext: "reference" 7032 }); 7033 const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0; 7034 return { 7035 data: { 7036 referenceHidden: referenceHidden || anchorHidden2 7037 } 7038 }; 7039 } 7040 }; 7041 7042 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs 7043 var DEFAULT_SIDES = { 7044 sideX: "left", 7045 sideY: "top" 7046 }; 7047 7048 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs 7049 var availableWidth = "--available-width"; 7050 var availableHeight = "--available-height"; 7051 var anchorWidth = "--anchor-width"; 7052 var anchorHeight = "--anchor-height"; 7053 var transformOrigin = "--transform-origin"; 7054 var positionerWidth = "--positioner-width"; 7055 var positionerHeight = "--positioner-height"; 7056 7057 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useAnchorPositioning.mjs 7058 var AVAILABLE_WIDTH_VAR = availableWidth; 7059 var AVAILABLE_HEIGHT_VAR = availableHeight; 7060 function getLogicalSide(sideParam, renderedSide, isRtl) { 7061 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; 7062 const logicalRight = isRtl ? "inline-start" : "inline-end"; 7063 const logicalLeft = isRtl ? "inline-end" : "inline-start"; 7064 return { 7065 top: "top", 7066 right: isLogicalSideParam ? logicalRight : "right", 7067 bottom: "bottom", 7068 left: isLogicalSideParam ? logicalLeft : "left" 7069 }[renderedSide]; 7070 } 7071 function getOffsetData(state, sideParam, isRtl) { 7072 const { 7073 rects, 7074 placement 7075 } = state; 7076 const data = { 7077 side: getLogicalSide(sideParam, getSide(placement), isRtl), 7078 align: getAlignment(placement) || "center", 7079 anchor: { 7080 width: rects.reference.width, 7081 height: rects.reference.height 7082 }, 7083 positioner: { 7084 width: rects.floating.width, 7085 height: rects.floating.height 7086 } 7087 }; 7088 return data; 7089 } 7090 function useAnchorPositioning(params) { 7091 return useAnchorPositioningWithHook(params, useBaseUIFloating); 7092 } 7093 function useAnchorPositioningWithHook(params, useFloatingHook) { 7094 const { 7095 // Public parameters 7096 anchor, 7097 positionMethod = "absolute", 7098 side: sideParam = "bottom", 7099 sideOffset = 0, 7100 align = "center", 7101 alignOffset = 0, 7102 collisionBoundary, 7103 collisionPadding: collisionPaddingParam = 5, 7104 sticky = false, 7105 arrowPadding = 5, 7106 disableAnchorTracking = false, 7107 inline: inlineMiddleware, 7108 // Private parameters 7109 keepMounted = false, 7110 floatingRootContext, 7111 mounted, 7112 collisionAvoidance, 7113 shift: shift4, 7114 nodeId, 7115 adaptiveOrigin: adaptiveOrigin2, 7116 lazyFlip = false, 7117 externalTree 7118 } = params; 7119 const collisionAvoidanceSide = collisionAvoidance.side || "flip"; 7120 const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; 7121 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; 7122 const shiftCrossAxis = shift4?.crossAxis ?? false; 7123 const shiftRootBoundary = shift4?.rootBoundary; 7124 const anchorFn = typeof anchor === "function" ? anchor : void 0; 7125 const anchorFnCallback = useStableCallback(anchorFn); 7126 const anchorDep = anchorFn ? anchorFnCallback : anchor; 7127 const anchorValueRef = useValueAsRef(anchor); 7128 const mountedRef = useValueAsRef(mounted); 7129 const direction = useDirection(); 7130 const isRtl = direction === "rtl"; 7131 const [mountPlacement, setMountPlacement] = React30.useState(null); 7132 if (!mounted && mountPlacement !== null) { 7133 setMountPlacement(null); 7134 } 7135 const lockAlign = lazyFlip === "placement"; 7136 const mountSide = mountPlacement ? getSide(mountPlacement) : null; 7137 const mountAlign = mountPlacement && lockAlign ? getAlignment(mountPlacement) || "center" : null; 7138 const side = mountSide || { 7139 top: "top", 7140 right: "right", 7141 bottom: "bottom", 7142 left: "left", 7143 "inline-end": isRtl ? "left" : "right", 7144 "inline-start": isRtl ? "right" : "left" 7145 }[sideParam]; 7146 const placementAlign = mountAlign || align; 7147 const placement = placementAlign === "center" ? side : `$side}-$placementAlign}`; 7148 let collisionPadding = collisionPaddingParam; 7149 if (typeof collisionPadding === "number") { 7150 collisionPadding = { 7151 top: collisionPadding, 7152 right: collisionPadding, 7153 bottom: collisionPadding, 7154 left: collisionPadding 7155 }; 7156 } else if (collisionPadding) { 7157 collisionPadding = { 7158 top: collisionPadding.top || 0, 7159 right: collisionPadding.right || 0, 7160 bottom: collisionPadding.bottom || 0, 7161 left: collisionPadding.left || 0 7162 }; 7163 } 7164 const bias = 1; 7165 const biasTop = sideParam === "bottom" ? bias : 0; 7166 const biasBottom = sideParam === "top" ? bias : 0; 7167 const biasLeft = sideParam === "right" ? bias : 0; 7168 const biasRight = sideParam === "left" ? bias : 0; 7169 const commonCollisionProps = { 7170 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, 7171 padding: collisionPadding 7172 }; 7173 const arrowRef = React30.useRef(null); 7174 const sideOffsetRef = useValueAsRef(sideOffset); 7175 const alignOffsetRef = useValueAsRef(alignOffset); 7176 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; 7177 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; 7178 const middleware = []; 7179 if (inlineMiddleware) { 7180 middleware.push(inlineMiddleware); 7181 } 7182 middleware.push(offset3((state) => { 7183 const data = getOffsetData(state, sideParam, isRtl); 7184 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; 7185 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; 7186 return { 7187 mainAxis: sideAxis, 7188 crossAxis: alignAxis, 7189 alignmentAxis: alignAxis 7190 }; 7191 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); 7192 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; 7193 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); 7194 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ 7195 ...commonCollisionProps, 7196 // Ensure the popup flips if it's been limited by its --available-height and it resizes. 7197 // Since the size() padding is smaller than the flip() padding, flip() will take precedence. 7198 padding: { 7199 top: collisionPadding.top + bias + biasTop, 7200 right: collisionPadding.right + bias + biasRight, 7201 bottom: collisionPadding.bottom + bias + biasBottom, 7202 left: collisionPadding.left + bias + biasLeft 7203 }, 7204 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", 7205 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, 7206 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide 7207 }); 7208 const shiftMiddleware = shiftDisabled ? null : shift3({ 7209 ...commonCollisionProps, 7210 // Use the Layout Viewport to avoid shifting around when pinch-zooming. 7211 rootBoundary: shiftRootBoundary, 7212 mainAxis: collisionAvoidanceAlign !== "none", 7213 crossAxis: crossAxisShiftEnabled, 7214 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { 7215 if (!arrowRef.current) { 7216 return {}; 7217 } 7218 const { 7219 width, 7220 height 7221 } = arrowRef.current.getBoundingClientRect(); 7222 const sideAxis = getSideAxis(getSide(limitData.placement)); 7223 const arrowSize = sideAxis === "y" ? width : height; 7224 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; 7225 return { 7226 offset: arrowSize / 2 + offsetAmount / 2 7227 }; 7228 }) 7229 }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]); 7230 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || placementAlign === "center") { 7231 middleware.push(shiftMiddleware, flipMiddleware); 7232 } else { 7233 middleware.push(flipMiddleware, shiftMiddleware); 7234 } 7235 middleware.push(size3({ 7236 ...commonCollisionProps, 7237 apply({ 7238 elements: { 7239 floating 7240 }, 7241 availableWidth: availableWidth2, 7242 availableHeight: availableHeight2, 7243 rects 7244 }) { 7245 if (!mountedRef.current) { 7246 return; 7247 } 7248 const floatingStyle = floating.style; 7249 floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `$availableWidth2}px`); 7250 floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `$availableHeight2}px`); 7251 const dpr = getWindow(floating).devicePixelRatio || 1; 7252 const { 7253 x: x2, 7254 y: y2, 7255 width, 7256 height 7257 } = rects.reference; 7258 const anchorWidth2 = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr; 7259 const anchorHeight2 = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr; 7260 floatingStyle.setProperty(anchorWidth, `$anchorWidth2}px`); 7261 floatingStyle.setProperty(anchorHeight, `$anchorHeight2}px`); 7262 } 7263 }), arrow4((state) => ({ 7264 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, 7265 // we'll create a fake element. 7266 element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), 7267 // No padding for the fake arrow: it would displace aligned popups on narrow anchors. 7268 padding: arrowRef.current ? arrowPadding : 0 7269 }), [arrowPadding]), { 7270 name: "transformOrigin", 7271 fn(state) { 7272 const { 7273 elements: { 7274 floating 7275 }, 7276 middlewareData: middlewareData2, 7277 placement: renderedPlacement2, 7278 platform: platform3, 7279 rects, 7280 y: y2 7281 } = state; 7282 const renderedSide2 = getSide(renderedPlacement2); 7283 const renderedAlign2 = getAlignment(renderedPlacement2); 7284 const isVertical = getSideAxis(renderedSide2) === "y"; 7285 const arrowEl = arrowRef.current; 7286 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; 7287 let crossOrigin; 7288 if (!arrowEl && renderedAlign2 && Math.abs(isVertical ? middlewareData2.shift?.x || 0 : middlewareData2.shift?.y || 0) <= 1) { 7289 crossOrigin = renderedAlign2 === "start" === (isVertical && platform3.isRTL?.(floating) === true) ? "100%" : "0%"; 7290 } else { 7291 const arrowOffset = isVertical ? middlewareData2.arrow?.x || 0 : middlewareData2.arrow?.y || 0; 7292 const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0; 7293 crossOrigin = `$arrowOffset + arrowSize / 2}px`; 7294 } 7295 let sideOrigin = renderedSide2 === "top" || renderedSide2 === "left" ? `calc(100% + $sideOffsetValue}px)` : `${-sideOffsetValue}px`; 7296 if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData2.shift?.y || 0) > sideOffsetValue) { 7297 sideOrigin = `$rects.reference.y + rects.reference.height / 2 - y2}px`; 7298 } 7299 floating.style.setProperty(transformOrigin, isVertical ? `$crossOrigin} $sideOrigin}` : `$sideOrigin} $crossOrigin}`); 7300 return {}; 7301 } 7302 }, hide4, adaptiveOrigin2); 7303 useIsoLayoutEffect(() => { 7304 if (!mounted && floatingRootContext) { 7305 floatingRootContext.update({ 7306 referenceElement: null, 7307 floatingElement: null, 7308 domReferenceElement: null, 7309 positionReference: null 7310 }); 7311 } 7312 }, [mounted, floatingRootContext]); 7313 const autoUpdateOptions = React30.useMemo(() => ({ 7314 ancestorScroll: !disableAnchorTracking, 7315 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", 7316 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" 7317 }), [disableAnchorTracking]); 7318 const { 7319 refs, 7320 elements, 7321 x, 7322 y, 7323 middlewareData, 7324 update: update2, 7325 placement: renderedPlacement, 7326 context, 7327 isPositioned, 7328 floatingStyles: originalFloatingStyles 7329 } = useFloatingHook({ 7330 rootContext: floatingRootContext, 7331 open: keepMounted ? mounted : void 0, 7332 placement, 7333 middleware, 7334 strategy: positionMethod, 7335 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), 7336 nodeId, 7337 externalTree 7338 }); 7339 const { 7340 sideX, 7341 sideY 7342 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; 7343 const resolvedPosition = isPositioned ? positionMethod : "fixed"; 7344 const floatingStyles = React30.useMemo(() => { 7345 let base; 7346 if (!isPositioned) { 7347 base = { 7348 position: resolvedPosition, 7349 top: 0, 7350 left: 0 7351 }; 7352 } else if (adaptiveOrigin2) { 7353 base = { 7354 position: resolvedPosition, 7355 [sideX]: x, 7356 [sideY]: y 7357 }; 7358 } else { 7359 base = { 7360 ...originalFloatingStyles, 7361 position: resolvedPosition 7362 }; 7363 } 7364 base[AVAILABLE_WIDTH_VAR] = "100vw"; 7365 base[AVAILABLE_HEIGHT_VAR] = "100vh"; 7366 if (!isPositioned) { 7367 base.opacity = 0; 7368 } 7369 return base; 7370 }, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]); 7371 const registeredPositionReferenceRef = React30.useRef(null); 7372 useIsoLayoutEffect(() => { 7373 if (!mounted) { 7374 return; 7375 } 7376 const anchorValue = anchorValueRef.current; 7377 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; 7378 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; 7379 const finalAnchor = unwrappedElement || null; 7380 if (finalAnchor !== registeredPositionReferenceRef.current) { 7381 refs.setPositionReference(finalAnchor); 7382 registeredPositionReferenceRef.current = finalAnchor; 7383 } 7384 }, [mounted, refs, anchorDep, anchorValueRef]); 7385 React30.useEffect(() => { 7386 if (!mounted) { 7387 return; 7388 } 7389 const anchorValue = anchorValueRef.current; 7390 if (typeof anchorValue === "function") { 7391 return; 7392 } 7393 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { 7394 refs.setPositionReference(anchorValue.current); 7395 registeredPositionReferenceRef.current = anchorValue.current; 7396 } 7397 }, [mounted, refs, anchorDep, anchorValueRef]); 7398 React30.useEffect(() => { 7399 if (keepMounted && mounted && elements.reference && elements.floating) { 7400 return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions); 7401 } 7402 return void 0; 7403 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]); 7404 const renderedSide = getSide(renderedPlacement); 7405 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); 7406 const renderedAlign = getAlignment(renderedPlacement) || "center"; 7407 const anchorHidden2 = Boolean(middlewareData.hide?.referenceHidden); 7408 useIsoLayoutEffect(() => { 7409 if (lazyFlip && mounted && isPositioned && (renderedSide !== side || lockAlign && renderedAlign !== placementAlign)) { 7410 setMountPlacement(renderedPlacement); 7411 } 7412 }, [lazyFlip, lockAlign, mounted, isPositioned, renderedPlacement, renderedSide, renderedAlign, side, placementAlign]); 7413 const arrowStyles = React30.useMemo(() => ({ 7414 position: "absolute", 7415 top: middlewareData.arrow?.y, 7416 left: middlewareData.arrow?.x 7417 }), [middlewareData.arrow]); 7418 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; 7419 return React30.useMemo(() => ({ 7420 positionerStyles: floatingStyles, 7421 arrowStyles, 7422 arrowRef, 7423 arrowUncentered, 7424 side: logicalRenderedSide, 7425 align: renderedAlign, 7426 physicalSide: renderedSide, 7427 anchorHidden: anchorHidden2, 7428 refs, 7429 context, 7430 isPositioned, 7431 update: update2 7432 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden2, refs, context, isPositioned, update2]); 7433 } 7434 function isRef(param) { 7435 return param != null && "current" in param; 7436 } 7437 7438 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs 7439 function getDisabledMountTransitionStyles(transitionStatus) { 7440 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; 7441 } 7442 7443 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/usePositioner.mjs 7444 function usePositioner(componentProps, state, { 7445 styles, 7446 transitionStatus, 7447 props, 7448 refs, 7449 hidden, 7450 inert = false 7451 }) { 7452 const style = { 7453 ...styles 7454 }; 7455 if (inert) { 7456 style.pointerEvents = "none"; 7457 } 7458 return useRenderElement("div", componentProps, { 7459 state, 7460 ref: refs, 7461 props: [{ 7462 role: "presentation", 7463 hidden, 7464 style 7465 }, getDisabledMountTransitionStyles(transitionStatus), props], 7466 stateAttributesMapping: popupStateMapping 7467 }); 7468 } 7469 7470 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/usePopupViewport.mjs 7471 var React34 = __toESM(require_react(), 1); 7472 var ReactDOM6 = __toESM(require_react_dom(), 1); 7473 7474 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/usePreviousValue.mjs 7475 var React31 = __toESM(require_react(), 1); 7476 function usePreviousValue(value) { 7477 const [state, setState] = React31.useState({ 7478 current: value, 7479 previous: null 7480 }); 7481 if (!Object.is(value, state.current)) { 7482 setState({ 7483 current: value, 7484 previous: state.current 7485 }); 7486 } 7487 return state.previous; 7488 } 7489 7490 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 7491 var React32 = __toESM(require_react(), 1); 7492 7493 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/getCssDimensions.mjs 7494 function getCssDimensions2(element) { 7495 const css = getComputedStyle2(element); 7496 let width = parseFloat(css.width) || 0; 7497 let height = parseFloat(css.height) || 0; 7498 const hasOffset = isHTMLElement(element); 7499 const offsetWidth = hasOffset ? element.offsetWidth : width; 7500 const offsetHeight = hasOffset ? element.offsetHeight : height; 7501 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 7502 if (shouldFallback) { 7503 width = offsetWidth; 7504 height = offsetHeight; 7505 } 7506 return { 7507 width, 7508 height 7509 }; 7510 } 7511 7512 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/CommonPopupCssVars.mjs 7513 var popupWidth = "--popup-width"; 7514 var popupHeight = "--popup-height"; 7515 7516 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 7517 function usePopupAutoResize(parameters) { 7518 const { 7519 popupElement, 7520 positionerElement, 7521 content, 7522 mounted, 7523 onMeasureLayout: onMeasureLayoutParam, 7524 onMeasureLayoutComplete: onMeasureLayoutCompleteParam, 7525 side, 7526 direction 7527 } = parameters; 7528 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true); 7529 const animationFrame = useAnimationFrame(); 7530 const committedDimensionsRef = React32.useRef(null); 7531 const onMeasureLayout = useStableCallback(onMeasureLayoutParam); 7532 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); 7533 const anchoringStyles = React32.useMemo(() => getPopupAnchoringStyles(side, direction), [side, direction]); 7534 useIsoLayoutEffect(() => { 7535 if (!mounted) { 7536 committedDimensionsRef.current = null; 7537 return void 0; 7538 } 7539 if (!popupElement || !positionerElement) { 7540 return void 0; 7541 } 7542 const restoreAnchoringStyles = applyElementStyles(popupElement, anchoringStyles); 7543 setPopupCssSize(popupElement, "auto"); 7544 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); 7545 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); 7546 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); 7547 const restorePositionerAvailableSize = applyElementStyles(positionerElement, { 7548 [availableWidth]: "max-content", 7549 [availableHeight]: "max-content" 7550 }); 7551 function restoreMeasurementOverrides() { 7552 restorePopupPosition(); 7553 restorePopupTransform(); 7554 restorePositionerAvailableSize(); 7555 restorePopupScale(); 7556 } 7557 onMeasureLayout?.(); 7558 if (committedDimensionsRef.current === null) { 7559 setPositionerCssSize(positionerElement, "max-content"); 7560 const dimensions = getCssDimensions2(popupElement); 7561 committedDimensionsRef.current = dimensions; 7562 setPositionerCssSize(positionerElement, dimensions); 7563 restoreMeasurementOverrides(); 7564 onMeasureLayoutComplete?.(null, dimensions); 7565 return restoreAnchoringStyles; 7566 } 7567 setPositionerCssSize(positionerElement, "max-content"); 7568 const previousDimensions = committedDimensionsRef.current; 7569 const newDimensions = getCssDimensions2(popupElement); 7570 committedDimensionsRef.current = newDimensions; 7571 setPopupCssSize(popupElement, previousDimensions); 7572 restoreMeasurementOverrides(); 7573 onMeasureLayoutComplete?.(previousDimensions, newDimensions); 7574 setPositionerCssSize(positionerElement, newDimensions); 7575 const abortController = new AbortController(); 7576 animationFrame.request(() => { 7577 setPopupCssSize(popupElement, newDimensions); 7578 runOnceAnimationsFinish(() => { 7579 popupElement.style.setProperty(popupWidth, "auto"); 7580 popupElement.style.setProperty(popupHeight, "auto"); 7581 }, abortController.signal); 7582 }); 7583 return () => { 7584 abortController.abort(); 7585 animationFrame.cancel(); 7586 restoreAnchoringStyles(); 7587 }; 7588 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); 7589 } 7590 function getPopupAnchoringStyles(side, direction) { 7591 const isPhysicalTop = side === "top"; 7592 const isPhysicalLeft = side === "left" || side === (direction === "rtl" ? "inline-end" : "inline-start"); 7593 if (!isPhysicalTop && !isPhysicalLeft) { 7594 return EMPTY_OBJECT; 7595 } 7596 return { 7597 position: "absolute", 7598 [isPhysicalTop ? "bottom" : "top"]: "0", 7599 [isPhysicalLeft ? "right" : "left"]: "0" 7600 }; 7601 } 7602 function overrideElementStyle(element, property, value) { 7603 const originalValue = element.style.getPropertyValue(property); 7604 element.style.setProperty(property, value); 7605 return () => { 7606 element.style.setProperty(property, originalValue); 7607 }; 7608 } 7609 function applyElementStyles(element, styles) { 7610 const restorers = []; 7611 for (const [key, value] of Object.entries(styles)) { 7612 restorers.push(overrideElementStyle(element, key, value)); 7613 } 7614 return restorers.length ? () => { 7615 restorers.forEach((restore) => restore()); 7616 } : NOOP; 7617 } 7618 function setPopupCssSize(popupElement, size4) { 7619 const width = size4 === "auto" ? "auto" : `$size4.width}px`; 7620 const height = size4 === "auto" ? "auto" : `$size4.height}px`; 7621 popupElement.style.setProperty(popupWidth, width); 7622 popupElement.style.setProperty(popupHeight, height); 7623 } 7624 function setPositionerCssSize(positionerElement, size4) { 7625 const width = size4 === "max-content" ? "max-content" : `$size4.width}px`; 7626 const height = size4 === "max-content" ? "max-content" : `$size4.height}px`; 7627 positionerElement.style.setProperty(positionerWidth, width); 7628 positionerElement.style.setProperty(positionerHeight, height); 7629 } 7630 7631 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs 7632 var React33 = __toESM(require_react(), 1); 7633 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 7634 var DirectionProvider = function DirectionProvider2(props) { 7635 const { 7636 direction = "ltr" 7637 } = props; 7638 const contextValue = React33.useMemo(() => ({ 7639 direction 7640 }), [direction]); 7641 return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DirectionContext.Provider, { 7642 value: contextValue, 7643 children: props.children 7644 }); 7645 }; 7646 if (true) DirectionProvider.displayName = "DirectionProvider"; 7647 7648 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs 7649 var adaptiveOrigin = { 7650 name: "adaptiveOrigin", 7651 async fn(state) { 7652 const { 7653 x: rawX, 7654 y: rawY, 7655 rects: { 7656 floating: floatRect 7657 }, 7658 elements: { 7659 floating 7660 }, 7661 platform: platform3, 7662 strategy, 7663 placement 7664 } = state; 7665 const win = getWindow(floating); 7666 const styles = win.getComputedStyle(floating); 7667 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; 7668 if (!hasTransition) { 7669 return { 7670 x: rawX, 7671 y: rawY, 7672 data: DEFAULT_SIDES 7673 }; 7674 } 7675 const offsetParent = await platform3.getOffsetParent?.(floating); 7676 let offsetDimensions = { 7677 width: 0, 7678 height: 0 7679 }; 7680 if (strategy === "fixed" && win?.visualViewport) { 7681 offsetDimensions = { 7682 width: win.visualViewport.width, 7683 height: win.visualViewport.height 7684 }; 7685 } else if (offsetParent === win) { 7686 const doc = ownerDocument(floating); 7687 offsetDimensions = { 7688 width: doc.documentElement.clientWidth, 7689 height: doc.documentElement.clientHeight 7690 }; 7691 } else if (await platform3.isElement?.(offsetParent)) { 7692 offsetDimensions = await platform3.getDimensions(offsetParent); 7693 } 7694 const currentSide = getSide(placement); 7695 let x = rawX; 7696 let y = rawY; 7697 if (currentSide === "left") { 7698 x = offsetDimensions.width - (rawX + floatRect.width); 7699 } 7700 if (currentSide === "top") { 7701 y = offsetDimensions.height - (rawY + floatRect.height); 7702 } 7703 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; 7704 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; 7705 return { 7706 x, 7707 y, 7708 data: { 7709 sideX, 7710 sideY 7711 } 7712 }; 7713 } 7714 }; 7715 7716 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/CommonViewportDataAttributes.mjs 7717 var activationDirection = "data-activation-direction"; 7718 7719 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/usePopupViewport.mjs 7720 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 7721 var popupViewportStateMapping = { 7722 activationDirection: (value) => value ? { 7723 [activationDirection]: value 7724 } : null 7725 }; 7726 function usePopupViewport(parameters) { 7727 const { 7728 store: store2, 7729 side, 7730 children 7731 } = parameters; 7732 const direction = useDirection(); 7733 const activeTrigger = store2.useState("activeTriggerElement"); 7734 const activeTriggerId = store2.useState("activeTriggerId"); 7735 const open2 = store2.useState("open"); 7736 const payload = store2.useState("payload"); 7737 const mounted = store2.useState("mounted"); 7738 const popupElement = store2.useState("popupElement"); 7739 const positionerElement = store2.useState("positionerElement"); 7740 const previousActiveTrigger = usePreviousValue(open2 ? activeTrigger : null); 7741 const currentContentKey = usePopupContentKey(activeTriggerId, payload); 7742 const capturedNodeRef = React34.useRef(null); 7743 const [previousContentNode, setPreviousContentNode] = React34.useState(null); 7744 const [newTriggerOffset, setNewTriggerOffset] = React34.useState(null); 7745 const currentContainerRef = React34.useRef(null); 7746 const previousContainerRef = React34.useRef(null); 7747 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true); 7748 const cleanupFrame = useAnimationFrame(); 7749 const cleanupControllerRef = React34.useRef(null); 7750 const [previousContentDimensions, setPreviousContentDimensions] = React34.useState(null); 7751 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React34.useState(false); 7752 useIsoLayoutEffect(() => { 7753 store2.set("adaptiveOrigin", adaptiveOrigin); 7754 return () => { 7755 store2.set("adaptiveOrigin", void 0); 7756 }; 7757 }, [store2]); 7758 const handleMeasureLayout = useStableCallback(() => { 7759 currentContainerRef.current?.style.setProperty("animation", "none"); 7760 currentContainerRef.current?.style.setProperty("transition", "none"); 7761 previousContainerRef.current?.style.setProperty("display", "none"); 7762 }); 7763 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { 7764 currentContainerRef.current?.style.removeProperty("animation"); 7765 currentContainerRef.current?.style.removeProperty("transition"); 7766 previousContainerRef.current?.style.removeProperty("display"); 7767 if (previousDimensions) { 7768 setPreviousContentDimensions(previousDimensions); 7769 } 7770 }); 7771 const armViewportCleanup = useStableCallback(() => { 7772 cleanupControllerRef.current?.abort(); 7773 const controller = new AbortController(); 7774 cleanupControllerRef.current = controller; 7775 onAnimationsFinished(() => { 7776 setPreviousContentNode(null); 7777 setPreviousContentDimensions(null); 7778 capturedNodeRef.current = null; 7779 }, controller.signal); 7780 }); 7781 const lastHandledTriggerRef = React34.useRef(null); 7782 useIsoLayoutEffect(() => { 7783 if (!open2 || !mounted) { 7784 lastHandledTriggerRef.current = null; 7785 } 7786 }, [open2, mounted]); 7787 useIsoLayoutEffect(() => { 7788 if (open2 && activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { 7789 setPreviousContentNode(capturedNodeRef.current); 7790 setShowStartingStyleAttribute(true); 7791 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); 7792 setNewTriggerOffset(offset4); 7793 lastHandledTriggerRef.current = activeTrigger; 7794 } 7795 }, [open2, activeTrigger, previousActiveTrigger]); 7796 useIsoLayoutEffect(() => { 7797 if (previousContentNode == null) { 7798 return; 7799 } 7800 cleanupControllerRef.current?.abort(); 7801 setShowStartingStyleAttribute(true); 7802 cleanupFrame.request(() => { 7803 ReactDOM6.flushSync(() => { 7804 setShowStartingStyleAttribute(false); 7805 }); 7806 armViewportCleanup(); 7807 }); 7808 }, [currentContentKey, previousContentNode, armViewportCleanup, cleanupFrame]); 7809 useIsoLayoutEffect(() => { 7810 const source = currentContainerRef.current; 7811 if (!source) { 7812 return; 7813 } 7814 const wrapper = ownerDocument(source).createElement("div"); 7815 for (const child of Array.from(source.childNodes)) { 7816 wrapper.appendChild(child.cloneNode(true)); 7817 } 7818 capturedNodeRef.current = wrapper; 7819 }); 7820 const isTransitioning = previousContentNode != null; 7821 let childrenToRender; 7822 if (!isTransitioning) { 7823 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { 7824 "data-current": true, 7825 ref: currentContainerRef, 7826 children 7827 }, currentContentKey); 7828 } else { 7829 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React34.Fragment, { 7830 children: [/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { 7831 "data-previous": true, 7832 inert: inertValue(true), 7833 ref: previousContainerRef, 7834 style: { 7835 ...previousContentDimensions ? { 7836 [popupWidth]: `$previousContentDimensions.width}px`, 7837 [popupHeight]: `$previousContentDimensions.height}px` 7838 } : null, 7839 position: "absolute" 7840 }, 7841 "data-ending-style": showStartingStyleAttribute ? void 0 : "" 7842 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { 7843 "data-current": true, 7844 ref: currentContainerRef, 7845 "data-starting-style": showStartingStyleAttribute ? "" : void 0, 7846 children 7847 }, currentContentKey)] 7848 }); 7849 } 7850 useIsoLayoutEffect(() => { 7851 const container = previousContainerRef.current; 7852 if (!container || !previousContentNode) { 7853 return; 7854 } 7855 container.replaceChildren(...Array.from(previousContentNode.childNodes)); 7856 }, [previousContentNode]); 7857 usePopupAutoResize({ 7858 popupElement, 7859 positionerElement, 7860 mounted, 7861 content: payload, 7862 onMeasureLayout: handleMeasureLayout, 7863 onMeasureLayoutComplete: handleMeasureLayoutComplete, 7864 side, 7865 direction 7866 }); 7867 const state = { 7868 activationDirection: getActivationDirection(newTriggerOffset), 7869 transitioning: isTransitioning 7870 }; 7871 return { 7872 children: childrenToRender, 7873 state 7874 }; 7875 } 7876 function getActivationDirection(offset4) { 7877 if (!offset4) { 7878 return void 0; 7879 } 7880 return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; 7881 } 7882 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { 7883 if (value > tolerance) { 7884 return positiveLabel; 7885 } 7886 if (value < -tolerance) { 7887 return negativeLabel; 7888 } 7889 return ""; 7890 } 7891 function calculateRelativePosition(from, to) { 7892 const fromRect = from.getBoundingClientRect(); 7893 const toRect = to.getBoundingClientRect(); 7894 const fromCenter = { 7895 x: fromRect.left + fromRect.width / 2, 7896 y: fromRect.top + fromRect.height / 2 7897 }; 7898 const toCenter = { 7899 x: toRect.left + toRect.width / 2, 7900 y: toRect.top + toRect.height / 2 7901 }; 7902 return { 7903 horizontal: toCenter.x - fromCenter.x, 7904 vertical: toCenter.y - fromCenter.y 7905 }; 7906 } 7907 function usePopupContentKey(activeTriggerId, payload) { 7908 const [contentKey, setContentKey] = React34.useState(0); 7909 const previousActiveTriggerIdRef = React34.useRef(activeTriggerId); 7910 const previousPayloadRef = React34.useRef(payload); 7911 const pendingPayloadUpdateRef = React34.useRef(false); 7912 useIsoLayoutEffect(() => { 7913 const previousActiveTriggerId = previousActiveTriggerIdRef.current; 7914 const previousPayload = previousPayloadRef.current; 7915 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; 7916 const payloadChanged = payload !== previousPayload; 7917 if (triggerIdChanged) { 7918 setContentKey((value) => value + 1); 7919 pendingPayloadUpdateRef.current = !payloadChanged; 7920 } else if (pendingPayloadUpdateRef.current && payloadChanged) { 7921 setContentKey((value) => value + 1); 7922 pendingPayloadUpdateRef.current = false; 7923 } 7924 previousActiveTriggerIdRef.current = activeTriggerId; 7925 previousPayloadRef.current = payload; 7926 }, [activeTriggerId, payload]); 7927 return `$activeTriggerId ?? "current"}-$contentKey}`; 7928 } 7929 7930 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/FloatingPortalLite.mjs 7931 var React35 = __toESM(require_react(), 1); 7932 var ReactDOM7 = __toESM(require_react_dom(), 1); 7933 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 7934 var FloatingPortalLite = /* @__PURE__ */ React35.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { 7935 const { 7936 children, 7937 container, 7938 className, 7939 render, 7940 style, 7941 ...elementProps 7942 } = componentProps; 7943 const { 7944 node: portalNode, 7945 subtree: portalSubtree 7946 } = useFloatingPortalNode({ 7947 container, 7948 ref: forwardedRef, 7949 componentProps, 7950 elementProps 7951 }); 7952 if (!portalSubtree && !portalNode) { 7953 return null; 7954 } 7955 return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(React35.Fragment, { 7956 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)] 7957 }); 7958 }); 7959 if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; 7960 7961 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/index.parts.mjs 7962 var index_parts_exports = {}; 7963 __export(index_parts_exports, { 7964 Arrow: () => TooltipArrow, 7965 Handle: () => TooltipHandle, 7966 Popup: () => TooltipPopup, 7967 Portal: () => TooltipPortal, 7968 Positioner: () => TooltipPositioner, 7969 Provider: () => TooltipProvider, 7970 Root: () => TooltipRoot, 7971 Trigger: () => TooltipTrigger, 7972 Viewport: () => TooltipViewport, 7973 createHandle: () => createTooltipHandle 7974 }); 7975 7976 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 7977 var React38 = __toESM(require_react(), 1); 7978 7979 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs 7980 var React36 = __toESM(require_react(), 1); 7981 var TooltipRootContext = /* @__PURE__ */ React36.createContext(void 0); 7982 if (true) TooltipRootContext.displayName = "TooltipRootContext"; 7983 function useTooltipRootContext(optional) { 7984 const context = React36.useContext(TooltipRootContext); 7985 if (context === void 0 && !optional) { 7986 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); 7987 } 7988 return context; 7989 } 7990 7991 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs 7992 var React37 = __toESM(require_react(), 1); 7993 var selectors2 = { 7994 ...popupStoreSelectors, 7995 disabled: (state) => state.disabled, 7996 instantType: (state) => state.instantType, 7997 isInstantPhase: (state) => state.isInstantPhase, 7998 trackCursorAxis: (state) => state.trackCursorAxis, 7999 disableHoverablePopup: (state) => state.disableHoverablePopup, 8000 lastOpenChangeReason: (state) => state.openChangeReason, 8001 closeOnClick: (state) => state.closeOnClick, 8002 // Active and inactive trigger props are the same object, so a constant for triggers that discard 8003 // them keeps those triggers from re-rendering when the props change. 8004 appliedTriggerProps: (state, apply) => apply ? state.activeTriggerProps : void 0, 8005 closeDelay: (state) => state.closeDelay, 8006 adaptiveOrigin: (state) => state.adaptiveOrigin 8007 }; 8008 var TooltipStore = class extends ReactStore { 8009 constructor(initialState, floatingId, nested) { 8010 const triggerElements = new PopupTriggerMap(); 8011 super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors2); 8012 } 8013 setOpen = (nextOpen, eventDetails) => { 8014 applyPopupOpenChange(this, nextOpen, eventDetails, { 8015 extraState: { 8016 openChangeReason: eventDetails.reason 8017 } 8018 }); 8019 }; 8020 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. 8021 cancelPendingOpen(event) { 8022 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); 8023 } 8024 }; 8025 function createNullTooltipStore() { 8026 const triggerElements = new PopupTriggerMap(); 8027 const store2 = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors2); 8028 return Object.assign(store2, { 8029 setOpen: NOOP, 8030 cancelPendingOpen: NOOP 8031 }); 8032 } 8033 function createInitialState(initialState, triggerElements, floatingId, nested = false) { 8034 const state = { 8035 ...createInitialPopupStoreState(triggerElements, floatingId, nested), 8036 disabled: false, 8037 instantType: void 0, 8038 isInstantPhase: false, 8039 trackCursorAxis: "none", 8040 disableHoverablePopup: false, 8041 openChangeReason: null, 8042 closeOnClick: true, 8043 closeDelay: 0, 8044 adaptiveOrigin: void 0, 8045 ...initialState 8046 }; 8047 return state; 8048 } 8049 function createInitialContext(triggerElements) { 8050 return { 8051 popupRef: /* @__PURE__ */ React37.createRef(), 8052 onOpenChange: void 0, 8053 onOpenChangeComplete: void 0, 8054 triggerElements 8055 }; 8056 } 8057 8058 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 8059 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 8060 var TooltipRoot = fastComponent(function TooltipRoot2(props) { 8061 const { 8062 disabled: disabled2 = false, 8063 defaultOpen = false, 8064 open: openProp, 8065 disableHoverablePopup = false, 8066 trackCursorAxis = "none", 8067 actionsRef, 8068 onOpenChange, 8069 onOpenChangeComplete, 8070 handle, 8071 triggerId: triggerIdProp, 8072 defaultTriggerId: defaultTriggerIdProp = null, 8073 children 8074 } = props; 8075 const store2 = usePopupRootStore((floatingId, nested) => new TooltipStore({ 8076 open: defaultOpen, 8077 openProp, 8078 activeTriggerId: defaultTriggerIdProp, 8079 triggerIdProp 8080 }, floatingId, nested)); 8081 store2.useControlledProp("openProp", openProp); 8082 store2.useControlledProp("triggerIdProp", triggerIdProp); 8083 store2.useContextCallback("onOpenChange", onOpenChange); 8084 store2.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 8085 const openState = store2.useState("open"); 8086 const open2 = !disabled2 && openState; 8087 const activeTriggerId = store2.useState("activeTriggerId"); 8088 const mounted = store2.useState("mounted"); 8089 const payload = store2.useState("payload"); 8090 store2.useSyncedValues({ 8091 trackCursorAxis, 8092 disableHoverablePopup, 8093 disabled: disabled2 8094 }); 8095 useImplicitActiveTrigger(store2, { 8096 closeOnActiveTriggerUnmount: true 8097 }); 8098 const { 8099 forceUnmount, 8100 transitionStatus 8101 } = useOpenStateTransitions(open2, store2); 8102 const isInstantPhase = store2.useState("isInstantPhase"); 8103 const instantType = store2.useState("instantType"); 8104 const lastOpenChangeReason = store2.useState("lastOpenChangeReason"); 8105 const previousInstantTypeRef = React38.useRef(null); 8106 useIsoLayoutEffect(() => { 8107 if (openState && disabled2) { 8108 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); 8109 } 8110 }, [openState, disabled2, store2]); 8111 useIsoLayoutEffect(() => { 8112 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { 8113 if (instantType !== "delay") { 8114 previousInstantTypeRef.current = instantType; 8115 } 8116 store2.set("instantType", "delay"); 8117 } else if (previousInstantTypeRef.current !== null) { 8118 store2.set("instantType", previousInstantTypeRef.current); 8119 previousInstantTypeRef.current = null; 8120 } 8121 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store2]); 8122 useIsoLayoutEffect(() => { 8123 if (open2) { 8124 if (activeTriggerId == null) { 8125 store2.set("payload", void 0); 8126 } 8127 } 8128 }, [store2, activeTriggerId, open2]); 8129 React38.useImperativeHandle(actionsRef, () => ({ 8130 unmount: forceUnmount, 8131 close: () => store2.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)) 8132 }), [forceUnmount, store2]); 8133 const shouldRenderInteractions = open2 || mounted || !disabled2 && trackCursorAxis !== "none"; 8134 return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(TooltipRootContext.Provider, { 8135 value: store2, 8136 children: [handle && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PopupHandleAttachment, { 8137 handle, 8138 store: store2 8139 }), shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipInteractions, { 8140 store: store2, 8141 disabled: disabled2, 8142 trackCursorAxis 8143 }), typeof children === "function" ? children({ 8144 payload 8145 }) : children] 8146 }); 8147 }); 8148 if (true) TooltipRoot.displayName = "TooltipRoot"; 8149 function TooltipInteractions({ 8150 store: store2, 8151 disabled: disabled2, 8152 trackCursorAxis 8153 }) { 8154 const floatingRootContext = store2.useState("floatingRootContext"); 8155 const dismiss = useDismiss(floatingRootContext, { 8156 enabled: !disabled2, 8157 referencePress: () => store2.select("closeOnClick") 8158 }); 8159 const clientPoint = useClientPoint(floatingRootContext, { 8160 enabled: !disabled2 && trackCursorAxis !== "none", 8161 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis 8162 }); 8163 const triggerProps = React38.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); 8164 usePopupInteractionProps(store2, { 8165 activeTriggerProps: triggerProps, 8166 inactiveTriggerProps: triggerProps, 8167 popupProps: dismiss.floating ?? EMPTY_OBJECT 8168 }); 8169 return null; 8170 } 8171 8172 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 8173 var React40 = __toESM(require_react(), 1); 8174 8175 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs 8176 var React39 = __toESM(require_react(), 1); 8177 var TooltipProviderContext = /* @__PURE__ */ React39.createContext(void 0); 8178 if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; 8179 function useTooltipProviderContext() { 8180 return React39.useContext(TooltipProviderContext); 8181 } 8182 8183 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/utils/constants.mjs 8184 var OPEN_DELAY = 600; 8185 8186 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 8187 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; 8188 function getTargetElement(event) { 8189 const target = getTarget(event); 8190 return isElement(target) ? target : null; 8191 } 8192 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { 8193 const { 8194 render, 8195 className, 8196 style, 8197 handle, 8198 payload, 8199 disabled: disabledProp, 8200 delay, 8201 closeOnClick = true, 8202 closeDelay, 8203 id: idProp, 8204 ...elementProps 8205 } = componentProps; 8206 const rootContext = useTooltipRootContext(true); 8207 const handleStore = usePopupHandleStore(handle); 8208 const store2 = handleStore ?? rootContext; 8209 if (!store2) { 8210 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)); 8211 } 8212 const thisTriggerId = useBaseUiId(idProp); 8213 const isTriggerActive = store2.useState("isTriggerActive", thisTriggerId); 8214 const isOpenedByThisTrigger = store2.useState("isOpenedByTrigger", thisTriggerId); 8215 const floatingRootContext = store2.useState("floatingRootContext"); 8216 const triggerElementRef = React40.useRef(null); 8217 const closeDelayWithDefault = closeDelay ?? 0; 8218 const { 8219 registerTrigger, 8220 isMountedByThisTrigger 8221 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store2, { 8222 payload, 8223 closeOnClick, 8224 closeDelay: closeDelayWithDefault 8225 }); 8226 const providerDelay = useTooltipProviderContext(); 8227 const { 8228 activeIdRef, 8229 delayRef, 8230 isInstantPhase, 8231 hasProvider 8232 } = useDelayGroup(floatingRootContext, { 8233 open: isOpenedByThisTrigger 8234 }); 8235 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); 8236 store2.useSyncedValue("isInstantPhase", isInstantPhase); 8237 const rootDisabled = store2.useState("disabled"); 8238 const disabled2 = disabledProp ?? rootDisabled; 8239 const disabledRef = useValueAsRef(disabled2); 8240 const trackCursorAxis = store2.useState("trackCursorAxis"); 8241 const disableHoverablePopup = store2.useState("disableHoverablePopup"); 8242 const isNestedTriggerHoveredRef = React40.useRef(false); 8243 const nestedTriggerOpenTimeout = useTimeout(); 8244 const pointerTypeRef = React40.useRef(void 0); 8245 function getOpenDelay() { 8246 if (hasProvider && activeIdRef.current != null) { 8247 return 0; 8248 } 8249 return delay ?? providerDelay ?? OPEN_DELAY; 8250 } 8251 function isEnabledNestedTriggerTarget(target) { 8252 const triggerEl = triggerElementRef.current; 8253 if (!triggerEl || !target) { 8254 return false; 8255 } 8256 const nearestTrigger = closest(target, `[$TOOLTIP_TRIGGER_IDENTIFIER}]`); 8257 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); 8258 } 8259 function detectNestedTriggerHover(target) { 8260 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); 8261 isNestedTriggerHoveredRef.current = nestedTriggerHovered; 8262 if (nestedTriggerHovered) { 8263 hoverInteraction.openChangeTimeout.clear(); 8264 hoverInteraction.restTimeout.clear(); 8265 hoverInteraction.restTimeoutPending = false; 8266 nestedTriggerOpenTimeout.clear(); 8267 } 8268 return nestedTriggerHovered; 8269 } 8270 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 8271 enabled: !disabled2, 8272 mouseOnly: true, 8273 move: false, 8274 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, 8275 restMs: getOpenDelay, 8276 delay() { 8277 if (closeDelay == null && hasProvider) { 8278 return { 8279 close: getDelay(delayRef.current, "close") 8280 }; 8281 } 8282 return { 8283 close: closeDelayWithDefault 8284 }; 8285 }, 8286 triggerElementRef, 8287 isActiveTrigger: isTriggerActive, 8288 isClosing: () => store2.select("transitionStatus") === "ending", 8289 shouldOpen() { 8290 return !isNestedTriggerHoveredRef.current; 8291 } 8292 }); 8293 const focusProps = useFocus(floatingRootContext, { 8294 enabled: !disabled2 8295 }).reference; 8296 const handleNestedTriggerHover = (event) => { 8297 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; 8298 const target = getTargetElement(event); 8299 const nestedTriggerHovered = detectNestedTriggerHover(target); 8300 const triggerEl = triggerElementRef.current; 8301 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); 8302 if (nestedTriggerHovered && store2.select("open") && store2.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { 8303 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8304 return; 8305 } 8306 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store2.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. 8307 isMouseLikePointerType(pointerTypeRef.current)) { 8308 const open2 = () => { 8309 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store2.select("open")) { 8310 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); 8311 } 8312 }; 8313 const openDelay = getOpenDelay(); 8314 if (openDelay === 0) { 8315 nestedTriggerOpenTimeout.clear(); 8316 open2(); 8317 } else { 8318 nestedTriggerOpenTimeout.start(openDelay, open2); 8319 } 8320 } 8321 }; 8322 const rootTriggerProps = store2.useState("appliedTriggerProps", isMountedByThisTrigger || trackCursorAxis !== "none"); 8323 const state = { 8324 open: isOpenedByThisTrigger 8325 }; 8326 const element = useRenderElement("button", componentProps, { 8327 state, 8328 ref: [forwardedRef, registerTrigger, triggerElementRef], 8329 props: [hoverProps, focusProps, rootTriggerProps, { 8330 onMouseOver(event) { 8331 handleNestedTriggerHover(event.nativeEvent); 8332 }, 8333 onFocus(event) { 8334 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { 8335 event.preventBaseUIHandler(); 8336 } 8337 }, 8338 onMouseLeave() { 8339 isNestedTriggerHoveredRef.current = false; 8340 nestedTriggerOpenTimeout.clear(); 8341 pointerTypeRef.current = void 0; 8342 }, 8343 onPointerEnter(event) { 8344 pointerTypeRef.current = event.pointerType; 8345 }, 8346 onPointerDown(event) { 8347 pointerTypeRef.current = event.pointerType; 8348 store2.set("closeOnClick", closeOnClick); 8349 if (closeOnClick && !store2.select("open")) { 8350 store2.cancelPendingOpen(event.nativeEvent); 8351 } 8352 }, 8353 onClick(event) { 8354 if (closeOnClick && !store2.select("open")) { 8355 store2.cancelPendingOpen(event.nativeEvent); 8356 } 8357 }, 8358 id: thisTriggerId, 8359 [triggerDisabled]: disabled2 ? "" : void 0, 8360 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" 8361 }, elementProps], 8362 stateAttributesMapping: triggerOpenStateMapping 8363 }); 8364 return element; 8365 }); 8366 if (true) TooltipTrigger.displayName = "TooltipTrigger"; 8367 8368 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 8369 var React42 = __toESM(require_react(), 1); 8370 8371 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs 8372 var React41 = __toESM(require_react(), 1); 8373 var TooltipPortalContext = /* @__PURE__ */ React41.createContext(void 0); 8374 if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; 8375 function useTooltipPortalContext() { 8376 const value = React41.useContext(TooltipPortalContext); 8377 if (value === void 0) { 8378 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); 8379 } 8380 return value; 8381 } 8382 8383 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 8384 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 8385 var TooltipPortal = /* @__PURE__ */ React42.forwardRef(function TooltipPortal2(props, forwardedRef) { 8386 const { 8387 keepMounted = false, 8388 ...portalProps 8389 } = props; 8390 const store2 = useTooltipRootContext(); 8391 const mounted = store2.useState("mounted"); 8392 const shouldRender = mounted || keepMounted; 8393 if (!shouldRender) { 8394 return null; 8395 } 8396 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPortalContext.Provider, { 8397 value: keepMounted, 8398 children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FloatingPortalLite, { 8399 ref: forwardedRef, 8400 ...portalProps 8401 }) 8402 }); 8403 }); 8404 if (true) TooltipPortal.displayName = "TooltipPortal"; 8405 8406 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 8407 var React44 = __toESM(require_react(), 1); 8408 8409 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs 8410 var React43 = __toESM(require_react(), 1); 8411 var TooltipPositionerContext = /* @__PURE__ */ React43.createContext(void 0); 8412 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; 8413 function useTooltipPositionerContext() { 8414 const context = React43.useContext(TooltipPositionerContext); 8415 if (context === void 0) { 8416 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); 8417 } 8418 return context; 8419 } 8420 8421 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 8422 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 8423 var TooltipPositioner = /* @__PURE__ */ React44.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { 8424 const { 8425 render, 8426 className, 8427 anchor, 8428 positionMethod = "absolute", 8429 side = "top", 8430 align = "center", 8431 sideOffset = 0, 8432 alignOffset = 0, 8433 collisionBoundary = "clipping-ancestors", 8434 collisionPadding = 5, 8435 arrowPadding = 5, 8436 sticky = false, 8437 disableAnchorTracking = false, 8438 collisionAvoidance = POPUP_COLLISION_AVOIDANCE, 8439 style, 8440 ...elementProps 8441 } = componentProps; 8442 const store2 = useTooltipRootContext(); 8443 const keepMounted = useTooltipPortalContext(); 8444 const open2 = store2.useState("open"); 8445 const mounted = store2.useState("mounted"); 8446 const trackCursorAxis = store2.useState("trackCursorAxis"); 8447 const disableHoverablePopup = store2.useState("disableHoverablePopup"); 8448 const floatingRootContext = store2.useState("floatingRootContext"); 8449 const instantType = store2.useState("instantType"); 8450 const transitionStatus = store2.useState("transitionStatus"); 8451 const adaptiveOrigin2 = store2.useState("adaptiveOrigin"); 8452 const positioning = useAnchorPositioning({ 8453 anchor, 8454 positionMethod, 8455 floatingRootContext, 8456 mounted, 8457 side, 8458 sideOffset, 8459 align, 8460 alignOffset, 8461 collisionBoundary, 8462 collisionPadding, 8463 sticky, 8464 arrowPadding, 8465 disableAnchorTracking, 8466 keepMounted, 8467 collisionAvoidance, 8468 adaptiveOrigin: adaptiveOrigin2 8469 }); 8470 const state = React44.useMemo(() => ({ 8471 open: open2, 8472 side: positioning.side, 8473 align: positioning.align, 8474 anchorHidden: positioning.anchorHidden, 8475 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType 8476 }), [open2, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); 8477 const element = usePositioner(componentProps, state, { 8478 styles: positioning.positionerStyles, 8479 transitionStatus, 8480 props: elementProps, 8481 refs: [forwardedRef, store2.useStateSetter("positionerElement")], 8482 hidden: !mounted, 8483 inert: !open2 || trackCursorAxis === "both" || disableHoverablePopup 8484 }); 8485 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipPositionerContext.Provider, { 8486 value: positioning, 8487 children: element 8488 }); 8489 }); 8490 if (true) TooltipPositioner.displayName = "TooltipPositioner"; 8491 8492 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs 8493 var React45 = __toESM(require_react(), 1); 8494 var TooltipPopup = /* @__PURE__ */ React45.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { 8495 const { 8496 render, 8497 className, 8498 style, 8499 ...elementProps 8500 } = componentProps; 8501 const store2 = useTooltipRootContext(); 8502 const { 8503 side, 8504 align 8505 } = useTooltipPositionerContext(); 8506 const open2 = store2.useState("open"); 8507 const instantType = store2.useState("instantType"); 8508 const transitionStatus = store2.useState("transitionStatus"); 8509 const popupProps = store2.useState("popupProps"); 8510 const floatingContext = store2.useState("floatingRootContext"); 8511 const disabled2 = store2.useState("disabled"); 8512 const closeDelay = store2.useState("closeDelay"); 8513 useOpenChangeComplete({ 8514 open: open2, 8515 ref: store2.context.popupRef, 8516 onComplete() { 8517 if (open2) { 8518 store2.context.onOpenChangeComplete?.(true); 8519 } 8520 } 8521 }); 8522 useHoverFloatingInteraction(floatingContext, { 8523 enabled: !disabled2, 8524 closeDelay 8525 }); 8526 const setPopupElement = store2.useStateSetter("popupElement"); 8527 const state = { 8528 open: open2, 8529 side, 8530 align, 8531 instant: instantType, 8532 transitionStatus 8533 }; 8534 const element = useRenderElement("div", componentProps, { 8535 state, 8536 ref: [forwardedRef, store2.context.popupRef, setPopupElement], 8537 props: [FOCUSABLE_POPUP_PROPS, popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], 8538 stateAttributesMapping: popupTransitionStateMapping 8539 }); 8540 return element; 8541 }); 8542 if (true) TooltipPopup.displayName = "TooltipPopup"; 8543 8544 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs 8545 var React46 = __toESM(require_react(), 1); 8546 var TooltipArrow = /* @__PURE__ */ React46.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { 8547 const { 8548 render, 8549 className, 8550 style, 8551 ...elementProps 8552 } = componentProps; 8553 const store2 = useTooltipRootContext(); 8554 const { 8555 arrowRef, 8556 side, 8557 align, 8558 arrowUncentered, 8559 arrowStyles 8560 } = useTooltipPositionerContext(); 8561 const open2 = store2.useState("open"); 8562 const instantType = store2.useState("instantType"); 8563 const state = { 8564 open: open2, 8565 side, 8566 align, 8567 uncentered: arrowUncentered, 8568 instant: instantType 8569 }; 8570 const element = useRenderElement("div", componentProps, { 8571 state, 8572 ref: [forwardedRef, arrowRef], 8573 props: [{ 8574 style: arrowStyles, 8575 "aria-hidden": true 8576 }, elementProps], 8577 stateAttributesMapping: popupStateMapping 8578 }); 8579 return element; 8580 }); 8581 if (true) TooltipArrow.displayName = "TooltipArrow"; 8582 8583 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs 8584 var React47 = __toESM(require_react(), 1); 8585 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 8586 var TooltipProvider = function TooltipProvider2(props) { 8587 const { 8588 delay, 8589 closeDelay, 8590 timeout = 400 8591 } = props; 8592 const delayValue = React47.useMemo(() => ({ 8593 open: delay, 8594 close: closeDelay 8595 }), [delay, closeDelay]); 8596 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipProviderContext.Provider, { 8597 value: delay, 8598 children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FloatingDelayGroup, { 8599 delay: delayValue, 8600 timeoutMs: timeout, 8601 children: props.children 8602 }) 8603 }); 8604 }; 8605 if (true) TooltipProvider.displayName = "TooltipProvider"; 8606 8607 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs 8608 var React48 = __toESM(require_react(), 1); 8609 var TooltipViewport = /* @__PURE__ */ React48.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { 8610 const { 8611 render, 8612 className, 8613 style, 8614 children, 8615 ...elementProps 8616 } = componentProps; 8617 const store2 = useTooltipRootContext(); 8618 const positioner = useTooltipPositionerContext(); 8619 const instantType = store2.useState("instantType"); 8620 const { 8621 children: childrenToRender, 8622 state: viewportState 8623 } = usePopupViewport({ 8624 store: store2, 8625 side: positioner.side, 8626 children 8627 }); 8628 const state = { 8629 activationDirection: viewportState.activationDirection, 8630 transitioning: viewportState.transitioning, 8631 instant: instantType 8632 }; 8633 return useRenderElement("div", componentProps, { 8634 state, 8635 ref: forwardedRef, 8636 props: [elementProps, { 8637 children: childrenToRender 8638 }], 8639 stateAttributesMapping: popupViewportStateMapping 8640 }); 8641 }); 8642 if (true) TooltipViewport.displayName = "TooltipViewport"; 8643 8644 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs 8645 var TooltipHandle = class extends BasePopupHandle { 8646 constructor() { 8647 super(createNullTooltipStore(), "Tooltip"); 8648 } 8649 /** 8650 * Opens the tooltip and associates it with the trigger with the given id. 8651 * 8652 * This method should only be called in an event handler or an effect (not during rendering). 8653 * 8654 * @param triggerId ID of the trigger to associate with the tooltip. The trigger must be a matching 8655 * `Tooltip.Trigger` with this handle passed as a prop. 8656 */ 8657 open(triggerId) { 8658 this.openByTrigger(triggerId); 8659 } 8660 /** 8661 * Closes the tooltip. 8662 * 8663 * This method should only be called in an event handler or an effect (not during rendering). 8664 */ 8665 close() { 8666 this.closePopup(); 8667 } 8668 /** 8669 * Whether the tooltip is currently open. Returns `false` while no root is attached to the handle. 8670 */ 8671 get isOpen() { 8672 return this.attachedStore?.select("open") ?? false; 8673 } 8674 }; 8675 function createTooltipHandle() { 8676 return new TooltipHandle(); 8677 } 8678 8679 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/use-render/useRender.mjs 8680 function useRender(params) { 8681 return useRenderElement(params.defaultTagName ?? "div", params, params); 8682 } 8683 8684 // packages/icons/build-module/library/chevron-down.mjs 8685 var import_primitives = __toESM(require_primitives(), 1); 8686 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 8687 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime12.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_runtime12.jsx)(import_primitives.Path, { d: "M7 11L12 15L17 11" }) }); 8688 8689 // packages/icons/build-module/library/chevron-left.mjs 8690 var import_primitives2 = __toESM(require_primitives(), 1); 8691 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 8692 var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime13.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_runtime13.jsx)(import_primitives2.Path, { d: "M14 6.5L9 12L14 17.5" }) }); 8693 8694 // packages/icons/build-module/library/chevron-right.mjs 8695 var import_primitives3 = __toESM(require_primitives(), 1); 8696 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 8697 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives3.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_runtime14.jsx)(import_primitives3.Path, { d: "M10 6.5L15 12L10 17.5" }) }); 8698 8699 // packages/icons/build-module/library/chevron-up.mjs 8700 var import_primitives4 = __toESM(require_primitives(), 1); 8701 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 8702 var chevron_up_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives4.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_runtime15.jsx)(import_primitives4.Path, { d: "M7 13L12 9L17 13" }) }); 8703 8704 // packages/icons/build-module/library/fullscreen.mjs 8705 var import_primitives5 = __toESM(require_primitives(), 1); 8706 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 8707 var fullscreen_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives5.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_runtime16.jsx)(import_primitives5.Path, { d: "M4.75 10V4.75H10M4.75 4.75L10 10M14 19.25H19.25V14M19.25 19.25L14 14" }) }); 8708 8709 // packages/ui/build-module/visually-hidden/visually-hidden.mjs 8710 var import_element10 = __toESM(require_element(), 1); 8711 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 8712 function getRuntime() { 8713 const globalScope = globalThis; 8714 if (globalScope.__wpStyleRuntime) { 8715 return globalScope.__wpStyleRuntime; 8716 } 8717 globalScope.__wpStyleRuntime = { 8718 documents: /* @__PURE__ */ new Map(), 8719 styles: /* @__PURE__ */ new Map(), 8720 injectedStyles: /* @__PURE__ */ new WeakMap() 8721 }; 8722 if (typeof document !== "undefined") { 8723 registerDocument(document); 8724 } 8725 return globalScope.__wpStyleRuntime; 8726 } 8727 function documentContainsStyleHash(targetDocument, hash) { 8728 if (!targetDocument.head) { 8729 return false; 8730 } 8731 for (const style of targetDocument.head.querySelectorAll( 8732 `style[$STYLE_HASH_ATTRIBUTE}]` 8733 )) { 8734 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 8735 return true; 8736 } 8737 } 8738 return false; 8739 } 8740 function injectStyle(targetDocument, hash, css) { 8741 if (!targetDocument.head) { 8742 return; 8743 } 8744 const runtime = getRuntime(); 8745 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8746 if (!injectedStyles) { 8747 injectedStyles = /* @__PURE__ */ new Set(); 8748 runtime.injectedStyles.set(targetDocument, injectedStyles); 8749 } 8750 if (injectedStyles.has(hash)) { 8751 return; 8752 } 8753 if (documentContainsStyleHash(targetDocument, hash)) { 8754 injectedStyles.add(hash); 8755 return; 8756 } 8757 const style = targetDocument.createElement("style"); 8758 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 8759 style.appendChild(targetDocument.createTextNode(css)); 8760 targetDocument.head.appendChild(style); 8761 injectedStyles.add(hash); 8762 } 8763 function registerDocument(targetDocument) { 8764 const runtime = getRuntime(); 8765 runtime.documents.set( 8766 targetDocument, 8767 (runtime.documents.get(targetDocument) ?? 0) + 1 8768 ); 8769 for (const [hash, css] of runtime.styles) { 8770 injectStyle(targetDocument, hash, css); 8771 } 8772 return () => { 8773 const count = runtime.documents.get(targetDocument); 8774 if (count === void 0) { 8775 return; 8776 } 8777 if (count <= 1) { 8778 runtime.documents.delete(targetDocument); 8779 return; 8780 } 8781 runtime.documents.set(targetDocument, count - 1); 8782 }; 8783 } 8784 function registerStyle(hash, css) { 8785 const runtime = getRuntime(); 8786 runtime.styles.set(hash, css); 8787 for (const targetDocument of runtime.documents.keys()) { 8788 injectStyle(targetDocument, hash, css); 8789 } 8790 } 8791 if (typeof process === "undefined" || true) { 8792 registerStyle("15abcab4d0", ".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}"); 8793 } 8794 var style_default = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; 8795 var VisuallyHidden = (0, import_element10.forwardRef)( 8796 function UnforwardedVisuallyHidden({ render, ...restProps }, ref) { 8797 const element = useRender({ 8798 render, 8799 ref, 8800 props: mergeProps( 8801 { className: style_default["visually-hidden"] }, 8802 restProps, 8803 { 8804 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. 8805 "data-visually-hidden": "" 8806 } 8807 ) 8808 }); 8809 return element; 8810 } 8811 ); 8812 8813 // packages/ui/build-module/utils/render-slot-with-children.mjs 8814 var import_element11 = __toESM(require_element(), 1); 8815 function renderSlotWithChildren(slot, defaultSlot, children) { 8816 return (0, import_element11.cloneElement)( 8817 slot ?? defaultSlot, 8818 { children } 8819 ); 8820 } 8821 8822 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs 8823 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 8824 function getRuntime2() { 8825 const globalScope = globalThis; 8826 if (globalScope.__wpStyleRuntime) { 8827 return globalScope.__wpStyleRuntime; 8828 } 8829 globalScope.__wpStyleRuntime = { 8830 documents: /* @__PURE__ */ new Map(), 8831 styles: /* @__PURE__ */ new Map(), 8832 injectedStyles: /* @__PURE__ */ new WeakMap() 8833 }; 8834 if (typeof document !== "undefined") { 8835 registerDocument2(document); 8836 } 8837 return globalScope.__wpStyleRuntime; 8838 } 8839 function documentContainsStyleHash2(targetDocument, hash) { 8840 if (!targetDocument.head) { 8841 return false; 8842 } 8843 for (const style of targetDocument.head.querySelectorAll( 8844 `style[$STYLE_HASH_ATTRIBUTE2}]` 8845 )) { 8846 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 8847 return true; 8848 } 8849 } 8850 return false; 8851 } 8852 function injectStyle2(targetDocument, hash, css) { 8853 if (!targetDocument.head) { 8854 return; 8855 } 8856 const runtime = getRuntime2(); 8857 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8858 if (!injectedStyles) { 8859 injectedStyles = /* @__PURE__ */ new Set(); 8860 runtime.injectedStyles.set(targetDocument, injectedStyles); 8861 } 8862 if (injectedStyles.has(hash)) { 8863 return; 8864 } 8865 if (documentContainsStyleHash2(targetDocument, hash)) { 8866 injectedStyles.add(hash); 8867 return; 8868 } 8869 const style = targetDocument.createElement("style"); 8870 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 8871 style.appendChild(targetDocument.createTextNode(css)); 8872 targetDocument.head.appendChild(style); 8873 injectedStyles.add(hash); 8874 } 8875 function registerDocument2(targetDocument) { 8876 const runtime = getRuntime2(); 8877 runtime.documents.set( 8878 targetDocument, 8879 (runtime.documents.get(targetDocument) ?? 0) + 1 8880 ); 8881 for (const [hash, css] of runtime.styles) { 8882 injectStyle2(targetDocument, hash, css); 8883 } 8884 return () => { 8885 const count = runtime.documents.get(targetDocument); 8886 if (count === void 0) { 8887 return; 8888 } 8889 if (count <= 1) { 8890 runtime.documents.delete(targetDocument); 8891 return; 8892 } 8893 runtime.documents.set(targetDocument, count - 1); 8894 }; 8895 } 8896 function registerStyle2(hash, css) { 8897 const runtime = getRuntime2(); 8898 runtime.styles.set(hash, css); 8899 for (const targetDocument of runtime.documents.keys()) { 8900 injectStyle2(targetDocument, hash, css); 8901 } 8902 } 8903 if (typeof process === "undefined" || true) { 8904 registerStyle2("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}}}"); 8905 } 8906 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; 8907 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; 8908 function resolveOwnerDocument() { 8909 return typeof document === "undefined" ? null : document; 8910 } 8911 function isInWordPressEnvironment() { 8912 let topWp; 8913 try { 8914 topWp = window.top?.wp; 8915 } catch { 8916 } 8917 const wp = topWp ?? window.wp; 8918 return typeof wp?.components === "object" && wp.components !== null; 8919 } 8920 var cachedSlot = null; 8921 function ensureSlotIsAccessible(element) { 8922 element.setAttribute("aria-hidden", "false"); 8923 return element; 8924 } 8925 function createSlot(ownerDocument2) { 8926 const element = ownerDocument2.createElement("div"); 8927 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); 8928 if (wp_compat_overlay_slot_default.slot) { 8929 element.classList.add(wp_compat_overlay_slot_default.slot); 8930 } 8931 ownerDocument2.body.appendChild(element); 8932 return element; 8933 } 8934 function getWpCompatOverlaySlot() { 8935 if (typeof window === "undefined") { 8936 return void 0; 8937 } 8938 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { 8939 return void 0; 8940 } 8941 const ownerDocument2 = resolveOwnerDocument(); 8942 if (!ownerDocument2 || !ownerDocument2.body) { 8943 return void 0; 8944 } 8945 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { 8946 return ensureSlotIsAccessible(cachedSlot); 8947 } 8948 const existing = ownerDocument2.querySelector( 8949 `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` 8950 ); 8951 if (existing instanceof HTMLDivElement) { 8952 cachedSlot = ensureSlotIsAccessible(existing); 8953 return cachedSlot; 8954 } 8955 if (cachedSlot?.isConnected) { 8956 cachedSlot.remove(); 8957 } 8958 cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2)); 8959 return cachedSlot; 8960 } 8961 8962 // packages/ui/build-module/utils/direction-provider.mjs 8963 var import_i18n = __toESM(require_i18n(), 1); 8964 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 8965 function DirectionProvider3({ children }) { 8966 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DirectionProvider, { direction: (0, import_i18n.isRTL)() ? "rtl" : "ltr", children }); 8967 } 8968 8969 // packages/ui/build-module/tooltip/index.mjs 8970 var tooltip_exports = {}; 8971 __export(tooltip_exports, { 8972 Popup: () => Popup, 8973 Portal: () => Portal, 8974 Positioner: () => Positioner, 8975 Provider: () => Provider, 8976 Root: () => Root, 8977 Trigger: () => Trigger 8978 }); 8979 8980 // packages/ui/build-module/tooltip/popup.mjs 8981 var import_element14 = __toESM(require_element(), 1); 8982 8983 // packages/ui/build-module/tooltip/portal.mjs 8984 var import_element12 = __toESM(require_element(), 1); 8985 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 8986 var Portal = (0, import_element12.forwardRef)( 8987 function TooltipPortal3({ container, ...restProps }, ref) { 8988 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 8989 index_parts_exports.Portal, 8990 { 8991 container: container === void 0 ? getWpCompatOverlaySlot() : container, 8992 ...restProps, 8993 ref 8994 } 8995 ); 8996 } 8997 ); 8998 8999 // packages/ui/build-module/tooltip/positioner.mjs 9000 var import_element13 = __toESM(require_element(), 1); 9001 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 9002 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; 9003 function getRuntime3() { 9004 const globalScope = globalThis; 9005 if (globalScope.__wpStyleRuntime) { 9006 return globalScope.__wpStyleRuntime; 9007 } 9008 globalScope.__wpStyleRuntime = { 9009 documents: /* @__PURE__ */ new Map(), 9010 styles: /* @__PURE__ */ new Map(), 9011 injectedStyles: /* @__PURE__ */ new WeakMap() 9012 }; 9013 if (typeof document !== "undefined") { 9014 registerDocument3(document); 9015 } 9016 return globalScope.__wpStyleRuntime; 9017 } 9018 function documentContainsStyleHash3(targetDocument, hash) { 9019 if (!targetDocument.head) { 9020 return false; 9021 } 9022 for (const style of targetDocument.head.querySelectorAll( 9023 `style[$STYLE_HASH_ATTRIBUTE3}]` 9024 )) { 9025 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { 9026 return true; 9027 } 9028 } 9029 return false; 9030 } 9031 function injectStyle3(targetDocument, hash, css) { 9032 if (!targetDocument.head) { 9033 return; 9034 } 9035 const runtime = getRuntime3(); 9036 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9037 if (!injectedStyles) { 9038 injectedStyles = /* @__PURE__ */ new Set(); 9039 runtime.injectedStyles.set(targetDocument, injectedStyles); 9040 } 9041 if (injectedStyles.has(hash)) { 9042 return; 9043 } 9044 if (documentContainsStyleHash3(targetDocument, hash)) { 9045 injectedStyles.add(hash); 9046 return; 9047 } 9048 const style = targetDocument.createElement("style"); 9049 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); 9050 style.appendChild(targetDocument.createTextNode(css)); 9051 targetDocument.head.appendChild(style); 9052 injectedStyles.add(hash); 9053 } 9054 function registerDocument3(targetDocument) { 9055 const runtime = getRuntime3(); 9056 runtime.documents.set( 9057 targetDocument, 9058 (runtime.documents.get(targetDocument) ?? 0) + 1 9059 ); 9060 for (const [hash, css] of runtime.styles) { 9061 injectStyle3(targetDocument, hash, css); 9062 } 9063 return () => { 9064 const count = runtime.documents.get(targetDocument); 9065 if (count === void 0) { 9066 return; 9067 } 9068 if (count <= 1) { 9069 runtime.documents.delete(targetDocument); 9070 return; 9071 } 9072 runtime.documents.set(targetDocument, count - 1); 9073 }; 9074 } 9075 function registerStyle3(hash, css) { 9076 const runtime = getRuntime3(); 9077 runtime.styles.set(hash, css); 9078 for (const targetDocument of runtime.documents.keys()) { 9079 injectStyle3(targetDocument, hash, css); 9080 } 9081 } 9082 if (typeof process === "undefined" || true) { 9083 registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 9084 } 9085 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 9086 if (typeof process === "undefined" || true) { 9087 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}}}}'); 9088 } 9089 var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 9090 var Positioner = (0, import_element13.forwardRef)( 9091 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { 9092 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 9093 index_parts_exports.Positioner, 9094 { 9095 ref, 9096 align, 9097 side, 9098 sideOffset, 9099 ...props, 9100 className: clsx_default( 9101 resets_default["box-sizing"], 9102 style_default2.positioner, 9103 className 9104 ) 9105 } 9106 ); 9107 } 9108 ); 9109 9110 // packages/ui/build-module/utils/theme-provider.mjs 9111 var theme = __toESM(require_theme(), 1); 9112 9113 // packages/ui/build-module/lock-unlock.mjs 9114 var import_private_apis = __toESM(require_private_apis(), 1); 9115 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 9116 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 9117 "@wordpress/ui" 9118 ); 9119 9120 // packages/ui/build-module/utils/theme-provider.mjs 9121 function getThemeProvider() { 9122 const themePackage = theme; 9123 if (themePackage.ThemeProvider) { 9124 return themePackage.ThemeProvider; 9125 } 9126 if (!themePackage.privateApis) { 9127 throw new Error( 9128 "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." 9129 ); 9130 } 9131 return unlock( 9132 themePackage.privateApis 9133 ).ThemeProvider; 9134 } 9135 var ThemeProvider = getThemeProvider(); 9136 9137 // packages/ui/build-module/tooltip/popup.mjs 9138 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 9139 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; 9140 function getRuntime4() { 9141 const globalScope = globalThis; 9142 if (globalScope.__wpStyleRuntime) { 9143 return globalScope.__wpStyleRuntime; 9144 } 9145 globalScope.__wpStyleRuntime = { 9146 documents: /* @__PURE__ */ new Map(), 9147 styles: /* @__PURE__ */ new Map(), 9148 injectedStyles: /* @__PURE__ */ new WeakMap() 9149 }; 9150 if (typeof document !== "undefined") { 9151 registerDocument4(document); 9152 } 9153 return globalScope.__wpStyleRuntime; 9154 } 9155 function documentContainsStyleHash4(targetDocument, hash) { 9156 if (!targetDocument.head) { 9157 return false; 9158 } 9159 for (const style of targetDocument.head.querySelectorAll( 9160 `style[$STYLE_HASH_ATTRIBUTE4}]` 9161 )) { 9162 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { 9163 return true; 9164 } 9165 } 9166 return false; 9167 } 9168 function injectStyle4(targetDocument, hash, css) { 9169 if (!targetDocument.head) { 9170 return; 9171 } 9172 const runtime = getRuntime4(); 9173 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9174 if (!injectedStyles) { 9175 injectedStyles = /* @__PURE__ */ new Set(); 9176 runtime.injectedStyles.set(targetDocument, injectedStyles); 9177 } 9178 if (injectedStyles.has(hash)) { 9179 return; 9180 } 9181 if (documentContainsStyleHash4(targetDocument, hash)) { 9182 injectedStyles.add(hash); 9183 return; 9184 } 9185 const style = targetDocument.createElement("style"); 9186 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); 9187 style.appendChild(targetDocument.createTextNode(css)); 9188 targetDocument.head.appendChild(style); 9189 injectedStyles.add(hash); 9190 } 9191 function registerDocument4(targetDocument) { 9192 const runtime = getRuntime4(); 9193 runtime.documents.set( 9194 targetDocument, 9195 (runtime.documents.get(targetDocument) ?? 0) + 1 9196 ); 9197 for (const [hash, css] of runtime.styles) { 9198 injectStyle4(targetDocument, hash, css); 9199 } 9200 return () => { 9201 const count = runtime.documents.get(targetDocument); 9202 if (count === void 0) { 9203 return; 9204 } 9205 if (count <= 1) { 9206 runtime.documents.delete(targetDocument); 9207 return; 9208 } 9209 runtime.documents.set(targetDocument, count - 1); 9210 }; 9211 } 9212 function registerStyle4(hash, css) { 9213 const runtime = getRuntime4(); 9214 runtime.styles.set(hash, css); 9215 for (const targetDocument of runtime.documents.keys()) { 9216 injectStyle4(targetDocument, hash, css); 9217 } 9218 } 9219 if (typeof process === "undefined" || true) { 9220 registerStyle4("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}}}}'); 9221 } 9222 var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 9223 var POPUP_COLOR = { background: "#1e1e1e" }; 9224 var Popup = (0, import_element14.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { 9225 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( 9226 index_parts_exports.Popup, 9227 { 9228 ref, 9229 className: clsx_default(style_default3.popup, className), 9230 ...props, 9231 children 9232 } 9233 ) }); 9234 const positionedPopup = renderSlotWithChildren( 9235 positioner, 9236 /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Positioner, {}), 9237 popupContent 9238 ); 9239 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Portal, {}), positionedPopup); 9240 }); 9241 9242 // packages/ui/build-module/tooltip/trigger.mjs 9243 var import_element15 = __toESM(require_element(), 1); 9244 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 9245 var Trigger = (0, import_element15.forwardRef)( 9246 function TooltipTrigger3(props, ref) { 9247 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(index_parts_exports.Trigger, { ref, ...props }); 9248 } 9249 ); 9250 9251 // packages/ui/build-module/tooltip/root.mjs 9252 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 9253 function Root(props) { 9254 return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(index_parts_exports.Root, { ...props }) }); 9255 } 9256 9257 // packages/ui/build-module/tooltip/provider.mjs 9258 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 9259 function Provider({ ...props }) { 9260 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(index_parts_exports.Provider, { ...props }); 9261 } 9262 9263 // packages/ui/build-module/stack/stack.mjs 9264 var import_element16 = __toESM(require_element(), 1); 9265 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; 9266 function getRuntime5() { 9267 const globalScope = globalThis; 9268 if (globalScope.__wpStyleRuntime) { 9269 return globalScope.__wpStyleRuntime; 9270 } 9271 globalScope.__wpStyleRuntime = { 9272 documents: /* @__PURE__ */ new Map(), 9273 styles: /* @__PURE__ */ new Map(), 9274 injectedStyles: /* @__PURE__ */ new WeakMap() 9275 }; 9276 if (typeof document !== "undefined") { 9277 registerDocument5(document); 9278 } 9279 return globalScope.__wpStyleRuntime; 9280 } 9281 function documentContainsStyleHash5(targetDocument, hash) { 9282 if (!targetDocument.head) { 9283 return false; 9284 } 9285 for (const style of targetDocument.head.querySelectorAll( 9286 `style[$STYLE_HASH_ATTRIBUTE5}]` 9287 )) { 9288 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { 9289 return true; 9290 } 9291 } 9292 return false; 9293 } 9294 function injectStyle5(targetDocument, hash, css) { 9295 if (!targetDocument.head) { 9296 return; 9297 } 9298 const runtime = getRuntime5(); 9299 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9300 if (!injectedStyles) { 9301 injectedStyles = /* @__PURE__ */ new Set(); 9302 runtime.injectedStyles.set(targetDocument, injectedStyles); 9303 } 9304 if (injectedStyles.has(hash)) { 9305 return; 9306 } 9307 if (documentContainsStyleHash5(targetDocument, hash)) { 9308 injectedStyles.add(hash); 9309 return; 9310 } 9311 const style = targetDocument.createElement("style"); 9312 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); 9313 style.appendChild(targetDocument.createTextNode(css)); 9314 targetDocument.head.appendChild(style); 9315 injectedStyles.add(hash); 9316 } 9317 function registerDocument5(targetDocument) { 9318 const runtime = getRuntime5(); 9319 runtime.documents.set( 9320 targetDocument, 9321 (runtime.documents.get(targetDocument) ?? 0) + 1 9322 ); 9323 for (const [hash, css] of runtime.styles) { 9324 injectStyle5(targetDocument, hash, css); 9325 } 9326 return () => { 9327 const count = runtime.documents.get(targetDocument); 9328 if (count === void 0) { 9329 return; 9330 } 9331 if (count <= 1) { 9332 runtime.documents.delete(targetDocument); 9333 return; 9334 } 9335 runtime.documents.set(targetDocument, count - 1); 9336 }; 9337 } 9338 function registerStyle5(hash, css) { 9339 const runtime = getRuntime5(); 9340 runtime.styles.set(hash, css); 9341 for (const targetDocument of runtime.documents.keys()) { 9342 injectStyle5(targetDocument, hash, css); 9343 } 9344 } 9345 if (typeof process === "undefined" || true) { 9346 registerStyle5("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); 9347 } 9348 var style_default4 = { "stack": "_19ce0419607e1896__stack" }; 9349 var gapTokens = { 9350 xs: "var(--wpds-dimension-gap-xs, 4px)", 9351 sm: "var(--wpds-dimension-gap-sm, 8px)", 9352 md: "var(--wpds-dimension-gap-md, 12px)", 9353 lg: "var(--wpds-dimension-gap-lg, 16px)", 9354 xl: "var(--wpds-dimension-gap-xl, 24px)", 9355 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 9356 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 9357 }; 9358 var Stack = (0, import_element16.forwardRef)( 9359 function UnforwardedStack({ direction, gap, align, justify, wrap, render, ...props }, ref) { 9360 const style = { 9361 gap: gap && gapTokens[gap], 9362 alignItems: align, 9363 justifyContent: justify, 9364 flexDirection: direction, 9365 flexWrap: wrap 9366 }; 9367 const element = useRender({ 9368 render, 9369 ref, 9370 props: mergeProps(props, { 9371 style, 9372 className: style_default4.stack 9373 }) 9374 }); 9375 return element; 9376 } 9377 ); 9378 9379 // packages/admin-ui/build-module/navigable-region/index.mjs 9380 var import_element17 = __toESM(require_element(), 1); 9381 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 9382 var NavigableRegion = (0, import_element17.forwardRef)( 9383 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 9384 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 9385 Tag, 9386 { 9387 ref, 9388 className: clsx_default("admin-ui-navigable-region", className), 9389 "aria-label": ariaLabel, 9390 role: "region", 9391 tabIndex: "-1", 9392 ...props, 9393 children 9394 } 9395 ); 9396 } 9397 ); 9398 NavigableRegion.displayName = "NavigableRegion"; 9399 var navigable_region_default = NavigableRegion; 9400 9401 // packages/admin-ui/build-module/admin-theme-colors/index.mjs 9402 var DEFAULT_THEME_COLORS = { 9403 primary: "#3858e9", 9404 background: "#222524" 9405 }; 9406 var ADMIN_THEME_COLORS = /* @__PURE__ */ new Map([ 9407 ["modern", DEFAULT_THEME_COLORS], 9408 ["fresh", { primary: "#007cba", background: "#25292b" }], 9409 ["midnight", { primary: "#cf4339", background: "#3d4042" }], 9410 ["coffee", { primary: "#916745", background: "#5b534d" }], 9411 ["ocean", { primary: "#567958", background: "#5f787f" }], 9412 ["blue", { primary: "#437aa8", background: "#3876a8" }], 9413 ["ectoplasm", { primary: "#646c3e", background: "#4f386e" }], 9414 ["sunrise", { primary: "#ad631e", background: "#cc4541" }], 9415 ["light", { primary: "#007cba", background: "#eaeeed" }] 9416 ]); 9417 function getAdminThemeColors() { 9418 const scheme = document.body.className.match(/admin-color-([\w-]+)/)?.[1] ?? "modern"; 9419 return ADMIN_THEME_COLORS.get(scheme) ?? DEFAULT_THEME_COLORS; 9420 } 9421 9422 // packages/edit-post/build-module/components/layout/index.mjs 9423 var import_editor19 = __toESM(require_editor(), 1); 9424 var import_data26 = __toESM(require_data(), 1); 9425 var import_block_editor2 = __toESM(require_block_editor(), 1); 9426 9427 // packages/global-styles-engine/build-module/utils/common.mjs 9428 var import_style_engine = __toESM(require_style_engine(), 1); 9429 var ROOT_BLOCK_SELECTOR = "body"; 9430 var ROOT_CSS_PROPERTIES_SELECTOR = ":root"; 9431 9432 // packages/global-styles-engine/build-module/core/render.mjs 9433 var import_blocks = __toESM(require_blocks(), 1); 9434 var import_style_engine2 = __toESM(require_style_engine(), 1); 9435 var import_data = __toESM(require_data(), 1); 9436 9437 // packages/global-styles-engine/build-module/utils/spacing.mjs 9438 function getSpacingPresetCssVar(value) { 9439 if (!value) { 9440 return; 9441 } 9442 const slug = value.match(/var:preset\|spacing\|(.+)/); 9443 if (!slug) { 9444 return value; 9445 } 9446 return `var(--wp--preset--spacing--$slug[1]})`; 9447 } 9448 9449 // packages/global-styles-engine/build-module/utils/gap.mjs 9450 function getGapBoxControlValueFromStyle(blockGapValue) { 9451 if (!blockGapValue) { 9452 return null; 9453 } 9454 const isValueString = typeof blockGapValue === "string"; 9455 return { 9456 top: isValueString ? blockGapValue : blockGapValue?.top, 9457 left: isValueString ? blockGapValue : blockGapValue?.left 9458 }; 9459 } 9460 function getGapCSSValue(blockGapValue, defaultValue = "0") { 9461 const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue); 9462 if (!blockGapBoxControlValue) { 9463 return null; 9464 } 9465 const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue; 9466 const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue; 9467 return row === column ? row : `$row} $column}`; 9468 } 9469 9470 // packages/global-styles-engine/build-module/utils/layout.mjs 9471 var LAYOUT_DEFINITIONS = { 9472 default: { 9473 name: "default", 9474 slug: "flow", 9475 className: "is-layout-flow", 9476 baseStyles: [ 9477 { 9478 selector: " > .alignleft", 9479 rules: { 9480 float: "left", 9481 "margin-inline-start": "0", 9482 "margin-inline-end": "2em" 9483 } 9484 }, 9485 { 9486 selector: " > .alignright", 9487 rules: { 9488 float: "right", 9489 "margin-inline-start": "2em", 9490 "margin-inline-end": "0" 9491 } 9492 }, 9493 { 9494 selector: " > .aligncenter", 9495 rules: { 9496 "margin-left": "auto !important", 9497 "margin-right": "auto !important" 9498 } 9499 } 9500 ], 9501 spacingStyles: [ 9502 { 9503 selector: " > :first-child", 9504 rules: { 9505 "margin-block-start": "0" 9506 } 9507 }, 9508 { 9509 selector: " > :last-child", 9510 rules: { 9511 "margin-block-end": "0" 9512 } 9513 }, 9514 { 9515 selector: " > *", 9516 rules: { 9517 "margin-block-start": null, 9518 "margin-block-end": "0" 9519 } 9520 } 9521 ] 9522 }, 9523 constrained: { 9524 name: "constrained", 9525 slug: "constrained", 9526 className: "is-layout-constrained", 9527 baseStyles: [ 9528 { 9529 selector: " > .alignleft", 9530 rules: { 9531 float: "left", 9532 "margin-inline-start": "0", 9533 "margin-inline-end": "2em" 9534 } 9535 }, 9536 { 9537 selector: " > .alignright", 9538 rules: { 9539 float: "right", 9540 "margin-inline-start": "2em", 9541 "margin-inline-end": "0" 9542 } 9543 }, 9544 { 9545 selector: " > .aligncenter", 9546 rules: { 9547 "margin-left": "auto !important", 9548 "margin-right": "auto !important" 9549 } 9550 }, 9551 { 9552 selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))", 9553 rules: { 9554 "max-width": "var(--wp--style--global--content-size)", 9555 "margin-left": "auto !important", 9556 "margin-right": "auto !important" 9557 } 9558 }, 9559 { 9560 selector: " > .alignwide", 9561 rules: { 9562 "max-width": "var(--wp--style--global--wide-size)" 9563 } 9564 } 9565 ], 9566 spacingStyles: [ 9567 { 9568 selector: " > :first-child", 9569 rules: { 9570 "margin-block-start": "0" 9571 } 9572 }, 9573 { 9574 selector: " > :last-child", 9575 rules: { 9576 "margin-block-end": "0" 9577 } 9578 }, 9579 { 9580 selector: " > *", 9581 rules: { 9582 "margin-block-start": null, 9583 "margin-block-end": "0" 9584 } 9585 } 9586 ] 9587 }, 9588 flex: { 9589 name: "flex", 9590 slug: "flex", 9591 className: "is-layout-flex", 9592 displayMode: "flex", 9593 baseStyles: [ 9594 { 9595 selector: "", 9596 rules: { 9597 "flex-wrap": "wrap", 9598 "align-items": "center" 9599 } 9600 }, 9601 { 9602 selector: " > :is(*, div)", 9603 // :is(*, div) instead of just * increases the specificity by 001. 9604 rules: { 9605 margin: "0" 9606 } 9607 } 9608 ], 9609 spacingStyles: [ 9610 { 9611 selector: "", 9612 rules: { 9613 gap: null 9614 } 9615 } 9616 ] 9617 }, 9618 grid: { 9619 name: "grid", 9620 slug: "grid", 9621 className: "is-layout-grid", 9622 displayMode: "grid", 9623 baseStyles: [ 9624 { 9625 selector: " > :is(*, div)", 9626 // :is(*, div) instead of just * increases the specificity by 001. 9627 rules: { 9628 margin: "0" 9629 } 9630 } 9631 ], 9632 spacingStyles: [ 9633 { 9634 selector: "", 9635 rules: { 9636 gap: null 9637 } 9638 } 9639 ] 9640 } 9641 }; 9642 9643 // packages/global-styles-engine/build-module/core/render.mjs 9644 function getLayoutStyles({ 9645 layoutDefinitions = LAYOUT_DEFINITIONS, 9646 style, 9647 selector, 9648 hasBlockGapSupport, 9649 hasFallbackGapSupport, 9650 fallbackGapValue 9651 }) { 9652 let ruleset = ""; 9653 const blockGapValue = style?.spacing?.blockGap; 9654 let gapValue = hasBlockGapSupport ? getGapCSSValue(blockGapValue) : ""; 9655 if (hasFallbackGapSupport) { 9656 if (selector === ROOT_BLOCK_SELECTOR) { 9657 gapValue = !gapValue ? "0.5em" : gapValue; 9658 } else if (!hasBlockGapSupport && fallbackGapValue) { 9659 gapValue = fallbackGapValue; 9660 } 9661 } 9662 const rowGapValue = hasBlockGapSupport && blockGapValue && typeof blockGapValue !== "string" ? getGapCSSValue(blockGapValue.top) : gapValue; 9663 if (gapValue && layoutDefinitions) { 9664 Object.values(layoutDefinitions).forEach( 9665 ({ className, name, spacingStyles }) => { 9666 if (!hasBlockGapSupport && "flex" !== name && "grid" !== name) { 9667 return; 9668 } 9669 const layoutGapValue = ["default", "constrained"].includes( 9670 name 9671 ) ? rowGapValue : gapValue; 9672 if (spacingStyles?.length) { 9673 spacingStyles.forEach((spacingStyle) => { 9674 const declarations = []; 9675 if (spacingStyle.rules) { 9676 Object.entries(spacingStyle.rules).forEach( 9677 ([cssProperty, cssValue]) => { 9678 declarations.push( 9679 `$cssProperty}: $cssValue ? cssValue : layoutGapValue}` 9680 ); 9681 } 9682 ); 9683 } 9684 if (declarations.length) { 9685 let combinedSelector = ""; 9686 if (!hasBlockGapSupport) { 9687 combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.$className}$spacingStyle?.selector || ""})` : `:where($selector}.$className}$spacingStyle?.selector || ""})`; 9688 } else { 9689 combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:root :where(.$className})$spacingStyle?.selector || ""}` : `:root :where($selector}-$className})$spacingStyle?.selector || ""}`; 9690 } 9691 ruleset += `$combinedSelector} { $declarations.join( 9692 "; " 9693 )}; }`; 9694 } 9695 }); 9696 } 9697 } 9698 ); 9699 if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) { 9700 ruleset += `$ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: $gapValue}; }`; 9701 } 9702 } 9703 if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) { 9704 const validDisplayModes = ["block", "flex", "grid"]; 9705 Object.values(layoutDefinitions).forEach( 9706 ({ className, displayMode, baseStyles }) => { 9707 if (displayMode && validDisplayModes.includes(displayMode)) { 9708 ruleset += `$selector} .$className} { display:$displayMode}; }`; 9709 } 9710 if (baseStyles?.length) { 9711 baseStyles.forEach((baseStyle) => { 9712 const declarations = []; 9713 if (baseStyle.rules) { 9714 Object.entries(baseStyle.rules).forEach( 9715 ([cssProperty, cssValue]) => { 9716 declarations.push( 9717 `$cssProperty}: $cssValue}` 9718 ); 9719 } 9720 ); 9721 } 9722 if (declarations.length) { 9723 const combinedSelector = `.$className}$baseStyle?.selector || ""}`; 9724 ruleset += `$combinedSelector} { $declarations.join( 9725 "; " 9726 )}; }`; 9727 } 9728 }); 9729 } 9730 } 9731 ); 9732 } 9733 return ruleset; 9734 } 9735 9736 // packages/edit-post/build-module/components/layout/index.mjs 9737 var import_plugins = __toESM(require_plugins(), 1); 9738 var import_i18n15 = __toESM(require_i18n(), 1); 9739 var import_element29 = __toESM(require_element(), 1); 9740 var import_notices3 = __toESM(require_notices(), 1); 9741 var import_preferences10 = __toESM(require_preferences(), 1); 9742 var import_commands2 = __toESM(require_commands(), 1); 9743 var import_url6 = __toESM(require_url(), 1); 9744 var import_html_entities = __toESM(require_html_entities(), 1); 9745 var import_core_data9 = __toESM(require_core_data(), 1); 9746 var import_components8 = __toESM(require_components(), 1); 9747 var import_compose2 = __toESM(require_compose(), 1); 9748 var import_theme = __toESM(require_theme(), 1); 9749 9750 // packages/edit-post/build-module/components/back-button/index.mjs 9751 var import_editor2 = __toESM(require_editor(), 1); 9752 var import_components2 = __toESM(require_components(), 1); 9753 var import_preferences = __toESM(require_preferences(), 1); 9754 var import_data3 = __toESM(require_data(), 1); 9755 9756 // packages/edit-post/build-module/components/back-button/fullscreen-mode-close.mjs 9757 var import_data2 = __toESM(require_data(), 1); 9758 var import_components = __toESM(require_components(), 1); 9759 var import_i18n2 = __toESM(require_i18n(), 1); 9760 var import_url = __toESM(require_url(), 1); 9761 var import_editor = __toESM(require_editor(), 1); 9762 var import_core_data = __toESM(require_core_data(), 1); 9763 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); 9764 function FullscreenModeClose({ showTooltip, icon, href, initialPost }) { 9765 const postType = (0, import_data2.useSelect)( 9766 (select3) => { 9767 const { getCurrentPostType } = select3(import_editor.store); 9768 const { getPostType } = select3(import_core_data.store); 9769 return getPostType(initialPost?.type || getCurrentPostType()); 9770 }, 9771 [initialPost?.type] 9772 ); 9773 if (!postType) { 9774 return null; 9775 } 9776 const buttonHref = href ?? (0, import_url.addQueryArgs)("edit.php", { 9777 post_type: postType.slug 9778 }); 9779 const buttonLabel = postType?.labels?.view_items ?? (0, import_i18n2.__)("Back"); 9780 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 9781 import_components.Button, 9782 { 9783 size: "compact", 9784 href: buttonHref, 9785 label: buttonLabel, 9786 showTooltip, 9787 tooltipPosition: "bottom", 9788 icon: icon ?? ((0, import_i18n2.isRTL)() ? chevron_right_default : chevron_left_default) 9789 } 9790 ); 9791 } 9792 var fullscreen_mode_close_default = FullscreenModeClose; 9793 9794 // packages/edit-post/build-module/lock-unlock.mjs 9795 var import_private_apis2 = __toESM(require_private_apis(), 1); 9796 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 9797 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 9798 "@wordpress/edit-post" 9799 ); 9800 9801 // packages/edit-post/build-module/components/back-button/index.mjs 9802 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); 9803 var { BackButton: BackButtonFill } = unlock2(import_editor2.privateApis); 9804 var slideX = { 9805 hidden: { x: "-100%" }, 9806 distractionFreeInactive: { x: 0 }, 9807 hover: { x: 0, transition: { type: "tween", delay: 0.2 } } 9808 }; 9809 function BackButton({ initialPost }) { 9810 const showIconLabels = (0, import_data3.useSelect)((select3) => { 9811 return select3(import_preferences.store).get("core", "showIconLabels"); 9812 }, []); 9813 return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(BackButtonFill, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( 9814 import_components2.__unstableMotion.div, 9815 { 9816 variants: slideX, 9817 transition: { type: "tween", delay: 0.8 }, 9818 children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( 9819 fullscreen_mode_close_default, 9820 { 9821 showTooltip: !showIconLabels, 9822 initialPost 9823 } 9824 ) 9825 } 9826 ) }); 9827 } 9828 var back_button_default = BackButton; 9829 9830 // packages/edit-post/build-module/components/editor-initialization/listener-hooks.mjs 9831 var import_data4 = __toESM(require_data(), 1); 9832 var import_element18 = __toESM(require_element(), 1); 9833 var import_editor3 = __toESM(require_editor(), 1); 9834 var import_core_data2 = __toESM(require_core_data(), 1); 9835 9836 // packages/edit-post/build-module/store/constants.mjs 9837 var STORE_NAME = "core/edit-post"; 9838 var VIEW_AS_LINK_SELECTOR = "#wp-admin-bar-view a"; 9839 var VIEW_AS_PREVIEW_LINK_SELECTOR = "#wp-admin-bar-preview a"; 9840 9841 // packages/edit-post/build-module/components/editor-initialization/listener-hooks.mjs 9842 var useUpdatePostLinkListener = () => { 9843 const { isViewable, newPermalink } = (0, import_data4.useSelect)((select3) => { 9844 const { getPostType } = select3(import_core_data2.store); 9845 const { getCurrentPost, getEditedPostAttribute } = select3(import_editor3.store); 9846 const postType = getPostType(getEditedPostAttribute("type")); 9847 return { 9848 isViewable: postType?.viewable, 9849 newPermalink: getCurrentPost().link 9850 }; 9851 }, []); 9852 const nodeToUpdateRef = (0, import_element18.useRef)(); 9853 (0, import_element18.useEffect)(() => { 9854 nodeToUpdateRef.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR); 9855 }, []); 9856 (0, import_element18.useEffect)(() => { 9857 if (!newPermalink || !nodeToUpdateRef.current) { 9858 return; 9859 } 9860 if (!isViewable) { 9861 nodeToUpdateRef.current.style.display = "none"; 9862 return; 9863 } 9864 nodeToUpdateRef.current.style.display = ""; 9865 nodeToUpdateRef.current.setAttribute("href", newPermalink); 9866 }, [newPermalink, isViewable]); 9867 }; 9868 9869 // packages/edit-post/build-module/components/editor-initialization/index.mjs 9870 function EditorInitialization() { 9871 useUpdatePostLinkListener(); 9872 return null; 9873 } 9874 9875 // packages/edit-post/build-module/components/keyboard-shortcuts/index.mjs 9876 var import_element19 = __toESM(require_element(), 1); 9877 var import_data8 = __toESM(require_data(), 1); 9878 var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1); 9879 var import_i18n4 = __toESM(require_i18n(), 1); 9880 9881 // packages/edit-post/build-module/store/index.mjs 9882 var import_data7 = __toESM(require_data(), 1); 9883 9884 // packages/edit-post/build-module/store/reducer.mjs 9885 var import_data5 = __toESM(require_data(), 1); 9886 function isSavingMetaBoxes(state = false, action) { 9887 switch (action.type) { 9888 case "REQUEST_META_BOX_UPDATES": 9889 return true; 9890 case "META_BOX_UPDATES_SUCCESS": 9891 case "META_BOX_UPDATES_FAILURE": 9892 return false; 9893 default: 9894 return state; 9895 } 9896 } 9897 function mergeMetaboxes(metaboxes = [], newMetaboxes) { 9898 const mergedMetaboxes = [...metaboxes]; 9899 for (const metabox of newMetaboxes) { 9900 const existing = mergedMetaboxes.findIndex( 9901 (box) => box.id === metabox.id 9902 ); 9903 if (existing !== -1) { 9904 mergedMetaboxes[existing] = { 9905 ...mergedMetaboxes[existing], 9906 ...metabox 9907 }; 9908 } else { 9909 mergedMetaboxes.push(metabox); 9910 } 9911 } 9912 return mergedMetaboxes; 9913 } 9914 function metaBoxLocations(state = {}, action) { 9915 switch (action.type) { 9916 case "SET_META_BOXES_PER_LOCATIONS": { 9917 const newState = { ...state }; 9918 for (const [location, metaboxes] of Object.entries( 9919 action.metaBoxesPerLocation 9920 )) { 9921 newState[location] = mergeMetaboxes( 9922 newState[location], 9923 metaboxes 9924 ); 9925 } 9926 return newState; 9927 } 9928 } 9929 return state; 9930 } 9931 function metaBoxesInitialized(state = false, action) { 9932 switch (action.type) { 9933 case "META_BOXES_INITIALIZED": 9934 return true; 9935 } 9936 return state; 9937 } 9938 var metaBoxes = (0, import_data5.combineReducers)({ 9939 isSaving: isSavingMetaBoxes, 9940 locations: metaBoxLocations, 9941 initialized: metaBoxesInitialized 9942 }); 9943 var reducer_default = (0, import_data5.combineReducers)({ 9944 metaBoxes 9945 }); 9946 9947 // packages/edit-post/build-module/store/actions.mjs 9948 var actions_exports = {}; 9949 __export(actions_exports, { 9950 __experimentalSetPreviewDeviceType: () => __experimentalSetPreviewDeviceType, 9951 __unstableCreateTemplate: () => __unstableCreateTemplate, 9952 closeGeneralSidebar: () => closeGeneralSidebar, 9953 closeModal: () => closeModal, 9954 closePublishSidebar: () => closePublishSidebar, 9955 hideBlockTypes: () => hideBlockTypes, 9956 initializeMetaBoxes: () => initializeMetaBoxes, 9957 metaBoxUpdatesFailure: () => metaBoxUpdatesFailure, 9958 metaBoxUpdatesSuccess: () => metaBoxUpdatesSuccess, 9959 openGeneralSidebar: () => openGeneralSidebar, 9960 openModal: () => openModal, 9961 openPublishSidebar: () => openPublishSidebar, 9962 removeEditorPanel: () => removeEditorPanel, 9963 requestMetaBoxUpdates: () => requestMetaBoxUpdates, 9964 setAvailableMetaBoxesPerLocation: () => setAvailableMetaBoxesPerLocation, 9965 setIsEditingTemplate: () => setIsEditingTemplate, 9966 setIsInserterOpened: () => setIsInserterOpened, 9967 setIsListViewOpened: () => setIsListViewOpened, 9968 showBlockTypes: () => showBlockTypes, 9969 switchEditorMode: () => switchEditorMode, 9970 toggleDistractionFree: () => toggleDistractionFree, 9971 toggleEditorPanelEnabled: () => toggleEditorPanelEnabled, 9972 toggleEditorPanelOpened: () => toggleEditorPanelOpened, 9973 toggleFeature: () => toggleFeature, 9974 toggleFullscreenMode: () => toggleFullscreenMode, 9975 togglePinnedPluginItem: () => togglePinnedPluginItem, 9976 togglePublishSidebar: () => togglePublishSidebar, 9977 updatePreferredStyleVariations: () => updatePreferredStyleVariations 9978 }); 9979 var import_api_fetch = __toESM(require_api_fetch(), 1); 9980 var import_preferences2 = __toESM(require_preferences(), 1); 9981 var import_editor4 = __toESM(require_editor(), 1); 9982 var import_deprecated = __toESM(require_deprecated(), 1); 9983 var import_hooks = __toESM(require_hooks(), 1); 9984 var import_core_data3 = __toESM(require_core_data(), 1); 9985 var import_notices = __toESM(require_notices(), 1); 9986 var import_i18n3 = __toESM(require_i18n(), 1); 9987 9988 // packages/edit-post/build-module/utils/meta-boxes.mjs 9989 var getMetaBoxContainer = (location) => { 9990 const area = document.querySelector( 9991 `.edit-post-meta-boxes-area.is-$location} .metabox-location-$location}` 9992 ); 9993 if (area) { 9994 return area; 9995 } 9996 return document.querySelector("#metaboxes .metabox-location-" + location); 9997 }; 9998 9999 // packages/edit-post/build-module/store/actions.mjs 10000 var { interfaceStore } = unlock2(import_editor4.privateApis); 10001 var openGeneralSidebar = (name) => ({ registry }) => { 10002 registry.dispatch(interfaceStore).enableComplementaryArea("core", name); 10003 }; 10004 var closeGeneralSidebar = () => ({ registry }) => registry.dispatch(interfaceStore).disableComplementaryArea("core"); 10005 var openModal = (name) => ({ registry }) => { 10006 (0, import_deprecated.default)("select( 'core/edit-post' ).openModal( name )", { 10007 since: "6.3", 10008 alternative: "select( 'core/interface').openModal( name )" 10009 }); 10010 return registry.dispatch(interfaceStore).openModal(name); 10011 }; 10012 var closeModal = () => ({ registry }) => { 10013 (0, import_deprecated.default)("select( 'core/edit-post' ).closeModal()", { 10014 since: "6.3", 10015 alternative: "select( 'core/interface').closeModal()" 10016 }); 10017 return registry.dispatch(interfaceStore).closeModal(); 10018 }; 10019 var openPublishSidebar = () => ({ registry }) => { 10020 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).openPublishSidebar", { 10021 since: "6.6", 10022 alternative: "dispatch( 'core/editor').openPublishSidebar" 10023 }); 10024 registry.dispatch(import_editor4.store).openPublishSidebar(); 10025 }; 10026 var closePublishSidebar = () => ({ registry }) => { 10027 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).closePublishSidebar", { 10028 since: "6.6", 10029 alternative: "dispatch( 'core/editor').closePublishSidebar" 10030 }); 10031 registry.dispatch(import_editor4.store).closePublishSidebar(); 10032 }; 10033 var togglePublishSidebar = () => ({ registry }) => { 10034 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).togglePublishSidebar", { 10035 since: "6.6", 10036 alternative: "dispatch( 'core/editor').togglePublishSidebar" 10037 }); 10038 registry.dispatch(import_editor4.store).togglePublishSidebar(); 10039 }; 10040 var toggleEditorPanelEnabled = (panelName) => ({ registry }) => { 10041 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).toggleEditorPanelEnabled", { 10042 since: "6.5", 10043 alternative: "dispatch( 'core/editor').toggleEditorPanelEnabled" 10044 }); 10045 registry.dispatch(import_editor4.store).toggleEditorPanelEnabled(panelName); 10046 }; 10047 var toggleEditorPanelOpened = (panelName) => ({ registry }) => { 10048 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).toggleEditorPanelOpened", { 10049 since: "6.5", 10050 alternative: "dispatch( 'core/editor').toggleEditorPanelOpened" 10051 }); 10052 registry.dispatch(import_editor4.store).toggleEditorPanelOpened(panelName); 10053 }; 10054 var removeEditorPanel = (panelName) => ({ registry }) => { 10055 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).removeEditorPanel", { 10056 since: "6.5", 10057 alternative: "dispatch( 'core/editor').removeEditorPanel" 10058 }); 10059 registry.dispatch(import_editor4.store).removeEditorPanel(panelName); 10060 }; 10061 var toggleFeature = (feature) => ({ registry }) => registry.dispatch(import_preferences2.store).toggle("core/edit-post", feature); 10062 var switchEditorMode = (mode) => ({ registry }) => { 10063 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).switchEditorMode", { 10064 since: "6.6", 10065 alternative: "dispatch( 'core/editor').switchEditorMode" 10066 }); 10067 registry.dispatch(import_editor4.store).switchEditorMode(mode); 10068 }; 10069 var togglePinnedPluginItem = (pluginName) => ({ registry }) => { 10070 const isPinned = registry.select(interfaceStore).isItemPinned("core", pluginName); 10071 registry.dispatch(interfaceStore)[isPinned ? "unpinItem" : "pinItem"]("core", pluginName); 10072 }; 10073 function updatePreferredStyleVariations() { 10074 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).updatePreferredStyleVariations", { 10075 since: "6.6", 10076 hint: "Preferred Style Variations are not supported anymore." 10077 }); 10078 return { type: "NOTHING" }; 10079 } 10080 var showBlockTypes = (blockNames) => ({ registry }) => { 10081 unlock2(registry.dispatch(import_editor4.store)).showBlockTypes(blockNames); 10082 }; 10083 var hideBlockTypes = (blockNames) => ({ registry }) => { 10084 unlock2(registry.dispatch(import_editor4.store)).hideBlockTypes(blockNames); 10085 }; 10086 function setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) { 10087 return { 10088 type: "SET_META_BOXES_PER_LOCATIONS", 10089 metaBoxesPerLocation 10090 }; 10091 } 10092 var requestMetaBoxUpdates = () => async ({ registry, select: select3, dispatch: dispatch2 }) => { 10093 dispatch2({ 10094 type: "REQUEST_META_BOX_UPDATES" 10095 }); 10096 if (window.tinyMCE) { 10097 window.tinyMCE.triggerSave(); 10098 } 10099 const baseFormData = new window.FormData( 10100 document.querySelector(".metabox-base-form") 10101 ); 10102 const postId = baseFormData.get("post_ID"); 10103 const postType = baseFormData.get("post_type"); 10104 const post = registry.select(import_core_data3.store).getEditedEntityRecord("postType", postType, postId); 10105 const additionalData = [ 10106 post.comment_status ? ["comment_status", post.comment_status] : false, 10107 post.ping_status ? ["ping_status", post.ping_status] : false, 10108 post.sticky ? ["sticky", post.sticky] : false, 10109 post.author ? ["post_author", post.author] : false 10110 ].filter(Boolean); 10111 const activeMetaBoxLocations = select3.getActiveMetaBoxLocations(); 10112 const formDataToMerge = [ 10113 baseFormData, 10114 ...activeMetaBoxLocations.map( 10115 (location) => new window.FormData(getMetaBoxContainer(location)) 10116 ) 10117 ]; 10118 const formData = formDataToMerge.reduce((memo, currentFormData) => { 10119 for (const [key, value] of currentFormData) { 10120 memo.append(key, value); 10121 } 10122 return memo; 10123 }, new window.FormData()); 10124 additionalData.forEach( 10125 ([key, value]) => formData.append(key, value) 10126 ); 10127 try { 10128 await (0, import_api_fetch.default)({ 10129 url: window._wpMetaBoxUrl, 10130 method: "POST", 10131 body: formData, 10132 parse: false 10133 }); 10134 dispatch2.metaBoxUpdatesSuccess(); 10135 } catch { 10136 dispatch2.metaBoxUpdatesFailure(); 10137 } 10138 }; 10139 function metaBoxUpdatesSuccess() { 10140 return { 10141 type: "META_BOX_UPDATES_SUCCESS" 10142 }; 10143 } 10144 function metaBoxUpdatesFailure() { 10145 return { 10146 type: "META_BOX_UPDATES_FAILURE" 10147 }; 10148 } 10149 var __experimentalSetPreviewDeviceType = (deviceType) => ({ registry }) => { 10150 (0, import_deprecated.default)( 10151 "dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType", 10152 { 10153 since: "6.5", 10154 version: "6.7", 10155 hint: "registry.dispatch( editorStore ).setDeviceType" 10156 } 10157 ); 10158 registry.dispatch(import_editor4.store).setDeviceType(deviceType); 10159 }; 10160 var setIsInserterOpened = (value) => ({ registry }) => { 10161 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).setIsInserterOpened", { 10162 since: "6.5", 10163 alternative: "dispatch( 'core/editor').setIsInserterOpened" 10164 }); 10165 registry.dispatch(import_editor4.store).setIsInserterOpened(value); 10166 }; 10167 var setIsListViewOpened = (isOpen) => ({ registry }) => { 10168 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).setIsListViewOpened", { 10169 since: "6.5", 10170 alternative: "dispatch( 'core/editor').setIsListViewOpened" 10171 }); 10172 registry.dispatch(import_editor4.store).setIsListViewOpened(isOpen); 10173 }; 10174 function setIsEditingTemplate() { 10175 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).setIsEditingTemplate", { 10176 since: "6.5", 10177 alternative: "dispatch( 'core/editor').setRenderingMode" 10178 }); 10179 return { type: "NOTHING" }; 10180 } 10181 function __unstableCreateTemplate() { 10182 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).__unstableCreateTemplate", { 10183 since: "6.5" 10184 }); 10185 return { type: "NOTHING" }; 10186 } 10187 var metaBoxesInitialized2 = false; 10188 var initializeMetaBoxes = () => ({ registry, select: select3, dispatch: dispatch2 }) => { 10189 const isEditorReady = registry.select(import_editor4.store).__unstableIsEditorReady(); 10190 if (!isEditorReady) { 10191 return; 10192 } 10193 if (metaBoxesInitialized2) { 10194 return; 10195 } 10196 const postType = registry.select(import_editor4.store).getCurrentPostType(); 10197 if (window.postboxes.page !== postType) { 10198 window.postboxes.add_postbox_toggles(postType); 10199 } 10200 metaBoxesInitialized2 = true; 10201 (0, import_hooks.addAction)( 10202 "editor.savePost", 10203 "core/edit-post/save-metaboxes", 10204 async (post, options) => { 10205 if (!options.isAutosave && select3.hasMetaBoxes()) { 10206 await dispatch2.requestMetaBoxUpdates(); 10207 } 10208 } 10209 ); 10210 dispatch2({ 10211 type: "META_BOXES_INITIALIZED" 10212 }); 10213 }; 10214 var toggleDistractionFree = () => ({ registry }) => { 10215 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).toggleDistractionFree", { 10216 since: "6.6", 10217 alternative: "dispatch( 'core/editor').toggleDistractionFree" 10218 }); 10219 registry.dispatch(import_editor4.store).toggleDistractionFree(); 10220 }; 10221 var toggleFullscreenMode = () => ({ registry }) => { 10222 const isFullscreen = registry.select(import_preferences2.store).get("core/edit-post", "fullscreenMode"); 10223 registry.dispatch(import_preferences2.store).toggle("core/edit-post", "fullscreenMode"); 10224 registry.dispatch(import_notices.store).createInfoNotice( 10225 isFullscreen ? (0, import_i18n3.__)("Fullscreen mode deactivated.") : (0, import_i18n3.__)("Fullscreen mode activated."), 10226 { 10227 id: "core/edit-post/toggle-fullscreen-mode/notice", 10228 type: "snackbar", 10229 actions: [ 10230 { 10231 label: (0, import_i18n3.__)("Undo"), 10232 onClick: () => { 10233 registry.dispatch(import_preferences2.store).toggle( 10234 "core/edit-post", 10235 "fullscreenMode" 10236 ); 10237 } 10238 } 10239 ] 10240 } 10241 ); 10242 }; 10243 10244 // packages/edit-post/build-module/store/selectors.mjs 10245 var selectors_exports = {}; 10246 __export(selectors_exports, { 10247 __experimentalGetInsertionPoint: () => __experimentalGetInsertionPoint, 10248 __experimentalGetPreviewDeviceType: () => __experimentalGetPreviewDeviceType, 10249 areMetaBoxesInitialized: () => areMetaBoxesInitialized, 10250 getActiveGeneralSidebarName: () => getActiveGeneralSidebarName, 10251 getActiveMetaBoxLocations: () => getActiveMetaBoxLocations, 10252 getAllMetaBoxes: () => getAllMetaBoxes, 10253 getEditedPostTemplate: () => getEditedPostTemplate, 10254 getEditorMode: () => getEditorMode, 10255 getHiddenBlockTypes: () => getHiddenBlockTypes, 10256 getMetaBoxesPerLocation: () => getMetaBoxesPerLocation, 10257 getPreference: () => getPreference, 10258 getPreferences: () => getPreferences, 10259 hasMetaBoxes: () => hasMetaBoxes, 10260 isEditingTemplate: () => isEditingTemplate, 10261 isEditorPanelEnabled: () => isEditorPanelEnabled, 10262 isEditorPanelOpened: () => isEditorPanelOpened, 10263 isEditorPanelRemoved: () => isEditorPanelRemoved, 10264 isEditorSidebarOpened: () => isEditorSidebarOpened, 10265 isFeatureActive: () => isFeatureActive, 10266 isInserterOpened: () => isInserterOpened, 10267 isListViewOpened: () => isListViewOpened, 10268 isMetaBoxLocationActive: () => isMetaBoxLocationActive, 10269 isMetaBoxLocationVisible: () => isMetaBoxLocationVisible, 10270 isModalActive: () => isModalActive, 10271 isPluginItemPinned: () => isPluginItemPinned, 10272 isPluginSidebarOpened: () => isPluginSidebarOpened, 10273 isPublishSidebarOpened: () => isPublishSidebarOpened, 10274 isSavingMetaBoxes: () => isSavingMetaBoxes2 10275 }); 10276 var import_data6 = __toESM(require_data(), 1); 10277 var import_preferences3 = __toESM(require_preferences(), 1); 10278 var import_core_data4 = __toESM(require_core_data(), 1); 10279 var import_editor5 = __toESM(require_editor(), 1); 10280 var import_deprecated2 = __toESM(require_deprecated(), 1); 10281 var { interfaceStore: interfaceStore2 } = unlock2(import_editor5.privateApis); 10282 var EMPTY_ARRAY2 = []; 10283 var EMPTY_OBJECT2 = {}; 10284 var getEditorMode = (0, import_data6.createRegistrySelector)( 10285 (select3) => () => select3(import_preferences3.store).get("core", "editorMode") ?? "visual" 10286 ); 10287 var isEditorSidebarOpened = (0, import_data6.createRegistrySelector)( 10288 (select3) => () => { 10289 const activeGeneralSidebar = select3(interfaceStore2).getActiveComplementaryArea("core"); 10290 return ["edit-post/document", "edit-post/block"].includes( 10291 activeGeneralSidebar 10292 ); 10293 } 10294 ); 10295 var isPluginSidebarOpened = (0, import_data6.createRegistrySelector)( 10296 (select3) => () => { 10297 const activeGeneralSidebar = select3(interfaceStore2).getActiveComplementaryArea("core"); 10298 return !!activeGeneralSidebar && !["edit-post/document", "edit-post/block"].includes( 10299 activeGeneralSidebar 10300 ); 10301 } 10302 ); 10303 var getActiveGeneralSidebarName = (0, import_data6.createRegistrySelector)( 10304 (select3) => () => { 10305 return select3(interfaceStore2).getActiveComplementaryArea("core"); 10306 } 10307 ); 10308 function convertPanelsToOldFormat(inactivePanels, openPanels) { 10309 const panelsWithEnabledState = inactivePanels?.reduce( 10310 (accumulatedPanels, panelName) => ({ 10311 ...accumulatedPanels, 10312 [panelName]: { 10313 enabled: false 10314 } 10315 }), 10316 {} 10317 ); 10318 const panels = openPanels?.reduce((accumulatedPanels, panelName) => { 10319 const currentPanelState = accumulatedPanels?.[panelName]; 10320 return { 10321 ...accumulatedPanels, 10322 [panelName]: { 10323 ...currentPanelState, 10324 opened: true 10325 } 10326 }; 10327 }, panelsWithEnabledState ?? {}); 10328 return panels ?? panelsWithEnabledState ?? EMPTY_OBJECT2; 10329 } 10330 var getPreferences = (0, import_data6.createRegistrySelector)((select3) => () => { 10331 (0, import_deprecated2.default)(`select( 'core/edit-post' ).getPreferences`, { 10332 since: "6.0", 10333 alternative: `select( 'core/preferences' ).get` 10334 }); 10335 const corePreferences = ["editorMode", "hiddenBlockTypes"].reduce( 10336 (accumulatedPrefs, preferenceKey) => { 10337 const value = select3(import_preferences3.store).get( 10338 "core", 10339 preferenceKey 10340 ); 10341 return { 10342 ...accumulatedPrefs, 10343 [preferenceKey]: value 10344 }; 10345 }, 10346 {} 10347 ); 10348 const inactivePanels = select3(import_preferences3.store).get( 10349 "core", 10350 "inactivePanels" 10351 ); 10352 const openPanels = select3(import_preferences3.store).get("core", "openPanels"); 10353 const panels = convertPanelsToOldFormat(inactivePanels, openPanels); 10354 return { 10355 ...corePreferences, 10356 panels 10357 }; 10358 }); 10359 function getPreference(state, preferenceKey, defaultValue) { 10360 (0, import_deprecated2.default)(`select( 'core/edit-post' ).getPreference`, { 10361 since: "6.0", 10362 alternative: `select( 'core/preferences' ).get` 10363 }); 10364 const preferences = getPreferences(state); 10365 const value = preferences[preferenceKey]; 10366 return value === void 0 ? defaultValue : value; 10367 } 10368 var getHiddenBlockTypes = (0, import_data6.createRegistrySelector)((select3) => () => { 10369 return select3(import_preferences3.store).get("core", "hiddenBlockTypes") ?? EMPTY_ARRAY2; 10370 }); 10371 var isPublishSidebarOpened = (0, import_data6.createRegistrySelector)( 10372 (select3) => () => { 10373 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isPublishSidebarOpened`, { 10374 since: "6.6", 10375 alternative: `select( 'core/editor' ).isPublishSidebarOpened` 10376 }); 10377 return select3(import_editor5.store).isPublishSidebarOpened(); 10378 } 10379 ); 10380 var isEditorPanelRemoved = (0, import_data6.createRegistrySelector)( 10381 (select3) => (state, panelName) => { 10382 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditorPanelRemoved`, { 10383 since: "6.5", 10384 alternative: `select( 'core/editor' ).isEditorPanelRemoved` 10385 }); 10386 return select3(import_editor5.store).isEditorPanelRemoved(panelName); 10387 } 10388 ); 10389 var isEditorPanelEnabled = (0, import_data6.createRegistrySelector)( 10390 (select3) => (state, panelName) => { 10391 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditorPanelEnabled`, { 10392 since: "6.5", 10393 alternative: `select( 'core/editor' ).isEditorPanelEnabled` 10394 }); 10395 return select3(import_editor5.store).isEditorPanelEnabled(panelName); 10396 } 10397 ); 10398 var isEditorPanelOpened = (0, import_data6.createRegistrySelector)( 10399 (select3) => (state, panelName) => { 10400 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditorPanelOpened`, { 10401 since: "6.5", 10402 alternative: `select( 'core/editor' ).isEditorPanelOpened` 10403 }); 10404 return select3(import_editor5.store).isEditorPanelOpened(panelName); 10405 } 10406 ); 10407 var isModalActive = (0, import_data6.createRegistrySelector)( 10408 (select3) => (state, modalName) => { 10409 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isModalActive`, { 10410 since: "6.3", 10411 alternative: `select( 'core/interface' ).isModalActive` 10412 }); 10413 return !!select3(interfaceStore2).isModalActive(modalName); 10414 } 10415 ); 10416 var isFeatureActive = (0, import_data6.createRegistrySelector)( 10417 (select3) => (state, feature) => { 10418 return !!select3(import_preferences3.store).get("core/edit-post", feature); 10419 } 10420 ); 10421 var isPluginItemPinned = (0, import_data6.createRegistrySelector)( 10422 (select3) => (state, pluginName) => { 10423 return select3(interfaceStore2).isItemPinned("core", pluginName); 10424 } 10425 ); 10426 var getActiveMetaBoxLocations = (0, import_data6.createSelector)( 10427 (state) => { 10428 return Object.keys(state.metaBoxes.locations).filter( 10429 (location) => isMetaBoxLocationActive(state, location) 10430 ); 10431 }, 10432 (state) => [state.metaBoxes.locations] 10433 ); 10434 var isMetaBoxLocationVisible = (0, import_data6.createRegistrySelector)( 10435 (select3) => (state, location) => { 10436 return isMetaBoxLocationActive(state, location) && getMetaBoxesPerLocation(state, location)?.some(({ id }) => { 10437 return select3(import_editor5.store).isEditorPanelEnabled( 10438 `meta-box-$id}` 10439 ); 10440 }); 10441 } 10442 ); 10443 function isMetaBoxLocationActive(state, location) { 10444 const metaBoxes2 = getMetaBoxesPerLocation(state, location); 10445 return !!metaBoxes2 && metaBoxes2.length !== 0; 10446 } 10447 function getMetaBoxesPerLocation(state, location) { 10448 return state.metaBoxes.locations[location]; 10449 } 10450 var getAllMetaBoxes = (0, import_data6.createSelector)( 10451 (state) => { 10452 return Object.values(state.metaBoxes.locations).flat(); 10453 }, 10454 (state) => [state.metaBoxes.locations] 10455 ); 10456 function hasMetaBoxes(state) { 10457 return getActiveMetaBoxLocations(state).length > 0; 10458 } 10459 function isSavingMetaBoxes2(state) { 10460 return state.metaBoxes.isSaving; 10461 } 10462 var __experimentalGetPreviewDeviceType = (0, import_data6.createRegistrySelector)( 10463 (select3) => () => { 10464 (0, import_deprecated2.default)( 10465 `select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, 10466 { 10467 since: "6.5", 10468 version: "6.7", 10469 alternative: `select( 'core/editor' ).getDeviceType` 10470 } 10471 ); 10472 return select3(import_editor5.store).getDeviceType(); 10473 } 10474 ); 10475 var isInserterOpened = (0, import_data6.createRegistrySelector)((select3) => () => { 10476 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isInserterOpened`, { 10477 since: "6.5", 10478 alternative: `select( 'core/editor' ).isInserterOpened` 10479 }); 10480 return select3(import_editor5.store).isInserterOpened(); 10481 }); 10482 var __experimentalGetInsertionPoint = (0, import_data6.createRegistrySelector)( 10483 (select3) => () => { 10484 (0, import_deprecated2.default)( 10485 `select( 'core/edit-post' ).__experimentalGetInsertionPoint`, 10486 { 10487 since: "6.5", 10488 version: "6.7" 10489 } 10490 ); 10491 return unlock2(select3(import_editor5.store)).getInserter(); 10492 } 10493 ); 10494 var isListViewOpened = (0, import_data6.createRegistrySelector)((select3) => () => { 10495 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isListViewOpened`, { 10496 since: "6.5", 10497 alternative: `select( 'core/editor' ).isListViewOpened` 10498 }); 10499 return select3(import_editor5.store).isListViewOpened(); 10500 }); 10501 var isEditingTemplate = (0, import_data6.createRegistrySelector)((select3) => () => { 10502 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditingTemplate`, { 10503 since: "6.5", 10504 alternative: `select( 'core/editor' ).getRenderingMode` 10505 }); 10506 return select3(import_editor5.store).getCurrentPostType() === "wp_template"; 10507 }); 10508 function areMetaBoxesInitialized(state) { 10509 return state.metaBoxes.initialized; 10510 } 10511 var getEditedPostTemplate = (0, import_data6.createRegistrySelector)( 10512 (select3) => () => { 10513 const { id: postId, type: postType } = select3(import_editor5.store).getCurrentPost(); 10514 const templateId = unlock2(select3(import_core_data4.store)).getTemplateId( 10515 postType, 10516 postId 10517 ); 10518 if (!templateId) { 10519 return void 0; 10520 } 10521 return select3(import_core_data4.store).getEditedEntityRecord( 10522 "postType", 10523 "wp_template", 10524 templateId 10525 ); 10526 } 10527 ); 10528 10529 // packages/edit-post/build-module/store/index.mjs 10530 var store = (0, import_data7.createReduxStore)(STORE_NAME, { 10531 reducer: reducer_default, 10532 actions: actions_exports, 10533 selectors: selectors_exports 10534 }); 10535 (0, import_data7.register)(store); 10536 10537 // packages/edit-post/build-module/components/keyboard-shortcuts/index.mjs 10538 function KeyboardShortcuts() { 10539 const { toggleFullscreenMode: toggleFullscreenMode2 } = (0, import_data8.useDispatch)(store); 10540 const { registerShortcut } = (0, import_data8.useDispatch)(import_keyboard_shortcuts.store); 10541 (0, import_element19.useEffect)(() => { 10542 registerShortcut({ 10543 name: "core/edit-post/toggle-fullscreen", 10544 category: "global", 10545 description: (0, import_i18n4.__)("Enable or disable fullscreen mode."), 10546 keyCombination: { 10547 modifier: "secondary", 10548 character: "f" 10549 } 10550 }); 10551 }, []); 10552 (0, import_keyboard_shortcuts.useShortcut)("core/edit-post/toggle-fullscreen", () => { 10553 toggleFullscreenMode2(); 10554 }); 10555 return null; 10556 } 10557 var keyboard_shortcuts_default = KeyboardShortcuts; 10558 10559 // packages/edit-post/build-module/components/init-pattern-modal/index.mjs 10560 var import_data9 = __toESM(require_data(), 1); 10561 var import_i18n5 = __toESM(require_i18n(), 1); 10562 var import_components3 = __toESM(require_components(), 1); 10563 var import_element20 = __toESM(require_element(), 1); 10564 var import_editor6 = __toESM(require_editor(), 1); 10565 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); 10566 function InitPatternModal() { 10567 const { editPost } = (0, import_data9.useDispatch)(import_editor6.store); 10568 const { isCleanNewPost } = (0, import_data9.useSelect)(import_editor6.store); 10569 const [syncType, setSyncType] = (0, import_element20.useState)(void 0); 10570 const [title, setTitle] = (0, import_element20.useState)(""); 10571 const [isModalOpen, setIsModalOpen] = (0, import_element20.useState)(() => isCleanNewPost()); 10572 if (!isModalOpen) { 10573 return null; 10574 } 10575 return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)( 10576 import_components3.Modal, 10577 { 10578 title: (0, import_i18n5.__)("Create pattern"), 10579 onRequestClose: () => { 10580 setIsModalOpen(false); 10581 }, 10582 overlayClassName: "patterns-create-modal", 10583 children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)( 10584 "form", 10585 { 10586 onSubmit: (event) => { 10587 event.preventDefault(); 10588 setIsModalOpen(false); 10589 editPost({ 10590 title, 10591 meta: { 10592 wp_pattern_sync_status: syncType 10593 } 10594 }); 10595 }, 10596 children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 10597 /* @__PURE__ */ (0, import_jsx_runtime27.jsx)( 10598 import_components3.TextControl, 10599 { 10600 label: (0, import_i18n5.__)("Name"), 10601 value: title, 10602 onChange: setTitle, 10603 placeholder: (0, import_i18n5.__)("My pattern"), 10604 className: "patterns-create-modal__name-input" 10605 } 10606 ), 10607 /* @__PURE__ */ (0, import_jsx_runtime27.jsx)( 10608 import_components3.ToggleControl, 10609 { 10610 label: (0, import_i18n5._x)("Synced", "pattern (singular)"), 10611 help: (0, import_i18n5.__)( 10612 "Sync this pattern across multiple locations." 10613 ), 10614 checked: !syncType, 10615 onChange: () => { 10616 setSyncType(!syncType ? "unsynced" : void 0); 10617 } 10618 } 10619 ), 10620 /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Stack, { justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)( 10621 import_components3.Button, 10622 { 10623 __next40pxDefaultSize: true, 10624 variant: "primary", 10625 type: "submit", 10626 disabled: !title, 10627 accessibleWhenDisabled: true, 10628 children: (0, import_i18n5.__)("Create") 10629 } 10630 ) }) 10631 ] }) 10632 } 10633 ) 10634 } 10635 ); 10636 } 10637 10638 // packages/edit-post/build-module/components/browser-url/index.mjs 10639 var import_element22 = __toESM(require_element(), 1); 10640 var import_data11 = __toESM(require_data(), 1); 10641 var import_url3 = __toESM(require_url(), 1); 10642 var import_editor8 = __toESM(require_editor(), 1); 10643 10644 // packages/edit-post/build-module/components/browser-url/use-classic-revision-redirect.mjs 10645 var import_data10 = __toESM(require_data(), 1); 10646 var import_core_data5 = __toESM(require_core_data(), 1); 10647 var import_editor7 = __toESM(require_editor(), 1); 10648 var import_element21 = __toESM(require_element(), 1); 10649 var import_url2 = __toESM(require_url(), 1); 10650 function useClassicRevisionRedirect() { 10651 const registry = (0, import_data10.useRegistry)(); 10652 const { disableVisualRevisions, currentRevisionId, postType, postId } = (0, import_data10.useSelect)((select3) => { 10653 const editor = select3(import_editor7.store); 10654 return { 10655 disableVisualRevisions: !!editor.getEditorSettings().disableVisualRevisions, 10656 currentRevisionId: unlock2(editor).getCurrentRevisionId(), 10657 postType: editor.getCurrentPostType(), 10658 postId: editor.getCurrentPostId() 10659 }; 10660 }, []); 10661 const hasClassicRevisionScreen = ![ 10662 "wp_template", 10663 "wp_template_part" 10664 ].includes(postType); 10665 (0, import_element21.useEffect)(() => { 10666 if (!disableVisualRevisions || !hasClassicRevisionScreen || !currentRevisionId || !postType || !postId) { 10667 return; 10668 } 10669 let cancelled = false; 10670 registry.resolveSelect(import_core_data5.store).getRevision("postType", postType, postId, currentRevisionId, { 10671 context: "edit", 10672 _fields: "id" 10673 }).then((revision) => { 10674 if (cancelled || !revision) { 10675 return; 10676 } 10677 const editor = registry.select(import_editor7.store); 10678 const isStillSelected = !!editor.getEditorSettings().disableVisualRevisions && editor.getCurrentPostType() === postType && String(editor.getCurrentPostId()) === String(postId) && unlock2(editor).getCurrentRevisionId() === currentRevisionId; 10679 if (!isStillSelected) { 10680 return; 10681 } 10682 window.location.replace( 10683 (0, import_url2.addQueryArgs)("revision.php", { 10684 revision: currentRevisionId 10685 }) 10686 ); 10687 }); 10688 return () => { 10689 cancelled = true; 10690 }; 10691 }, [ 10692 disableVisualRevisions, 10693 hasClassicRevisionScreen, 10694 currentRevisionId, 10695 postType, 10696 postId, 10697 registry 10698 ]); 10699 } 10700 10701 // packages/edit-post/build-module/components/browser-url/index.mjs 10702 var URL_WRITE_DEBOUNCE_MS = 300; 10703 function getPostEditURL(postId, revisionId) { 10704 const args = { post: postId, action: "edit" }; 10705 if (revisionId) { 10706 args.revision = revisionId; 10707 } 10708 return (0, import_url3.addQueryArgs)("post.php", args); 10709 } 10710 function BrowserURL() { 10711 useClassicRevisionRedirect(); 10712 const [initialRevisionId] = (0, import_element22.useState)(() => { 10713 const revision = Number( 10714 (0, import_url3.getQueryArg)(window.location.href, "revision") 10715 ); 10716 return Number.isInteger(revision) && revision > 0 ? revision : null; 10717 }); 10718 const hasHandledInitialRevisionRef = (0, import_element22.useRef)(false); 10719 const { postId, postStatus, currentRevisionId } = (0, import_data11.useSelect)((select3) => { 10720 const { getCurrentPost } = select3(import_editor8.store); 10721 const { getCurrentRevisionId } = unlock2(select3(import_editor8.store)); 10722 const post = getCurrentPost(); 10723 let { id, status, type } = post; 10724 const isTemplate = ["wp_template", "wp_template_part"].includes( 10725 type 10726 ); 10727 if (isTemplate) { 10728 id = post.wp_id; 10729 } 10730 return { 10731 postId: id, 10732 postStatus: status, 10733 // `post.php` rejects templates because `show_ui` is false. Adding 10734 // their revision ID to this URL would create a dead link. 10735 currentRevisionId: isTemplate ? null : getCurrentRevisionId() 10736 }; 10737 }, []); 10738 const { openRevision } = unlock2((0, import_data11.useDispatch)(import_editor8.store)); 10739 const lastURLWriteTimeRef = (0, import_element22.useRef)(null); 10740 const lastPostIdRef = (0, import_element22.useRef)(null); 10741 (0, import_element22.useEffect)(() => { 10742 if (!postId) { 10743 return; 10744 } 10745 if (initialRevisionId && !hasHandledInitialRevisionRef.current) { 10746 hasHandledInitialRevisionRef.current = true; 10747 openRevision(initialRevisionId); 10748 return; 10749 } 10750 if (postStatus === "auto-draft") { 10751 return; 10752 } 10753 const previousPostId = lastPostIdRef.current; 10754 lastPostIdRef.current = postId; 10755 const url = getPostEditURL(postId, currentRevisionId); 10756 const write = () => { 10757 lastURLWriteTimeRef.current = Date.now(); 10758 try { 10759 window.history.replaceState( 10760 { id: postId }, 10761 "Post " + postId, 10762 url 10763 ); 10764 } catch { 10765 } 10766 }; 10767 if (previousPostId !== null && previousPostId !== postId) { 10768 write(); 10769 return; 10770 } 10771 if (lastURLWriteTimeRef.current === null) { 10772 write(); 10773 return; 10774 } 10775 if (Date.now() - lastURLWriteTimeRef.current >= URL_WRITE_DEBOUNCE_MS) { 10776 write(); 10777 return; 10778 } 10779 const timeoutId = setTimeout(write, URL_WRITE_DEBOUNCE_MS); 10780 return () => clearTimeout(timeoutId); 10781 }, [ 10782 postId, 10783 postStatus, 10784 currentRevisionId, 10785 initialRevisionId, 10786 openRevision 10787 ]); 10788 return null; 10789 } 10790 10791 // packages/edit-post/build-module/components/meta-boxes/index.mjs 10792 var import_data14 = __toESM(require_data(), 1); 10793 10794 // packages/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.mjs 10795 var import_element23 = __toESM(require_element(), 1); 10796 var import_components4 = __toESM(require_components(), 1); 10797 var import_data12 = __toESM(require_data(), 1); 10798 var import_block_editor = __toESM(require_block_editor(), 1); 10799 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); 10800 var { useNativeUndo } = unlock2(import_block_editor.privateApis); 10801 function move(parent, node) { 10802 if (parent.moveBefore && parent.isConnected && node.isConnected) { 10803 parent.moveBefore(node, null); 10804 } else { 10805 parent.appendChild(node); 10806 } 10807 } 10808 function MetaBoxesArea({ location }) { 10809 const container = (0, import_element23.useRef)(null); 10810 const formRef = (0, import_element23.useRef)(null); 10811 (0, import_element23.useLayoutEffect)(() => { 10812 formRef.current = document.querySelector( 10813 ".metabox-location-" + location 10814 ); 10815 if (formRef.current) { 10816 move(container.current, formRef.current); 10817 } 10818 return () => { 10819 if (formRef.current) { 10820 move(document.querySelector("#metaboxes"), formRef.current); 10821 } 10822 }; 10823 }, [location]); 10824 const isSaving = (0, import_data12.useSelect)((select3) => { 10825 return select3(store).isSavingMetaBoxes(); 10826 }, []); 10827 const classes = clsx_default("edit-post-meta-boxes-area", `is-$location}`, { 10828 "is-loading": isSaving 10829 }); 10830 const nativeUndoRef = useNativeUndo(); 10831 return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: classes, ref: nativeUndoRef, children: [ 10832 isSaving && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components4.Spinner, { className: "edit-post-meta-boxes-area__spinner" }), 10833 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 10834 "div", 10835 { 10836 className: "edit-post-meta-boxes-area__container", 10837 ref: container 10838 } 10839 ), 10840 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "edit-post-meta-boxes-area__clear" }) 10841 ] }); 10842 } 10843 var meta_boxes_area_default = MetaBoxesArea; 10844 10845 // packages/edit-post/build-module/components/meta-boxes/meta-box-visibility.mjs 10846 var import_element24 = __toESM(require_element(), 1); 10847 var import_data13 = __toESM(require_data(), 1); 10848 var import_editor9 = __toESM(require_editor(), 1); 10849 function MetaBoxVisibility({ id }) { 10850 const isVisible = (0, import_data13.useSelect)( 10851 (select3) => { 10852 return select3(import_editor9.store).isEditorPanelEnabled( 10853 `meta-box-$id}` 10854 ); 10855 }, 10856 [id] 10857 ); 10858 (0, import_element24.useEffect)(() => { 10859 const element = document.getElementById(id); 10860 if (!element) { 10861 return; 10862 } 10863 if (isVisible) { 10864 element.classList.remove("is-hidden"); 10865 } else { 10866 element.classList.add("is-hidden"); 10867 } 10868 }, [id, isVisible]); 10869 return null; 10870 } 10871 10872 // packages/edit-post/build-module/components/meta-boxes/index.mjs 10873 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); 10874 function MetaBoxes({ location }) { 10875 const metaBoxes2 = (0, import_data14.useSelect)( 10876 (select3) => select3(store).getMetaBoxesPerLocation(location), 10877 [location] 10878 ); 10879 return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [ 10880 (metaBoxes2 ?? []).map(({ id }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(MetaBoxVisibility, { id }, id)), 10881 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(meta_boxes_area_default, { location }) 10882 ] }); 10883 } 10884 10885 // packages/edit-post/build-module/components/more-menu/index.mjs 10886 var import_i18n11 = __toESM(require_i18n(), 1); 10887 var import_compose = __toESM(require_compose(), 1); 10888 var import_editor16 = __toESM(require_editor(), 1); 10889 var import_keycodes = __toESM(require_keycodes(), 1); 10890 10891 // packages/edit-post/build-module/components/more-menu/manage-patterns-menu-item.mjs 10892 var import_core_data6 = __toESM(require_core_data(), 1); 10893 var import_data15 = __toESM(require_data(), 1); 10894 var import_editor10 = __toESM(require_editor(), 1); 10895 var import_i18n6 = __toESM(require_i18n(), 1); 10896 var import_url4 = __toESM(require_url(), 1); 10897 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); 10898 var { MoreMenuItem } = unlock2(import_editor10.privateApis); 10899 function ManagePatternsMenuItem() { 10900 const url = (0, import_data15.useSelect)((select3) => { 10901 const { canUser } = select3(import_core_data6.store); 10902 const defaultUrl = (0, import_url4.addQueryArgs)("edit.php", { 10903 post_type: "wp_block" 10904 }); 10905 const patternsUrl = (0, import_url4.addQueryArgs)("site-editor.php", { 10906 p: "/pattern" 10907 }); 10908 return canUser("create", { 10909 kind: "postType", 10910 name: "wp_template" 10911 }) ? patternsUrl : defaultUrl; 10912 }, []); 10913 return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MoreMenuItem, { href: url, children: (0, import_i18n6.__)("Manage patterns") }); 10914 } 10915 var manage_patterns_menu_item_default = ManagePatternsMenuItem; 10916 10917 // packages/edit-post/build-module/components/more-menu/welcome-guide-menu-item.mjs 10918 var import_i18n7 = __toESM(require_i18n(), 1); 10919 var import_data16 = __toESM(require_data(), 1); 10920 var import_editor11 = __toESM(require_editor(), 1); 10921 var import_preferences4 = __toESM(require_preferences(), 1); 10922 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); 10923 var { MoreMenuItem: MoreMenuItem2 } = unlock2(import_editor11.privateApis); 10924 function WelcomeGuideMenuItem() { 10925 const isEditingTemplate2 = (0, import_data16.useSelect)( 10926 (select3) => select3(import_editor11.store).getCurrentPostType() === "wp_template", 10927 [] 10928 ); 10929 const { toggle } = (0, import_data16.useDispatch)(import_preferences4.store); 10930 return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 10931 MoreMenuItem2, 10932 { 10933 onClick: () => toggle( 10934 "core/edit-post", 10935 isEditingTemplate2 ? "welcomeGuideTemplate" : "welcomeGuide" 10936 ), 10937 "aria-haspopup": "dialog", 10938 children: (0, import_i18n7.__)("Welcome Guide") 10939 } 10940 ); 10941 } 10942 10943 // packages/edit-post/build-module/components/preferences-modal/index.mjs 10944 var import_i18n10 = __toESM(require_i18n(), 1); 10945 var import_preferences8 = __toESM(require_preferences(), 1); 10946 var import_editor15 = __toESM(require_editor(), 1); 10947 10948 // packages/edit-post/build-module/components/preferences-modal/meta-boxes-section.mjs 10949 var import_i18n9 = __toESM(require_i18n(), 1); 10950 var import_data19 = __toESM(require_data(), 1); 10951 var import_editor14 = __toESM(require_editor(), 1); 10952 var import_preferences7 = __toESM(require_preferences(), 1); 10953 10954 // packages/edit-post/build-module/components/preferences-modal/enable-custom-fields.mjs 10955 var import_element25 = __toESM(require_element(), 1); 10956 var import_i18n8 = __toESM(require_i18n(), 1); 10957 var import_components5 = __toESM(require_components(), 1); 10958 var import_data17 = __toESM(require_data(), 1); 10959 var import_editor12 = __toESM(require_editor(), 1); 10960 var import_preferences5 = __toESM(require_preferences(), 1); 10961 var import_url5 = __toESM(require_url(), 1); 10962 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); 10963 var { PreferenceBaseOption } = unlock2(import_preferences5.privateApis); 10964 function submitCustomFieldsForm() { 10965 const customFieldsForm = document.getElementById( 10966 "toggle-custom-fields-form" 10967 ); 10968 customFieldsForm.querySelector('[name="_wp_http_referer"]').setAttribute("value", (0, import_url5.getPathAndQueryString)(window.location.href)); 10969 customFieldsForm.submit(); 10970 } 10971 function CustomFieldsConfirmation({ willEnable }) { 10972 const [isReloading, setIsReloading] = (0, import_element25.useState)(false); 10973 return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [ 10974 /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "edit-post-preferences-modal__custom-fields-confirmation-message", children: (0, import_i18n8.__)( 10975 "A page reload is required for this change. Make sure your content is saved before reloading." 10976 ) }), 10977 /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 10978 import_components5.Button, 10979 { 10980 __next40pxDefaultSize: true, 10981 variant: "secondary", 10982 isBusy: isReloading, 10983 accessibleWhenDisabled: true, 10984 disabled: isReloading, 10985 onClick: () => { 10986 setIsReloading(true); 10987 submitCustomFieldsForm(); 10988 }, 10989 children: willEnable ? (0, import_i18n8.__)("Show & Reload Page") : (0, import_i18n8.__)("Hide & Reload Page") 10990 } 10991 ) 10992 ] }); 10993 } 10994 function EnableCustomFieldsOption({ label }) { 10995 const areCustomFieldsEnabled = (0, import_data17.useSelect)((select3) => { 10996 return !!select3(import_editor12.store).getEditorSettings().enableCustomFields; 10997 }, []); 10998 const [isChecked, setIsChecked] = (0, import_element25.useState)(areCustomFieldsEnabled); 10999 return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 11000 PreferenceBaseOption, 11001 { 11002 label, 11003 isChecked, 11004 onChange: setIsChecked, 11005 children: isChecked !== areCustomFieldsEnabled && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CustomFieldsConfirmation, { willEnable: isChecked }) 11006 } 11007 ); 11008 } 11009 11010 // packages/edit-post/build-module/components/preferences-modal/enable-panel.mjs 11011 var import_data18 = __toESM(require_data(), 1); 11012 var import_editor13 = __toESM(require_editor(), 1); 11013 var import_preferences6 = __toESM(require_preferences(), 1); 11014 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); 11015 var { PreferenceBaseOption: PreferenceBaseOption2 } = unlock2(import_preferences6.privateApis); 11016 function EnablePanelOption(props) { 11017 const { toggleEditorPanelEnabled: toggleEditorPanelEnabled2 } = (0, import_data18.useDispatch)(import_editor13.store); 11018 const { isChecked, isRemoved } = (0, import_data18.useSelect)( 11019 (select3) => { 11020 const { isEditorPanelEnabled: isEditorPanelEnabled2, isEditorPanelRemoved: isEditorPanelRemoved2 } = select3(import_editor13.store); 11021 return { 11022 isChecked: isEditorPanelEnabled2(props.panelName), 11023 isRemoved: isEditorPanelRemoved2(props.panelName) 11024 }; 11025 }, 11026 [props.panelName] 11027 ); 11028 if (isRemoved) { 11029 return null; 11030 } 11031 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( 11032 PreferenceBaseOption2, 11033 { 11034 isChecked, 11035 onChange: () => toggleEditorPanelEnabled2(props.panelName), 11036 ...props 11037 } 11038 ); 11039 } 11040 11041 // packages/edit-post/build-module/components/preferences-modal/meta-boxes-section.mjs 11042 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); 11043 var { PreferencesModalSection } = unlock2(import_preferences7.privateApis); 11044 function MetaBoxesSection(sectionProps) { 11045 const { areCustomFieldsRegistered, metaBoxes: metaBoxes2 } = (0, import_data19.useSelect)((select3) => { 11046 const { getEditorSettings } = select3(import_editor14.store); 11047 const { getAllMetaBoxes: getAllMetaBoxes2 } = select3(store); 11048 return { 11049 areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== void 0, 11050 metaBoxes: getAllMetaBoxes2() 11051 }; 11052 }, []); 11053 const thirdPartyMetaBoxes = metaBoxes2.filter( 11054 ({ id }) => id !== "postcustom" 11055 ); 11056 if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) { 11057 return null; 11058 } 11059 return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(PreferencesModalSection, { ...sectionProps, children: [ 11060 areCustomFieldsRegistered && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EnableCustomFieldsOption, { label: (0, import_i18n9.__)("Custom fields") }), 11061 thirdPartyMetaBoxes.map(({ id, title }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( 11062 EnablePanelOption, 11063 { 11064 label: title, 11065 panelName: `meta-box-$id}` 11066 }, 11067 id 11068 )) 11069 ] }); 11070 } 11071 11072 // packages/edit-post/build-module/components/preferences-modal/index.mjs 11073 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); 11074 var { PreferenceToggleControl } = unlock2(import_preferences8.privateApis); 11075 var { PreferencesModal } = unlock2(import_editor15.privateApis); 11076 function EditPostPreferencesModal() { 11077 const extraSections = { 11078 general: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(MetaBoxesSection, { title: (0, import_i18n10.__)("Advanced") }), 11079 appearance: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 11080 PreferenceToggleControl, 11081 { 11082 scope: "core/edit-post", 11083 featureName: "themeStyles", 11084 help: (0, import_i18n10.__)("Make the editor look like your theme."), 11085 label: (0, import_i18n10.__)("Use theme styles") 11086 } 11087 ) 11088 }; 11089 return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PreferencesModal, { extraSections }); 11090 } 11091 11092 // packages/edit-post/build-module/components/more-menu/index.mjs 11093 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); 11094 var { MoreMenuPreferenceItem, ToolsMoreMenuGroup, ViewMoreMenuGroup } = unlock2(import_editor16.privateApis); 11095 var MoreMenu = () => { 11096 const isLargeViewport = (0, import_compose.useViewportMatch)("large"); 11097 return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [ 11098 isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ViewMoreMenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 11099 MoreMenuPreferenceItem, 11100 { 11101 scope: "core/edit-post", 11102 name: "fullscreenMode", 11103 label: (0, import_i18n11.__)("Fullscreen mode"), 11104 info: (0, import_i18n11.__)("Show and hide the admin user interface"), 11105 messageActivated: (0, import_i18n11.__)("Fullscreen mode activated."), 11106 messageDeactivated: (0, import_i18n11.__)( 11107 "Fullscreen mode deactivated." 11108 ), 11109 shortcut: import_keycodes.keyboardShortcut.secondary("f") 11110 } 11111 ) }), 11112 /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(ToolsMoreMenuGroup, { children: [ 11113 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(manage_patterns_menu_item_default, {}), 11114 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WelcomeGuideMenuItem, {}) 11115 ] }), 11116 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EditPostPreferencesModal, {}) 11117 ] }); 11118 }; 11119 var more_menu_default = MoreMenu; 11120 11121 // packages/edit-post/build-module/components/welcome-guide/index.mjs 11122 var import_data22 = __toESM(require_data(), 1); 11123 11124 // packages/edit-post/build-module/components/welcome-guide/default.mjs 11125 var import_data20 = __toESM(require_data(), 1); 11126 var import_components6 = __toESM(require_components(), 1); 11127 var import_i18n12 = __toESM(require_i18n(), 1); 11128 var import_element26 = __toESM(require_element(), 1); 11129 11130 // packages/edit-post/build-module/components/welcome-guide/image.mjs 11131 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); 11132 function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) { 11133 return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("picture", { className: "edit-post-welcome-guide__image", children: [ 11134 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 11135 "source", 11136 { 11137 srcSet: nonAnimatedSrc, 11138 media: "(prefers-reduced-motion: reduce)" 11139 } 11140 ), 11141 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" }) 11142 ] }); 11143 } 11144 11145 // packages/edit-post/build-module/components/welcome-guide/default.mjs 11146 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); 11147 function WelcomeGuideDefault() { 11148 const { toggleFeature: toggleFeature2 } = (0, import_data20.useDispatch)(store); 11149 return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 11150 import_components6.Guide, 11151 { 11152 className: "edit-post-welcome-guide", 11153 contentLabel: (0, import_i18n12.__)("Welcome to the editor"), 11154 finishButtonText: (0, import_i18n12.__)("Get started"), 11155 onFinish: () => toggleFeature2("welcomeGuide"), 11156 pages: [ 11157 { 11158 image: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 11159 WelcomeGuideImage, 11160 { 11161 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", 11162 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" 11163 } 11164 ), 11165 content: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [ 11166 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n12.__)("Welcome to the editor") }), 11167 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n12.__)( 11168 "In the WordPress editor, each paragraph, image, or video is presented as a distinct \u201Cblock\u201D of content." 11169 ) }) 11170 ] }) 11171 }, 11172 { 11173 image: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 11174 WelcomeGuideImage, 11175 { 11176 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", 11177 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" 11178 } 11179 ), 11180 content: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [ 11181 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n12.__)("Customize each block") }), 11182 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n12.__)( 11183 "Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected." 11184 ) }) 11185 ] }) 11186 }, 11187 { 11188 image: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 11189 WelcomeGuideImage, 11190 { 11191 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", 11192 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" 11193 } 11194 ), 11195 content: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [ 11196 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n12.__)("Explore all blocks") }), 11197 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_element26.createInterpolateElement)( 11198 (0, import_i18n12.__)( 11199 "All of the blocks available to you live in the block library. You\u2019ll find it wherever you see the <InserterIconImage /> icon." 11200 ), 11201 { 11202 InserterIconImage: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 11203 "img", 11204 { 11205 alt: (0, import_i18n12.__)("inserter"), 11206 src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A" 11207 } 11208 ) 11209 } 11210 ) }) 11211 ] }) 11212 }, 11213 { 11214 image: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 11215 WelcomeGuideImage, 11216 { 11217 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", 11218 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" 11219 } 11220 ), 11221 content: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [ 11222 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n12.__)("Learn more") }), 11223 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_element26.createInterpolateElement)( 11224 (0, import_i18n12.__)( 11225 "New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>" 11226 ), 11227 { 11228 a: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 11229 import_components6.ExternalLink, 11230 { 11231 href: (0, import_i18n12.__)( 11232 "https://wordpress.org/documentation/article/wordpress-block-editor/" 11233 ) 11234 } 11235 ) 11236 } 11237 ) }) 11238 ] }) 11239 } 11240 ] 11241 } 11242 ); 11243 } 11244 11245 // packages/edit-post/build-module/components/welcome-guide/template.mjs 11246 var import_data21 = __toESM(require_data(), 1); 11247 var import_components7 = __toESM(require_components(), 1); 11248 var import_i18n13 = __toESM(require_i18n(), 1); 11249 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); 11250 function WelcomeGuideTemplate() { 11251 const { toggleFeature: toggleFeature2 } = (0, import_data21.useDispatch)(store); 11252 return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( 11253 import_components7.Guide, 11254 { 11255 className: "edit-template-welcome-guide", 11256 contentLabel: (0, import_i18n13.__)("Welcome to the template editor"), 11257 finishButtonText: (0, import_i18n13.__)("Get started"), 11258 onFinish: () => toggleFeature2("welcomeGuideTemplate"), 11259 pages: [ 11260 { 11261 image: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( 11262 WelcomeGuideImage, 11263 { 11264 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg", 11265 animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif" 11266 } 11267 ), 11268 content: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [ 11269 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n13.__)("Welcome to the template editor") }), 11270 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n13.__)( 11271 "Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor." 11272 ) }) 11273 ] }) 11274 } 11275 ] 11276 } 11277 ); 11278 } 11279 11280 // packages/edit-post/build-module/components/welcome-guide/index.mjs 11281 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); 11282 function WelcomeGuide({ postType }) { 11283 const { isActive, isEditingTemplate: isEditingTemplate2 } = (0, import_data22.useSelect)( 11284 (select3) => { 11285 const { isFeatureActive: isFeatureActive2 } = select3(store); 11286 const _isEditingTemplate = postType === "wp_template"; 11287 const feature = _isEditingTemplate ? "welcomeGuideTemplate" : "welcomeGuide"; 11288 return { 11289 isActive: isFeatureActive2(feature), 11290 isEditingTemplate: _isEditingTemplate 11291 }; 11292 }, 11293 [postType] 11294 ); 11295 if (!isActive) { 11296 return null; 11297 } 11298 return isEditingTemplate2 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(WelcomeGuideTemplate, {}) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(WelcomeGuideDefault, {}); 11299 } 11300 11301 // packages/edit-post/build-module/commands/use-commands.mjs 11302 var import_data23 = __toESM(require_data(), 1); 11303 var import_i18n14 = __toESM(require_i18n(), 1); 11304 var import_commands = __toESM(require_commands(), 1); 11305 var import_preferences9 = __toESM(require_preferences(), 1); 11306 var import_notices2 = __toESM(require_notices(), 1); 11307 function useCommands() { 11308 const { isFullscreen } = (0, import_data23.useSelect)((select3) => { 11309 const { get } = select3(import_preferences9.store); 11310 return { 11311 isFullscreen: get("core/edit-post", "fullscreenMode") 11312 }; 11313 }, []); 11314 const { toggle } = (0, import_data23.useDispatch)(import_preferences9.store); 11315 const { createInfoNotice } = (0, import_data23.useDispatch)(import_notices2.store); 11316 (0, import_commands.useCommand)({ 11317 name: "core/toggle-fullscreen-mode", 11318 label: isFullscreen ? (0, import_i18n14.__)("Exit fullscreen") : (0, import_i18n14.__)("Enter fullscreen"), 11319 icon: fullscreen_default, 11320 category: "command", 11321 callback: ({ close }) => { 11322 toggle("core/edit-post", "fullscreenMode"); 11323 close(); 11324 createInfoNotice( 11325 isFullscreen ? (0, import_i18n14.__)("Fullscreen off.") : (0, import_i18n14.__)("Fullscreen on."), 11326 { 11327 id: "core/edit-post/toggle-fullscreen-mode/notice", 11328 type: "snackbar", 11329 actions: [ 11330 { 11331 label: (0, import_i18n14.__)("Undo"), 11332 onClick: () => { 11333 toggle("core/edit-post", "fullscreenMode"); 11334 } 11335 } 11336 ] 11337 } 11338 ); 11339 } 11340 }); 11341 } 11342 11343 // packages/edit-post/build-module/hooks/use-navigate-to-entity-record.mjs 11344 var import_element27 = __toESM(require_element(), 1); 11345 var import_data24 = __toESM(require_data(), 1); 11346 var import_editor17 = __toESM(require_editor(), 1); 11347 var import_core_data7 = __toESM(require_core_data(), 1); 11348 function useNavigateToEntityRecord(initialPostId, initialPostType, defaultRenderingMode) { 11349 const registry = (0, import_data24.useRegistry)(); 11350 const [postHistory, dispatch2] = (0, import_element27.useReducer)( 11351 (historyState, { type, post: post2, previousRenderingMode: previousRenderingMode2, selectedBlockClientId }) => { 11352 if (type === "push") { 11353 const updatedHistory = [...historyState]; 11354 const currentIndex = updatedHistory.length - 1; 11355 updatedHistory[currentIndex] = { 11356 ...updatedHistory[currentIndex], 11357 selectedBlockClientId 11358 }; 11359 return [...updatedHistory, { post: post2, previousRenderingMode: previousRenderingMode2 }]; 11360 } 11361 if (type === "pop") { 11362 if (historyState.length > 1) { 11363 return historyState.slice(0, -1); 11364 } 11365 } 11366 return historyState; 11367 }, 11368 [ 11369 { 11370 post: { postId: initialPostId, postType: initialPostType } 11371 } 11372 ] 11373 ); 11374 const { post, previousRenderingMode } = postHistory[postHistory.length - 1]; 11375 const { getRenderingMode } = (0, import_data24.useSelect)(import_editor17.store); 11376 const { setRenderingMode } = (0, import_data24.useDispatch)(import_editor17.store); 11377 const { editEntityRecord } = (0, import_data24.useDispatch)(import_core_data7.store); 11378 const onNavigateToEntityRecord = (0, import_element27.useCallback)( 11379 (params) => { 11380 const entityEdits = registry.select(import_core_data7.store).getEntityRecordEdits("postType", post.postType, post.postId); 11381 const externalClientId = entityEdits?.selection?.selectionStart?.clientId ?? null; 11382 dispatch2({ 11383 type: "push", 11384 post: { postId: params.postId, postType: params.postType }, 11385 // Save the current rendering mode so we can restore it when navigating back. 11386 previousRenderingMode: getRenderingMode(), 11387 selectedBlockClientId: externalClientId 11388 }); 11389 setRenderingMode(defaultRenderingMode); 11390 }, 11391 [ 11392 registry, 11393 post.postType, 11394 post.postId, 11395 getRenderingMode, 11396 setRenderingMode, 11397 defaultRenderingMode 11398 ] 11399 ); 11400 const onNavigateToPreviousEntityRecord = (0, import_element27.useCallback)(() => { 11401 if (postHistory.length > 1) { 11402 const previousItem = postHistory[postHistory.length - 2]; 11403 if (previousItem.selectedBlockClientId) { 11404 editEntityRecord( 11405 "postType", 11406 previousItem.post.postType, 11407 previousItem.post.postId, 11408 { 11409 selection: { 11410 selectionStart: { 11411 clientId: previousItem.selectedBlockClientId 11412 }, 11413 selectionEnd: { 11414 clientId: previousItem.selectedBlockClientId 11415 } 11416 } 11417 }, 11418 { undoIgnore: true } 11419 ); 11420 } 11421 } 11422 dispatch2({ 11423 type: "pop" 11424 }); 11425 if (previousRenderingMode) { 11426 setRenderingMode(previousRenderingMode); 11427 } 11428 }, [ 11429 setRenderingMode, 11430 previousRenderingMode, 11431 postHistory, 11432 editEntityRecord 11433 ]); 11434 return { 11435 currentPost: post, 11436 onNavigateToEntityRecord, 11437 onNavigateToPreviousEntityRecord: postHistory.length > 1 ? onNavigateToPreviousEntityRecord : void 0 11438 }; 11439 } 11440 11441 // packages/edit-post/build-module/components/meta-boxes/use-meta-box-initialization.mjs 11442 var import_data25 = __toESM(require_data(), 1); 11443 var import_editor18 = __toESM(require_editor(), 1); 11444 var import_core_data8 = __toESM(require_core_data(), 1); 11445 var import_element28 = __toESM(require_element(), 1); 11446 var useMetaBoxInitialization = (enabled) => { 11447 const { 11448 isEnabledAndEditorReady, 11449 isCollaborationEnabled, 11450 hasIncompatibleMetaBoxes, 11451 hasActiveMetaBoxes 11452 } = (0, import_data25.useSelect)( 11453 (select3) => { 11454 const { 11455 __unstableIsEditorReady, 11456 isCollaborationEnabledForCurrentPost 11457 } = unlock2(select3(import_editor18.store)); 11458 return { 11459 isEnabledAndEditorReady: enabled && __unstableIsEditorReady(), 11460 isCollaborationEnabled: isCollaborationEnabledForCurrentPost(), 11461 hasIncompatibleMetaBoxes: enabled ? select3(store).getAllMetaBoxes().some((metaBox) => !metaBox.__rtc_compatible) : false, 11462 hasActiveMetaBoxes: enabled && select3(store).hasMetaBoxes() 11463 }; 11464 }, 11465 [enabled] 11466 ); 11467 const { setCollaborationSupported } = unlock2((0, import_data25.useDispatch)(import_core_data8.store)); 11468 const { updateEditorSettings } = (0, import_data25.useDispatch)(import_editor18.store); 11469 const { initializeMetaBoxes: initializeMetaBoxes2 } = (0, import_data25.useDispatch)(store); 11470 (0, import_element28.useEffect)(() => { 11471 if (isEnabledAndEditorReady) { 11472 initializeMetaBoxes2(); 11473 if (isCollaborationEnabled && hasIncompatibleMetaBoxes) { 11474 setCollaborationSupported(false); 11475 } 11476 if (hasActiveMetaBoxes) { 11477 updateEditorSettings({ disableVisualRevisions: true }); 11478 } 11479 } 11480 }, [ 11481 isEnabledAndEditorReady, 11482 initializeMetaBoxes2, 11483 isCollaborationEnabled, 11484 setCollaborationSupported, 11485 hasIncompatibleMetaBoxes, 11486 hasActiveMetaBoxes, 11487 updateEditorSettings 11488 ]); 11489 }; 11490 11491 // packages/edit-post/build-module/components/layout/index.mjs 11492 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); 11493 var { useCommandContext } = unlock2(import_commands2.privateApis); 11494 var { useDrag } = unlock2(import_components8.privateApis); 11495 var { Editor, FullscreenMode, UploadProgressSnackbar } = unlock2(import_editor19.privateApis); 11496 var DESIGN_POST_TYPES = [ 11497 "wp_template", 11498 "wp_template_part", 11499 "wp_block", 11500 "wp_navigation" 11501 ]; 11502 function useEditorStyles(settings) { 11503 const { hasThemeStyleSupport } = (0, import_data26.useSelect)((select3) => { 11504 return { 11505 hasThemeStyleSupport: select3(store).isFeatureActive("themeStyles") 11506 }; 11507 }, []); 11508 return (0, import_element29.useMemo)(() => { 11509 const presetStyles = settings.styles?.filter( 11510 (style) => style.__unstableType && style.__unstableType !== "theme" 11511 ) ?? []; 11512 const defaultEditorStyles = [ 11513 ...settings?.defaultEditorStyles ?? [], 11514 ...presetStyles 11515 ]; 11516 const hasThemeStyles = hasThemeStyleSupport && presetStyles.length !== (settings.styles?.length ?? 0); 11517 if (!settings.disableLayoutStyles && !hasThemeStyles) { 11518 defaultEditorStyles.push({ 11519 css: getLayoutStyles({ 11520 style: {}, 11521 selector: "body", 11522 hasBlockGapSupport: false, 11523 hasFallbackGapSupport: true, 11524 fallbackGapValue: "0.5em" 11525 }) 11526 }); 11527 } 11528 return hasThemeStyles ? settings.styles ?? [] : defaultEditorStyles; 11529 }, [ 11530 settings.defaultEditorStyles, 11531 settings.disableLayoutStyles, 11532 settings.styles, 11533 hasThemeStyleSupport 11534 ]); 11535 } 11536 function MetaBoxesMain() { 11537 const [isOpen, openHeight, hasAnyVisible] = (0, import_data26.useSelect)((select3) => { 11538 const { get } = select3(import_preferences10.store); 11539 const { isMetaBoxLocationVisible: isMetaBoxLocationVisible2 } = select3(store); 11540 return [ 11541 !!get("core/edit-post", "metaBoxesMainIsOpen"), 11542 get("core/edit-post", "metaBoxesMainOpenHeight"), 11543 isMetaBoxLocationVisible2("normal") || isMetaBoxLocationVisible2("advanced") || isMetaBoxLocationVisible2("side") 11544 ]; 11545 }, []); 11546 const { set: setPreference } = (0, import_data26.useDispatch)(import_preferences10.store); 11547 const isShort = (0, import_compose2.useMediaQuery)("(max-height: 549px)"); 11548 const [{ min: min2 = 0, max: max2 }, setHeightConstraints] = (0, import_element29.useState)(() => ({})); 11549 const effectSizeConstraints = (0, import_compose2.useRefEffect)((node) => { 11550 const container = node.closest( 11551 ".interface-interface-skeleton__content" 11552 ); 11553 if (!container) { 11554 return; 11555 } 11556 const noticeContainer = container.querySelector(".editor-notices"); 11557 const resizeHandle = container.querySelector( 11558 ".edit-post-meta-boxes-main__presenter" 11559 ); 11560 const deriveConstraints = () => { 11561 const fullHeight = container.offsetHeight; 11562 let nextMax = fullHeight; 11563 if (noticeContainer) { 11564 nextMax -= noticeContainer.offsetHeight; 11565 } 11566 const nextMin = resizeHandle?.offsetHeight ?? 0; 11567 setHeightConstraints({ min: nextMin, max: nextMax }); 11568 }; 11569 const observer = new window.ResizeObserver(deriveConstraints); 11570 observer.observe(container); 11571 if (noticeContainer) { 11572 observer.observe(noticeContainer); 11573 } 11574 return () => observer.disconnect(); 11575 }, []); 11576 const metaBoxesMainRef = (0, import_element29.useRef)(); 11577 const setMainRefs = (0, import_compose2.useMergeRefs)([ 11578 metaBoxesMainRef, 11579 effectSizeConstraints 11580 ]); 11581 const separatorRef = (0, import_element29.useRef)(); 11582 const separatorHelpId = (0, import_element29.useId)(); 11583 const heightRef = (0, import_element29.useRef)(); 11584 const getAriaValueNow = (height) => Math.round((height - min2) / (max2 - min2) * 100); 11585 const persistIsOpen = (to = !isOpen) => setPreference("core/edit-post", "metaBoxesMainIsOpen", to); 11586 const applyHeight = (candidateHeight = "auto", isPersistent) => { 11587 let styleHeight; 11588 if (candidateHeight === "auto") { 11589 isPersistent = false; 11590 styleHeight = candidateHeight; 11591 } else { 11592 candidateHeight = Math.min(max2, Math.max(min2, candidateHeight)); 11593 heightRef.current = candidateHeight; 11594 styleHeight = `$candidateHeight}px`; 11595 } 11596 if (isPersistent) { 11597 setPreference( 11598 "core/edit-post", 11599 "metaBoxesMainOpenHeight", 11600 candidateHeight 11601 ); 11602 } else { 11603 metaBoxesMainRef.current.style.height = styleHeight; 11604 if (!isShort) { 11605 separatorRef.current.ariaValueNow = getAriaValueNow(candidateHeight); 11606 } 11607 } 11608 }; 11609 const bindDragGesture = useDrag( 11610 ({ movement, first, last, memo, tap, args }) => { 11611 const pane = metaBoxesMainRef.current; 11612 const [, yMovement] = movement; 11613 if (first) { 11614 pane.classList.add("is-resizing"); 11615 let fromHeight = heightRef.current ?? pane.offsetHeight; 11616 if (isOpen) { 11617 if (fromHeight > max2) { 11618 fromHeight = max2; 11619 } 11620 } else { 11621 fromHeight = min2; 11622 } 11623 applyHeight(fromHeight - yMovement); 11624 return { fromHeight }; 11625 } 11626 if (!first && !last && !tap) { 11627 applyHeight(memo.fromHeight - yMovement); 11628 return memo; 11629 } 11630 pane.classList.remove("is-resizing"); 11631 if (tap) { 11632 const [onTap] = args; 11633 onTap?.(); 11634 return; 11635 } 11636 const nextIsOpen = heightRef.current > min2; 11637 persistIsOpen(nextIsOpen); 11638 applyHeight(heightRef.current, nextIsOpen); 11639 }, 11640 { keyboardDisplacement: 20, filterTaps: true } 11641 ); 11642 if (!hasAnyVisible) { 11643 return; 11644 } 11645 const contents = /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)( 11646 "div", 11647 { 11648 className: "edit-post-layout__metaboxes edit-post-meta-boxes-main__liner", 11649 hidden: !isOpen, 11650 children: [ 11651 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MetaBoxes, { location: "normal" }), 11652 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MetaBoxes, { location: "advanced" }) 11653 ] 11654 } 11655 ); 11656 const isAutoHeight = openHeight === void 0; 11657 const usedOpenHeight = isShort ? "auto" : openHeight; 11658 const usedHeight = isOpen ? usedOpenHeight : min2; 11659 const usedAriaValueNow = max2 === void 0 || isAutoHeight ? 50 : getAriaValueNow(usedHeight); 11660 const paneLabel = (0, import_i18n15.__)("Meta Boxes"); 11661 const toggle = /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)( 11662 "button", 11663 { 11664 "aria-expanded": isOpen, 11665 onClick: ({ detail }) => { 11666 if (isShort || !detail) { 11667 persistIsOpen(); 11668 } 11669 }, 11670 ...!isShort && bindDragGesture(persistIsOpen), 11671 children: [ 11672 paneLabel, 11673 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components8.Icon, { icon: isOpen ? chevron_up_default : chevron_down_default }) 11674 ] 11675 } 11676 ); 11677 const separator = !isShort && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [ 11678 /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(tooltip_exports.Root, { children: [ 11679 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( 11680 tooltip_exports.Trigger, 11681 { 11682 render: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( 11683 "button", 11684 { 11685 ref: separatorRef, 11686 role: "separator", 11687 "aria-valuenow": usedAriaValueNow, 11688 "aria-label": (0, import_i18n15.__)("Drag to resize"), 11689 "aria-describedby": separatorHelpId, 11690 ...bindDragGesture() 11691 } 11692 ) 11693 } 11694 ), 11695 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(tooltip_exports.Popup, { children: (0, import_i18n15.__)("Drag to resize") }) 11696 ] }), 11697 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(VisuallyHidden, { id: separatorHelpId, children: (0, import_i18n15.__)( 11698 "Use up and down arrow keys to resize the meta box pane." 11699 ) }) 11700 ] }); 11701 return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)( 11702 navigable_region_default, 11703 { 11704 ariaLabel: paneLabel, 11705 ref: setMainRefs, 11706 className: clsx_default( 11707 "edit-post-meta-boxes-main", 11708 !isShort && "is-resizable" 11709 ), 11710 style: { height: usedHeight }, 11711 children: [ 11712 /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "edit-post-meta-boxes-main__presenter", children: [ 11713 toggle, 11714 separator 11715 ] }), 11716 contents 11717 ] 11718 } 11719 ); 11720 } 11721 function Layout({ 11722 postId: initialPostId, 11723 postType: initialPostType, 11724 settings, 11725 initialEdits 11726 }) { 11727 useCommands(); 11728 const { createErrorNotice } = (0, import_data26.useDispatch)(import_notices3.store); 11729 const { 11730 currentPost: { postId: currentPostId, postType: currentPostType }, 11731 onNavigateToEntityRecord, 11732 onNavigateToPreviousEntityRecord 11733 } = useNavigateToEntityRecord( 11734 initialPostId, 11735 initialPostType, 11736 "post-only" 11737 ); 11738 const isEditingTemplate2 = currentPostType === "wp_template"; 11739 const { 11740 mode, 11741 isFullscreenActive, 11742 hasResolvedMode, 11743 hasActiveMetaboxes, 11744 hasBlockSelected, 11745 showIconLabels, 11746 isDistractionFree, 11747 showMetaBoxes, 11748 isWelcomeGuideVisible, 11749 templateId 11750 } = (0, import_data26.useSelect)( 11751 (select3) => { 11752 const { get } = select3(import_preferences10.store); 11753 const { isFeatureActive: isFeatureActive2, hasMetaBoxes: hasMetaBoxes2 } = select3(store); 11754 const { canUser, getPostType, getTemplateId } = unlock2( 11755 select3(import_core_data9.store) 11756 ); 11757 const supportsTemplateMode = settings.supportsTemplateMode; 11758 const isViewable = getPostType(currentPostType)?.viewable ?? false; 11759 const canViewTemplate = canUser("read", { 11760 kind: "postType", 11761 name: "wp_template" 11762 }); 11763 const { getBlockSelectionStart, isZoomOut } = unlock2( 11764 select3(import_block_editor2.store) 11765 ); 11766 const { getEditorMode: getEditorMode2, getDefaultRenderingMode } = unlock2( 11767 select3(import_editor19.store) 11768 ); 11769 const isNotDesignPostType = !DESIGN_POST_TYPES.includes(currentPostType); 11770 const isDirectlyEditingPattern = currentPostType === "wp_block" && !onNavigateToPreviousEntityRecord; 11771 const _templateId = getTemplateId(currentPostType, currentPostId); 11772 const defaultMode = getDefaultRenderingMode(currentPostType); 11773 return { 11774 mode: getEditorMode2(), 11775 isFullscreenActive: isFeatureActive2("fullscreenMode"), 11776 hasActiveMetaboxes: hasMetaBoxes2(), 11777 hasResolvedMode: defaultMode === "template-locked" ? !!_templateId : defaultMode !== void 0, 11778 hasBlockSelected: !!getBlockSelectionStart(), 11779 showIconLabels: get("core", "showIconLabels"), 11780 isDistractionFree: get("core", "distractionFree"), 11781 showMetaBoxes: isNotDesignPostType && !isZoomOut() || isDirectlyEditingPattern, 11782 isWelcomeGuideVisible: isFeatureActive2("welcomeGuide"), 11783 templateId: supportsTemplateMode && isViewable && canViewTemplate && !isEditingTemplate2 ? _templateId : null 11784 }; 11785 }, 11786 [ 11787 currentPostType, 11788 currentPostId, 11789 isEditingTemplate2, 11790 settings.supportsTemplateMode, 11791 onNavigateToPreviousEntityRecord 11792 ] 11793 ); 11794 useMetaBoxInitialization(hasActiveMetaboxes && hasResolvedMode); 11795 const commandContext = hasBlockSelected ? "block-selection-edit" : "entity-edit"; 11796 useCommandContext(commandContext); 11797 const styles = useEditorStyles(settings); 11798 const editorSettings = (0, import_element29.useMemo)( 11799 () => ({ 11800 ...settings, 11801 styles, 11802 onNavigateToEntityRecord, 11803 onNavigateToPreviousEntityRecord 11804 }), 11805 [ 11806 settings, 11807 styles, 11808 onNavigateToEntityRecord, 11809 onNavigateToPreviousEntityRecord 11810 ] 11811 ); 11812 if (showIconLabels) { 11813 document.body.classList.add("show-icon-labels"); 11814 } else { 11815 document.body.classList.remove("show-icon-labels"); 11816 } 11817 const navigateRegionsProps = (0, import_components8.__unstableUseNavigateRegions)(); 11818 const className = clsx_default("edit-post-layout", "is-mode-" + mode, { 11819 "has-metaboxes": hasActiveMetaboxes 11820 }); 11821 function onPluginAreaError(name) { 11822 createErrorNotice( 11823 (0, import_i18n15.sprintf)( 11824 /* translators: %s: plugin name */ 11825 (0, import_i18n15.__)( 11826 'The "%s" plugin has encountered an error and cannot be rendered.' 11827 ), 11828 name 11829 ) 11830 ); 11831 } 11832 const { createSuccessNotice } = (0, import_data26.useDispatch)(import_notices3.store); 11833 const onActionPerformed = (0, import_element29.useCallback)( 11834 (actionId, items) => { 11835 switch (actionId) { 11836 case "move-to-trash": 11837 { 11838 document.location.href = (0, import_url6.addQueryArgs)("edit.php", { 11839 trashed: 1, 11840 post_type: items[0].type, 11841 ids: items[0].id 11842 }); 11843 } 11844 break; 11845 case "permanently-delete": 11846 { 11847 document.location.href = (0, import_url6.addQueryArgs)("edit.php", { 11848 deleted: 1, 11849 post_type: items[0].type 11850 }); 11851 } 11852 break; 11853 case "duplicate-post": 11854 { 11855 const newItem = items[0]; 11856 const title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered; 11857 createSuccessNotice( 11858 (0, import_i18n15.sprintf)( 11859 // translators: %s: Title of the created post or template, e.g: "Hello world". 11860 (0, import_i18n15.__)('"%s" successfully created.'), 11861 (0, import_html_entities.decodeEntities)(title) || (0, import_i18n15.__)("(no title)") 11862 ), 11863 { 11864 type: "snackbar", 11865 id: "duplicate-post-action", 11866 actions: [ 11867 { 11868 label: (0, import_i18n15.__)("Edit"), 11869 onClick: () => { 11870 const postId = newItem.id; 11871 document.location.href = (0, import_url6.addQueryArgs)("post.php", { 11872 post: postId, 11873 action: "edit" 11874 }); 11875 } 11876 } 11877 ] 11878 } 11879 ); 11880 } 11881 break; 11882 } 11883 }, 11884 [createSuccessNotice] 11885 ); 11886 const initialPost = (0, import_element29.useMemo)(() => { 11887 return { 11888 type: initialPostType, 11889 id: initialPostId 11890 }; 11891 }, [initialPostType, initialPostId]); 11892 const backButton = (0, import_compose2.useViewportMatch)("medium") && isFullscreenActive ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(back_button_default, { initialPost }) : null; 11893 const adminPrimary = (0, import_element29.useMemo)(() => getAdminThemeColors().primary, []); 11894 return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components8.SlotFillProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(tooltip_exports.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_theme.ThemeProvider, { isRoot: true, color: { primary: adminPrimary }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_editor19.ErrorBoundary, { canCopyContent: true, children: [ 11895 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(WelcomeGuide, { postType: currentPostType }), 11896 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { ...navigateRegionsProps, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)( 11897 Editor, 11898 { 11899 settings: editorSettings, 11900 initialEdits: currentPostId === initialPostId && currentPostType === initialPostType ? initialEdits : void 0, 11901 postType: currentPostType, 11902 postId: currentPostId, 11903 templateId, 11904 className, 11905 forceIsDirty: hasActiveMetaboxes, 11906 autoFocus: !isWelcomeGuideVisible, 11907 onActionPerformed, 11908 extraSidebarPanels: showMetaBoxes && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MetaBoxes, { location: "side" }), 11909 extraContent: !isDistractionFree && showMetaBoxes && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MetaBoxesMain, {}), 11910 children: [ 11911 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_editor19.PostLockedModal, {}), 11912 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(EditorInitialization, {}), 11913 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( 11914 FullscreenMode, 11915 { 11916 isActive: isFullscreenActive 11917 } 11918 ), 11919 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(BrowserURL, {}), 11920 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_editor19.UnsavedChangesWarning, {}), 11921 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_editor19.AutosaveMonitor, {}), 11922 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_editor19.LocalAutosaveMonitor, {}), 11923 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(keyboard_shortcuts_default, {}), 11924 currentPostType === "wp_block" && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(InitPatternModal, {}), 11925 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_plugins.PluginArea, { onError: onPluginAreaError }), 11926 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(more_menu_default, {}), 11927 backButton, 11928 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_notices3.SnackbarNotices, { className: "edit-post-layout__snackbar" }), 11929 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(UploadProgressSnackbar, {}) 11930 ] 11931 } 11932 ) }) 11933 ] }) }) }) }); 11934 } 11935 var layout_default = Layout; 11936 11937 // packages/edit-post/build-module/deprecated.mjs 11938 var import_editor20 = __toESM(require_editor(), 1); 11939 var import_url7 = __toESM(require_url(), 1); 11940 var import_deprecated3 = __toESM(require_deprecated(), 1); 11941 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); 11942 var { PluginPostExcerpt } = unlock2(import_editor20.privateApis); 11943 var isSiteEditor = (0, import_url7.getPath)(window.location.href)?.includes( 11944 "site-editor.php" 11945 ); 11946 var deprecateSlot = (name) => { 11947 (0, import_deprecated3.default)(`wp.editPost.$name}`, { 11948 since: "6.6", 11949 alternative: `wp.editor.$name}` 11950 }); 11951 }; 11952 function PluginBlockSettingsMenuItem(props) { 11953 if (isSiteEditor) { 11954 return null; 11955 } 11956 deprecateSlot("PluginBlockSettingsMenuItem"); 11957 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor20.PluginBlockSettingsMenuItem, { ...props }); 11958 } 11959 function PluginDocumentSettingPanel(props) { 11960 if (isSiteEditor) { 11961 return null; 11962 } 11963 deprecateSlot("PluginDocumentSettingPanel"); 11964 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor20.PluginDocumentSettingPanel, { ...props }); 11965 } 11966 function PluginMoreMenuItem(props) { 11967 if (isSiteEditor) { 11968 return null; 11969 } 11970 deprecateSlot("PluginMoreMenuItem"); 11971 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor20.PluginMoreMenuItem, { ...props }); 11972 } 11973 function PluginPrePublishPanel(props) { 11974 if (isSiteEditor) { 11975 return null; 11976 } 11977 deprecateSlot("PluginPrePublishPanel"); 11978 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor20.PluginPrePublishPanel, { ...props }); 11979 } 11980 function PluginPostPublishPanel(props) { 11981 if (isSiteEditor) { 11982 return null; 11983 } 11984 deprecateSlot("PluginPostPublishPanel"); 11985 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor20.PluginPostPublishPanel, { ...props }); 11986 } 11987 function PluginPostStatusInfo(props) { 11988 if (isSiteEditor) { 11989 return null; 11990 } 11991 deprecateSlot("PluginPostStatusInfo"); 11992 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor20.PluginPostStatusInfo, { ...props }); 11993 } 11994 function PluginSidebar(props) { 11995 if (isSiteEditor) { 11996 return null; 11997 } 11998 deprecateSlot("PluginSidebar"); 11999 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor20.PluginSidebar, { ...props }); 12000 } 12001 function PluginSidebarMoreMenuItem(props) { 12002 if (isSiteEditor) { 12003 return null; 12004 } 12005 deprecateSlot("PluginSidebarMoreMenuItem"); 12006 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor20.PluginSidebarMoreMenuItem, { ...props }); 12007 } 12008 function __experimentalPluginPostExcerpt() { 12009 if (isSiteEditor) { 12010 return null; 12011 } 12012 (0, import_deprecated3.default)("wp.editPost.__experimentalPluginPostExcerpt", { 12013 since: "6.6", 12014 hint: "Core and custom panels can be access programmatically using their panel name.", 12015 link: "https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically" 12016 }); 12017 return PluginPostExcerpt; 12018 } 12019 12020 // packages/edit-post/build-module/index.mjs 12021 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); 12022 var { 12023 BackButton: __experimentalMainDashboardButton, 12024 registerCoreBlockBindingsSources 12025 } = unlock2(import_editor21.privateApis); 12026 var { enablePreloadMultiUse, clearPreloadedData } = unlock2( 12027 import_api_fetch2.default.privateApis 12028 ); 12029 function initializeEditor(id, postType, postId, settings, initialEdits) { 12030 const target = document.getElementById(id); 12031 const root = (0, import_element30.createRoot)(target); 12032 (0, import_data27.dispatch)(import_preferences11.store).setDefaults("core/edit-post", { 12033 fullscreenMode: true, 12034 themeStyles: true, 12035 welcomeGuide: true, 12036 welcomeGuideTemplate: true 12037 }); 12038 (0, import_data27.dispatch)(import_preferences11.store).setDefaults("core", { 12039 allowRightClickOverrides: true, 12040 editorMode: "visual", 12041 fixedToolbar: false, 12042 hiddenBlockTypes: [], 12043 inactivePanels: [], 12044 openPanels: ["post-status"], 12045 showBlockBreadcrumbs: true, 12046 showIconLabels: false, 12047 showListViewByDefault: false, 12048 enableChoosePatternModal: true, 12049 isPublishSidebarEnabled: true, 12050 showCollaborationCursor: false, 12051 showCollaborationJoinNotifications: true, 12052 showCollaborationLeaveNotifications: true, 12053 showCollaborationPostSaveNotifications: true 12054 }); 12055 if (window.__clientSideMediaProcessing) { 12056 (0, import_data27.dispatch)(import_preferences11.store).setDefaults("core/media", { 12057 requireApproval: true, 12058 optimizeOnUpload: true 12059 }); 12060 } 12061 (0, import_data27.dispatch)(import_blocks2.store).reapplyBlockTypeFilters(); 12062 (0, import_block_library.registerCoreBlocks)(); 12063 registerCoreBlockBindingsSources(); 12064 (0, import_widgets.registerLegacyWidgetBlock)({ inserter: false }); 12065 (0, import_widgets.registerWidgetGroupBlock)({ inserter: false }); 12066 if (false) { 12067 (0, import_block_library.__experimentalRegisterExperimentalCoreBlocks)({ 12068 enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks 12069 }); 12070 } 12071 const documentMode = document.compatMode === "CSS1Compat" ? "Standards" : "Quirks"; 12072 if (documentMode !== "Standards") { 12073 console.warn( 12074 "Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins." 12075 ); 12076 } 12077 window.addEventListener("dragover", (e) => e.preventDefault(), false); 12078 window.addEventListener("drop", (e) => e.preventDefault(), false); 12079 enablePreloadMultiUse(); 12080 const preloadedResolutions = preloadResolutions(postType, postId); 12081 preloadedResolutions.finally(() => { 12082 clearPreloadedData(); 12083 if (postType && postId) { 12084 const post = (0, import_data27.select)(import_core_data10.store).getEntityRecord( 12085 "postType", 12086 postType, 12087 postId 12088 ); 12089 if (post) { 12090 (0, import_data27.dispatch)(import_editor21.store).setupEditor( 12091 post, 12092 initialEdits, 12093 settings.template 12094 ); 12095 } 12096 } 12097 root.render( 12098 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_element30.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( 12099 layout_default, 12100 { 12101 settings, 12102 postId, 12103 postType, 12104 initialEdits 12105 } 12106 ) }) 12107 ); 12108 }); 12109 return root; 12110 } 12111 async function preloadResolutions(postType, postId) { 12112 const core = (0, import_data27.resolveSelect)(import_core_data10.store); 12113 const coreSelect = (0, import_data27.select)(import_core_data10.store); 12114 try { 12115 await Promise.all([ 12116 core.getCurrentUser(), 12117 core.getEntitiesConfig("postType"), 12118 core.getEntitiesConfig("taxonomy"), 12119 core.getEntitiesConfig("root"), 12120 core.getEntityRecords("root", "taxonomy"), 12121 core.getCurrentTheme(), 12122 // Forward-resolver alias of `getCurrentTheme` with its own 12123 // resolution metadata, so it needs a separate kick. 12124 core.getThemeSupports(), 12125 core.getBlockPatternCategories(), 12126 core.__experimentalGetCurrentGlobalStylesId(), 12127 core.__experimentalGetCurrentThemeBaseGlobalStyles(), 12128 core.__experimentalGetCurrentThemeGlobalStylesVariations(), 12129 core.getEntityRecord("root", "__unstableBase"), 12130 core.canUser("read", { kind: "root", name: "site" }), 12131 core.canUser("create", { kind: "postType", name: "attachment" }), 12132 core.canUser("create", { kind: "postType", name: "page" }), 12133 core.canUser("create", { kind: "postType", name: "wp_block" }), 12134 core.canUser("create", { 12135 kind: "postType", 12136 name: "wp_template" 12137 }), 12138 // The inspector requests the entity form config when the document 12139 // sidebar mounts. The args must match the `useViewConfig` call in 12140 // `@wordpress/views` exactly for the resolution (and its preload 12141 // entry) to be shared. 12142 ...postType ? [ 12143 unlock2(core).getViewConfig("postType", postType, { 12144 fields: "form" 12145 }), 12146 // The fields of the post type, which the DataForm post 12147 // summary reads with `useFields`. The summary reports a 12148 // failure of its own, so this must not cut the rest of 12149 // the kickoff short. 12150 unlock2(core).getFieldsConfig("postType", postType).catch(() => { 12151 }) 12152 ] : [], 12153 // The actions of the post type, which the actions menu of the 12154 // document sidebar reads with `useEntityActions`. It reports a failure 12155 // of its own, so this must not cut the rest of the kickoff short. 12156 ...postType ? [ 12157 unlock2(core).getEntityActionsConfig("postType", postType).catch(() => { 12158 }) 12159 ] : [], 12160 // Per-post resolvers. `getPostType` and `getEditedEntityRecord` 12161 // are shorthand/forward-resolver aliases with their own 12162 // resolution metadata, so they need separate kicks. 12163 ...postType && postId ? [ 12164 core.getPostType(postType), 12165 core.getEntityRecord("postType", postType, postId), 12166 core.getEditedEntityRecord( 12167 "postType", 12168 postType, 12169 postId 12170 ), 12171 core.getAutosaves(postType, postId), 12172 core.getDefaultTemplateId({ slug: "front-page" }), 12173 core.canUser("create", { 12174 kind: "postType", 12175 name: postType 12176 }) 12177 ] : [] 12178 ]); 12179 const tasks = []; 12180 if (coreSelect.canUser("read", { kind: "root", name: "site" })) { 12181 tasks.push(core.getEntityRecord("root", "site")); 12182 } 12183 const globalStylesId = coreSelect.__experimentalGetCurrentGlobalStylesId(); 12184 if (globalStylesId) { 12185 tasks.push( 12186 core.canUser("update", { 12187 kind: "root", 12188 name: "globalStyles", 12189 id: globalStylesId 12190 }) 12191 ); 12192 } 12193 if (postType && postId) { 12194 const post = coreSelect.getEntityRecord( 12195 "postType", 12196 postType, 12197 postId 12198 ); 12199 if (post) { 12200 let slug = "page" === postType ? "page" : "single-" + postType; 12201 if (post.slug) { 12202 slug += "-" + post.slug; 12203 } 12204 tasks.push(core.getDefaultTemplateId({ slug })); 12205 } 12206 } 12207 if (tasks.length) { 12208 await Promise.all(tasks); 12209 } 12210 if (globalStylesId) { 12211 if (coreSelect.canUser("update", { 12212 kind: "root", 12213 name: "globalStyles", 12214 id: globalStylesId 12215 })) { 12216 await core.getEntityRecord( 12217 "root", 12218 "globalStyles", 12219 globalStylesId 12220 ); 12221 } else { 12222 await core.getEntityRecord( 12223 "root", 12224 "globalStyles", 12225 globalStylesId, 12226 { context: "view" } 12227 ); 12228 } 12229 } 12230 } catch { 12231 } 12232 } 12233 function reinitializeEditor() { 12234 (0, import_deprecated4.default)("wp.editPost.reinitializeEditor", { 12235 since: "6.2", 12236 version: "6.3" 12237 }); 12238 } 12239 return __toCommonJS(index_exports); 12240 })(); 12241 /*! Bundled license information: 12242 12243 use-sync-external-store/cjs/use-sync-external-store-shim.development.js: 12244 (** 12245 * @license React 12246 * use-sync-external-store-shim.development.js 12247 * 12248 * Copyright (c) Meta Platforms, Inc. and affiliates. 12249 * 12250 * This source code is licensed under the MIT license found in the 12251 * LICENSE file in the root directory of this source tree. 12252 *) 12253 12254 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: 12255 (** 12256 * @license React 12257 * use-sync-external-store-shim/with-selector.development.js 12258 * 12259 * Copyright (c) Meta Platforms, Inc. and affiliates. 12260 * 12261 * This source code is licensed under the MIT license found in the 12262 * LICENSE file in the root directory of this source tree. 12263 *) 12264 */ 12265 (window.wp ||= {}).editPost = wp.editPost; 12266 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Fri Oct 23 08:20:34 2026 | Cross-referenced by PHPXref |